Merge "Remove coeff from BLOCK" into experimental
This commit is contained in:
		@@ -24,9 +24,6 @@ typedef struct {
 | 
				
			|||||||
} search_site;
 | 
					} search_site;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct block {
 | 
					typedef struct block {
 | 
				
			||||||
  // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
 | 
					 | 
				
			||||||
  int16_t *coeff;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
 | 
					  // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
 | 
				
			||||||
  int16_t *quant;
 | 
					  int16_t *quant;
 | 
				
			||||||
  int16_t *quant_fast;      // fast quant deprecated for now
 | 
					  int16_t *quant_fast;      // fast quant deprecated for now
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1248,8 +1248,6 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  vp9_setup_block_dptrs(&x->e_mbd);
 | 
					  vp9_setup_block_dptrs(&x->e_mbd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  vp9_setup_block_ptrs(x);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  xd->mode_info_context->mbmi.mode = DC_PRED;
 | 
					  xd->mode_info_context->mbmi.mode = DC_PRED;
 | 
				
			||||||
  xd->mode_info_context->mbmi.uv_mode = DC_PRED;
 | 
					  xd->mode_info_context->mbmi.uv_mode = DC_PRED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1733,17 +1731,6 @@ void vp9_encode_frame(VP9_COMP *cpi) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void vp9_setup_block_ptrs(MACROBLOCK *x) {
 | 
					 | 
				
			||||||
  int i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (i = 0; i < 16; i++)
 | 
					 | 
				
			||||||
    x->block[i].coeff = x->plane[0].coeff + i * 16;
 | 
					 | 
				
			||||||
  for (i = 16; i < 20; i++)
 | 
					 | 
				
			||||||
    x->block[i].coeff = x->plane[1].coeff + (i - 16) * 16;
 | 
					 | 
				
			||||||
  for (i = 20; i < 24; i++)
 | 
					 | 
				
			||||||
    x->block[i].coeff = x->plane[2].coeff + (i - 20) * 16;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void vp9_build_block_offsets(MACROBLOCK *x) {
 | 
					void vp9_build_block_offsets(MACROBLOCK *x) {
 | 
				
			||||||
  int block = 0;
 | 
					  int block = 0;
 | 
				
			||||||
  int br, bc;
 | 
					  int br, bc;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,4 @@ struct macroblock;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void vp9_build_block_offsets(struct macroblock *x);
 | 
					void vp9_build_block_offsets(struct macroblock *x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void vp9_setup_block_ptrs(struct macroblock *x);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif  // VP9_ENCODER_VP9_ENCODEFRAME_H_
 | 
					#endif  // VP9_ENCODER_VP9_ENCODEFRAME_H_
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,6 +48,7 @@ static void encode_intra4x4block(MACROBLOCK *x, int ib) {
 | 
				
			|||||||
  int16_t* const src_diff =
 | 
					  int16_t* const src_diff =
 | 
				
			||||||
      raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
 | 
					      raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
 | 
				
			||||||
                                x->plane[0].src_diff);
 | 
					                                x->plane[0].src_diff);
 | 
				
			||||||
 | 
					  int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, ib, 16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  assert(ib < 16);
 | 
					  assert(ib < 16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -63,12 +64,12 @@ static void encode_intra4x4block(MACROBLOCK *x, int ib) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  tx_type = get_tx_type_4x4(&x->e_mbd, ib);
 | 
					  tx_type = get_tx_type_4x4(&x->e_mbd, ib);
 | 
				
			||||||
  if (tx_type != DCT_DCT) {
 | 
					  if (tx_type != DCT_DCT) {
 | 
				
			||||||
    vp9_short_fht4x4(src_diff, be->coeff, 16, tx_type);
 | 
					    vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
 | 
				
			||||||
    vp9_ht_quantize_b_4x4(x, ib, tx_type);
 | 
					    vp9_ht_quantize_b_4x4(x, ib, tx_type);
 | 
				
			||||||
    vp9_short_iht4x4(BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
 | 
					    vp9_short_iht4x4(BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
 | 
				
			||||||
                     b->diff, 16, tx_type);
 | 
					                     b->diff, 16, tx_type);
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    x->fwd_txm4x4(src_diff, be->coeff, 32);
 | 
					    x->fwd_txm4x4(src_diff, coeff, 32);
 | 
				
			||||||
    x->quantize_b_4x4(x, ib, 16);
 | 
					    x->quantize_b_4x4(x, ib, 16);
 | 
				
			||||||
    vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[0].eobs[ib],
 | 
					    vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[0].eobs[ib],
 | 
				
			||||||
                                BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
 | 
					                                BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
 | 
				
			||||||
@@ -167,24 +168,26 @@ void vp9_encode_intra8x8(MACROBLOCK *x, int ib) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
 | 
					  if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
 | 
				
			||||||
    int idx = (ib & 0x02) ? (ib + 2) : ib;
 | 
					    int idx = (ib & 0x02) ? (ib + 2) : ib;
 | 
				
			||||||
    int16_t * const dqcoeff = BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16);
 | 
					    int16_t* const dqcoeff = BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16);
 | 
				
			||||||
 | 
					    int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, idx, 16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(idx < 16);
 | 
					    assert(idx < 16);
 | 
				
			||||||
    tx_type = get_tx_type_8x8(xd, ib);
 | 
					    tx_type = get_tx_type_8x8(xd, ib);
 | 
				
			||||||
    if (tx_type != DCT_DCT) {
 | 
					    if (tx_type != DCT_DCT) {
 | 
				
			||||||
      vp9_short_fht8x8(src_diff, (x->block + idx)->coeff, 16, tx_type);
 | 
					      vp9_short_fht8x8(src_diff, coeff, 16, tx_type);
 | 
				
			||||||
      x->quantize_b_8x8(x, idx, tx_type, 16);
 | 
					      x->quantize_b_8x8(x, idx, tx_type, 16);
 | 
				
			||||||
      vp9_short_iht8x8(dqcoeff, xd->block[ib].diff,
 | 
					      vp9_short_iht8x8(dqcoeff, xd->block[ib].diff,
 | 
				
			||||||
                            16, tx_type);
 | 
					                            16, tx_type);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      x->fwd_txm8x8(src_diff, (x->block + idx)->coeff, 32);
 | 
					      x->fwd_txm8x8(src_diff, coeff, 32);
 | 
				
			||||||
      x->quantize_b_8x8(x, idx, DCT_DCT, 16);
 | 
					      x->quantize_b_8x8(x, idx, DCT_DCT, 16);
 | 
				
			||||||
      vp9_short_idct8x8(dqcoeff, xd->block[ib].diff, 32);
 | 
					      vp9_short_idct8x8(dqcoeff, xd->block[ib].diff, 32);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    for (i = 0; i < 4; i++) {
 | 
					    for (i = 0; i < 4; i++) {
 | 
				
			||||||
      int idx = ib + iblock[i];
 | 
					      int idx = ib + iblock[i];
 | 
				
			||||||
      int16_t * const dqcoeff = BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16);
 | 
					      int16_t* const dqcoeff = BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16);
 | 
				
			||||||
 | 
					      int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, idx, 16);
 | 
				
			||||||
      int16_t* const src_diff =
 | 
					      int16_t* const src_diff =
 | 
				
			||||||
          raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, idx,
 | 
					          raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, idx,
 | 
				
			||||||
                                    x->plane[0].src_diff);
 | 
					                                    x->plane[0].src_diff);
 | 
				
			||||||
@@ -194,12 +197,12 @@ void vp9_encode_intra8x8(MACROBLOCK *x, int ib) {
 | 
				
			|||||||
      be = &x->block[ib + iblock[i]];
 | 
					      be = &x->block[ib + iblock[i]];
 | 
				
			||||||
      tx_type = get_tx_type_4x4(xd, ib + iblock[i]);
 | 
					      tx_type = get_tx_type_4x4(xd, ib + iblock[i]);
 | 
				
			||||||
      if (tx_type != DCT_DCT) {
 | 
					      if (tx_type != DCT_DCT) {
 | 
				
			||||||
        vp9_short_fht4x4(src_diff, be->coeff, 16, tx_type);
 | 
					        vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
 | 
				
			||||||
        vp9_ht_quantize_b_4x4(x, ib + iblock[i], tx_type);
 | 
					        vp9_ht_quantize_b_4x4(x, ib + iblock[i], tx_type);
 | 
				
			||||||
        vp9_short_iht4x4(dqcoeff, b->diff, 16, tx_type);
 | 
					        vp9_short_iht4x4(dqcoeff, b->diff, 16, tx_type);
 | 
				
			||||||
      } else if (!(i & 1) &&
 | 
					      } else if (!(i & 1) &&
 | 
				
			||||||
                 get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
 | 
					                 get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
 | 
				
			||||||
        x->fwd_txm8x4(src_diff, be->coeff, 32);
 | 
					        x->fwd_txm8x4(src_diff, coeff, 32);
 | 
				
			||||||
        x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1, 16);
 | 
					        x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1, 16);
 | 
				
			||||||
        vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
 | 
					        vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
 | 
				
			||||||
                                    dqcoeff, b->diff, 32);
 | 
					                                    dqcoeff, b->diff, 32);
 | 
				
			||||||
@@ -207,7 +210,7 @@ void vp9_encode_intra8x8(MACROBLOCK *x, int ib) {
 | 
				
			|||||||
                                    dqcoeff + 16, (b + 1)->diff, 32);
 | 
					                                    dqcoeff + 16, (b + 1)->diff, 32);
 | 
				
			||||||
        i++;
 | 
					        i++;
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        x->fwd_txm4x4(src_diff, be->coeff, 32);
 | 
					        x->fwd_txm4x4(src_diff, coeff, 32);
 | 
				
			||||||
        x->quantize_b_4x4(x, ib + iblock[i], 16);
 | 
					        x->quantize_b_4x4(x, ib + iblock[i], 16);
 | 
				
			||||||
        vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
 | 
					        vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
 | 
				
			||||||
                                    dqcoeff, b->diff, 32);
 | 
					                                    dqcoeff, b->diff, 32);
 | 
				
			||||||
@@ -235,6 +238,7 @@ static void encode_intra_uv4x4(MACROBLOCK *x, int ib, int mode) {
 | 
				
			|||||||
  BLOCKD *b = &x->e_mbd.block[ib];
 | 
					  BLOCKD *b = &x->e_mbd.block[ib];
 | 
				
			||||||
  BLOCK *be = &x->block[ib];
 | 
					  BLOCK *be = &x->block[ib];
 | 
				
			||||||
  int16_t * const dqcoeff = MB_SUBBLOCK_FIELD(xd, dqcoeff, ib);
 | 
					  int16_t * const dqcoeff = MB_SUBBLOCK_FIELD(xd, dqcoeff, ib);
 | 
				
			||||||
 | 
					  int16_t* const coeff = MB_SUBBLOCK_FIELD(x, coeff, ib);
 | 
				
			||||||
  const int plane = ib < 20 ? 1 : 2;
 | 
					  const int plane = ib < 20 ? 1 : 2;
 | 
				
			||||||
  const int block = ib < 20 ? ib - 16 : ib - 20;
 | 
					  const int block = ib < 20 ? ib - 16 : ib - 20;
 | 
				
			||||||
  int16_t* const src_diff =
 | 
					  int16_t* const src_diff =
 | 
				
			||||||
@@ -250,7 +254,7 @@ static void encode_intra_uv4x4(MACROBLOCK *x, int ib, int mode) {
 | 
				
			|||||||
                     *(be->base_src) + be->src, be->src_stride,
 | 
					                     *(be->base_src) + be->src, be->src_stride,
 | 
				
			||||||
                     *(b->base_dst) + b->dst, b->dst_stride);
 | 
					                     *(b->base_dst) + b->dst, b->dst_stride);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  x->fwd_txm4x4(src_diff, be->coeff, 16);
 | 
					  x->fwd_txm4x4(src_diff, coeff, 16);
 | 
				
			||||||
  x->quantize_b_4x4(x, ib, 16);
 | 
					  x->quantize_b_4x4(x, ib, 16);
 | 
				
			||||||
  vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[plane].eobs[block],
 | 
					  vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[plane].eobs[block],
 | 
				
			||||||
                              dqcoeff, b->diff, 16);
 | 
					                              dqcoeff, b->diff, 16);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -496,8 +496,6 @@ void vp9_first_pass(VP9_COMP *cpi) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  vp9_setup_block_dptrs(&x->e_mbd);
 | 
					  vp9_setup_block_dptrs(&x->e_mbd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  vp9_setup_block_ptrs(x);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // set up frame new frame for intra coded blocks
 | 
					  // set up frame new frame for intra coded blocks
 | 
				
			||||||
  vp9_setup_intra_recon(new_yv12);
 | 
					  vp9_setup_intra_recon(new_yv12);
 | 
				
			||||||
  vp9_frame_init_quantizer(cpi);
 | 
					  vp9_frame_init_quantizer(cpi);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -855,6 +855,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
 | 
				
			|||||||
  int16_t* const src_diff =
 | 
					  int16_t* const src_diff =
 | 
				
			||||||
      raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
 | 
					      raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
 | 
				
			||||||
                                x->plane[0].src_diff);
 | 
					                                x->plane[0].src_diff);
 | 
				
			||||||
 | 
					  int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, ib, 16);
 | 
				
			||||||
  ENTROPY_CONTEXT ta = *a, tempa = *a;
 | 
					  ENTROPY_CONTEXT ta = *a, tempa = *a;
 | 
				
			||||||
  ENTROPY_CONTEXT tl = *l, templ = *l;
 | 
					  ENTROPY_CONTEXT tl = *l, templ = *l;
 | 
				
			||||||
  TX_TYPE tx_type = DCT_DCT;
 | 
					  TX_TYPE tx_type = DCT_DCT;
 | 
				
			||||||
