Index: source/libvpx/vp9/common/vp9_idct.h |
=================================================================== |
--- source/libvpx/vp9/common/vp9_idct.h (revision 290053) |
+++ source/libvpx/vp9/common/vp9_idct.h (working copy) |
@@ -81,6 +81,16 @@ |
static INLINE int dct_const_round_shift(int input) { |
int rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS); |
+#if CONFIG_COEFFICIENT_RANGE_CHECKING |
+ // For valid VP9 input streams, intermediate stage coefficients should always |
+ // stay within the range of a signed 16 bit integer. Coefficients can go out |
+ // of this range for invalid/corrupt VP9 streams. However, strictly checking |
+ // this range for every intermediate coefficient can burdensome for a decoder, |
+ // therefore the following assertion is only enabled when configured with |
+ // --enable-coefficient-range-checking. |
+ assert(INT16_MIN <= rv); |
+ assert(rv <= INT16_MAX); |
+#endif |
return (int16_t)rv; |
} |