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

Side by Side Diff: third_party/libwebp/enc/cost.c

Issue 12942006: libwebp: update snapshot to v0.3.0-rc6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « third_party/libwebp/enc/cost.h ('k') | third_party/libwebp/enc/frame.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 2011 Google Inc. All Rights Reserved. 1 // Copyright 2011 Google Inc. All Rights Reserved.
2 // 2 //
3 // This code is licensed under the same terms as WebM: 3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/ 4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // ----------------------------------------------------------------------------- 6 // -----------------------------------------------------------------------------
7 // 7 //
8 // Cost tables for level and modes 8 // Cost tables for level and modes
9 // 9 //
10 // Author: Skal (pascal.massimino@gmail.com) 10 // Author: Skal (pascal.massimino@gmail.com)
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 pattern >>= 1; 347 pattern >>= 1;
348 } 348 }
349 return cost; 349 return cost;
350 } 350 }
351 351
352 //------------------------------------------------------------------------------ 352 //------------------------------------------------------------------------------
353 // Pre-calc level costs once for all 353 // Pre-calc level costs once for all
354 354
355 void VP8CalculateLevelCosts(VP8Proba* const proba) { 355 void VP8CalculateLevelCosts(VP8Proba* const proba) {
356 int ctype, band, ctx; 356 int ctype, band, ctx;
357
358 if (!proba->dirty_) return; // nothing to do.
359
357 for (ctype = 0; ctype < NUM_TYPES; ++ctype) { 360 for (ctype = 0; ctype < NUM_TYPES; ++ctype) {
358 for (band = 0; band < NUM_BANDS; ++band) { 361 for (band = 0; band < NUM_BANDS; ++band) {
359 for(ctx = 0; ctx < NUM_CTX; ++ctx) { 362 for(ctx = 0; ctx < NUM_CTX; ++ctx) {
360 const uint8_t* const p = proba->coeffs_[ctype][band][ctx]; 363 const uint8_t* const p = proba->coeffs_[ctype][band][ctx];
361 uint16_t* const table = proba->level_cost_[ctype][band][ctx]; 364 uint16_t* const table = proba->level_cost_[ctype][band][ctx];
362 const int cost_base = VP8BitCost(1, p[1]); 365 const int cost_base = VP8BitCost(1, p[1]);
363 int v; 366 int v;
364 table[0] = VP8BitCost(0, p[1]); 367 table[0] = VP8BitCost(0, p[1]);
365 for (v = 1; v <= MAX_VARIABLE_LEVEL; ++v) { 368 for (v = 1; v <= MAX_VARIABLE_LEVEL; ++v) {
366 table[v] = cost_base + VariableLevelCost(v, p); 369 table[v] = cost_base + VariableLevelCost(v, p);
367 } 370 }
368 // Starting at level 67 and up, the variable part of the cost is 371 // Starting at level 67 and up, the variable part of the cost is
369 // actually constant. 372 // actually constant.
370 } 373 }
371 } 374 }
372 } 375 }
376 proba->dirty_ = 0;
373 } 377 }
374 378
375 //------------------------------------------------------------------------------ 379 //------------------------------------------------------------------------------
376 // Mode cost tables. 380 // Mode cost tables.
377 381
378 // These are the fixed probabilities (in the coding trees) turned into bit-cost 382 // These are the fixed probabilities (in the coding trees) turned into bit-cost
379 // by calling VP8BitCost(). 383 // by calling VP8BitCost().
380 const uint16_t VP8FixedCostsUV[4] = { 302, 984, 439, 642 }; 384 const uint16_t VP8FixedCostsUV[4] = { 302, 984, 439, 642 };
381 // note: these values include the fixed VP8BitCost(1, 145) mode selection cost. 385 // note: these values include the fixed VP8BitCost(1, 145) mode selection cost.
382 const uint16_t VP8FixedCostsI16[4] = { 663, 919, 872, 919 }; 386 const uint16_t VP8FixedCostsI16[4] = { 663, 919, 872, 919 };
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 { 439, 1139, 1101, 1257, 3710, 1922, 1205, 1040, 1931, 1529 }, 485 { 439, 1139, 1101, 1257, 3710, 1922, 1205, 1040, 1931, 1529 },
482 { 979, 935, 1269, 847, 1202, 1286, 1530, 1535, 827, 1036 }, 486 { 979, 935, 1269, 847, 1202, 1286, 1530, 1535, 827, 1036 },
483 { 516, 1378, 1569, 1110, 1798, 1798, 1198, 2199, 1543, 712 } }, 487 { 516, 1378, 1569, 1110, 1798, 1798, 1198, 2199, 1543, 712 } },
484 }; 488 };
485 489
486 //------------------------------------------------------------------------------ 490 //------------------------------------------------------------------------------
487 491
488 #if defined(__cplusplus) || defined(c_plusplus) 492 #if defined(__cplusplus) || defined(c_plusplus)
489 } // extern "C" 493 } // extern "C"
490 #endif 494 #endif
OLDNEW
« no previous file with comments | « third_party/libwebp/enc/cost.h ('k') | third_party/libwebp/enc/frame.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698