From cb9319bbfa5e596724226be261adcbf2c630df7a Mon Sep 17 00:00:00 2001 From: "mlamouri@chromium.org" Date: Sat, 3 May 2014 10:36:38 +0000 Subject: [PATCH] Revert of Add correct support for videos with YUVJ420P color format, in the software conversion path. (https://codereview.chromium.org/242643011/) Reason for revert: Broke Linux Clang (dbg) bot. http://build.chromium.org/p/chromium.linux/builders/Linux%20Clang%20%28dbg%29/builds/59028 http://build.chromium.org/p/chromium.linux/builders/Linux%20Clang%20%28dbg%29/builds/59028/steps/compile/logs/stdio Original issue's description: > Add correct support for videos with YUVJ420P color format, in the software conversion path. > > BUG=172898 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=268061 TBR=scherkus@chromium.org,hclam@chromium.org,rileya@chromium.org NOTREECHECKS=true NOTRY=true BUG=172898 Review URL: https://codereview.chromium.org/263723004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268064 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/media/media_browsertest.cc | 3 +- media/base/simd/convert_yuv_to_rgb.h | 122 ++++---- media/base/simd/convert_yuv_to_rgb_c.cc | 89 +++--- media/base/simd/convert_yuv_to_rgb_mmx.asm | 3 +- media/base/simd/convert_yuv_to_rgb_mmx.inc | 5 +- media/base/simd/convert_yuv_to_rgb_sse.asm | 1 - media/base/simd/convert_yuv_to_rgb_x86.cc | 16 +- media/base/simd/convert_yuva_to_argb_mmx.asm | 1 - media/base/simd/convert_yuva_to_argb_mmx.inc | 4 +- media/base/simd/linear_scale_yuv_to_rgb_mmx.asm | 1 - media/base/simd/linear_scale_yuv_to_rgb_mmx.inc | 12 +- .../base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm | 8 +- media/base/simd/scale_yuv_to_rgb_mmx.asm | 1 - media/base/simd/scale_yuv_to_rgb_mmx.inc | 8 +- media/base/simd/scale_yuv_to_rgb_sse.asm | 1 - media/base/simd/scale_yuv_to_rgb_sse2_x64.asm | 8 +- media/base/simd/yuv_to_rgb_table.cc | 331 --------------------- media/base/simd/yuv_to_rgb_table.h | 1 - media/base/yuv_convert.cc | 64 +--- media/base/yuv_convert.h | 13 +- media/base/yuv_convert_perftest.cc | 19 +- media/base/yuv_convert_unittest.cc | 51 +--- media/filters/skcanvas_video_renderer.cc | 17 +- 23 files changed, 161 insertions(+), 618 deletions(-) diff --git a/content/browser/media/media_browsertest.cc b/content/browser/media/media_browsertest.cc index 7e44a31e6053..f284add4de51 100644 --- a/content/browser/media/media_browsertest.cc +++ b/content/browser/media/media_browsertest.cc @@ -231,7 +231,8 @@ IN_PROC_BROWSER_TEST_F(MediaTest, MAYBE(Yuv420pH264)) { } IN_PROC_BROWSER_TEST_F(MediaTest, MAYBE(Yuvj420pH264)) { - RunColorFormatTest("yuvj420p.mp4", "ENDED"); + // TODO(rileya): Support YUVJ420P properly http://crbug.com/310273 + RunColorFormatTest("yuvj420p.mp4", "FAILED"); } IN_PROC_BROWSER_TEST_F(MediaTest, MAYBE(Yuv422pH264)) { diff --git a/media/base/simd/convert_yuv_to_rgb.h b/media/base/simd/convert_yuv_to_rgb.h index 6c0a9661135e..2991d562af08 100644 --- a/media/base/simd/convert_yuv_to_rgb.h +++ b/media/base/simd/convert_yuv_to_rgb.h @@ -28,8 +28,7 @@ MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8* yplane, const uint8* uplane, const uint8* vplane, uint8* rgbframe, - ptrdiff_t width, - const int16 convert_table[1024][4]); + ptrdiff_t width); MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane, const uint8* uplane, @@ -49,8 +48,7 @@ MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane, const uint8* vplane, const uint8* aplane, uint8* rgbframe, - ptrdiff_t width, - const int16 convert_table[1024][4]); + ptrdiff_t width); MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane, const uint8* uplane, @@ -92,27 +90,22 @@ MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_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_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]); + 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); } // namespace media @@ -130,75 +123,62 @@ MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8* yplane, const uint8* uplane, const uint8* vplane, uint8* rgbframe, - ptrdiff_t width, - const int16 convert_table[1024][4]); + ptrdiff_t width); MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane, const uint8* uplane, const uint8* vplane, const uint8* aplane, uint8* rgbframe, - ptrdiff_t width, - const int16 convert_table[1024][4]); + ptrdiff_t width); MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane, const uint8* uplane, const uint8* vplane, uint8* rgbframe, - ptrdiff_t width, - const int16 convert_table[1024][4]); + ptrdiff_t width); 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, - const int16 convert_table[1024][4]); + ptrdiff_t source_dx); 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, - 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]); + 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); } // 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 9d6476b07d56..0466112918de 100644 --- a/media/base/simd/convert_yuv_to_rgb_c.cc +++ b/media/base/simd/convert_yuv_to_rgb_c.cc @@ -38,22 +38,21 @@ namespace media { static inline void ConvertYUVToRGB32_C(uint8 y, uint8 u, uint8 v, - 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]; + 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]; - 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[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[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 = 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 >>= 6; g >>= 6; @@ -70,19 +69,18 @@ static inline void ConvertYUVAToARGB_C(uint8 y, uint8 u, uint8 v, uint8 a, - 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]; + uint8* rgb_buf) { + int b = kCoefficientsRgbY[256+u][0]; + int g = kCoefficientsRgbY[256+u][1]; + int r = kCoefficientsRgbY[256+u][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[512+v][0]); + g = paddsw(g, kCoefficientsRgbY[512+v][1]); + r = paddsw(r, kCoefficientsRgbY[512+v][2]); - b = paddsw(b, convert_table[y][0]); - g = paddsw(g, convert_table[y][1]); - r = paddsw(r, convert_table[y][2]); + b = paddsw(b, kCoefficientsRgbY[y][0]); + g = paddsw(g, kCoefficientsRgbY[y][1]); + r = paddsw(r, kCoefficientsRgbY[y][2]); b >>= 6; g >>= 6; @@ -102,16 +100,15 @@ void ConvertYUVToRGB32Row_C(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - ptrdiff_t width, - const int16 convert_table[1024][4]) { + ptrdiff_t width) { 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, convert_table); + ConvertYUVToRGB32_C(y0, u, v, rgb_buf); if ((x + 1) < width) { uint8 y1 = y_buf[x + 1]; - ConvertYUVToRGB32_C(y1, u, v, rgb_buf + 4, convert_table); + ConvertYUVToRGB32_C(y1, u, v, rgb_buf + 4); } rgb_buf += 8; // Advance 2 pixels. } @@ -122,18 +119,17 @@ void ConvertYUVAToARGBRow_C(const uint8* y_buf, const uint8* v_buf, const uint8* a_buf, uint8* rgba_buf, - ptrdiff_t width, - const int16 convert_table[1024][4]) { + ptrdiff_t width) { 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, convert_table); + ConvertYUVAToARGB_C(y0, u, v, a0, rgba_buf); 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, convert_table); + ConvertYUVAToARGB_C(y1, u, v, a1, rgba_buf + 4); } rgba_buf += 8; // Advance 2 pixels. } @@ -148,18 +144,17 @@ void ScaleYUVToRGB32Row_C(const uint8* y_buf, const uint8* v_buf, uint8* rgb_buf, ptrdiff_t width, - ptrdiff_t source_dx, - const int16 convert_table[1024][4]) { + ptrdiff_t source_dx) { 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, convert_table); + ConvertYUVToRGB32_C(y, u, v, rgb_buf); x += source_dx; if ((i + 1) < width) { y = y_buf[x >> 16]; - ConvertYUVToRGB32_C(y, u, v, rgb_buf+4, convert_table); + ConvertYUVToRGB32_C(y, u, v, rgb_buf+4); x += source_dx; } rgb_buf += 8; @@ -171,14 +166,13 @@ void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, const uint8* v_buf, uint8* rgb_buf, ptrdiff_t width, - ptrdiff_t source_dx, - const int16 convert_table[1024][4]) { + ptrdiff_t source_dx) { // 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, convert_table); + source_x, source_dx); } void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, @@ -187,8 +181,7 @@ void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, uint8* rgb_buf, int dest_width, int x, - int source_dx, - const int16 convert_table[1024][4]) { + int source_dx) { for (int i = 0; i < dest_width; i += 2) { int y0 = y_buf[x >> 16]; int y1 = y_buf[(x >> 16) + 1]; @@ -201,14 +194,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, convert_table); + ConvertYUVToRGB32_C(y, u, v, rgb_buf); 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, convert_table); + ConvertYUVToRGB32_C(y, u, v, rgb_buf+4); x += source_dx; } rgb_buf += 8; @@ -225,7 +218,7 @@ void ConvertYUVToRGB32_C(const uint8* yplane, int uvstride, int rgbstride, YUVType yuv_type) { - unsigned int y_shift = GetVerticalShift(yuv_type); + unsigned int y_shift = yuv_type; for (int y = 0; y < height; ++y) { uint8* rgb_row = rgbframe + y * rgbstride; const uint8* y_ptr = yplane + y * ystride; @@ -236,8 +229,7 @@ void ConvertYUVToRGB32_C(const uint8* yplane, u_ptr, v_ptr, rgb_row, - width, - GetLookupTable(yuv_type)); + width); } } @@ -266,8 +258,7 @@ void ConvertYUVAToARGB_C(const uint8* yplane, v_ptr, a_ptr, rgba_row, - width, - GetLookupTable(yuv_type)); + width); } } diff --git a/media/base/simd/convert_yuv_to_rgb_mmx.asm b/media/base/simd/convert_yuv_to_rgb_mmx.asm index 7395419d442e..39a4f75697dc 100644 --- a/media/base/simd/convert_yuv_to_rgb_mmx.asm +++ b/media/base/simd/convert_yuv_to_rgb_mmx.asm @@ -17,7 +17,6 @@ ; const uint8* u_buf, ; const uint8* v_buf, ; uint8* rgb_buf, -; ptrdiff_t width, -; const int16 convert_table[1024][4]); +; ptrdiff_t width); %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 4b69d1b13cf4..f143574575a9 100644 --- a/media/base/simd/convert_yuv_to_rgb_mmx.inc +++ b/media/base/simd/convert_yuv_to_rgb_mmx.inc @@ -9,7 +9,10 @@ mangle(SYMBOL): %assign stack_offset 0 - PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, TABLE, TEMP + PROLOGUE 5, 7, 3, Y, U, V, ARGB, WIDTH, TEMP, TABLE + + extern mangle(kCoefficientsRgbY) + LOAD_SYM TABLEq, mangle(kCoefficientsRgbY) 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 44b123fcdd19..8b3ee582ad2a 100644 --- a/media/base/simd/convert_yuv_to_rgb_sse.asm +++ b/media/base/simd/convert_yuv_to_rgb_sse.asm @@ -19,6 +19,5 @@ ; 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 969890dbbefd..d1d6e16beb79 100644 --- a/media/base/simd/convert_yuv_to_rgb_x86.cc +++ b/media/base/simd/convert_yuv_to_rgb_x86.cc @@ -9,7 +9,6 @@ #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 { @@ -24,7 +23,7 @@ void ConvertYUVToRGB32_MMX(const uint8* yplane, int uvstride, int rgbstride, YUVType yuv_type) { - unsigned int y_shift = GetVerticalShift(yuv_type); + unsigned int y_shift = yuv_type; for (int y = 0; y < height; ++y) { uint8* rgb_row = rgbframe + y * rgbstride; const uint8* y_ptr = yplane + y * ystride; @@ -35,8 +34,7 @@ void ConvertYUVToRGB32_MMX(const uint8* yplane, u_ptr, v_ptr, rgb_row, - width, - GetLookupTable(yuv_type)); + width); } EmptyRegisterState(); @@ -54,7 +52,7 @@ void ConvertYUVAToARGB_MMX(const uint8* yplane, int astride, int rgbstride, YUVType yuv_type) { - unsigned int y_shift = GetVerticalShift(yuv_type); + unsigned int y_shift = yuv_type; for (int y = 0; y < height; ++y) { uint8* rgb_row = rgbframe + y * rgbstride; const uint8* y_ptr = yplane + y * ystride; @@ -67,8 +65,7 @@ void ConvertYUVAToARGB_MMX(const uint8* yplane, v_ptr, a_ptr, rgb_row, - width, - GetLookupTable(yuv_type)); + width); } EmptyRegisterState(); @@ -84,7 +81,7 @@ void ConvertYUVToRGB32_SSE(const uint8* yplane, int uvstride, int rgbstride, YUVType yuv_type) { - unsigned int y_shift = GetVerticalShift(yuv_type); + unsigned int y_shift = yuv_type; for (int y = 0; y < height; ++y) { uint8* rgb_row = rgbframe + y * rgbstride; const uint8* y_ptr = yplane + y * ystride; @@ -95,8 +92,7 @@ void ConvertYUVToRGB32_SSE(const uint8* yplane, u_ptr, v_ptr, rgb_row, - width, - GetLookupTable(yuv_type)); + width); } EmptyRegisterState(); diff --git a/media/base/simd/convert_yuva_to_argb_mmx.asm b/media/base/simd/convert_yuva_to_argb_mmx.asm index 395f326abbf8..b39315dc461b 100644 --- a/media/base/simd/convert_yuva_to_argb_mmx.asm +++ b/media/base/simd/convert_yuva_to_argb_mmx.asm @@ -19,6 +19,5 @@ ; 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 5faa6a542368..2e9e62d60c90 100644 --- a/media/base/simd/convert_yuva_to_argb_mmx.inc +++ b/media/base/simd/convert_yuva_to_argb_mmx.inc @@ -9,9 +9,11 @@ mangle(SYMBOL): %assign stack_offset 0 - PROLOGUE 7, 7, 3, Y, U, V, A, ARGB, WIDTH, TABLE, TEMP + PROLOGUE 6, 7, 3, Y, U, V, A, ARGB, WIDTH, TEMP + extern mangle(kCoefficientsRgbY) 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 bf2f70805208..40418340e35d 100644 --- a/media/base/simd/linear_scale_yuv_to_rgb_mmx.asm +++ b/media/base/simd/linear_scale_yuv_to_rgb_mmx.asm @@ -19,6 +19,5 @@ ; 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 48f62acf25ad..dce591d78044 100644 --- a/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc +++ b/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc @@ -10,6 +10,8 @@ mangle(SYMBOL): %assign stack_offset 0 + extern mangle(kCoefficientsRgbY) + ; Parameters are in the following order: ; 1. Y plane ; 2. U plane @@ -17,9 +19,8 @@ mangle(SYMBOL): ; 4. ARGB frame ; 5. Width ; 6. Source dx -; 7. Conversion lookup table -PROLOGUE 7, 7, 3, Y, R0, R1, ARGB, R2, TEMP, R3 +PROLOGUE 6, 7, 3, Y, R0, R1, ARGB, R2, R3, TEMP %if gprsize == 8 %define WORD_SIZE QWORD @@ -33,7 +34,7 @@ PROLOGUE 7, 7, 3, Y, R0, R1, ARGB, R2, TEMP, R3 %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 TEMPq ; Source dx argument +%define SOURCE_DX_ARG_REGq R3q ; Source dx argument %define WIDTH_ARG_REGq R2q ; Width argument %define COMPRq R0q ; Component B value @@ -55,6 +56,11 @@ PROLOGUE 7, 7, 3, Y, R0, R1, ARGB, R2, TEMP, R3 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 89e4e2a6825a..f7e1d9085490 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,9 +32,8 @@ mangle(SYMBOL): ; 4. ARGB frame ; 5. Width ; 6. Source dx -; 7. Conversion lookup table -PROLOGUE 7, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, R1 +PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, COMPL %define TABLEq r10 %define Xq r11 @@ -42,9 +41,6 @@ PROLOGUE 7, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, R1 %define COMPRd r13d %define COMPRq r13 %define FRACTIONq r14 -%define COMPL R1 -%define COMPLq R1q -%define COMPLd R1d PUSH TABLEq PUSH Xq @@ -60,7 +56,7 @@ PROLOGUE 7, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, R1 POP TABLEq %endmacro - mov TABLEq, R1q + LOAD_SYM TABLEq, mangle(kCoefficientsRgbY) 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 122365149fc3..583b7cbb0e60 100644 --- a/media/base/simd/scale_yuv_to_rgb_mmx.asm +++ b/media/base/simd/scale_yuv_to_rgb_mmx.asm @@ -19,6 +19,5 @@ ; 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 60351db557d5..a599b0c30a22 100644 --- a/media/base/simd/scale_yuv_to_rgb_mmx.inc +++ b/media/base/simd/scale_yuv_to_rgb_mmx.inc @@ -19,9 +19,8 @@ mangle(SYMBOL): ; 4. ARGB frame ; 5. Width ; 6. Source dx -; 7. Lookup table address -PROLOGUE 7, 7, 3, Y, U, V, ARGB, R1, R2, TEMP +PROLOGUE 6, 7, 3, Y, U, V, ARGB, R1, R2, TEMP %ifdef ARCH_X86_64 %define WORD_SIZE QWORD @@ -34,11 +33,10 @@ PROLOGUE 7, 7, 3, Y, U, V, ARGB, R1, R2, TEMP %define SOURCE_DX WORD_SIZE [rsp] - mov R1q, TEMPq - + LOAD_SYM R1q, mangle(kCoefficientsRgbY) %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 fc98bbe6bdaf..536ed18db074 100644 --- a/media/base/simd/scale_yuv_to_rgb_sse.asm +++ b/media/base/simd/scale_yuv_to_rgb_sse.asm @@ -19,6 +19,5 @@ ; 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 cf0d140dbfdc..d6786875a312 100644 --- a/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm +++ b/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm @@ -32,21 +32,17 @@ mangle(SYMBOL): ; 4. ARGB frame ; 5. Width ; 6. Source dx -; 7. Convert table -PROLOGUE 7, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, R1 +PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, COMP %define TABLEq r10 %define Xq r11 %define INDEXq r12 -%define COMPq R1q -%define COMPd R1d - PUSH r10 PUSH r11 PUSH r12 - mov TABLEq, R1q + LOAD_SYM TABLEq, mangle(kCoefficientsRgbY) ; 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 5bc35aff89aa..253280da951b 100644 --- a/media/base/simd/yuv_to_rgb_table.cc +++ b/media/base/simd/yuv_to_rgb_table.cc @@ -335,335 +335,4 @@ 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(64 * i + 0.5), \ - static_cast(64 * i + 0.5), \ - static_cast(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(-0.34414 * 64 * (i - 128) + 0.5), \ - static_cast(1.772 * 64 * (i - 128) + 0.5), \ - static_cast(256 * 64 - 1) \ -} -#else -#define RGBU(i) { \ - static_cast(1.772 * 64 * (i - 128) + 0.5), \ - static_cast(-0.34414 * 64 * (i - 128) + 0.5), \ - 0, \ - static_cast(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(1.402 * 64 * (i - 128) + 0.5), \ - static_cast(-0.71414 * 64 * (i - 128) + 0.5), \ - 0, \ - 0 \ -} -#else -#define RGBV(i) { \ - 0, \ - static_cast(-0.813 * 64 * (i - 128) + 0.5), \ - static_cast(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 1ed6fd86cae3..aebf1b20d19b 100644 --- a/media/base/simd/yuv_to_rgb_table.h +++ b/media/base/simd/yuv_to_rgb_table.h @@ -20,7 +20,6 @@ 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 5ad8f3079fbd..2b27c1da4a9a 100644 --- a/media/base/yuv_convert.cc +++ b/media/base/yuv_convert.cc @@ -25,7 +25,6 @@ #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) @@ -80,24 +79,21 @@ typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, const uint8*, const uint8*, uint8*, - ptrdiff_t, - const int16[1024][4]); + ptrdiff_t); typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, const uint8*, const uint8*, const uint8*, uint8*, - ptrdiff_t, - const int16[1024][4]); + ptrdiff_t); typedef void (*ScaleYUVToRGB32RowProc)(const uint8*, const uint8*, const uint8*, uint8*, ptrdiff_t, - ptrdiff_t, - const int16[1024][4]); + ptrdiff_t); static FilterYUVRowsProc g_filter_yuv_rows_proc_ = NULL; static ConvertYUVToRGB32RowProc g_convert_yuv_to_rgb32_row_proc_ = NULL; @@ -116,31 +112,6 @@ 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_); @@ -251,7 +222,7 @@ void ScaleYUVToRGB32(const uint8* y_buf, if (source_width > kFilterBufferSize || view_rotate) filter = FILTER_NONE; - unsigned int y_shift = GetVerticalShift(yuv_type); + unsigned int y_shift = yuv_type; // Diagram showing origin and direction of source sampling. // ->0 4<- // 7 3 @@ -383,25 +354,14 @@ 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, kCoefficientsRgbY); + g_convert_yuv_to_rgb32_row_proc_(y_ptr, u_ptr, v_ptr, dest_pixel, width); } 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, - kCoefficientsRgbY); + g_linear_scale_yuv_to_rgb32_row_proc_( + y_ptr, u_ptr, v_ptr, dest_pixel, width, source_dx); } else { - g_scale_yuv_to_rgb32_row_proc_(y_ptr, - u_ptr, - v_ptr, - dest_pixel, - width, - source_dx, - kCoefficientsRgbY); + g_scale_yuv_to_rgb32_row_proc_( + y_ptr, u_ptr, v_ptr, dest_pixel, width, source_dx); } } } @@ -545,8 +505,7 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, rgb_buf, dest_rect_width, source_left, - x_step, - kCoefficientsRgbY); + x_step); } else { // If the frame is too large then we linear scale a single row. LinearScaleYUVToRGB32RowWithRange_C(y0_ptr, @@ -555,8 +514,7 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, rgb_buf, dest_rect_width, source_left, - x_step, - kCoefficientsRgbY); + x_step); } // Advance vertically in the source and destination image. diff --git a/media/base/yuv_convert.h b/media/base/yuv_convert.h index cf13edb17ab2..8f64c79689a3 100644 --- a/media/base/yuv_convert.h +++ b/media/base/yuv_convert.h @@ -7,7 +7,6 @@ #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 @@ -23,18 +22,12 @@ 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. - YV12J = 2, // YV12J is the same as YV12, but in JPEG color range. + YV16 = 0, // YV16 is half width and full height chroma channels. + YV12 = 1, // YV12 is half width and half height chroma channels. }; -// 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 7ff9041be19e..0188ce6e33f6 100644 --- a/media/base/yuv_convert_perftest.cc +++ b/media/base/yuv_convert_perftest.cc @@ -9,7 +9,6 @@ #include "base/path_service.h" #include "base/time/time.h" #include "media/base/simd/convert_yuv_to_rgb.h" -#include "media/base/simd/yuv_to_rgb_table.h" #include "media/base/yuv_convert.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/perf/perf_test.h" @@ -77,8 +76,7 @@ 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, - kCoefficientsRgbY); + kWidth); } } double total_time_seconds = @@ -102,8 +100,7 @@ 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, - kCoefficientsRgbY); + kWidth); } } double total_time_seconds = @@ -129,8 +126,7 @@ TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_MMX) { yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), kWidth, - kSourceDx, - kCoefficientsRgbY); + kSourceDx); } } double total_time_seconds = @@ -156,8 +152,7 @@ TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) { yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), kWidth, - kSourceDx, - kCoefficientsRgbY); + kSourceDx); } } double total_time_seconds = @@ -183,8 +178,7 @@ TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_MMX) { yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), kWidth, - kSourceDx, - kCoefficientsRgbY); + kSourceDx); } } double total_time_seconds = @@ -210,8 +204,7 @@ TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) { yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), rgb_bytes_converted_.get(), kWidth, - kSourceDx, - kCoefficientsRgbY); + kSourceDx); } } double total_time_seconds = diff --git a/media/base/yuv_convert_unittest.cc b/media/base/yuv_convert_unittest.cc index 73deb1ff9192..7c964f3771a5 100644 --- a/media/base/yuv_convert_unittest.cc +++ b/media/base/yuv_convert_unittest.cc @@ -11,7 +11,6 @@ #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" @@ -163,7 +162,6 @@ class YUVScaleTest : public ::testing::TestWithParam { YUVScaleTest() { switch (GetParam().yuv_type) { case media::YV12: - case media::YV12J: ReadYV12Data(&yuv_bytes_); break; case media::YV16: @@ -180,7 +178,6 @@ class YUVScaleTest : public ::testing::TestWithParam { 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; @@ -621,14 +618,12 @@ TEST(YUVConvertTest, ConvertYUVToRGB32Row_MMX) { yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), - kWidth, - GetLookupTable(YV12)); + kWidth); ConvertYUVToRGB32Row_MMX(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), - kWidth, - GetLookupTable(YV12)); + kWidth); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -652,14 +647,12 @@ TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) { yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), - kWidth, - GetLookupTable(YV12)); + kWidth); ConvertYUVToRGB32Row_SSE(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), - kWidth, - GetLookupTable(YV12)); + kWidth); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -685,15 +678,13 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_MMX) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); ScaleYUVToRGB32Row_MMX(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -719,15 +710,13 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); ScaleYUVToRGB32Row_SSE(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -753,15 +742,13 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); LinearScaleYUVToRGB32Row_MMX(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -787,15 +774,13 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); LinearScaleYUVToRGB32Row_SSE(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -939,15 +924,13 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE2_X64) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); ScaleYUVToRGB32Row_SSE2_X64(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), @@ -967,15 +950,13 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX_X64) { yuv_bytes.get() + kSourceVOffset, rgb_bytes_reference.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); LinearScaleYUVToRGB32Row_MMX_X64(yuv_bytes.get(), yuv_bytes.get() + kSourceUOffset, yuv_bytes.get() + kSourceVOffset, rgb_bytes_converted.get(), kWidth, - kSourceDx, - GetLookupTable(YV12)); + kSourceDx); media::EmptyRegisterState(); EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), rgb_bytes_converted.get(), diff --git a/media/filters/skcanvas_video_renderer.cc b/media/filters/skcanvas_video_renderer.cc index 998a6403e507..9781b4c49715 100644 --- a/media/filters/skcanvas_video_renderer.cc +++ b/media/filters/skcanvas_video_renderer.cc @@ -88,7 +88,7 @@ static void FastPaint( } if (video_frame->format() == media::VideoFrame::YV12J) { - yuv_type = media::YV12J; + yuv_type = media::YV12; y_shift = 1; } @@ -229,19 +229,6 @@ static void ConvertVideoFrameToBitmap( switch (video_frame->format()) { case media::VideoFrame::YV12: case media::VideoFrame::I420: - media::ConvertYUVToRGB32( - video_frame->data(media::VideoFrame::kYPlane) + y_offset, - video_frame->data(media::VideoFrame::kUPlane) + uv_offset, - video_frame->data(media::VideoFrame::kVPlane) + uv_offset, - static_cast(bitmap->getPixels()), - video_frame->visible_rect().width(), - video_frame->visible_rect().height(), - video_frame->stride(media::VideoFrame::kYPlane), - video_frame->stride(media::VideoFrame::kUPlane), - bitmap->rowBytes(), - media::YV12); - break; - case media::VideoFrame::YV12J: media::ConvertYUVToRGB32( video_frame->data(media::VideoFrame::kYPlane) + y_offset, @@ -253,7 +240,7 @@ static void ConvertVideoFrameToBitmap( video_frame->stride(media::VideoFrame::kYPlane), video_frame->stride(media::VideoFrame::kUPlane), bitmap->rowBytes(), - media::YV12J); + media::YV12); break; case media::VideoFrame::YV16: -- 2.11.4.GIT