vp9 dec/com: only update frame counts when necessary (2)
missed one in vp9_detokenize.c in the last + add some asserts in vp9_decode_frame() to catch regressions Change-Id: Ide67505114ee17efdafb13694aed0c09039e5a16
This commit is contained in:
parent
e6a0099971
commit
2d1ab9a850
@ -942,6 +942,44 @@ void vp9_init_dequantizer(VP9_COMMON *cm) {
|
||||
}
|
||||
}
|
||||
|
||||
#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;
|
||||
@ -1032,6 +1070,8 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
|
||||
vp9_adapt_mode_probs(cm);
|
||||
vp9_adapt_mv_probs(cm, xd->allow_high_precision_mv);
|
||||
}
|
||||
} else {
|
||||
debug_check_frame_counts(cm);
|
||||
}
|
||||
|
||||
if (cm->refresh_frame_context)
|
||||
|
@ -63,10 +63,13 @@ static const vp9_prob cat6_prob[15] = {
|
||||
|
||||
#define INCREMENT_COUNT(token) \
|
||||
do { \
|
||||
coef_counts[type][ref][band][pt] \
|
||||
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 == DCT_EOB_TOKEN ? \
|
||||
DCT_EOB_MODEL_TOKEN : TWO_TOKEN) : \
|
||||
token]; \
|
||||
} \
|
||||
token_cache[scan[c]] = vp9_pt_energy_class[token]; \
|
||||
} while (0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user