[Ffmpeg-devel] BUG in H264.C

Chengji Zhao czhao
Fri Jun 10 03:15:56 CEST 2005


Dear all, 

I reported this bug yesterday, but seems got no response. 
Actually this is the bug which make ffmpeg h264 decodr 
cannot decode multiple sliced bitstream correctly. So I decide to
post it again.


the following code is copied from decode_ref_pic_marking( )

if(h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count)
{ //FIXME fields
                h->mmco[0].opcode= MMCO_SHORT2UNUSED;
                h->mmco[0].short_frame_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num;
                h->mmco_index= 1;
            }else
                h->mmco_index= 0;


we can see that whenever the total number of reference pictures equals to ref_frame_count, one mmco command of 
MMCO_SHORT2UNUSED will be 
inserted into the command queue. 
This is right only when the number of slices within a picture is 1. 
Imaging when we have multiple slices for a picture, function of decode_ref_pic_marking() will be called 
multiple times, therefore  mulitple commands of  MMCO_SHORT2UNUSED will be insert into
the command queue. As such, many reference frame in the ref_list will be erased. 
To fix this bug, we can simply move this part of the code to execute_ref_pic_marking().  


Best regards
Chengji





More information about the ffmpeg-devel mailing list