Merge commit 'bf03a878a76dea29b36f368759e9f66102b39a5f'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 14:30:10 +0000 (15:30 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 14:36:57 +0000 (15:36 +0100)
* commit 'bf03a878a76dea29b36f368759e9f66102b39a5f':
  h264: move mb[_{padding,luma_dc}] into the per-slice context

Conflicts:
libavcodec/h264.h
libavcodec/h264_cavlc.c
libavcodec/h264_mb.c
libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/h264.h
libavcodec/h264_cabac.c
libavcodec/h264_cavlc.c
libavcodec/h264_mb.c
libavcodec/h264_mb_template.c
libavcodec/h264_slice.c
libavcodec/svq3.c

index 8518fc8..f3c86ef 100644 (file)
@@ -426,6 +426,13 @@ typedef struct H264SliceContext {
     DECLARE_ALIGNED(8,  int8_t, ref_cache)[2][5 * 8];
 
     DECLARE_ALIGNED(8, uint16_t, sub_mb_type)[4];
+
+    ///< as a dct coefficient is int32_t in high depth, we need to reserve twice the space.
+    DECLARE_ALIGNED(16, int16_t, mb)[16 * 48 * 2];
+    DECLARE_ALIGNED(16, int16_t, mb_luma_dc)[3][16 * 2];
+    ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either
+    ///< check that i is not too large or ensure that there is some unused stuff after mb
+    int16_t mb_padding[256 * 2];
 } H264SliceContext;
 
 /**
@@ -512,10 +519,6 @@ typedef struct H264Context {
     GetBitContext *intra_gb_ptr;
     GetBitContext *inter_gb_ptr;
 
-    DECLARE_ALIGNED(16, int16_t, mb)[16 * 48 * 2]; ///< as a dct coefficient is int32_t in high depth, we need to reserve twice the space.
-    DECLARE_ALIGNED(16, int16_t, mb_luma_dc)[3][16 * 2];
-    int16_t mb_padding[256 * 2];        ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb
-
     /**
      * Cabac
      */
index d2a8fb0..09c957e 100644 (file)
@@ -1859,17 +1859,17 @@ static av_always_inline void decode_cabac_luma_residual(H264Context *h, H264Slic
     int i8x8, i4x4;
     int qscale = p == 0 ? sl->qscale : sl->chroma_qp[p - 1];
     if( IS_INTRA16x16( mb_type ) ) {
-        AV_ZERO128(h->mb_luma_dc[p]+0);
-        AV_ZERO128(h->mb_luma_dc[p]+8);
-        AV_ZERO128(h->mb_luma_dc[p]+16);
-        AV_ZERO128(h->mb_luma_dc[p]+24);
-        decode_cabac_residual_dc(h, sl, h->mb_luma_dc[p], ctx_cat[0][p], LUMA_DC_BLOCK_INDEX+p, scan, 16);
+        AV_ZERO128(sl->mb_luma_dc[p]+0);
+        AV_ZERO128(sl->mb_luma_dc[p]+8);
+        AV_ZERO128(sl->mb_luma_dc[p]+16);
+        AV_ZERO128(sl->mb_luma_dc[p]+24);
+        decode_cabac_residual_dc(h, sl, sl->mb_luma_dc[p], ctx_cat[0][p], LUMA_DC_BLOCK_INDEX+p, scan, 16);
 
         if( cbp&15 ) {
             qmul = h->dequant4_coeff[p][qscale];
             for( i4x4 = 0; i4x4 < 16; i4x4++ ) {
                 const int index = 16*p + i4x4;
-                decode_cabac_residual_nondc(h, sl, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15);
+                decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15);
             }
         } else {
             fill_rectangle(&sl->non_zero_count_cache[scan8[16*p]], 4, 4, 8, 0, 1);
@@ -1880,14 +1880,14 @@ static av_always_inline void decode_cabac_luma_residual(H264Context *h, H264Slic
             if( cbp & (1<<i8x8) ) {
                 if( IS_8x8DCT(mb_type) ) {
                     const int index = 16*p + 4*i8x8;
-                    decode_cabac_residual_nondc(h, sl, h->mb + (16*index << pixel_shift), ctx_cat[3][p], index,
+                    decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), ctx_cat[3][p], index,
                                                 scan8x8, h->dequant8_coeff[cqm][qscale], 64);
                 } else {
                     qmul = h->dequant4_coeff[cqm][qscale];
                     for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
                         const int index = 16*p + 4*i8x8 + i4x4;
 //START_TIMER
-                        decode_cabac_residual_nondc(h, sl, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16);
+                        decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16);
 //STOP_TIMER("decode_residual")
                     }
                 }
@@ -2399,7 +2399,7 @@ decode_intra_mb:
             if( cbp&0x30 ){
                 int c;
                 for (c = 0; c < 2; c++)
-                    decode_cabac_residual_dc_422(h, sl, h->mb + ((256 + 16*16*c) << pixel_shift), 3,
+                    decode_cabac_residual_dc_422(h, sl, sl->mb + ((256 + 16*16*c) << pixel_shift), 3,
                                                  CHROMA_DC_BLOCK_INDEX + c,
                                                  chroma422_dc_scan, 8);
             }
@@ -2407,7 +2407,7 @@ decode_intra_mb:
             if( cbp&0x20 ) {
                 int c, i, i8x8;
                 for( c = 0; c < 2; c++ ) {
-                    int16_t *mb = h->mb + (16*(16 + 16*c) << pixel_shift);
+                    int16_t *mb = sl->mb + (16*(16 + 16*c) << pixel_shift);
                     qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[c]];
                     for (i8x8 = 0; i8x8 < 2; i8x8++) {
                         for (i = 0; i < 4; i++) {
@@ -2425,7 +2425,7 @@ decode_intra_mb:
             if( cbp&0x30 ){
                 int c;
                 for (c = 0; c < 2; c++)
-                    decode_cabac_residual_dc(h, sl, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
+                    decode_cabac_residual_dc(h, sl, sl->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
             }
 
             if( cbp&0x20 ) {
@@ -2434,7 +2434,7 @@ decode_intra_mb:
                     qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[c]];
                     for( i = 0; i < 4; i++ ) {
                         const int index = 16 + 16 * c + i;
-                        decode_cabac_residual_nondc(h, sl, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15);
+                        decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15);
                     }
                 }
             } else {
index 09b5038..af8a8b6 100644 (file)
@@ -639,11 +639,11 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
     int i4x4, i8x8;
     int qscale = p == 0 ? sl->qscale : sl->chroma_qp[p - 1];
     if(IS_INTRA16x16(mb_type)){
-        AV_ZERO128(h->mb_luma_dc[p]+0);
-        AV_ZERO128(h->mb_luma_dc[p]+8);
-        AV_ZERO128(h->mb_luma_dc[p]+16);
-        AV_ZERO128(h->mb_luma_dc[p]+24);
-        if( decode_residual(h, sl, h->intra_gb_ptr, h->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX+p, scan, NULL, 16) < 0){
+        AV_ZERO128(sl->mb_luma_dc[p]+0);
+        AV_ZERO128(sl->mb_luma_dc[p]+8);
+        AV_ZERO128(sl->mb_luma_dc[p]+16);
+        AV_ZERO128(sl->mb_luma_dc[p]+24);
+        if( decode_residual(h, sl, h->intra_gb_ptr, sl->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX+p, scan, NULL, 16) < 0){
             return -1; //FIXME continue if partitioned and other return -1 too
         }
 
@@ -653,7 +653,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
             for(i8x8=0; i8x8<4; i8x8++){
                 for(i4x4=0; i4x4<4; i4x4++){
                     const int index= i4x4 + 4*i8x8 + p*16;
-                    if( decode_residual(h, sl, h->intra_gb_ptr, h->mb + (16*index << pixel_shift),
+                    if( decode_residual(h, sl, h->intra_gb_ptr, sl->mb + (16*index << pixel_shift),
                         index, scan + 1, h->dequant4_coeff[p][qscale], 15) < 0 ){
                         return -1;
                     }
@@ -671,7 +671,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
         for(i8x8=0; i8x8<4; i8x8++){
             if(cbp & (1<<i8x8)){
                 if(IS_8x8DCT(mb_type)){
-                    int16_t *buf = &h->mb[64*i8x8+256*p << pixel_shift];
+                    int16_t *buf = &sl->mb[64*i8x8+256*p << pixel_shift];
                     uint8_t *nnz;
                     for(i4x4=0; i4x4<4; i4x4++){
                         const int index= i4x4 + 4*i8x8 + p*16;
@@ -685,7 +685,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
                 }else{
                     for(i4x4=0; i4x4<4; i4x4++){
                         const int index= i4x4 + 4*i8x8 + p*16;
-                        if( decode_residual(h, sl, gb, h->mb + (16*index << pixel_shift), index,
+                        if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift), index,
                                             scan, h->dequant4_coeff[cqm][qscale], 16) < 0 ){
                             return -1;
                         }
@@ -1140,7 +1140,7 @@ decode_intra_mb:
 
             if(cbp&0x30){
                 for(chroma_idx=0; chroma_idx<2; chroma_idx++)
-                    if (decode_residual(h, sl, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift),
+                    if (decode_residual(h, sl, gb, sl->mb + ((256 + 16*16*chroma_idx) << pixel_shift),
                                         CHROMA_DC_BLOCK_INDEX+chroma_idx,
                                         CHROMA422(h) ? chroma422_dc_scan : chroma_dc_scan,
                                         NULL, 4*num_c8x8) < 0) {
@@ -1151,7 +1151,7 @@ decode_intra_mb:
             if(cbp&0x20){
                 for(chroma_idx=0; chroma_idx<2; chroma_idx++){
                     const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[chroma_idx]];
-                    int16_t *mb = h->mb + (16*(16 + 16*chroma_idx) << pixel_shift);
+                    int16_t *mb = sl->mb + (16*(16 + 16*chroma_idx) << pixel_shift);
                     for (i8x8 = 0; i8x8<num_c8x8; i8x8++) {
                         for (i4x4 = 0; i4x4 < 4; i4x4++) {
                             const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4;
index 4c94c8a..57d5b30 100644 (file)
@@ -639,9 +639,9 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
                 const int dir      = sl->intra4x4_pred_mode_cache[scan8[i]];
                 if (transform_bypass && h->sps.profile_idc == 244 && dir <= 1) {
                     if (h->x264_build != -1) {
-                        h->hpc.pred8x8l_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
+                        h->hpc.pred8x8l_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
                     } else
-                        h->hpc.pred8x8l_filter_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift),
+                        h->hpc.pred8x8l_filter_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift),
                                                         (sl-> topleft_samples_available << i) & 0x8000,
                                                         (sl->topright_samples_available << i) & 0x4000, linesize);
                 } else {
@@ -649,10 +649,10 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
                     h->hpc.pred8x8l[dir](ptr, (sl->topleft_samples_available << i) & 0x8000,
                                          (sl->topright_samples_available << i) & 0x4000, linesize);
                     if (nnz) {
-                        if (nnz == 1 && dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256))
-                            idct_dc_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
+                        if (nnz == 1 && dctcoef_get(sl->mb, pixel_shift, i * 16 + p * 256))
+                            idct_dc_add(ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
                         else
-                            idct_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
+                            idct_add(ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
                     }
                 }
             }
@@ -669,7 +669,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
                 const int dir      = sl->intra4x4_pred_mode_cache[scan8[i]];
 
                 if (transform_bypass && h->sps.profile_idc == 244 && dir <= 1) {
-                    h->hpc.pred4x4_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
+                    h->hpc.pred4x4_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
                 } else {
                     uint8_t *topright;
                     int nnz, tr;
@@ -694,12 +694,12 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
                     nnz = sl->non_zero_count_cache[scan8[i + p * 16]];
                     if (nnz) {
                         if (is_h264) {
-                            if (nnz == 1 && dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256))
-                                idct_dc_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
+                            if (nnz == 1 && dctcoef_get(sl->mb, pixel_shift, i * 16 + p * 256))
+                                idct_dc_add(ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
                             else
-                                idct_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
+                                idct_add(ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
                         } else if (CONFIG_SVQ3_DECODER)
-                            ff_svq3_add_idct_c(ptr, h->mb + i * 16 + p * 256, linesize, qscale, 0);
+                            ff_svq3_add_idct_c(ptr, sl->mb + i * 16 + p * 256, linesize, qscale, 0);
                     }
                 }
             }
@@ -709,8 +709,8 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
         if (is_h264) {
             if (sl->non_zero_count_cache[scan8[LUMA_DC_BLOCK_INDEX + p]]) {
                 if (!transform_bypass)
-                    h->h264dsp.h264_luma_dc_dequant_idct(h->mb + (p * 256 << pixel_shift),
-                                                         h->mb_luma_dc[p],
+                    h->h264dsp.h264_luma_dc_dequant_idct(sl->mb + (p * 256 << pixel_shift),
+                                                         sl->mb_luma_dc[p],
                                                          h->dequant4_coeff[p][qscale][0]);
                 else {
                     static const uint8_t dc_mapping[16] = {
@@ -720,15 +720,15 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
                         10 * 16, 11 * 16, 14 * 16, 15 * 16
                     };
                     for (i = 0; i < 16; i++)
-                        dctcoef_set(h->mb + (p * 256 << pixel_shift),
+                        dctcoef_set(sl->mb + (p * 256 << pixel_shift),
                                     pixel_shift, dc_mapping[i],
-                                    dctcoef_get(h->mb_luma_dc[p],
+                                    dctcoef_get(sl->mb_luma_dc[p],
                                                 pixel_shift, i));
                 }
             }
         } else if (CONFIG_SVQ3_DECODER)
-            ff_svq3_luma_dc_dequant_idct_c(h->mb + p * 256,
-                                           h->mb_luma_dc[p], qscale);
+            ff_svq3_luma_dc_dequant_idct_c(sl->mb + p * 256,
+                                           sl->mb_luma_dc[p], qscale);
     }
 }
 
@@ -752,19 +752,19 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
                         (sl->intra16x16_pred_mode == VERT_PRED8x8 ||
                          sl->intra16x16_pred_mode == HOR_PRED8x8)) {
                         h->hpc.pred16x16_add[sl->intra16x16_pred_mode](dest_y, block_offset,
-                                                                      h->mb + (p * 256 << pixel_shift),
+                                                                      sl->mb + (p * 256 << pixel_shift),
                                                                       linesize);
                     } else {
                         for (i = 0; i < 16; i++)
                             if (sl->non_zero_count_cache[scan8[i + p * 16]] ||
-                                dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256))
+                                dctcoef_get(sl->mb, pixel_shift, i * 16 + p * 256))
                                 h->h264dsp.h264_add_pixels4_clear(dest_y + block_offset[i],
-                                                                  h->mb + (i * 16 + p * 256 << pixel_shift),
+                                                                  sl->mb + (i * 16 + p * 256 << pixel_shift),
                                                                   linesize);
                     }
                 } else {
                     h->h264dsp.h264_idct_add16intra(dest_y, block_offset,
-                                                    h->mb + (p * 256 << pixel_shift),
+                                                    sl->mb + (p * 256 << pixel_shift),
                                                     linesize,
                                                     sl->non_zero_count_cache + p * 5 * 8);
                 }
@@ -776,27 +776,27 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
                     for (i = 0; i < 16; i += di)
                         if (sl->non_zero_count_cache[scan8[i + p * 16]])
                             idct_add(dest_y + block_offset[i],
-                                     h->mb + (i * 16 + p * 256 << pixel_shift),
+                                     sl->mb + (i * 16 + p * 256 << pixel_shift),
                                      linesize);
                 } else {
                     if (IS_8x8DCT(mb_type))
                         h->h264dsp.h264_idct8_add4(dest_y, block_offset,
-                                                   h->mb + (p * 256 << pixel_shift),
+                                                   sl->mb + (p * 256 << pixel_shift),
                                                    linesize,
                                                    sl->non_zero_count_cache + p * 5 * 8);
                     else
                         h->h264dsp.h264_idct_add16(dest_y, block_offset,
-                                                   h->mb + (p * 256 << pixel_shift),
+                                                   sl->mb + (p * 256 << pixel_shift),
                                                    linesize,
                                                    sl->non_zero_count_cache + p * 5 * 8);
                 }
             }
         } else if (CONFIG_SVQ3_DECODER) {
             for (i = 0; i < 16; i++)
-                if (sl->non_zero_count_cache[scan8[i + p * 16]] || h->mb[i * 16 + p * 256]) {
+                if (sl->non_zero_count_cache[scan8[i + p * 16]] || sl->mb[i * 16 + p * 256]) {
                     // FIXME benchmark weird rule, & below
                     uint8_t *const ptr = dest_y + block_offset[i];
-                    ff_svq3_add_idct_c(ptr, h->mb + i * 16 + p * 256, linesize,
+                    ff_svq3_add_idct_c(ptr, sl->mb + i * 16 + p * 256, linesize,
                                        sl->qscale, IS_INTRA(mb_type) ? 1 : 0);
                 }
         }
index 5d7117c..b4ef404 100644 (file)
@@ -199,27 +199,27 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
                      sl->chroma_pred_mode == HOR_PRED8x8)) {
                     h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0],
                                                             block_offset + 16,
-                                                            h->mb + (16 * 16 * 1 << PIXEL_SHIFT),
+                                                            sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),
                                                             uvlinesize);
                     h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1],
                                                             block_offset + 32,
-                                                            h->mb + (16 * 16 * 2 << PIXEL_SHIFT),
+                                                            sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),
                                                             uvlinesize);
                 } else {
                     idct_add = h->h264dsp.h264_add_pixels4_clear;
                     for (j = 1; j < 3; j++) {
                         for (i = j * 16; i < j * 16 + 4; i++)
                             if (sl->non_zero_count_cache[scan8[i]] ||
-                                dctcoef_get(h->mb, PIXEL_SHIFT, i * 16))
+                                dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16))
                                 idct_add(dest[j - 1] + block_offset[i],
-                                         h->mb + (i * 16 << PIXEL_SHIFT),
+                                         sl->mb + (i * 16 << PIXEL_SHIFT),
                                          uvlinesize);
                         if (chroma422) {
                             for (i = j * 16 + 4; i < j * 16 + 8; i++)
                                 if (sl->non_zero_count_cache[scan8[i + 4]] ||
-                                    dctcoef_get(h->mb, PIXEL_SHIFT, i * 16))
+                                    dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16))
                                     idct_add(dest[j - 1] + block_offset[i + 4],
-                                             h->mb + (i * 16 << PIXEL_SHIFT),
+                                             sl->mb + (i * 16 << PIXEL_SHIFT),
                                              uvlinesize);
                         }
                     }
@@ -235,24 +235,24 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
                         qp[1] = sl->chroma_qp[1];
                     }
                     if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]])
-                        h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16 * 16 * 1 << PIXEL_SHIFT),
+                        h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),
                                                                h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]);
                     if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]])
-                        h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16 * 16 * 2 << PIXEL_SHIFT),
+                        h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),
                                                                h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]);
                     h->h264dsp.h264_idct_add8(dest, block_offset,
-                                              h->mb, uvlinesize,
+                                              sl->mb, uvlinesize,
                                               sl->non_zero_count_cache);
                 } else if (CONFIG_SVQ3_DECODER) {
-                    h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16 * 16 * 1,
+                    h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 1,
                                                            h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][sl->chroma_qp[0]][0]);
-                    h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16 * 16 * 2,
+                    h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 2,
                                                            h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][sl->chroma_qp[1]][0]);
                     for (j = 1; j < 3; j++) {
                         for (i = j * 16; i < j * 16 + 4; i++)
-                            if (sl->non_zero_count_cache[scan8[i]] || h->mb[i * 16]) {
+                            if (sl->non_zero_count_cache[scan8[i]] || sl->mb[i * 16]) {
                                 uint8_t *const ptr = dest[j - 1] + block_offset[i];
-                                ff_svq3_add_idct_c(ptr, h->mb + i * 16,
+                                ff_svq3_add_idct_c(ptr, sl->mb + i * 16,
                                                    uvlinesize,
                                                    ff_h264_chroma_qp[0][sl->qscale + 12] - 12, 2);
                             }
index cb8328e..a4aa671 100644 (file)
@@ -534,23 +534,24 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
         av_freep(&h->rbsp_buffer[0]);
         av_freep(&h->rbsp_buffer[1]);
         ff_h264_unref_picture(h, &h->last_pic_for_ec);
-        memcpy(h, h1, offsetof(H264Context, mb));
+        memcpy(h, h1, offsetof(H264Context, cabac));
         memcpy(&h->cabac, &h1->cabac,
                sizeof(H264Context) - offsetof(H264Context, cabac));
-        av_assert0((void*)&h->cabac == &h->mb_padding + 1);
+
 
         memset(h->sps_buffers, 0, sizeof(h->sps_buffers));
         memset(h->pps_buffers, 0, sizeof(h->pps_buffers));
 
         memset(&h->er, 0, sizeof(h->er));
-        memset(&h->mb, 0, sizeof(h->mb));
-        memset(&h->mb_luma_dc, 0, sizeof(h->mb_luma_dc));
-        memset(&h->mb_padding, 0, sizeof(h->mb_padding));
         memset(&h->cur_pic, 0, sizeof(h->cur_pic));
         memset(&h->last_pic_for_ec, 0, sizeof(h->last_pic_for_ec));
 
         h->slice_ctx = orig_slice_ctx;
 
+        memset(&h->slice_ctx[0].mb,         0, sizeof(h->slice_ctx[0].mb));
+        memset(&h->slice_ctx[0].mb_luma_dc, 0, sizeof(h->slice_ctx[0].mb_luma_dc));
+        memset(&h->slice_ctx[0].mb_padding, 0, sizeof(h->slice_ctx[0].mb_padding));
+
         h->avctx             = dst;
         h->DPB               = NULL;
         h->qscale_table_pool = NULL;
index 850216b..5a5cf26 100644 (file)
@@ -714,9 +714,9 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
         }
     }
     if (IS_INTRA16x16(mb_type)) {
-        AV_ZERO128(h->mb_luma_dc[0] + 0);
-        AV_ZERO128(h->mb_luma_dc[0] + 8);
-        if (svq3_decode_block(&h->gb, h->mb_luma_dc[0], 0, 1)) {
+        AV_ZERO128(sl->mb_luma_dc[0] + 0);
+        AV_ZERO128(sl->mb_luma_dc[0] + 8);
+        if (svq3_decode_block(&h->gb, sl->mb_luma_dc[0], 0, 1)) {
             av_log(h->avctx, AV_LOG_ERROR,
                    "error while decoding intra luma dc\n");
             return -1;
@@ -735,7 +735,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
                               : (4 * i + j);
                     sl->non_zero_count_cache[scan8[k]] = 1;
 
-                    if (svq3_decode_block(&h->gb, &h->mb[16 * k], index, type)) {
+                    if (svq3_decode_block(&h->gb, &sl->mb[16 * k], index, type)) {
                         av_log(h->avctx, AV_LOG_ERROR,
                                "error while decoding block\n");
                         return -1;
@@ -745,7 +745,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
 
         if ((cbp & 0x30)) {
             for (i = 1; i < 3; ++i)
-                if (svq3_decode_block(&h->gb, &h->mb[16 * 16 * i], 0, 3)) {
+                if (svq3_decode_block(&h->gb, &sl->mb[16 * 16 * i], 0, 3)) {
                     av_log(h->avctx, AV_LOG_ERROR,
                            "error while decoding chroma dc block\n");
                     return -1;
@@ -757,7 +757,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
                         k                                 = 16 * i + j;
                         sl->non_zero_count_cache[scan8[k]] = 1;
 
-                        if (svq3_decode_block(&h->gb, &h->mb[16 * k], 1, 1)) {
+                        if (svq3_decode_block(&h->gb, &sl->mb[16 * k], 1, 1)) {
                             av_log(h->avctx, AV_LOG_ERROR,
                                    "error while decoding chroma ac block\n");
                             return -1;