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

Side by Side Diff: third_party/libwebp/dec/io.c

Issue 116213006: Update libwebp to 0.4.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: After Blink Roll Created 6 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 | Annotate | Revision Log
« no previous file with comments | « third_party/libwebp/dec/idec.c ('k') | third_party/libwebp/dec/layer.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 // functions for sample output. 10 // functions for sample output.
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 #include <stdlib.h> 15 #include <stdlib.h>
16 #include "../dec/vp8i.h" 16 #include "../dec/vp8i.h"
17 #include "./webpi.h" 17 #include "./webpi.h"
18 #include "../dsp/dsp.h" 18 #include "../dsp/dsp.h"
19 #include "../dsp/yuv.h" 19 #include "../dsp/yuv.h"
20 20
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24
25 //------------------------------------------------------------------------------ 21 //------------------------------------------------------------------------------
26 // Main YUV<->RGB conversion functions 22 // Main YUV<->RGB conversion functions
27 23
28 static int EmitYUV(const VP8Io* const io, WebPDecParams* const p) { 24 static int EmitYUV(const VP8Io* const io, WebPDecParams* const p) {
29 WebPDecBuffer* output = p->output; 25 WebPDecBuffer* output = p->output;
30 const WebPYUVABuffer* const buf = &output->u.YUVA; 26 const WebPYUVABuffer* const buf = &output->u.YUVA;
31 uint8_t* const y_dst = buf->y + io->mb_y * buf->y_stride; 27 uint8_t* const y_dst = buf->y + io->mb_y * buf->y_stride;
32 uint8_t* const u_dst = buf->u + (io->mb_y >> 1) * buf->u_stride; 28 uint8_t* const u_dst = buf->u + (io->mb_y >> 1) * buf->u_stride;
33 uint8_t* const v_dst = buf->v + (io->mb_y >> 1) * buf->v_stride; 29 uint8_t* const v_dst = buf->v + (io->mb_y >> 1) * buf->v_stride;
34 const int mb_w = io->mb_w; 30 const int mb_w = io->mb_w;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 const uint8_t* cur_v = io->v; 108 const uint8_t* cur_v = io->v;
113 const uint8_t* top_u = p->tmp_u; 109 const uint8_t* top_u = p->tmp_u;
114 const uint8_t* top_v = p->tmp_v; 110 const uint8_t* top_v = p->tmp_v;
115 int y = io->mb_y; 111 int y = io->mb_y;
116 const int y_end = io->mb_y + io->mb_h; 112 const int y_end = io->mb_y + io->mb_h;
117 const int mb_w = io->mb_w; 113 const int mb_w = io->mb_w;
118 const int uv_w = (mb_w + 1) / 2; 114 const int uv_w = (mb_w + 1) / 2;
119 115
120 if (y == 0) { 116 if (y == 0) {
121 // First line is special cased. We mirror the u/v samples at boundary. 117 // First line is special cased. We mirror the u/v samples at boundary.
122 upsample(NULL, cur_y, cur_u, cur_v, cur_u, cur_v, NULL, dst, mb_w); 118 upsample(cur_y, NULL, cur_u, cur_v, cur_u, cur_v, dst, NULL, mb_w);
123 } else { 119 } else {
124 // We can finish the left-over line from previous call. 120 // We can finish the left-over line from previous call.
125 upsample(p->tmp_y, cur_y, top_u, top_v, cur_u, cur_v, 121 upsample(p->tmp_y, cur_y, top_u, top_v, cur_u, cur_v,
126 dst - buf->stride, dst, mb_w); 122 dst - buf->stride, dst, mb_w);
127 ++num_lines_out; 123 ++num_lines_out;
128 } 124 }
129 // Loop over each output pairs of row. 125 // Loop over each output pairs of row.
130 for (; y + 2 < y_end; y += 2) { 126 for (; y + 2 < y_end; y += 2) {
131 top_u = cur_u; 127 top_u = cur_u;
132 top_v = cur_v; 128 top_v = cur_v;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 WebPDecParams* const p = (WebPDecParams*)io->opaque; 592 WebPDecParams* const p = (WebPDecParams*)io->opaque;
597 const int mb_w = io->mb_w; 593 const int mb_w = io->mb_w;
598 const int mb_h = io->mb_h; 594 const int mb_h = io->mb_h;
599 int num_lines_out; 595 int num_lines_out;
600 assert(!(io->mb_y & 1)); 596 assert(!(io->mb_y & 1));
601 597
602 if (mb_w <= 0 || mb_h <= 0) { 598 if (mb_w <= 0 || mb_h <= 0) {
603 return 0; 599 return 0;
604 } 600 }
605 num_lines_out = p->emit(io, p); 601 num_lines_out = p->emit(io, p);
606 if (p->emit_alpha) { 602 if (p->emit_alpha != NULL) {
607 p->emit_alpha(io, p); 603 p->emit_alpha(io, p);
608 } 604 }
609 p->last_y += num_lines_out; 605 p->last_y += num_lines_out;
610 return 1; 606 return 1;
611 } 607 }
612 608
613 //------------------------------------------------------------------------------ 609 //------------------------------------------------------------------------------
614 610
615 static void CustomTeardown(const VP8Io* io) { 611 static void CustomTeardown(const VP8Io* io) {
616 WebPDecParams* const p = (WebPDecParams*)io->opaque; 612 WebPDecParams* const p = (WebPDecParams*)io->opaque;
617 free(p->memory); 613 free(p->memory);
618 p->memory = NULL; 614 p->memory = NULL;
619 } 615 }
620 616
621 //------------------------------------------------------------------------------ 617 //------------------------------------------------------------------------------
622 // Main entry point 618 // Main entry point
623 619
624 void WebPInitCustomIo(WebPDecParams* const params, VP8Io* const io) { 620 void WebPInitCustomIo(WebPDecParams* const params, VP8Io* const io) {
625 io->put = CustomPut; 621 io->put = CustomPut;
626 io->setup = CustomSetup; 622 io->setup = CustomSetup;
627 io->teardown = CustomTeardown; 623 io->teardown = CustomTeardown;
628 io->opaque = params; 624 io->opaque = params;
629 } 625 }
630 626
631 //------------------------------------------------------------------------------ 627 //------------------------------------------------------------------------------
632 628
633 #if defined(__cplusplus) || defined(c_plusplus)
634 } // extern "C"
635 #endif
OLDNEW
« no previous file with comments | « third_party/libwebp/dec/idec.c ('k') | third_party/libwebp/dec/layer.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698