@@ -901,10 +902,10 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
 | 
				
			|||||||
    b->bmi.as_mode.first = mode;
 | 
					    b->bmi.as_mode.first = mode;
 | 
				
			||||||
    tx_type = get_tx_type_4x4(xd, be - x->block);
 | 
					    tx_type = get_tx_type_4x4(xd, be - x->block);
 | 
				
			||||||
    if (tx_type != DCT_DCT) {
 | 
					    if (tx_type != DCT_DCT) {
 | 
				
			||||||
      vp9_short_fht4x4(src_diff, be->coeff, 16, tx_type);
 | 
					      vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
 | 
				
			||||||
      vp9_ht_quantize_b_4x4(x, be - x->block, tx_type);
 | 
					      vp9_ht_quantize_b_4x4(x, be - x->block, tx_type);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      x->fwd_txm4x4(src_diff, be->coeff, 32);
 | 
					      x->fwd_txm4x4(src_diff, coeff, 32);
 | 
				
			||||||
      x->quantize_b_4x4(x, be - x->block, 16);
 | 
					      x->quantize_b_4x4(x, be - x->block, 16);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -914,7 +915,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
 | 
				
			|||||||
    ratey = cost_coeffs(cm, x, b - xd->block,
 | 
					    ratey = cost_coeffs(cm, x, b - xd->block,
 | 
				
			||||||
                        PLANE_TYPE_Y_WITH_DC, &tempa, &templ, TX_4X4, 16);
 | 
					                        PLANE_TYPE_Y_WITH_DC, &tempa, &templ, TX_4X4, 16);
 | 
				
			||||||
    rate += ratey;
 | 
					    rate += ratey;
 | 
				
			||||||
    distortion = vp9_block_error(be->coeff,
 | 
					    distortion = vp9_block_error(coeff,
 | 
				
			||||||
                                 BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
 | 
					                                 BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
 | 
				
			||||||
                                 16) >> 2;
 | 
					                                 16) >> 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1092,6 +1093,7 @@ static int64_t rd_pick_intra8x8block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
 | 
				
			|||||||
  int16_t* const src_diff =
 | 
					  int16_t* const src_diff =
 | 
				
			||||||
      raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
 | 
					      raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
 | 
				
			||||||
                                x->plane[0].src_diff);
 | 
					                                x->plane[0].src_diff);
 | 
				
			||||||
 | 
					  int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, idx, 16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  assert(ib < 16);
 | 
					  assert(ib < 16);
 | 
				
			||||||
  for (mode = DC_PRED; mode <= TM_PRED; mode++) {
 | 
					  for (mode = DC_PRED; mode <= TM_PRED; mode++) {
 | 
				
			||||||
@@ -1111,13 +1113,13 @@ static int64_t rd_pick_intra8x8block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
 | 
				
			|||||||
    if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
 | 
					    if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
 | 
				
			||||||
      TX_TYPE tx_type = get_tx_type_8x8(xd, ib);
 | 
					      TX_TYPE tx_type = get_tx_type_8x8(xd, ib);
 | 
				
			||||||
      if (tx_type != DCT_DCT)
 | 
					      if (tx_type != DCT_DCT)
 | 
				
			||||||
        vp9_short_fht8x8(src_diff, (x->block + idx)->coeff, 16, tx_type);
 | 
					        vp9_short_fht8x8(src_diff, coeff, 16, tx_type);
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        x->fwd_txm8x8(src_diff, (x->block + idx)->coeff, 32);
 | 
					        x->fwd_txm8x8(src_diff, coeff, 32);
 | 
				
			||||||
      x->quantize_b_8x8(x, idx, tx_type, 16);
 | 
					      x->quantize_b_8x8(x, idx, tx_type, 16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // compute quantization mse of 8x8 block
 | 
					      // compute quantization mse of 8x8 block
 | 
				
			||||||
      distortion = vp9_block_error_c((x->block + idx)->coeff,
 | 
					      distortion = vp9_block_error_c(coeff,
 | 
				
			||||||
          BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64);
 | 
					          BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      vpx_memcpy(&ta, a, sizeof(ENTROPY_CONTEXT_PLANES));
 | 
					      vpx_memcpy(&ta, a, sizeof(ENTROPY_CONTEXT_PLANES));
 | 
				
			||||||
@@ -1149,23 +1151,25 @@ static int64_t rd_pick_intra8x8block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
 | 
				
			|||||||
            raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16,
 | 
					            raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16,
 | 
				
			||||||
                                      0, ib + iblock[i],
 | 
					                                      0, ib + iblock[i],
 | 
				
			||||||
                                      x->plane[0].src_diff);
 | 
					                                      x->plane[0].src_diff);
 | 
				
			||||||
 | 
					        int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff,
 | 
				
			||||||
 | 
					                                            ib + iblock[i], 16);
 | 
				
			||||||
        int do_two = 0;
 | 
					        int do_two = 0;
 | 
				
			||||||
        b = &xd->block[ib + iblock[i]];
 | 
					        b = &xd->block[ib + iblock[i]];
 | 
				
			||||||
        be = &x->block[ib + iblock[i]];
 | 
					        be = &x->block[ib + iblock[i]];
 | 
				
			||||||
        tx_type = get_tx_type_4x4(xd, ib + iblock[i]);
 | 
					        tx_type = get_tx_type_4x4(xd, ib + iblock[i]);
 | 
				
			||||||
        if (tx_type != DCT_DCT) {
 | 
					        if (tx_type != DCT_DCT) {
 | 
				
			||||||
          vp9_short_fht4x4(src_diff, be->coeff, 16, tx_type);
 | 
					          vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
 | 
				
			||||||
          vp9_ht_quantize_b_4x4(x, ib + iblock[i], tx_type);
 | 
					          vp9_ht_quantize_b_4x4(x, ib + iblock[i], tx_type);
 | 
				
			||||||
        } else if (!(i & 1) &&
 | 
					        } else if (!(i & 1) &&
 | 
				
			||||||
                   get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
 | 
					                   get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
 | 
				
			||||||
          x->fwd_txm8x4(src_diff, be->coeff, 32);
 | 
					          x->fwd_txm8x4(src_diff, coeff, 32);
 | 
				
			||||||
          x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1, 16);
 | 
					          x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1, 16);
 | 
				
			||||||
          do_two = 1;
 | 
					          do_two = 1;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          x->fwd_txm4x4(src_diff, be->coeff, 32);
 | 
					          x->fwd_txm4x4(src_diff, coeff, 32);
 | 
				
			||||||
          x->quantize_b_4x4(x, ib + iblock[i], 16);
 | 
					          x->quantize_b_4x4(x, ib + iblock[i], 16);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        distortion += vp9_block_error_c(be->coeff,
 | 
					        distortion += vp9_block_error_c(coeff,
 | 
				
			||||||
            BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[i], 16),
 | 
					            BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[i], 16),
 | 
				
			||||||
            16 << do_two);
 | 
					            16 << do_two);
 | 
				
			||||||
        rate_t += cost_coeffs(cm, x, ib + iblock[i], PLANE_TYPE_Y_WITH_DC,
 | 
					        rate_t += cost_coeffs(cm, x, ib + iblock[i], PLANE_TYPE_Y_WITH_DC,
 | 
				
			||||||
@@ -1708,6 +1712,7 @@ static int64_t encode_inter_mb_segment(VP9_COMMON *const cm,
 | 
				
			|||||||
      int16_t* const src_diff =
 | 
					      int16_t* const src_diff =
 | 
				
			||||||
          raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, i,
 | 
					          raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, i,
 | 
				
			||||||
                                    x->plane[0].src_diff);
 | 
					                                    x->plane[0].src_diff);
 | 
				
			||||||
 | 
					      int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, 16, i);
 | 
				
			||||||
      int thisdistortion;
 | 
					      int thisdistortion;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      vp9_build_inter_predictor(*(bd->base_pre) + bd->pre,
 | 
					      vp9_build_inter_predictor(*(bd->base_pre) + bd->pre,
 | 
				
			||||||
@@ -1732,9 +1737,9 @@ static int64_t encode_inter_mb_segment(VP9_COMMON *const cm,
 | 
				
			|||||||
      vp9_subtract_block(4, 4, src_diff, 16,
 | 
					      vp9_subtract_block(4, 4, src_diff, 16,
 | 
				
			||||||
                         *(be->base_src) + be->src, be->src_stride,
 | 
					                         *(be->base_src) + be->src, be->src_stride,
 | 
				
			||||||
                         *(bd->base_dst) + bd->dst, bd->dst_stride);
 | 
					                         *(bd->base_dst) + bd->dst, bd->dst_stride);
 | 
				
			||||||
      x->fwd_txm4x4(src_diff, be->coeff, 32);
 | 
					      x->fwd_txm4x4(src_diff, coeff, 32);
 | 
				
			||||||
      x->quantize_b_4x4(x, i, 16);
 | 
					      x->quantize_b_4x4(x, i, 16);
 | 
				
			||||||
      thisdistortion = vp9_block_error(be->coeff,
 | 
					      thisdistortion = vp9_block_error(coeff,
 | 
				
			||||||
          BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16), 16);
 | 
					          BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16), 16);
 | 
				
			||||||
      *distortion += thisdistortion;
 | 
					      *distortion += thisdistortion;
 | 
				
			||||||
      *labelyrate += cost_coeffs(cm, x, i, PLANE_TYPE_Y_WITH_DC,
 | 
					      *labelyrate += cost_coeffs(cm, x, i, PLANE_TYPE_Y_WITH_DC,
 | 
				
			||||||
@@ -1779,10 +1784,11 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
 | 
				
			|||||||
      int which_mv;
 | 
					      int which_mv;
 | 
				
			||||||
      const int idx = (ib & 8) + ((ib & 2) << 1);
 | 
					      const int idx = (ib & 8) + ((ib & 2) << 1);
 | 
				
			||||||
      BLOCKD *bd = &xd->block[ib];
 | 
					      BLOCKD *bd = &xd->block[ib];
 | 
				
			||||||
      BLOCK *be = &x->block[ib], *be2 = &x->block[idx];
 | 
					      BLOCK *be = &x->block[ib];
 | 
				
			||||||
      int16_t* const src_diff =
 | 
					      int16_t* const src_diff =
 | 
				
			||||||
          raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
 | 
					          raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
 | 
				
			||||||
                                    x->plane[0].src_diff);
 | 
					                                    x->plane[0].src_diff);
 | 
				
			||||||
 | 
					      int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, idx, 16);
 | 
				
			||||||
      int thisdistortion;
 | 
					      int thisdistortion;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      assert(idx < 16);
 | 
					      assert(idx < 16);
 | 
				
			||||||
