diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-15 02:13:10 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-15 02:13:10 +0000 |
commit | 596026f49c473b458597e0a4dcd8220cad700c89 (patch) | |
tree | c4788da50f5c4bce0942c033540830b17136d0bb /media | |
parent | 70277f6b896c776999e356d6546d65fd999dea05 (diff) | |
download | chromium_src-596026f49c473b458597e0a4dcd8220cad700c89.zip chromium_src-596026f49c473b458597e0a4dcd8220cad700c89.tar.gz chromium_src-596026f49c473b458597e0a4dcd8220cad700c89.tar.bz2 |
fix arm warnings
BUG=19113
TEST=builds on arm
Review URL: http://codereview.chromium.org/1553033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/base/yuv_convert.cc | 11 | ||||
-rw-r--r-- | media/base/yuv_convert.h | 4 | ||||
-rw-r--r-- | media/base/yuv_row.h | 14 | ||||
-rw-r--r-- | media/base/yuv_row_posix.cc | 72 | ||||
-rw-r--r-- | media/base/yuv_row_win.cc | 224 |
5 files changed, 163 insertions, 162 deletions
diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc index e9b8c59..b5ddf64 100644 --- a/media/base/yuv_convert.cc +++ b/media/base/yuv_convert.cc @@ -44,14 +44,14 @@ void ConvertYUVToRGB32(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, - int source_height, + int width, + int height, int y_pitch, int uv_pitch, int rgb_pitch, YUVType yuv_type) { unsigned int y_shift = yuv_type; - for (int y = 0; y < source_height; ++y) { + for (int y = 0; y < height; ++y) { uint8* rgb_row = rgb_buf + y * rgb_pitch; const uint8* y_ptr = y_buf + y * y_pitch; const uint8* u_ptr = u_buf + (y >> y_shift) * uv_pitch; @@ -61,7 +61,7 @@ void ConvertYUVToRGB32(const uint8* y_buf, u_ptr, v_ptr, rgb_row, - source_width); + width); } // MMX used for FastConvertYUVToRGB32Row requires emms instruction. @@ -134,9 +134,6 @@ static void FilterRows(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, int source_width, int source_y_fraction) { int y1_fraction = source_y_fraction >> 8; int y0_fraction = 256 - (source_y_fraction >> 8); - - int y0_fraction = kFractionMax - source_y_fraction; - int y1_fraction = source_y_fraction; uint8* end = ybuf + source_width; if (ybuf < end) { do { diff --git a/media/base/yuv_convert.h b/media/base/yuv_convert.h index 2ef4847..d55337d 100644 --- a/media/base/yuv_convert.h +++ b/media/base/yuv_convert.h @@ -41,8 +41,8 @@ void ConvertYUVToRGB32(const uint8* yplane, const uint8* uplane, const uint8* vplane, uint8* rgbframe, - int source_width, - int source_height, + int width, + int height, int ystride, int uvstride, int rgbstride, diff --git a/media/base/yuv_row.h b/media/base/yuv_row.h index 7855b9b..262d9a0 100644 --- a/media/base/yuv_row.h +++ b/media/base/yuv_row.h @@ -19,7 +19,7 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width); + int width); // Can do 1x, half size or any scale down by an integer amount. // Step can be negative (mirroring, rotate 180). @@ -28,7 +28,7 @@ void ConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int step); // Rotate is like Convert, but applies different step to Y versus U and V. @@ -38,7 +38,7 @@ void RotateConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int ystep, int uvstep); @@ -48,7 +48,7 @@ void DoubleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width); + int width); // Handles arbitrary scaling up or down. // Mirroring is supported, but not 90 or 270 degree rotation. @@ -58,15 +58,15 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx); void LinearScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, - int dx); + int width, + int source_dx); #if defined(_MSC_VER) #define SIMD_ALIGNED(var) __declspec(align(16)) var diff --git a/media/base/yuv_row_posix.cc b/media/base/yuv_row_posix.cc index b992177..6bd2367 100644 --- a/media/base/yuv_row_posix.cc +++ b/media/base/yuv_row_posix.cc @@ -19,7 +19,7 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, // rdi const uint8* u_buf, // rsi const uint8* v_buf, // rdx uint8* rgb_buf, // rcx - int source_width) { // r8 + int width) { // r8 asm( "jmp convertend\n" "convertloop:" @@ -67,7 +67,7 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, // rdi "r"(u_buf), // %1 "r"(v_buf), // %2 "r"(rgb_buf), // %3 - "r"(source_width), // %4 + "r"(width), // %4 "r" (kCoefficientsRgbY) // %5 : "memory", "r10", "r11", "xmm0", "xmm1", "xmm2", "xmm3" ); @@ -77,7 +77,7 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, // rdi const uint8* u_buf, // rsi const uint8* v_buf, // rdx uint8* rgb_buf, // rcx - int source_width, // r8 + int width, // r8 int source_dx) { // r9 asm( "xor %%r11,%%r11\n" @@ -135,7 +135,7 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, // rdi "r"(u_buf), // %1 "r"(v_buf), // %2 "r"(rgb_buf), // %3 - "r"(source_width), // %4 + "r"(width), // %4 "r" (kCoefficientsRgbY), // %5 "r"(static_cast<long>(source_dx)) // %6 : "memory", "r10", "r11", "rax", "xmm0", "xmm1", "xmm2" @@ -146,7 +146,7 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx) { asm( "xor %%r11,%%r11\n" @@ -248,7 +248,7 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, "r"(u_buf), // %1 "r"(v_buf), // %2 "r"(rgb_buf), // %3 - "r"(source_width), // %4 + "r"(width), // %4 "r" (kCoefficientsRgbY), // %5 "r"(static_cast<long>(source_dx)) // %6 : "memory", "r10", "r11", "r13", "r14", "rax", "xmm0", "xmm1", "xmm2" @@ -264,7 +264,7 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width); + int width); asm( ".global FastConvertYUVToRGB32Row\n" @@ -323,7 +323,7 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx); asm( @@ -397,7 +397,7 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx); asm( @@ -409,7 +409,7 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, "mov 0x30(%esp),%ebp\n" "xor %ebx,%ebx\n" - // source_width = source_width * source_dx + ebx + // source_width = width * source_dx + ebx "mov 0x34(%esp), %ecx\n" "imull 0x38(%esp), %ecx\n" "addl %ebx, %ecx\n" @@ -507,7 +507,7 @@ extern void PICConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int16 *kCoefficientsRgbY); __asm__( "_PICConvertYUVToRGB32Row:\n" @@ -565,8 +565,8 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width) { - PICConvertYUVToRGB32Row(y_buf, u_buf, v_buf, rgb_buf, source_width, + int width) { + PICConvertYUVToRGB32Row(y_buf, u_buf, v_buf, rgb_buf, width, &kCoefficientsRgbY[0][0]); } @@ -574,7 +574,7 @@ extern void PICScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx, int16 *kCoefficientsRgbY); @@ -649,9 +649,9 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx) { - PICScaleYUVToRGB32Row(y_buf, u_buf, v_buf, rgb_buf, source_width, source_dx, + PICScaleYUVToRGB32Row(y_buf, u_buf, v_buf, rgb_buf, width, source_dx, &kCoefficientsRgbY[0][0]); } @@ -659,7 +659,7 @@ void PICLinearScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx, int16 *kCoefficientsRgbY); @@ -672,7 +672,7 @@ void PICLinearScaleYUVToRGB32Row(const uint8* y_buf, "mov 0x3c(%esp),%edi\n" "xor %ebx,%ebx\n" - // source_width = source_width * source_dx + ebx + // source_width = width * source_dx + ebx "mov 0x34(%esp), %ecx\n" "imull 0x38(%esp), %ecx\n" "addl %ebx, %ecx\n" @@ -769,9 +769,9 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx) { - PICLinearScaleYUVToRGB32Row(y_buf, u_buf, v_buf, rgb_buf, source_width, source_dx, + PICLinearScaleYUVToRGB32Row(y_buf, u_buf, v_buf, rgb_buf, width, source_dx, &kCoefficientsRgbY[0][0]); } @@ -779,7 +779,7 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, // C reference code that mimic the YUV assembly. #define packuswb(x) ((x) < 0 ? 0 : ((x) > 255 ? 255 : (x))) -#define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \\ +#define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \ (((x) + (y)) > 32767 ? 32767 : ((x) + (y)))) static inline void YuvPixel(uint8 y, @@ -840,13 +840,13 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width) { - for (int x = 0; x < source_width; x += 2) { + int 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]; YuvPixel(y0, u, v, rgb_buf); - if ((x + 1) < source_width) { + if ((x + 1) < width) { uint8 y1 = y_buf[x + 1]; YuvPixel(y1, u, v, rgb_buf + 4); } @@ -862,19 +862,19 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, - int dx) { + int width, + int source_dx) { int x = 0; - for (int i = 0; i < source_width; i += 2) { + 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)]; YuvPixel(y, u, v, rgb_buf); - x += dx; - if ((i + 1) < source_width) { + x += source_dx; + if ((i + 1) < width) { y = y_buf[x >> 16]; YuvPixel(y, u, v, rgb_buf+4); - x += dx; + x += source_dx; } rgb_buf += 8; } @@ -884,10 +884,10 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, - int dx) { + int width, + int source_dx) { int x = 0; - for (int i = 0; i < source_width; i += 2) { + for (int i = 0; i < width; i += 2) { int y0 = y_buf[x >> 16]; int y1 = y_buf[(x >> 16) + 1]; int u0 = u_buf[(x >> 17)]; @@ -900,14 +900,14 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, int u = (uv_frac * u1 + (uv_frac ^ 65535) * u0) >> 16; int v = (uv_frac * v1 + (uv_frac ^ 65535) * v0) >> 16; YuvPixel(y, u, v, rgb_buf); - x += dx; - if ((i + 1) < source_width) { + x += source_dx; + if ((i + 1) < 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; YuvPixel(y, u, v, rgb_buf+4); - x += dx; + x += source_dx; } rgb_buf += 8; } diff --git a/media/base/yuv_row_win.cc b/media/base/yuv_row_win.cc index e5354a8..1315ae4 100644 --- a/media/base/yuv_row_win.cc +++ b/media/base/yuv_row_win.cc @@ -15,14 +15,14 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width) { + int width) { __asm { pushad mov edx, [esp + 32 + 4] // Y mov edi, [esp + 32 + 8] // U mov esi, [esp + 32 + 12] // V mov ebp, [esp + 32 + 16] // rgb - mov ecx, [esp + 32 + 20] // source_width + mov ecx, [esp + 32 + 20] // width jmp convertend convertloop : @@ -73,7 +73,7 @@ void ConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int step) { __asm { pushad @@ -81,7 +81,7 @@ void ConvertYUVToRGB32Row(const uint8* y_buf, mov edi, [esp + 32 + 8] // U mov esi, [esp + 32 + 12] // V mov ebp, [esp + 32 + 16] // rgb - mov ecx, [esp + 32 + 20] // source_width + mov ecx, [esp + 32 + 20] // width mov ebx, [esp + 32 + 24] // step jmp wend @@ -134,7 +134,7 @@ void RotateConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int ystep, int uvstep) { __asm { @@ -143,7 +143,7 @@ void RotateConvertYUVToRGB32Row(const uint8* y_buf, mov edi, [esp + 32 + 8] // U mov esi, [esp + 32 + 12] // V mov ebp, [esp + 32 + 16] // rgb - mov ecx, [esp + 32 + 20] // source_width + mov ecx, [esp + 32 + 20] // width jmp wend wloop : @@ -197,14 +197,14 @@ void DoubleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width) { + int width) { __asm { pushad mov edx, [esp + 32 + 4] // Y mov edi, [esp + 32 + 8] // U mov esi, [esp + 32 + 12] // V mov ebp, [esp + 32 + 16] // rgb - mov ecx, [esp + 32 + 20] // source_width + mov ecx, [esp + 32 + 20] // width jmp wend wloop : @@ -269,15 +269,15 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, - int dx) { + int width, + int source_dx) { __asm { pushad mov edx, [esp + 32 + 4] // Y mov edi, [esp + 32 + 8] // U mov esi, [esp + 32 + 12] // V mov ebp, [esp + 32 + 16] // rgb - mov ecx, [esp + 32 + 20] // source_width + mov ecx, [esp + 32 + 20] // width xor ebx, ebx // x jmp scaleend @@ -291,12 +291,12 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, movzx eax, byte ptr [esi + eax] paddsw mm0, [kCoefficientsRgbV + 8 * eax] mov eax, ebx - add ebx, [esp + 32 + 24] // x += dx + add ebx, [esp + 32 + 24] // x += source_dx sar eax, 16 movzx eax, byte ptr [edx + eax] movq mm1, [kCoefficientsRgbY + 8 * eax] mov eax, ebx - add ebx, [esp + 32 + 24] // x += dx + add ebx, [esp + 32 + 24] // x += source_dx sar eax, 16 movzx eax, byte ptr [edx + eax] movq mm2, [kCoefficientsRgbY + 8 * eax] @@ -342,91 +342,92 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, + int width, int source_dx) { -__asm { + __asm { pushad - mov edx, [esp + 32 + 4] - mov edi, [esp + 32 + 8] - mov ebp, [esp + 32 + 16] - mov ecx, [esp + 32 + 20] // source_width = source_width * source_dx + ebx - imul ecx, [esp + 32 + 24] - xor ebx, ebx - add ecx, ebx - mov [esp + 32 + 20], ecx - jmp lscaleend + mov edx, [esp + 32 + 4] // Y + mov edi, [esp + 32 + 8] // U + // [esp + 32 + 12] // V + mov ebp, [esp + 32 + 16] // rgb + mov ecx, [esp + 32 + 20] // width + imul ecx, [esp + 32 + 24] // source_dx + mov [esp + 32 + 20], ecx // source_width = width * source_dx + xor ebx, ebx // x + + jmp lscaleend lscaleloop: - mov eax, ebx - sar eax, 0x11 - - movzx ecx, byte ptr [edi + eax] - movzx esi, byte ptr [edi + eax + 1] - mov eax, ebx - and eax, 0x1fffe - imul esi, eax - xor eax, 0x1fffe - imul ecx, eax - add ecx, esi - shr ecx, 17 - movq mm0, [kCoefficientsRgbU + 8 * ecx] - - mov esi, [esp + 0x2c] - mov eax, ebx - sar eax, 0x11 - - movzx ecx, byte ptr [esi + eax] - movzx esi, byte ptr [esi + eax + 1] - mov eax, ebx - and eax, 0x1fffe - imul esi, eax - xor eax, 0x1fffe - imul ecx, eax - add ecx, esi - shr ecx, 17 - paddsw mm0, [kCoefficientsRgbV + 8 * ecx] - - mov eax, ebx - sar eax, 0x10 - movzx ecx, byte ptr [edx + eax] - movzx esi, byte ptr [1 + edx + eax] - mov eax, ebx - add ebx, [esp + 0x38] - and eax, 0xffff - imul esi, eax - xor eax, 0xffff - imul ecx, eax - add ecx, esi - shr ecx, 16 - movq mm1, [kCoefficientsRgbY + 8 * ecx] - - cmp ebx, [esp + 0x34] - jge lscalelastpixel - - mov eax, ebx - sar eax, 0x10 - movzx ecx, byte ptr [edx + eax] - movzx esi, byte ptr [edx + eax + 1] - mov eax, ebx - add ebx, [esp + 0x38] - and eax, 0xffff - imul esi, eax - xor eax, 0xffff - imul ecx, eax - add ecx, esi - shr ecx, 16 - movq mm2, [kCoefficientsRgbY + 8 * ecx] - - paddsw mm1, mm0 - paddsw mm2, mm0 - psraw mm1, 0x6 - psraw mm2, 0x6 - packuswb mm1, mm2 - movntq [ebp], mm1 - add ebp, 0x8 + mov eax, ebx + sar eax, 0x11 + + movzx ecx, byte ptr [edi + eax] + movzx esi, byte ptr [edi + eax + 1] + mov eax, ebx + and eax, 0x1fffe + imul esi, eax + xor eax, 0x1fffe + imul ecx, eax + add ecx, esi + shr ecx, 17 + movq mm0, [kCoefficientsRgbU + 8 * ecx] + + mov esi, [esp + 32 + 12] + mov eax, ebx + sar eax, 0x11 + + movzx ecx, byte ptr [esi + eax] + movzx esi, byte ptr [esi + eax + 1] + mov eax, ebx + and eax, 0x1fffe + imul esi, eax + xor eax, 0x1fffe + imul ecx, eax + add ecx, esi + shr ecx, 17 + paddsw mm0, [kCoefficientsRgbV + 8 * ecx] + + mov eax, ebx + sar eax, 0x10 + movzx ecx, byte ptr [edx + eax] + movzx esi, byte ptr [1 + edx + eax] + mov eax, ebx + add ebx, [esp + 32 + 24] + and eax, 0xffff + imul esi, eax + xor eax, 0xffff + imul ecx, eax + add ecx, esi + shr ecx, 16 + movq mm1, [kCoefficientsRgbY + 8 * ecx] + + cmp ebx, [esp + 32 + 20] + jge lscalelastpixel + + mov eax, ebx + sar eax, 0x10 + movzx ecx, byte ptr [edx + eax] + movzx esi, byte ptr [edx + eax + 1] + mov eax, ebx + add ebx, [esp + 32 + 24] + and eax, 0xffff + imul esi, eax + xor eax, 0xffff + imul ecx, eax + add ecx, esi + shr ecx, 16 + movq mm2, [kCoefficientsRgbY + 8 * ecx] + + paddsw mm1, mm0 + paddsw mm2, mm0 + psraw mm1, 0x6 + psraw mm2, 0x6 + packuswb mm1, mm2 + movntq [ebp], mm1 + add ebp, 0x8 lscaleend: - cmp ebx, [esp + 0x34] - jl lscaleloop + cmp ebx, [esp + 32 + 20] + jl lscaleloop popad ret @@ -437,13 +438,13 @@ lscalelastpixel: movd [ebp], mm1 popad ret -}; + }; } #else // USE_MMX // C reference code that mimic the YUV assembly. #define packuswb(x) ((x) < 0 ? 0 : ((x) > 255 ? 255 : (x))) -#define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \\ +#define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \ (((x) + (y)) > 32767 ? 32767 : ((x) + (y)))) static inline void YuvPixel(uint8 y, @@ -504,13 +505,13 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width) { - for (int x = 0; x < source_width; x += 2) { + int 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]; YuvPixel(y0, u, v, rgb_buf); - if ((x + 1) < source_width) { + if ((x + 1) < width) { uint8 y1 = y_buf[x + 1]; YuvPixel(y1, u, v, rgb_buf + 4); } @@ -526,19 +527,19 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, - int dx) { + int width, + int source_dx) { int x = 0; - for (int i = 0; i < source_width; i += 2) { + 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)]; YuvPixel(y, u, v, rgb_buf); - x += dx; - if ((i + 1) < source_width) { + x += source_dx; + if ((i + 1) < width) { y = y_buf[x >> 16]; YuvPixel(y, u, v, rgb_buf+4); - x += dx; + x += source_dx; } rgb_buf += 8; } @@ -548,10 +549,13 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, - int source_width, - int dx) { + int width, + int source_dx) { int x = 0; - for (int i = 0; i < source_width; i += 2) { + if (source_dx >= 2) { + x = 32768; + } + for (int i = 0; i < width; i += 2) { int y0 = y_buf[x >> 16]; int y1 = y_buf[(x >> 16) + 1]; int u0 = u_buf[(x >> 17)]; @@ -564,14 +568,14 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, int u = (uv_frac * u1 + (uv_frac ^ 65535) * u0) >> 16; int v = (uv_frac * v1 + (uv_frac ^ 65535) * v0) >> 16; YuvPixel(y, u, v, rgb_buf); - x += dx; - if ((i + 1) < source_width) { + x += source_dx; + if ((i + 1) < 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; YuvPixel(y, u, v, rgb_buf+4); - x += dx; + x += source_dx; } rgb_buf += 8; } |