diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-22 14:30:51 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-22 14:39:38 +0100 |
commit | 797ba4d53b080962a9efca95c96bdf525cc2f787 (patch) | |
tree | 3028f14a787fcea79dcac7e7d23145e130dee9fd | |
parent | 563a8b4aac5d61657f49701b6cdb13b9ac6e7c9a (diff) | |
download | ffmpeg-797ba4d53b080962a9efca95c96bdf525cc2f787.tar.gz |
avcodec/h264_cavlc: Drop local_ref_count
This basically switches to the implementation from f6f7d1504134683c435e2c7d804279d982e52bb4
which seems faster
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/h264_cavlc.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index ce14dcef5e..42afce9f7e 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -714,7 +714,6 @@ int ff_h264_decode_mb_cavlc(const H264Context *h, H264SliceContext *sl) int dct8x8_allowed= h->pps.transform_8x8_mode; int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2; const int pixel_shift = h->pixel_shift; - unsigned local_ref_count[2]; mb_xy = sl->mb_xy = sl->mb_x + sl->mb_y*h->mb_stride; @@ -799,9 +798,6 @@ decode_intra_mb: return 0; } - local_ref_count[0] = sl->ref_count[0] << MB_MBAFF(sl); - local_ref_count[1] = sl->ref_count[1] << MB_MBAFF(sl); - fill_decode_neighbors(h, sl, mb_type); fill_decode_caches(h, sl, mb_type); @@ -881,7 +877,7 @@ decode_intra_mb: } for (list = 0; list < sl->list_count; list++) { - int ref_count = IS_REF0(mb_type) ? 1 : local_ref_count[list]; + int ref_count = IS_REF0(mb_type) ? 1 : sl->ref_count[list] << MB_MBAFF(sl); for(i=0; i<4; i++){ if(IS_DIRECT(sl->sub_mb_type[i])) continue; if(IS_DIR(sl->sub_mb_type[i], 0, list)){ @@ -961,13 +957,14 @@ decode_intra_mb: for (list = 0; list < sl->list_count; list++) { unsigned int val; if(IS_DIR(mb_type, 0, list)){ - if(local_ref_count[list]==1){ + unsigned rc = sl->ref_count[list] << MB_MBAFF(sl); + if (rc == 1) { val= 0; - } else if(local_ref_count[list]==2){ + } else if (rc == 2) { val= get_bits1(&sl->gb)^1; }else{ val= get_ue_golomb_31(&sl->gb); - if (val >= local_ref_count[list]){ + if (val >= rc) { av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } @@ -991,13 +988,14 @@ decode_intra_mb: for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ - if(local_ref_count[list] == 1) { + unsigned rc = sl->ref_count[list] << MB_MBAFF(sl); + if (rc == 1) { val= 0; - } else if(local_ref_count[list] == 2) { + } else if (rc == 2) { val= get_bits1(&sl->gb)^1; }else{ val= get_ue_golomb_31(&sl->gb); - if (val >= local_ref_count[list]){ + if (val >= rc) { av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } @@ -1028,13 +1026,14 @@ decode_intra_mb: for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ //FIXME optimize - if(local_ref_count[list]==1){ + unsigned rc = sl->ref_count[list] << MB_MBAFF(sl); + if (rc == 1) { val= 0; - } else if(local_ref_count[list]==2){ + } else if (rc == 2) { val= get_bits1(&sl->gb)^1; }else{ val= get_ue_golomb_31(&sl->gb); - if (val >= local_ref_count[list]){ + if (val >= rc) { av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } |