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

Side by Side Diff: third_party/libwebp/yuv.c

Issue 3614010: Add WebP library to Chromium... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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/yuv.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2010 Google Inc.
2 //
3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // -----------------------------------------------------------------------------
7 //
8 // YUV->RGB conversion function
9 //
10 // Author: Skal (pascal.massimino@gmail.com)
11
12 #include "yuv.h"
13
14 #if defined(__cplusplus) || defined(c_plusplus)
15 extern "C" {
16 #endif
17
18 enum { YUV_HALF = 1 << (YUV_FIX - 1) };
19
20 int16_t VP8kVToR[256], VP8kUToB[256];
21 int32_t VP8kVToG[256], VP8kUToG[256];
22 uint8_t VP8kClip[YUV_RANGE_MAX - YUV_RANGE_MIN];
23
24 static int done = 0;
25
26 void VP8YUVInit() {
27 if (done) {
28 return;
29 }
30 for (int i = 0; i < 256; ++i) {
31 VP8kVToR[i] = (89858 * (i - 128) + YUV_HALF) >> YUV_FIX;
32 VP8kUToG[i] = -22014 * (i - 128) + YUV_HALF;
33 VP8kVToG[i] = -45773 * (i - 128);
34 VP8kUToB[i] = (113618 * (i - 128) + YUV_HALF) >> YUV_FIX;
35 }
36 for (int i = YUV_RANGE_MIN; i < YUV_RANGE_MAX; ++i) {
37 const int j = ((i - 16) * 76283 + YUV_HALF) >> YUV_FIX;
38 VP8kClip[i - YUV_RANGE_MIN] = (j < 0) ? 0 : (j > 255) ? 255 : j;
39 }
40 done = 1;
41 }
42
43 #if defined(__cplusplus) || defined(c_plusplus)
44 } // extern "C"
45 #endif
OLDNEW
« no previous file with comments | « third_party/libwebp/yuv.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698