/src/libwebp/src/dsp/yuv.h
Line | Count | Source |
1 | | // Copyright 2010 Google Inc. All Rights Reserved. |
2 | | // |
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 |
5 | | // tree. An additional intellectual property rights grant can be found |
6 | | // in the file PATENTS. All contributing project authors may |
7 | | // be found in the AUTHORS file in the root of the source tree. |
8 | | // ----------------------------------------------------------------------------- |
9 | | // |
10 | | // inline YUV<->RGB conversion function |
11 | | // |
12 | | // The exact naming is Y'CbCr, following the ITU-R BT.601 standard. |
13 | | // More information at: https://en.wikipedia.org/wiki/YCbCr |
14 | | // Y = 0.2568 * R + 0.5041 * G + 0.0979 * B + 16 |
15 | | // U = -0.1482 * R - 0.2910 * G + 0.4392 * B + 128 |
16 | | // V = 0.4392 * R - 0.3678 * G - 0.0714 * B + 128 |
17 | | // We use 16bit fixed point operations for RGB->YUV conversion (YUV_FIX). |
18 | | // |
19 | | // For the Y'CbCr to RGB conversion, the BT.601 specification reads: |
20 | | // R = 1.164 * (Y-16) + 1.596 * (V-128) |
21 | | // G = 1.164 * (Y-16) - 0.813 * (V-128) - 0.392 * (U-128) |
22 | | // B = 1.164 * (Y-16) + 2.017 * (U-128) |
23 | | // where Y is in the [16,235] range, and U/V in the [16,240] range. |
24 | | // |
25 | | // The fixed-point implementation used here is: |
26 | | // R = (19077 . y + 26149 . v - 14234) >> 6 |
27 | | // G = (19077 . y - 6419 . u - 13320 . v + 8708) >> 6 |
28 | | // B = (19077 . y + 33050 . u - 17685) >> 6 |
29 | | // where the '.' operator is the mulhi_epu16 variant: |
30 | | // a . b = ((a << 8) * b) >> 16 |
31 | | // that preserves 8 bits of fractional precision before final descaling. |
32 | | |
33 | | // Author: Skal (pascal.massimino@gmail.com) |
34 | | |
35 | | #ifndef WEBP_DSP_YUV_H_ |
36 | | #define WEBP_DSP_YUV_H_ |
37 | | |
38 | | #include "src/dec/vp8_dec.h" |
39 | | #include "src/dsp/cpu.h" |
40 | | #include "src/dsp/dsp.h" |
41 | | #include "src/webp/types.h" |
42 | | |
43 | | WEBP_ASSUME_UNSAFE_INDEXABLE_ABI |
44 | | |
45 | | // Macros to give the offset of each channel in a uint32_t containing ARGB. |
46 | | #ifdef WORDS_BIGENDIAN |
47 | | // uint32_t 0xff000000 is 0xff,00,00,00 in memory |
48 | | #define CHANNEL_OFFSET(i) (i) |
49 | | #else |
50 | | // uint32_t 0xff000000 is 0x00,00,00,ff in memory |
51 | 0 | #define CHANNEL_OFFSET(i) (3 - (i)) |
52 | | #endif |
53 | | |
54 | | //------------------------------------------------------------------------------ |
55 | | // YUV -> RGB conversion |
56 | | |
57 | | #ifdef __cplusplus |
58 | | extern "C" { |
59 | | #endif |
60 | | |
61 | | enum { |
62 | | YUV_FIX = 16, // fixed-point precision for RGB->YUV |
63 | | YUV_HALF = 1 << (YUV_FIX - 1), |
64 | | |
65 | | YUV_FIX2 = 6, // fixed-point precision for YUV->RGB |
66 | | YUV_MASK2 = (256 << YUV_FIX2) - 1 |
67 | | }; |
68 | | |
69 | | //------------------------------------------------------------------------------ |
70 | | // slower on x86 by ~7-8%, but bit-exact with the SSE2/NEON version |
71 | | |
72 | 2.60M | static WEBP_INLINE int MultHi(int v, int coeff) { // _mm_mulhi_epu16 emulation |
73 | 2.60M | return (v * coeff) >> 8; |
74 | 2.60M | } Unexecuted instantiation: io_dec.c:MultHi Unexecuted instantiation: vp8l_dec.c:MultHi Unexecuted instantiation: upsampling.c:MultHi Unexecuted instantiation: yuv.c:MultHi Line | Count | Source | 72 | 2.60M | static WEBP_INLINE int MultHi(int v, int coeff) { // _mm_mulhi_epu16 emulation | 73 | 2.60M | return (v * coeff) >> 8; | 74 | 2.60M | } |
Unexecuted instantiation: yuv_sse2.c:MultHi Unexecuted instantiation: upsampling_sse41.c:MultHi Unexecuted instantiation: yuv_sse41.c:MultHi Unexecuted instantiation: picture_csp_enc.c:MultHi Unexecuted instantiation: picture_tools_enc.c:MultHi |
75 | | |
76 | 1.11M | static WEBP_INLINE int VP8Clip8(int v) { |
77 | 1.11M | return ((v & ~YUV_MASK2) == 0) ? (v >> YUV_FIX2) : (v < 0) ? 0 : 255; |
78 | 1.11M | } Unexecuted instantiation: io_dec.c:VP8Clip8 Unexecuted instantiation: vp8l_dec.c:VP8Clip8 Unexecuted instantiation: upsampling.c:VP8Clip8 Unexecuted instantiation: yuv.c:VP8Clip8 upsampling_sse2.c:VP8Clip8 Line | Count | Source | 76 | 1.11M | static WEBP_INLINE int VP8Clip8(int v) { | 77 | 1.11M | return ((v & ~YUV_MASK2) == 0) ? (v >> YUV_FIX2) : (v < 0) ? 0 : 255; | 78 | 1.11M | } |
Unexecuted instantiation: yuv_sse2.c:VP8Clip8 Unexecuted instantiation: upsampling_sse41.c:VP8Clip8 Unexecuted instantiation: yuv_sse41.c:VP8Clip8 Unexecuted instantiation: picture_csp_enc.c:VP8Clip8 Unexecuted instantiation: picture_tools_enc.c:VP8Clip8 |
79 | | |
80 | 372k | static WEBP_INLINE int VP8YUVToR(int y, int v) { |
81 | 372k | return VP8Clip8(MultHi(y, 19077) + MultHi(v, 26149) - 14234); |
82 | 372k | } Unexecuted instantiation: io_dec.c:VP8YUVToR Unexecuted instantiation: vp8l_dec.c:VP8YUVToR Unexecuted instantiation: upsampling.c:VP8YUVToR Unexecuted instantiation: yuv.c:VP8YUVToR upsampling_sse2.c:VP8YUVToR Line | Count | Source | 80 | 372k | static WEBP_INLINE int VP8YUVToR(int y, int v) { | 81 | 372k | return VP8Clip8(MultHi(y, 19077) + MultHi(v, 26149) - 14234); | 82 | 372k | } |
Unexecuted instantiation: yuv_sse2.c:VP8YUVToR Unexecuted instantiation: upsampling_sse41.c:VP8YUVToR Unexecuted instantiation: yuv_sse41.c:VP8YUVToR Unexecuted instantiation: picture_csp_enc.c:VP8YUVToR Unexecuted instantiation: picture_tools_enc.c:VP8YUVToR |
83 | | |
84 | 372k | static WEBP_INLINE int VP8YUVToG(int y, int u, int v) { |
85 | 372k | return VP8Clip8(MultHi(y, 19077) - MultHi(u, 6419) - MultHi(v, 13320) + 8708); |
86 | 372k | } Unexecuted instantiation: io_dec.c:VP8YUVToG Unexecuted instantiation: vp8l_dec.c:VP8YUVToG Unexecuted instantiation: upsampling.c:VP8YUVToG Unexecuted instantiation: yuv.c:VP8YUVToG upsampling_sse2.c:VP8YUVToG Line | Count | Source | 84 | 372k | static WEBP_INLINE int VP8YUVToG(int y, int u, int v) { | 85 | 372k | return VP8Clip8(MultHi(y, 19077) - MultHi(u, 6419) - MultHi(v, 13320) + 8708); | 86 | 372k | } |
Unexecuted instantiation: yuv_sse2.c:VP8YUVToG Unexecuted instantiation: upsampling_sse41.c:VP8YUVToG Unexecuted instantiation: yuv_sse41.c:VP8YUVToG Unexecuted instantiation: picture_csp_enc.c:VP8YUVToG Unexecuted instantiation: picture_tools_enc.c:VP8YUVToG |
87 | | |
88 | 372k | static WEBP_INLINE int VP8YUVToB(int y, int u) { |
89 | 372k | return VP8Clip8(MultHi(y, 19077) + MultHi(u, 33050) - 17685); |
90 | 372k | } Unexecuted instantiation: io_dec.c:VP8YUVToB Unexecuted instantiation: vp8l_dec.c:VP8YUVToB Unexecuted instantiation: upsampling.c:VP8YUVToB Unexecuted instantiation: yuv.c:VP8YUVToB upsampling_sse2.c:VP8YUVToB Line | Count | Source | 88 | 372k | static WEBP_INLINE int VP8YUVToB(int y, int u) { | 89 | 372k | return VP8Clip8(MultHi(y, 19077) + MultHi(u, 33050) - 17685); | 90 | 372k | } |
Unexecuted instantiation: yuv_sse2.c:VP8YUVToB Unexecuted instantiation: upsampling_sse41.c:VP8YUVToB Unexecuted instantiation: yuv_sse41.c:VP8YUVToB Unexecuted instantiation: picture_csp_enc.c:VP8YUVToB Unexecuted instantiation: picture_tools_enc.c:VP8YUVToB |
91 | | |
92 | 372k | static WEBP_INLINE void VP8YuvToRgb(int y, int u, int v, uint8_t* const rgb) { |
93 | 372k | rgb[0] = VP8YUVToR(y, v); |
94 | 372k | rgb[1] = VP8YUVToG(y, u, v); |
95 | 372k | rgb[2] = VP8YUVToB(y, u); |
96 | 372k | } Unexecuted instantiation: io_dec.c:VP8YuvToRgb Unexecuted instantiation: vp8l_dec.c:VP8YuvToRgb Unexecuted instantiation: upsampling.c:VP8YuvToRgb Unexecuted instantiation: yuv.c:VP8YuvToRgb upsampling_sse2.c:VP8YuvToRgb Line | Count | Source | 92 | 372k | static WEBP_INLINE void VP8YuvToRgb(int y, int u, int v, uint8_t* const rgb) { | 93 | 372k | rgb[0] = VP8YUVToR(y, v); | 94 | 372k | rgb[1] = VP8YUVToG(y, u, v); | 95 | 372k | rgb[2] = VP8YUVToB(y, u); | 96 | 372k | } |
Unexecuted instantiation: yuv_sse2.c:VP8YuvToRgb Unexecuted instantiation: upsampling_sse41.c:VP8YuvToRgb Unexecuted instantiation: yuv_sse41.c:VP8YuvToRgb Unexecuted instantiation: picture_csp_enc.c:VP8YuvToRgb Unexecuted instantiation: picture_tools_enc.c:VP8YuvToRgb |
97 | | |
98 | 0 | static WEBP_INLINE void VP8YuvToBgr(int y, int u, int v, uint8_t* const bgr) { |
99 | 0 | bgr[0] = VP8YUVToB(y, u); |
100 | 0 | bgr[1] = VP8YUVToG(y, u, v); |
101 | 0 | bgr[2] = VP8YUVToR(y, v); |
102 | 0 | } Unexecuted instantiation: io_dec.c:VP8YuvToBgr Unexecuted instantiation: vp8l_dec.c:VP8YuvToBgr Unexecuted instantiation: upsampling.c:VP8YuvToBgr Unexecuted instantiation: yuv.c:VP8YuvToBgr Unexecuted instantiation: upsampling_sse2.c:VP8YuvToBgr Unexecuted instantiation: yuv_sse2.c:VP8YuvToBgr Unexecuted instantiation: upsampling_sse41.c:VP8YuvToBgr Unexecuted instantiation: yuv_sse41.c:VP8YuvToBgr Unexecuted instantiation: picture_csp_enc.c:VP8YuvToBgr Unexecuted instantiation: picture_tools_enc.c:VP8YuvToBgr |
103 | | |
104 | | static WEBP_INLINE void VP8YuvToRgb565(int y, int u, int v, |
105 | 0 | uint8_t* const rgb) { |
106 | 0 | const int r = VP8YUVToR(y, v); // 5 usable bits |
107 | 0 | const int g = VP8YUVToG(y, u, v); // 6 usable bits |
108 | 0 | const int b = VP8YUVToB(y, u); // 5 usable bits |
109 | 0 | const int rg = (r & 0xf8) | (g >> 5); |
110 | 0 | const int gb = ((g << 3) & 0xe0) | (b >> 3); |
111 | | #if (WEBP_SWAP_16BIT_CSP == 1) |
112 | | rgb[0] = gb; |
113 | | rgb[1] = rg; |
114 | | #else |
115 | 0 | rgb[0] = rg; |
116 | 0 | rgb[1] = gb; |
117 | 0 | #endif |
118 | 0 | } Unexecuted instantiation: io_dec.c:VP8YuvToRgb565 Unexecuted instantiation: vp8l_dec.c:VP8YuvToRgb565 Unexecuted instantiation: upsampling.c:VP8YuvToRgb565 Unexecuted instantiation: yuv.c:VP8YuvToRgb565 Unexecuted instantiation: upsampling_sse2.c:VP8YuvToRgb565 Unexecuted instantiation: yuv_sse2.c:VP8YuvToRgb565 Unexecuted instantiation: upsampling_sse41.c:VP8YuvToRgb565 Unexecuted instantiation: yuv_sse41.c:VP8YuvToRgb565 Unexecuted instantiation: picture_csp_enc.c:VP8YuvToRgb565 Unexecuted instantiation: picture_tools_enc.c:VP8YuvToRgb565 |
119 | | |
120 | | static WEBP_INLINE void VP8YuvToRgba4444(int y, int u, int v, |
121 | 0 | uint8_t* const argb) { |
122 | 0 | const int r = VP8YUVToR(y, v); // 4 usable bits |
123 | 0 | const int g = VP8YUVToG(y, u, v); // 4 usable bits |
124 | 0 | const int b = VP8YUVToB(y, u); // 4 usable bits |
125 | 0 | const int rg = (r & 0xf0) | (g >> 4); |
126 | 0 | const int ba = (b & 0xf0) | 0x0f; // overwrite the lower 4 bits |
127 | | #if (WEBP_SWAP_16BIT_CSP == 1) |
128 | | argb[0] = ba; |
129 | | argb[1] = rg; |
130 | | #else |
131 | 0 | argb[0] = rg; |
132 | 0 | argb[1] = ba; |
133 | 0 | #endif |
134 | 0 | } Unexecuted instantiation: io_dec.c:VP8YuvToRgba4444 Unexecuted instantiation: vp8l_dec.c:VP8YuvToRgba4444 Unexecuted instantiation: upsampling.c:VP8YuvToRgba4444 Unexecuted instantiation: yuv.c:VP8YuvToRgba4444 Unexecuted instantiation: upsampling_sse2.c:VP8YuvToRgba4444 Unexecuted instantiation: yuv_sse2.c:VP8YuvToRgba4444 Unexecuted instantiation: upsampling_sse41.c:VP8YuvToRgba4444 Unexecuted instantiation: yuv_sse41.c:VP8YuvToRgba4444 Unexecuted instantiation: picture_csp_enc.c:VP8YuvToRgba4444 Unexecuted instantiation: picture_tools_enc.c:VP8YuvToRgba4444 |
135 | | |
136 | | //----------------------------------------------------------------------------- |
137 | | // Alpha handling variants |
138 | | |
139 | | static WEBP_INLINE void VP8YuvToArgb(uint8_t y, uint8_t u, uint8_t v, |
140 | 0 | uint8_t* const argb) { |
141 | 0 | argb[0] = 0xff; |
142 | 0 | VP8YuvToRgb(y, u, v, argb + 1); |
143 | 0 | } Unexecuted instantiation: io_dec.c:VP8YuvToArgb Unexecuted instantiation: vp8l_dec.c:VP8YuvToArgb Unexecuted instantiation: upsampling.c:VP8YuvToArgb Unexecuted instantiation: yuv.c:VP8YuvToArgb Unexecuted instantiation: upsampling_sse2.c:VP8YuvToArgb Unexecuted instantiation: yuv_sse2.c:VP8YuvToArgb Unexecuted instantiation: upsampling_sse41.c:VP8YuvToArgb Unexecuted instantiation: yuv_sse41.c:VP8YuvToArgb Unexecuted instantiation: picture_csp_enc.c:VP8YuvToArgb Unexecuted instantiation: picture_tools_enc.c:VP8YuvToArgb |
144 | | |
145 | | static WEBP_INLINE void VP8YuvToBgra(uint8_t y, uint8_t u, uint8_t v, |
146 | 0 | uint8_t* const bgra) { |
147 | 0 | VP8YuvToBgr(y, u, v, bgra); |
148 | 0 | bgra[3] = 0xff; |
149 | 0 | } Unexecuted instantiation: io_dec.c:VP8YuvToBgra Unexecuted instantiation: vp8l_dec.c:VP8YuvToBgra Unexecuted instantiation: upsampling.c:VP8YuvToBgra Unexecuted instantiation: yuv.c:VP8YuvToBgra Unexecuted instantiation: upsampling_sse2.c:VP8YuvToBgra Unexecuted instantiation: yuv_sse2.c:VP8YuvToBgra Unexecuted instantiation: upsampling_sse41.c:VP8YuvToBgra Unexecuted instantiation: yuv_sse41.c:VP8YuvToBgra Unexecuted instantiation: picture_csp_enc.c:VP8YuvToBgra Unexecuted instantiation: picture_tools_enc.c:VP8YuvToBgra |
150 | | |
151 | | static WEBP_INLINE void VP8YuvToRgba(uint8_t y, uint8_t u, uint8_t v, |
152 | 372k | uint8_t* const rgba) { |
153 | 372k | VP8YuvToRgb(y, u, v, rgba); |
154 | 372k | rgba[3] = 0xff; |
155 | 372k | } Unexecuted instantiation: io_dec.c:VP8YuvToRgba Unexecuted instantiation: vp8l_dec.c:VP8YuvToRgba Unexecuted instantiation: upsampling.c:VP8YuvToRgba Unexecuted instantiation: yuv.c:VP8YuvToRgba upsampling_sse2.c:VP8YuvToRgba Line | Count | Source | 152 | 372k | uint8_t* const rgba) { | 153 | 372k | VP8YuvToRgb(y, u, v, rgba); | 154 | 372k | rgba[3] = 0xff; | 155 | 372k | } |
Unexecuted instantiation: yuv_sse2.c:VP8YuvToRgba Unexecuted instantiation: upsampling_sse41.c:VP8YuvToRgba Unexecuted instantiation: yuv_sse41.c:VP8YuvToRgba Unexecuted instantiation: picture_csp_enc.c:VP8YuvToRgba Unexecuted instantiation: picture_tools_enc.c:VP8YuvToRgba |
156 | | |
157 | | //----------------------------------------------------------------------------- |
158 | | // SSE2 extra functions (mostly for upsampling_sse2.c) |
159 | | |
160 | | #if defined(WEBP_USE_SSE2) |
161 | | |
162 | | // Process 32 pixels and store the result (16b, 24b or 32b per pixel) in *dst. |
163 | | void VP8YuvToRgba32_SSE2(const uint8_t* WEBP_RESTRICT y, |
164 | | const uint8_t* WEBP_RESTRICT u, |
165 | | const uint8_t* WEBP_RESTRICT v, |
166 | | uint8_t* WEBP_RESTRICT dst); |
167 | | void VP8YuvToRgb32_SSE2(const uint8_t* WEBP_RESTRICT y, |
168 | | const uint8_t* WEBP_RESTRICT u, |
169 | | const uint8_t* WEBP_RESTRICT v, |
170 | | uint8_t* WEBP_RESTRICT dst); |
171 | | void VP8YuvToBgra32_SSE2(const uint8_t* WEBP_RESTRICT y, |
172 | | const uint8_t* WEBP_RESTRICT u, |
173 | | const uint8_t* WEBP_RESTRICT v, |
174 | | uint8_t* WEBP_RESTRICT dst); |
175 | | void VP8YuvToBgr32_SSE2(const uint8_t* WEBP_RESTRICT y, |
176 | | const uint8_t* WEBP_RESTRICT u, |
177 | | const uint8_t* WEBP_RESTRICT v, |
178 | | uint8_t* WEBP_RESTRICT dst); |
179 | | void VP8YuvToArgb32_SSE2(const uint8_t* WEBP_RESTRICT y, |
180 | | const uint8_t* WEBP_RESTRICT u, |
181 | | const uint8_t* WEBP_RESTRICT v, |
182 | | uint8_t* WEBP_RESTRICT dst); |
183 | | void VP8YuvToRgba444432_SSE2(const uint8_t* WEBP_RESTRICT y, |
184 | | const uint8_t* WEBP_RESTRICT u, |
185 | | const uint8_t* WEBP_RESTRICT v, |
186 | | uint8_t* WEBP_RESTRICT dst); |
187 | | void VP8YuvToRgb56532_SSE2(const uint8_t* WEBP_RESTRICT y, |
188 | | const uint8_t* WEBP_RESTRICT u, |
189 | | const uint8_t* WEBP_RESTRICT v, |
190 | | uint8_t* WEBP_RESTRICT dst); |
191 | | |
192 | | #endif // WEBP_USE_SSE2 |
193 | | |
194 | | //----------------------------------------------------------------------------- |
195 | | // SSE41 extra functions (mostly for upsampling_sse41.c) |
196 | | |
197 | | #if defined(WEBP_USE_SSE41) |
198 | | |
199 | | // Process 32 pixels and store the result (16b, 24b or 32b per pixel) in *dst. |
200 | | void VP8YuvToRgb32_SSE41(const uint8_t* WEBP_RESTRICT y, |
201 | | const uint8_t* WEBP_RESTRICT u, |
202 | | const uint8_t* WEBP_RESTRICT v, |
203 | | uint8_t* WEBP_RESTRICT dst); |
204 | | void VP8YuvToBgr32_SSE41(const uint8_t* WEBP_RESTRICT y, |
205 | | const uint8_t* WEBP_RESTRICT u, |
206 | | const uint8_t* WEBP_RESTRICT v, |
207 | | uint8_t* WEBP_RESTRICT dst); |
208 | | |
209 | | #endif // WEBP_USE_SSE41 |
210 | | |
211 | | //------------------------------------------------------------------------------ |
212 | | // RGB -> YUV conversion |
213 | | |
214 | | // Stub functions that can be called with various rounding values: |
215 | 0 | static WEBP_INLINE int VP8ClipUV(int uv, int rounding) { |
216 | 0 | uv = (uv + rounding + (128 << (YUV_FIX + 2))) >> (YUV_FIX + 2); |
217 | 0 | return ((uv & ~0xff) == 0) ? uv : (uv < 0) ? 0 : 255; |
218 | 0 | } Unexecuted instantiation: io_dec.c:VP8ClipUV Unexecuted instantiation: vp8l_dec.c:VP8ClipUV Unexecuted instantiation: upsampling.c:VP8ClipUV Unexecuted instantiation: yuv.c:VP8ClipUV Unexecuted instantiation: upsampling_sse2.c:VP8ClipUV Unexecuted instantiation: yuv_sse2.c:VP8ClipUV Unexecuted instantiation: upsampling_sse41.c:VP8ClipUV Unexecuted instantiation: yuv_sse41.c:VP8ClipUV Unexecuted instantiation: picture_csp_enc.c:VP8ClipUV Unexecuted instantiation: picture_tools_enc.c:VP8ClipUV |
219 | | |
220 | 0 | static WEBP_INLINE int VP8RGBToY(int r, int g, int b, int rounding) { |
221 | 0 | const int luma = 16839 * r + 33059 * g + 6420 * b; |
222 | 0 | return (luma + rounding + (16 << YUV_FIX)) >> YUV_FIX; // no need to clip |
223 | 0 | } Unexecuted instantiation: io_dec.c:VP8RGBToY Unexecuted instantiation: vp8l_dec.c:VP8RGBToY Unexecuted instantiation: upsampling.c:VP8RGBToY Unexecuted instantiation: yuv.c:VP8RGBToY Unexecuted instantiation: upsampling_sse2.c:VP8RGBToY Unexecuted instantiation: yuv_sse2.c:VP8RGBToY Unexecuted instantiation: upsampling_sse41.c:VP8RGBToY Unexecuted instantiation: yuv_sse41.c:VP8RGBToY Unexecuted instantiation: picture_csp_enc.c:VP8RGBToY Unexecuted instantiation: picture_tools_enc.c:VP8RGBToY |
224 | | |
225 | 0 | static WEBP_INLINE int VP8RGBToU(int r, int g, int b, int rounding) { |
226 | 0 | const int u = -9719 * r - 19081 * g + 28800 * b; |
227 | 0 | return VP8ClipUV(u, rounding); |
228 | 0 | } Unexecuted instantiation: io_dec.c:VP8RGBToU Unexecuted instantiation: vp8l_dec.c:VP8RGBToU Unexecuted instantiation: upsampling.c:VP8RGBToU Unexecuted instantiation: yuv.c:VP8RGBToU Unexecuted instantiation: upsampling_sse2.c:VP8RGBToU Unexecuted instantiation: yuv_sse2.c:VP8RGBToU Unexecuted instantiation: upsampling_sse41.c:VP8RGBToU Unexecuted instantiation: yuv_sse41.c:VP8RGBToU Unexecuted instantiation: picture_csp_enc.c:VP8RGBToU Unexecuted instantiation: picture_tools_enc.c:VP8RGBToU |
229 | | |
230 | 0 | static WEBP_INLINE int VP8RGBToV(int r, int g, int b, int rounding) { |
231 | 0 | const int v = +28800 * r - 24116 * g - 4684 * b; |
232 | 0 | return VP8ClipUV(v, rounding); |
233 | 0 | } Unexecuted instantiation: io_dec.c:VP8RGBToV Unexecuted instantiation: vp8l_dec.c:VP8RGBToV Unexecuted instantiation: upsampling.c:VP8RGBToV Unexecuted instantiation: yuv.c:VP8RGBToV Unexecuted instantiation: upsampling_sse2.c:VP8RGBToV Unexecuted instantiation: yuv_sse2.c:VP8RGBToV Unexecuted instantiation: upsampling_sse41.c:VP8RGBToV Unexecuted instantiation: yuv_sse41.c:VP8RGBToV Unexecuted instantiation: picture_csp_enc.c:VP8RGBToV Unexecuted instantiation: picture_tools_enc.c:VP8RGBToV |
234 | | |
235 | | // has_alpha is true if there is an alpha value that is not 0xff. |
236 | | extern void (*WebPImportYUVAFromRGBA)( |
237 | | const uint8_t* r_ptr, const uint8_t* g_ptr, const uint8_t* b_ptr, |
238 | | const uint8_t* a_ptr, |
239 | | int step, // bytes per pixel |
240 | | int rgb_stride, // bytes per scanline |
241 | | int has_alpha, int width, int height, uint16_t* tmp_rgb, int y_stride, |
242 | | int uv_stride, int a_stride, uint8_t* dst_y, uint8_t* dst_u, uint8_t* dst_v, |
243 | | uint8_t* dst_a); |
244 | | extern void (*WebPImportYUVAFromRGBALastLine)( |
245 | | const uint8_t* r_ptr, const uint8_t* g_ptr, const uint8_t* b_ptr, |
246 | | const uint8_t* a_ptr, |
247 | | int step, // bytes per pixel |
248 | | int has_alpha, int width, uint16_t* tmp_rgb, uint8_t* dst_y, uint8_t* dst_u, |
249 | | uint8_t* dst_v, uint8_t* dst_a); |
250 | | |
251 | | // Internal function to WebPImportYUVAFromRGBA* that can be reused. |
252 | | void WebPAccumulateRGBA(const uint8_t* const r_ptr, const uint8_t* const g_ptr, |
253 | | const uint8_t* const b_ptr, const uint8_t* const a_ptr, |
254 | | int rgb_stride, uint16_t* dst, int width); |
255 | | void WebPAccumulateRGB(const uint8_t* const r_ptr, const uint8_t* const g_ptr, |
256 | | const uint8_t* const b_ptr, int step, int rgb_stride, |
257 | | uint16_t* dst, int width); |
258 | | // Must be called before calling WebPAccumulateRGB*. |
259 | | void WebPInitGammaTables(void); |
260 | | |
261 | | #ifdef __cplusplus |
262 | | } // extern "C" |
263 | | #endif |
264 | | |
265 | | #endif // WEBP_DSP_YUV_H_ |