Commit 797ba4d5 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h264_cavlc: Drop local_ref_count

This basically switches to the implementation from f6f7d150
which seems faster
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 563a8b4a
...@@ -714,7 +714,6 @@ int ff_h264_decode_mb_cavlc(const H264Context *h, H264SliceContext *sl) ...@@ -714,7 +714,6 @@ int ff_h264_decode_mb_cavlc(const H264Context *h, H264SliceContext *sl)
int dct8x8_allowed= h->pps.transform_8x8_mode; int dct8x8_allowed= h->pps.transform_8x8_mode;
int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2; int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2;
const int pixel_shift = h->pixel_shift; 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; mb_xy = sl->mb_xy = sl->mb_x + sl->mb_y*h->mb_stride;
...@@ -799,9 +798,6 @@ decode_intra_mb: ...@@ -799,9 +798,6 @@ decode_intra_mb:
return 0; 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_neighbors(h, sl, mb_type);
fill_decode_caches(h, sl, mb_type); fill_decode_caches(h, sl, mb_type);
...@@ -881,7 +877,7 @@ decode_intra_mb: ...@@ -881,7 +877,7 @@ decode_intra_mb:
} }
for (list = 0; list < sl->list_count; list++) { 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++){ for(i=0; i<4; i++){
if(IS_DIRECT(sl->sub_mb_type[i])) continue; if(IS_DIRECT(sl->sub_mb_type[i])) continue;
if(IS_DIR(sl->sub_mb_type[i], 0, list)){ if(IS_DIR(sl->sub_mb_type[i], 0, list)){
...@@ -961,13 +957,14 @@ decode_intra_mb: ...@@ -961,13 +957,14 @@ decode_intra_mb:
for (list = 0; list < sl->list_count; list++) { for (list = 0; list < sl->list_count; list++) {
unsigned int val; unsigned int val;
if(IS_DIR(mb_type, 0, list)){ 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; val= 0;
} else if(local_ref_count[list]==2){ } else if (rc == 2) {
val= get_bits1(&sl->gb)^1; val= get_bits1(&sl->gb)^1;
}else{ }else{
val= get_ue_golomb_31(&sl->gb); 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); av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1; return -1;
} }
...@@ -991,13 +988,14 @@ decode_intra_mb: ...@@ -991,13 +988,14 @@ decode_intra_mb:
for(i=0; i<2; i++){ for(i=0; i<2; i++){
unsigned int val; unsigned int val;
if(IS_DIR(mb_type, i, list)){ 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; val= 0;
} else if(local_ref_count[list] == 2) { } else if (rc == 2) {
val= get_bits1(&sl->gb)^1; val= get_bits1(&sl->gb)^1;
}else{ }else{
val= get_ue_golomb_31(&sl->gb); 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); av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1; return -1;
} }
...@@ -1028,13 +1026,14 @@ decode_intra_mb: ...@@ -1028,13 +1026,14 @@ decode_intra_mb:
for(i=0; i<2; i++){ for(i=0; i<2; i++){
unsigned int val; unsigned int val;
if(IS_DIR(mb_type, i, list)){ //FIXME optimize 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; val= 0;
} else if(local_ref_count[list]==2){ } else if (rc == 2) {
val= get_bits1(&sl->gb)^1; val= get_bits1(&sl->gb)^1;
}else{ }else{
val= get_ue_golomb_31(&sl->gb); 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); av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment