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 // This webpage shows layout of YV12 and other YUV formats | 5 // This webpage shows layout of YV12 and other YUV formats |
6 // http://www.fourcc.org/yuv.php | 6 // http://www.fourcc.org/yuv.php |
7 // The actual conversion is best described here | 7 // The actual conversion is best described here |
8 // http://en.wikipedia.org/wiki/YUV | 8 // http://en.wikipedia.org/wiki/YUV |
9 // An article on optimizing YUV conversion using tables instead of multiplies | 9 // An article on optimizing YUV conversion using tables instead of multiplies |
10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf | 10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_C; | 158 g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_C; |
159 g_convert_rgb32_to_yuv_proc_ = ConvertRGB32ToYUV_C; | 159 g_convert_rgb32_to_yuv_proc_ = ConvertRGB32ToYUV_C; |
160 g_convert_rgb24_to_yuv_proc_ = ConvertRGB24ToYUV_C; | 160 g_convert_rgb24_to_yuv_proc_ = ConvertRGB24ToYUV_C; |
161 g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_C; | 161 g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_C; |
162 g_convert_yuva_to_argb_proc_ = ConvertYUVAToARGB_C; | 162 g_convert_yuva_to_argb_proc_ = ConvertYUVAToARGB_C; |
163 g_empty_register_state_proc_ = EmptyRegisterStateStub; | 163 g_empty_register_state_proc_ = EmptyRegisterStateStub; |
164 | 164 |
165 // Assembly code confuses MemorySanitizer. | 165 // Assembly code confuses MemorySanitizer. |
166 #if defined(ARCH_CPU_X86_FAMILY) && !defined(MEMORY_SANITIZER) | 166 #if defined(ARCH_CPU_X86_FAMILY) && !defined(MEMORY_SANITIZER) |
167 base::CPU cpu; | 167 base::CPU cpu; |
168 if (cpu.has_mmx()) { | 168 |
169 g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_MMX; | 169 g_convert_yuva_to_argb_proc_ = ConvertYUVAToARGB_MMX; |
170 g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_MMX; | |
171 g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_MMX; | |
172 g_convert_yuva_to_argb_proc_ = ConvertYUVAToARGB_MMX; | |
173 g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX; | |
174 | 170 |
175 #if defined(MEDIA_MMX_INTRINSICS_AVAILABLE) | 171 #if defined(MEDIA_MMX_INTRINSICS_AVAILABLE) |
176 g_filter_yuv_rows_proc_ = FilterYUVRows_MMX; | 172 g_filter_yuv_rows_proc_ = FilterYUVRows_MMX; |
177 g_empty_register_state_proc_ = EmptyRegisterStateIntrinsic; | 173 g_empty_register_state_proc_ = EmptyRegisterStateIntrinsic; |
178 #else | 174 #else |
179 g_empty_register_state_proc_ = EmptyRegisterState_MMX; | 175 g_empty_register_state_proc_ = EmptyRegisterState_MMX; |
180 #endif | 176 #endif |
181 } | |
182 | 177 |
183 if (cpu.has_sse()) { | 178 g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_SSE; |
184 g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_SSE; | 179 g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE; |
185 g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE; | 180 g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_SSE; |
186 g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_SSE; | 181 g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_SSE; |
187 g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_SSE; | |
188 } | |
189 | 182 |
190 if (cpu.has_sse2()) { | 183 g_filter_yuv_rows_proc_ = FilterYUVRows_SSE2; |
191 g_filter_yuv_rows_proc_ = FilterYUVRows_SSE2; | 184 g_convert_rgb32_to_yuv_proc_ = ConvertRGB32ToYUV_SSE2; |
192 g_convert_rgb32_to_yuv_proc_ = ConvertRGB32ToYUV_SSE2; | |
193 | 185 |
194 #if defined(ARCH_CPU_X86_64) | 186 #if defined(ARCH_CPU_X86_64) |
195 g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE2_X64; | 187 g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE2_X64; |
196 | 188 |
197 // Technically this should be in the MMX section, but MSVC will optimize out | 189 // Technically this should be in the MMX section, but MSVC will optimize out |
198 // the export of LinearScaleYUVToRGB32Row_MMX, which is required by the unit | 190 // the export of LinearScaleYUVToRGB32Row_MMX, which is required by the unit |
199 // tests, if that decision can be made at compile time. Since all X64 CPUs | 191 // tests, if that decision can be made at compile time. Since all X64 CPUs |
200 // have SSE2, we can hack around this by making the selection here. | 192 // have SSE2, we can hack around this by making the selection here. |
201 g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX_X64; | 193 g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX_X64; |
202 #endif | 194 #endif |
203 } | |
204 | 195 |
205 if (cpu.has_ssse3()) { | 196 if (cpu.has_ssse3()) { |
206 g_convert_rgb24_to_yuv_proc_ = &ConvertRGB24ToYUV_SSSE3; | 197 g_convert_rgb24_to_yuv_proc_ = &ConvertRGB24ToYUV_SSSE3; |
207 | 198 |
208 // TODO(hclam): Add ConvertRGB32ToYUV_SSSE3 when the cyan problem is solved. | 199 // TODO(hclam): Add ConvertRGB32ToYUV_SSSE3 when the cyan problem is solved. |
209 // See: crbug.com/100462 | 200 // See: crbug.com/100462 |
210 } | 201 } |
211 #endif | 202 #endif |
212 } | 203 } |
213 | 204 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 width, | 683 width, |
693 height, | 684 height, |
694 ystride, | 685 ystride, |
695 uvstride, | 686 uvstride, |
696 astride, | 687 astride, |
697 rgbstride, | 688 rgbstride, |
698 yuv_type); | 689 yuv_type); |
699 } | 690 } |
700 | 691 |
701 } // namespace media | 692 } // namespace media |
OLD | NEW |