| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "media/base/yuv_convert.h" | 5 #include "build/build_config.h" |
| 6 #include "media/base/yuv_convert_internal.h" | 6 #include "media/base/simd/convert_rgb_to_yuv.h" |
| 7 #include "media/base/yuv_row.h" | 7 #include "media/base/simd/yuv_to_rgb_table.h" |
| 8 | 8 |
| 9 #if defined(_MSC_VER) | 9 #if defined(COMPILER_MSVC) |
| 10 #include <intrin.h> | 10 #include <intrin.h> |
| 11 #else | 11 #else |
| 12 #include <mmintrin.h> | 12 #include <mmintrin.h> |
| 13 #include <emmintrin.h> | 13 #include <emmintrin.h> |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 #define FIX_SHIFT 12 | 18 #define FIX_SHIFT 12 |
| 19 #define FIX(x) ((x) * (1 << FIX_SHIFT)) | 19 #define FIX(x) ((x) * (1 << FIX_SHIFT)) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 const uint8* rgb_buf_2, | 78 const uint8* rgb_buf_2, |
| 79 uint8* y_buf_1, | 79 uint8* y_buf_1, |
| 80 uint8* y_buf_2, | 80 uint8* y_buf_2, |
| 81 uint8* u_buf, | 81 uint8* u_buf, |
| 82 uint8* v_buf) { | 82 uint8* v_buf) { |
| 83 int sum_b = 0; | 83 int sum_b = 0; |
| 84 int sum_g = 0; | 84 int sum_g = 0; |
| 85 int sum_r = 0; | 85 int sum_r = 0; |
| 86 int r, g, b; | 86 int r, g, b; |
| 87 | 87 |
| 88 |
| 89 |
| 88 CONVERT_Y(rgb_buf_1, y_buf_1); | 90 CONVERT_Y(rgb_buf_1, y_buf_1); |
| 89 CONVERT_Y(rgb_buf_1, y_buf_1); | 91 CONVERT_Y(rgb_buf_1, y_buf_1); |
| 90 CONVERT_Y(rgb_buf_2, y_buf_2); | 92 CONVERT_Y(rgb_buf_2, y_buf_2); |
| 91 CONVERT_Y(rgb_buf_2, y_buf_2); | 93 CONVERT_Y(rgb_buf_2, y_buf_2); |
| 92 *u_buf++ = RGBToU(sum_r, sum_g, sum_b, 2); | 94 *u_buf++ = RGBToU(sum_r, sum_g, sum_b, 2); |
| 93 *v_buf++ = RGBToV(sum_r, sum_g, sum_b, 2); | 95 *v_buf++ = RGBToV(sum_r, sum_g, sum_b, 2); |
| 94 } | 96 } |
| 95 | 97 |
| 96 static inline void ConvertRGBToYUV_V2H1(const uint8* rgb_buf_1, | 98 static inline void ConvertRGBToYUV_V2H1(const uint8* rgb_buf_1, |
| 97 const uint8* rgb_buf_2, | 99 const uint8* rgb_buf_2, |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 ++vplane; | 383 ++vplane; |
| 382 width -= 2; | 384 width -= 2; |
| 383 } | 385 } |
| 384 | 386 |
| 385 // Handle the last pixel in the last row. | 387 // Handle the last pixel in the last row. |
| 386 if (width) | 388 if (width) |
| 387 ConvertRGBToYUV_V1H1(rgbframe, yplane, uplane, vplane); | 389 ConvertRGBToYUV_V1H1(rgbframe, yplane, uplane, vplane); |
| 388 } | 390 } |
| 389 | 391 |
| 390 } // namespace media | 392 } // namespace media |
| OLD | NEW |