Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: third_party/libwebp/dsp/lossless_enc_mips32.c

Issue 2651883004: libwebp-0.6.0-rc1 (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libwebp/dsp/lossless_enc.c ('k') | third_party/libwebp/dsp/lossless_enc_msa.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 Google Inc. All Rights Reserved. 1 // Copyright 2015 Google Inc. All Rights Reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license 3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source 4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may 6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree. 7 // be found in the AUTHORS file in the root of the source tree.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 // 9 //
10 // MIPS version of lossless functions 10 // MIPS version of lossless functions
11 // 11 //
12 // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) 12 // Author(s): Djordje Pesut (djordje.pesut@imgtec.com)
13 // Jovan Zelincevic (jovan.zelincevic@imgtec.com) 13 // Jovan Zelincevic (jovan.zelincevic@imgtec.com)
14 14
15 #include "./dsp.h" 15 #include "./dsp.h"
16 #include "./lossless.h" 16 #include "./lossless.h"
17 #include "./lossless_common.h"
17 18
18 #if defined(WEBP_USE_MIPS32) 19 #if defined(WEBP_USE_MIPS32)
19 20
20 #include <assert.h> 21 #include <assert.h>
21 #include <math.h> 22 #include <math.h>
22 #include <stdlib.h> 23 #include <stdlib.h>
23 #include <string.h> 24 #include <string.h>
24 25
25 static float FastSLog2Slow(uint32_t v) { 26 static float FastSLog2Slow(uint32_t v) {
26 assert(v >= LOG_LOOKUP_IDX_MAX); 27 assert(v >= LOG_LOOKUP_IDX_MAX);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 234 }
234 235
235 // Gather info for the Huffman cost. 236 // Gather info for the Huffman cost.
236 temp0 = (*val_prev != 0); 237 temp0 = (*val_prev != 0);
237 HUFFMAN_COST_PASS 238 HUFFMAN_COST_PASS
238 239
239 *val_prev = val; 240 *val_prev = val;
240 *i_prev = i; 241 *i_prev = i;
241 } 242 }
242 243
244 static void GetEntropyUnrefined(const uint32_t X[], int length,
245 VP8LBitEntropy* const bit_entropy,
246 VP8LStreaks* const stats) {
247 int i;
248 int i_prev = 0;
249 uint32_t x_prev = X[0];
250
251 memset(stats, 0, sizeof(*stats));
252 VP8LBitEntropyInit(bit_entropy);
253
254 for (i = 1; i < length; ++i) {
255 const uint32_t x = X[i];
256 if (x != x_prev) {
257 GetEntropyUnrefinedHelper(x, i, &x_prev, &i_prev, bit_entropy, stats);
258 }
259 }
260 GetEntropyUnrefinedHelper(0, i, &x_prev, &i_prev, bit_entropy, stats);
261
262 bit_entropy->entropy += VP8LFastSLog2(bit_entropy->sum);
263 }
264
265 static void GetCombinedEntropyUnrefined(const uint32_t X[], const uint32_t Y[],
266 int length,
267 VP8LBitEntropy* const bit_entropy,
268 VP8LStreaks* const stats) {
269 int i = 1;
270 int i_prev = 0;
271 uint32_t xy_prev = X[0] + Y[0];
272
273 memset(stats, 0, sizeof(*stats));
274 VP8LBitEntropyInit(bit_entropy);
275
276 for (i = 1; i < length; ++i) {
277 const uint32_t xy = X[i] + Y[i];
278 if (xy != xy_prev) {
279 GetEntropyUnrefinedHelper(xy, i, &xy_prev, &i_prev, bit_entropy, stats);
280 }
281 }
282 GetEntropyUnrefinedHelper(0, i, &xy_prev, &i_prev, bit_entropy, stats);
283
284 bit_entropy->entropy += VP8LFastSLog2(bit_entropy->sum);
285 }
286
243 #define ASM_START \ 287 #define ASM_START \
244 __asm__ volatile( \ 288 __asm__ volatile( \
245 ".set push \n\t" \ 289 ".set push \n\t" \
246 ".set at \n\t" \ 290 ".set at \n\t" \
247 ".set macro \n\t" \ 291 ".set macro \n\t" \
248 "1: \n\t" 292 "1: \n\t"
249 293
250 // P2 = P0 + P1 294 // P2 = P0 + P1
251 // A..D - offsets 295 // A..D - offsets
252 // E - temp variable to tell macro 296 // E - temp variable to tell macro
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 //------------------------------------------------------------------------------ 412 //------------------------------------------------------------------------------
369 // Entry point 413 // Entry point
370 414
371 extern void VP8LEncDspInitMIPS32(void); 415 extern void VP8LEncDspInitMIPS32(void);
372 416
373 WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitMIPS32(void) { 417 WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitMIPS32(void) {
374 VP8LFastSLog2Slow = FastSLog2Slow; 418 VP8LFastSLog2Slow = FastSLog2Slow;
375 VP8LFastLog2Slow = FastLog2Slow; 419 VP8LFastLog2Slow = FastLog2Slow;
376 VP8LExtraCost = ExtraCost; 420 VP8LExtraCost = ExtraCost;
377 VP8LExtraCostCombined = ExtraCostCombined; 421 VP8LExtraCostCombined = ExtraCostCombined;
378 VP8LGetEntropyUnrefinedHelper = GetEntropyUnrefinedHelper; 422 VP8LGetEntropyUnrefined = GetEntropyUnrefined;
423 VP8LGetCombinedEntropyUnrefined = GetCombinedEntropyUnrefined;
379 VP8LHistogramAdd = HistogramAdd; 424 VP8LHistogramAdd = HistogramAdd;
380 } 425 }
381 426
382 #else // !WEBP_USE_MIPS32 427 #else // !WEBP_USE_MIPS32
383 428
384 WEBP_DSP_INIT_STUB(VP8LEncDspInitMIPS32) 429 WEBP_DSP_INIT_STUB(VP8LEncDspInitMIPS32)
385 430
386 #endif // WEBP_USE_MIPS32 431 #endif // WEBP_USE_MIPS32
OLDNEW
« no previous file with comments | « third_party/libwebp/dsp/lossless_enc.c ('k') | third_party/libwebp/dsp/lossless_enc_msa.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698