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

Scale up point use step / 2 as initial coordinate, which is more symetric and…

Scale up point use step / 2 as initial coordinate, which is more symetric and matches ffmpeg exactly.
BUG=232
TEST=convert.exe -f 0 faces_352x288_P420.yuv faces_640x480_P420.yuv
R=ryanpetrie@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@706 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent a14b5cdf
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 705 Version: 706
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 705 #define LIBYUV_VERSION 706
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -3232,20 +3232,14 @@ static void ScalePlaneSimple(int src_width, int src_height, ...@@ -3232,20 +3232,14 @@ static void ScalePlaneSimple(int src_width, int src_height,
const uint8* src_ptr, uint8* dst_ptr) { const uint8* src_ptr, uint8* dst_ptr) {
int dx = (Abs(src_width) << 16) / dst_width; int dx = (Abs(src_width) << 16) / dst_width;
int dy = (src_height << 16) / dst_height; int dy = (src_height << 16) / dst_height;
int x = 0; int x = (dx >= 65536) ? ((dx >> 1) - 32768) : (dx >> 1);
int y = 0; int y = (dy >= 65536) ? ((dy >> 1) - 32768) : (dy >> 1);
if (dst_width <= Abs(src_width)) {
x = (dx >> 1) - 32768;
}
// Negative src_width means horizontally mirror. // Negative src_width means horizontally mirror.
if (src_width < 0) { if (src_width < 0) {
x += (dst_width - 1) * dx; x += (dst_width - 1) * dx;
dx = -dx; dx = -dx;
src_width = -src_width; src_width = -src_width;
} }
if (dst_height <= src_height) {
y = (dy >> 1) - 32768;
}
for (int j = 0; j < dst_height; ++j) { for (int j = 0; j < dst_height; ++j) {
int xs = x; int xs = x;
......
...@@ -1081,12 +1081,8 @@ static void ScaleARGB(const uint8* src, int src_stride, ...@@ -1081,12 +1081,8 @@ static void ScaleARGB(const uint8* src, int src_stride,
// Scale step for point sampling duplicates all pixels equally. // Scale step for point sampling duplicates all pixels equally.
dx = (Abs(src_width) << 16) / dst_width; dx = (Abs(src_width) << 16) / dst_width;
dy = (src_height << 16) / dst_height; dy = (src_height << 16) / dst_height;
if (dst_width <= Abs(src_width)) { x = (dx >= 65536) ? ((dx >> 1) - 32768) : (dx >> 1);
x = (dx >> 1) - 32768; y = (dy >= 65536) ? ((dy >> 1) - 32768) : (dy >> 1);
}
if (dst_height <= src_height) {
y = (dy >> 1) - 32768;
}
} }
// Negative src_width means horizontally mirror. // Negative src_width means horizontally mirror.
if (src_width < 0) { if (src_width < 0) {
......
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