OLD | NEW |
---|---|
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 #ifndef MEDIA_BASE_YUV_CONVERT_H_ | 5 #ifndef MEDIA_BASE_YUV_CONVERT_H_ |
6 #define MEDIA_BASE_YUV_CONVERT_H_ | 6 #define MEDIA_BASE_YUV_CONVERT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
10 | 10 |
11 // Visual Studio 2010 does not support MMX intrinsics on x64. | 11 // Visual Studio 2010 does not support MMX intrinsics on x64. |
12 // Some win64 yuv_convert code paths use SSE+MMX yasm, so without rewriting | 12 // Some win64 yuv_convert code paths use SSE+MMX yasm, so without rewriting |
13 // them, we use yasm EmptyRegisterState_MMX in place of _mm_empty() or | 13 // them, we use yasm EmptyRegisterState_MMX in place of _mm_empty() or |
14 // hide the versions implemented with heavy use of MMX intrinsics. | 14 // hide the versions implemented with heavy use of MMX intrinsics. |
15 // TODO(wolenetz): Use MMX intrinsics when compiling win64 with Visual | 15 // TODO(wolenetz): Use MMX intrinsics when compiling win64 with Visual |
16 // Studio 2012? http://crbug.com/173450 | 16 // Studio 2012? http://crbug.com/173450 |
17 #if defined(ARCH_CPU_X86_FAMILY) && \ | 17 #if defined(ARCH_CPU_X86_FAMILY) && \ |
18 !(defined(ARCH_CPU_X86_64) && defined(COMPILER_MSVC)) | 18 !(defined(ARCH_CPU_X86_64) && defined(COMPILER_MSVC)) |
19 #define MEDIA_MMX_INTRINSICS_AVAILABLE | 19 #define MEDIA_MMX_INTRINSICS_AVAILABLE |
20 #endif | 20 #endif |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 | 23 |
24 // Type of YUV surface. | 24 // Type of YUV surface. |
25 // The value of these enums matter as they are used to shift vertical indices. | |
26 enum YUVType { | 25 enum YUVType { |
27 YV16 = 0, // YV16 is half width and full height chroma channels. | 26 YV16 = 0, // YV16 is half width and full height chroma channels. |
28 YV12 = 1, // YV12 is half width and half height chroma channels. | 27 YV12 = 1, // YV12 is half width and half height chroma channels. |
28 YV12J = 2, // YV12J is the same as YV12, but in JPEG color range. | |
29 }; | 29 }; |
30 | 30 |
31 // Get the appropriate value to bitshift by for vertical indices. | |
32 int GetVerticalShift(YUVType type); | |
33 | |
34 #define GET_LOOKUP_TABLE(type) \ | |
rileya (GONE FROM CHROMIUM)
2014/04/22 17:57:50
Ugly macro, since we can't return a sized/multidim
scherkus (not reviewing)
2014/04/22 18:53:33
so there is some heinous syntax you can use to pas
rileya (GONE FROM CHROMIUM)
2014/04/23 21:23:51
Looks like that worked without needing to modify t
| |
35 ((type) == YV12J ? kCoefficientsRgbY_JPEG : kCoefficientsRgbY) | |
36 | |
31 // Mirror means flip the image horizontally, as in looking in a mirror. | 37 // Mirror means flip the image horizontally, as in looking in a mirror. |
32 // Rotate happens after mirroring. | 38 // Rotate happens after mirroring. |
33 enum Rotate { | 39 enum Rotate { |
34 ROTATE_0, // Rotation off. | 40 ROTATE_0, // Rotation off. |
35 ROTATE_90, // Rotate clockwise. | 41 ROTATE_90, // Rotate clockwise. |
36 ROTATE_180, // Rotate upside down. | 42 ROTATE_180, // Rotate upside down. |
37 ROTATE_270, // Rotate counter clockwise. | 43 ROTATE_270, // Rotate counter clockwise. |
38 MIRROR_ROTATE_0, // Mirror horizontally. | 44 MIRROR_ROTATE_0, // Mirror horizontally. |
39 MIRROR_ROTATE_90, // Mirror then Rotate clockwise. | 45 MIRROR_ROTATE_90, // Mirror then Rotate clockwise. |
40 MIRROR_ROTATE_180, // Mirror vertically. | 46 MIRROR_ROTATE_180, // Mirror vertically. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 uint8* vplane, | 154 uint8* vplane, |
149 int width, | 155 int width, |
150 int height); | 156 int height); |
151 | 157 |
152 // Empty SIMD register state after calling optimized scaler functions. | 158 // Empty SIMD register state after calling optimized scaler functions. |
153 MEDIA_EXPORT void EmptyRegisterState(); | 159 MEDIA_EXPORT void EmptyRegisterState(); |
154 | 160 |
155 } // namespace media | 161 } // namespace media |
156 | 162 |
157 #endif // MEDIA_BASE_YUV_CONVERT_H_ | 163 #endif // MEDIA_BASE_YUV_CONVERT_H_ |
OLD | NEW |