summaryrefslogtreecommitdiff
path: root/vp10/encoder
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2015-10-08 18:50:39 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-10-08 18:50:39 +0000
commitca67339901f21e25ce7c7c1b9c935c08a07e00eb (patch)
treece31ec2de226c1ce60717380986b18a78406b71e /vp10/encoder
parentb60b15bc1189aa512c48b94766e25e933205e31b (diff)
parent3461e8ce64739f8e70a9bcb8b062382e23a09cf9 (diff)
downloadlibvpx-ca67339901f21e25ce7c7c1b9c935c08a07e00eb.tar
libvpx-ca67339901f21e25ce7c7c1b9c935c08a07e00eb.tar.gz
libvpx-ca67339901f21e25ce7c7c1b9c935c08a07e00eb.tar.bz2
libvpx-ca67339901f21e25ce7c7c1b9c935c08a07e00eb.zip
Merge "vp10: skip unreachable cat6 token extrabits."
Diffstat (limited to 'vp10/encoder')
-rw-r--r--vp10/encoder/bitstream.c33
-rw-r--r--vp10/encoder/encodeframe.c3
-rw-r--r--vp10/encoder/tokenize.c10
3 files changed, 37 insertions, 9 deletions
diff --git a/vp10/encoder/bitstream.c b/vp10/encoder/bitstream.c
index 940ae8832..1661fbd5d 100644
--- a/vp10/encoder/bitstream.c
+++ b/vp10/encoder/bitstream.c
@@ -122,8 +122,11 @@ static void update_switchable_interp_probs(VP10_COMMON *cm, vpx_writer *w,
static void pack_mb_tokens(vpx_writer *w,
TOKENEXTRA **tp, const TOKENEXTRA *const stop,
- vpx_bit_depth_t bit_depth) {
+ vpx_bit_depth_t bit_depth, const TX_SIZE tx) {
TOKENEXTRA *p = *tp;
+#if !CONFIG_MISC_FIXES
+ (void) tx;
+#endif
while (p < stop && p->token != EOSB_TOKEN) {
const int t = p->token;
@@ -171,6 +174,12 @@ static void pack_mb_tokens(vpx_writer *w,
if (b->base_val) {
const int e = p->extra, l = b->len;
+#if CONFIG_MISC_FIXES
+ int skip_bits =
+ (b->base_val == CAT6_MIN_VAL) ? TX_SIZES - 1 - tx : 0;
+#else
+ int skip_bits = 0;
+#endif
if (l) {
const unsigned char *pb = b->prob;
@@ -180,7 +189,12 @@ static void pack_mb_tokens(vpx_writer *w,
do {
const int bb = (v >> --n) & 1;
- vpx_write(w, bb, pb[i >> 1]);
+ if (skip_bits) {
+ skip_bits--;
+ assert(!bb);
+ } else {
+ vpx_write(w, bb, pb[i >> 1]);
+ }
i = b->tree[i + bb];
} while (n);
}
@@ -190,7 +204,7 @@ static void pack_mb_tokens(vpx_writer *w,
++p;
}
- *tp = p + (p->token == EOSB_TOKEN);
+ *tp = p;
}
static void write_segment_id(vpx_writer *w, const struct segmentation *seg,
@@ -382,6 +396,7 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
const VP10_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
MODE_INFO *m;
+ int plane;
xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col);
m = xd->mi[0];
@@ -398,8 +413,16 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
pack_inter_mode_mvs(cpi, m, w);
}
- assert(*tok < tok_end);
- pack_mb_tokens(w, tok, tok_end, cm->bit_depth);
+ if (!m->mbmi.skip) {
+ assert(*tok < tok_end);
+ for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+ TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane])
+ : m->mbmi.tx_size;
+ pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx);
+ assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
+ (*tok)++;
+ }
+ }
}
static void write_partition(const VP10_COMMON *const cm,
diff --git a/vp10/encoder/encodeframe.c b/vp10/encoder/encodeframe.c
index 019e5b1e9..ce1530c63 100644
--- a/vp10/encoder/encodeframe.c
+++ b/vp10/encoder/encodeframe.c
@@ -1356,9 +1356,6 @@ static void encode_b(VP10_COMP *cpi, const TileInfo *const tile,
if (output_enabled) {
update_stats(&cpi->common, td);
-
- (*tp)->token = EOSB_TOKEN;
- (*tp)++;
}
}
diff --git a/vp10/encoder/tokenize.c b/vp10/encoder/tokenize.c
index af915feed..cbebd5aa8 100644
--- a/vp10/encoder/tokenize.c
+++ b/vp10/encoder/tokenize.c
@@ -628,8 +628,16 @@ void vp10_tokenize_sb(VP10_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
}
if (!dry_run) {
+ int plane;
+
td->counts->skip[ctx][0] += skip_inc;
- vp10_foreach_transformed_block(xd, bsize, tokenize_b, &arg);
+
+ for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+ vp10_foreach_transformed_block_in_plane(xd, bsize, plane, tokenize_b,
+ &arg);
+ (*t)->token = EOSB_TOKEN;
+ (*t)++;
+ }
} else {
vp10_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
}