@@ -1805,9 +1811,9 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      if (xd->mode_info_context->mbmi.txfm_size == TX_4X4) {
 | 
					      if (xd->mode_info_context->mbmi.txfm_size == TX_4X4) {
 | 
				
			||||||
        if (otherrd) {
 | 
					        if (otherrd) {
 | 
				
			||||||
          x->fwd_txm8x8(src_diff, be2->coeff, 32);
 | 
					          x->fwd_txm8x8(src_diff, coeff, 32);
 | 
				
			||||||
          x->quantize_b_8x8(x, idx, DCT_DCT, 16);
 | 
					          x->quantize_b_8x8(x, idx, DCT_DCT, 16);
 | 
				
			||||||
          thisdistortion = vp9_block_error_c(be2->coeff,
 | 
					          thisdistortion = vp9_block_error_c(coeff,
 | 
				
			||||||
              BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64);
 | 
					              BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64);
 | 
				
			||||||
          otherdist += thisdistortion;
 | 
					          otherdist += thisdistortion;
 | 
				
			||||||
          xd->mode_info_context->mbmi.txfm_size = TX_8X8;
 | 
					          xd->mode_info_context->mbmi.txfm_size = TX_8X8;
 | 
				
			||||||
@@ -1822,11 +1828,13 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
 | 
				
			|||||||
              raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16,
 | 
					              raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16,
 | 
				
			||||||
                                        0, ib + iblock[j],
 | 
					                                        0, ib + iblock[j],
 | 
				
			||||||
                                        x->plane[0].src_diff);
 | 
					                                        x->plane[0].src_diff);
 | 
				
			||||||
 | 
					          int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff,
 | 
				
			||||||
 | 
					                                              ib + iblock[j], 16);
 | 
				
			||||||
          bd = &xd->block[ib + iblock[j]];
 | 
					          bd = &xd->block[ib + iblock[j]];
 | 
				
			||||||
          be = &x->block[ib + iblock[j]];
 | 
					          be = &x->block[ib + iblock[j]];
 | 
				
			||||||
          x->fwd_txm8x4(src_diff, be->coeff, 32);
 | 
					          x->fwd_txm8x4(src_diff, coeff, 32);
 | 
				
			||||||
          x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1, 16);
 | 
					          x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1, 16);
 | 
				
			||||||
          thisdistortion = vp9_block_error_c(be->coeff,
 | 
					          thisdistortion = vp9_block_error_c(coeff,
 | 
				
			||||||
              BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[j], 16), 32);
 | 
					              BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[j], 16), 32);
 | 
				
			||||||
          *distortion += thisdistortion;
 | 
					          *distortion += thisdistortion;
 | 
				
			||||||
          *labelyrate +=
 | 
					          *labelyrate +=
 | 
				
			||||||
