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

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

Issue 10543080: Fix gcc 4.7 building problems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
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 | Annotate | Revision Log
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 20
21 // Define a convenient macro to do static cast.
22 #define INT16_FIX(x) static_cast<int16>(FIX(x))
23
21 SIMD_ALIGNED(const int16 ConvertRGBAToYUV_kTable[8 * 3]) = { 24 SIMD_ALIGNED(const int16 ConvertRGBAToYUV_kTable[8 * 3]) = {
22 FIX(0.098), FIX(0.504), FIX(0.257), 0, 25 INT16_FIX(0.098), INT16_FIX(0.504), INT16_FIX(0.257), 0,
23 FIX(0.098), FIX(0.504), FIX(0.257), 0, 26 INT16_FIX(0.098), INT16_FIX(0.504), INT16_FIX(0.257), 0,
24 FIX(0.439), -FIX(0.291), -FIX(0.148), 0, 27 INT16_FIX(0.439), -INT16_FIX(0.291), -INT16_FIX(0.148), 0,
25 FIX(0.439), -FIX(0.291), -FIX(0.148), 0, 28 INT16_FIX(0.439), -INT16_FIX(0.291), -INT16_FIX(0.148), 0,
26 -FIX(0.071), -FIX(0.368), FIX(0.439), 0, 29 -INT16_FIX(0.071), -INT16_FIX(0.368), INT16_FIX(0.439), 0,
27 -FIX(0.071), -FIX(0.368), FIX(0.439), 0, 30 -INT16_FIX(0.071), -INT16_FIX(0.368), INT16_FIX(0.439), 0,
28 }; 31 };
29 32
33 #undef INT16_FIX
34
30 // This is the final offset for the conversion from signed yuv values to 35 // 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 36 // 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. 37 // components and 128 is added to UV components for 2 pixels.
33 SIMD_ALIGNED(const int32 kYOffset[4]) = {16, 16, 16, 16}; 38 SIMD_ALIGNED(const int32 kYOffset[4]) = {16, 16, 16, 16};
34 39
35 static inline int Clamp(int value) { 40 static inline int Clamp(int value) {
36 if (value < 0) 41 if (value < 0)
37 return 0; 42 return 0;
38 if (value > 255) 43 if (value > 255)
39 return 255; 44 return 255;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 ++vplane; 388 ++vplane;
384 width -= 2; 389 width -= 2;
385 } 390 }
386 391
387 // Handle the last pixel in the last row. 392 // Handle the last pixel in the last row.
388 if (width) 393 if (width)
389 ConvertRGBToYUV_V1H1(rgbframe, yplane, uplane, vplane); 394 ConvertRGBToYUV_V1H1(rgbframe, yplane, uplane, vplane);
390 } 395 }
391 396
392 } // namespace media 397 } // namespace media
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_gtk.cc ('k') | webkit/glue/webcursor_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698