Merge commit 'f69574cf7aca4fe4d57a2155e925f37fc863474d'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 13:02:02 +0000 (14:02 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 13:02:02 +0000 (14:02 +0100)
* commit 'f69574cf7aca4fe4d57a2155e925f37fc863474d':
  h264: move non_zero_count_cache into the per-slice context

Conflicts:
libavcodec/h264.c
libavcodec/h264_cabac.c
libavcodec/h264_cavlc.c

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

@@@ -68,8 -61,8 +69,8 @@@ static void h264_er_decode_mb(void *opa
      h->mb_x  = mb_x;
      h->mb_y  = mb_y;
      h->mb_xy = mb_x + mb_y * h->mb_stride;
-     memset(h->non_zero_count_cache, 0, sizeof(h->non_zero_count_cache));
+     memset(sl->non_zero_count_cache, 0, sizeof(sl->non_zero_count_cache));
 -    assert(ref >= 0);
 +    av_assert1(ref >= 0);
      /* FIXME: It is possible albeit uncommon that slice references
       * differ between slices. We take the easy approach and ignore
       * it for now. If this turns out to have any relevance in
Simple merge
@@@ -1684,13 -1686,13 +1688,13 @@@ decode_cabac_residual_internal(H264Cont
              h->cbp_table[h->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX);
          else
              h->cbp_table[h->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX);
-         h->non_zero_count_cache[scan8[n]] = coeff_count;
+         sl->non_zero_count_cache[scan8[n]] = coeff_count;
      } else {
          if( max_coeff == 64 )
-             fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
+             fill_rectangle(&sl->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
          else {
 -            assert( cat == 1 || cat ==  2 || cat ==  4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 );
 +            av_assert2( cat == 1 || cat ==  2 || cat ==  4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 );
-             h->non_zero_count_cache[scan8[n]] = coeff_count;
+             sl->non_zero_count_cache[scan8[n]] = coeff_count;
          }
      }
  
@@@ -1130,15 -1122,12 +1135,15 @@@ decode_intra_mb
              if (decode_luma_residual(h, sl, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 2) < 0 ) {
                  return -1;
              }
 -        } else if (CHROMA422(h)) {
 +        } else {
 +            const int num_c8x8 = h->sps.chroma_format_idc;
 +
              if(cbp&0x30){
                  for(chroma_idx=0; chroma_idx<2; chroma_idx++)
-                     if (decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift),
+                     if (decode_residual(h, sl, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift),
 -                                        CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma422_dc_scan,
 -                                        NULL, 8) < 0) {
 +                                        CHROMA_DC_BLOCK_INDEX+chroma_idx,
 +                                        CHROMA422(h) ? chroma422_dc_scan : chroma_dc_scan,
 +                                        NULL, 4*num_c8x8) < 0) {
                          return -1;
                      }
              }
                  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);
 -                    for (i8x8 = 0; i8x8 < 2; i8x8++) {
 +                    for (i8x8 = 0; i8x8<num_c8x8; i8x8++) {
                          for (i4x4 = 0; i4x4 < 4; i4x4++) {
                              const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4;
-                             if (decode_residual(h, gb, mb, index, scan + 1, qmul, 15) < 0)
+                             if (decode_residual(h, sl, gb, mb, index, scan + 1, qmul, 15) < 0)
                                  return -1;
                              mb += 16 << pixel_shift;
                          }
                      }
                  }
              }else{
-                 fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
-                 fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
+                 fill_rectangle(&sl->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
+                 fill_rectangle(&sl->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
              }
 -        } else /* yuv420 */ {
 -            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), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){
 -                        return -1;
 -                    }
 -            }
 -
 -            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]];
 -                    for(i4x4=0; i4x4<4; i4x4++){
 -                        const int index= 16 + 16*chroma_idx + i4x4;
 -                        if( decode_residual(h, sl, gb, h->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){
 -                            return -1;
 -                        }
 -                    }
 -                }
 -            }else{
 -                fill_rectangle(&sl->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
 -                fill_rectangle(&sl->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
 -            }
          }
      }else{
-         fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1);
-         fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
-         fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
+         fill_rectangle(&sl->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1);
+         fill_rectangle(&sl->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
+         fill_rectangle(&sl->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
      }
      h->cur_pic.qscale_table[mb_xy] = sl->qscale;
-     write_back_non_zero_count(h);
+     write_back_non_zero_count(h, sl);
  
      return 0;
  }
Simple merge
@@@ -633,14 -633,9 +633,14 @@@ static av_always_inline void hl_decode_
                  uint8_t *const ptr = dest_y + block_offset[i];
                  const int dir      = sl->intra4x4_pred_mode_cache[scan8[i]];
                  if (transform_bypass && h->sps.profile_idc == 244 && dir <= 1) {
 -                    h->hpc.pred8x8l_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
 +                    if (h->x264_build != -1) {
 +                        h->hpc.pred8x8l_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
 +                    } else
 +                        h->hpc.pred8x8l_filter_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift),
 +                                                        (sl-> topleft_samples_available << i) & 0x8000,
 +                                                        (sl->topright_samples_available << i) & 0x4000, linesize);
                  } else {
-                     const int nnz = h->non_zero_count_cache[scan8[i + p * 16]];
+                     const int nnz = sl->non_zero_count_cache[scan8[i + p * 16]];
                      h->hpc.pred8x8l[dir](ptr, (sl->topleft_samples_available << i) & 0x8000,
                                           (sl->topright_samples_available << i) & 0x4000, linesize);
                      if (nnz) {
Simple merge
Simple merge
Simple merge
Simple merge