Remove obsolete segment skip checks from tokenization.

Change-Id: Iac7bc0d0eba459a04688aae224d34ae9b59742db
This commit is contained in:
Alex Converse 2016-04-08 11:38:25 -07:00
parent 989d536861
commit fa4ca4037e
3 changed files with 17 additions and 20 deletions

View File

@ -4316,7 +4316,8 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td,
vp9_encode_intra_block_plane(x, VPXMAX(bsize, BLOCK_8X8), plane); vp9_encode_intra_block_plane(x, VPXMAX(bsize, BLOCK_8X8), plane);
if (output_enabled) if (output_enabled)
sum_intra_stats(td->counts, mi); sum_intra_stats(td->counts, mi);
vp9_tokenize_sb(cpi, td, t, !output_enabled, VPXMAX(bsize, BLOCK_8X8)); vp9_tokenize_sb(cpi, td, t, !output_enabled, seg_skip,
VPXMAX(bsize, BLOCK_8X8));
} else { } else {
int ref; int ref;
const int is_compound = has_second_ref(mi); const int is_compound = has_second_ref(mi);
@ -4336,7 +4337,8 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td,
VPXMAX(bsize, BLOCK_8X8)); VPXMAX(bsize, BLOCK_8X8));
vp9_encode_sb(x, VPXMAX(bsize, BLOCK_8X8)); vp9_encode_sb(x, VPXMAX(bsize, BLOCK_8X8));
vp9_tokenize_sb(cpi, td, t, !output_enabled, VPXMAX(bsize, BLOCK_8X8)); vp9_tokenize_sb(cpi, td, t, !output_enabled, seg_skip,
VPXMAX(bsize, BLOCK_8X8));
} }
if (output_enabled) { if (output_enabled) {

View File

@ -18,7 +18,6 @@
#include "vp9/common/vp9_entropy.h" #include "vp9/common/vp9_entropy.h"
#include "vp9/common/vp9_pred_common.h" #include "vp9/common/vp9_pred_common.h"
#include "vp9/common/vp9_scan.h" #include "vp9/common/vp9_scan.h"
#include "vp9/common/vp9_seg_common.h"
#include "vp9/encoder/vp9_cost.h" #include "vp9/encoder/vp9_cost.h"
#include "vp9/encoder/vp9_encoder.h" #include "vp9/encoder/vp9_encoder.h"
@ -354,12 +353,6 @@ static INLINE void add_token_no_extra(TOKENEXTRA **t,
++counts[token]; ++counts[token];
} }
static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id,
TX_SIZE tx_size) {
const int eob_max = 16 << (tx_size << 1);
return segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;
}
static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) { TX_SIZE tx_size, void *arg) {
struct tokenize_b_args* const args = arg; struct tokenize_b_args* const args = arg;
@ -378,7 +371,6 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
int eob = p->eobs[block]; int eob = p->eobs[block];
const PLANE_TYPE type = get_plane_type(plane); const PLANE_TYPE type = get_plane_type(plane);
const tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block); const tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
const int segment_id = mi->segment_id;
const int16_t *scan, *nb; const int16_t *scan, *nb;
const scan_order *so; const scan_order *so;
const int ref = is_inter_block(mi); const int ref = is_inter_block(mi);
@ -389,7 +381,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
unsigned int (*const eob_branch)[COEFF_CONTEXTS] = unsigned int (*const eob_branch)[COEFF_CONTEXTS] =
td->counts->eob_branch[tx_size][type][ref]; td->counts->eob_branch[tx_size][type][ref];
const uint8_t *const band = get_band_translate(tx_size); const uint8_t *const band = get_band_translate(tx_size);
const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size); const int tx_eob = 16 << (tx_size << 1);
int16_t token; int16_t token;
EXTRABIT extra; EXTRABIT extra;
int aoff, loff; int aoff, loff;
@ -426,7 +418,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
++c; ++c;
pt = get_coef_context(nb, token_cache, c); pt = get_coef_context(nb, token_cache, c);
} }
if (c < seg_eob) { if (c < tx_eob) {
++eob_branch[band[c]][pt]; ++eob_branch[band[c]][pt];
add_token_no_extra(&t, coef_probs[band[c]][pt], EOB_TOKEN, add_token_no_extra(&t, coef_probs[band[c]][pt], EOB_TOKEN,
counts[band[c]][pt]); counts[band[c]][pt]);
@ -481,24 +473,26 @@ int vp9_has_high_freq_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
} }
void vp9_tokenize_sb(VP9_COMP *cpi, ThreadData *td, TOKENEXTRA **t, void vp9_tokenize_sb(VP9_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
int dry_run, BLOCK_SIZE bsize) { int dry_run, int seg_skip, BLOCK_SIZE bsize) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &td->mb; MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mi = xd->mi[0]; MODE_INFO *const mi = xd->mi[0];
const int ctx = vp9_get_skip_context(xd); const int ctx = vp9_get_skip_context(xd);
const int skip_inc = !segfeature_active(&cm->seg, mi->segment_id,
SEG_LVL_SKIP);
struct tokenize_b_args arg = {cpi, td, t}; struct tokenize_b_args arg = {cpi, td, t};
if (seg_skip) {
assert(mi->skip);
}
if (mi->skip) { if (mi->skip) {
if (!dry_run) if (!dry_run && !seg_skip)
td->counts->skip[ctx][1] += skip_inc; ++td->counts->skip[ctx][1];
reset_skip_context(xd, bsize); reset_skip_context(xd, bsize);
return; return;
} }
if (!dry_run) { if (!dry_run) {
td->counts->skip[ctx][0] += skip_inc; ++td->counts->skip[ctx][0];
vp9_foreach_transformed_block(xd, bsize, tokenize_b, &arg); vp9_foreach_transformed_block(xd, bsize, tokenize_b, &arg);
} else { } else {
vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg); vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);

View File

@ -51,7 +51,8 @@ struct VP9_COMP;
struct ThreadData; struct ThreadData;
void vp9_tokenize_sb(struct VP9_COMP *cpi, struct ThreadData *td, void vp9_tokenize_sb(struct VP9_COMP *cpi, struct ThreadData *td,
TOKENEXTRA **t, int dry_run, BLOCK_SIZE bsize); TOKENEXTRA **t, int dry_run, int seg_skip,
BLOCK_SIZE bsize);
typedef struct { typedef struct {
const vpx_prob *prob; const vpx_prob *prob;