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;
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_caches(h, sl, mb_type);
if( IS_INTRA( mb_type ) ) {
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)){
- if (local_ref_count[list] > 1) {
+ unsigned rc = sl->ref_count[list] << MB_MBAFF(sl);
+ if (rc > 1) {
ref[list][i] = decode_cabac_mb_ref(sl, list, 4 * i);
- if (ref[list][i] >= (unsigned)local_ref_count[list]) {
- av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], local_ref_count[list]);
+ if (ref[list][i] >= rc) {
+ av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], rc);
return -1;
}
}else
for (list = 0; list < sl->list_count; list++) {
if(IS_DIR(mb_type, 0, list)){
int ref;
- if (local_ref_count[list] > 1) {
+ unsigned rc = sl->ref_count[list] << MB_MBAFF(sl);
+ if (rc > 1) {
ref= decode_cabac_mb_ref(sl, list, 0);
- if (ref >= (unsigned)local_ref_count[list]) {
- av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
+ if (ref >= rc) {
+ av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
return -1;
}
}else
for(i=0; i<2; i++){
if(IS_DIR(mb_type, i, list)){
int ref;
- if (local_ref_count[list] > 1) {
+ unsigned rc = sl->ref_count[list] << MB_MBAFF(sl);
+ if (rc > 1) {
ref= decode_cabac_mb_ref(sl, list, 8 * i);
- if (ref >= (unsigned)local_ref_count[list]) {
- av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
+ if (ref >= rc) {
+ av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
return -1;
}
}else
for(i=0; i<2; i++){
if(IS_DIR(mb_type, i, list)){ //FIXME optimize
int ref;
- if (local_ref_count[list] > 1) {
+ unsigned rc = sl->ref_count[list] << MB_MBAFF(sl);
+ if (rc > 1) {
ref = decode_cabac_mb_ref(sl, list, 4 * i);
- if (ref >= (unsigned)local_ref_count[list]) {
- av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
+ if (ref >= rc) {
+ av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
return -1;
}
}else