@@ -1844,14 +1852,15 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
 | 
				
			|||||||
      } else /* 8x8 */ {
 | 
					      } else /* 8x8 */ {
 | 
				
			||||||
        if (otherrd) {
 | 
					        if (otherrd) {
 | 
				
			||||||
          for (j = 0; j < 4; j += 2) {
 | 
					          for (j = 0; j < 4; j += 2) {
 | 
				
			||||||
            BLOCK *be = &x->block[ib + iblock[j]];
 | 
					 | 
				
			||||||
            int16_t* const src_diff =
 | 
					            int16_t* const src_diff =
 | 
				
			||||||
                raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16,
 | 
					                raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16,
 | 
				
			||||||
                                          0, ib + iblock[j],
 | 
					                                          0, ib + iblock[j],
 | 
				
			||||||
                                          x->plane[0].src_diff);
 | 
					                                          x->plane[0].src_diff);
 | 
				
			||||||
            x->fwd_txm8x4(src_diff, be->coeff, 32);
 | 
					            int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff,
 | 
				
			||||||
 | 
					                                                ib + iblock[j], 16);
 | 
				
			||||||
 | 
					            x->fwd_txm8x4(src_diff, coeff, 32);
 | 
				
			||||||
            x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1, 16);
 | 
					            x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1, 16);
 | 
				
			||||||
            thisdistortion = vp9_block_error_c(be->coeff,
 | 
					            thisdistortion = vp9_block_error_c(coeff,
 | 
				
			||||||
                BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[j], 16), 32);
 | 
					                BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[j], 16), 32);
 | 
				
			||||||
            otherdist += thisdistortion;
 | 
					            otherdist += thisdistortion;
 | 
				
			||||||
            xd->mode_info_context->mbmi.txfm_size = TX_4X4;
 | 
					            xd->mode_info_context->mbmi.txfm_size = TX_4X4;
 | 
				
			||||||
@@ -1869,9 +1878,9 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
 | 
				
			|||||||
            xd->mode_info_context->mbmi.txfm_size = TX_8X8;
 | 
					            xd->mode_info_context->mbmi.txfm_size = TX_8X8;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        x->fwd_txm8x8(src_diff, be2->coeff, 32);
 | 
					        x->fwd_txm8x8(src_diff, coeff, 32);
 | 
				
			||||||
        x->quantize_b_8x8(x, idx, DCT_DCT, 16);
 | 
					        x->quantize_b_8x8(x, idx, DCT_DCT, 16);
 | 
				
			||||||
        thisdistortion = vp9_block_error_c(be2->coeff,
 | 
					        thisdistortion = vp9_block_error_c(coeff,
 | 
				
			||||||
            BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64);
 | 
					            BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64);
 | 
				
			||||||
        *distortion += thisdistortion;
 | 
					        *distortion += thisdistortion;
 | 
				
			||||||
        *labelyrate += cost_coeffs(cm, x, idx, PLANE_TYPE_Y_WITH_DC,
 | 
					        *labelyrate += cost_coeffs(cm, x, idx, PLANE_TYPE_Y_WITH_DC,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user