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