diff options
author | jzern@chromium.org <jzern@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-26 08:22:07 +0000 |
---|---|---|
committer | jzern@chromium.org <jzern@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-26 08:22:07 +0000 |
commit | 3716d71d6d241352dd0ff57746697b3bd1f1bb29 (patch) | |
tree | 1ec5efdcfc06f89d375c773849288b13dfb4d747 /third_party/libwebp/dsp | |
parent | c10f8536810abc39a9e4a5d93d65b262362734c6 (diff) | |
download | chromium_src-3716d71d6d241352dd0ff57746697b3bd1f1bb29.zip chromium_src-3716d71d6d241352dd0ff57746697b3bd1f1bb29.tar.gz chromium_src-3716d71d6d241352dd0ff57746697b3bd1f1bb29.tar.bz2 |
libwebp: rollup from v0.3.0-rc6..v0.3.0
Additonally cherry picks a change from master:
94328d6 Demux: Fix a potential memleak
This avoids a leak when parsing an improperly formatted animation file.
BUG=
TBR=cpu
Review URL: https://chromiumcodereview.appspot.com/13825013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libwebp/dsp')
-rw-r--r-- | third_party/libwebp/dsp/dec_neon.c | 6 | ||||
-rw-r--r-- | third_party/libwebp/dsp/enc.c | 4 | ||||
-rw-r--r-- | third_party/libwebp/dsp/enc_neon.c | 4 | ||||
-rw-r--r-- | third_party/libwebp/dsp/enc_sse2.c | 11 | ||||
-rw-r--r-- | third_party/libwebp/dsp/upsampling.c | 2 |
5 files changed, 14 insertions, 13 deletions
diff --git a/third_party/libwebp/dsp/dec_neon.c b/third_party/libwebp/dsp/dec_neon.c index 5d7cff1..5aff0d3 100644 --- a/third_party/libwebp/dsp/dec_neon.c +++ b/third_party/libwebp/dsp/dec_neon.c @@ -79,7 +79,7 @@ extern "C" { "vld4.8 {" #c1"[6], " #c2"[6], " #c3"[6], " #c4"[6]}," #b1 "," #stride"\n" \ "vld4.8 {" #c1"[7], " #c2"[7], " #c3"[7], " #c4"[7]}," #b2 "," #stride"\n" -#define STORE8x2(c1, c2, p,stride) \ +#define STORE8x2(c1, c2, p, stride) \ "vst2.8 {" #c1"[0], " #c2"[0]}," #p "," #stride " \n" \ "vst2.8 {" #c1"[1], " #c2"[1]}," #p "," #stride " \n" \ "vst2.8 {" #c1"[2], " #c2"[2]}," #p "," #stride " \n" \ @@ -315,8 +315,8 @@ static void TransformTwoNEON(const int16_t* in, uint8_t* dst, int do_two) { } static void TransformWHT(const int16_t* in, int16_t* out) { - const int kStep = 32; // The store is only incrementing the pointer as if we - // had stored a single byte. + const int kStep = 32; // The store is only incrementing the pointer as if we + // had stored a single byte. __asm__ volatile ( // part 1 // load data into q0, q1 diff --git a/third_party/libwebp/dsp/enc.c b/third_party/libwebp/dsp/enc.c index ae2c830..a6f05a5 100644 --- a/third_party/libwebp/dsp/enc.c +++ b/third_party/libwebp/dsp/enc.c @@ -631,13 +631,13 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16], for (; n < 16; ++n) { const int j = kZigzag[n]; const int sign = (in[j] < 0); - int coeff = (sign ? -in[j] : in[j]) + mtx->sharpen_[j]; - if (coeff > 2047) coeff = 2047; + const int coeff = (sign ? -in[j] : in[j]) + mtx->sharpen_[j]; if (coeff > mtx->zthresh_[j]) { const int Q = mtx->q_[j]; const int iQ = mtx->iq_[j]; const int B = mtx->bias_[j]; out[n] = QUANTDIV(coeff, iQ, B); + if (out[n] > MAX_LEVEL) out[n] = MAX_LEVEL; if (sign) out[n] = -out[n]; in[j] = out[n] * Q; if (out[n]) last = n; diff --git a/third_party/libwebp/dsp/enc_neon.c b/third_party/libwebp/dsp/enc_neon.c index b5a1fba..06b6b09 100644 --- a/third_party/libwebp/dsp/enc_neon.c +++ b/third_party/libwebp/dsp/enc_neon.c @@ -149,8 +149,8 @@ static void ITransform(const uint8_t* ref, // Same code as dec_neon.c static void ITransformWHT(const int16_t* in, int16_t* out) { - const int kStep = 32; // The store is only incrementing the pointer as if we - // had stored a single byte. + const int kStep = 32; // The store is only incrementing the pointer as if we + // had stored a single byte. __asm__ volatile ( // part 1 // load data into q0, q1 diff --git a/third_party/libwebp/dsp/enc_sse2.c b/third_party/libwebp/dsp/enc_sse2.c index c4148b5..619e6c5 100644 --- a/third_party/libwebp/dsp/enc_sse2.c +++ b/third_party/libwebp/dsp/enc_sse2.c @@ -776,7 +776,7 @@ static int Disto16x16SSE2(const uint8_t* const a, const uint8_t* const b, // Simple quantization static int QuantizeBlockSSE2(int16_t in[16], int16_t out[16], int n, const VP8Matrix* const mtx) { - const __m128i max_coeff_2047 = _mm_set1_epi16(2047); + const __m128i max_coeff_2047 = _mm_set1_epi16(MAX_LEVEL); const __m128i zero = _mm_setzero_si128(); __m128i coeff0, coeff8; __m128i out0, out8; @@ -812,10 +812,6 @@ static int QuantizeBlockSSE2(int16_t in[16], int16_t out[16], coeff0 = _mm_add_epi16(coeff0, sharpen0); coeff8 = _mm_add_epi16(coeff8, sharpen8); - // if (coeff > 2047) coeff = 2047 - coeff0 = _mm_min_epi16(coeff0, max_coeff_2047); - coeff8 = _mm_min_epi16(coeff8, max_coeff_2047); - // out = (coeff * iQ + B) >> QFIX; { // doing calculations with 32b precision (QFIX=17) @@ -843,9 +839,14 @@ static int QuantizeBlockSSE2(int16_t in[16], int16_t out[16], out_04 = _mm_srai_epi32(out_04, QFIX); out_08 = _mm_srai_epi32(out_08, QFIX); out_12 = _mm_srai_epi32(out_12, QFIX); + // pack result as 16b out0 = _mm_packs_epi32(out_00, out_04); out8 = _mm_packs_epi32(out_08, out_12); + + // if (coeff > 2047) coeff = 2047 + out0 = _mm_min_epi16(out0, max_coeff_2047); + out8 = _mm_min_epi16(out8, max_coeff_2047); } // get sign back (if (sign[j]) out_n = -out_n) diff --git a/third_party/libwebp/dsp/upsampling.c b/third_party/libwebp/dsp/upsampling.c index 91d939c..aea4964 100644 --- a/third_party/libwebp/dsp/upsampling.c +++ b/third_party/libwebp/dsp/upsampling.c @@ -32,7 +32,7 @@ WebPUpsampleLinePairFunc WebPUpsamplers[MODE_LAST]; // ([3*a + b + 9*c + 3*d a + 3*b + 3*c + 9*d] [8 8]) / 16 // We process u and v together stashed into 32bit (16bit each). -#define LOAD_UV(u,v) ((u) | ((v) << 16)) +#define LOAD_UV(u, v) ((u) | ((v) << 16)) #define UPSAMPLE_FUNC(FUNC_NAME, FUNC, XSTEP) \ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ |