Merge "Add multiple quantization profiles to new_quant experiment" into nextgenv2

This commit is contained in:
Sarah Parker 2016-06-27 18:46:25 +00:00 коммит произвёл Gerrit Code Review
Родитель 9f2167aede fbe6fb2773
Коммит cc16c5d805
14 изменённых файлов: 276 добавлений и 181 удалений

Просмотреть файл

@ -31,6 +31,14 @@
extern "C" {
#endif
#if CONFIG_NEW_QUANT
#define QUANT_PROFILES 3
static INLINE int get_dq_profile_from_ctx(int q_ctx) {
return VPXMIN(q_ctx, QUANT_PROFILES - 1);
}
#endif // CONFIG_NEW_QUANT
#define MAX_MB_PLANE 3
typedef enum {
@ -224,7 +232,8 @@ typedef struct macroblockd_plane {
ENTROPY_CONTEXT *left_context;
int16_t seg_dequant[MAX_SEGMENTS][2];
#if CONFIG_NEW_QUANT
dequant_val_type_nuq seg_dequant_nuq[MAX_SEGMENTS][COEF_BANDS];
dequant_val_type_nuq
seg_dequant_nuq[MAX_SEGMENTS][QUANT_PROFILES][COEF_BANDS];
#endif
uint8_t *color_index_map;
@ -236,7 +245,7 @@ typedef struct macroblockd_plane {
// encoder
const int16_t *dequant;
#if CONFIG_NEW_QUANT
const dequant_val_type_nuq* dequant_val_nuq;
const dequant_val_type_nuq* dequant_val_nuq[QUANT_PROFILES];
#endif // CONFIG_NEW_QUANT
} MACROBLOCKD_PLANE;

Просмотреть файл

@ -220,8 +220,8 @@ typedef struct VP10Common {
int16_t y_dequant[MAX_SEGMENTS][2];
int16_t uv_dequant[MAX_SEGMENTS][2];
#if CONFIG_NEW_QUANT
dequant_val_type_nuq y_dequant_nuq[MAX_SEGMENTS][COEF_BANDS];
dequant_val_type_nuq uv_dequant_nuq[MAX_SEGMENTS][COEF_BANDS];
dequant_val_type_nuq y_dequant_nuq[MAX_SEGMENTS][QUANT_PROFILES][COEF_BANDS];
dequant_val_type_nuq uv_dequant_nuq[MAX_SEGMENTS][QUANT_PROFILES][COEF_BANDS];
#endif
/* We allocate a MODE_INFO struct for each macroblock, together with

Просмотреть файл

@ -12,6 +12,7 @@
#include "vp10/common/entropy.h"
#include "vp10/common/quant_common.h"
#include "vp10/common/seg_common.h"
#include "vp10/common/blockd.h"
#if CONFIG_NEW_QUANT
// Bin widths expressed as a fraction over 128 of the quant stepsize,
@ -32,39 +33,76 @@ static const uint8_t nuq_knots_lossless[COEF_BANDS][NUQ_KNOTS] = {
{64, 128, 128}, // band 5
};
// TODO(sarahparker) add multiple quantization profiles
static const uint8_t nuq_knots[COEF_BANDS][NUQ_KNOTS] = {
static const uint8_t nuq_knots[QUANT_PROFILES][COEF_BANDS][NUQ_KNOTS] = {
{
{91, 133, 139}, // dc, band 0
{78, 122, 134}, // band 1
{83, 127, 139}, // band 2
{84, 117, 128}, // band 3
{88, 117, 129}, // band 4
{93, 122, 134}, // band 5
},
#if QUANT_PROFILES > 1
{
{86, 122, 134}, // dc, band 0
{78, 122, 134}, // band 1
{78, 122, 134}, // band 2
{84, 122, 134}, // band 3
{88, 122, 134}, // band 4
{88, 122, 134}, // band 5
},
#if QUANT_PROFILES > 2
{
{86, 122, 134}, // dc, band 0
{78, 122, 135}, // band 1
{78, 122, 134}, // band 2
{84, 122, 133}, // band 3
{88, 122, 134}, // band 4
{88, 122, 134}, // band 5
}
#endif // QUANT_PROFILES > 2
#endif // QUANT_PROFILES > 1
};
// dequantization offsets
static const uint8_t nuq_doff_lossless[COEF_BANDS] = {0, 0, 0, 0, 0, 0};
static const uint8_t nuq_doff[COEF_BANDS] = {11, 12, 22, 18, 20, 21};
#if QUANT_PROFILES == 1
static const uint8_t nuq_doff[QUANT_PROFILES][COEF_BANDS] = {
{11, 12, 22, 18, 20, 21} // dq_off_index = 0
};
#elif QUANT_PROFILES == 2
static const uint8_t nuq_doff[QUANT_PROFILES][COEF_BANDS] = {
{11, 12, 22, 18, 20, 21}, // dq_off_index = 0
{13, 20, 21, 27, 28, 29} // dq_off_index = 1
};
#else // QUANT_PROFILES == 3
static const uint8_t nuq_doff[QUANT_PROFILES][COEF_BANDS] = {
{11, 12, 22, 18, 20, 21}, // dq_off_index = 0
{6, 15, 17, 22, 23, 23}, // dq_off_index = 1
{6, 14, 16, 22, 23, 27} // dq_off_index = 2
};
#endif // QUANT_PROFILES == x
static const uint8_t *get_nuq_knots(int lossless, int band) {
static const uint8_t *get_nuq_knots(int lossless, int band, int dq_off_index) {
if (lossless)
return nuq_knots_lossless[band];
else
return nuq_knots[band];
return nuq_knots[dq_off_index][band];
}
static INLINE int16_t quant_to_doff_fixed(int lossless, int band) {
static INLINE int16_t quant_to_doff_fixed(int lossless, int band,
int dq_off_index) {
if (lossless)
return nuq_doff_lossless[band];
else
return nuq_doff[band];
return nuq_doff[dq_off_index][band];
}
// get cumulative bins
static INLINE void get_cuml_bins_nuq(int q, int lossless, int band,
tran_low_t *cuml_bins) {
const uint8_t *knots = get_nuq_knots(lossless, band);
tran_low_t *cuml_bins, int dq_off_index) {
const uint8_t *knots = get_nuq_knots(lossless, band, dq_off_index);
int16_t cuml_knots[NUQ_KNOTS];
int i;
cuml_knots[0] = knots[0];
@ -75,21 +113,22 @@ static INLINE void get_cuml_bins_nuq(int q, int lossless, int band,
}
void get_dequant_val_nuq(int q, int lossless, int band,
tran_low_t *dq, tran_low_t *cuml_bins) {
const uint8_t *knots = get_nuq_knots(lossless, band);
tran_low_t *dq, tran_low_t *cuml_bins,
int dq_off_index) {
const uint8_t *knots = get_nuq_knots(lossless, band, dq_off_index);
tran_low_t cuml_bins_[NUQ_KNOTS], *cuml_bins_ptr;
tran_low_t doff;
int i;
cuml_bins_ptr = (cuml_bins ? cuml_bins : cuml_bins_);
get_cuml_bins_nuq(q, lossless, band, cuml_bins_ptr);
get_cuml_bins_nuq(q, lossless, band, cuml_bins_ptr, dq_off_index);
dq[0] = 0;
for (i = 1; i < NUQ_KNOTS; ++i) {
doff = quant_to_doff_fixed(lossless, band);
doff = quant_to_doff_fixed(lossless, band, dq_off_index);
doff = ROUND_POWER_OF_TWO(doff * knots[i], 7);
dq[i] = cuml_bins_ptr[i - 1] +
ROUND_POWER_OF_TWO((knots[i] - doff * 2) * q, 8);
}
doff = quant_to_doff_fixed(lossless, band);
doff = quant_to_doff_fixed(lossless, band, dq_off_index);
dq[NUQ_KNOTS] =
cuml_bins_ptr[NUQ_KNOTS - 1] + ROUND_POWER_OF_TWO((64 - doff) * q, 7);
}

Просмотреть файл

@ -34,7 +34,8 @@ int vp10_get_qindex(const struct segmentation *seg, int segment_id,
typedef tran_low_t dequant_val_type_nuq[NUQ_KNOTS + 1];
typedef tran_low_t cuml_bins_type_nuq[NUQ_KNOTS];
void get_dequant_val_nuq(int q, int lossless, int band,
tran_low_t *dq, tran_low_t *cumbins);
tran_low_t *dq, tran_low_t *cuml_bins,
int dq_off_index);
tran_low_t dequant_abscoeff_nuq(int v, int q, const tran_low_t *dq);
tran_low_t dequant_coeff_nuq(int v, int q, const tran_low_t *dq);
#endif // CONFIG_NEW_QUANT

Просмотреть файл

@ -2077,7 +2077,8 @@ static void setup_segmentation_dequant(VP10_COMMON *const cm) {
// Build y/uv dequant values based on segmentation.
#if CONFIG_NEW_QUANT
int b;
#endif
int dq;
#endif // CONFIG_NEW_QUANT
if (cm->seg.enabled) {
int i;
for (i = 0; i < MAX_SEGMENTS; ++i) {
@ -2090,15 +2091,17 @@ static void setup_segmentation_dequant(VP10_COMMON *const cm) {
cm->uv_dequant[i][1] = vp10_ac_quant(qindex, cm->uv_ac_delta_q,
cm->bit_depth);
#if CONFIG_NEW_QUANT
for (b = 0; b < COEF_BANDS; ++b) {
get_dequant_val_nuq(
cm->y_dequant[i][b != 0], qindex == 0, b,
cm->y_dequant_nuq[i][b], NULL);
get_dequant_val_nuq(
cm->uv_dequant[i][b != 0], qindex == 0, b,
cm->uv_dequant_nuq[i][b], NULL);
for (dq = 0; dq < QUANT_PROFILES; dq ++) {
for (b = 0; b < COEF_BANDS; ++b) {
get_dequant_val_nuq(
cm->y_dequant[i][b != 0], qindex == 0, b,
cm->y_dequant_nuq[i][dq][b], NULL, dq);
get_dequant_val_nuq(
cm->uv_dequant[i][b != 0], qindex == 0, b,
cm->uv_dequant_nuq[i][dq][b], NULL, dq);
}
}
#endif
#endif // CONFIG_NEW_QUANT
}
} else {
const int qindex = cm->base_qindex;
@ -2111,15 +2114,17 @@ static void setup_segmentation_dequant(VP10_COMMON *const cm) {
cm->uv_dequant[0][1] = vp10_ac_quant(qindex, cm->uv_ac_delta_q,
cm->bit_depth);
#if CONFIG_NEW_QUANT
for (b = 0; b < COEF_BANDS; ++b) {
get_dequant_val_nuq(
cm->y_dequant[0][b != 0], qindex == 0, b,
cm->y_dequant_nuq[0][b], NULL);
get_dequant_val_nuq(
cm->uv_dequant[0][b != 0], qindex == 0, b,
cm->uv_dequant_nuq[0][b], NULL);
for (dq = 0; dq < QUANT_PROFILES; dq ++) {
for (b = 0; b < COEF_BANDS; ++b) {
get_dequant_val_nuq(
cm->y_dequant[0][b != 0], qindex == 0, b,
cm->y_dequant_nuq[0][dq][b], NULL, dq);
get_dequant_val_nuq(
cm->uv_dequant[0][b != 0], qindex == 0, b,
cm->uv_dequant_nuq[0][dq][b], NULL, dq);
}
}
#endif
#endif // CONFIG_NEW_QUANT
}
}

Просмотреть файл

@ -506,12 +506,16 @@ int vp10_decode_block_tokens(MACROBLOCKD *const xd,
const int16_t *const dequant = pd->seg_dequant[seg_id];
const int ctx = get_entropy_context(tx_size, pd->above_context + x,
pd->left_context + y);
#if CONFIG_NEW_QUANT
int dq = get_dq_profile_from_ctx(ctx);
#endif // CONFIG_NEW_QUANT
#if !CONFIG_ANS
const int eob = decode_coefs(xd, pd->plane_type,
pd->dqcoeff, tx_size, tx_type,
dequant,
#if CONFIG_NEW_QUANT
pd->seg_dequant_nuq[seg_id],
pd->seg_dequant_nuq[seg_id][dq],
#endif // CONFIG_NEW_QUANT
ctx, sc->scan, sc->neighbors, r);
#else
@ -519,7 +523,7 @@ int vp10_decode_block_tokens(MACROBLOCKD *const xd,
pd->dqcoeff, tx_size, tx_type,
dequant,
#if CONFIG_NEW_QUANT
pd->seg_dequant_nuq[seg_id],
pd->seg_dequant_nuq[seg_id][dq],
#endif // CONFIG_NEW_QUANT
ctx, sc->scan, sc->neighbors, r);
#endif // !CONFIG_ANS

Просмотреть файл

@ -42,7 +42,7 @@ typedef struct macroblock_plane {
const int16_t *zbin;
const int16_t *round;
#if CONFIG_NEW_QUANT
const cuml_bins_type_nuq *cuml_bins_nuq;
cuml_bins_type_nuq *cuml_bins_nuq[QUANT_PROFILES];
#endif // CONFIG_NEW_QUANT
int64_t quant_thred[2];

Просмотреть файл

@ -28,11 +28,6 @@
#include "vp10/encoder/rd.h"
#include "vp10/encoder/tokenize.h"
struct optimize_ctx {
ENTROPY_CONTEXT ta[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
ENTROPY_CONTEXT tl[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
};
void vp10_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &x->e_mbd.plane[plane];
@ -109,7 +104,8 @@ int vp10_optimize_b(MACROBLOCK *mb, int plane, int block,
const int16_t* const scan = so->scan;
const int16_t* const nb = so->neighbors;
#if CONFIG_NEW_QUANT
const dequant_val_type_nuq *dequant_val = pd->dequant_val_nuq;
int dq = get_dq_profile_from_ctx(ctx);
const dequant_val_type_nuq *dequant_val = pd->dequant_val_nuq[dq];
#endif // CONFIG_NEW_QUANT
const int shift = get_tx_scale(xd, tx_type, tx_size);
const int dq_step[2] = { dequant_ptr[0] >> shift, dequant_ptr[1] >> shift };
@ -493,7 +489,7 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block, int blk_row,
#if CONFIG_NEW_QUANT
void vp10_xform_quant_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size) {
TX_SIZE tx_size, int ctx) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[plane];
@ -504,6 +500,7 @@ void vp10_xform_quant_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
int dq = get_dq_profile_from_ctx(ctx);
uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int16_t *src_diff;
@ -530,36 +527,36 @@ void vp10_xform_quant_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
highbd_quantize_32x32_nuq(coeff, 1024, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
case TX_16X16:
highbd_quantize_nuq(coeff, 256, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
case TX_8X8:
highbd_quantize_nuq(coeff, 64, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
case TX_4X4:
highbd_quantize_nuq(coeff, 16, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -575,33 +572,33 @@ void vp10_xform_quant_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
case TX_32X32:
quantize_32x32_nuq(coeff, 1024, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
case TX_16X16:
quantize_nuq(coeff, 256, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq,
(const dequant_val_type_nuq *)pd->dequant_val_nuq,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
case TX_8X8:
quantize_nuq(coeff, 64, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq,
(const dequant_val_type_nuq *)pd->dequant_val_nuq,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
case TX_4X4:
quantize_nuq(coeff, 16, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq,
(const dequant_val_type_nuq *)pd->dequant_val_nuq,
(const cuml_bins_type_nuq *)p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -613,10 +610,11 @@ void vp10_xform_quant_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size) {
TX_SIZE tx_size, int ctx) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[plane];
int dq = get_dq_profile_from_ctx(ctx);
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
const scan_order *const scan_order =
@ -650,9 +648,9 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
highbd_quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
p->quant_fp, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -660,9 +658,9 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
highbd_quantize_fp_nuq(coeff, 256, x->skip_block,
p->quant_fp, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -670,9 +668,9 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
highbd_quantize_fp_nuq(coeff, 64, x->skip_block,
p->quant_fp, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -680,9 +678,9 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
highbd_quantize_fp_nuq(coeff, 16, x->skip_block,
p->quant_fp, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -699,9 +697,9 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
p->quant_fp, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -709,9 +707,9 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
quantize_fp_nuq(coeff, 256, x->skip_block,
p->quant_fp, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -719,9 +717,9 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
quantize_fp_nuq(coeff, 64, x->skip_block,
p->quant_fp, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -729,9 +727,9 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
quantize_fp_nuq(coeff, 16, x->skip_block,
p->quant_fp, pd->dequant,
(const cuml_bins_type_nuq *)
p->cuml_bins_nuq,
p->cuml_bins_nuq[dq],
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq[dq],
qcoeff, dqcoeff, eob,
scan_order->scan, band);
break;
@ -743,7 +741,7 @@ void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
void vp10_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size) {
TX_SIZE tx_size, int ctx) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[plane];
@ -755,6 +753,7 @@ void vp10_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int16_t *src_diff;
int dq = get_dq_profile_from_ctx(ctx);
FWD_TXFM_PARAM fwd_txfm_param;
@ -777,32 +776,32 @@ void vp10_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
highbd_quantize_dc_32x32_nuq(coeff, 1024, x->skip_block,
p->quant[0], p->quant_shift[0],
pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_16X16:
highbd_quantize_dc_nuq(coeff, 256, x->skip_block,
p->quant[0], p->quant_shift[0],
pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_8X8:
highbd_quantize_dc_nuq(coeff, 64, x->skip_block,
p->quant[0], p->quant_shift[0],
pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_4X4:
highbd_quantize_dc_nuq(coeff, 16, x->skip_block,
p->quant[0], p->quant_shift[0],
pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
default:
@ -817,29 +816,29 @@ void vp10_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
case TX_32X32:
quantize_dc_32x32_nuq(coeff, 1024, x->skip_block,
p->quant[0], p->quant_shift[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_16X16:
quantize_dc_nuq(coeff, 256, x->skip_block,
p->quant[0], p->quant_shift[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_8X8:
quantize_dc_nuq(coeff, 64, x->skip_block,
p->quant[0], p->quant_shift[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_4X4:
quantize_dc_nuq(coeff, 16, x->skip_block,
p->quant[0], p->quant_shift[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
default:
@ -850,7 +849,8 @@ void vp10_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
void vp10_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
int ctx) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[plane];
@ -862,6 +862,7 @@ void vp10_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int16_t *src_diff;
int dq = get_dq_profile_from_ctx(ctx);
FWD_TXFM_PARAM fwd_txfm_param;
@ -883,29 +884,29 @@ void vp10_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
case TX_32X32:
highbd_quantize_dc_32x32_fp_nuq(coeff, 1024, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_16X16:
highbd_quantize_dc_fp_nuq(coeff, 256, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_8X8:
highbd_quantize_dc_fp_nuq(coeff, 64, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_4X4:
highbd_quantize_dc_fp_nuq(coeff, 16, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
default:
@ -920,30 +921,30 @@ void vp10_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
case TX_32X32:
quantize_dc_32x32_fp_nuq(coeff, 1024, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_16X16:
quantize_dc_fp_nuq(coeff, 256, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_8X8:
quantize_dc_fp_nuq(coeff, 64, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
case TX_4X4:
quantize_dc_fp_nuq(coeff, 16, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cuml_bins_nuq[0],
pd->dequant_val_nuq[0],
p->cuml_bins_nuq[dq][0],
pd->dequant_val_nuq[dq][0],
qcoeff, dqcoeff, eob);
break;
default:
@ -959,6 +960,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
struct encode_b_args *const args = arg;
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
int ctx;
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
@ -972,6 +974,11 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
dst = &pd->dst.buf[4 * blk_row * pd->dst.stride + 4 * blk_col];
a = &args->ta[blk_col];
l = &args->tl[blk_row];
#if CONFIG_VAR_TX
ctx = get_entropy_context(tx_size, a, l);
#else
ctx = combine_entropy_contexts(*a, *l);
#endif
// TODO(jingning): per transformed block zero forcing only enabled for
// luma component. will integrate chroma components as well.
@ -1001,7 +1008,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
} else {
#if CONFIG_NEW_QUANT
vp10_xform_quant_fp_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size, ctx);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, VP10_XFORM_QUANT_FP);
@ -1014,7 +1021,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
// full forward transform and quantization
#if CONFIG_NEW_QUANT
vp10_xform_quant_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size, ctx);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, VP10_XFORM_QUANT_FP);
@ -1023,7 +1030,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
// fast path forward transform and quantization
#if CONFIG_NEW_QUANT
vp10_xform_quant_dc_nuq(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size);
plane_bsize, tx_size, ctx);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, VP10_XFORM_QUANT_DC);
@ -1039,7 +1046,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
} else {
#if CONFIG_NEW_QUANT
vp10_xform_quant_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size, ctx);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, VP10_XFORM_QUANT_FP);
@ -1054,29 +1061,6 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
#endif
if (p->eobs[block]) {
int ctx;
#if CONFIG_VAR_TX
switch (tx_size) {
case TX_4X4:
break;
case TX_8X8:
a[0] = !!*(const uint16_t *)&a[0];
l[0] = !!*(const uint16_t *)&l[0];
break;
case TX_16X16:
a[0] = !!*(const uint32_t *)&a[0];
l[0] = !!*(const uint32_t *)&l[0];
break;
case TX_32X32:
a[0] = !!*(const uint64_t *)&a[0];
l[0] = !!*(const uint64_t *)&l[0];
break;
default:
assert(0 && "Invalid transform size.");
break;
}
#endif
ctx = combine_entropy_contexts(*a, *l);
*a = *l = vp10_optimize_b(x, plane, block, tx_size, ctx) > 0;
} else {
*a = *l = p->eobs[block] > 0;
@ -1172,11 +1156,15 @@ static void encode_block_pass1(int plane, int block, int blk_row, int blk_col,
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
uint8_t *dst;
#if CONFIG_NEW_QUANT
int ctx;
#endif // CONFIG_NEW_QUANT
dst = &pd->dst.buf[4 * blk_row * pd->dst.stride + 4 * blk_col];
#if CONFIG_NEW_QUANT
ctx = 0;
vp10_xform_quant_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size, ctx);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, VP10_XFORM_QUANT_B);
@ -1243,6 +1231,17 @@ void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
vp10_subtract_plane(x, bsize, plane);
arg.ta = ctx.ta[plane];
arg.tl = ctx.tl[plane];
#if CONFIG_NEW_QUANT
#if CONFIG_VAR_TX
vp10_get_entropy_contexts(bsize, TX_4X4, pd,
ctx.ta[plane], ctx.tl[plane]);
#else
vp10_get_entropy_contexts(bsize, tx_size, pd,
ctx.ta[plane], ctx.tl[plane]);
#endif // CONFIG_VAR_TX
#endif // CONFIG_NEW_QUANT
#if CONFIG_VAR_TX
for (idy = 0; idy < mi_height; idy += bh) {
for (idx = 0; idx < mi_width; idx += bh) {
@ -1310,8 +1309,10 @@ void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
const int src_stride = p->src.stride;
const int dst_stride = pd->dst.stride;
const int tx1d_size = get_tx1d_size(tx_size);
ENTROPY_CONTEXT *a = NULL, *l = NULL;
int ctx;
INV_TXFM_PARAM inv_txfm_param;
ENTROPY_CONTEXT *a, *l;
dst = &pd->dst.buf[4 * (blk_row * dst_stride + blk_col)];
src = &p->src.buf[4 * (blk_row * src_stride + blk_col)];
@ -1333,18 +1334,18 @@ void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
src_stride, dst, dst_stride);
#endif // CONFIG_VP9_HIGHBITDEPTH
a = &args->ta[blk_col];
l = &args->tl[blk_row];
ctx = combine_entropy_contexts(*a, *l);
#if CONFIG_NEW_QUANT
vp10_xform_quant_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size, ctx);
#else // CONFIG_NEW_QUANT
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
VP10_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
a = &args->ta[blk_col];
l = &args->tl[blk_row];
if (p->eobs[block]) {
int ctx;
ctx = combine_entropy_contexts(*a, *l);
*a = *l = vp10_optimize_b(x, plane, block, tx_size, ctx) > 0;
} else {
*a = *l = p->eobs[block] > 0;
@ -1378,14 +1379,12 @@ void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane,
ENTROPY_CONTEXT tl[2 * MAX_MIB_SIZE];
struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip, ta, tl};
if (enable_optimize_b) {
const struct macroblockd_plane* const pd = &xd->plane[plane];
const TX_SIZE tx_size = plane ? get_uv_tx_size(&xd->mi[0]->mbmi, pd) :
xd->mi[0]->mbmi.tx_size;
vp10_get_entropy_contexts(bsize, tx_size, pd, ta, tl);
}
vp10_foreach_transformed_block_in_plane(xd, bsize, plane,
vp10_encode_block_intra, &arg);
}

Просмотреть файл

@ -18,6 +18,11 @@
extern "C" {
#endif
struct optimize_ctx {
ENTROPY_CONTEXT ta[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
ENTROPY_CONTEXT tl[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
};
struct encode_b_args {
MACROBLOCK *x;
struct optimize_ctx *ctx;
@ -46,16 +51,17 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
#if CONFIG_NEW_QUANT
void vp10_xform_quant_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size);
TX_SIZE tx_size, int ctx);
void vp10_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size);
TX_SIZE tx_size, int ctx);
void vp10_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size);
TX_SIZE tx_size, int ctx);
void vp10_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
int ctx);
#endif
int vp10_optimize_b(MACROBLOCK *mb, int plane, int block,

Просмотреть файл

@ -334,9 +334,9 @@ typedef struct VP10_COMP {
DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]); // 8: SIMD width
#if CONFIG_NEW_QUANT
DECLARE_ALIGNED(16, dequant_val_type_nuq,
y_dequant_val_nuq[QINDEX_RANGE][COEF_BANDS]);
y_dequant_val_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]);
DECLARE_ALIGNED(16, dequant_val_type_nuq,
uv_dequant_val_nuq[QINDEX_RANGE][COEF_BANDS]);
uv_dequant_val_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]);
#endif // CONFIG_NEW_QUANT
VP10_COMMON common;
VP10EncoderConfig oxcf;

Просмотреть файл

@ -1191,6 +1191,9 @@ void vp10_init_quantizer(VP10_COMP *cpi) {
VP10_COMMON *const cm = &cpi->common;
QUANTS *const quants = &cpi->quants;
int i, q, quant;
#if CONFIG_NEW_QUANT
int dq;
#endif
for (q = 0; q < QINDEX_RANGE; q++) {
const int qzbin_factor = get_qzbin_factor(q, cm->bit_depth);
@ -1221,16 +1224,17 @@ void vp10_init_quantizer(VP10_COMP *cpi) {
}
#if CONFIG_NEW_QUANT
// TODO(sarahparker) do this for multiple profiles once they are added
for (i = 0; i < COEF_BANDS; i++) {
const int quant = cpi->y_dequant[q][i != 0];
const int uvquant = cpi->uv_dequant[q][i != 0];
get_dequant_val_nuq(quant, q == 0, i,
cpi->y_dequant_val_nuq[q][i],
quants->y_cuml_bins_nuq[q][i]);
get_dequant_val_nuq(uvquant, q == 0, i,
cpi->uv_dequant_val_nuq[q][i],
quants->uv_cuml_bins_nuq[q][i]);
for (dq = 0; dq < QUANT_PROFILES; dq++) {
for (i = 0; i < COEF_BANDS; i++) {
const int quant = cpi->y_dequant[q][i != 0];
const int uvquant = cpi->uv_dequant[q][i != 0];
get_dequant_val_nuq(quant, q == 0, i,
cpi->y_dequant_val_nuq[dq][q][i],
quants->y_cuml_bins_nuq[dq][q][i], dq);
get_dequant_val_nuq(uvquant, q == 0, i,
cpi->uv_dequant_val_nuq[dq][q][i],
quants->uv_cuml_bins_nuq[dq][q][i], dq);
}
}
#endif // CONFIG_NEW_QUANT
@ -1262,6 +1266,9 @@ void vp10_init_plane_quantizers(const VP10_COMP *cpi, MACROBLOCK *x,
const int qindex = vp10_get_qindex(&cm->seg, segment_id, cm->base_qindex);
const int rdmult = vp10_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q);
int i;
#if CONFIG_NEW_QUANT
int dq;
#endif
// Y
x->plane[0].quant = quants->y_quant[qindex];
@ -1272,8 +1279,12 @@ void vp10_init_plane_quantizers(const VP10_COMP *cpi, MACROBLOCK *x,
x->plane[0].round = quants->y_round[qindex];
xd->plane[0].dequant = cpi->y_dequant[qindex];
#if CONFIG_NEW_QUANT
x->plane[0].cuml_bins_nuq = quants->y_cuml_bins_nuq[qindex];
xd->plane[0].dequant_val_nuq = cpi->y_dequant_val_nuq[qindex];
for (dq = 0; dq < QUANT_PROFILES; dq ++) {
x->plane[0].cuml_bins_nuq[dq] = (cuml_bins_type_nuq*)
quants->y_cuml_bins_nuq[dq][qindex];
xd->plane[0].dequant_val_nuq[dq] = (const dequant_val_type_nuq*)
cpi->y_dequant_val_nuq[dq][qindex];
}
#endif // CONFIG_NEW_QUANT
x->plane[0].quant_thred[0] = x->plane[0].zbin[0] * x->plane[0].zbin[0];
@ -1289,8 +1300,12 @@ void vp10_init_plane_quantizers(const VP10_COMP *cpi, MACROBLOCK *x,
x->plane[i].round = quants->uv_round[qindex];
xd->plane[i].dequant = cpi->uv_dequant[qindex];
#if CONFIG_NEW_QUANT
x->plane[i].cuml_bins_nuq = quants->uv_cuml_bins_nuq[qindex];
xd->plane[i].dequant_val_nuq = cpi->uv_dequant_val_nuq[qindex];
for (dq = 0; dq < QUANT_PROFILES; dq ++) {
x->plane[i].cuml_bins_nuq[dq] = (cuml_bins_type_nuq*)
quants->uv_cuml_bins_nuq[dq][qindex];
xd->plane[i].dequant_val_nuq[dq] = (const dequant_val_type_nuq*)
cpi->uv_dequant_val_nuq[dq][qindex];
}
#endif // CONFIG_NEW_QUANT
x->plane[i].quant_thred[0] = x->plane[i].zbin[0] * x->plane[i].zbin[0];

Просмотреть файл

@ -34,10 +34,10 @@ typedef void (*VP10_QUANT_FACADE)(const tran_low_t *coeff_ptr,
typedef struct {
#if CONFIG_NEW_QUANT
DECLARE_ALIGNED(16, tran_low_t,
y_cuml_bins_nuq[QINDEX_RANGE][COEF_BANDS]
y_cuml_bins_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]
[NUQ_KNOTS]);
DECLARE_ALIGNED(16, tran_low_t,
uv_cuml_bins_nuq[QINDEX_RANGE][COEF_BANDS]
uv_cuml_bins_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]
[NUQ_KNOTS]);
#endif // CONFIG_NEW_QUANT
// 0: dc 1: ac 2-8: ac repeated to SIMD width

Просмотреть файл

@ -582,11 +582,10 @@ void vp10_model_rd_from_var_lapndz(unsigned int var, unsigned int n_log2,
}
}
void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
const struct macroblockd_plane *pd,
ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE],
ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]) {
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
void vp10_get_entropy_contexts_plane(BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
const struct macroblockd_plane *pd,
ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE],
ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]) {
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 ENTROPY_CONTEXT *const above = pd->above_context;
@ -622,6 +621,14 @@ void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
}
}
void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
const struct macroblockd_plane *pd,
ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE],
ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]) {
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
vp10_get_entropy_contexts_plane(plane_bsize, tx_size, pd, t_above, t_left);
}
void vp10_mv_pred(VP10_COMP *cpi, MACROBLOCK *x,
uint8_t *ref_y_buffer, int ref_y_stride,
int ref_frame, BLOCK_SIZE block_size) {

Просмотреть файл

@ -1188,6 +1188,10 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
#if CONFIG_NEW_QUANT
int ctx;
struct macroblockd_plane *const pd = &xd->plane[plane];
#endif // CONFIG_NEW_QUANT
int64_t rd1, rd2, rd;
int rate;
int64_t dist;
@ -1195,12 +1199,18 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
ENTROPY_CONTEXT coeff_ctx = combine_entropy_contexts(
*(args->t_above + blk_col), *(args->t_left + blk_row));
#if CONFIG_NEW_QUANT
ctx = get_entropy_context(tx_size, pd->above_context + blk_col,
pd->left_context + blk_row);
#endif // CONFIG_NEW_QUANT
if (args->exit_early)
return;
if (!is_inter_block(mbmi)) {
struct encode_b_args intra_arg = {x, NULL, &mbmi->skip, args->t_above,
args->t_left};
vp10_encode_block_intra(plane, block, blk_row, blk_col,
plane_bsize, tx_size, &intra_arg);
@ -1243,7 +1253,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
// full forward transform and quantization
#if CONFIG_NEW_QUANT
vp10_xform_quant_nuq(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size);
plane_bsize, tx_size, ctx);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size, VP10_XFORM_QUANT_FP);
@ -1260,10 +1270,10 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
#if CONFIG_NEW_QUANT
if (x->quant_fp)
vp10_xform_quant_dc_fp_nuq(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size);
plane_bsize, tx_size, ctx);
else
vp10_xform_quant_dc_nuq(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size);
plane_bsize, tx_size, ctx);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col,
plane_bsize, tx_size, VP10_XFORM_QUANT_DC);
@ -1296,10 +1306,10 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
#if CONFIG_NEW_QUANT
if (x->quant_fp)
vp10_xform_quant_fp_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size, ctx);
else
vp10_xform_quant_nuq(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
tx_size, ctx);
#else
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
VP10_XFORM_QUANT_FP);