summaryrefslogtreecommitdiff
path: root/vp10/decoder
diff options
context:
space:
mode:
authorDebargha Mukherjee <debargha@google.com>2016-01-06 11:24:57 -0800
committerDebargha Mukherjee <debargha@google.com>2016-01-08 11:13:46 -0800
commitf7dfa4ece7b4e2aef190923abe4a3f1d3ca3ece8 (patch)
tree4f775faea7fd1be5147f090025b413ed62e428ab /vp10/decoder
parent2bd4f444092bf1902a1caca66e14e8e75189191d (diff)
downloadlibvpx-f7dfa4ece7b4e2aef190923abe4a3f1d3ca3ece8.tar
libvpx-f7dfa4ece7b4e2aef190923abe4a3f1d3ca3ece8.tar.gz
libvpx-f7dfa4ece7b4e2aef190923abe4a3f1d3ca3ece8.tar.bz2
libvpx-f7dfa4ece7b4e2aef190923abe4a3f1d3ca3ece8.zip
Modifies inter/intra coding to allow all tx types
The nominal tx_type for a given mode is used as a context to encode the actual tx_type for intra. Results: derflr: -0.241% BDRATE hevcmr: -0.366% BDRATE Change-Id: Icfe7b0a58d79bc6497a06e3441779afec6e01e21
Diffstat (limited to 'vp10/decoder')
-rw-r--r--vp10/decoder/decodeframe.c32
-rw-r--r--vp10/decoder/decodemv.c40
2 files changed, 72 insertions, 0 deletions
diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c
index 2bfedf638..36eb004d7 100644
--- a/vp10/decoder/decodeframe.c
+++ b/vp10/decoder/decodeframe.c
@@ -268,7 +268,11 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane,
if (eob == 1) {
dqcoeff[0] = 0;
} else {
+#if CONFIG_EXT_TX
+ if (tx_type == DCT_DCT && tx_size <= TX_16X16 && eob <= 10)
+#else
if (tx_size <= TX_16X16 && eob <= 10)
+#endif // CONFIG_EXT_TX
memset(dqcoeff, 0, 4 * (4 << tx_size) * sizeof(dqcoeff[0]));
else if (tx_size == TX_32X32 && eob <= 34)
memset(dqcoeff, 0, 256 * sizeof(dqcoeff[0]));
@@ -2124,6 +2128,25 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
return sz;
}
+#if CONFIG_EXT_TX
+static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
+ int i, j, k;
+ if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
+ for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
+ for (j = 0; j < TX_TYPES; ++j)
+ for (k = 0; k < TX_TYPES - 1; ++k)
+ vp10_diff_update_prob(r, &fc->intra_ext_tx_prob[i][j][k]);
+ }
+ }
+ if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
+ for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
+ for (k = 0; k < TX_TYPES - 1; ++k)
+ vp10_diff_update_prob(r, &fc->inter_ext_tx_prob[i][k]);
+ }
+ }
+}
+#endif // CONFIG_EXT_TX
+
static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
size_t partition_size) {
VP10_COMMON *const cm = &pbi->common;
@@ -2205,6 +2228,9 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
#endif
read_mv_probs(nmvc, cm->allow_high_precision_mv, &r);
+#if CONFIG_EXT_TX
+ read_ext_tx_probs(fc, &r);
+#endif
}
return vpx_reader_has_error(&r);
@@ -2245,6 +2271,12 @@ static void debug_check_frame_counts(const VP10_COMMON *const cm) {
assert(!memcmp(&cm->counts.tx, &zero_counts.tx, sizeof(cm->counts.tx)));
assert(!memcmp(cm->counts.skip, zero_counts.skip, sizeof(cm->counts.skip)));
assert(!memcmp(&cm->counts.mv, &zero_counts.mv, sizeof(cm->counts.mv)));
+#if CONFIG_EXT_TX
+ assert(!memcmp(cm->counts.intra_ext_tx, zero_counts.intra_ext_tx,
+ sizeof(cm->counts.intra_ext_tx)));
+ assert(!memcmp(cm->counts.inter_ext_tx, zero_counts.inter_ext_tx,
+ sizeof(cm->counts.inter_ext_tx)));
+#endif // CONFIG_EXT_TX
}
#endif // NDEBUG
diff --git a/vp10/decoder/decodemv.c b/vp10/decoder/decodemv.c
index 2bad07a51..1556ea070 100644
--- a/vp10/decoder/decodemv.c
+++ b/vp10/decoder/decodemv.c
@@ -296,6 +296,22 @@ static void read_intra_frame_mode_info(VP10_COMMON *const cm,
}
mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
+
+#if CONFIG_EXT_TX
+ if (mbmi->tx_size < TX_32X32 &&
+ cm->base_qindex > 0 && !mbmi->skip &&
+ !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
+ FRAME_COUNTS *counts = xd->counts;
+ TX_TYPE tx_type_nom = intra_mode_to_tx_type_context[mbmi->mode];
+ mbmi->tx_type = vpx_read_tree(
+ r, vp10_ext_tx_tree,
+ cm->fc->intra_ext_tx_prob[mbmi->tx_size][tx_type_nom]);
+ if (counts)
+ ++counts->intra_ext_tx[mbmi->tx_size][tx_type_nom][mbmi->tx_type];
+ } else {
+ mbmi->tx_type = DCT_DCT;
+ }
+#endif // CONFIG_EXT_TX
}
static int read_mv_component(vpx_reader *r,
@@ -652,6 +668,30 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
read_inter_block_mode_info(pbi, xd, mi, mi_row, mi_col, r);
else
read_intra_block_mode_info(cm, xd, mi, r);
+
+#if CONFIG_EXT_TX
+ if (mbmi->tx_size < TX_32X32 &&
+ cm->base_qindex > 0 && !mbmi->skip &&
+ !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
+ FRAME_COUNTS *counts = xd->counts;
+ if (inter_block) {
+ mbmi->tx_type = vpx_read_tree(
+ r, vp10_ext_tx_tree,
+ cm->fc->inter_ext_tx_prob[mbmi->tx_size]);
+ if (counts)
+ ++counts->inter_ext_tx[mbmi->tx_size][mbmi->tx_type];
+ } else {
+ const TX_TYPE tx_type_nom = intra_mode_to_tx_type_context[mbmi->mode];
+ mbmi->tx_type = vpx_read_tree(
+ r, vp10_ext_tx_tree,
+ cm->fc->intra_ext_tx_prob[mbmi->tx_size][tx_type_nom]);
+ if (counts)
+ ++counts->intra_ext_tx[mbmi->tx_size][tx_type_nom][mbmi->tx_type];
+ }
+ } else {
+ mbmi->tx_type = DCT_DCT;
+ }
+#endif // CONFIG_EXT_TX
}
void vp10_read_mode_info(VP10Decoder *const pbi, MACROBLOCKD *xd,