Revision 3566042a

View differences:

libavcodec/avcodec.h
1308 1308
#define FF_BUG_HPEL_CHROMA      2048
1309 1309
#define FF_BUG_DC_CLIP          4096
1310 1310
#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
1311
#define FF_BUG_TRUNCATED       16384
1311 1312
//#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
1312 1313

  
1313 1314
    /**
libavcodec/h264.c
2257 2257
            }
2258 2258
            eos = get_cabac_terminate( &h->cabac );
2259 2259

  
2260
            if((s->workaround_bugs & FF_BUG_TRUNCATED) && h->cabac.bytestream > h->cabac.bytestream_end + 2){
2261
                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
2262
                return 0;
2263
            }
2260 2264
            if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) {
2261 2265
                av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%td)\n", s->mb_x, s->mb_y, h->cabac.bytestream_end - h->cabac.bytestream);
2262 2266
                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
......
2492 2496
        if (ptr==NULL || dst_length < 0){
2493 2497
            return -1;
2494 2498
        }
2499
        i= buf_index + consumed;
2500
        if((s->workaround_bugs & FF_BUG_AUTODETECT) && i+3<next_avc &&
2501
           buf[i]==0x00 && buf[i+1]==0x00 && buf[i+2]==0x01 && buf[i+3]==0xE0)
2502
            s->workaround_bugs |= FF_BUG_TRUNCATED;
2503

  
2504
        if(!(s->workaround_bugs & FF_BUG_TRUNCATED)){
2495 2505
        while(ptr[dst_length - 1] == 0 && dst_length > 0)
2496 2506
            dst_length--;
2507
        }
2497 2508
        bit_length= !dst_length ? 0 : (8*dst_length - ff_h264_decode_rbsp_trailing(h, ptr + dst_length - 1));
2498 2509

  
2499 2510
        if(s->avctx->debug&FF_DEBUG_STARTCODE){
libavcodec/options.c
153 153
{"hpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_HPEL_CHROMA, INT_MIN, INT_MAX, V|D, "bug"},
154 154
{"dc_clip", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_DC_CLIP, INT_MIN, INT_MAX, V|D, "bug"},
155 155
{"ms", "workaround various bugs in microsofts broken decoders", 0, FF_OPT_TYPE_CONST, FF_BUG_MS, INT_MIN, INT_MAX, V|D, "bug"},
156
{"trunc", "trancated frames", 0, FF_OPT_TYPE_CONST,FF_BUG_TRUNCATED, INT_MIN, INT_MAX, V|D, "bug"},
156 157
{"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
157 158
{"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
158 159
{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|V|D|E, "strict"},

Also available in: Unified diff