| Index: source/libvpx/vp9/encoder/vp9_encodemb.c
|
| ===================================================================
|
| --- source/libvpx/vp9/encoder/vp9_encodemb.c (revision 219822)
|
| +++ source/libvpx/vp9/encoder/vp9_encodemb.c (working copy)
|
| @@ -47,8 +47,29 @@
|
| xd->inv_txm4x4_add(dqcoeff, dest, stride);
|
| }
|
|
|
| +static void inverse_transform_b_8x8_add(int eob,
|
| + int16_t *dqcoeff, uint8_t *dest,
|
| + int stride) {
|
| + if (eob <= 1)
|
| + vp9_short_idct8x8_1_add(dqcoeff, dest, stride);
|
| + else if (eob <= 10)
|
| + vp9_short_idct10_8x8_add(dqcoeff, dest, stride);
|
| + else
|
| + vp9_short_idct8x8_add(dqcoeff, dest, stride);
|
| +}
|
|
|
| -static void subtract_plane(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize, int plane) {
|
| +static void inverse_transform_b_16x16_add(int eob,
|
| + int16_t *dqcoeff, uint8_t *dest,
|
| + int stride) {
|
| + if (eob <= 1)
|
| + vp9_short_idct16x16_1_add(dqcoeff, dest, stride);
|
| + else if (eob <= 10)
|
| + vp9_short_idct10_16x16_add(dqcoeff, dest, stride);
|
| + else
|
| + vp9_short_idct16x16_add(dqcoeff, dest, stride);
|
| +}
|
| +
|
| +static void subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
|
| struct macroblock_plane *const p = &x->plane[plane];
|
| const MACROBLOCKD *const xd = &x->e_mbd;
|
| const struct macroblockd_plane *const pd = &xd->plane[plane];
|
| @@ -60,18 +81,18 @@
|
| pd->dst.buf, pd->dst.stride);
|
| }
|
|
|
| -void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
| +void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
| subtract_plane(x, bsize, 0);
|
| }
|
|
|
| -void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
| +void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
| int i;
|
|
|
| for (i = 1; i < MAX_MB_PLANE; i++)
|
| subtract_plane(x, bsize, i);
|
| }
|
|
|
| -void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
| +void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
| vp9_subtract_sby(x, bsize);
|
| vp9_subtract_sbuv(x, bsize);
|
| }
|
| @@ -120,38 +141,37 @@
|
| return pt;
|
| }
|
|
|
| -static void optimize_b(VP9_COMMON *const cm, MACROBLOCK *mb,
|
| - int plane, int block, BLOCK_SIZE_TYPE bsize,
|
| +static void optimize_b(MACROBLOCK *mb,
|
| + int plane, int block, BLOCK_SIZE plane_bsize,
|
| ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
|
| TX_SIZE tx_size) {
|
| - const int ref = mb->e_mbd.mode_info_context->mbmi.ref_frame[0] != INTRA_FRAME;
|
| MACROBLOCKD *const xd = &mb->e_mbd;
|
| + struct macroblockd_plane *pd = &xd->plane[plane];
|
| + const int ref = is_inter_block(&xd->mode_info_context->mbmi);
|
| vp9_token_state tokens[1025][2];
|
| unsigned best_index[1025][2];
|
| - const int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[plane].coeff,
|
| - block, 16);
|
| + const int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[plane].coeff, block);
|
| int16_t *qcoeff_ptr;
|
| int16_t *dqcoeff_ptr;
|
| - int eob = xd->plane[plane].eobs[block], final_eob, sz = 0;
|
| + int eob = pd->eobs[block], final_eob, sz = 0;
|
| const int i0 = 0;
|
| int rc, x, next, i;
|
| int64_t rdmult, rddiv, rd_cost0, rd_cost1;
|
| int rate0, rate1, error0, error1, t0, t1;
|
| int best, band, pt;
|
| - PLANE_TYPE type = xd->plane[plane].plane_type;
|
| + PLANE_TYPE type = pd->plane_type;
|
| int err_mult = plane_rd_mult[type];
|
| int default_eob;
|
| const int16_t *scan, *nb;
|
| const int mul = 1 + (tx_size == TX_32X32);
|
| uint8_t token_cache[1024];
|
| - const int ib = txfrm_block_to_raster_block(xd, bsize, plane,
|
| - block, 2 * tx_size);
|
| - const int16_t *dequant_ptr = xd->plane[plane].dequant;
|
| + const int ib = txfrm_block_to_raster_block(plane_bsize, tx_size, block);
|
| + const int16_t *dequant_ptr = pd->dequant;
|
| const uint8_t * band_translate;
|
|
|
| assert((!type && !plane) || (type && plane));
|
| - dqcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].dqcoeff, block, 16);
|
| - qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16);
|
| + dqcoeff_ptr = BLOCK_OFFSET(pd->dqcoeff, block);
|
| + qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block);
|
| switch (tx_size) {
|
| default:
|
| case TX_4X4:
|
| @@ -214,10 +234,10 @@
|
| band = get_coef_band(band_translate, i + 1);
|
| pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache);
|
| rate0 +=
|
| - mb->token_costs[tx_size][type][ref][0][band][pt]
|
| + mb->token_costs[tx_size][type][ref][band][0][pt]
|
| [tokens[next][0].token];
|
| rate1 +=
|
| - mb->token_costs[tx_size][type][ref][0][band][pt]
|
| + mb->token_costs[tx_size][type][ref][band][0][pt]
|
| [tokens[next][1].token];
|
| }
|
| UPDATE_RD_COST();
|
| @@ -265,12 +285,12 @@
|
| band = get_coef_band(band_translate, i + 1);
|
| if (t0 != DCT_EOB_TOKEN) {
|
| pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache);
|
| - rate0 += mb->token_costs[tx_size][type][ref][!x][band][pt]
|
| + rate0 += mb->token_costs[tx_size][type][ref][band][!x][pt]
|
| [tokens[next][0].token];
|
| }
|
| if (t1 != DCT_EOB_TOKEN) {
|
| pt = trellis_get_coeff_context(scan, nb, i, t1, token_cache);
|
| - rate1 += mb->token_costs[tx_size][type][ref][!x][band][pt]
|
| + rate1 += mb->token_costs[tx_size][type][ref][band][!x][pt]
|
| [tokens[next][1].token];
|
| }
|
| }
|
| @@ -303,12 +323,12 @@
|
| /* Update the cost of each path if we're past the EOB token. */
|
| if (t0 != DCT_EOB_TOKEN) {
|
| tokens[next][0].rate +=
|
| - mb->token_costs[tx_size][type][ref][1][band][0][t0];
|
| + mb->token_costs[tx_size][type][ref][band][1][0][t0];
|
| tokens[next][0].token = ZERO_TOKEN;
|
| }
|
| if (t1 != DCT_EOB_TOKEN) {
|
| tokens[next][1].rate +=
|
| - mb->token_costs[tx_size][type][ref][1][band][0][t1];
|
| + mb->token_costs[tx_size][type][ref][band][1][0][t1];
|
| tokens[next][1].token = ZERO_TOKEN;
|
| }
|
| best_index[i][0] = best_index[i][1] = 0;
|
| @@ -325,8 +345,8 @@
|
| error1 = tokens[next][1].error;
|
| t0 = tokens[next][0].token;
|
| t1 = tokens[next][1].token;
|
| - rate0 += mb->token_costs[tx_size][type][ref][0][band][pt][t0];
|
| - rate1 += mb->token_costs[tx_size][type][ref][0][band][pt][t1];
|
| + rate0 += mb->token_costs[tx_size][type][ref][band][0][pt][t0];
|
| + rate1 += mb->token_costs[tx_size][type][ref][band][0][pt][t1];
|
| UPDATE_RD_COST();
|
| best = rd_cost1 < rd_cost0;
|
| final_eob = i0 - 1;
|
| @@ -350,85 +370,68 @@
|
| *a = *l = (final_eob > 0);
|
| }
|
|
|
| -void vp9_optimize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
|
| - int ss_txfrm_size, VP9_COMMON *cm, MACROBLOCK *mb,
|
| - struct optimize_ctx *ctx) {
|
| - MACROBLOCKD *const xd = &mb->e_mbd;
|
| +void vp9_optimize_b(int plane, int block, BLOCK_SIZE plane_bsize,
|
| + TX_SIZE tx_size, MACROBLOCK *mb, struct optimize_ctx *ctx) {
|
| int x, y;
|
| -
|
| - // find current entropy context
|
| - txfrm_block_to_raster_xy(xd, bsize, plane, block, ss_txfrm_size, &x, &y);
|
| -
|
| - optimize_b(cm, mb, plane, block, bsize,
|
| - &ctx->ta[plane][x], &ctx->tl[plane][y], ss_txfrm_size / 2);
|
| + txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
|
| + optimize_b(mb, plane, block, plane_bsize,
|
| + &ctx->ta[plane][x], &ctx->tl[plane][y], tx_size);
|
| }
|
|
|
| -static void optimize_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
|
| - int ss_txfrm_size, void *arg) {
|
| - const struct encode_b_args* const args = arg;
|
| - vp9_optimize_b(plane, block, bsize, ss_txfrm_size, args->cm, args->x,
|
| - args->ctx);
|
| -}
|
| +static void optimize_init_b(int plane, BLOCK_SIZE bsize,
|
| + struct encode_b_args *args) {
|
| + const MACROBLOCKD *xd = &args->x->e_mbd;
|
| + const struct macroblockd_plane* const pd = &xd->plane[plane];
|
| + const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
| + const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
|
| + const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
|
| + const MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
|
| + const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi) : mbmi->txfm_size;
|
| + int i;
|
|
|
| -void vp9_optimize_init(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
|
| - struct optimize_ctx *ctx) {
|
| - int p;
|
| -
|
| - for (p = 0; p < MAX_MB_PLANE; p++) {
|
| - const struct macroblockd_plane* const plane = &xd->plane[p];
|
| - const int bwl = b_width_log2(bsize) - plane->subsampling_x;
|
| - const int bhl = b_height_log2(bsize) - plane->subsampling_y;
|
| - const MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
|
| - const TX_SIZE tx_size = p ? get_uv_tx_size(mbmi)
|
| - : mbmi->txfm_size;
|
| - int i, j;
|
| -
|
| - for (i = 0; i < 1 << bwl; i += 1 << tx_size) {
|
| - int c = 0;
|
| - ctx->ta[p][i] = 0;
|
| - for (j = 0; j < 1 << tx_size && !c; j++) {
|
| - c = ctx->ta[p][i] |= plane->above_context[i + j];
|
| - }
|
| - }
|
| - for (i = 0; i < 1 << bhl; i += 1 << tx_size) {
|
| - int c = 0;
|
| - ctx->tl[p][i] = 0;
|
| - for (j = 0; j < 1 << tx_size && !c; j++) {
|
| - c = ctx->tl[p][i] |= plane->left_context[i + j];
|
| - }
|
| - }
|
| + switch (tx_size) {
|
| + case TX_4X4:
|
| + vpx_memcpy(args->ctx->ta[plane], pd->above_context,
|
| + sizeof(ENTROPY_CONTEXT) * num_4x4_w);
|
| + vpx_memcpy(args->ctx->tl[plane], pd->left_context,
|
| + sizeof(ENTROPY_CONTEXT) * num_4x4_h);
|
| + break;
|
| + case TX_8X8:
|
| + for (i = 0; i < num_4x4_w; i += 2)
|
| + args->ctx->ta[plane][i] = !!*(uint16_t *)&pd->above_context[i];
|
| + for (i = 0; i < num_4x4_h; i += 2)
|
| + args->ctx->tl[plane][i] = !!*(uint16_t *)&pd->left_context[i];
|
| + break;
|
| + case TX_16X16:
|
| + for (i = 0; i < num_4x4_w; i += 4)
|
| + args->ctx->ta[plane][i] = !!*(uint32_t *)&pd->above_context[i];
|
| + for (i = 0; i < num_4x4_h; i += 4)
|
| + args->ctx->tl[plane][i] = !!*(uint32_t *)&pd->left_context[i];
|
| + break;
|
| + case TX_32X32:
|
| + for (i = 0; i < num_4x4_w; i += 8)
|
| + args->ctx->ta[plane][i] = !!*(uint64_t *)&pd->above_context[i];
|
| + for (i = 0; i < num_4x4_h; i += 8)
|
| + args->ctx->tl[plane][i] = !!*(uint64_t *)&pd->left_context[i];
|
| + break;
|
| + default:
|
| + assert(0);
|
| }
|
| }
|
|
|
| -void vp9_optimize_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
| - struct optimize_ctx ctx;
|
| - struct encode_b_args arg = {cm, x, &ctx};
|
| - vp9_optimize_init(&x->e_mbd, bsize, &ctx);
|
| - foreach_transformed_block_in_plane(&x->e_mbd, bsize, 0, optimize_block, &arg);
|
| -}
|
| -
|
| -void vp9_optimize_sbuv(VP9_COMMON *const cm, MACROBLOCK *x,
|
| - BLOCK_SIZE_TYPE bsize) {
|
| - struct optimize_ctx ctx;
|
| - struct encode_b_args arg = {cm, x, &ctx};
|
| - vp9_optimize_init(&x->e_mbd, bsize, &ctx);
|
| - foreach_transformed_block_uv(&x->e_mbd, bsize, optimize_block, &arg);
|
| -}
|
| -
|
| -void xform_quant(int plane, int block, BLOCK_SIZE_TYPE bsize,
|
| - int ss_txfrm_size, void *arg) {
|
| +void vp9_xform_quant(int plane, int block, BLOCK_SIZE plane_bsize,
|
| + TX_SIZE tx_size, void *arg) {
|
| struct encode_b_args* const args = arg;
|
| MACROBLOCK* const x = args->x;
|
| MACROBLOCKD* const xd = &x->e_mbd;
|
| struct macroblock_plane *const p = &x->plane[plane];
|
| struct macroblockd_plane *const pd = &xd->plane[plane];
|
| - int16_t *coeff = BLOCK_OFFSET(p->coeff, block, 16);
|
| - int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16);
|
| - int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block, 16);
|
| - const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size / 2);
|
| + int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
|
| + int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
|
| + int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
|
| const int16_t *scan, *iscan;
|
| uint16_t *eob = &pd->eobs[block];
|
| - const int bwl = plane_block_width_log2by4(bsize, pd), bw = 1 << bwl;
|
| + const int bwl = b_width_log2(plane_bsize), bw = 1 << bwl;
|
| const int twl = bwl - tx_size, twmask = (1 << twl) - 1;
|
| int xoff, yoff;
|
| int16_t *src_diff;
|
| @@ -441,7 +444,7 @@
|
| xoff = 32 * (block & twmask);
|
| yoff = 32 * (block >> twl);
|
| src_diff = p->src_diff + 4 * bw * yoff + xoff;
|
| - if (x->rd_search)
|
| + if (x->use_lp32x32fdct)
|
| vp9_short_fdct32x32_rd(src_diff, coeff, bw * 8);
|
| else
|
| vp9_short_fdct32x32(src_diff, coeff, bw * 8);
|
| @@ -489,37 +492,37 @@
|
| }
|
| }
|
|
|
| -static void encode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
|
| - int ss_txfrm_size, void *arg) {
|
| +static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
|
| + TX_SIZE tx_size, void *arg) {
|
| struct encode_b_args *const args = arg;
|
| MACROBLOCK *const x = args->x;
|
| MACROBLOCKD *const xd = &x->e_mbd;
|
| - const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane,
|
| - block, ss_txfrm_size);
|
| struct macroblockd_plane *const pd = &xd->plane[plane];
|
| - int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block, 16);
|
| - uint8_t *const dst = raster_block_offset_uint8(xd, bsize, plane,
|
| - raster_block,
|
| + const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size,
|
| + block);
|
| +
|
| + int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
|
| + uint8_t *const dst = raster_block_offset_uint8(plane_bsize, raster_block,
|
| pd->dst.buf, pd->dst.stride);
|
| - xform_quant(plane, block, bsize, ss_txfrm_size, arg);
|
| + vp9_xform_quant(plane, block, plane_bsize, tx_size, arg);
|
|
|
| if (x->optimize)
|
| - vp9_optimize_b(plane, block, bsize, ss_txfrm_size, args->cm, x, args->ctx);
|
| + vp9_optimize_b(plane, block, plane_bsize, tx_size, x, args->ctx);
|
|
|
| - if (x->skip_encode)
|
| + if (x->skip_encode || pd->eobs[block] == 0)
|
| return;
|
| - if (pd->eobs[block] == 0)
|
| - return;
|
|
|
| - switch (ss_txfrm_size / 2) {
|
| + switch (tx_size) {
|
| case TX_32X32:
|
| vp9_short_idct32x32_add(dqcoeff, dst, pd->dst.stride);
|
| break;
|
| case TX_16X16:
|
| - vp9_short_idct16x16_add(dqcoeff, dst, pd->dst.stride);
|
| + inverse_transform_b_16x16_add(pd->eobs[block], dqcoeff, dst,
|
| + pd->dst.stride);
|
| break;
|
| case TX_8X8:
|
| - vp9_short_idct8x8_add(dqcoeff, dst, pd->dst.stride);
|
| + inverse_transform_b_8x8_add(pd->eobs[block], dqcoeff, dst,
|
| + pd->dst.stride);
|
| break;
|
| case TX_4X4:
|
| // this is like vp9_short_idct4x4 but has a special case around eob<=1
|
| @@ -528,89 +531,65 @@
|
| inverse_transform_b_4x4_add(xd, pd->eobs[block], dqcoeff,
|
| dst, pd->dst.stride);
|
| break;
|
| + default:
|
| + assert(!"Invalid transform size");
|
| }
|
| }
|
|
|
| -void vp9_xform_quant_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
| - MACROBLOCKD* const xd = &x->e_mbd;
|
| - struct encode_b_args arg = {cm, x, NULL};
|
| -
|
| - foreach_transformed_block_in_plane(xd, bsize, 0, xform_quant, &arg);
|
| -}
|
| -
|
| -void vp9_xform_quant_sbuv(VP9_COMMON *cm, MACROBLOCK *x,
|
| - BLOCK_SIZE_TYPE bsize) {
|
| - MACROBLOCKD* const xd = &x->e_mbd;
|
| - struct encode_b_args arg = {cm, x, NULL};
|
| -
|
| - foreach_transformed_block_uv(xd, bsize, xform_quant, &arg);
|
| -}
|
| -
|
| -void vp9_encode_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
| +void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
| MACROBLOCKD *const xd = &x->e_mbd;
|
| struct optimize_ctx ctx;
|
| - struct encode_b_args arg = {cm, x, &ctx};
|
| + struct encode_b_args arg = {x, &ctx};
|
|
|
| vp9_subtract_sby(x, bsize);
|
| if (x->optimize)
|
| - vp9_optimize_init(xd, bsize, &ctx);
|
| + optimize_init_b(0, bsize, &arg);
|
|
|
| foreach_transformed_block_in_plane(xd, bsize, 0, encode_block, &arg);
|
| }
|
|
|
| -void vp9_encode_sbuv(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
| +void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
| MACROBLOCKD *const xd = &x->e_mbd;
|
| struct optimize_ctx ctx;
|
| - struct encode_b_args arg = {cm, x, &ctx};
|
| + struct encode_b_args arg = {x, &ctx};
|
|
|
| - vp9_subtract_sbuv(x, bsize);
|
| - if (x->optimize)
|
| - vp9_optimize_init(xd, bsize, &ctx);
|
| -
|
| - foreach_transformed_block_uv(xd, bsize, encode_block, &arg);
|
| -}
|
| -
|
| -void vp9_encode_sb(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
| - MACROBLOCKD *const xd = &x->e_mbd;
|
| - struct optimize_ctx ctx;
|
| - struct encode_b_args arg = {cm, x, &ctx};
|
| -
|
| vp9_subtract_sb(x, bsize);
|
| - if (x->optimize)
|
| - vp9_optimize_init(xd, bsize, &ctx);
|
|
|
| + if (x->optimize) {
|
| + int i;
|
| + for (i = 0; i < MAX_MB_PLANE; ++i)
|
| + optimize_init_b(i, bsize, &arg);
|
| + }
|
| +
|
| foreach_transformed_block(xd, bsize, encode_block, &arg);
|
| }
|
|
|
| -void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
|
| - int ss_txfrm_size, void *arg) {
|
| +void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
|
| + TX_SIZE tx_size, void *arg) {
|
| struct encode_b_args* const args = arg;
|
| MACROBLOCK *const x = args->x;
|
| MACROBLOCKD *const xd = &x->e_mbd;
|
| MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
|
| - const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size / 2);
|
| struct macroblock_plane *const p = &x->plane[plane];
|
| struct macroblockd_plane *const pd = &xd->plane[plane];
|
| - int16_t *coeff = BLOCK_OFFSET(p->coeff, block, 16);
|
| - int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16);
|
| - int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block, 16);
|
| + int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
|
| + int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
|
| + int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
|
| const int16_t *scan, *iscan;
|
| TX_TYPE tx_type;
|
| MB_PREDICTION_MODE mode;
|
| - const int bwl = b_width_log2(bsize) - pd->subsampling_x, bw = 1 << bwl;
|
| + const int bwl = b_width_log2(plane_bsize), bw = 1 << bwl;
|
| const int twl = bwl - tx_size, twmask = (1 << twl) - 1;
|
| int xoff, yoff;
|
| uint8_t *src, *dst;
|
| int16_t *src_diff;
|
| uint16_t *eob = &pd->eobs[block];
|
|
|
| - if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
|
| - extend_for_intra(xd, plane, block, bsize, ss_txfrm_size);
|
| - }
|
| + if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0)
|
| + extend_for_intra(xd, plane_bsize, plane, block, tx_size);
|
|
|
| // if (x->optimize)
|
| - // vp9_optimize_b(plane, block, bsize, ss_txfrm_size,
|
| - // args->cm, x, args->ctx);
|
| + // vp9_optimize_b(plane, block, plane_bsize, tx_size, x, args->ctx);
|
|
|
| switch (tx_size) {
|
| case TX_32X32:
|
| @@ -627,7 +606,7 @@
|
| dst, pd->dst.stride, dst, pd->dst.stride);
|
| vp9_subtract_block(32, 32, src_diff, bw * 4,
|
| src, p->src.stride, dst, pd->dst.stride);
|
| - if (x->rd_search)
|
| + if (x->use_lp32x32fdct)
|
| vp9_short_fdct32x32_rd(src_diff, coeff, bw * 8);
|
| else
|
| vp9_short_fdct32x32(src_diff, coeff, bw * 8);
|
| @@ -661,7 +640,7 @@
|
| pd->dequant, p->zbin_extra, eob, scan, iscan);
|
| if (!x->skip_encode && *eob) {
|
| if (tx_type == DCT_DCT)
|
| - vp9_short_idct16x16_add(dqcoeff, dst, pd->dst.stride);
|
| + inverse_transform_b_16x16_add(*eob, dqcoeff, dst, pd->dst.stride);
|
| else
|
| vp9_short_iht16x16_add(dqcoeff, dst, pd->dst.stride, tx_type);
|
| }
|
| @@ -690,7 +669,7 @@
|
| pd->dequant, p->zbin_extra, eob, scan, iscan);
|
| if (!x->skip_encode && *eob) {
|
| if (tx_type == DCT_DCT)
|
| - vp9_short_idct8x8_add(dqcoeff, dst, pd->dst.stride);
|
| + inverse_transform_b_8x8_add(*eob, dqcoeff, dst, pd->dst.stride);
|
| else
|
| vp9_short_iht8x8_add(dqcoeff, dst, pd->dst.stride, tx_type);
|
| }
|
| @@ -699,11 +678,11 @@
|
| tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
|
| scan = get_scan_4x4(tx_type);
|
| iscan = get_iscan_4x4(tx_type);
|
| - if (mbmi->sb_type < BLOCK_SIZE_SB8X8 && plane == 0) {
|
| + if (mbmi->sb_type < BLOCK_8X8 && plane == 0)
|
| mode = xd->mode_info_context->bmi[block].as_mode;
|
| - } else {
|
| + else
|
| mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
|
| - }
|
| +
|
| xoff = 4 * (block & twmask);
|
| yoff = 4 * (block >> twl);
|
| dst = pd->dst.buf + yoff * pd->dst.stride + xoff;
|
| @@ -725,8 +704,7 @@
|
| // this is like vp9_short_idct4x4 but has a special case around eob<=1
|
| // which is significant (not just an optimization) for the lossless
|
| // case.
|
| - inverse_transform_b_4x4_add(xd, *eob, dqcoeff,
|
| - dst, pd->dst.stride);
|
| + inverse_transform_b_4x4_add(xd, *eob, dqcoeff, dst, pd->dst.stride);
|
| else
|
| vp9_short_iht4x4_add(dqcoeff, dst, pd->dst.stride, tx_type);
|
| }
|
| @@ -736,20 +714,18 @@
|
| }
|
| }
|
|
|
| -void vp9_encode_intra_block_y(VP9_COMMON *cm, MACROBLOCK *x,
|
| - BLOCK_SIZE_TYPE bsize) {
|
| +void vp9_encode_intra_block_y(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
| MACROBLOCKD* const xd = &x->e_mbd;
|
| struct optimize_ctx ctx;
|
| - struct encode_b_args arg = {cm, x, &ctx};
|
| + struct encode_b_args arg = {x, &ctx};
|
|
|
| - foreach_transformed_block_in_plane(xd, bsize, 0,
|
| - encode_block_intra, &arg);
|
| + foreach_transformed_block_in_plane(xd, bsize, 0, vp9_encode_block_intra,
|
| + &arg);
|
| }
|
| -void vp9_encode_intra_block_uv(VP9_COMMON *cm, MACROBLOCK *x,
|
| - BLOCK_SIZE_TYPE bsize) {
|
| +void vp9_encode_intra_block_uv(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
| MACROBLOCKD* const xd = &x->e_mbd;
|
| struct optimize_ctx ctx;
|
| - struct encode_b_args arg = {cm, x, &ctx};
|
| - foreach_transformed_block_uv(xd, bsize, encode_block_intra, &arg);
|
| + struct encode_b_args arg = {x, &ctx};
|
| + foreach_transformed_block_uv(xd, bsize, vp9_encode_block_intra, &arg);
|
| }
|
|
|
|
|