ref: 5645b2d89b6407117364c02b6278eca78fe5235e
parent: 9f09618bd4d1b90b0897fa8ddcb0d3c73b3d9b25
parent: 2d1ab9a85049852434129c0862f84dd412b32295
author: James Zern <[email protected]>
date: Tue Oct 22 09:08:44 EDT 2013
Merge "vp9 dec/com: only update frame counts when necessary (2)"
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -928,6 +928,44 @@
}
}
+#ifdef NDEBUG
+#define debug_check_frame_counts(cm) (void)0
+#else // !NDEBUG
+// Counts should only be incremented when frame_parallel_decoding_mode and
+// error_resilient_mode are disabled.
+static void debug_check_frame_counts(const VP9_COMMON *const cm) {
+ FRAME_COUNTS zero_counts;
+ vp9_zero(zero_counts);
+ assert(cm->frame_parallel_decoding_mode || cm->error_resilient_mode);
+ assert(!memcmp(cm->counts.y_mode, zero_counts.y_mode,
+ sizeof(cm->counts.y_mode)));
+ assert(!memcmp(cm->counts.uv_mode, zero_counts.uv_mode,
+ sizeof(cm->counts.uv_mode)));
+ assert(!memcmp(cm->counts.partition, zero_counts.partition,
+ sizeof(cm->counts.partition)));
+ assert(!memcmp(cm->counts.coef, zero_counts.coef,
+ sizeof(cm->counts.coef)));
+ assert(!memcmp(cm->counts.eob_branch, zero_counts.eob_branch,
+ sizeof(cm->counts.eob_branch)));
+ assert(!memcmp(cm->counts.switchable_interp, zero_counts.switchable_interp,
+ sizeof(cm->counts.switchable_interp)));
+ assert(!memcmp(cm->counts.inter_mode, zero_counts.inter_mode,
+ sizeof(cm->counts.inter_mode)));
+ assert(!memcmp(cm->counts.intra_inter, zero_counts.intra_inter,
+ sizeof(cm->counts.intra_inter)));
+ assert(!memcmp(cm->counts.comp_inter, zero_counts.comp_inter,
+ sizeof(cm->counts.comp_inter)));
+ assert(!memcmp(cm->counts.single_ref, zero_counts.single_ref,
+ sizeof(cm->counts.single_ref)));
+ assert(!memcmp(cm->counts.comp_ref, zero_counts.comp_ref,
+ sizeof(cm->counts.comp_ref)));
+ assert(!memcmp(&cm->counts.tx, &zero_counts.tx, sizeof(cm->counts.tx)));
+ assert(!memcmp(cm->counts.mbskip, zero_counts.mbskip,
+ sizeof(cm->counts.mbskip)));
+ assert(!memcmp(&cm->counts.mv, &zero_counts.mv, sizeof(cm->counts.mv)));
+}
+#endif // NDEBUG
+
int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
int i;
VP9_COMMON *const cm = &pbi->common;
@@ -1018,6 +1056,8 @@
vp9_adapt_mode_probs(cm);
vp9_adapt_mv_probs(cm, cm->allow_high_precision_mv);
}
+ } else {
+ debug_check_frame_counts(cm);
}
if (cm->refresh_frame_context)
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -61,13 +61,16 @@
254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0
};
-#define INCREMENT_COUNT(token) \
- do { \
- coef_counts[type][ref][band][pt] \
- [token >= TWO_TOKEN ? \
- (token == DCT_EOB_TOKEN ? DCT_EOB_MODEL_TOKEN : TWO_TOKEN) : \
- token]++; \
- token_cache[scan[c]] = vp9_pt_energy_class[token]; \
+#define INCREMENT_COUNT(token) \
+ do { \
+ if (!cm->frame_parallel_decoding_mode) { \
+ ++coef_counts[type][ref][band][pt] \
+ [token >= TWO_TOKEN ? \
+ (token == DCT_EOB_TOKEN ? \
+ DCT_EOB_MODEL_TOKEN : TWO_TOKEN) : \
+ token]; \
+ } \
+ token_cache[scan[c]] = vp9_pt_energy_class[token]; \
} while (0)
#define WRITE_COEF_CONTINUE(val, token) \