From 83408b85e4c64cca1495d7fbfdfa4febc5e7e6f5 Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Wed, 29 May 2013 17:40:50 +0000 Subject: [PATCH] Change point down sampling to x = dx / 2 which matches ffmpeg and is lossless on up and then down sample. BUG=232 TEST=convert.exe -f 0 faces_640x480_P420.yuv face2_352x288_P420.yuv R=johannkoenig@google.com, ryanpetrie@google.com Review URL: https://webrtc-codereview.appspot.com/1581005 git-svn-id: http://libyuv.googlecode.com/svn/trunk@707 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/version.h | 2 +- source/scale.cc | 4 ++-- source/scale_argb.cc | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.chromium b/README.chromium index 48b2e296f..441cf7581 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 706 +Version: 707 License: BSD License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 2626f123a..5cb5d7f2f 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 706 +#define LIBYUV_VERSION 707 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/scale.cc b/source/scale.cc index 9fd27a157..f39f1dace 100644 --- a/source/scale.cc +++ b/source/scale.cc @@ -3232,8 +3232,8 @@ static void ScalePlaneSimple(int src_width, int src_height, const uint8* src_ptr, uint8* dst_ptr) { int dx = (Abs(src_width) << 16) / dst_width; int dy = (src_height << 16) / dst_height; - int x = (dx >= 65536) ? ((dx >> 1) - 32768) : (dx >> 1); - int y = (dy >= 65536) ? ((dy >> 1) - 32768) : (dy >> 1); + int x = dx >> 1; + int y = dy >> 1; // Negative src_width means horizontally mirror. if (src_width < 0) { x += (dst_width - 1) * dx; diff --git a/source/scale_argb.cc b/source/scale_argb.cc index 1aaf057c7..248236c24 100644 --- a/source/scale_argb.cc +++ b/source/scale_argb.cc @@ -1081,8 +1081,8 @@ static void ScaleARGB(const uint8* src, int src_stride, // Scale step for point sampling duplicates all pixels equally. dx = (Abs(src_width) << 16) / dst_width; dy = (src_height << 16) / dst_height; - x = (dx >= 65536) ? ((dx >> 1) - 32768) : (dx >> 1); - y = (dy >= 65536) ? ((dy >> 1) - 32768) : (dy >> 1); + x = dx >> 1; + y = dy >> 1; } // Negative src_width means horizontally mirror. if (src_width < 0) {