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

Side by Side Diff: media/base/simd/convert_yuv_to_rgb_c.cc

Issue 15151002: Streamline SIMD targets in media.gyp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix exports. Created 7 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/simd/convert_yuv_to_rgb.h" 5 #include "media/base/simd/convert_yuv_to_rgb.h"
6 #include "media/base/simd/yuv_to_rgb_table.h" 6 #include "media/base/simd/yuv_to_rgb_table.h"
7 7
8 namespace media {
9
8 #define packuswb(x) ((x) < 0 ? 0 : ((x) > 255 ? 255 : (x))) 10 #define packuswb(x) ((x) < 0 ? 0 : ((x) > 255 ? 255 : (x)))
9 #define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \ 11 #define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \
10 (((x) + (y)) > 32767 ? 32767 : ((x) + (y)))) 12 (((x) + (y)) > 32767 ? 32767 : ((x) + (y))))
11 13
12 static inline void ConvertYUVToRGB32_C(uint8 y, 14 static inline void ConvertYUVToRGB32_C(uint8 y,
13 uint8 u, 15 uint8 u,
14 uint8 v, 16 uint8 v,
15 uint8* rgb_buf) { 17 uint8* rgb_buf) {
16 int b = kCoefficientsRgbY[256+u][0]; 18 int b = kCoefficientsRgbY[256+u][0];
17 int g = kCoefficientsRgbY[256+u][1]; 19 int g = kCoefficientsRgbY[256+u][1];
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 g >>= 6; 62 g >>= 6;
61 r >>= 6; 63 r >>= 6;
62 64
63 b = packuswb(b) * a >> 8; 65 b = packuswb(b) * a >> 8;
64 g = packuswb(g) * a >> 8; 66 g = packuswb(g) * a >> 8;
65 r = packuswb(r) * a >> 8; 67 r = packuswb(r) * a >> 8;
66 68
67 *reinterpret_cast<uint32*>(rgb_buf) = b | (g << 8) | (r << 16) | (a << 24); 69 *reinterpret_cast<uint32*>(rgb_buf) = b | (g << 8) | (r << 16) | (a << 24);
68 } 70 }
69 71
70 extern "C" {
Ami GONE FROM CHROMIUM 2013/05/18 02:22:04 Was this just not necessary or what?
DaleCurtis 2013/05/23 23:43:23 Nope, I moved the _C functions outside of the exte
71
72 void ConvertYUVToRGB32Row_C(const uint8* y_buf, 72 void ConvertYUVToRGB32Row_C(const uint8* y_buf,
73 const uint8* u_buf, 73 const uint8* u_buf,
74 const uint8* v_buf, 74 const uint8* v_buf,
75 uint8* rgb_buf, 75 uint8* rgb_buf,
76 ptrdiff_t width) { 76 ptrdiff_t width) {
77 for (int x = 0; x < width; x += 2) { 77 for (int x = 0; x < width; x += 2) {
78 uint8 u = u_buf[x >> 1]; 78 uint8 u = u_buf[x >> 1];
79 uint8 v = v_buf[x >> 1]; 79 uint8 v = v_buf[x >> 1];
80 uint8 y0 = y_buf[x]; 80 uint8 y0 = y_buf[x];
81 ConvertYUVToRGB32_C(y0, u, v, rgb_buf); 81 ConvertYUVToRGB32_C(y0, u, v, rgb_buf);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 y1 = y_buf[(x >> 16) + 1]; 174 y1 = y_buf[(x >> 16) + 1];
175 y_frac = (x & 65535); 175 y_frac = (x & 65535);
176 y = (y_frac * y1 + (y_frac ^ 65535) * y0) >> 16; 176 y = (y_frac * y1 + (y_frac ^ 65535) * y0) >> 16;
177 ConvertYUVToRGB32_C(y, u, v, rgb_buf+4); 177 ConvertYUVToRGB32_C(y, u, v, rgb_buf+4);
178 x += source_dx; 178 x += source_dx;
179 } 179 }
180 rgb_buf += 8; 180 rgb_buf += 8;
181 } 181 }
182 } 182 }
183 183
184 }
185
186 namespace media {
187
188 void ConvertYUVToRGB32_C(const uint8* yplane, 184 void ConvertYUVToRGB32_C(const uint8* yplane,
189 const uint8* uplane, 185 const uint8* uplane,
190 const uint8* vplane, 186 const uint8* vplane,
191 uint8* rgbframe, 187 uint8* rgbframe,
192 int width, 188 int width,
193 int height, 189 int height,
194 int ystride, 190 int ystride,
195 int uvstride, 191 int uvstride,
196 int rgbstride, 192 int rgbstride,
197 YUVType yuv_type) { 193 YUVType yuv_type) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ConvertYUVAToARGBRow_C(y_ptr, 229 ConvertYUVAToARGBRow_C(y_ptr,
234 u_ptr, 230 u_ptr,
235 v_ptr, 231 v_ptr,
236 a_ptr, 232 a_ptr,
237 rgba_row, 233 rgba_row,
238 width); 234 width);
239 } 235 }
240 } 236 }
241 237
242 } // namespace media 238 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698