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

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

Issue 10537037: Fix gcc 4.7 building problems - cont' (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "build/build_config.h" 5 #include "build/build_config.h"
6 #include "media/base/simd/convert_rgb_to_yuv.h" 6 #include "media/base/simd/convert_rgb_to_yuv.h"
7 #include "media/base/simd/yuv_to_rgb_table.h" 7 #include "media/base/simd/yuv_to_rgb_table.h"
8 8
9 #if defined(COMPILER_MSVC) 9 #if defined(COMPILER_MSVC)
10 #include <intrin.h> 10 #include <intrin.h>
11 #else 11 #else
12 #include <mmintrin.h> 12 #include <mmintrin.h>
13 #include <emmintrin.h> 13 #include <emmintrin.h>
14 #endif 14 #endif
15 15
16 namespace media { 16 namespace media {
17 17
18 #define FIX_SHIFT 12 18 #define FIX_SHIFT 12
19 #define FIX(x) ((x) * (1 << FIX_SHIFT)) 19 #define FIX(x) ((x) * (1 << FIX_SHIFT))
20 #define INT16_FIX(x) static_cast<int16>(FIX(x))
20 21
21 SIMD_ALIGNED(const int16 ConvertRGBAToYUV_kTable[8 * 3]) = { 22 SIMD_ALIGNED(const int16 ConvertRGBAToYUV_kTable[8 * 3]) = {
22 FIX(0.098), FIX(0.504), FIX(0.257), 0, 23 INT16_FIX(0.098), INT16_FIX(0.504), INT16_FIX(0.257), 0,
23 FIX(0.098), FIX(0.504), FIX(0.257), 0, 24 INT16_FIX(0.098), INT16_FIX(0.504), INT16_FIX(0.257), 0,
24 FIX(0.439), -FIX(0.291), -FIX(0.148), 0, 25 INT16_FIX(0.439), -INT16_FIX(0.291), -INT16_FIX(0.148), 0,
25 FIX(0.439), -FIX(0.291), -FIX(0.148), 0, 26 INT16_FIX(0.439), -INT16_FIX(0.291), -INT16_FIX(0.148), 0,
26 -FIX(0.071), -FIX(0.368), FIX(0.439), 0, 27 -INT16_FIX(0.071), -INT16_FIX(0.368), INT16_FIX(0.439), 0,
Ami GONE FROM CHROMIUM 2012/06/06 21:34:09 nit: add leading space
27 -FIX(0.071), -FIX(0.368), FIX(0.439), 0, 28 -INT16_FIX(0.071), -INT16_FIX(0.368), INT16_FIX(0.439), 0,
28 }; 29 };
29 30
30 // This is the final offset for the conversion from signed yuv values to 31 // This is the final offset for the conversion from signed yuv values to
31 // unsigned values. It is arranged so that offset of 16 is applied to Y 32 // unsigned values. It is arranged so that offset of 16 is applied to Y
32 // components and 128 is added to UV components for 2 pixels. 33 // components and 128 is added to UV components for 2 pixels.
33 SIMD_ALIGNED(const int32 kYOffset[4]) = {16, 16, 16, 16}; 34 SIMD_ALIGNED(const int32 kYOffset[4]) = {16, 16, 16, 16};
34 35
35 static inline int Clamp(int value) { 36 static inline int Clamp(int value) {
36 if (value < 0) 37 if (value < 0)
37 return 0; 38 return 0;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 ++vplane; 384 ++vplane;
384 width -= 2; 385 width -= 2;
385 } 386 }
386 387
387 // Handle the last pixel in the last row. 388 // Handle the last pixel in the last row.
388 if (width) 389 if (width)
389 ConvertRGBToYUV_V1H1(rgbframe, yplane, uplane, vplane); 390 ConvertRGBToYUV_V1H1(rgbframe, yplane, uplane, vplane);
390 } 391 }
391 392
392 } // namespace media 393 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698