Commit afd9bd3e authored by Dmitry Kovalev's avatar Dmitry Kovalev

Moving from ss_txfrm_size to tx_size.

Updating foreach_transformed_block_visitor and corresponding functions
to accept tx_size instead of ss_txfrm_size. List of functions per file:

vp9_decodframe.c
  decode_block
  decode_block_intra

vp9_detokenize.c
  decode_block

vp9_encodemb.c
  optimize_block
  vp9_xform_quant
  vp9_encode_block_intra

vp9_rdopt.c
  dist_block
  rate_block
  block_yrd_txfm

vp9_tokenize.c
  set_entropy_context_b
  tokenize_b
  is_skippable

Change-Id: I351bf563eb36cf34db71c3f06b9bbc9a61b55b73
parent 9451e8d3
......@@ -408,7 +408,7 @@ static INLINE int plane_block_height(BLOCK_SIZE_TYPE bsize,
typedef void (*foreach_transformed_block_visitor)(int plane, int block,
BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size,
TX_SIZE tx_size,
void *arg);
static INLINE void foreach_transformed_block_in_plane(
......@@ -452,7 +452,7 @@ static INLINE void foreach_transformed_block_in_plane(
for (r = 0; r < (1 << bh); r += (1 << tx_size)) {
for (c = 0; c < (1 << bw); c += (1 << tx_size)) {
if (r < max_blocks_high && c < max_blocks_wide)
visit(plane, i, bsize, txfrm_size_b, arg);
visit(plane, i, bsize, tx_size, arg);
i += step;
}
}
......@@ -460,7 +460,7 @@ static INLINE void foreach_transformed_block_in_plane(
const int ss_block_size = bw + bh;
assert(txfrm_size_b <= ss_block_size);
for (i = 0; i < (1 << ss_block_size); i += step)
visit(plane, i, bsize, txfrm_size_b, arg);
visit(plane, i, bsize, tx_size, arg);
}
}
......@@ -557,10 +557,9 @@ static int txfrm_block_to_raster_block(MACROBLOCKD *xd,
int plane, int block,
TX_SIZE tx_size) {
const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
const int ss_txfrm_size = tx_size << 1;
const int tx_cols_log2 = bwl - tx_size;
const int tx_cols = 1 << tx_cols_log2;
const int raster_mb = block >> ss_txfrm_size;
const int raster_mb = block >> (tx_size << 1);
const int x = (raster_mb & (tx_cols - 1)) << tx_size;
const int y = raster_mb >> tx_cols_log2 << tx_size;
return x + (y << bwl);
......@@ -572,10 +571,9 @@ static void txfrm_block_to_raster_xy(MACROBLOCKD *xd,
TX_SIZE tx_size,
int *x, int *y) {
const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
const int ss_txfrm_size = tx_size << 1;
const int tx_cols_log2 = bwl - tx_size;
const int tx_cols = 1 << tx_cols_log2;
const int raster_mb = block >> ss_txfrm_size;
const int raster_mb = block >> (tx_size << 1);
*x = (raster_mb & (tx_cols - 1)) << tx_size;
*y = raster_mb >> tx_cols_log2 << tx_size;
}
......
......@@ -88,13 +88,12 @@ static void init_dequantizer(VP9_COMMON *cm, MACROBLOCKD *xd) {
}
static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
TX_SIZE tx_size, void *arg) {
MACROBLOCKD* const xd = arg;
struct macroblockd_plane *const pd = &xd->plane[plane];
int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
const int stride = pd->dst.stride;
const int eob = pd->eobs[block];
const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size >> 1);
const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane,
block, tx_size);
uint8_t* const dst = raster_block_offset_uint8(xd, bsize, plane,
......@@ -126,11 +125,10 @@ static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
static void decode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
TX_SIZE tx_size, void *arg) {
MACROBLOCKD* const xd = arg;
struct macroblockd_plane *const pd = &xd->plane[plane];
MODE_INFO *const mi = xd->mode_info_context;
const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size >> 1);
const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane,
block, tx_size);
uint8_t* const dst = raster_block_offset_uint8(xd, bsize, plane,
......@@ -160,7 +158,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
if (mi->mbmi.skip_coeff)
return;
decode_block(plane, block, bsize, ss_txfrm_size, arg);
decode_block(plane, block, bsize, tx_size, arg);
}
static int decode_tokens(VP9D_COMP *pbi, BLOCK_SIZE_TYPE bsize, vp9_reader *r) {
......
......@@ -249,10 +249,8 @@ struct decode_block_args {
int *eobtotal;
};
static void decode_block(int plane, int block,
BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size,
void *argv) {
static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
TX_SIZE tx_size, void *argv) {
const struct decode_block_args* const arg = argv;
const int bw = b_width_log2(bsize);
......@@ -261,7 +259,7 @@ static void decode_block(int plane, int block,
struct segmentation *seg = &arg->pbi->common.seg;
struct macroblockd_plane* pd = &xd->plane[plane];
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const TX_SIZE tx_size = ss_txfrm_size >> 1;
const int ss_txfrm_size = tx_size << 1;
const int seg_eob = get_eob(seg, segment_id, 16 << ss_txfrm_size);
const int off = block >> ss_txfrm_size;
const int mod = bw - tx_size - pd->subsampling_x;
......
......@@ -14,8 +14,8 @@
#include "vp9/encoder/vp9_onyx_int.h"
int vp9_encode_intra(VP9_COMP *cpi, MACROBLOCK *x, int use_16x16_pred);
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_TYPE bsize,
TX_SIZE tx_size, void *arg);
void vp9_encode_intra_block_y(VP9_COMMON *const cm, MACROBLOCK *mb,
BLOCK_SIZE_TYPE bs);
void vp9_encode_intra_block_uv(VP9_COMMON *const cm, MACROBLOCK *mb,
......
......@@ -382,9 +382,9 @@ void vp9_optimize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
static void optimize_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
TX_SIZE tx_size, void *arg) {
const struct encode_b_args* const args = arg;
vp9_optimize_b(plane, block, bsize, ss_txfrm_size >> 1, args->x, args->ctx);
vp9_optimize_b(plane, block, bsize, tx_size, args->x, args->ctx);
}
void optimize_init_b(int plane, BLOCK_SIZE_TYPE bsize, void *arg) {
......@@ -446,8 +446,8 @@ void vp9_optimize_sbuv(VP9_COMMON *const cm, MACROBLOCK *x,
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_TYPE 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;
......@@ -458,7 +458,6 @@ void xform_quant(int plane, int block, BLOCK_SIZE_TYPE bsize,
int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
const int16_t *scan, *iscan;
uint16_t *eob = &pd->eobs[block];
const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size >> 1);
const int bwl = b_width_log2(bsize) - pd->subsampling_x, bw = 1 << bwl;
const int twl = bwl - tx_size, twmask = (1 << twl) - 1;
int xoff, yoff;
......@@ -521,11 +520,10 @@ void xform_quant(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
static void encode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
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 TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size >> 1);
const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane,
block, tx_size);
struct macroblockd_plane *const pd = &xd->plane[plane];
......@@ -533,7 +531,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
uint8_t *const dst = raster_block_offset_uint8(xd, bsize, plane,
raster_block,
pd->dst.buf, pd->dst.stride);
xform_quant(plane, block, bsize, ss_txfrm_size, arg);
vp9_xform_quant(plane, block, bsize, tx_size, arg);
if (x->optimize)
vp9_optimize_b(plane, block, bsize, tx_size, x, args->ctx);
......@@ -569,7 +567,7 @@ 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);
foreach_transformed_block_in_plane(xd, bsize, 0, vp9_xform_quant, &arg);
}
void vp9_xform_quant_sbuv(VP9_COMMON *cm, MACROBLOCK *x,
......@@ -577,7 +575,7 @@ void vp9_xform_quant_sbuv(VP9_COMMON *cm, MACROBLOCK *x,
MACROBLOCKD* const xd = &x->e_mbd;
struct encode_b_args arg = {cm, x, NULL};
foreach_transformed_block_uv(xd, bsize, xform_quant, &arg);
foreach_transformed_block_uv(xd, bsize, vp9_xform_quant, &arg);
}
void vp9_encode_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
......@@ -623,13 +621,12 @@ void vp9_encode_sb(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
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_TYPE 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 >> 1);
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
......@@ -781,14 +778,14 @@ void vp9_encode_intra_block_y(VP9_COMMON *cm, MACROBLOCK *x,
struct optimize_ctx ctx;
struct encode_b_args arg = {cm, 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) {
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);
foreach_transformed_block_uv(xd, bsize, vp9_encode_block_intra, &arg);
}
......@@ -42,8 +42,8 @@ void vp9_encode_sb(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sbuv(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
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_TYPE bsize,
TX_SIZE tx_size, void *arg);
void vp9_xform_quant_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_xform_quant_sbuv(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
......
......@@ -572,7 +572,8 @@ struct rdcost_block_args {
};
static void dist_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
TX_SIZE tx_size, void *arg) {
const int ss_txfrm_size = tx_size << 1;
struct rdcost_block_args* args = arg;
MACROBLOCK* const x = args->x;
MACROBLOCKD* const xd = &x->e_mbd;
......@@ -597,7 +598,7 @@ static void dist_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
static void rate_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
TX_SIZE tx_size, void *arg) {
struct rdcost_block_args* args = arg;
MACROBLOCKD *const xd = &args->x->e_mbd;
int x_idx, y_idx;
......@@ -693,7 +694,7 @@ static int64_t block_error_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize,
}
static void block_yrd_txfm(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
TX_SIZE tx_size, void *arg) {
struct rdcost_block_args *args = arg;
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
......@@ -714,12 +715,12 @@ static void block_yrd_txfm(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
if (!is_inter_block(&xd->mode_info_context->mbmi))
encode_block_intra(plane, block, bsize, ss_txfrm_size, &encode_args);
vp9_encode_block_intra(plane, block, bsize, tx_size, &encode_args);
else
xform_quant(plane, block, bsize, ss_txfrm_size, &encode_args);
vp9_xform_quant(plane, block, bsize, tx_size, &encode_args);
dist_block(plane, block, bsize, ss_txfrm_size, args);
rate_block(plane, block, bsize, ss_txfrm_size, args);
dist_block(plane, block, bsize, tx_size, args);
rate_block(plane, block, bsize, tx_size, args);
}
static void txfm_rd_in_plane(VP9_COMMON *const cm, MACROBLOCK *x,
......
......@@ -98,9 +98,8 @@ struct tokenize_b_args {
};
static void set_entropy_context_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
TX_SIZE tx_size, void *arg) {
struct tokenize_b_args* const args = arg;
const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size >> 1);
MACROBLOCKD *const xd = args->xd;
const int bwl = b_width_log2(bsize);
const int off = block >> (2 * tx_size);
......@@ -122,12 +121,11 @@ static void set_entropy_context_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, void *arg) {
TX_SIZE tx_size, void *arg) {
struct tokenize_b_args* const args = arg;
VP9_COMP *cpi = args->cpi;
MACROBLOCKD *xd = args->xd;
TOKENEXTRA **tp = args->tp;
const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size >> 1);
const int tx_size_in_blocks = 1 << tx_size;
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
int pt; /* near block/prev token context index */
......@@ -242,7 +240,7 @@ struct is_skippable_args {
};
static void is_skippable(int plane, int block,
BLOCK_SIZE_TYPE bsize, int ss_txfrm_size, void *argv) {
BLOCK_SIZE_TYPE bsize, TX_SIZE tx_size, void *argv) {
struct is_skippable_args *args = argv;
args->skippable[0] &= (!args->xd->plane[plane].eobs[block]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment