From 08ad7e4db57ab5be05a5304ad518c0886e18ad17 Mon Sep 17 00:00:00 2001 From: Johann Date: Thu, 20 Nov 2014 13:24:55 -0800 Subject: [PATCH] Correctly initialize "ones" value in neon quantize By using 0xff for a short it was not setting the high bits. When comparing the output with vtst to find non-zero elements it was skipping vaules which had no low bits set such as -512 / 0xFE00. Using -8191 as the first element of coeff will generate this condition. BUG=883 Change-Id: Ia1e10fb809d1e7866f28c56769fe703e6231a657 --- test/quantize_test.cc | 8 ++++++++ vp8/encoder/arm/neon/fastquantizeb_neon.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/test/quantize_test.cc b/test/quantize_test.cc index 756d0f6..329227b 100644 --- a/test/quantize_test.cc +++ b/test/quantize_test.cc @@ -147,6 +147,14 @@ TEST_P(QuantizeTest, TestZeroInput) { RunComparison(); } +TEST_P(QuantizeTest, TestLargeNegativeInput) { + FillCoeffConstant(0); + // Generate a qcoeff which contains 512/-512 (0x0100/0xFE00) to catch issues + // like BUG=883 where the constant being compared was incorrectly initialized. + vp8_comp_->mb.coeff[0] = -8191; + RunComparison(); +} + TEST_P(QuantizeTest, TestRandomInput) { FillCoeffRandom(); RunComparison(); diff --git a/vp8/encoder/arm/neon/fastquantizeb_neon.c b/vp8/encoder/arm/neon/fastquantizeb_neon.c index caa7637..e5824bf 100644 --- a/vp8/encoder/arm/neon/fastquantizeb_neon.c +++ b/vp8/encoder/arm/neon/fastquantizeb_neon.c @@ -19,7 +19,7 @@ static const uint16_t inv_zig_zag[16] = { }; void vp8_fast_quantize_b_neon(BLOCK *b, BLOCKD *d) { - const int16x8_t one_q = vdupq_n_s16(0xff), + const int16x8_t one_q = vdupq_n_s16(-1), z0 = vld1q_s16(b->coeff), z1 = vld1q_s16(b->coeff + 8), round0 = vld1q_s16(b->round), -- 2.7.4