On Tue, Aug 16, 2011 at 2:41 PM, Ronald S. Bultje <rsbul...@gmail.com> wrote: > Hi, > > On Tue, Aug 16, 2011 at 8:05 AM, Diego Biurrun <di...@biurrun.de> wrote: >> From: Jeff Downs <heydo...@somuchpressure.net> >> >> Correct computation of implicit weight tables when referencing pictures >> that are marked for long reference. >> >> Signed-off-by: Diego Biurrun <di...@biurrun.de> >> --- >> libavcodec/h264.c | 20 +++++++++++--------- >> 1 files changed, 11 insertions(+), 9 deletions(-) >> >> diff --git a/libavcodec/h264.c b/libavcodec/h264.c >> index a9a6c8c..5d42ed3 100644 >> --- a/libavcodec/h264.c >> +++ b/libavcodec/h264.c >> @@ -2174,15 +2174,17 @@ static void implicit_weight_table(H264Context *h, >> int field){ >> for(ref0=ref_start; ref0 < ref_count0; ref0++){ >> int poc0 = h->ref_list[0][ref0].poc; >> for(ref1=ref_start; ref1 < ref_count1; ref1++){ >> - int poc1 = h->ref_list[1][ref1].poc; >> - int td = av_clip(poc1 - poc0, -128, 127); >> - int w= 32; >> - if(td){ >> - int tb = av_clip(cur_poc - poc0, -128, 127); >> - int tx = (16384 + (FFABS(td) >> 1)) / td; >> - int dist_scale_factor = (tb*tx + 32) >> 8; >> - if(dist_scale_factor >= -64 && dist_scale_factor <= 128) >> - w = 64 - dist_scale_factor; >> + int w = 32; >> + if (!h->ref_list[0][ref0].long_ref && >> !h->ref_list[1][ref1].long_ref) { >> + int poc1 = h->ref_list[1][ref1].poc; >> + int td = av_clip(poc1 - poc0, -128, 127); >> + if(td){ >> + int tb = av_clip(cur_poc - poc0, -128, 127); >> + int tx = (16384 + (FFABS(td) >> 1)) / td; >> + int dist_scale_factor = (tb*tx + 32) >> 8; >> + if(dist_scale_factor >= -64 && dist_scale_factor <= 128) >> + w = 64 - dist_scale_factor; >> + } > > Which sample/bug does this fix? I really have no idea if this is > correct without spending some significant time on the spec right > now... Jason, Loren, do you guys know?
if( td == 0 /* || pic0 is a long-term ref */ ) dist_scale_factor = 256; Going by x264 code, this seems correct. Jason _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel