| 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_SIMD_CONVERT_YUV_TO_RGB_H_ | 5 #ifndef MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ |
| 6 #define MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ | 6 #define MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "media/base/yuv_convert.h" | 9 #include "media/base/yuv_convert.h" |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 typedef void (*ConvertYUVToRGB32Proc)(const uint8*, | 13 // These methods are exported for testing purposes only. Library users should |
| 14 const uint8*, | 14 // only call the methods listed in yuv_convert.h. |
| 15 const uint8*, | |
| 16 uint8*, | |
| 17 int, | |
| 18 int, | |
| 19 int, | |
| 20 int, | |
| 21 int, | |
| 22 YUVType); | |
| 23 | 15 |
| 24 typedef void (*ConvertYUVAToARGBProc)(const uint8*, | 16 MEDIA_EXPORT void ConvertYUVToRGB32_C(const uint8* yplane, |
| 25 const uint8*, | 17 const uint8* uplane, |
| 26 const uint8*, | 18 const uint8* vplane, |
| 27 const uint8*, | 19 uint8* rgbframe, |
| 28 uint8*, | 20 int width, |
| 29 int, | 21 int height, |
| 30 int, | 22 int ystride, |
| 31 int, | 23 int uvstride, |
| 32 int, | 24 int rgbstride, |
| 33 int, | 25 YUVType yuv_type); |
| 34 int, | |
| 35 YUVType); | |
| 36 | 26 |
| 37 void ConvertYUVToRGB32_C(const uint8* yplane, | 27 MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8* yplane, |
| 38 const uint8* uplane, | 28 const uint8* uplane, |
| 39 const uint8* vplane, | 29 const uint8* vplane, |
| 40 uint8* rgbframe, | 30 uint8* rgbframe, |
| 41 int width, | 31 ptrdiff_t width); |
| 42 int height, | |
| 43 int ystride, | |
| 44 int uvstride, | |
| 45 int rgbstride, | |
| 46 YUVType yuv_type); | |
| 47 | 32 |
| 48 void ConvertYUVAToARGB_C(const uint8* yplane, | 33 MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane, |
| 49 const uint8* uplane, | 34 const uint8* uplane, |
| 50 const uint8* vplane, | 35 const uint8* vplane, |
| 51 const uint8* aplane, | 36 const uint8* aplane, |
| 52 uint8* rgbframe, | 37 uint8* rgbframe, |
| 53 int width, | 38 int width, |
| 54 int height, | 39 int height, |
| 55 int ystride, | 40 int ystride, |
| 56 int uvstride, | 41 int uvstride, |
| 57 int avstride, | 42 int avstride, |
| 58 int rgbstride, | 43 int rgbstride, |
| 59 YUVType yuv_type); | 44 YUVType yuv_type); |
| 60 | 45 |
| 61 void ConvertYUVToRGB32_SSE(const uint8* yplane, | 46 MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane, |
| 62 const uint8* uplane, | 47 const uint8* uplane, |
| 63 const uint8* vplane, | 48 const uint8* vplane, |
| 64 uint8* rgbframe, | 49 const uint8* aplane, |
| 65 int width, | 50 uint8* rgbframe, |
| 66 int height, | 51 ptrdiff_t width); |
| 67 int ystride, | |
| 68 int uvstride, | |
| 69 int rgbstride, | |
| 70 YUVType yuv_type); | |
| 71 | 52 |
| 72 void ConvertYUVToRGB32_MMX(const uint8* yplane, | 53 MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane, |
| 73 const uint8* uplane, | 54 const uint8* uplane, |
| 74 const uint8* vplane, | 55 const uint8* vplane, |
| 75 uint8* rgbframe, | 56 uint8* rgbframe, |
| 76 int width, | 57 int width, |
| 77 int height, | 58 int height, |
| 78 int ystride, | 59 int ystride, |
| 79 int uvstride, | 60 int uvstride, |
| 80 int rgbstride, | 61 int rgbstride, |
| 81 YUVType yuv_type); | 62 YUVType yuv_type); |
| 82 | 63 |
| 83 void ConvertYUVAToARGB_MMX(const uint8* yplane, | 64 MEDIA_EXPORT void ConvertYUVToRGB32_MMX(const uint8* yplane, |
| 84 const uint8* uplane, | 65 const uint8* uplane, |
| 85 const uint8* vplane, | 66 const uint8* vplane, |
| 86 const uint8* aplane, | 67 uint8* rgbframe, |
| 87 uint8* rgbframe, | 68 int width, |
| 88 int width, | 69 int height, |
| 89 int height, | 70 int ystride, |
| 90 int ystride, | 71 int uvstride, |
| 91 int uvstride, | 72 int rgbstride, |
| 92 int avstride, | 73 YUVType yuv_type); |
| 93 int rgbstride, | 74 |
| 94 YUVType yuv_type); | 75 MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane, |
| 76 const uint8* uplane, |
| 77 const uint8* vplane, |
| 78 const uint8* aplane, |
| 79 uint8* rgbframe, |
| 80 int width, |
| 81 int height, |
| 82 int ystride, |
| 83 int uvstride, |
| 84 int avstride, |
| 85 int rgbstride, |
| 86 YUVType yuv_type); |
| 87 |
| 88 MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf, |
| 89 const uint8* u_buf, |
| 90 const uint8* v_buf, |
| 91 uint8* rgb_buf, |
| 92 ptrdiff_t width, |
| 93 ptrdiff_t source_dx); |
| 94 |
| 95 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, |
| 96 const uint8* u_buf, |
| 97 const uint8* v_buf, |
| 98 uint8* rgb_buf, |
| 99 ptrdiff_t width, |
| 100 ptrdiff_t source_dx); |
| 101 |
| 102 MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, |
| 103 const uint8* u_buf, |
| 104 const uint8* v_buf, |
| 105 uint8* rgb_buf, |
| 106 int dest_width, |
| 107 int source_x, |
| 108 int source_dx); |
| 95 | 109 |
| 96 } // namespace media | 110 } // namespace media |
| 97 | 111 |
| 98 // Assembly functions are declared without namespace. | 112 // Assembly functions are declared without namespace. |
| 99 extern "C" { | 113 extern "C" { |
| 100 | 114 |
| 101 // We use ptrdiff_t instead of int for yasm routine parameters to portably | 115 // We use ptrdiff_t instead of int for yasm routine parameters to portably |
| 102 // sign-extend int. On Win64, MSVC does not sign-extend the value in the stack | 116 // sign-extend int. On Win64, MSVC does not sign-extend the value in the stack |
| 103 // home of int function parameters, and yasm routines are unaware of this lack | 117 // home of int function parameters, and yasm routines are unaware of this lack |
| 104 // of extension and fault. ptrdiff_t is portably sign-extended and fixes this | 118 // of extension and fault. ptrdiff_t is portably sign-extended and fixes this |
| 105 // issue on at least Win64. The C-equivalent RowProc versions' prototypes | 119 // issue on at least Win64. The C-equivalent RowProc versions' prototypes |
| 106 // include the same change to ptrdiff_t to reuse the typedefs. | 120 // include the same change to ptrdiff_t to reuse the typedefs. |
| 107 | 121 |
| 108 typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, | 122 MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8* yplane, |
| 109 const uint8*, | 123 const uint8* uplane, |
| 110 const uint8*, | 124 const uint8* vplane, |
| 111 uint8*, | 125 uint8* rgbframe, |
| 112 ptrdiff_t); | 126 ptrdiff_t width); |
| 113 | 127 |
| 114 typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, | 128 MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane, |
| 115 const uint8*, | 129 const uint8* uplane, |
| 116 const uint8*, | 130 const uint8* vplane, |
| 117 const uint8*, | 131 const uint8* aplane, |
| 118 uint8*, | 132 uint8* rgbframe, |
| 119 ptrdiff_t); | 133 ptrdiff_t width); |
| 120 | 134 |
| 121 typedef void (*ScaleYUVToRGB32RowProc)(const uint8*, | 135 MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane, |
| 122 const uint8*, | 136 const uint8* uplane, |
| 123 const uint8*, | 137 const uint8* vplane, |
| 124 uint8*, | 138 uint8* rgbframe, |
| 125 ptrdiff_t, | 139 ptrdiff_t width); |
| 126 ptrdiff_t); | |
| 127 | 140 |
| 128 void ConvertYUVToRGB32Row_C(const uint8* yplane, | 141 MEDIA_EXPORT void ScaleYUVToRGB32Row_MMX(const uint8* y_buf, |
| 129 const uint8* uplane, | |
| 130 const uint8* vplane, | |
| 131 uint8* rgbframe, | |
| 132 ptrdiff_t width); | |
| 133 | |
| 134 void ConvertYUVAToARGBRow_C(const uint8* yplane, | |
| 135 const uint8* uplane, | |
| 136 const uint8* vplane, | |
| 137 const uint8* aplane, | |
| 138 uint8* rgbframe, | |
| 139 ptrdiff_t width); | |
| 140 | |
| 141 void ConvertYUVToRGB32Row_MMX(const uint8* yplane, | |
| 142 const uint8* uplane, | |
| 143 const uint8* vplane, | |
| 144 uint8* rgbframe, | |
| 145 ptrdiff_t width); | |
| 146 | |
| 147 void ConvertYUVAToARGBRow_MMX(const uint8* yplane, | |
| 148 const uint8* uplane, | |
| 149 const uint8* vplane, | |
| 150 const uint8* aplane, | |
| 151 uint8* rgbframe, | |
| 152 ptrdiff_t width); | |
| 153 | |
| 154 void ConvertYUVToRGB32Row_SSE(const uint8* yplane, | |
| 155 const uint8* uplane, | |
| 156 const uint8* vplane, | |
| 157 uint8* rgbframe, | |
| 158 ptrdiff_t width); | |
| 159 | |
| 160 void ScaleYUVToRGB32Row_C(const uint8* y_buf, | |
| 161 const uint8* u_buf, | |
| 162 const uint8* v_buf, | |
| 163 uint8* rgb_buf, | |
| 164 ptrdiff_t width, | |
| 165 ptrdiff_t source_dx); | |
| 166 | |
| 167 void ScaleYUVToRGB32Row_MMX(const uint8* y_buf, | |
| 168 const uint8* u_buf, | |
| 169 const uint8* v_buf, | |
| 170 uint8* rgb_buf, | |
| 171 ptrdiff_t width, | |
| 172 ptrdiff_t source_dx); | |
| 173 | |
| 174 void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, | |
| 175 const uint8* u_buf, | |
| 176 const uint8* v_buf, | |
| 177 uint8* rgb_buf, | |
| 178 ptrdiff_t width, | |
| 179 ptrdiff_t source_dx); | |
| 180 | |
| 181 void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf, | |
| 182 const uint8* u_buf, | |
| 183 const uint8* v_buf, | |
| 184 uint8* rgb_buf, | |
| 185 ptrdiff_t width, | |
| 186 ptrdiff_t source_dx); | |
| 187 | |
| 188 void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, | |
| 189 const uint8* u_buf, | |
| 190 const uint8* v_buf, | |
| 191 uint8* rgb_buf, | |
| 192 ptrdiff_t width, | |
| 193 ptrdiff_t source_dx); | |
| 194 | |
| 195 void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, | |
| 196 const uint8* u_buf, | 142 const uint8* u_buf, |
| 197 const uint8* v_buf, | 143 const uint8* v_buf, |
| 198 uint8* rgb_buf, | 144 uint8* rgb_buf, |
| 199 int dest_width, | 145 ptrdiff_t width, |
| 200 int source_x, | 146 ptrdiff_t source_dx); |
| 201 int source_dx); | |
| 202 | 147 |
| 203 void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf, | 148 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, |
| 204 const uint8* u_buf, | 149 const uint8* u_buf, |
| 205 const uint8* v_buf, | 150 const uint8* v_buf, |
| 206 uint8* rgb_buf, | 151 uint8* rgb_buf, |
| 207 ptrdiff_t width, | 152 ptrdiff_t width, |
| 208 ptrdiff_t source_dx); | 153 ptrdiff_t source_dx); |
| 209 | 154 |
| 210 void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, | 155 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf, |
| 211 const uint8* u_buf, | 156 const uint8* u_buf, |
| 212 const uint8* v_buf, | 157 const uint8* v_buf, |
| 213 uint8* rgb_buf, | 158 uint8* rgb_buf, |
| 214 ptrdiff_t width, | 159 ptrdiff_t width, |
| 215 ptrdiff_t source_dx); | 160 ptrdiff_t source_dx); |
| 216 | 161 |
| 217 void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf, | 162 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf, |
| 218 const uint8* u_buf, | 163 const uint8* u_buf, |
| 219 const uint8* v_buf, | 164 const uint8* v_buf, |
| 220 uint8* rgb_buf, | 165 uint8* rgb_buf, |
| 221 ptrdiff_t width, | 166 ptrdiff_t width, |
| 222 ptrdiff_t source_dx); | 167 ptrdiff_t source_dx); |
| 168 |
| 169 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, |
| 170 const uint8* u_buf, |
| 171 const uint8* v_buf, |
| 172 uint8* rgb_buf, |
| 173 ptrdiff_t width, |
| 174 ptrdiff_t source_dx); |
| 175 |
| 176 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf, |
| 177 const uint8* u_buf, |
| 178 const uint8* v_buf, |
| 179 uint8* rgb_buf, |
| 180 ptrdiff_t width, |
| 181 ptrdiff_t source_dx); |
| 223 | 182 |
| 224 } // extern "C" | 183 } // extern "C" |
| 225 | 184 |
| 226 #endif // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ | 185 #endif // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ |
| OLD | NEW |