Modify scan order for non-transform coding blocks
Use raster scan order for non-transform blocks +15.45% (+2.1%) on screen_content no significant change on natural videos Change-Id: I0e264cb69e8624540639302d131f7de9c31c3ba7
This commit is contained in:
parent
33207fb170
commit
9e0750c2d2
@ -1172,10 +1172,6 @@ void vp9_default_coef_probs(VP9_COMMON *cm) {
|
||||
#if CONFIG_TX64X64
|
||||
vp9_copy(cm->fc.coef_probs[TX_64X64], default_coef_probs_64x64);
|
||||
#endif // CONFIG_TX64X64
|
||||
#if CONFIG_TX_SKIP
|
||||
memset(vp9_coefband_tx_skip, TX_SKIP_COEFF_BAND,
|
||||
sizeof(vp9_coefband_tx_skip[0]) * MAX_NUM_COEFS);
|
||||
#endif // CONFIG_TX_SKIP
|
||||
}
|
||||
|
||||
#define COEF_COUNT_SAT 24
|
||||
|
@ -257,6 +257,11 @@ static INLINE const scan_order *get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size,
|
||||
PLANE_TYPE type, int block_idx) {
|
||||
const MODE_INFO *const mi = xd->mi[0].src_mi;
|
||||
|
||||
#if CONFIG_TX_SKIP
|
||||
if (mi->mbmi.tx_skip[type])
|
||||
return &vp9_default_scan_orders_pxd[tx_size];
|
||||
#endif // CONFIG_TX_SKIP
|
||||
|
||||
if (is_inter_block(&mi->mbmi) || type != PLANE_TYPE_Y || xd->lossless) {
|
||||
return &vp9_default_scan_orders[tx_size];
|
||||
} else {
|
||||
|
@ -1239,6 +1239,28 @@ static void set_default_lf_deltas(struct loopfilter *lf) {
|
||||
lf->mode_deltas[1] = 0;
|
||||
}
|
||||
|
||||
#if CONFIG_TX_SKIP
|
||||
static void init_pxd_scan_orders(int16_t *scan, int16_t *iscan,
|
||||
int16_t *neighbors, int bs) {
|
||||
int i;
|
||||
scan[0] = iscan[0] = 0;
|
||||
vpx_memset(neighbors, 0, MAX_NEIGHBORS * sizeof(neighbors[0]));
|
||||
|
||||
for (i = 1; i < bs * bs; i++) {
|
||||
scan[i] = i;
|
||||
iscan[i] = i;
|
||||
if (i < bs) {
|
||||
neighbors[MAX_NEIGHBORS * i] = neighbors[MAX_NEIGHBORS * i + 1] = i - 1;
|
||||
} else if (i % bs == 0) {
|
||||
neighbors[MAX_NEIGHBORS * i] = neighbors[MAX_NEIGHBORS * i + 1] = i - bs;
|
||||
} else {
|
||||
neighbors[MAX_NEIGHBORS * i] = i - bs;
|
||||
neighbors[MAX_NEIGHBORS * i + 1] = i - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_TX_SKIP
|
||||
|
||||
void vp9_setup_past_independence(VP9_COMMON *cm) {
|
||||
// Reset the segment feature data to the default stats:
|
||||
// Features disabled, 0, with delta coding (Default state).
|
||||
@ -1281,4 +1303,23 @@ void vp9_setup_past_independence(VP9_COMMON *cm) {
|
||||
vp9_zero(cm->ref_frame_sign_bias);
|
||||
|
||||
cm->frame_context_idx = 0;
|
||||
|
||||
#if CONFIG_TX_SKIP
|
||||
memset(vp9_coefband_tx_skip, TX_SKIP_COEFF_BAND,
|
||||
sizeof(vp9_coefband_tx_skip[0]) * MAX_NUM_COEFS);
|
||||
|
||||
init_pxd_scan_orders(vp9_default_scan_pxd_4x4, vp9_default_iscan_pxd_4x4,
|
||||
vp9_default_scan_pxd_4x4_neighbors, 4);
|
||||
init_pxd_scan_orders(vp9_default_scan_pxd_8x8, vp9_default_iscan_pxd_8x8,
|
||||
vp9_default_scan_pxd_8x8_neighbors, 8);
|
||||
init_pxd_scan_orders(vp9_default_scan_pxd_16x16, vp9_default_iscan_pxd_16x16,
|
||||
vp9_default_scan_pxd_16x16_neighbors, 16);
|
||||
init_pxd_scan_orders(vp9_default_scan_pxd_32x32, vp9_default_iscan_pxd_32x32,
|
||||
vp9_default_scan_pxd_32x32_neighbors, 32);
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
init_pxd_scan_orders(vp9_default_scan_pxd_64x64, vp9_default_iscan_pxd_64x64,
|
||||
vp9_default_scan_pxd_64x64_neighbors, 64);
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_TX_SKIP
|
||||
}
|
||||
|
@ -2759,6 +2759,49 @@ DECLARE_ALIGNED(16, static const int16_t, vp9_default_iscan_64x64[4096]) = {
|
||||
};
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
#if CONFIG_TX_SKIP
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_scan_pxd_4x4[16]);
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_scan_pxd_8x8[64]);
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_scan_pxd_16x16[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_scan_pxd_32x32[1024]);
|
||||
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_pxd_4x4[16]);
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_pxd_8x8[64]);
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_pxd_16x16[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_pxd_32x32[1024]);
|
||||
|
||||
DECLARE_ALIGNED(16, int16_t,
|
||||
vp9_default_scan_pxd_4x4_neighbors[17 * MAX_NEIGHBORS]);
|
||||
DECLARE_ALIGNED(16, int16_t,
|
||||
vp9_default_scan_pxd_8x8_neighbors[65 * MAX_NEIGHBORS]);
|
||||
DECLARE_ALIGNED(16, int16_t,
|
||||
vp9_default_scan_pxd_16x16_neighbors[257 * MAX_NEIGHBORS]);
|
||||
DECLARE_ALIGNED(16, int16_t,
|
||||
vp9_default_scan_pxd_32x32_neighbors[1025 * MAX_NEIGHBORS]);
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_scan_pxd_64x64[4096]);
|
||||
DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_pxd_64x64[4096]);
|
||||
DECLARE_ALIGNED(16, int16_t,
|
||||
vp9_default_scan_pxd_64x64_neighbors[4097 * MAX_NEIGHBORS]);
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
const scan_order vp9_default_scan_orders_pxd[TX_SIZES] = {
|
||||
{vp9_default_scan_pxd_4x4, vp9_default_iscan_pxd_4x4,
|
||||
vp9_default_scan_pxd_4x4_neighbors},
|
||||
{vp9_default_scan_pxd_8x8, vp9_default_iscan_pxd_8x8,
|
||||
vp9_default_scan_pxd_8x8_neighbors},
|
||||
{vp9_default_scan_pxd_16x16, vp9_default_iscan_pxd_16x16,
|
||||
vp9_default_scan_pxd_16x16_neighbors},
|
||||
{vp9_default_scan_pxd_32x32, vp9_default_iscan_pxd_32x32,
|
||||
vp9_default_scan_pxd_32x32_neighbors},
|
||||
#if CONFIG_TX64X64
|
||||
{vp9_default_scan_pxd_64x64, vp9_default_iscan_pxd_64x64,
|
||||
vp9_default_scan_pxd_64x64_neighbors},
|
||||
#endif
|
||||
};
|
||||
#endif // CONFIG_TX_SKIP
|
||||
|
||||
const scan_order vp9_default_scan_orders[TX_SIZES] = {
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
|
@ -32,6 +32,32 @@ typedef struct {
|
||||
extern const scan_order vp9_default_scan_orders[TX_SIZES];
|
||||
extern const scan_order vp9_scan_orders[TX_SIZES][TX_TYPES];
|
||||
|
||||
#if CONFIG_TX_SKIP
|
||||
// pixel domain default scan orders
|
||||
extern const scan_order vp9_default_scan_orders_pxd[TX_SIZES];
|
||||
|
||||
extern int16_t vp9_default_scan_pxd_4x4[16];
|
||||
extern int16_t vp9_default_scan_pxd_8x8[64];
|
||||
extern int16_t vp9_default_scan_pxd_16x16[256];
|
||||
extern int16_t vp9_default_scan_pxd_32x32[1024];
|
||||
|
||||
extern int16_t vp9_default_iscan_pxd_4x4[16];
|
||||
extern int16_t vp9_default_iscan_pxd_8x8[64];
|
||||
extern int16_t vp9_default_iscan_pxd_16x16[256];
|
||||
extern int16_t vp9_default_iscan_pxd_32x32[1024];
|
||||
|
||||
extern int16_t vp9_default_scan_pxd_4x4_neighbors[17 * MAX_NEIGHBORS];
|
||||
extern int16_t vp9_default_scan_pxd_8x8_neighbors[65 * MAX_NEIGHBORS];
|
||||
extern int16_t vp9_default_scan_pxd_16x16_neighbors[257 * MAX_NEIGHBORS];
|
||||
extern int16_t vp9_default_scan_pxd_32x32_neighbors[1025 * MAX_NEIGHBORS];
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
extern int16_t vp9_default_scan_pxd_64x64[4096];
|
||||
extern int16_t vp9_default_iscan_pxd_64x64[4096];
|
||||
extern int16_t vp9_default_scan_pxd_64x64_neighbors[4097 * MAX_NEIGHBORS];
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_TX_SKIP
|
||||
|
||||
static INLINE int get_coef_context(const int16_t *neighbors,
|
||||
const uint8_t *token_cache, int c) {
|
||||
return (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
|
||||
|
@ -696,7 +696,15 @@ void vp9_xform_quant_nuq(MACROBLOCK *x, int plane, int block,
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
const struct macroblock_plane *const p = &x->plane[plane];
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
#if CONFIG_TX_SKIP
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
|
||||
int shift = mbmi->tx_skip_shift;
|
||||
const scan_order *const scan_order =
|
||||
mbmi->tx_skip[plane != 0] ? &vp9_default_scan_orders_pxd[tx_size] :
|
||||
&vp9_default_scan_orders[tx_size];
|
||||
#else
|
||||
const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
|
||||
#endif // CONFIG_TX_SKIP
|
||||
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);
|
||||
@ -704,10 +712,6 @@ void vp9_xform_quant_nuq(MACROBLOCK *x, int plane, int block,
|
||||
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
|
||||
int i, j;
|
||||
const int16_t *src_diff;
|
||||
#if CONFIG_TX_SKIP
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
|
||||
int shift = mbmi->tx_skip_shift;
|
||||
#endif
|
||||
const uint8_t* band = get_band_translate(tx_size);
|
||||
|
||||
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
|
||||
@ -895,7 +899,15 @@ void vp9_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block,
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
const struct macroblock_plane *const p = &x->plane[plane];
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
#if CONFIG_TX_SKIP
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
|
||||
int shift = mbmi->tx_skip_shift;
|
||||
const scan_order *const scan_order =
|
||||
mbmi->tx_skip[plane != 0] ? &vp9_default_scan_orders_pxd[tx_size] :
|
||||
&vp9_default_scan_orders[tx_size];
|
||||
#else
|
||||
const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
|
||||
#endif // CONFIG_TX_SKIP
|
||||
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);
|
||||
@ -903,10 +915,6 @@ void vp9_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block,
|
||||
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
|
||||
int i, j;
|
||||
const int16_t *src_diff;
|
||||
#if CONFIG_TX_SKIP
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
|
||||
int shift = mbmi->tx_skip_shift;
|
||||
#endif
|
||||
const uint8_t* band = get_band_translate(tx_size);
|
||||
|
||||
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
|
||||
@ -1441,7 +1449,15 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
const struct macroblock_plane *const p = &x->plane[plane];
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
#if CONFIG_TX_SKIP
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
|
||||
int shift = mbmi->tx_skip_shift;
|
||||
const scan_order *const scan_order =
|
||||
mbmi->tx_skip[plane != 0] ? &vp9_default_scan_orders_pxd[tx_size] :
|
||||
&vp9_default_scan_orders[tx_size];
|
||||
#else
|
||||
const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
|
||||
#endif // CONFIG_TX_SKIP
|
||||
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);
|
||||
@ -1449,10 +1465,6 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
|
||||
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
|
||||
int i, j;
|
||||
const int16_t *src_diff;
|
||||
#if CONFIG_TX_SKIP
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
|
||||
int shift = mbmi->tx_skip_shift;
|
||||
#endif
|
||||
|
||||
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
|
||||
src_diff = &p->src_diff[4 * (j * diff_stride + i)];
|
||||
@ -1808,7 +1820,15 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
const struct macroblock_plane *const p = &x->plane[plane];
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
#if CONFIG_TX_SKIP
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
|
||||
int shift = mbmi->tx_skip_shift;
|
||||
const scan_order *const scan_order =
|
||||
mbmi->tx_skip[plane != 0] ? &vp9_default_scan_orders_pxd[tx_size] :
|
||||
&vp9_default_scan_orders[tx_size];
|
||||
#else
|
||||
const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
|
||||
#endif // CONFIG_TX_SKIP
|
||||
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);
|
||||
@ -1816,10 +1836,6 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
|
||||
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
|
||||
int i, j;
|
||||
const int16_t *src_diff;
|
||||
#if CONFIG_TX_SKIP
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
|
||||
int shift = mbmi->tx_skip_shift;
|
||||
#endif
|
||||
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
|
||||
src_diff = &p->src_diff[4 * (j * diff_stride + i)];
|
||||
|
||||
@ -2574,17 +2590,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
|
||||
band = vp9_coefband_tx_skip;
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
|
||||
if (tx_size == TX_4X4) {
|
||||
tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
|
||||
scan_order = &vp9_scan_orders[TX_4X4][tx_type];
|
||||
mode = plane == 0 ?
|
||||
get_y_mode(xd->mi[0].src_mi, block) : mbmi->uv_mode;
|
||||
} else if (tx_size <= TX_16X16) {
|
||||
tx_type = get_tx_type(pd->plane_type, xd);
|
||||
scan_order = &vp9_scan_orders[tx_size][tx_type];
|
||||
} else {
|
||||
scan_order = &vp9_default_scan_orders[tx_size];
|
||||
}
|
||||
scan_order = &vp9_default_scan_orders_pxd[tx_size];
|
||||
|
||||
vp9_predict_intra_block(xd, block >> (2 * tx_size), bwl, tx_size, mode,
|
||||
#if CONFIG_FILTERINTRA
|
||||
|
Loading…
x
Reference in New Issue
Block a user