Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
|
Alpha Left Google
2011/08/22 14:16:59
These functions should be defined in yuv_convert_s
| |
| 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/yuv_convert.h" | |
| 6 | |
| 7 #include "build/build_config.h" | |
| 8 #include "media/base/cpu_features.h" | |
| 9 #include "media/base/simd/yuv_row.h" | |
| 10 | |
| 11 namespace media { | |
| 12 | |
| 13 namespace simd { | |
| 14 | |
| 15 void ConvertRGB32toYUV(const uint8* rgbframe, | |
|
Alpha Left Google
2011/08/22 14:16:59
Call this ConvertRGB32toYUV_SSE2, you can call the
| |
| 16 uint8* yplane, | |
| 17 uint8* uplane, | |
| 18 uint8* vplane, | |
| 19 int width, | |
| 20 int height, | |
| 21 int rgbstride, | |
| 22 int ystride, | |
| 23 int uvstride) { | |
| 24 for (; height >= 2; height -= 2) { | |
| 25 ConvertARGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); | |
| 26 rgbframe += rgbstride; | |
| 27 yplane += ystride; | |
| 28 | |
| 29 ConvertARGBtoYUVRow(rgbframe, yplane, NULL, NULL, width); | |
| 30 rgbframe += rgbstride; | |
| 31 yplane += ystride; | |
| 32 | |
| 33 uplane += uvstride; | |
| 34 vplane += uvstride; | |
| 35 } | |
| 36 | |
| 37 if (height) | |
| 38 ConvertARGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); | |
| 39 } | |
| 40 | |
| 41 void ConvertRGB24toYUV(const uint8* rgbframe, | |
|
Alpha Left Google
2011/08/22 14:16:59
Same for this one, call it ConvertRGB24toYUV_SSE2
| |
| 42 uint8* yplane, | |
| 43 uint8* uplane, | |
| 44 uint8* vplane, | |
| 45 int width, | |
| 46 int height, | |
| 47 int rgbstride, | |
| 48 int ystride, | |
| 49 int uvstride) { | |
| 50 for (; height >= 2; height -= 2) { | |
| 51 ConvertRGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); | |
| 52 rgbframe += rgbstride; | |
| 53 yplane += ystride; | |
| 54 | |
| 55 ConvertRGBtoYUVRow(rgbframe, yplane, NULL, NULL, width); | |
| 56 rgbframe += rgbstride; | |
| 57 yplane += ystride; | |
| 58 | |
| 59 uplane += uvstride; | |
| 60 vplane += uvstride; | |
| 61 } | |
| 62 | |
| 63 if (height) | |
| 64 ConvertARGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); | |
| 65 } | |
| 66 | |
| 67 void ConvertYUVtoRGB32(const uint8* y_buf, | |
|
Alpha Left Google
2011/08/22 14:16:59
Call this ConvertYUVtoRGB32_SSE2.
| |
| 68 const uint8* u_buf, | |
| 69 const uint8* v_buf, | |
| 70 uint8* rgb_buf, | |
| 71 int width, | |
| 72 int height, | |
| 73 int y_pitch, | |
| 74 int uv_pitch, | |
| 75 int rgb_pitch, | |
| 76 YUVType yuv_type) { | |
| 77 if (yuv_type == YV12) { | |
|
Alpha Left Google
2011/08/22 14:16:59
Please this use construct:
if (yuv_type != YV12)
| |
| 78 for (; height >= 2; height -= 2) { | |
| 79 ConvertYUVtoARGBRow(y_buf, u_buf, v_buf, rgb_buf, width); | |
| 80 rgb_buf += rgb_pitch; | |
| 81 y_buf += y_pitch; | |
| 82 | |
| 83 ConvertYUVtoARGBRow(y_buf, u_buf, v_buf, rgb_buf, width); | |
| 84 rgb_buf += rgb_pitch; | |
| 85 y_buf += y_pitch; | |
| 86 | |
| 87 u_buf += uv_pitch; | |
| 88 v_buf += uv_pitch; | |
| 89 } | |
| 90 | |
| 91 if (height) | |
| 92 ConvertYUVtoARGBRow(y_buf, u_buf, v_buf, rgb_buf, width); | |
| 93 } else { | |
| 94 } | |
| 95 } | |
| 96 | |
| 97 void ConvertYUVtoRGB24(const uint8* y_buf, | |
|
Alpha Left Google
2011/08/22 14:16:59
Call this ConvertYUVtoRGB24_SSE2.
| |
| 98 const uint8* u_buf, | |
| 99 const uint8* v_buf, | |
| 100 uint8* rgb_buf, | |
| 101 int width, | |
| 102 int height, | |
| 103 int y_pitch, | |
| 104 int uv_pitch, | |
| 105 int rgb_pitch, | |
| 106 YUVType yuv_type) { | |
| 107 if (yuv_type == YV12) { | |
|
Alpha Left Google
2011/08/22 14:16:59
Please this use construct:
if (yuv_type != YV12)
| |
| 108 for (; height >= 2; height -= 2) { | |
| 109 ConvertYUVtoRGBRow(y_buf, u_buf, v_buf, rgb_buf, width); | |
| 110 rgb_buf += rgb_pitch; | |
| 111 y_buf += y_pitch; | |
| 112 | |
| 113 ConvertYUVtoRGBRow(y_buf, u_buf, v_buf, rgb_buf, width); | |
| 114 rgb_buf += rgb_pitch; | |
| 115 y_buf += y_pitch; | |
| 116 | |
| 117 u_buf += uv_pitch; | |
| 118 v_buf += uv_pitch; | |
| 119 } | |
| 120 | |
| 121 if (height) | |
| 122 ConvertYUVtoRGBRow(y_buf, u_buf, v_buf, rgb_buf, width); | |
| 123 } else { | |
| 124 } | |
| 125 } | |
| 126 | |
| 127 } // namespace simd | |
| 128 | |
| 129 } // namespace media | |
| OLD | NEW |