| Index: source/libvpx/vp9/encoder/vp9_encodemb.c
|
| ===================================================================
|
| --- source/libvpx/vp9/encoder/vp9_encodemb.c (revision 281795)
|
| +++ source/libvpx/vp9/encoder/vp9_encodemb.c (working copy)
|
| @@ -21,7 +21,7 @@
|
|
|
| #include "vp9/encoder/vp9_encodemb.h"
|
| #include "vp9/encoder/vp9_quantize.h"
|
| -#include "vp9/encoder/vp9_rdopt.h"
|
| +#include "vp9/encoder/vp9_rd.h"
|
| #include "vp9/encoder/vp9_tokenize.h"
|
|
|
| struct optimize_ctx {
|
| @@ -306,6 +306,7 @@
|
| MACROBLOCKD *const xd = &x->e_mbd;
|
| const struct macroblock_plane *const p = &x->plane[plane];
|
| const struct macroblockd_plane *const pd = &xd->plane[plane];
|
| + const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
|
| int16_t *const coeff = BLOCK_OFFSET(p->coeff, block);
|
| int16_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
|
| int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
|
| @@ -313,7 +314,56 @@
|
| const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
|
| int i, j;
|
| const int16_t *src_diff;
|
| + txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
|
| + src_diff = &p->src_diff[4 * (j * diff_stride + i)];
|
|
|
| + switch (tx_size) {
|
| + case TX_32X32:
|
| + fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
|
| + vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
|
| + p->quant, p->quant_shift, qcoeff, dqcoeff,
|
| + pd->dequant, p->zbin_extra, eob, scan_order->scan,
|
| + scan_order->iscan);
|
| + break;
|
| + case TX_16X16:
|
| + vp9_fdct16x16(src_diff, coeff, diff_stride);
|
| + vp9_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp,
|
| + p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
|
| + pd->dequant, p->zbin_extra, eob,
|
| + scan_order->scan, scan_order->iscan);
|
| + break;
|
| + case TX_8X8:
|
| + vp9_fdct8x8(src_diff, coeff, diff_stride);
|
| + vp9_quantize_fp(coeff, 64, x->skip_block, p->zbin, p->round_fp,
|
| + p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
|
| + pd->dequant, p->zbin_extra, eob,
|
| + scan_order->scan, scan_order->iscan);
|
| + break;
|
| + case TX_4X4:
|
| + x->fwd_txm4x4(src_diff, coeff, diff_stride);
|
| + vp9_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
|
| + p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
|
| + pd->dequant, p->zbin_extra, eob,
|
| + scan_order->scan, scan_order->iscan);
|
| + break;
|
| + default:
|
| + assert(0);
|
| + }
|
| +}
|
| +
|
| +void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
|
| + BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
|
| + MACROBLOCKD *const xd = &x->e_mbd;
|
| + const struct macroblock_plane *const p = &x->plane[plane];
|
| + const struct macroblockd_plane *const pd = &xd->plane[plane];
|
| + int16_t *const coeff = BLOCK_OFFSET(p->coeff, block);
|
| + int16_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
|
| + int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
|
| + uint16_t *const eob = &p->eobs[block];
|
| + const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
|
| + int i, j;
|
| + const int16_t *src_diff;
|
| +
|
| txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
|
| src_diff = &p->src_diff[4 * (j * diff_stride + i)];
|
|
|
| @@ -424,11 +474,15 @@
|
|
|
| if (x->skip_txfm == 0) {
|
| // full forward transform and quantization
|
| - if (!x->skip_recode)
|
| - vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
|
| + if (!x->skip_recode) {
|
| + if (x->quant_fp)
|
| + vp9_xform_quant_fp(x, plane, block, plane_bsize, tx_size);
|
| + else
|
| + vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
|
| + }
|
| } else if (x->skip_txfm == 2) {
|
| // fast path forward transform and quantization
|
| - vp9_xform_quant_fp(x, plane, block, plane_bsize, tx_size);
|
| + vp9_xform_quant_dc(x, plane, block, plane_bsize, tx_size);
|
| } else {
|
| // skip forward transform
|
| p->eobs[block] = 0;
|
| @@ -507,7 +561,7 @@
|
|
|
| if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
|
| const struct macroblockd_plane* const pd = &xd->plane[plane];
|
| - const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi) : mbmi->tx_size;
|
| + const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
|
| vp9_get_entropy_contexts(bsize, tx_size, pd,
|
| ctx.ta[plane], ctx.tl[plane]);
|
| }
|
|
|