Refactor write_modes_b() and decode_block()
In order to reduce the code complexity for handling parameter
coding and recon separately for each 64x64 in non-causal obmc
experiment, we break them down to two steps calling separate
functions, one for params, the other dealing with coefficients
and recon(decoder side).
Note: actually the non-causal prediction can use the original
syntax, but right now in the decoder coeff detoken and recon are
heavily nested.
Change-Id: I72d9c42ab8f38b57850d6b0481551893f1702822
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index f3135de..a7015c1 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1378,37 +1378,36 @@
}
#endif // CONFIG_SUPERTX
-static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
+static void decode_mbmi_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
#if CONFIG_SUPERTX
- int supertx_enabled,
+ int supertx_enabled,
#endif // CONFIG_SUPERTX
- int mi_row, int mi_col, aom_reader *r,
+ int mi_row, int mi_col, aom_reader *r,
#if CONFIG_EXT_PARTITION_TYPES
- PARTITION_TYPE partition,
+ PARTITION_TYPE partition,
#endif // CONFIG_EXT_PARTITION_TYPES
- BLOCK_SIZE bsize) {
+ BLOCK_SIZE bsize) {
AV1_COMMON *const cm = &pbi->common;
const int bw = mi_size_wide[bsize];
const int bh = mi_size_high[bsize];
const int x_mis = AOMMIN(bw, cm->mi_cols - mi_col);
const int y_mis = AOMMIN(bh, cm->mi_rows - mi_row);
- MB_MODE_INFO *mbmi;
#if CONFIG_ACCOUNTING
aom_accounting_set_context(&pbi->accounting, mi_col, mi_row);
#endif
#if CONFIG_SUPERTX
if (supertx_enabled) {
- mbmi = set_mb_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
+ set_mb_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
} else {
- mbmi = set_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
+ set_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
}
#if CONFIG_EXT_PARTITION_TYPES
xd->mi[0]->mbmi.partition = partition;
#endif
av1_read_mode_info(pbi, xd, supertx_enabled, mi_row, mi_col, r, x_mis, y_mis);
#else
- mbmi = set_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
+ set_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
#if CONFIG_EXT_PARTITION_TYPES
xd->mi[0]->mbmi.partition = partition;
#endif
@@ -1424,14 +1423,24 @@
}
#if CONFIG_SUPERTX
- mbmi->segment_id_supertx = MAX_SEGMENTS;
-
- if (supertx_enabled) {
- xd->corrupted |= aom_reader_has_error(r);
- return;
- }
+ xd->mi[0]->mbmi.segment_id_supertx = MAX_SEGMENTS;
#endif // CONFIG_SUPERTX
+ xd->corrupted |= aom_reader_has_error(r);
+}
+
+static void decode_token_and_recon_block(AV1Decoder *const pbi,
+ MACROBLOCKD *const xd, int mi_row,
+ int mi_col, aom_reader *r,
+ BLOCK_SIZE bsize) {
+ AV1_COMMON *const cm = &pbi->common;
+ const int bw = mi_size_wide[bsize];
+ const int bh = mi_size_high[bsize];
+ const int x_mis = AOMMIN(bw, cm->mi_cols - mi_col);
+ const int y_mis = AOMMIN(bh, cm->mi_rows - mi_row);
+ MB_MODE_INFO *mbmi;
+
+ mbmi = set_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
#if CONFIG_DELTA_Q
if (cm->delta_q_present_flag) {
int i;
@@ -1691,6 +1700,30 @@
xd->corrupted |= aom_reader_has_error(r);
}
+static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
+#if CONFIG_SUPERTX
+ int supertx_enabled,
+#endif // CONFIG_SUPERTX
+ int mi_row, int mi_col, aom_reader *r,
+#if CONFIG_EXT_PARTITION_TYPES
+ PARTITION_TYPE partition,
+#endif // CONFIG_EXT_PARTITION_TYPES
+ BLOCK_SIZE bsize) {
+ decode_mbmi_block(pbi, xd,
+#if CONFIG_SUPERTX
+ supertx_enabled,
+#endif
+ mi_row, mi_col, r,
+#if CONFIG_EXT_PARTITION_TYPES
+ partition,
+#endif
+ bsize);
+#if CONFIG_SUPERTX
+ if (!supertx_enabled)
+#endif // CONFIG_SUPERTX
+ decode_token_and_recon_block(pbi, xd, mi_row, mi_col, r, bsize);
+}
+
static PARTITION_TYPE read_partition(AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, aom_reader *r,
int has_rows, int has_cols,