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

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

Issue 2651883004: libwebp-0.6.0-rc1 (Closed)
Patch Set: Created 3 years, 11 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/enc/syntax.c ('k') | third_party/libwebp/enc/token.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 // 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 // Header syntax writing 10 // Header syntax writing
11 // 11 //
12 // Author: Skal (pascal.massimino@gmail.com) 12 // Author: Skal (pascal.massimino@gmail.com)
13 13
14 #include <assert.h> 14 #include <assert.h>
15 15
16 #include "../utils/utils.h" 16 #include "../utils/utils.h"
17 #include "../webp/format_constants.h" // RIFF constants 17 #include "../webp/format_constants.h" // RIFF constants
18 #include "../webp/mux_types.h" // ALPHA_FLAG 18 #include "../webp/mux_types.h" // ALPHA_FLAG
19 #include "./vp8enci.h" 19 #include "./vp8i_enc.h"
20 20
21 //------------------------------------------------------------------------------ 21 //------------------------------------------------------------------------------
22 // Helper functions 22 // Helper functions
23 23
24 static int IsVP8XNeeded(const VP8Encoder* const enc) { 24 static int IsVP8XNeeded(const VP8Encoder* const enc) {
25 return !!enc->has_alpha_; // Currently the only case when VP8X is needed. 25 return !!enc->has_alpha_; // Currently the only case when VP8X is needed.
26 // This could change in the future. 26 // This could change in the future.
27 } 27 }
28 28
29 static int PutPaddingByte(const WebPPicture* const pic) { 29 static int PutPaddingByte(const WebPPicture* const pic) {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 ok = ok && PutWebPHeaders(enc, size0, vp8_size, riff_size) 355 ok = ok && PutWebPHeaders(enc, size0, vp8_size, riff_size)
356 && pic->writer(part0, size0, pic) 356 && pic->writer(part0, size0, pic)
357 && EmitPartitionsSize(enc, pic); 357 && EmitPartitionsSize(enc, pic);
358 VP8BitWriterWipeOut(bw); // will free the internal buffer. 358 VP8BitWriterWipeOut(bw); // will free the internal buffer.
359 } 359 }
360 360
361 // Token partitions 361 // Token partitions
362 for (p = 0; p < enc->num_parts_; ++p) { 362 for (p = 0; p < enc->num_parts_; ++p) {
363 const uint8_t* const buf = VP8BitWriterBuf(enc->parts_ + p); 363 const uint8_t* const buf = VP8BitWriterBuf(enc->parts_ + p);
364 const size_t size = VP8BitWriterSize(enc->parts_ + p); 364 const size_t size = VP8BitWriterSize(enc->parts_ + p);
365 if (size) 365 if (size) ok = ok && pic->writer(buf, size, pic);
366 ok = ok && pic->writer(buf, size, pic);
367 VP8BitWriterWipeOut(enc->parts_ + p); // will free the internal buffer. 366 VP8BitWriterWipeOut(enc->parts_ + p); // will free the internal buffer.
368 ok = ok && WebPReportProgress(pic, enc->percent_ + percent_per_part, 367 ok = ok && WebPReportProgress(pic, enc->percent_ + percent_per_part,
369 &enc->percent_); 368 &enc->percent_);
370 } 369 }
371 370
372 // Padding byte 371 // Padding byte
373 if (ok && pad) { 372 if (ok && pad) {
374 ok = PutPaddingByte(pic); 373 ok = PutPaddingByte(pic);
375 } 374 }
376 375
377 enc->coded_size_ = (int)(CHUNK_HEADER_SIZE + riff_size); 376 enc->coded_size_ = (int)(CHUNK_HEADER_SIZE + riff_size);
378 ok = ok && WebPReportProgress(pic, final_percent, &enc->percent_); 377 ok = ok && WebPReportProgress(pic, final_percent, &enc->percent_);
379 return ok; 378 return ok;
380 } 379 }
381 380
382 //------------------------------------------------------------------------------ 381 //------------------------------------------------------------------------------
383 382
OLDNEW
« no previous file with comments | « third_party/libwebp/enc/syntax.c ('k') | third_party/libwebp/enc/token.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698