| 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 |
| 13 void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe, |
| 14 uint8* yplane, |
| 15 uint8* uplane, |
| 16 uint8* vplane, |
| 17 int width, |
| 18 int height, |
| 19 int rgbstride, |
| 20 int ystride, |
| 21 int uvstride) { |
| 22 #ifdef ENABLE_SUBSAMPLING |
| 23 for (; height >= 2; height -= 2) { |
| 24 ConvertARGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 25 rgbframe += rgbstride; |
| 26 yplane += ystride; |
| 27 |
| 28 ConvertARGBToYUVOdd_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 29 rgbframe += rgbstride; |
| 30 yplane += ystride; |
| 31 |
| 32 uplane += uvstride; |
| 33 vplane += uvstride; |
| 34 } |
| 35 |
| 36 if (height) |
| 37 ConvertARGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 38 #else |
| 39 for (; height >= 2; height -= 2) { |
| 40 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 41 rgbframe += rgbstride; |
| 42 yplane += ystride; |
| 43 |
| 44 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width); |
| 45 rgbframe += rgbstride; |
| 46 yplane += ystride; |
| 47 |
| 48 uplane += uvstride; |
| 49 vplane += uvstride; |
| 50 } |
| 51 |
| 52 if (height) |
| 53 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 54 #endif |
| 55 } |
| 56 |
| 57 void ConvertRGB24ToYUV_SSSE3(const uint8* rgbframe, |
| 58 uint8* yplane, |
| 59 uint8* uplane, |
| 60 uint8* vplane, |
| 61 int width, |
| 62 int height, |
| 63 int rgbstride, |
| 64 int ystride, |
| 65 int uvstride) { |
| 66 #ifdef ENABLE_SUBSAMPLING |
| 67 for (; height >= 2; height -= 2) { |
| 68 ConvertRGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 69 rgbframe += rgbstride; |
| 70 yplane += ystride; |
| 71 |
| 72 ConvertRGBToYUVOdd_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 73 rgbframe += rgbstride; |
| 74 yplane += ystride; |
| 75 |
| 76 uplane += uvstride; |
| 77 vplane += uvstride; |
| 78 } |
| 79 |
| 80 if (height) |
| 81 ConvertRGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 82 #else |
| 83 for (; height >= 2; height -= 2) { |
| 84 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 85 rgbframe += rgbstride; |
| 86 yplane += ystride; |
| 87 |
| 88 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width); |
| 89 rgbframe += rgbstride; |
| 90 yplane += ystride; |
| 91 |
| 92 uplane += uvstride; |
| 93 vplane += uvstride; |
| 94 } |
| 95 |
| 96 if (height) |
| 97 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width); |
| 98 #endif |
| 99 } |
| 100 |
| 101 } // namespace media |
| OLD | NEW |