}
typedef void (*foreach_transformed_block_visitor)(int plane, int block,
- BLOCK_SIZE_TYPE bsize,
+ BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size,
void *arg);
const MB_MODE_INFO* mbmi = &xd->mode_info_context->mbmi;
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi)
: mbmi->txfm_size;
- const int bw = b_width_log2(bsize) - pd->subsampling_x;
- const int bh = b_height_log2(bsize) - pd->subsampling_y;
- const int txfrm_size_b = tx_size * 2;
- const int step = 1 << txfrm_size_b;
+ const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize, pd);
+ const int bw = b_width_log2(plane_bsize);
+ const int bh = b_height_log2(plane_bsize);
+ const int step = 1 << (tx_size << 1);
int i;
// If mb_to_right_edge is < 0 we are in a situation in which
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, tx_size, arg);
+ visit(plane, i, plane_bsize, tx_size, arg);
i += step;
}
}
} else {
- 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, tx_size, arg);
+ for (i = 0; i < (1 << (bw + bh)); i += step)
+ visit(plane, i, plane_bsize, tx_size, arg);
}
}
*d = c;
}
}
-static void set_contexts_on_border(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
+static void set_contexts_on_border(MACROBLOCKD *xd, BLOCK_SIZE_TYPE plane_bsize,
int plane, int tx_size_in_blocks,
int eob, int aoff, int loff,
ENTROPY_CONTEXT *A, ENTROPY_CONTEXT *L) {
struct macroblockd_plane *pd = &xd->plane[plane];
- const BLOCK_SIZE_TYPE bs = get_plane_block_size(bsize, pd);
- int mi_blocks_wide = num_4x4_blocks_wide_lookup[bs];
- int mi_blocks_high = num_4x4_blocks_high_lookup[bs];
+ int mi_blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize];
+ int mi_blocks_high = num_4x4_blocks_high_lookup[plane_bsize];
int above_contexts = tx_size_in_blocks;
int left_contexts = tx_size_in_blocks;
int pt;
xd->plane[i].dequant = cm->uv_dequant[xd->q_index];
}
-static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
+static void decode_block(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *arg) {
MACROBLOCKD* const xd = arg;
struct macroblockd_plane *const pd = &xd->plane[plane];
- const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize, pd);
int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
const int stride = pd->dst.stride;
const int eob = pd->eobs[block];
}
}
-static void decode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
+static void decode_block_intra(int plane, int block,
+ BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *arg) {
MACROBLOCKD* const xd = arg;
struct macroblockd_plane *const pd = &xd->plane[plane];
- const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize, pd);
MODE_INFO *const mi = xd->mode_info_context;
const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size,
block);
const int mode = (plane == 0) ? mi->mbmi.mode : mi->mbmi.uv_mode;
if (plane == 0 && mi->mbmi.sb_type < BLOCK_8X8) {
- assert(bsize == BLOCK_8X8);
+ assert(plane_bsize == BLOCK_8X8);
b_mode = mi->bmi[raster_block].as_mode;
} else {
b_mode = mode;
if (mi->mbmi.skip_coeff)
return;
- decode_block(plane, block, bsize, tx_size, arg);
+ decode_block(plane, block, plane_bsize, tx_size, arg);
}
static int decode_tokens(VP9D_COMP *pbi, BLOCK_SIZE_TYPE bsize, vp9_reader *r) {
int *eobtotal;
};
-static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
+static void decode_block(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *argv) {
const struct decode_block_args* const arg = argv;
- const int bw = b_width_log2(bsize);
// find the maximum eob for this transform size, adjusted by segment
MACROBLOCKD *xd = &arg->pbi->mb;
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;
+ const int mod = b_width_log2(plane_bsize) - tx_size;
const int aoff = (off & ((1 << mod) - 1)) << tx_size;
const int loff = (off >> mod) << tx_size;
const int tx_size_in_blocks = 1 << tx_size;
tx_size, pd->dequant, A, L);
if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
- set_contexts_on_border(xd, bsize, plane, tx_size_in_blocks, eob, aoff, loff,
- A, L);
+ set_contexts_on_border(xd, plane_bsize, plane, tx_size_in_blocks, eob,
+ aoff, loff, A, L);
} else {
int pt;
for (pt = 0; pt < tx_size_in_blocks; pt++)
#include "vp9/encoder/vp9_onyx_int.h"
int vp9_encode_intra(MACROBLOCK *x, int use_16x16_pred);
-void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
+void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *arg);
#endif // VP9_ENCODER_VP9_ENCODEINTRA_H_
}
static void optimize_b(MACROBLOCK *mb,
- int plane, int block, BLOCK_SIZE_TYPE bsize,
+ int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
TX_SIZE tx_size) {
MACROBLOCKD *const xd = &mb->e_mbd;
struct macroblockd_plane *pd = &xd->plane[plane];
- const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize, pd);
const int ref = is_inter_block(&xd->mode_info_context->mbmi);
vp9_token_state tokens[1025][2];
unsigned best_index[1025][2];
*a = *l = (final_eob > 0);
}
-void vp9_optimize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
+void vp9_optimize_b(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, MACROBLOCK *mb, struct optimize_ctx *ctx) {
- MACROBLOCKD *const xd = &mb->e_mbd;
- const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize,
- &xd->plane[plane]);
int x, y;
-
- // find current entropy context
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
-
- optimize_b(mb, plane, block, bsize, &ctx->ta[plane][x], &ctx->tl[plane][y],
- tx_size);
-}
-
-static void optimize_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
- TX_SIZE tx_size, void *arg) {
- const struct encode_b_args* const args = arg;
- vp9_optimize_b(plane, block, bsize, tx_size, args->x, args->ctx);
+ optimize_b(mb, plane, block, plane_bsize,
+ &ctx->ta[plane][x], &ctx->tl[plane][y], tx_size);
}
void optimize_init_b(int plane, BLOCK_SIZE_TYPE bsize, void *arg) {
}
}
-void vp9_optimize_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
- struct optimize_ctx ctx;
- struct encode_b_args arg = {x, &ctx};
- optimize_init_b(0, bsize, &arg);
- foreach_transformed_block_in_plane(&x->e_mbd, bsize, 0, optimize_block, &arg);
-}
-
-void vp9_optimize_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
- struct optimize_ctx ctx;
- struct encode_b_args arg = {x, &ctx};
- int i;
- for (i = 1; i < MAX_MB_PLANE; ++i)
- optimize_init_b(i, bsize, &arg);
-
- foreach_transformed_block_uv(&x->e_mbd, bsize, optimize_block, &arg);
-}
-
void vp9_xform_quant(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *arg) {
struct encode_b_args* const args = arg;
}
}
-static void encode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
+static void encode_block(int plane, int block, BLOCK_SIZE_TYPE 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 macroblockd_plane *const pd = &xd->plane[plane];
- const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize, pd);
const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size,
block);
vp9_xform_quant(plane, block, plane_bsize, tx_size, arg);
if (x->optimize)
- vp9_optimize_b(plane, block, bsize, tx_size, x, args->ctx);
+ vp9_optimize_b(plane, block, plane_bsize, tx_size, x, args->ctx);
if (x->skip_encode || pd->eobs[block] == 0)
return;
}
}
-void vp9_xform_quant_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
- MACROBLOCKD* const xd = &x->e_mbd;
- struct encode_b_args arg = {x, NULL};
-
- foreach_transformed_block_in_plane(xd, bsize, 0, vp9_xform_quant, &arg);
-}
-
-void vp9_xform_quant_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
- MACROBLOCKD* const xd = &x->e_mbd;
- struct encode_b_args arg = {x, NULL};
-
- foreach_transformed_block_uv(xd, bsize, vp9_xform_quant, &arg);
-}
-
void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
foreach_transformed_block_in_plane(xd, bsize, 0, encode_block, &arg);
}
-void vp9_encode_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
- MACROBLOCKD *const xd = &x->e_mbd;
- struct optimize_ctx ctx;
- struct encode_b_args arg = {x, &ctx};
-
- vp9_subtract_sbuv(x, bsize);
- if (x->optimize) {
- int i;
- for (i = 1; i < MAX_MB_PLANE; ++i)
- optimize_init_b(i, bsize, &arg);
- }
-
- foreach_transformed_block_uv(xd, bsize, encode_block, &arg);
-}
-
void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
foreach_transformed_block(xd, bsize, encode_block, &arg);
}
-void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
+void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *arg) {
struct encode_b_args* const args = arg;
MACROBLOCK *const x = args->x;
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
- const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize, pd);
int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
int16_t *src_diff;
uint16_t *eob = &pd->eobs[block];
- if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
+ 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, tx_size, x, args->ctx);
+ // vp9_optimize_b(plane, block, plane_bsize, tx_size, x, args->ctx);
switch (tx_size) {
case TX_32X32:
struct optimize_ctx *ctx;
};
-void vp9_optimize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
- TX_SIZE tx_size, MACROBLOCK *x, struct optimize_ctx *ctx);
-void vp9_optimize_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
-void vp9_optimize_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
-
void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
-void vp9_encode_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_xform_quant(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *arg);
-void vp9_xform_quant_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
-void vp9_xform_quant_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
args->scan, args->nb);
}
-static void block_yrd_txfm(int plane, int block, BLOCK_SIZE_TYPE bsize,
+static void block_yrd_txfm(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *arg) {
struct rdcost_block_args *args = arg;
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
struct encode_b_args encode_args = {x, NULL};
- const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize,
- &xd->plane[plane]);
int64_t rd1, rd2, rd;
if (args->skip)
}
if (!is_inter_block(&xd->mode_info_context->mbmi))
- vp9_encode_block_intra(plane, block, bsize, tx_size, &encode_args);
+ vp9_encode_block_intra(plane, block, plane_bsize, tx_size, &encode_args);
else
vp9_xform_quant(plane, block, plane_bsize, tx_size, &encode_args);
TX_SIZE tx_size;
};
-static void set_entropy_context_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
+static void set_entropy_context_b(int plane, int block,
+ BLOCK_SIZE_TYPE plane_bsize,
TX_SIZE tx_size, void *arg) {
struct tokenize_b_args* const args = arg;
MACROBLOCKD *const xd = args->xd;
- const int bwl = b_width_log2(bsize);
+ struct macroblockd_plane *pd = &xd->plane[plane];
const int off = block >> (2 * tx_size);
- const int mod = bwl - tx_size - xd->plane[plane].subsampling_x;
+ const int mod = b_width_log2(plane_bsize) - tx_size;
const int aoff = (off & ((1 << mod) - 1)) << tx_size;
const int loff = (off >> mod) << tx_size;
- ENTROPY_CONTEXT *A = xd->plane[plane].above_context + aoff;
- ENTROPY_CONTEXT *L = xd->plane[plane].left_context + loff;
- const int eob = xd->plane[plane].eobs[block];
+ ENTROPY_CONTEXT *A = pd->above_context + aoff;
+ ENTROPY_CONTEXT *L = pd->left_context + loff;
+ const int eob = pd->eobs[block];
const int tx_size_in_blocks = 1 << tx_size;
if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
- set_contexts_on_border(xd, bsize, plane, tx_size_in_blocks, eob, aoff, loff,
- A, L);
+ set_contexts_on_border(xd, plane_bsize, plane, tx_size_in_blocks, eob, aoff,
+ loff, A, L);
} else {
vpx_memset(A, eob > 0, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
vpx_memset(L, eob > 0, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
}
}
-static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
+static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE plane_bsize,
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 int tx_size_in_blocks = 1 << tx_size;
+ struct macroblockd_plane *pd = &xd->plane[plane];
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
int pt; /* near block/prev token context index */
int c = 0, rc = 0;
TOKENEXTRA *t = *tp; /* store tokens starting here */
- const int eob = xd->plane[plane].eobs[block];
- const PLANE_TYPE type = xd->plane[plane].plane_type;
- const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block);
- const int bwl = b_width_log2(bsize);
+ const int eob = pd->eobs[block];
+ const PLANE_TYPE type = pd->plane_type;
+ const int16_t *qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block);
const int off = block >> (2 * tx_size);
- const int mod = bwl - tx_size - xd->plane[plane].subsampling_x;
+ const int mod = b_width_log2(plane_bsize) - tx_size;
const int aoff = (off & ((1 << mod) - 1)) << tx_size;
const int loff = (off >> mod) << tx_size;
- ENTROPY_CONTEXT *A = xd->plane[plane].above_context + aoff;
- ENTROPY_CONTEXT *L = xd->plane[plane].left_context + loff;
+ ENTROPY_CONTEXT *A = pd->above_context + aoff;
+ ENTROPY_CONTEXT *L = pd->left_context + loff;
int seg_eob;
const int segment_id = mbmi->segment_id;
const int16_t *scan, *nb;
*tp = t;
if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
- set_contexts_on_border(xd, bsize, plane, tx_size_in_blocks, c, aoff, loff,
- A, L);
+ set_contexts_on_border(xd, plane_bsize, plane, tx_size_in_blocks, c,
+ aoff, loff, A, L);
} else {
vpx_memset(A, c > 0, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
vpx_memset(L, c > 0, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
};
static void is_skippable(int plane, int block,
- BLOCK_SIZE_TYPE bsize, TX_SIZE tx_size, void *argv) {
+ BLOCK_SIZE_TYPE plane_bsize, TX_SIZE tx_size,
+ void *argv) {
struct is_skippable_args *args = argv;
args->skippable[0] &= (!args->xd->plane[plane].eobs[block]);
}