| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/base/simd/convert_rgb_to_yuv.h" |
| 6 |
| 7 #include "build/build_config.h" |
| 8 #include "media/base/cpu_features.h" |
| 9 #include "media/base/simd/convert_rgb_to_yuv_ssse3.h" |
| 10 |
| 11 namespace media { |
| 12 namespace simd { |
| 13 |
| 14 void ConvertRGB32toYUV(const uint8* rgbframe, |
| 15 uint8* yplane, |
| 16 uint8* uplane, |
| 17 uint8* vplane, |
| 18 int width, |
| 19 int height, |
| 20 int rgbstride, |
| 21 int ystride, |
| 22 int uvstride) { |
| 23 #if ENABLE_SUBSAMPLING |
| 24 for (; height >= 2; height -= 2) { |
| 25 ConvertARGBtoYUVEven(rgbframe, yplane, uplane, vplane, width); |
| 26 rgbframe += rgbstride; |
| 27 yplane += ystride; |
| 28 |
| 29 ConvertARGBtoYUVOdd(rgbframe, yplane, uplane, vplane, width); |
| 30 rgbframe += rgbstride; |
| 31 yplane += ystride; |
| 32 |
| 33 uplane += uvstride; |
| 34 vplane += uvstride; |
| 35 } |
| 36 #else |
| 37 for (; height >= 2; height -= 2) { |
| 38 ConvertARGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); |
| 39 rgbframe += rgbstride; |
| 40 yplane += ystride; |
| 41 |
| 42 ConvertARGBtoYUVRow(rgbframe, yplane, NULL, NULL, width); |
| 43 rgbframe += rgbstride; |
| 44 yplane += ystride; |
| 45 |
| 46 uplane += uvstride; |
| 47 vplane += uvstride; |
| 48 } |
| 49 #endif |
| 50 |
| 51 if (height) |
| 52 ConvertARGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); |
| 53 } |
| 54 |
| 55 void ConvertRGB24toYUV(const uint8* rgbframe, |
| 56 uint8* yplane, |
| 57 uint8* uplane, |
| 58 uint8* vplane, |
| 59 int width, |
| 60 int height, |
| 61 int rgbstride, |
| 62 int ystride, |
| 63 int uvstride) { |
| 64 #if ENABLE_SUBSAMPLING |
| 65 for (; height >= 2; height -= 2) { |
| 66 ConvertRGBtoYUVEven(rgbframe, yplane, uplane, vplane, width); |
| 67 rgbframe += rgbstride; |
| 68 yplane += ystride; |
| 69 |
| 70 ConvertRGBtoYUVOdd(rgbframe, yplane, uplane, vplane, width); |
| 71 rgbframe += rgbstride; |
| 72 yplane += ystride; |
| 73 |
| 74 uplane += uvstride; |
| 75 vplane += uvstride; |
| 76 } |
| 77 #else |
| 78 for (; height >= 2; height -= 2) { |
| 79 ConvertRGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); |
| 80 rgbframe += rgbstride; |
| 81 yplane += ystride; |
| 82 |
| 83 ConvertRGBtoYUVRow(rgbframe, yplane, NULL, NULL, width); |
| 84 rgbframe += rgbstride; |
| 85 yplane += ystride; |
| 86 |
| 87 uplane += uvstride; |
| 88 vplane += uvstride; |
| 89 } |
| 90 #endif |
| 91 |
| 92 if (height) |
| 93 ConvertRGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); |
| 94 } |
| 95 |
| 96 } // namespace simd |
| 97 } // namespace media |
| OLD | NEW |