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

Side by Side Diff: third_party/libwebp/dsp/upsampling_sse2.c

Issue 10832153: libwebp: update snapshot to v0.2.0-rc1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
OLDNEW
1 // Copyright 2011 Google Inc. 1 // Copyright 2011 Google Inc. All Rights Reserved.
2 // 2 //
3 // This code is licensed under the same terms as WebM: 3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/ 4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // ----------------------------------------------------------------------------- 6 // -----------------------------------------------------------------------------
7 // 7 //
8 // SSE2 version of YUV to RGB upsampling functions. 8 // SSE2 version of YUV to RGB upsampling functions.
9 // 9 //
10 // Author: somnath@google.com (Somnath Banerjee) 10 // Author: somnath@google.com (Somnath Banerjee)
11 11
12 #if defined(__SSE2__) || defined(_MSC_VER) 12 #include "./dsp.h"
13
14 #if defined(WEBP_USE_SSE2)
13 15
14 #include <assert.h> 16 #include <assert.h>
15 #include <emmintrin.h> 17 #include <emmintrin.h>
16 #include <string.h> 18 #include <string.h>
17 #include "./dsp.h"
18 #include "./yuv.h" 19 #include "./yuv.h"
19 #include "../dec/webpi.h"
20 20
21 #if defined(__cplusplus) || defined(c_plusplus) 21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" { 22 extern "C" {
23 #endif 23 #endif
24 24
25 #ifdef FANCY_UPSAMPLING 25 #ifdef FANCY_UPSAMPLING
26 26
27 // We compute (9*a + 3*b + 3*c + d + 8) / 16 as follows 27 // We compute (9*a + 3*b + 3*c + d + 8) / 16 as follows
28 // u = (9*a + 3*b + 3*c + d + 8) / 16 28 // u = (9*a + 3*b + 3*c + d + 8) / 16
29 // = (a + (a + 3*b + 3*c + d) / 8 + 1) / 2 29 // = (a + (a + 3*b + 3*c + d) / 8 + 1) / 2
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 UPSAMPLE_LAST_BLOCK(top_v, cur_v, leftover, r_uv + 1 * 32); \ 169 UPSAMPLE_LAST_BLOCK(top_v, cur_v, leftover, r_uv + 1 * 32); \
170 CONVERT2RGB(FUNC, XSTEP, top_y, bottom_y, r_uv, top_dst, bottom_dst, \ 170 CONVERT2RGB(FUNC, XSTEP, top_y, bottom_y, r_uv, top_dst, bottom_dst, \
171 last_pos, len - last_pos); \ 171 last_pos, len - last_pos); \
172 } 172 }
173 173
174 // SSE2 variants of the fancy upsampler. 174 // SSE2 variants of the fancy upsampler.
175 SSE2_UPSAMPLE_FUNC(UpsampleRgbLinePairSSE2, VP8YuvToRgb, 3) 175 SSE2_UPSAMPLE_FUNC(UpsampleRgbLinePairSSE2, VP8YuvToRgb, 3)
176 SSE2_UPSAMPLE_FUNC(UpsampleBgrLinePairSSE2, VP8YuvToBgr, 3) 176 SSE2_UPSAMPLE_FUNC(UpsampleBgrLinePairSSE2, VP8YuvToBgr, 3)
177 SSE2_UPSAMPLE_FUNC(UpsampleRgbaLinePairSSE2, VP8YuvToRgba, 4) 177 SSE2_UPSAMPLE_FUNC(UpsampleRgbaLinePairSSE2, VP8YuvToRgba, 4)
178 SSE2_UPSAMPLE_FUNC(UpsampleBgraLinePairSSE2, VP8YuvToBgra, 4) 178 SSE2_UPSAMPLE_FUNC(UpsampleBgraLinePairSSE2, VP8YuvToBgra, 4)
179 // These two don't erase the alpha value
180 SSE2_UPSAMPLE_FUNC(UpsampleRgbKeepAlphaLinePairSSE2, VP8YuvToRgb, 4)
181 SSE2_UPSAMPLE_FUNC(UpsampleBgrKeepAlphaLinePairSSE2, VP8YuvToBgr, 4)
182 179
183 #undef GET_M 180 #undef GET_M
184 #undef PACK_AND_STORE 181 #undef PACK_AND_STORE
185 #undef UPSAMPLE_32PIXELS 182 #undef UPSAMPLE_32PIXELS
186 #undef UPSAMPLE_LAST_BLOCK 183 #undef UPSAMPLE_LAST_BLOCK
187 #undef CONVERT2RGB 184 #undef CONVERT2RGB
188 #undef SSE2_UPSAMPLE_FUNC 185 #undef SSE2_UPSAMPLE_FUNC
189 186
190 //------------------------------------------------------------------------------ 187 //------------------------------------------------------------------------------
191 188
192 extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; 189 extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */];
193 extern WebPUpsampleLinePairFunc WebPUpsamplersKeepAlpha[/* MODE_LAST */];
194
195 #endif // FANCY_UPSAMPLING
196 190
197 void WebPInitUpsamplersSSE2(void) { 191 void WebPInitUpsamplersSSE2(void) {
198 #ifdef FANCY_UPSAMPLING
199 WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePairSSE2; 192 WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePairSSE2;
200 WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePairSSE2; 193 WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePairSSE2;
201 WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePairSSE2; 194 WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePairSSE2;
202 WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePairSSE2; 195 WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePairSSE2;
196 }
203 197
204 WebPUpsamplersKeepAlpha[MODE_RGB] = UpsampleRgbLinePairSSE2; 198 void WebPInitPremultiplySSE2(void) {
205 WebPUpsamplersKeepAlpha[MODE_RGBA] = UpsampleRgbKeepAlphaLinePairSSE2; 199 WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePairSSE2;
206 WebPUpsamplersKeepAlpha[MODE_BGR] = UpsampleBgrLinePairSSE2; 200 WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePairSSE2;
207 WebPUpsamplersKeepAlpha[MODE_BGRA] = UpsampleBgrKeepAlphaLinePairSSE2; 201 }
202
208 #endif // FANCY_UPSAMPLING 203 #endif // FANCY_UPSAMPLING
209 }
210 204
211 #if defined(__cplusplus) || defined(c_plusplus) 205 #if defined(__cplusplus) || defined(c_plusplus)
212 } // extern "C" 206 } // extern "C"
213 #endif 207 #endif
214 208
215 #endif //__SSE2__ || _MSC_VER 209 #endif // WEBP_USE_SSE2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698