[FFmpeg-devel] [BUG] h264 picture reordering fails

Haruhiko Yamagata h.yamagata
Wed Jun 3 12:04:57 CEST 2009

>On Sat, May 30, 2009 at 07:34:32PM +0900, Haruhiko Yamagata wrote:
>> I found picture reordering fails in
>> http://x264.nl/h.264.samples/premiere-paff.ts
>> Outputted pictures have POC {-4, -2, 4, 0, 2, 6}.
>> Are negative POCs allowed?
>> If yes, zero as POC is valid as well.
>> But, in h264.c decode_frame,
>>            for(i=1; h->delayed_pic[i] && (h->delayed_pic[i]->poc && 
>> !h->delayed_pic[i]->key_frame); i++)
>> This code assume poc zero is special. The case above is not supported.
>> If I comment out /* h->delayed_pic[i]->poc && */, then it works for the 
>> sample.
>> This is just a bug report, but if you give me a hint, I'm willing to work 
>> on this.
>is has_b_frames set to the correct value?
>about POCs, IIRC the spec requires POC=0 to be true and only true for
>IDR pictures, but i might misremember (would have to check the spec)
>What i do know is that the POC or frame number == 0 rules in the spec
>are not followed by some encoders.

A patch attaced.
I'm not sure how correct this is, but it fixes the bug without breaking anything.

Best regards,
Haruhiko Yamagata
-------------- next part --------------
A non-text attachment was scrubbed...
Name: disallow_poc_msb_below_zero.patch
Type: application/octet-stream
Size: 672 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090603/62b91e2c/attachment.obj>

More information about the ffmpeg-devel mailing list