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

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

Issue 1546003002: libwebp: update to 0.5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 'defines' exists Created 4 years, 12 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
OLDNEW
1 // Copyright 2011 Google Inc. All Rights Reserved. 1 // Copyright 2011 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 // Coding of token probabilities, intra modes and segments. 10 // Coding of token probabilities, intra modes and segments.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 { 42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128 } 147 { 42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128 }
148 }, 148 },
149 { { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 }, 149 { { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
150 { 244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 }, 150 { 244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
151 { 238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 } 151 { 238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
152 } 152 }
153 } 153 }
154 }; 154 };
155 155
156 void VP8DefaultProbas(VP8Encoder* const enc) { 156 void VP8DefaultProbas(VP8Encoder* const enc) {
157 VP8Proba* const probas = &enc->proba_; 157 VP8EncProba* const probas = &enc->proba_;
158 probas->use_skip_proba_ = 0; 158 probas->use_skip_proba_ = 0;
159 memset(probas->segments_, 255u, sizeof(probas->segments_)); 159 memset(probas->segments_, 255u, sizeof(probas->segments_));
160 memcpy(probas->coeffs_, VP8CoeffsProba0, sizeof(VP8CoeffsProba0)); 160 memcpy(probas->coeffs_, VP8CoeffsProba0, sizeof(VP8CoeffsProba0));
161 // Note: we could hard-code the level_costs_ corresponding to VP8CoeffsProba0, 161 // Note: we could hard-code the level_costs_ corresponding to VP8CoeffsProba0,
162 // but that's ~11k of static data. Better call VP8CalculateLevelCosts() later. 162 // but that's ~11k of static data. Better call VP8CalculateLevelCosts() later.
163 probas->dirty_ = 1; 163 probas->dirty_ = 1;
164 } 164 }
165 165
166 // Paragraph 11.5. 900bytes. 166 // Paragraph 11.5. 900bytes.
167 static const uint8_t kBModesProba[NUM_BMODES][NUM_BMODES][NUM_BMODES - 1] = { 167 static const uint8_t kBModesProba[NUM_BMODES][NUM_BMODES][NUM_BMODES - 1] = {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, 475 { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
476 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } 476 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
477 }, 477 },
478 { { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, 478 { { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
479 { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, 479 { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
480 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } 480 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
481 } 481 }
482 } 482 }
483 }; 483 };
484 484
485 void VP8WriteProbas(VP8BitWriter* const bw, const VP8Proba* const probas) { 485 void VP8WriteProbas(VP8BitWriter* const bw, const VP8EncProba* const probas) {
486 int t, b, c, p; 486 int t, b, c, p;
487 for (t = 0; t < NUM_TYPES; ++t) { 487 for (t = 0; t < NUM_TYPES; ++t) {
488 for (b = 0; b < NUM_BANDS; ++b) { 488 for (b = 0; b < NUM_BANDS; ++b) {
489 for (c = 0; c < NUM_CTX; ++c) { 489 for (c = 0; c < NUM_CTX; ++c) {
490 for (p = 0; p < NUM_PROBAS; ++p) { 490 for (p = 0; p < NUM_PROBAS; ++p) {
491 const uint8_t p0 = probas->coeffs_[t][b][c][p]; 491 const uint8_t p0 = probas->coeffs_[t][b][c][p];
492 const int update = (p0 != VP8CoeffsProba0[t][b][c][p]); 492 const int update = (p0 != VP8CoeffsProba0[t][b][c][p]);
493 if (VP8PutBit(bw, update, VP8CoeffsUpdateProba[t][b][c][p])) { 493 if (VP8PutBit(bw, update, VP8CoeffsUpdateProba[t][b][c][p])) {
494 VP8PutValue(bw, p0, 8); 494 VP8PutBits(bw, p0, 8);
495 } 495 }
496 } 496 }
497 } 497 }
498 } 498 }
499 } 499 }
500 if (VP8PutBitUniform(bw, probas->use_skip_proba_)) { 500 if (VP8PutBitUniform(bw, probas->use_skip_proba_)) {
501 VP8PutValue(bw, probas->skip_proba_, 8); 501 VP8PutBits(bw, probas->skip_proba_, 8);
502 } 502 }
503 } 503 }
504 504
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698