| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 for (int y = 0; y < scaled_height; ++y) { | 127 for (int y = 0; y < scaled_height; ++y) { |
| 128 uint8* dest_pixel = rgb_buf + y * rgb_pitch; | 128 uint8* dest_pixel = rgb_buf + y * rgb_pitch; |
| 129 int scaled_y = (y * height / scaled_height); | 129 int scaled_y = (y * height / scaled_height); |
| 130 const uint8* y_ptr = y_buf + scaled_y * y_pitch; | 130 const uint8* y_ptr = y_buf + scaled_y * y_pitch; |
| 131 const uint8* u_ptr = u_buf + (scaled_y >> y_shift) * uv_pitch; | 131 const uint8* u_ptr = u_buf + (scaled_y >> y_shift) * uv_pitch; |
| 132 const uint8* v_ptr = v_buf + (scaled_y >> y_shift) * uv_pitch; | 132 const uint8* v_ptr = v_buf + (scaled_y >> y_shift) * uv_pitch; |
| 133 | 133 |
| 134 #if USE_MMX | 134 #if USE_MMX && defined(_MSC_VER) |
| 135 if (scaled_width == (width * 2)) { | 135 if (scaled_width == (width * 2)) { |
| 136 DoubleYUVToRGB32Row(y_ptr, u_ptr, v_ptr, | 136 DoubleYUVToRGB32Row(y_ptr, u_ptr, v_ptr, |
| 137 dest_pixel, scaled_width); | 137 dest_pixel, scaled_width); |
| 138 } else if ((scaled_dx & 15) == 0) { // Scaling by integer scale factor. | 138 } else if ((scaled_dx & 15) == 0) { // Scaling by integer scale factor. |
| 139 if (scaled_dx_uv == scaled_dx) { // Not rotated. | 139 if (scaled_dx_uv == scaled_dx) { // Not rotated. |
| 140 if (scaled_dx == 16) { // Not scaled | 140 if (scaled_dx == 16) { // Not scaled |
| 141 FastConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr, | 141 FastConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr, |
| 142 dest_pixel, scaled_width); | 142 dest_pixel, scaled_width); |
| 143 } else { // Simple scale down. ie half | 143 } else { // Simple scale down. ie half |
| 144 ConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr, | 144 ConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 158 ScaleYUVToRGB32Row(y_ptr, u_ptr, v_ptr, | 158 ScaleYUVToRGB32Row(y_ptr, u_ptr, v_ptr, |
| 159 dest_pixel, scaled_width, scaled_dx); | 159 dest_pixel, scaled_width, scaled_dx); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 // MMX used for FastConvertYUVToRGB32Row requires emms instruction. | 163 // MMX used for FastConvertYUVToRGB32Row requires emms instruction. |
| 164 EMMS(); | 164 EMMS(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace media | 167 } // namespace media |
| OLD | NEW |