diff options
author | rileya@chromium.org <rileya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-04 01:05:51 +0000 |
---|---|---|
committer | rileya@chromium.org <rileya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-04 01:05:51 +0000 |
commit | 6be9232bbdf56b40bbb107923827de925d34049a (patch) | |
tree | f434fce4139c781ed5386b2594636896e81a8850 /media/base | |
parent | 9630731e7c4bec5722917760a04b56d34da460da (diff) | |
download | chromium_src-6be9232bbdf56b40bbb107923827de925d34049a.zip chromium_src-6be9232bbdf56b40bbb107923827de925d34049a.tar.gz chromium_src-6be9232bbdf56b40bbb107923827de925d34049a.tar.bz2 |
Re-land: Add correct support for videos with YUVJ420P color format, in the software conversion path (https://codereview.chromium.org/242643011/).
Fixes media_perftests on linux-clang-dbg.
BUG=172898
TBR=scherkus
Review URL: https://codereview.chromium.org/267933005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
21 files changed, 601 insertions, 157 deletions
diff --git a/media/base/simd/convert_yuv_to_rgb.h b/media/base/simd/convert_yuv_to_rgb.h index 2991d56..6c0a966 100644 --- a/media/base/simd/convert_yuv_to_rgb.h +++ b/media/base/simd/convert_yuv_to_rgb.h @@ -28,7 +28,8 @@ MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8* yplane, const uint8* uplane, const uint8* vplane, uint8* rgbframe, - ptrdiff_t width); + ptrdiff_t width, + const int16 convert_table[1024][4]); MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane, const uint8* uplane, @@ -48,7 +49,8 @@ MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane, const uint8* vplane, const uint8* aplane, uint8* rgbframe, - ptrdiff_t width); + ptrdiff_t width, + const int16 convert_table[1024][4]); MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane, const uint8* uplane, @@ -90,22 +92,27 @@ MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf, const uint8* v_buf, uint8* rgb_buf, ptrdiff_t width, - ptrdiff_t source_dx); - -MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - ptrdiff_t width, - ptrdiff_t source_dx); - -MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - int dest_width, - int source_x, - int source_dx); + ptrdiff_t source_dx, + const int16 convert_table[1024][4]); + +MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C( + const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + uint8* rgb_buf, + ptrdiff_t width, + ptrdiff_t source_dx, + const int16 convert_table[1024][4]); + +MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C( + const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + uint8* rgb_buf, + int dest_width, + int source_x, + int source_dx, + const int16 convert_table[1024][4]); } // namespace media @@ -123,62 +130,75 @@ MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8* yplane, const uint8* uplane, const uint8* vplane, uint8* rgbframe, - ptrdiff_t width); + ptrdiff_t width, + const int16 convert_table[1024][4]); MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane, const uint8* uplane, const uint8* vplane, const uint8* aplane, uint8* rgbframe, - ptrdiff_t width); + ptrdiff_t width, + const int16 convert_table[1024][4]); MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane, const uint8* uplane, const uint8* vplane, uint8* rgbframe, - ptrdiff_t width); + ptrdiff_t width, + const int16 convert_table[1024][4]); MEDIA_EXPORT void ScaleYUVToRGB32Row_MMX(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, ptrdiff_t width, - ptrdiff_t source_dx); + ptrdiff_t source_dx, + const int16 convert_table[1024][4]); MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, ptrdiff_t width, - ptrdiff_t source_dx); - -MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - ptrdiff_t width, - ptrdiff_t source_dx); - -MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - ptrdiff_t width, - ptrdiff_t source_dx); - -MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - ptrdiff_t width, - ptrdiff_t source_dx); - -MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - ptrdiff_t width, - ptrdiff_t source_dx); + ptrdiff_t source_dx, + const int16 convert_table[1024][4]); + +MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64( + const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + uint8* rgb_buf, + ptrdiff_t width, + ptrdiff_t source_dx, + const int16 convert_table[1024][4]); + +MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX( + const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + uint8* rgb_buf, + ptrdiff_t width, + ptrdiff_t source_dx, + const int16 convert_table[1024][4]); + +MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE( + const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + uint8* rgb_buf, + ptrdiff_t width, + ptrdiff_t source_dx, + const int16 convert_table[1024][4]); + +MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64( + const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + uint8* rgb_buf, + ptrdiff_t width, + ptrdiff_t source_dx, + const int16 convert_table[1024][4]); } // extern "C" diff --git a/media/base/simd/convert_yuv_to_rgb_c.cc b/media/base/simd/convert_yuv_to_rgb_c.cc index 0466112..9d6476b 100644 --- a/media/base/simd/convert_yuv_to_rgb_c.cc +++ b/media/base/simd/convert_yuv_to_rgb_c.cc @@ -38,21 +38,22 @@ namespace media { static inline void ConvertYUVToRGB32_C(uint8 y, uint8 u, uint8 v, - uint8* rgb_buf) { - int b = kCoefficientsRgbY[256+u][B_INDEX]; - int g = kCoefficientsRgbY[256+u][G_INDEX]; - int r = kCoefficientsRgbY[256+u][R_INDEX]; - int a = kCoefficientsRgbY[256+u][A_INDEX]; + uint8* rgb_buf, + const int16 convert_table[1024][4]) { + int b = convert_table[256+u][B_INDEX]; + int g = convert_table[256+u][G_INDEX]; + int r = convert_table[256+u][R_INDEX]; + int a = convert_table[256+u][A_INDEX]; - b = paddsw(b, kCoefficientsRgbY[512+v][B_INDEX]); - g = paddsw(g, kCoefficientsRgbY[512+v][G_INDEX]); - r = paddsw(r, kCoefficientsRgbY[512+v][R_INDEX]); - a = paddsw(a, kCoefficientsRgbY[512+v][A_INDEX]); + b = paddsw(b, convert_table[512+v][B_INDEX]); + g = paddsw(g, convert_table[512+v][G_INDEX]); + r = paddsw(r, convert_table[512+v][R_INDEX]); + a = paddsw(a, convert_table[512+v][A_INDEX]); - b = paddsw(b, kCoefficientsRgbY[y][B_INDEX]); - g = paddsw(g, kCoefficientsRgbY[y][G_INDEX]); - r = paddsw(r, kCoefficientsRgbY[y][R_INDEX]); - a = paddsw(a, kCoefficientsRgbY[y][A_INDEX]); + b = paddsw(b, convert_table[y][B_INDEX]); + g = paddsw(g, convert_table[y][G_INDEX]); + r = paddsw(r, convert_table[y][R_INDEX]); + a = paddsw(a, convert_table[y][A_INDEX]); b >>= 6; g >>= 6; @@ -69,18 +70,19 @@ static inline void ConvertYUVAToARGB_C(uint8 y, uint8 u, uint8 v, uint8 a, - uint8* rgb_buf) { - int b = kCoefficientsRgbY[256+u][0]; - int g = kCoefficientsRgbY[256+u][1]; - int r = kCoefficientsRgbY[256+u][2]; + uint8* rgb_buf, + const int16 convert_table[1024][4]) { + int b = convert_table[256+u][0]; + int g = convert_table[256+u][1]; + int r = convert_table[256+u][2]; - b = paddsw(b, kCoefficientsRgbY[512+v][0]); - g = paddsw(g, kCoefficientsRgbY[512+v][1]); - r = paddsw(r, kCoefficientsRgbY[512+v][2]); + b = paddsw(b, convert_table[512+v][0]); + g = paddsw(g, convert_table[512+v][1]); + r = paddsw(r, convert_table[512+v][2]); - b = paddsw(b, kCoefficientsRgbY[y][0]); - g = paddsw(g, kCoefficientsRgbY[y][1]); - r = paddsw(r, kCoefficientsRgbY[y][2]); + b = paddsw(b, convert_table[y][0]); + g = paddsw(g, convert_table[y][1]); + r = paddsw(r, convert_table[y][2]); b >>= 6; g >>= 6; @@ -100,15 +102,16 @@ void ConvertYUVToRGB32Row_C(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - ptrdiff_t width) { + ptrdiff_t width, + const int16 convert_table[1024][4]) { for (int x = 0; x < width; x += 2) { uint8 u = u_buf[x >> 1]; uint8 v = v_buf[x >> 1]; uint8 y0 = y_buf[x]; - ConvertYUVToRGB32_C(y0, u, v, rgb_buf); + ConvertYUVToRGB32_C(y0, u, v, rgb_buf, convert_table); if ((x + 1) < width) { uint8 y1 = y_buf[x + 1]; - ConvertYUVToRGB32_C(y1, u, v, rgb_buf + 4); + ConvertYUVToRGB32_C(y1, u, v, rgb_buf + 4, convert_table); } rgb_buf += 8; // Advance 2 pixels. } @@ -119,17 +122,18 @@ void ConvertYUVAToARGBRow_C(const uint8* y_buf, const uint8* v_buf, const uint8* a_buf, uint8* rgba_buf, - ptrdiff_t width) { + ptrdiff_t width, + const int16 convert_table[1024][4]) { for (int x = 0; x < width; x += 2) { uint8 u = u_buf[x >> 1]; uint8 v = v_buf[x >> 1]; uint8 y0 = y_buf[x]; uint8 a0 = a_buf[x]; - ConvertYUVAToARGB_C(y0, u, v, a0, rgba_buf); + ConvertYUVAToARGB_C(y0, u, v, a0, rgba_buf, convert_table); if ((x + 1) < width) { uint8 y1 = y_buf[x + 1]; uint8 a1 = a_buf[x + 1]; - ConvertYUVAToARGB_C(y1, u, v, a1, rgba_buf + 4); + ConvertYUVAToARGB_C(y1, u, v, a1, rgba_buf + 4, convert_table); } rgba_buf += 8; // Advance 2 pixels. } @@ -144,17 +148,18 @@ void ScaleYUVToRGB32Row_C(const uint8* y_buf, const uint8* v_buf, uint8* rgb_buf, ptrdiff_t width, - ptrdiff_t source_dx) { + ptrdiff_t source_dx, + const int16 convert_table[1024][4]) { int x = 0; for (int i = 0; i < width; i += 2) { int y = y_buf[x >> 16]; int u = u_buf[(x >> 17)]; int v = v_buf[(x >> 17)]; - ConvertYUVToRGB32_C(y, u, v, rgb_buf); + ConvertYUVToRGB32_C(y, u, v, rgb_buf, convert_table); x += source_dx; if ((i + 1) < width) { y = y_buf[x >> 16]; - ConvertYUVToRGB32_C(y, u, v, rgb_buf+4); + ConvertYUVToRGB32_C(y, u, v, rgb_buf+4, convert_table); x += source_dx; } rgb_buf += 8; @@ -166,13 +171,14 @@ void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, const uint8* v_buf, uint8* rgb_buf, ptrdiff_t width, - ptrdiff_t source_dx) { + ptrdiff_t source_dx, + const int16 convert_table[1024][4]) { // Avoid point-sampling for down-scaling by > 2:1. int source_x = 0; if (source_dx >= 0x20000) source_x += 0x8000; LinearScaleYUVToRGB32RowWithRange_C(y_buf, u_buf, v_buf, rgb_buf, width, - source_x, source_dx); + source_x, source_dx, convert_table); } void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, @@ -181,7 +187,8 @@ void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, uint8* rgb_buf, int dest_width, int x, - int source_dx) { + int source_dx, + const int16 convert_table[1024][4]) { for (int i = 0; i < dest_width; i += 2) { int y0 = y_buf[x >> 16]; int y1 = y_buf[(x >> 16) + 1]; @@ -194,14 +201,14 @@ void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, int y = (y_frac * y1 + (y_frac ^ 65535) * y0) >> 16; int u = (uv_frac * u1 + (uv_frac ^ 65535) * u0) >> 16; int v = (uv_frac * v1 + (uv_frac ^ 65535) * v0) >> 16; - ConvertYUVToRGB32_C(y, u, v, rgb_buf); + ConvertYUVToRGB32_C(y, u, v, rgb_buf, convert_table); x += source_dx; if ((i + 1) < dest_width) { y0 = y_buf[x >> 16]; y1 = y_buf[(x >> 16) + 1]; y_frac = (x & 65535); y = (y_frac * y1 + (y_frac ^ 65535) * y0) >> 16; - ConvertYUVToRGB32_C(y, u, v, rgb_buf+4); + ConvertYUVToRGB32_C(y, u, v, rgb_buf+4, convert_table); x += source_dx; } rgb_buf += 8; @@ -218,7 +225,7 @@ void ConvertYUVToRGB32_C(const uint8* yplane, int uvstride, int rgbstride, YUVType yuv_type) { - unsigned int y_shift = yuv_type; + unsigned int y_shift = GetVerticalShift(yuv_type); for (int y = 0; y < height; ++y) { uint8* rgb_row = rgbframe + y * rgbstride; const uint8* y_ptr = yplane + y * ystride; @@ -229,7 +236,8 @@ void ConvertYUVToRGB32_C(const uint8* yplane, u_ptr, v_ptr, rgb_row, - width); + width, + GetLookupTable(yuv_type)); } } @@ -258,7 +266,8 @@ void ConvertYUVAToARGB_C(const uint8* yplane, v_ptr, a_ptr, rgba_row, - width); + width, + GetLookupTable(yuv_type)); } } diff --git a/media/base/simd/convert_yuv_to_rgb_mmx.asm b/media/base/simd/convert_yuv_to_rgb_mmx.asm index 39a4f75..7395419 100644 --- a/media/base/simd/convert_yuv_to_rgb_mmx.asm +++ b/media/base/simd/convert_yuv_to_rgb_mmx.asm @@ -17,6 +17,7 @@ ; const uint8* u_buf, ; const uint8* v_buf, ; uint8* rgb_buf, -; ptrdiff_t width); +; ptrdiff_t width, +; const int16 convert_table[1024][4]); %define SYMBOL ConvertYUVToRGB32Row_MMX %include "convert_yuv_to_rgb_mmx.inc" diff --git a/media/base/simd/convert_yuv_to_rgb_mmx.inc b/media/base/simd/convert_yuv_to_rgb_mmx.inc index f143574..4b69d1b 100644 --- a/media/base/simd/convert_yuv_to_rgb_mmx.inc +++ b/media/base/simd/convert_yuv_to_rgb_mmx.inc @@ -9,10 +9,7 @@ mangle(SYMBOL): %assign stack_offset 0 - PROLOGUE 5, 7, 3, Y, U, V, ARGB, WIDTH, TEMP, TABLE - - extern mangle(kCoefficientsRgbY) - LOAD_SYM TABLEq, mangle(kCoefficientsRgbY) + PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, TABLE, TEMP jmp .convertend diff --git a/media/base/simd/convert_yuv_to_rgb_sse.asm b/media/base/simd/convert_yuv_to_rgb_sse.asm index 8b3ee58..44b123f 100644 --- a/media/base/simd/convert_yuv_to_rgb_sse.asm +++ b/media/base/simd/convert_yuv_to_rgb_sse.asm @@ -19,5 +19,6 @@ ; const uint8* v_buf, ; uint8* rgb_buf, ; ptrdiff_t width); +; const int16 convert_table[1024][4]); %define SYMBOL ConvertYUVToRGB32Row_SSE %include "convert_yuv_to_rgb_mmx.inc" diff --git a/media/base/simd/convert_yuv_to_rgb_x86.cc b/media/base/simd/convert_yuv_to_rgb_x86.cc index d1d6e16..969890d 100644 --- a/media/base/simd/convert_yuv_to_rgb_x86.cc +++ b/media/base/simd/convert_yuv_to_rgb_x86.cc @@ -9,6 +9,7 @@ #endif #include "media/base/simd/convert_yuv_to_rgb.h" +#include "media/base/simd/yuv_to_rgb_table.h" #include "media/base/yuv_convert.h" namespace media { @@ -23,7 +24,7 @@ void ConvertYUVToRGB32_MMX(const uint8* yplane, int uvstride, int rgbstride, YUVType yuv_type) { - unsigned int y_shift = yuv_type; + unsigned int y_shift = GetVerticalShift(yuv_type); for (int y = 0; y < height; ++y) { uint8* rgb_row = rgbframe + y * rgbstride; const uint8* y_ptr = yplane + y * ystride; @@ -34,7 +35,8 @@ void ConvertYUVToRGB32_MMX(const uint8* yplane, u_ptr, v_ptr, rgb_row, - width); + width, + GetLookupTable(yuv_type)); } EmptyRegisterState(); @@ -52,7 +54,7 @@ void ConvertYUVAToARGB_MMX(const uint8* yplane, int astride, int rgbstride, YUVType yuv_type) { - unsigned int y_shift = yuv_type; + unsigned int y_shift = GetVerticalShift(yuv_type); for (int y = 0; y < height; ++y) { uint8* rgb_row = rgbframe + y * rgbstride; const uint8* y_ptr = yplane + y * ystride; @@ -65,7 +67,8 @@ void ConvertYUVAToARGB_MMX(const uint8* yplane, v_ptr, a_ptr, rgb_row, - width); + width, + GetLookupTable(yuv_type)); } EmptyRegisterState(); @@ -81,7 +84,7 @@ void ConvertYUVToRGB32_SSE(const uint8* yplane, int uvstride, int rgbstride, YUVType yuv_type) { - unsigned int y_shift = yuv_type; + unsigned int y_shift = GetVerticalShift(yuv_type); for (int y = 0; y < height; ++y) { uint8* rgb_row = rgbframe + y * rgbstride; const uint8* y_ptr = yplane + y * ystride; @@ -92,7 +95,8 @@ void ConvertYUVToRGB32_SSE(const uint8* yplane, u_ptr, v_ptr, rgb_row, - width); + width, + GetLookupTable(yuv_type)); } EmptyRegisterState(); diff --git a/media/base/simd/convert_yuva_to_argb_mmx.asm b/media/base/simd/convert_yuva_to_argb_mmx.asm index b39315dc..395f326 100644 --- a/media/base/simd/convert_yuva_to_argb_mmx.asm +++ b/media/base/simd/convert_yuva_to_argb_mmx.asm @@ -19,5 +19,6 @@ ; const uint8* a_buf, ; uint8* rgb_buf, ; ptrdiff_t width); +; const int16 convert_table[1024][4]); %define SYMBOL ConvertYUVAToARGBRow_MMX %include "convert_yuva_to_argb_mmx.inc" diff --git a/media/base/simd/convert_yuva_to_argb_mmx.inc b/media/base/simd/convert_yuva_to_argb_mmx.inc index 2e9e62d..5faa6a5 100644 --- a/media/base/simd/convert_yuva_to_argb_mmx.inc +++ b/media/base/simd/convert_yuva_to_argb_mmx.inc @@ -9,11 +9,9 @@ mangle(SYMBOL): %assign stack_offset 0 - PROLOGUE 6, 7, 3, Y, U, V, A, ARGB, WIDTH, TEMP - extern mangle(kCoefficientsRgbY) + PROLOGUE 7, 7, 3, Y, U, V, A, ARGB, WIDTH, TABLE, TEMP PUSH WIDTHq DEFINE_ARGS Y, U, V, A, ARGB, TABLE, TEMP - LOAD_SYM TABLEq, mangle(kCoefficientsRgbY) jmp .convertend .convertloop: diff --git a/media/base/simd/linear_scale_yuv_to_rgb_mmx.asm b/media/base/simd/linear_scale_yuv_to_rgb_mmx.asm index 4041834..bf2f708 100644 --- a/media/base/simd/linear_scale_yuv_to_rgb_mmx.asm +++ b/media/base/simd/linear_scale_yuv_to_rgb_mmx.asm @@ -19,5 +19,6 @@ ; uint8* rgb_buf, ; ptrdiff_t width, ; ptrdiff_t source_dx); +; const int16 convert_table[1024][4]); %define SYMBOL LinearScaleYUVToRGB32Row_MMX %include "linear_scale_yuv_to_rgb_mmx.inc" diff --git a/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc b/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc index dce591d..48f62ac 100644 --- a/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc +++ b/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc @@ -10,8 +10,6 @@ mangle(SYMBOL): %assign stack_offset 0 - extern mangle(kCoefficientsRgbY) - ; Parameters are in the following order: ; 1. Y plane ; 2. U plane @@ -19,8 +17,9 @@ mangle(SYMBOL): ; 4. ARGB frame ; 5. Width ; 6. Source dx +; 7. Conversion lookup table -PROLOGUE 6, 7, 3, Y, R0, R1, ARGB, R2, R3, TEMP +PROLOGUE 7, 7, 3, Y, R0, R1, ARGB, R2, TEMP, R3 %if gprsize == 8 %define WORD_SIZE QWORD @@ -34,7 +33,7 @@ PROLOGUE 6, 7, 3, Y, R0, R1, ARGB, R2, R3, TEMP %define COMPLd R2d ; Component A value %define U_ARG_REGq R0q ; U plane address argument %define V_ARG_REGq R1q ; V plane address argument -%define SOURCE_DX_ARG_REGq R3q ; Source dx argument +%define SOURCE_DX_ARG_REGq TEMPq ; Source dx argument %define WIDTH_ARG_REGq R2q ; Width argument %define COMPRq R0q ; Component B value @@ -56,11 +55,6 @@ PROLOGUE 6, 7, 3, Y, R0, R1, ARGB, R2, R3, TEMP imul WIDTH_ARG_REGq, SOURCE_DX_ARG_REGq ; source_width = width * source_dx PUSH WIDTH_ARG_REGq -; Load the address of kCoefficientsRgbY into TABLE - mov TEMPq, SOURCE_DX_ARG_REGq ; Need to save source_dx first - LOAD_SYM TABLE, mangle(kCoefficientsRgbY) -%define SOURCE_DX_ARG_REGq TEMPq ; Overwrite SOURCE_DX_ARG_REGq to TEMPq - %macro EPILOGUE 0 ADD rsp, 4 * gprsize %endmacro diff --git a/media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm b/media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm index f7e1d90..89e4e2a 100644 --- a/media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm +++ b/media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm @@ -32,8 +32,9 @@ mangle(SYMBOL): ; 4. ARGB frame ; 5. Width ; 6. Source dx +; 7. Conversion lookup table -PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, COMPL +PROLOGUE 7, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, R1 %define TABLEq r10 %define Xq r11 @@ -41,6 +42,9 @@ PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, COMPL %define COMPRd r13d %define COMPRq r13 %define FRACTIONq r14 +%define COMPL R1 +%define COMPLq R1q +%define COMPLd R1d PUSH TABLEq PUSH Xq @@ -56,7 +60,7 @@ PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, COMPL POP TABLEq %endmacro - LOAD_SYM TABLEq, mangle(kCoefficientsRgbY) + mov TABLEq, R1q imul WIDTHq, SOURCE_DXq ; source_width = width * source_dx xor Xq, Xq ; x = 0 diff --git a/media/base/simd/scale_yuv_to_rgb_mmx.asm b/media/base/simd/scale_yuv_to_rgb_mmx.asm index 583b7cb..1223651 100644 --- a/media/base/simd/scale_yuv_to_rgb_mmx.asm +++ b/media/base/simd/scale_yuv_to_rgb_mmx.asm @@ -19,5 +19,6 @@ ; uint8* rgb_buf, ; ptrdiff_t width, ; ptrdiff_t source_dx); +; const int16 convert_table[1024][4]); %define SYMBOL ScaleYUVToRGB32Row_MMX %include "scale_yuv_to_rgb_mmx.inc" diff --git a/media/base/simd/scale_yuv_to_rgb_mmx.inc b/media/base/simd/scale_yuv_to_rgb_mmx.inc index a599b0c..60351db 100644 --- a/media/base/simd/scale_yuv_to_rgb_mmx.inc +++ b/media/base/simd/scale_yuv_to_rgb_mmx.inc @@ -19,8 +19,9 @@ mangle(SYMBOL): ; 4. ARGB frame ; 5. Width ; 6. Source dx +; 7. Lookup table address -PROLOGUE 6, 7, 3, Y, U, V, ARGB, R1, R2, TEMP +PROLOGUE 7, 7, 3, Y, U, V, ARGB, R1, R2, TEMP %ifdef ARCH_X86_64 %define WORD_SIZE QWORD @@ -33,10 +34,11 @@ PROLOGUE 6, 7, 3, Y, U, V, ARGB, R1, R2, TEMP %define SOURCE_DX WORD_SIZE [rsp] - LOAD_SYM R1q, mangle(kCoefficientsRgbY) + mov R1q, TEMPq + %define WIDTH WORD_SIZE [rsp + gprsize] %define TABLE R1q -%define Xq R2q +%define Xq R2q ; Set Xq index to 0. xor Xq, Xq diff --git a/media/base/simd/scale_yuv_to_rgb_sse.asm b/media/base/simd/scale_yuv_to_rgb_sse.asm index 536ed18..fc98bbe 100644 --- a/media/base/simd/scale_yuv_to_rgb_sse.asm +++ b/media/base/simd/scale_yuv_to_rgb_sse.asm @@ -19,5 +19,6 @@ ; uint8* rgb_buf, ; ptrdiff_t width, ; ptrdiff_t source_dx); +; const int16 convert_table[1024][4]); %define SYMBOL ScaleYUVToRGB32Row_SSE %include "scale_yuv_to_rgb_mmx.inc" diff --git a/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm b/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm index d678687..cf0d140 100644 --- a/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm +++ b/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm @@ -32,17 +32,21 @@ mangle(SYMBOL): ; 4. ARGB frame ; 5. Width ; 6. Source dx +; 7. Convert table -PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, COMP +PROLOGUE 7, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, R1 %define TABLEq r10 %define Xq r11 %define INDEXq r12 +%define COMPq R1q +%define COMPd R1d + PUSH r10 PUSH r11 PUSH r12 - LOAD_SYM TABLEq, mangle(kCoefficientsRgbY) + mov TABLEq, R1q ; Set Xq index to 0. xor Xq, Xq diff --git a/media/base/simd/yuv_to_rgb_table.cc b/media/base/simd/yuv_to_rgb_table.cc index 253280d..5bc35af 100644 --- a/media/base/simd/yuv_to_rgb_table.cc +++ b/media/base/simd/yuv_to_rgb_table.cc @@ -335,4 +335,335 @@ SIMD_ALIGNED(const int16 kCoefficientsRgbY[256 * 4][4]) = { #undef RGBV #undef ALPHA +// JPEG color range version: + +// Defines the R,G,B,A contributions from Y. +#define RGBY(i) { \ + static_cast<int16>(64 * i + 0.5), \ + static_cast<int16>(64 * i + 0.5), \ + static_cast<int16>(64 * i + 0.5), \ + 0 \ +} + +// Defines the R,G,B,A contributions from U. +// The contribution to A is the same for any value of U +// causing the final A value to be 255 in every conversion. +// Android's pixel layout is RGBA, while other platforms +// are BGRA. +#if defined(OS_ANDROID) +#define RGBU(i) { \ + 0, \ + static_cast<int16>(-0.34414 * 64 * (i - 128) + 0.5), \ + static_cast<int16>(1.772 * 64 * (i - 128) + 0.5), \ + static_cast<int16>(256 * 64 - 1) \ +} +#else +#define RGBU(i) { \ + static_cast<int16>(1.772 * 64 * (i - 128) + 0.5), \ + static_cast<int16>(-0.34414 * 64 * (i - 128) + 0.5), \ + 0, \ + static_cast<int16>(256 * 64 - 1) \ +} +#endif + +// Defines the R,G,B,A contributions from V. +// Android's pixel layout is RGBA, while other platforms +// are BGRA. +#if defined(OS_ANDROID) +#define RGBV(i) { \ + static_cast<int16>(1.402 * 64 * (i - 128) + 0.5), \ + static_cast<int16>(-0.71414 * 64 * (i - 128) + 0.5), \ + 0, \ + 0 \ +} +#else +#define RGBV(i) { \ + 0, \ + static_cast<int16>(-0.813 * 64 * (i - 128) + 0.5), \ + static_cast<int16>(1.402 * 64 * (i - 128) + 0.5), \ + 0 \ +} +#endif + +// Used to define a set of multiplier words for each alpha level. +#define ALPHA(i) { \ + i, i, i, i \ +} + +// The following table defines the RGBA contributions +// for each component of YUVA. The Y table is first followed +// by the U, and V tables. The alpha multiplier table follows. +// These tables are aligned and kept adjacent to optimize for +// SIMD and caching. + +SIMD_ALIGNED(const int16 kCoefficientsRgbY_JPEG[256 * 4][4]) = { + RGBY(0x00), RGBY(0x01), RGBY(0x02), RGBY(0x03), + RGBY(0x04), RGBY(0x05), RGBY(0x06), RGBY(0x07), + RGBY(0x08), RGBY(0x09), RGBY(0x0A), RGBY(0x0B), + RGBY(0x0C), RGBY(0x0D), RGBY(0x0E), RGBY(0x0F), + RGBY(0x10), RGBY(0x11), RGBY(0x12), RGBY(0x13), + RGBY(0x14), RGBY(0x15), RGBY(0x16), RGBY(0x17), + RGBY(0x18), RGBY(0x19), RGBY(0x1A), RGBY(0x1B), + RGBY(0x1C), RGBY(0x1D), RGBY(0x1E), RGBY(0x1F), + RGBY(0x20), RGBY(0x21), RGBY(0x22), RGBY(0x23), + RGBY(0x24), RGBY(0x25), RGBY(0x26), RGBY(0x27), + RGBY(0x28), RGBY(0x29), RGBY(0x2A), RGBY(0x2B), + RGBY(0x2C), RGBY(0x2D), RGBY(0x2E), RGBY(0x2F), + RGBY(0x30), RGBY(0x31), RGBY(0x32), RGBY(0x33), + RGBY(0x34), RGBY(0x35), RGBY(0x36), RGBY(0x37), + RGBY(0x38), RGBY(0x39), RGBY(0x3A), RGBY(0x3B), + RGBY(0x3C), RGBY(0x3D), RGBY(0x3E), RGBY(0x3F), + RGBY(0x40), RGBY(0x41), RGBY(0x42), RGBY(0x43), + RGBY(0x44), RGBY(0x45), RGBY(0x46), RGBY(0x47), + RGBY(0x48), RGBY(0x49), RGBY(0x4A), RGBY(0x4B), + RGBY(0x4C), RGBY(0x4D), RGBY(0x4E), RGBY(0x4F), + RGBY(0x50), RGBY(0x51), RGBY(0x52), RGBY(0x53), + RGBY(0x54), RGBY(0x55), RGBY(0x56), RGBY(0x57), + RGBY(0x58), RGBY(0x59), RGBY(0x5A), RGBY(0x5B), + RGBY(0x5C), RGBY(0x5D), RGBY(0x5E), RGBY(0x5F), + RGBY(0x60), RGBY(0x61), RGBY(0x62), RGBY(0x63), + RGBY(0x64), RGBY(0x65), RGBY(0x66), RGBY(0x67), + RGBY(0x68), RGBY(0x69), RGBY(0x6A), RGBY(0x6B), + RGBY(0x6C), RGBY(0x6D), RGBY(0x6E), RGBY(0x6F), + RGBY(0x70), RGBY(0x71), RGBY(0x72), RGBY(0x73), + RGBY(0x74), RGBY(0x75), RGBY(0x76), RGBY(0x77), + RGBY(0x78), RGBY(0x79), RGBY(0x7A), RGBY(0x7B), + RGBY(0x7C), RGBY(0x7D), RGBY(0x7E), RGBY(0x7F), + RGBY(0x80), RGBY(0x81), RGBY(0x82), RGBY(0x83), + RGBY(0x84), RGBY(0x85), RGBY(0x86), RGBY(0x87), + RGBY(0x88), RGBY(0x89), RGBY(0x8A), RGBY(0x8B), + RGBY(0x8C), RGBY(0x8D), RGBY(0x8E), RGBY(0x8F), + RGBY(0x90), RGBY(0x91), RGBY(0x92), RGBY(0x93), + RGBY(0x94), RGBY(0x95), RGBY(0x96), RGBY(0x97), + RGBY(0x98), RGBY(0x99), RGBY(0x9A), RGBY(0x9B), + RGBY(0x9C), RGBY(0x9D), RGBY(0x9E), RGBY(0x9F), + RGBY(0xA0), RGBY(0xA1), RGBY(0xA2), RGBY(0xA3), + RGBY(0xA4), RGBY(0xA5), RGBY(0xA6), RGBY(0xA7), + RGBY(0xA8), RGBY(0xA9), RGBY(0xAA), RGBY(0xAB), + RGBY(0xAC), RGBY(0xAD), RGBY(0xAE), RGBY(0xAF), + RGBY(0xB0), RGBY(0xB1), RGBY(0xB2), RGBY(0xB3), + RGBY(0xB4), RGBY(0xB5), RGBY(0xB6), RGBY(0xB7), + RGBY(0xB8), RGBY(0xB9), RGBY(0xBA), RGBY(0xBB), + RGBY(0xBC), RGBY(0xBD), RGBY(0xBE), RGBY(0xBF), + RGBY(0xC0), RGBY(0xC1), RGBY(0xC2), RGBY(0xC3), + RGBY(0xC4), RGBY(0xC5), RGBY(0xC6), RGBY(0xC7), + RGBY(0xC8), RGBY(0xC9), RGBY(0xCA), RGBY(0xCB), + RGBY(0xCC), RGBY(0xCD), RGBY(0xCE), RGBY(0xCF), + RGBY(0xD0), RGBY(0xD1), RGBY(0xD2), RGBY(0xD3), + RGBY(0xD4), RGBY(0xD5), RGBY(0xD6), RGBY(0xD7), + RGBY(0xD8), RGBY(0xD9), RGBY(0xDA), RGBY(0xDB), + RGBY(0xDC), RGBY(0xDD), RGBY(0xDE), RGBY(0xDF), + RGBY(0xE0), RGBY(0xE1), RGBY(0xE2), RGBY(0xE3), + RGBY(0xE4), RGBY(0xE5), RGBY(0xE6), RGBY(0xE7), + RGBY(0xE8), RGBY(0xE9), RGBY(0xEA), RGBY(0xEB), + RGBY(0xEC), RGBY(0xED), RGBY(0xEE), RGBY(0xEF), + RGBY(0xF0), RGBY(0xF1), RGBY(0xF2), RGBY(0xF3), + RGBY(0xF4), RGBY(0xF5), RGBY(0xF6), RGBY(0xF7), + RGBY(0xF8), RGBY(0xF9), RGBY(0xFA), RGBY(0xFB), + RGBY(0xFC), RGBY(0xFD), RGBY(0xFE), RGBY(0xFF), + + // Chroma U table. + RGBU(0x00), RGBU(0x01), RGBU(0x02), RGBU(0x03), + RGBU(0x04), RGBU(0x05), RGBU(0x06), RGBU(0x07), + RGBU(0x08), RGBU(0x09), RGBU(0x0A), RGBU(0x0B), + RGBU(0x0C), RGBU(0x0D), RGBU(0x0E), RGBU(0x0F), + RGBU(0x10), RGBU(0x11), RGBU(0x12), RGBU(0x13), + RGBU(0x14), RGBU(0x15), RGBU(0x16), RGBU(0x17), + RGBU(0x18), RGBU(0x19), RGBU(0x1A), RGBU(0x1B), + RGBU(0x1C), RGBU(0x1D), RGBU(0x1E), RGBU(0x1F), + RGBU(0x20), RGBU(0x21), RGBU(0x22), RGBU(0x23), + RGBU(0x24), RGBU(0x25), RGBU(0x26), RGBU(0x27), + RGBU(0x28), RGBU(0x29), RGBU(0x2A), RGBU(0x2B), + RGBU(0x2C), RGBU(0x2D), RGBU(0x2E), RGBU(0x2F), + RGBU(0x30), RGBU(0x31), RGBU(0x32), RGBU(0x33), + RGBU(0x34), RGBU(0x35), RGBU(0x36), RGBU(0x37), + RGBU(0x38), RGBU(0x39), RGBU(0x3A), RGBU(0x3B), + RGBU(0x3C), RGBU(0x3D), RGBU(0x3E), RGBU(0x3F), + RGBU(0x40), RGBU(0x41), RGBU(0x42), RGBU(0x43), + RGBU(0x44), RGBU(0x45), RGBU(0x46), RGBU(0x47), + RGBU(0x48), RGBU(0x49), RGBU(0x4A), RGBU(0x4B), + RGBU(0x4C), RGBU(0x4D), RGBU(0x4E), RGBU(0x4F), + RGBU(0x50), RGBU(0x51), RGBU(0x52), RGBU(0x53), + RGBU(0x54), RGBU(0x55), RGBU(0x56), RGBU(0x57), + RGBU(0x58), RGBU(0x59), RGBU(0x5A), RGBU(0x5B), + RGBU(0x5C), RGBU(0x5D), RGBU(0x5E), RGBU(0x5F), + RGBU(0x60), RGBU(0x61), RGBU(0x62), RGBU(0x63), + RGBU(0x64), RGBU(0x65), RGBU(0x66), RGBU(0x67), + RGBU(0x68), RGBU(0x69), RGBU(0x6A), RGBU(0x6B), + RGBU(0x6C), RGBU(0x6D), RGBU(0x6E), RGBU(0x6F), + RGBU(0x70), RGBU(0x71), RGBU(0x72), RGBU(0x73), + RGBU(0x74), RGBU(0x75), RGBU(0x76), RGBU(0x77), + RGBU(0x78), RGBU(0x79), RGBU(0x7A), RGBU(0x7B), + RGBU(0x7C), RGBU(0x7D), RGBU(0x7E), RGBU(0x7F), + RGBU(0x80), RGBU(0x81), RGBU(0x82), RGBU(0x83), + RGBU(0x84), RGBU(0x85), RGBU(0x86), RGBU(0x87), + RGBU(0x88), RGBU(0x89), RGBU(0x8A), RGBU(0x8B), + RGBU(0x8C), RGBU(0x8D), RGBU(0x8E), RGBU(0x8F), + RGBU(0x90), RGBU(0x91), RGBU(0x92), RGBU(0x93), + RGBU(0x94), RGBU(0x95), RGBU(0x96), RGBU(0x97), + RGBU(0x98), RGBU(0x99), RGBU(0x9A), RGBU(0x9B), + RGBU(0x9C), RGBU(0x9D), RGBU(0x9E), RGBU(0x9F), + RGBU(0xA0), RGBU(0xA1), RGBU(0xA2), RGBU(0xA3), + RGBU(0xA4), RGBU(0xA5), RGBU(0xA6), RGBU(0xA7), + RGBU(0xA8), RGBU(0xA9), RGBU(0xAA), RGBU(0xAB), + RGBU(0xAC), RGBU(0xAD), RGBU(0xAE), RGBU(0xAF), + RGBU(0xB0), RGBU(0xB1), RGBU(0xB2), RGBU(0xB3), + RGBU(0xB4), RGBU(0xB5), RGBU(0xB6), RGBU(0xB7), + RGBU(0xB8), RGBU(0xB9), RGBU(0xBA), RGBU(0xBB), + RGBU(0xBC), RGBU(0xBD), RGBU(0xBE), RGBU(0xBF), + RGBU(0xC0), RGBU(0xC1), RGBU(0xC2), RGBU(0xC3), + RGBU(0xC4), RGBU(0xC5), RGBU(0xC6), RGBU(0xC7), + RGBU(0xC8), RGBU(0xC9), RGBU(0xCA), RGBU(0xCB), + RGBU(0xCC), RGBU(0xCD), RGBU(0xCE), RGBU(0xCF), + RGBU(0xD0), RGBU(0xD1), RGBU(0xD2), RGBU(0xD3), + RGBU(0xD4), RGBU(0xD5), RGBU(0xD6), RGBU(0xD7), + RGBU(0xD8), RGBU(0xD9), RGBU(0xDA), RGBU(0xDB), + RGBU(0xDC), RGBU(0xDD), RGBU(0xDE), RGBU(0xDF), + RGBU(0xE0), RGBU(0xE1), RGBU(0xE2), RGBU(0xE3), + RGBU(0xE4), RGBU(0xE5), RGBU(0xE6), RGBU(0xE7), + RGBU(0xE8), RGBU(0xE9), RGBU(0xEA), RGBU(0xEB), + RGBU(0xEC), RGBU(0xED), RGBU(0xEE), RGBU(0xEF), + RGBU(0xF0), RGBU(0xF1), RGBU(0xF2), RGBU(0xF3), + RGBU(0xF4), RGBU(0xF5), RGBU(0xF6), RGBU(0xF7), + RGBU(0xF8), RGBU(0xF9), RGBU(0xFA), RGBU(0xFB), + RGBU(0xFC), RGBU(0xFD), RGBU(0xFE), RGBU(0xFF), + + // Chroma V table. + RGBV(0x00), RGBV(0x01), RGBV(0x02), RGBV(0x03), + RGBV(0x04), RGBV(0x05), RGBV(0x06), RGBV(0x07), + RGBV(0x08), RGBV(0x09), RGBV(0x0A), RGBV(0x0B), + RGBV(0x0C), RGBV(0x0D), RGBV(0x0E), RGBV(0x0F), + RGBV(0x10), RGBV(0x11), RGBV(0x12), RGBV(0x13), + RGBV(0x14), RGBV(0x15), RGBV(0x16), RGBV(0x17), + RGBV(0x18), RGBV(0x19), RGBV(0x1A), RGBV(0x1B), + RGBV(0x1C), RGBV(0x1D), RGBV(0x1E), RGBV(0x1F), + RGBV(0x20), RGBV(0x21), RGBV(0x22), RGBV(0x23), + RGBV(0x24), RGBV(0x25), RGBV(0x26), RGBV(0x27), + RGBV(0x28), RGBV(0x29), RGBV(0x2A), RGBV(0x2B), + RGBV(0x2C), RGBV(0x2D), RGBV(0x2E), RGBV(0x2F), + RGBV(0x30), RGBV(0x31), RGBV(0x32), RGBV(0x33), + RGBV(0x34), RGBV(0x35), RGBV(0x36), RGBV(0x37), + RGBV(0x38), RGBV(0x39), RGBV(0x3A), RGBV(0x3B), + RGBV(0x3C), RGBV(0x3D), RGBV(0x3E), RGBV(0x3F), + RGBV(0x40), RGBV(0x41), RGBV(0x42), RGBV(0x43), + RGBV(0x44), RGBV(0x45), RGBV(0x46), RGBV(0x47), + RGBV(0x48), RGBV(0x49), RGBV(0x4A), RGBV(0x4B), + RGBV(0x4C), RGBV(0x4D), RGBV(0x4E), RGBV(0x4F), + RGBV(0x50), RGBV(0x51), RGBV(0x52), RGBV(0x53), + RGBV(0x54), RGBV(0x55), RGBV(0x56), RGBV(0x57), + RGBV(0x58), RGBV(0x59), RGBV(0x5A), RGBV(0x5B), + RGBV(0x5C), RGBV(0x5D), RGBV(0x5E), RGBV(0x5F), + RGBV(0x60), RGBV(0x61), RGBV(0x62), RGBV(0x63), + RGBV(0x64), RGBV(0x65), RGBV(0x66), RGBV(0x67), + RGBV(0x68), RGBV(0x69), RGBV(0x6A), RGBV(0x6B), + RGBV(0x6C), RGBV(0x6D), RGBV(0x6E), RGBV(0x6F), + RGBV(0x70), RGBV(0x71), RGBV(0x72), RGBV(0x73), + RGBV(0x74), RGBV(0x75), RGBV(0x76), RGBV(0x77), + RGBV(0x78), RGBV(0x79), RGBV(0x7A), RGBV(0x7B), + RGBV(0x7C), RGBV(0x7D), RGBV(0x7E), RGBV(0x7F), + RGBV(0x80), RGBV(0x81), RGBV(0x82), RGBV(0x83), + RGBV(0x84), RGBV(0x85), RGBV(0x86), RGBV(0x87), + RGBV(0x88), RGBV(0x89), RGBV(0x8A), RGBV(0x8B), + RGBV(0x8C), RGBV(0x8D), RGBV(0x8E), RGBV(0x8F), + RGBV(0x90), RGBV(0x91), RGBV(0x92), RGBV(0x93), + RGBV(0x94), RGBV(0x95), RGBV(0x96), RGBV(0x97), + RGBV(0x98), RGBV(0x99), RGBV(0x9A), RGBV(0x9B), + RGBV(0x9C), RGBV(0x9D), RGBV(0x9E), RGBV(0x9F), + RGBV(0xA0), RGBV(0xA1), RGBV(0xA2), RGBV(0xA3), + RGBV(0xA4), RGBV(0xA5), RGBV(0xA6), RGBV(0xA7), + RGBV(0xA8), RGBV(0xA9), RGBV(0xAA), RGBV(0xAB), + RGBV(0xAC), RGBV(0xAD), RGBV(0xAE), RGBV(0xAF), + RGBV(0xB0), RGBV(0xB1), RGBV(0xB2), RGBV(0xB3), + RGBV(0xB4), RGBV(0xB5), RGBV(0xB6), RGBV(0xB7), + RGBV(0xB8), RGBV(0xB9), RGBV(0xBA), RGBV(0xBB), + RGBV(0xBC), RGBV(0xBD), RGBV(0xBE), RGBV(0xBF), + RGBV(0xC0), RGBV(0xC1), RGBV(0xC2), RGBV(0xC3), + RGBV(0xC4), RGBV(0xC5), RGBV(0xC6), RGBV(0xC7), + RGBV(0xC8), RGBV(0xC9), RGBV(0xCA), RGBV(0xCB), + RGBV(0xCC), RGBV(0xCD), RGBV(0xCE), RGBV(0xCF), + RGBV(0xD0), RGBV(0xD1), RGBV(0xD2), RGBV(0xD3), + RGBV(0xD4), RGBV(0xD5), RGBV(0xD6), RGBV(0xD7), + RGBV(0xD8), RGBV(0xD9), RGBV(0xDA), RGBV(0xDB), + RGBV(0xDC), RGBV(0xDD), RGBV(0xDE), RGBV(0xDF), + RGBV(0xE0), RGBV(0xE1), RGBV(0xE2), RGBV(0xE3), + RGBV(0xE4), RGBV(0xE5), RGBV(0xE6), RGBV(0xE7), + RGBV(0xE8), RGBV(0xE9), RGBV(0xEA), RGBV(0xEB), + RGBV(0xEC), RGBV(0xED), RGBV(0xEE), RGBV(0xEF), + RGBV(0xF0), RGBV(0xF1), RGBV(0xF2), RGBV(0xF3), + RGBV(0xF4), RGBV(0xF5), RGBV(0xF6), RGBV(0xF7), + RGBV(0xF8), RGBV(0xF9), RGBV(0xFA), RGBV(0xFB), + RGBV(0xFC), RGBV(0xFD), RGBV(0xFE), RGBV(0xFF), + + // Alpha multipliers for each alpha level. + ALPHA(0x00), ALPHA(0x01), ALPHA(0x02), ALPHA(0x03), + ALPHA(0x04), ALPHA(0x05), ALPHA(0x06), ALPHA(0x07), + ALPHA(0x08), ALPHA(0x09), ALPHA(0x0A), ALPHA(0x0B), + ALPHA(0x0C), ALPHA(0x0D), ALPHA(0x0E), ALPHA(0x0F), + ALPHA(0x10), ALPHA(0x11), ALPHA(0x12), ALPHA(0x13), + ALPHA(0x14), ALPHA(0x15), ALPHA(0x16), ALPHA(0x17), + ALPHA(0x18), ALPHA(0x19), ALPHA(0x1A), ALPHA(0x1B), + ALPHA(0x1C), ALPHA(0x1D), ALPHA(0x1E), ALPHA(0x1F), + ALPHA(0x20), ALPHA(0x21), ALPHA(0x22), ALPHA(0x23), + ALPHA(0x24), ALPHA(0x25), ALPHA(0x26), ALPHA(0x27), + ALPHA(0x28), ALPHA(0x29), ALPHA(0x2A), ALPHA(0x2B), + ALPHA(0x2C), ALPHA(0x2D), ALPHA(0x2E), ALPHA(0x2F), + ALPHA(0x30), ALPHA(0x31), ALPHA(0x32), ALPHA(0x33), + ALPHA(0x34), ALPHA(0x35), ALPHA(0x36), ALPHA(0x37), + ALPHA(0x38), ALPHA(0x39), ALPHA(0x3A), ALPHA(0x3B), + ALPHA(0x3C), ALPHA(0x3D), ALPHA(0x3E), ALPHA(0x3F), + ALPHA(0x40), ALPHA(0x41), ALPHA(0x42), ALPHA(0x43), + ALPHA(0x44), ALPHA(0x45), ALPHA(0x46), ALPHA(0x47), + ALPHA(0x48), ALPHA(0x49), ALPHA(0x4A), ALPHA(0x4B), + ALPHA(0x4C), ALPHA(0x4D), ALPHA(0x4E), ALPHA(0x4F), + ALPHA(0x50), ALPHA(0x51), ALPHA(0x52), ALPHA(0x53), + ALPHA(0x54), ALPHA(0x55), ALPHA(0x56), ALPHA(0x57), + ALPHA(0x58), ALPHA(0x59), ALPHA(0x5A), ALPHA(0x5B), + ALPHA(0x5C), ALPHA(0x5D), ALPHA(0x5E), ALPHA(0x5F), + ALPHA(0x60), ALPHA(0x61), ALPHA(0x62), ALPHA(0x63), + ALPHA(0x64), ALPHA(0x65), ALPHA(0x66), ALPHA(0x67), + ALPHA(0x68), ALPHA(0x69), ALPHA(0x6A), ALPHA(0x6B), + ALPHA(0x6C), ALPHA(0x6D), ALPHA(0x6E), ALPHA(0x6F), + ALPHA(0x70), ALPHA(0x71), ALPHA(0x72), ALPHA(0x73), + ALPHA(0x74), ALPHA(0x75), ALPHA(0x76), ALPHA(0x77), + ALPHA(0x78), ALPHA(0x79), ALPHA(0x7A), ALPHA(0x7B), + ALPHA(0x7C), ALPHA(0x7D), ALPHA(0x7E), ALPHA(0x7F), + ALPHA(0x80), ALPHA(0x81), ALPHA(0x82), ALPHA(0x83), + ALPHA(0x84), ALPHA(0x85), ALPHA(0x86), ALPHA(0x87), + ALPHA(0x88), ALPHA(0x89), ALPHA(0x8A), ALPHA(0x8B), + ALPHA(0x8C), ALPHA(0x8D), ALPHA(0x8E), ALPHA(0x8F), + ALPHA(0x90), ALPHA(0x91), ALPHA(0x92), ALPHA(0x93), + ALPHA(0x94), ALPHA(0x95), ALPHA(0x96), ALPHA(0x97), + ALPHA(0x98), ALPHA(0x99), ALPHA(0x9A), ALPHA(0x9B), + ALPHA(0x9C), ALPHA(0x9D), ALPHA(0x9E), ALPHA(0x9F), + ALPHA(0xA0), ALPHA(0xA1), ALPHA(0xA2), ALPHA(0xA3), + ALPHA(0xA4), ALPHA(0xA5), ALPHA(0xA6), ALPHA(0xA7), + ALPHA(0xA8), ALPHA(0xA9), ALPHA(0xAA), ALPHA(0xAB), + ALPHA(0xAC), ALPHA(0xAD), ALPHA(0xAE), ALPHA(0xAF), + ALPHA(0xB0), ALPHA(0xB1), ALPHA(0xB2), ALPHA(0xB3), + ALPHA(0xB4), ALPHA(0xB5), ALPHA(0xB6), ALPHA(0xB7), + ALPHA(0xB8), ALPHA(0xB9), ALPHA(0xBA), ALPHA(0xBB), + ALPHA(0xBC), ALPHA(0xBD), ALPHA(0xBE), ALPHA(0xBF), + ALPHA(0xC0), ALPHA(0xC1), ALPHA(0xC2), ALPHA(0xC3), + ALPHA(0xC4), ALPHA(0xC5), ALPHA(0xC6), ALPHA(0xC7), + ALPHA(0xC8), ALPHA(0xC9), ALPHA(0xCA), ALPHA(0xCB), + ALPHA(0xCC), ALPHA(0xCD), ALPHA(0xCE), ALPHA(0xCF), + ALPHA(0xD0), ALPHA(0xD1), ALPHA(0xD2), ALPHA(0xD3), + ALPHA(0xD4), ALPHA(0xD5), ALPHA(0xD6), ALPHA(0xD7), + ALPHA(0xD8), ALPHA(0xD9), ALPHA(0xDA), ALPHA(0xDB), + ALPHA(0xDC), ALPHA(0xDD), ALPHA(0xDE), ALPHA(0xDF), + ALPHA(0xE0), ALPHA(0xE1), ALPHA(0xE2), ALPHA(0xE3), + ALPHA(0xE4), ALPHA(0xE5), ALPHA(0xE6), ALPHA(0xE7), + ALPHA(0xE8), ALPHA(0xE9), ALPHA(0xEA), ALPHA(0xEB), + ALPHA(0xEC), ALPHA(0xED), ALPHA(0xEE), ALPHA(0xEF), + ALPHA(0xF0), ALPHA(0xF1), ALPHA(0xF2), ALPHA(0xF3), + ALPHA(0xF4), ALPHA(0xF5), ALPHA(0xF6), ALPHA(0xF7), + ALPHA(0xF8), ALPHA(0xF9), ALPHA(0xFA), ALPHA(0xFB), + ALPHA(0xFC), ALPHA(0xFD), ALPHA(0xFE), ALPHA(0xFF), +}; + +#undef RGBY +#undef RGBU +#undef RGBV +#undef ALPHA + } // extern "C" diff --git a/media/base/simd/yuv_to_rgb_table.h b/media/base/simd/yuv_to_rgb_table.h index aebf1b20..1ed6fd8 100644 --- a/media/base/simd/yuv_to_rgb_table.h +++ b/media/base/simd/yuv_to_rgb_table.h @@ -20,6 +20,7 @@ extern "C" { // Align the table to 16-bytes to allow faster reading. extern SIMD_ALIGNED(const int16 kCoefficientsRgbY[256 * 4][4]); +extern SIMD_ALIGNED(const int16 kCoefficientsRgbY_JPEG[256 * 4][4]); } // extern "C" diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc index 2b27c1d..5ad8f30 100644 --- a/media/base/yuv_convert.cc +++ b/media/base/yuv_convert.cc @@ -25,6 +25,7 @@ #include "media/base/simd/convert_rgb_to_yuv.h" #include "media/base/simd/convert_yuv_to_rgb.h" #include "media/base/simd/filter_yuv.h" +#include "media/base/simd/yuv_to_rgb_table.h" #if defined(ARCH_CPU_X86_FAMILY) #if defined(COMPILER_MSVC) @@ -79,21 +80,24 @@ typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, const uint8*, const uint8*, uint8*, - ptrdiff_t); + ptrdiff_t, + const int16[1024][4]); typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, const uint8*, const uint8*, const uint8*, uint8*, - ptrdiff_t); + ptrdiff_t, + const int16[1024][4]); typedef void (*ScaleYUVToRGB32RowProc)(const uint8*, const uint8*, const uint8*, uint8*, ptrdiff_t, - ptrdiff_t); + ptrdiff_t, + const int16[1024][4]); static FilterYUVRowsProc g_filter_yuv_rows_proc_ = NULL; static ConvertYUVToRGB32RowProc g_convert_yuv_to_rgb32_row_proc_ = NULL; @@ -112,6 +116,31 @@ void EmptyRegisterStateIntrinsic() { _mm_empty(); } typedef void (*EmptyRegisterStateProc)(); static EmptyRegisterStateProc g_empty_register_state_proc_ = NULL; +// Get the appropriate value to bitshift by for vertical indices. +int GetVerticalShift(YUVType type) { + switch (type) { + case YV16: + return 0; + case YV12: + case YV12J: + return 1; + } + NOTREACHED(); + return 0; +} + +const int16 (&GetLookupTable(YUVType type))[1024][4] { + switch (type) { + case YV12: + case YV16: + return kCoefficientsRgbY; + case YV12J: + return kCoefficientsRgbY_JPEG; + } + NOTREACHED(); + return kCoefficientsRgbY; +} + void InitializeCPUSpecificYUVConversions() { CHECK(!g_filter_yuv_rows_proc_); CHECK(!g_convert_yuv_to_rgb32_row_proc_); @@ -222,7 +251,7 @@ void ScaleYUVToRGB32(const uint8* y_buf, if (source_width > kFilterBufferSize || view_rotate) filter = FILTER_NONE; - unsigned int y_shift = yuv_type; + unsigned int y_shift = GetVerticalShift(yuv_type); // Diagram showing origin and direction of source sampling. // ->0 4<- // 7 3 @@ -354,14 +383,25 @@ void ScaleYUVToRGB32(const uint8* y_buf, v_ptr = v_buf + (source_y >> y_shift) * uv_pitch; } if (source_dx == kFractionMax) { // Not scaled - g_convert_yuv_to_rgb32_row_proc_(y_ptr, u_ptr, v_ptr, dest_pixel, width); + g_convert_yuv_to_rgb32_row_proc_( + y_ptr, u_ptr, v_ptr, dest_pixel, width, kCoefficientsRgbY); } else { if (filter & FILTER_BILINEAR_H) { - g_linear_scale_yuv_to_rgb32_row_proc_( - y_ptr, u_ptr, v_ptr, dest_pixel, width, source_dx); + g_linear_scale_yuv_to_rgb32_row_proc_(y_ptr, + u_ptr, + v_ptr, + dest_pixel, + width, + source_dx, + kCoefficientsRgbY); } else { - g_scale_yuv_to_rgb32_row_proc_( - y_ptr, u_ptr, v_ptr, dest_pixel, width, source_dx); + g_scale_yuv_to_rgb32_row_proc_(y_ptr, + u_ptr, + v_ptr, + dest_pixel, + width, + source_dx, + kCoefficientsRgbY); } } } @@ -505,7 +545,8 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, rgb_buf, dest_rect_width, source_left, - x_step); + x_step, + kCoefficientsRgbY); } else { // If the frame is too large then we linear scale a single row. LinearScaleYUVToRGB32RowWithRange_C(y0_ptr, @@ -514,7 +555,8 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, rgb_buf, dest_rect_width, source_left, - x_step); + x_step, + kCoefficientsRgbY); } // Advance vertically in the source and destination image. diff --git a/media/base/yuv_convert.h b/media/base/yuv_convert.h index 8f64c79..cf13edb 100644 --- a/media/base/yuv_convert.h +++ b/media/base/yuv_convert.h @@ -7,6 +7,7 @@ #include "base/basictypes.h" #include "media/base/media_export.h" +#include "media/base/simd/yuv_to_rgb_table.h" // Visual Studio 2010 does not support MMX intrinsics on x64. // Some win64 yuv_convert code paths use SSE+MMX yasm, so without rewriting @@ -22,12 +23,18 @@ namespace media { // Type of YUV surface. -// The value of these enums matter as they are used to shift vertical indices. enum YUVType { - YV16 = 0, // YV16 is half width and full height chroma channels. - YV12 = 1, // YV12 is half width and half height chroma channels. + YV16 = 0, // YV16 is half width and full height chroma channels. + YV12 = 1, // YV12 is half width and half height chroma channels. + YV12J = 2, // YV12J is the same as YV12, but in JPEG color range. }; +// Get the appropriate value to bitshift by for vertical indices. +MEDIA_EXPORT int GetVerticalShift(YUVType type); + +// Get the appropriate lookup table for a given YUV format. +MEDIA_EXPORT const int16 (&GetLookupTable(YUVType type))[1024][4]; + // Mirror means flip the image horizontally, as in looking in a mirror. // Rotate happens after mirroring. enum Rotate { diff --git a/media/base/yuv_convert_perftest.cc b/media/base/yuv_convert_perftest.cc index 0188ce6..0f30beb 100644 --- a/media/base/yuv_convert_perftest.cc +++ b/media/base/yuv_convert_perftest.cc @@ -76,7 +76,8 @@ TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_MMX) { yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2), yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), - kWidth); + kWidth, + GetLookupTable(YV12)); } } double total_time_seconds = @@ -100,7 +101,8 @@ TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) { yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2), yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), - kWidth); + kWidth, + GetLookupTable(YV12)); } } double total_time_seconds = @@ -126,7 +128,8 @@ TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_MMX) { yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); } } double total_time_seconds = @@ -152,7 +155,8 @@ TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) { yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); } } double total_time_seconds = @@ -178,7 +182,8 @@ TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_MMX) { yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); } } double total_time_seconds = @@ -204,7 +209,8 @@ TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) { yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); } } double total_time_seconds = diff --git a/media/base/yuv_convert_unittest.cc b/media/base/yuv_convert_unittest.cc index 7c964f3..73deb1f 100644 --- a/media/base/yuv_convert_unittest.cc +++ b/media/base/yuv_convert_unittest.cc @@ -11,6 +11,7 @@ #include "media/base/simd/convert_rgb_to_yuv.h" #include "media/base/simd/convert_yuv_to_rgb.h" #include "media/base/simd/filter_yuv.h" +#include "media/base/simd/yuv_to_rgb_table.h" #include "media/base/yuv_convert.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/rect.h" @@ -162,6 +163,7 @@ class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> { YUVScaleTest() { switch (GetParam().yuv_type) { case media::YV12: + case media::YV12J: ReadYV12Data(&yuv_bytes_); break; case media::YV16: @@ -178,6 +180,7 @@ class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> { uint8* v_plane() { switch (GetParam().yuv_type) { case media::YV12: + case media::YV12J: return yuv_bytes_.get() + kSourceVOffset; case media::YV16: return yuv_bytes_.get() + kSourceYSize * 3 / 2; @@ -618,12 +621,14 @@ TEST(YUVConvertTest, ConvertYUVToRGB32Row_MMX) { yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), - kWidth); + kWidth, + GetLookupTable(YV12)); ConvertYUVToRGB32Row_MMX(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), - kWidth); + kWidth, + GetLookupTable(YV12)); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -647,12 +652,14 @@ TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) { yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), - kWidth); + kWidth, + GetLookupTable(YV12)); ConvertYUVToRGB32Row_SSE(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), - kWidth); + kWidth, + GetLookupTable(YV12)); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -678,13 +685,15 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_MMX) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); ScaleYUVToRGB32Row_MMX(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -710,13 +719,15 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); ScaleYUVToRGB32Row_SSE(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -742,13 +753,15 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); LinearScaleYUVToRGB32Row_MMX(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -774,13 +787,15 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); LinearScaleYUVToRGB32Row_SSE(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -924,13 +939,15 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE2_X64) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); ScaleYUVToRGB32Row_SSE2_X64(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -950,13 +967,15 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX_X64) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); LinearScaleYUVToRGB32Row_MMX_X64(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx); + kSourceDx, + GetLookupTable(YV12)); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), |