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

Reduce filter to None if 1 pixel wide.

BUG=none
TESTED=talk media_unittest YuvScalerTest.TestScaleUp1x6OptInt
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@906 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 5316f383
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 905
Version: 906
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 905
#define LIBYUV_VERSION 906
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -566,6 +566,11 @@ FilterMode ScaleFilterReduce(int src_width, int src_height,
if (dst_height == src_height || dst_height * 3 == src_height) {
filtering = kFilterLinear;
}
// TODO(fbarchard): Remove 1 pixel wide filter restriction, which is to
// avoid reading 2 pixels horizontally that causes memory exception.
if (src_width == 1) {
filtering = kFilterNone;
}
}
if (filtering == kFilterLinear) {
if (src_width == 1) {
......@@ -606,14 +611,14 @@ void ScaleSlope(int src_width, int src_height,
// Scale step for bilinear sampling renders last pixel once for upsample.
if (dst_width <= Abs(src_width)) {
*dx = FixedDiv(Abs(src_width), dst_width);
*x = CENTERSTART(*dx, -32768);
*x = CENTERSTART(*dx, -32768); // Subtract 0.5 (32768) to center filter.
} else if (dst_width > 1) {
*dx = FIXEDDIV1(Abs(src_width), dst_width);
*x = 0;
}
if (dst_height <= src_height) {
*dy = FixedDiv(src_height, dst_height);
*y = CENTERSTART(*dy, -32768); // 32768 = -0.5 to center bilinear.
*y = CENTERSTART(*dy, -32768); // Subtract 0.5 (32768) to center filter.
} else if (dst_height > 1) {
*dy = FIXEDDIV1(src_height, dst_height);
*y = 0;
......@@ -622,7 +627,7 @@ void ScaleSlope(int src_width, int src_height,
// Scale step for bilinear sampling renders last pixel once for upsample.
if (dst_width <= Abs(src_width)) {
*dx = FixedDiv(Abs(src_width), dst_width);
*x = CENTERSTART(*dx, -32768);
*x = CENTERSTART(*dx, -32768); // Subtract 0.5 (32768) to center filter.
} else if (dst_width > 1) {
*dx = FIXEDDIV1(Abs(src_width), dst_width);
*x = 0;
......
......@@ -19,8 +19,8 @@
#define BENCHMARK_ITERATIONS 1
libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128),
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(33),
benchmark_height_(17) {
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(32),
benchmark_height_(24) {
const char* repeat = getenv("LIBYUV_REPEAT");
if (repeat) {
benchmark_iterations_ = atoi(repeat); // NOLINT
......
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