Commit 74b50f1b authored by fbarchard@google.com's avatar fbarchard@google.com

Expose scale plane function

BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/459009

git-svn-id: http://libyuv.googlecode.com/svn/trunk@224 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 4f59bcc1
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 223 Version: 224
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -25,6 +25,13 @@ enum FilterMode { ...@@ -25,6 +25,13 @@ enum FilterMode {
kFilterBox = 2 // Highest quality kFilterBox = 2 // Highest quality
}; };
// Scale a YUV plane.
void ScalePlane(const uint8* src, int src_stride,
int src_width, int src_height,
uint8* dst, int dst_stride,
int dst_width, int dst_height,
FilterMode filtering);
// Scales a YUV 4:2:0 image from the src width and height to the // Scales a YUV 4:2:0 image from the src width and height to the
// dst width and height. // dst width and height.
// If filtering is kFilterNone, a simple nearest-neighbor algorithm is // If filtering is kFilterNone, a simple nearest-neighbor algorithm is
......
...@@ -3631,11 +3631,16 @@ static void ScalePlaneDown(int src_width, int src_height, ...@@ -3631,11 +3631,16 @@ static void ScalePlaneDown(int src_width, int src_height,
} }
} }
static void ScalePlane(const uint8* src, int src_stride, // Scale a plane.
int src_width, int src_height, //
uint8* dst, int dst_stride, // This function in turn calls a scaling function
int dst_width, int dst_height, // suitable for handling the desired resolutions.
FilterMode filtering, bool use_ref) {
void ScalePlane(const uint8* src, int src_stride,
int src_width, int src_height,
uint8* dst, int dst_stride,
int dst_width, int dst_height,
FilterMode filtering) {
#ifdef CPU_X86 #ifdef CPU_X86
// environment variable overrides for testing. // environment variable overrides for testing.
char *filter_override = getenv("LIBYUV_FILTER"); char *filter_override = getenv("LIBYUV_FILTER");
...@@ -3650,7 +3655,7 @@ static void ScalePlane(const uint8* src, int src_stride, ...@@ -3650,7 +3655,7 @@ static void ScalePlane(const uint8* src, int src_stride,
CopyPlane(src, src_stride, dst, dst_stride, dst_width, dst_height); CopyPlane(src, src_stride, dst, dst_stride, dst_width, dst_height);
} else if (dst_width <= src_width && dst_height <= src_height) { } else if (dst_width <= src_width && dst_height <= src_height) {
// Scale down. // Scale down.
if (use_ref) { if (use_reference_impl_) {
// For testing, allow the optimized versions to be disabled. // For testing, allow the optimized versions to be disabled.
ScalePlaneDown(src_width, src_height, dst_width, dst_height, ScalePlaneDown(src_width, src_height, dst_width, dst_height,
src_stride, dst_stride, src, dst, filtering); src_stride, dst_stride, src, dst, filtering);
...@@ -3689,13 +3694,9 @@ static void ScalePlane(const uint8* src, int src_stride, ...@@ -3689,13 +3694,9 @@ static void ScalePlane(const uint8* src, int src_stride,
} }
} }
/** // Scale an I420 image.
* Scale a plane. //
* // This function in turn calls a scaling function for each plane.
* This function in turn calls a scaling function
* suitable for handling the desired resolutions.
*
*/
int I420Scale(const uint8* src_y, int src_stride_y, int I420Scale(const uint8* src_y, int src_stride_y,
const uint8* src_u, int src_stride_u, const uint8* src_u, int src_stride_u,
...@@ -3728,13 +3729,13 @@ int I420Scale(const uint8* src_y, int src_stride_y, ...@@ -3728,13 +3729,13 @@ int I420Scale(const uint8* src_y, int src_stride_y,
ScalePlane(src_y, src_stride_y, src_width, src_height, ScalePlane(src_y, src_stride_y, src_width, src_height,
dst_y, dst_stride_y, dst_width, dst_height, dst_y, dst_stride_y, dst_width, dst_height,
filtering, use_reference_impl_); filtering);
ScalePlane(src_u, src_stride_u, src_halfwidth, src_halfheight, ScalePlane(src_u, src_stride_u, src_halfwidth, src_halfheight,
dst_u, dst_stride_u, dst_halfwidth, dst_halfheight, dst_u, dst_stride_u, dst_halfwidth, dst_halfheight,
filtering, use_reference_impl_); filtering);
ScalePlane(src_v, src_stride_v, src_halfwidth, src_halfheight, ScalePlane(src_v, src_stride_v, src_halfwidth, src_halfheight,
dst_v, dst_stride_v, dst_halfwidth, dst_halfheight, dst_v, dst_stride_v, dst_halfwidth, dst_halfheight,
filtering, use_reference_impl_); filtering);
return 0; return 0;
} }
...@@ -3769,13 +3770,13 @@ int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v, ...@@ -3769,13 +3770,13 @@ int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
ScalePlane(src_y, src_stride_y, src_width, src_height, ScalePlane(src_y, src_stride_y, src_width, src_height,
dst_y, dst_stride_y, dst_width, dst_height, dst_y, dst_stride_y, dst_width, dst_height,
filtering, use_reference_impl_); filtering);
ScalePlane(src_u, src_stride_u, src_halfwidth, src_halfheight, ScalePlane(src_u, src_stride_u, src_halfwidth, src_halfheight,
dst_u, dst_stride_u, dst_halfwidth, dst_halfheight, dst_u, dst_stride_u, dst_halfwidth, dst_halfheight,
filtering, use_reference_impl_); filtering);
ScalePlane(src_v, src_stride_v, src_halfwidth, src_halfheight, ScalePlane(src_v, src_stride_v, src_halfwidth, src_halfheight,
dst_v, dst_stride_v, dst_halfwidth, dst_halfheight, dst_v, dst_stride_v, dst_halfwidth, dst_halfheight,
filtering, use_reference_impl_); filtering);
return 0; return 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