Revision b5ca0c6f libavcodec/h263.c

View differences:

libavcodec/h263.c
3188 3188
 * @return 0 if not
3189 3189
 */
3190 3190
static inline int mpeg4_is_resync(MpegEncContext *s){
3191
    const int bits_count= get_bits_count(&s->gb);
3191
    int bits_count= get_bits_count(&s->gb);
3192
    int v= show_bits(&s->gb, 16);
3192 3193

  
3193 3194
    if(s->workaround_bugs&FF_BUG_NO_PADDING){
3194 3195
        return 0;
3195 3196
    }
3196 3197

  
3198
    while(v<=0xFF){
3199
        if(s->pict_type==B_TYPE || (v>>(8-s->pict_type)!=1))
3200
            break;
3201
        skip_bits(&s->gb, 8+s->pict_type);
3202
        bits_count+= 8+s->pict_type;
3203
        v= show_bits(&s->gb, 16);
3204
    }
3205

  
3197 3206
    if(bits_count + 8 >= s->gb.size_in_bits){
3198
        int v= show_bits(&s->gb, 8);
3207
        v>>=8;
3199 3208
        v|= 0x7F >> (7-(bits_count&7));
3200 3209

  
3201 3210
        if(v==0x7F)
3202 3211
            return 1;
3203 3212
    }else{
3204
        if(show_bits(&s->gb, 16) == ff_mpeg4_resync_prefix[bits_count&7]){
3213
        if(v == ff_mpeg4_resync_prefix[bits_count&7]){
3205 3214
            int len;
3206 3215
            GetBitContext gb= s->gb;
3207 3216

  
......
4520 4529

  
4521 4530
        /* per-MB end of slice check */
4522 4531
    if(s->codec_id==CODEC_ID_MPEG4){
4523
#if 0 //http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_14496-4_2004_Conformance_Testing/video_conformance/version_1/simple/ERROR.ZIP/mit025.m4v needs this but its unclear if the mpeg4 standard allows this at all (MN)
4524
        if(s->pict_type != B_TYPE){
4525
            while(show_bits(&s->gb, 9 + (s->pict_type == P_TYPE)) == 1)
4526
                skip_bits(&s->gb, 9 + (s->pict_type == P_TYPE));
4527
        }
4528
#endif
4529 4532
        if(mpeg4_is_resync(s)){
4530 4533
            const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
4531 4534
            if(s->pict_type==B_TYPE && s->next_picture.mbskip_table[xy + delta])

Also available in: Unified diff