Commit cf17f0cd authored by fbarchard@google.com's avatar fbarchard@google.com

Scale exit early if simple version used

BUG=none
TEST=none
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@921 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 06ed6258
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 920 Version: 921
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 920 #define LIBYUV_VERSION 921
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -407,41 +407,38 @@ static void ScalePlaneBox(int src_width, int src_height, ...@@ -407,41 +407,38 @@ static void ScalePlaneBox(int src_width, int src_height,
src, dst); src, dst);
dst += dst_stride; dst += dst_stride;
} }
} else { return;
SIMD_ALIGNED(uint16 row[kMaxStride]); }
void (*ScaleAddRows)(const uint8* src_ptr, ptrdiff_t src_stride, // TODO(fbarchard): Remove kMaxStride limitation.
uint16* dst_ptr, int src_width, int src_height) = SIMD_ALIGNED(uint16 row[kMaxStride]);
ScaleAddRows_C; void (*ScaleAddRows)(const uint8* src_ptr, ptrdiff_t src_stride,
void (*ScaleAddCols)(int dst_width, int boxheight, int x, int dx, uint16* dst_ptr, int src_width, int src_height) = ScaleAddRows_C;
const uint16* src_ptr, uint8* dst_ptr); void (*ScaleAddCols)(int dst_width, int boxheight, int x, int dx,
if (dx & 0xffff) { const uint16* src_ptr, uint8* dst_ptr) =
ScaleAddCols = ScaleAddCols2_C; (dx & 0xffff) ? ScaleAddCols2_C: ScaleAddCols1_C;
} else {
ScaleAddCols = ScaleAddCols1_C;
}
#if defined(HAS_SCALEADDROWS_SSE2) #if defined(HAS_SCALEADDROWS_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && if (TestCpuFlag(kCpuHasSSE2) &&
#ifdef AVOID_OVERREAD #ifdef AVOID_OVERREAD
IS_ALIGNED(src_width, 16) && IS_ALIGNED(src_width, 16) &&
#endif #endif
IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(src_stride, 16)) { IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(src_stride, 16)) {
ScaleAddRows = ScaleAddRows_SSE2; ScaleAddRows = ScaleAddRows_SSE2;
} }
#endif #endif
for (int j = 0; j < dst_height; ++j) { for (int 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;
if (y > (src_height << 16)) { if (y > (src_height << 16)) {
y = (src_height << 16); y = (src_height << 16);
}
int boxheight = (y >> 16) - iy;
ScaleAddRows(src, src_stride, row, src_width, boxheight);
ScaleAddCols(dst_width, boxheight, x, dx, row, dst_ptr);
dst_ptr += dst_stride;
} }
int boxheight = (y >> 16) - iy;
ScaleAddRows(src, src_stride, row, src_width, boxheight);
ScaleAddCols(dst_width, boxheight, x, dx, row, dst_ptr);
dst_ptr += dst_stride;
} }
} }
// Scale plane down with bilinear interpolation. // Scale plane down with bilinear interpolation.
......
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