diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 08:24:32 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 08:24:32 +0000 |
commit | 433e9a1e0ba40fca511aa903932781c703caf75b (patch) | |
tree | e3721a7732026920e9949c18795d7550d0b23a78 /media/base/yuv_row_posix.cc | |
parent | 39ca7de68778d0987c7308d5e6c19886c2bbcfc6 (diff) | |
download | chromium_src-433e9a1e0ba40fca511aa903932781c703caf75b.zip chromium_src-433e9a1e0ba40fca511aa903932781c703caf75b.tar.gz chromium_src-433e9a1e0ba40fca511aa903932781c703caf75b.tar.bz2 |
Filter YUV scaling at half size and below with center of pixel
BUG=19113
TEST=use playerwtl and reduce size to half and turn filtering on/off. Should look better.
Review URL: http://codereview.chromium.org/1625017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/yuv_row_posix.cc')
-rw-r--r-- | media/base/yuv_row_posix.cc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/media/base/yuv_row_posix.cc b/media/base/yuv_row_posix.cc index 6bd2367..c38ac1f 100644 --- a/media/base/yuv_row_posix.cc +++ b/media/base/yuv_row_posix.cc @@ -149,9 +149,13 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, int width, int source_dx) { asm( - "xor %%r11,%%r11\n" + "xor %%r11,%%r11\n" // x = 0 "sub $0x2,%4\n" "js .lscalenext\n" + "cmp $0x20000,%6\n" // if source_dx >= 2.0 + "jl .lscalehalf\n" + "mov $0x8000,%%r11\n" // x = 0.5 for 1/2 or less +".lscalehalf:" ".lscaleloop:" "mov %%r11,%%r10\n" @@ -407,14 +411,17 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, "mov 0x24(%esp),%edx\n" "mov 0x28(%esp),%edi\n" "mov 0x30(%esp),%ebp\n" - "xor %ebx,%ebx\n" // source_width = width * source_dx + ebx "mov 0x34(%esp), %ecx\n" "imull 0x38(%esp), %ecx\n" - "addl %ebx, %ecx\n" "mov %ecx, 0x34(%esp)\n" + "mov 0x38(%esp), %ecx\n" + "xor %ebx,%ebx\n" // x = 0 + "cmp $0x20000,%ecx\n" // if source_dx >= 2.0 + "jl .lscaleend\n" + "mov $0x8000,%ebx\n" // x = 0.5 for 1/2 or less "jmp .lscaleend\n" ".lscaleloop:" @@ -675,9 +682,13 @@ void PICLinearScaleYUVToRGB32Row(const uint8* y_buf, // source_width = width * source_dx + ebx "mov 0x34(%esp), %ecx\n" "imull 0x38(%esp), %ecx\n" - "addl %ebx, %ecx\n" "mov %ecx, 0x34(%esp)\n" + "mov 0x38(%esp), %ecx\n" + "xor %ebx,%ebx\n" // x = 0 + "cmp $0x20000,%ecx\n" // if source_dx >= 2.0 + "jl .lscaleend\n" + "mov $0x8000,%ebx\n" // x = 0.5 for 1/2 or less "jmp .lscaleend\n" ".lscaleloop:" @@ -775,7 +786,7 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, &kCoefficientsRgbY[0][0]); } -#else // Use C code instead of MMX/SSE2. +#else // USE_MMX // C reference code that mimic the YUV assembly. #define packuswb(x) ((x) < 0 ? 0 : ((x) > 255 ? 255 : (x))) @@ -887,6 +898,9 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, int width, int source_dx) { int x = 0; + if (source_dx >= 0x20000) { + x = 32768; + } for (int i = 0; i < width; i += 2) { int y0 = y_buf[x >> 16]; int y1 = y_buf[(x >> 16) + 1]; |