Merge commit 'b53569e0681ff7bc99103ab4c961dbac3cc0fce6'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 22:13:25 +0000 (23:13 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 22:13:25 +0000 (23:13 +0100)
* commit 'b53569e0681ff7bc99103ab4c961dbac3cc0fce6':
  h264_cabac: remove now unnecessary H264Context function parameters

Conflicts:
libavcodec/h264_cabac.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/h264_cabac.c

@@@ -2008,10 -2005,10 +2008,10 @@@ int ff_h264_decode_mb_cabac(const H264C
              goto decode_intra_mb;
          }
      } else {
-         mb_type = decode_cabac_intra_mb_type(h, sl, 3, 1);
+         mb_type = decode_cabac_intra_mb_type(sl, 3, 1);
          if (sl->slice_type == AV_PICTURE_TYPE_SI && mb_type)
              mb_type--;
 -        assert(sl->slice_type_nos == AV_PICTURE_TYPE_I);
 +        av_assert2(sl->slice_type_nos == AV_PICTURE_TYPE_I);
  decode_intra_mb:
          partition_count = 0;
          cbp= i_mb_type_info[mb_type].cbp;
              } else {
                  for( i = 0; i < 16; i++ ) {
                      int pred = pred_intra_mode(h, sl, i);
-                     sl->intra4x4_pred_mode_cache[scan8[i]] = decode_cabac_mb_intra4x4_pred_mode(h, sl, pred);
+                     sl->intra4x4_pred_mode_cache[scan8[i]] = decode_cabac_mb_intra4x4_pred_mode(sl, pred);
  
                      av_dlog(h->avctx, "i4x4 pred=%d mode=%d\n", pred,
 -                            h->intra4x4_pred_mode_cache[scan8[i]]);
 +                            sl->intra4x4_pred_mode_cache[scan8[i]]);
                  }
              }
              write_back_intra_pred_mode(h, 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)){
 -                        int rc = sl->ref_count[list] << MB_MBAFF(sl);
 -                        if (rc > 1) {
 +                        if (local_ref_count[list] > 1) {
-                             ref[list][i] = decode_cabac_mb_ref(h, sl, list, 4 * i);
+                             ref[list][i] = decode_cabac_mb_ref(sl, list, 4 * i);
 -                            if (ref[list][i] >= (unsigned) rc) {
 -                                av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], rc);
 +                            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]);
                                  return -1;
                              }
                          }else
          if(IS_16X16(mb_type)){
              for (list = 0; list < sl->list_count; list++) {
                  if(IS_DIR(mb_type, 0, list)){
 -                    int ref, rc = sl->ref_count[list] << MB_MBAFF(sl);
 -                    if (rc > 1) {
 +                    int ref;
 +                    if (local_ref_count[list] > 1) {
-                         ref= decode_cabac_mb_ref(h, sl, list, 0);
+                         ref= decode_cabac_mb_ref(sl, list, 0);
 -                        if (ref >= (unsigned) rc) {
 -                            av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
 +                        if (ref >= (unsigned)local_ref_count[list]) {
 +                            av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
                              return -1;
                          }
                      }else
              for (list = 0; list < sl->list_count; list++) {
                      for(i=0; i<2; i++){
                          if(IS_DIR(mb_type, i, list)){
 -                            int ref, rc = sl->ref_count[list] << MB_MBAFF(sl);
 -                            if (rc > 1) {
 +                            int ref;
 +                            if (local_ref_count[list] > 1) {
-                                 ref= decode_cabac_mb_ref(h, sl, list, 8 * i);
+                                 ref= decode_cabac_mb_ref(sl, list, 8 * i);
 -                                if (ref >= (unsigned) rc) {
 -                                    av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
 +                                if (ref >= (unsigned)local_ref_count[list]) {
 +                                    av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
                                      return -1;
                                  }
                              }else
              for (list = 0; list < sl->list_count; list++) {
                      for(i=0; i<2; i++){
                          if(IS_DIR(mb_type, i, list)){ //FIXME optimize
 -                            int ref, rc = sl->ref_count[list] << MB_MBAFF(sl);
 -                            if (rc > 1) {
 +                            int ref;
 +                            if (local_ref_count[list] > 1) {
-                                 ref= decode_cabac_mb_ref(h, sl, list, 4 * i);
+                                 ref = decode_cabac_mb_ref(sl, list, 4 * i);
 -                                if (ref >= (unsigned) rc) {
 -                                    av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
 +                                if (ref >= (unsigned)local_ref_count[list]) {
 +                                    av_log(h->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
                                      return -1;
                                  }
                              }else
     }
  
      if( !IS_INTRA16x16( mb_type ) ) {
-         cbp  = decode_cabac_mb_cbp_luma(h, sl);
+         cbp  = decode_cabac_mb_cbp_luma(sl);
          if(decode_chroma)
-             cbp |= decode_cabac_mb_cbp_chroma(h, sl) << 4;
+             cbp |= decode_cabac_mb_cbp_chroma(sl) << 4;
 +    } else {
 +        if (!decode_chroma && cbp>15) {
 +            av_log(h->avctx, AV_LOG_ERROR, "gray chroma\n");
 +            return AVERROR_INVALIDDATA;
 +        }
      }
  
      h->cbp_table[mb_xy] = sl->cbp = cbp;