Commit 73cd22f8 authored by Jim Bankoski's avatar Jim Bankoski

As you go mbmi->skip_coeff

Calculate the skip_coeff as part of the encode process, rather than
checking the eobs after the fact with another pass.

Change-Id: Ib41b139e96a97dee30e4b993b4cc53d86337128d
parent da94b9be
......@@ -2543,6 +2543,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
}
if (!is_inter_block(mbmi)) {
mbmi->skip_coeff = 1;
vp9_encode_intra_block_y(x, MAX(bsize, BLOCK_8X8));
vp9_encode_intra_block_uv(x, MAX(bsize, BLOCK_8X8));
if (output_enabled)
......@@ -2561,6 +2562,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
if (!is_inter_block(mbmi)) {
vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
} else if (!x->skip) {
mbmi->skip_coeff = 1;
vp9_encode_sb(x, MAX(bsize, BLOCK_8X8));
vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
} else {
......
......@@ -451,6 +451,9 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
ctx->tl[plane][j] = p->eobs[block] > 0;
}
if (p->eobs[block])
*(args->skip_coeff) = 0;
if (x->skip_encode || p->eobs[block] == 0)
return;
......@@ -474,7 +477,6 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
assert(0 && "Invalid transform size");
}
}
static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) {
struct encode_b_args *const args = arg;
......@@ -499,7 +501,8 @@ static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,
void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {x, &ctx};
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
vp9_subtract_sby(x, bsize);
if (x->optimize)
......@@ -511,7 +514,8 @@ void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {x, &ctx};
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
if (!x->skip_recode)
vp9_subtract_sb(x, bsize);
......@@ -655,12 +659,15 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
default:
assert(0);
}
if (*eob)
*(args->skip_coeff) = 0;
}
void vp9_encode_intra_block_y(MACROBLOCK *x, BLOCK_SIZE bsize) {
MACROBLOCKD* const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {x, &ctx};
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
foreach_transformed_block_in_plane(xd, bsize, 0, vp9_encode_block_intra,
&arg);
......@@ -668,7 +675,8 @@ void vp9_encode_intra_block_y(MACROBLOCK *x, BLOCK_SIZE bsize) {
void vp9_encode_intra_block_uv(MACROBLOCK *x, BLOCK_SIZE bsize) {
MACROBLOCKD* const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {x, &ctx};
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
foreach_transformed_block_uv(xd, bsize, vp9_encode_block_intra, &arg);
}
......
......@@ -24,6 +24,7 @@ struct optimize_ctx {
struct encode_b_args {
MACROBLOCK *x;
struct optimize_ctx *ctx;
unsigned char *skip_coeff;
};
void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
......
......@@ -640,7 +640,9 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
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};
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args encode_args = {x, NULL, &mbmi->skip_coeff};
int64_t rd1, rd2, rd;
if (args->skip)
......
......@@ -299,8 +299,6 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
const int skip_inc = !vp9_segfeature_active(&cm->seg, mbmi->segment_id,
SEG_LVL_SKIP);
struct tokenize_b_args arg = {cpi, xd, t, mbmi->tx_size, cpi->mb.token_cache};
mbmi->skip_coeff = sb_is_skippable(&cpi->mb, bsize);
if (mbmi->skip_coeff) {
if (!dry_run)
cm->counts.mbskip[ctx][1] += skip_inc;
......
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