Commit 6700a27c authored by fbarchard@google.com's avatar fbarchard@google.com

Scale mirror bug fix.

BUG=304
TESTED=try
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@959 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 9124ac89
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 957
Version: 958
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 957
#define LIBYUV_VERSION 958
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -379,9 +379,6 @@ static void ScalePlaneBox(int src_width, int src_height,
int dst_width, int dst_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr) {
assert(dst_width > 0);
assert(dst_height > 0);
// Initial source x/y coordinate and step values as 16.16 fixed point.
int x = 0;
int y = 0;
......@@ -389,6 +386,7 @@ static void ScalePlaneBox(int src_width, int src_height,
int dy = 0;
ScaleSlope(src_width, src_height, dst_width, dst_height, kFilterBox,
&x, &y, &dx, &dy);
src_width = Abs(src_width);
const int max_y = (src_height << 16);
// TODO(fbarchard): Remove this and make AddRows handle boxheight 1.
if (!IS_ALIGNED(src_width, 16) || dst_height * 2 > src_height) {
......@@ -449,9 +447,6 @@ void ScalePlaneBilinearDown(int src_width, int src_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr,
enum FilterMode filtering) {
assert(dst_width > 0);
assert(dst_height > 0);
// Initial source x/y coordinate and step values as 16.16 fixed point.
int x = 0;
int y = 0;
......@@ -459,6 +454,7 @@ void ScalePlaneBilinearDown(int src_width, int src_height,
int dy = 0;
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering,
&x, &y, &dx, &dy);
src_width = Abs(src_width);
void (*InterpolateRow)(uint8* dst_ptr, const uint8* src_ptr,
ptrdiff_t src_stride, int dst_width, int source_y_fraction) =
......@@ -550,11 +546,6 @@ void ScalePlaneBilinearUp(int src_width, int src_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr,
enum FilterMode filtering) {
assert(src_width != 0);
assert(src_height != 0);
assert(dst_width > 0);
assert(dst_height > 0);
// Initial source x/y coordinate and step values as 16.16 fixed point.
int x = 0;
int y = 0;
......@@ -562,6 +553,7 @@ void ScalePlaneBilinearUp(int src_width, int src_height,
int dy = 0;
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering,
&x, &y, &dx, &dy);
src_width = Abs(src_width);
void (*InterpolateRow)(uint8* dst_ptr, const uint8* src_ptr,
ptrdiff_t src_stride, int dst_width, int source_y_fraction) =
......@@ -701,6 +693,7 @@ static void ScalePlaneSimple(int src_width, int src_height,
int dy = 0;
ScaleSlope(src_width, src_height, dst_width, dst_height, kFilterNone,
&x, &y, &dx, &dy);
src_width = Abs(src_width);
void (*ScaleCols)(uint8* dst_ptr, const uint8* src_ptr,
int dst_width, int x, int dx) = ScaleCols_C;
......
......@@ -168,9 +168,6 @@ static void ScaleARGBBilinearDown(int src_width, int src_height,
const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy,
enum FilterMode filtering) {
assert(src_height > 0);
assert(dst_width > 0);
assert(dst_height > 0);
int64 xlast = x + (int64)(dst_width - 1) * dx;
int64 xl = (dx >= 0) ? x : xlast;
int64 xr = (dx >= 0) ? xlast : x;
......@@ -268,10 +265,6 @@ static void ScaleARGBBilinearUp(int src_width, int src_height,
const uint8* src_argb, uint8* dst_argb,
int x, int dx, int y, int dy,
enum FilterMode filtering) {
assert(src_width > 0);
assert(src_height > 0);
assert(dst_width > 0);
assert(dst_height > 0);
void (*InterpolateRow)(uint8* dst_argb, const uint8* src_argb,
ptrdiff_t src_stride, int dst_width, int source_y_fraction) =
InterpolateRow_C;
......@@ -411,11 +404,6 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height,
uint8* dst_argb,
int x, int dx, int y, int dy,
enum FilterMode filtering) {
assert(src_width > 0);
assert(src_height > 0);
assert(dst_width > 0);
assert(dst_height > 0);
void (*I422ToARGBRow)(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
......@@ -659,6 +647,11 @@ static void ScaleARGB(const uint8* src, int src_stride,
int dst_width, int dst_height,
int clip_x, int clip_y, int clip_width, int clip_height,
enum FilterMode filtering) {
// Initial source x/y coordinate and step values as 16.16 fixed point.
int x = 0;
int y = 0;
int dx = 0;
int dy = 0;
// ARGB does not support box filter yet, but allow the user to pass it.
// Simplify filtering when possible.
filtering = ScaleFilterReduce(src_width, src_height,
......@@ -671,13 +664,9 @@ static void ScaleARGB(const uint8* src, int src_stride,
src = src + (src_height - 1) * src_stride;
src_stride = -src_stride;
}
// Initial source x/y coordinate and step values as 16.16 fixed point.
int x = 0;
int y = 0;
int dx = 0;
int dy = 0;
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering,
&x, &y, &dx, &dy);
src_width = Abs(src_width);
if (clip_x) {
int64 clipf = (int64)(clip_x) * dx;
x += (clipf & 0xffff);
......
......@@ -731,7 +731,7 @@ void ScaleSlope(int src_width, int src_height,
if (src_width < 0) {
*x += (dst_width - 1) * *dx;
*dx = -*dx;
src_width = -src_width;
// src_width = -src_width; // Caller must do this.
}
}
#undef CENTERSTART
......
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