Commit 5aa39953 authored by fbarchard@google.com's avatar fbarchard@google.com

Port scale to C moving variable definitions to top of functions.

BUG=303
TESTED=gyp builds still build/pass.
R=tpsiaki@google.com

Review URL: https://webrtc-codereview.appspot.com/6949004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@962 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent ecf5a144
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 960 Version: 961
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 960 #define LIBYUV_VERSION 961
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -82,7 +82,8 @@ static void ScalePlaneDown2(int src_width, int src_height, ...@@ -82,7 +82,8 @@ static void ScalePlaneDown2(int src_width, int src_height,
src_stride = 0; src_stride = 0;
} }
// TODO(fbarchard): Loop through source height to allow odd height. // TODO(fbarchard): Loop through source height to allow odd height.
for (int y = 0; y < dst_height; ++y) { int y;
for (y = 0; y < dst_height; ++y) {
ScaleRowDown2(src_ptr, src_stride, dst_ptr, dst_width); ScaleRowDown2(src_ptr, src_stride, dst_ptr, dst_width);
src_ptr += row_stride; src_ptr += row_stride;
dst_ptr += dst_stride; dst_ptr += dst_stride;
...@@ -128,7 +129,8 @@ static void ScalePlaneDown4(int src_width, int src_height, ...@@ -128,7 +129,8 @@ static void ScalePlaneDown4(int src_width, int src_height,
if (filtering == kFilterLinear) { if (filtering == kFilterLinear) {
src_stride = 0; src_stride = 0;
} }
for (int y = 0; y < dst_height; ++y) { int y;
for (y = 0; y < dst_height; ++y) {
ScaleRowDown4(src_ptr, src_stride, dst_ptr, dst_width); ScaleRowDown4(src_ptr, src_stride, dst_ptr, dst_width);
src_ptr += row_stride; src_ptr += row_stride;
dst_ptr += dst_stride; dst_ptr += dst_stride;
...@@ -192,7 +194,8 @@ static void ScalePlaneDown34(int src_width, int src_height, ...@@ -192,7 +194,8 @@ static void ScalePlaneDown34(int src_width, int src_height,
#endif #endif
const int filter_stride = (filtering == kFilterLinear) ? 0 : src_stride; const int filter_stride = (filtering == kFilterLinear) ? 0 : src_stride;
for (int y = 0; y < dst_height - 2; y += 3) { int y;
for (y = 0; y < dst_height - 2; y += 3) {
ScaleRowDown34_0(src_ptr, filter_stride, dst_ptr, dst_width); ScaleRowDown34_0(src_ptr, filter_stride, dst_ptr, dst_width);
src_ptr += src_stride; src_ptr += src_stride;
dst_ptr += dst_stride; dst_ptr += dst_stride;
...@@ -285,7 +288,8 @@ static void ScalePlaneDown38(int src_width, int src_height, ...@@ -285,7 +288,8 @@ static void ScalePlaneDown38(int src_width, int src_height,
#endif #endif
const int filter_stride = (filtering == kFilterLinear) ? 0 : src_stride; const int filter_stride = (filtering == kFilterLinear) ? 0 : src_stride;
for (int y = 0; y < dst_height - 2; y += 3) { int y;
for (y = 0; y < dst_height - 2; y += 3) {
ScaleRowDown38_3(src_ptr, filter_stride, dst_ptr, dst_width); ScaleRowDown38_3(src_ptr, filter_stride, dst_ptr, dst_width);
src_ptr += src_stride * 3; src_ptr += src_stride * 3;
dst_ptr += dst_stride; dst_ptr += dst_stride;
...@@ -313,8 +317,10 @@ static __inline uint32 SumBox(int iboxwidth, int iboxheight, ...@@ -313,8 +317,10 @@ static __inline uint32 SumBox(int iboxwidth, int iboxheight,
assert(iboxwidth > 0); assert(iboxwidth > 0);
assert(iboxheight > 0); assert(iboxheight > 0);
uint32 sum = 0u; uint32 sum = 0u;
for (int y = 0; y < iboxheight; ++y) { int y;
for (int x = 0; x < iboxwidth; ++x) { for (y = 0; y < iboxheight; ++y) {
int x;
for (x = 0; x < iboxwidth; ++x) {
sum += src_ptr[x]; sum += src_ptr[x];
} }
src_ptr += src_stride; src_ptr += src_stride;
...@@ -325,7 +331,8 @@ static __inline uint32 SumBox(int iboxwidth, int iboxheight, ...@@ -325,7 +331,8 @@ static __inline uint32 SumBox(int iboxwidth, int iboxheight,
static void ScalePlaneBoxRow_C(int dst_width, int boxheight, static void ScalePlaneBoxRow_C(int dst_width, int boxheight,
int x, int dx, ptrdiff_t src_stride, int x, int dx, ptrdiff_t src_stride,
const uint8* src_ptr, uint8* dst_ptr) { const uint8* src_ptr, uint8* dst_ptr) {
for (int i = 0; i < dst_width; ++i) { int i;
for (i = 0; i < dst_width; ++i) {
int ix = x >> 16; int ix = x >> 16;
x += dx; x += dx;
int boxwidth = (x >> 16) - ix; int boxwidth = (x >> 16) - ix;
...@@ -337,7 +344,8 @@ static void ScalePlaneBoxRow_C(int dst_width, int boxheight, ...@@ -337,7 +344,8 @@ static void ScalePlaneBoxRow_C(int dst_width, int boxheight,
static __inline uint32 SumPixels(int iboxwidth, const uint16* src_ptr) { static __inline uint32 SumPixels(int iboxwidth, const uint16* src_ptr) {
assert(iboxwidth > 0); assert(iboxwidth > 0);
uint32 sum = 0u; uint32 sum = 0u;
for (int x = 0; x < iboxwidth; ++x) { int x;
for (x = 0; x < iboxwidth; ++x) {
sum += src_ptr[x]; sum += src_ptr[x];
} }
return sum; return sum;
...@@ -350,7 +358,8 @@ static void ScaleAddCols2_C(int dst_width, int boxheight, int x, int dx, ...@@ -350,7 +358,8 @@ static void ScaleAddCols2_C(int dst_width, int boxheight, int x, int dx,
scaletbl[0] = 65536 / (minboxwidth * boxheight); scaletbl[0] = 65536 / (minboxwidth * boxheight);
scaletbl[1] = 65536 / ((minboxwidth + 1) * boxheight); scaletbl[1] = 65536 / ((minboxwidth + 1) * boxheight);
int* scaleptr = scaletbl - minboxwidth; int* scaleptr = scaletbl - minboxwidth;
for (int i = 0; i < dst_width; ++i) { int i;
for (i = 0; i < dst_width; ++i) {
int ix = x >> 16; int ix = x >> 16;
x += dx; x += dx;
int boxwidth = (x >> 16) - ix; int boxwidth = (x >> 16) - ix;
...@@ -362,7 +371,8 @@ static void ScaleAddCols1_C(int dst_width, int boxheight, int x, int dx, ...@@ -362,7 +371,8 @@ static void ScaleAddCols1_C(int dst_width, int boxheight, int x, int dx,
const uint16* src_ptr, uint8* dst_ptr) { const uint16* src_ptr, uint8* dst_ptr) {
int boxwidth = (dx >> 16); int boxwidth = (dx >> 16);
int scaleval = 65536 / (boxwidth * boxheight); int scaleval = 65536 / (boxwidth * boxheight);
for (int i = 0; i < dst_width; ++i) { int i;
for (i = 0; i < dst_width; ++i) {
*dst_ptr++ = SumPixels(boxwidth, src_ptr + x) * scaleval >> 16; *dst_ptr++ = SumPixels(boxwidth, src_ptr + x) * scaleval >> 16;
x += boxwidth; x += boxwidth;
} }
...@@ -391,7 +401,8 @@ static void ScalePlaneBox(int src_width, int src_height, ...@@ -391,7 +401,8 @@ static void ScalePlaneBox(int src_width, int src_height,
// TODO(fbarchard): Remove this and make AddRows handle boxheight 1. // TODO(fbarchard): Remove this and make AddRows handle boxheight 1.
if (!IS_ALIGNED(src_width, 16) || dst_height * 2 > src_height) { if (!IS_ALIGNED(src_width, 16) || dst_height * 2 > src_height) {
uint8* dst = dst_ptr; uint8* dst = dst_ptr;
for (int j = 0; j < dst_height; ++j) { int j;
for (j = 0; j < dst_height; ++j) {
int iy = y >> 16; int iy = y >> 16;
const uint8* src = src_ptr + iy * src_stride; const uint8* src = src_ptr + iy * src_stride;
y += dy; y += dy;
...@@ -424,7 +435,8 @@ static void ScalePlaneBox(int src_width, int src_height, ...@@ -424,7 +435,8 @@ static void ScalePlaneBox(int src_width, int src_height,
} }
#endif #endif
for (int j = 0; j < dst_height; ++j) { int j;
for (j = 0; j < dst_height; ++j) {
int iy = y >> 16; int iy = y >> 16;
const uint8* src = src_ptr + iy * src_stride; const uint8* src = src_ptr + iy * src_stride;
y += dy; y += dy;
...@@ -521,7 +533,8 @@ void ScalePlaneBilinearDown(int src_width, int src_height, ...@@ -521,7 +533,8 @@ void ScalePlaneBilinearDown(int src_width, int src_height,
align_buffer_64(row, src_width); align_buffer_64(row, src_width);
const int max_y = (src_height - 1) << 16; const int max_y = (src_height - 1) << 16;
for (int j = 0; j < dst_height; ++j) { int j;
for (j = 0; j < dst_height; ++j) {
if (y > max_y) { if (y > max_y) {
y = max_y; y = max_y;
} }
...@@ -649,7 +662,8 @@ void ScalePlaneBilinearUp(int src_width, int src_height, ...@@ -649,7 +662,8 @@ void ScalePlaneBilinearUp(int src_width, int src_height,
ScaleFilterCols(rowptr + rowstride, src, dst_width, x, dx); ScaleFilterCols(rowptr + rowstride, src, dst_width, x, dx);
src += src_stride; src += src_stride;
for (int j = 0; j < dst_height; ++j) { int j;
for (j = 0; j < dst_height; ++j) {
yi = y >> 16; yi = y >> 16;
if (yi != lasty) { if (yi != lasty) {
if (y > max_y) { if (y > max_y) {
...@@ -708,7 +722,8 @@ static void ScalePlaneSimple(int src_width, int src_height, ...@@ -708,7 +722,8 @@ static void ScalePlaneSimple(int src_width, int src_height,
#endif #endif
} }
for (int i = 0; i < dst_height; ++i) { int i;
for (i = 0; i < dst_height; ++i) {
ScaleCols(dst_ptr, src_ptr + (y >> 16) * src_stride, ScaleCols(dst_ptr, src_ptr + (y >> 16) * src_stride,
dst_width, x, dx); dst_width, x, dx);
dst_ptr += dst_stride; dst_ptr += dst_stride;
......
...@@ -36,6 +36,13 @@ static void ScaleARGBDown2(int src_width, int src_height, ...@@ -36,6 +36,13 @@ static void ScaleARGBDown2(int src_width, int src_height,
const uint8* src_argb, uint8* dst_argb, const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy, int x, int dx, int y, int dy,
enum FilterMode filtering) { enum FilterMode filtering) {
int j;
int row_stride = src_stride * (dy >> 16);
void (*ScaleARGBRowDown2)(const uint8* src_argb, ptrdiff_t src_stride,
uint8* dst_argb, int dst_width) =
filtering == kFilterNone ? ScaleARGBRowDown2_C :
(filtering == kFilterLinear ? ScaleARGBRowDown2Linear_C :
ScaleARGBRowDown2Box_C);
assert(dx == 65536 * 2); // Test scale factor of 2. assert(dx == 65536 * 2); // Test scale factor of 2.
assert((dy & 0x1ffff) == 0); // Test vertical scale is multiple of 2. assert((dy & 0x1ffff) == 0); // Test vertical scale is multiple of 2.
// Advance to odd row, even column. // Advance to odd row, even column.
...@@ -44,12 +51,7 @@ static void ScaleARGBDown2(int src_width, int src_height, ...@@ -44,12 +51,7 @@ static void ScaleARGBDown2(int src_width, int src_height,
} else { } else {
src_argb += (y >> 16) * src_stride + ((x >> 16) - 1) * 4; src_argb += (y >> 16) * src_stride + ((x >> 16) - 1) * 4;
} }
int row_stride = src_stride * (dy >> 16);
void (*ScaleARGBRowDown2)(const uint8* src_argb, ptrdiff_t src_stride,
uint8* dst_argb, int dst_width) =
filtering == kFilterNone ? ScaleARGBRowDown2_C :
(filtering == kFilterLinear ? ScaleARGBRowDown2Linear_C :
ScaleARGBRowDown2Box_C);
#if defined(HAS_SCALEARGBROWDOWN2_SSE2) #if defined(HAS_SCALEARGBROWDOWN2_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(dst_width, 4) && if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(dst_width, 4) &&
IS_ALIGNED(src_argb, 16) && IS_ALIGNED(row_stride, 16) && IS_ALIGNED(src_argb, 16) && IS_ALIGNED(row_stride, 16) &&
...@@ -69,7 +71,7 @@ static void ScaleARGBDown2(int src_width, int src_height, ...@@ -69,7 +71,7 @@ static void ScaleARGBDown2(int src_width, int src_height,
if (filtering == kFilterLinear) { if (filtering == kFilterLinear) {
src_stride = 0; src_stride = 0;
} }
for (int y = 0; y < dst_height; ++y) { for (j = 0; j < dst_height; ++j) {
ScaleARGBRowDown2(src_argb, src_stride, dst_argb, dst_width); ScaleARGBRowDown2(src_argb, src_stride, dst_argb, dst_width);
src_argb += row_stride; src_argb += row_stride;
dst_argb += dst_stride; dst_argb += dst_stride;
...@@ -84,14 +86,17 @@ static void ScaleARGBDown4Box(int src_width, int src_height, ...@@ -84,14 +86,17 @@ static void ScaleARGBDown4Box(int src_width, int src_height,
int src_stride, int dst_stride, int src_stride, int dst_stride,
const uint8* src_argb, uint8* dst_argb, const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy) { int x, int dx, int y, int dy) {
assert(dx == 65536 * 4); // Test scale factor of 4. int j;
assert((dy & 0x3ffff) == 0); // Test vertical scale is multiple of 4. // Allocate 2 rows of ARGB.
const int kRowSize = (dst_width * 2 * 4 + 15) & ~15;
// Advance to odd row, even column. align_buffer_64(row, kRowSize * 2);
src_argb += (y >> 16) * src_stride + (x >> 16) * 4;
int row_stride = src_stride * (dy >> 16); int row_stride = src_stride * (dy >> 16);
void (*ScaleARGBRowDown2)(const uint8* src_argb, ptrdiff_t src_stride, void (*ScaleARGBRowDown2)(const uint8* src_argb, ptrdiff_t src_stride,
uint8* dst_argb, int dst_width) = ScaleARGBRowDown2Box_C; uint8* dst_argb, int dst_width) = ScaleARGBRowDown2Box_C;
// Advance to odd row, even column.
src_argb += (y >> 16) * src_stride + (x >> 16) * 4;
assert(dx == 65536 * 4); // Test scale factor of 4.
assert((dy & 0x3ffff) == 0); // Test vertical scale is multiple of 4.
#if defined(HAS_SCALEARGBROWDOWN2_SSE2) #if defined(HAS_SCALEARGBROWDOWN2_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(dst_width, 4) && if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(dst_width, 4) &&
IS_ALIGNED(src_argb, 16) && IS_ALIGNED(row_stride, 16) && IS_ALIGNED(src_argb, 16) && IS_ALIGNED(row_stride, 16) &&
...@@ -104,12 +109,7 @@ static void ScaleARGBDown4Box(int src_width, int src_height, ...@@ -104,12 +109,7 @@ static void ScaleARGBDown4Box(int src_width, int src_height,
ScaleARGBRowDown2 = ScaleARGBRowDown2Box_NEON; ScaleARGBRowDown2 = ScaleARGBRowDown2Box_NEON;
} }
#endif #endif
for (j = 0; j < dst_height; ++j) {
// Allocate 2 rows of ARGB.
const int kRowSize = (dst_width * 2 * 4 + 15) & ~15;
align_buffer_64(row, kRowSize * 2);
for (int y = 0; y < dst_height; ++y) {
ScaleARGBRowDown2(src_argb, src_stride, row, dst_width * 2); ScaleARGBRowDown2(src_argb, src_stride, row, dst_width * 2);
ScaleARGBRowDown2(src_argb + src_stride * 2, src_stride, ScaleARGBRowDown2(src_argb + src_stride * 2, src_stride,
row + kRowSize, dst_width * 2); row + kRowSize, dst_width * 2);
...@@ -129,14 +129,15 @@ static void ScaleARGBDownEven(int src_width, int src_height, ...@@ -129,14 +129,15 @@ static void ScaleARGBDownEven(int src_width, int src_height,
const uint8* src_argb, uint8* dst_argb, const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy, int x, int dx, int y, int dy,
enum FilterMode filtering) { enum FilterMode filtering) {
assert(IS_ALIGNED(src_width, 2)); int j;
assert(IS_ALIGNED(src_height, 2));
int col_step = dx >> 16; int col_step = dx >> 16;
int row_stride = (dy >> 16) * src_stride; int row_stride = (dy >> 16) * src_stride;
src_argb += (y >> 16) * src_stride + (x >> 16) * 4;
void (*ScaleARGBRowDownEven)(const uint8* src_argb, ptrdiff_t src_stride, void (*ScaleARGBRowDownEven)(const uint8* src_argb, ptrdiff_t src_stride,
int src_step, uint8* dst_argb, int dst_width) = int src_step, uint8* dst_argb, int dst_width) =
filtering ? ScaleARGBRowDownEvenBox_C : ScaleARGBRowDownEven_C; filtering ? ScaleARGBRowDownEvenBox_C : ScaleARGBRowDownEven_C;
assert(IS_ALIGNED(src_width, 2));
assert(IS_ALIGNED(src_height, 2));
src_argb += (y >> 16) * src_stride + (x >> 16) * 4;
#if defined(HAS_SCALEARGBROWDOWNEVEN_SSE2) #if defined(HAS_SCALEARGBROWDOWNEVEN_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(dst_width, 4) && if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(dst_width, 4) &&
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride, 16)) { IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride, 16)) {
...@@ -154,7 +155,7 @@ static void ScaleARGBDownEven(int src_width, int src_height, ...@@ -154,7 +155,7 @@ static void ScaleARGBDownEven(int src_width, int src_height,
if (filtering == kFilterLinear) { if (filtering == kFilterLinear) {
src_stride = 0; src_stride = 0;
} }
for (int y = 0; y < dst_height; ++y) { for (j = 0; j < dst_height; ++j) {
ScaleARGBRowDownEven(src_argb, src_stride, col_step, dst_argb, dst_width); ScaleARGBRowDownEven(src_argb, src_stride, col_step, dst_argb, dst_width);
src_argb += row_stride; src_argb += row_stride;
dst_argb += dst_stride; dst_argb += dst_stride;
...@@ -168,12 +169,14 @@ static void ScaleARGBBilinearDown(int src_width, int src_height, ...@@ -168,12 +169,14 @@ static void ScaleARGBBilinearDown(int src_width, int src_height,
const uint8* src_argb, uint8* dst_argb, const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy, int x, int dx, int y, int dy,
enum FilterMode filtering) { enum FilterMode filtering) {
int j;
int64 xlast = x + (int64)(dst_width - 1) * dx; int64 xlast = x + (int64)(dst_width - 1) * dx;
int64 xl = (dx >= 0) ? x : xlast; int64 xl = (dx >= 0) ? x : xlast;
int64 xr = (dx >= 0) ? xlast : x; int64 xr = (dx >= 0) ? xlast : x;
int clip_src_width;
xl = (xl >> 16) & ~3; // Left edge aligned. xl = (xl >> 16) & ~3; // Left edge aligned.
xr = (xr >> 16) + 1; // Right most pixel used. xr = (xr >> 16) + 1; // Right most pixel used.
int clip_src_width = (((xr - xl) + 1 + 3) & ~3) * 4; // Width aligned to 4. clip_src_width = (((xr - xl) + 1 + 3) & ~3) * 4; // Width aligned to 4.
src_argb += xl * 4; src_argb += xl * 4;
x -= (int)(xl << 16); x -= (int)(xl << 16);
void (*InterpolateRow)(uint8* dst_argb, const uint8* src_argb, void (*InterpolateRow)(uint8* dst_argb, const uint8* src_argb,
...@@ -239,7 +242,7 @@ static void ScaleARGBBilinearDown(int src_width, int src_height, ...@@ -239,7 +242,7 @@ static void ScaleARGBBilinearDown(int src_width, int src_height,
align_buffer_64(row, clip_src_width * 4); align_buffer_64(row, clip_src_width * 4);
const int max_y = (src_height - 1) << 16; const int max_y = (src_height - 1) << 16;
for (int j = 0; j < dst_height; ++j) { for (j = 0; j < dst_height; ++j) {
if (y > max_y) { if (y > max_y) {
y = max_y; y = max_y;
} }
...@@ -265,9 +268,13 @@ static void ScaleARGBBilinearUp(int src_width, int src_height, ...@@ -265,9 +268,13 @@ static void ScaleARGBBilinearUp(int src_width, int src_height,
const uint8* src_argb, uint8* dst_argb, const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy, int x, int dx, int y, int dy,
enum FilterMode filtering) { enum FilterMode filtering) {
int j;
void (*InterpolateRow)(uint8* dst_argb, const uint8* src_argb, void (*InterpolateRow)(uint8* dst_argb, const uint8* src_argb,
ptrdiff_t src_stride, int dst_width, int source_y_fraction) = ptrdiff_t src_stride, int dst_width, int source_y_fraction) =
InterpolateRow_C; InterpolateRow_C;
void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb,
int dst_width, int x, int dx) =
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
#if defined(HAS_INTERPOLATEROW_SSE2) #if defined(HAS_INTERPOLATEROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && dst_width >= 4) { if (TestCpuFlag(kCpuHasSSE2) && dst_width >= 4) {
InterpolateRow = InterpolateRow_Any_SSE2; InterpolateRow = InterpolateRow_Any_SSE2;
...@@ -312,9 +319,6 @@ static void ScaleARGBBilinearUp(int src_width, int src_height, ...@@ -312,9 +319,6 @@ static void ScaleARGBBilinearUp(int src_width, int src_height,
InterpolateRow = InterpolateRow_MIPS_DSPR2; InterpolateRow = InterpolateRow_MIPS_DSPR2;
} }
#endif #endif
void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb,
int dst_width, int x, int dx) =
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
if (src_width >= 32768) { if (src_width >= 32768) {
ScaleARGBFilterCols = filtering ? ScaleARGBFilterCols = filtering ?
ScaleARGBFilterCols64_C : ScaleARGBCols64_C; ScaleARGBFilterCols64_C : ScaleARGBCols64_C;
...@@ -362,7 +366,7 @@ static void ScaleARGBBilinearUp(int src_width, int src_height, ...@@ -362,7 +366,7 @@ static void ScaleARGBBilinearUp(int src_width, int src_height,
ScaleARGBFilterCols(rowptr + rowstride, src, dst_width, x, dx); ScaleARGBFilterCols(rowptr + rowstride, src, dst_width, x, dx);
src += src_stride; src += src_stride;
for (int j = 0; j < dst_height; ++j) { for (j = 0; j < dst_height; ++j) {
yi = y >> 16; yi = y >> 16;
if (yi != lasty) { if (yi != lasty) {
if (y > max_y) { if (y > max_y) {
...@@ -404,6 +408,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height, ...@@ -404,6 +408,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height,
uint8* dst_argb, uint8* dst_argb,
int x, int dx, int y, int dy, int x, int dx, int y, int dy,
enum FilterMode filtering) { enum FilterMode filtering) {
int j;
void (*I422ToARGBRow)(const uint8* y_buf, void (*I422ToARGBRow)(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
...@@ -562,7 +567,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height, ...@@ -562,7 +567,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height,
} }
} }
for (int j = 0; j < dst_height; ++j) { for (j = 0; j < dst_height; ++j) {
yi = y >> 16; yi = y >> 16;
if (yi != lasty) { if (yi != lasty) {
if (y > max_y) { if (y > max_y) {
...@@ -611,6 +616,7 @@ static void ScaleARGBSimple(int src_width, int src_height, ...@@ -611,6 +616,7 @@ static void ScaleARGBSimple(int src_width, int src_height,
int src_stride, int dst_stride, int src_stride, int dst_stride,
const uint8* src_argb, uint8* dst_argb, const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy) { int x, int dx, int y, int dy) {
int j;
void (*ScaleARGBCols)(uint8* dst_argb, const uint8* src_argb, void (*ScaleARGBCols)(uint8* dst_argb, const uint8* src_argb,
int dst_width, int x, int dx) = int dst_width, int x, int dx) =
(src_width >= 32768) ? ScaleARGBCols64_C : ScaleARGBCols_C; (src_width >= 32768) ? ScaleARGBCols64_C : ScaleARGBCols_C;
...@@ -630,7 +636,7 @@ static void ScaleARGBSimple(int src_width, int src_height, ...@@ -630,7 +636,7 @@ static void ScaleARGBSimple(int src_width, int src_height,
#endif #endif
} }
for (int i = 0; i < dst_height; ++i) { for (j = 0; j < dst_height; ++j) {
ScaleARGBCols(dst_argb, src_argb + (y >> 16) * src_stride, ScaleARGBCols(dst_argb, src_argb + (y >> 16) * src_stride,
dst_width, x, dx); dst_width, x, dx);
dst_argb += dst_stride; dst_argb += dst_stride;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment