/* * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /**************************************************************************** * * Module Title : scale.c * * Description : Image scaling functions. * ***************************************************************************/ /**************************************************************************** * Header Files ****************************************************************************/ #include <assert.h> #include "./vpx_scale_rtcd.h" #include "vpx_mem/vpx_mem.h" #include "vpx_scale/vpx_scale.h" #include "vpx_scale/yv12config.h" SCALE_VARS; /**************************************************************************** * * ROUTINE : scale1d_2t1_i * * INPUTS : const unsigned char *source : Pointer to data to be scaled. * int source_step : Number of pixels to step on in * source. * unsigned int source_scale : Scale for source (UNUSED). * unsigned int source_length : Length of source (UNUSED). * unsigned char *dest : Pointer to output data array. * int dest_step : Number of pixels to step on in * destination. * unsigned int dest_scale : Scale for destination * (UNUSED). * unsigned int dest_length : Length of destination. * * OUTPUTS : None. * * RETURNS : void * * FUNCTION : Performs 2-to-1 interpolated scaling. * * SPECIAL NOTES : None. * ****************************************************************************/ static void scale1d_2t1_i(const unsigned char *source, int source_step, unsigned int source_scale, unsigned int source_length, unsigned char *dest, int dest_step, unsigned int dest_scale, unsigned int dest_length) { … } /**************************************************************************** * * ROUTINE : scale1d_2t1_ps * * INPUTS : const unsigned char *source : Pointer to data to be scaled. * int source_step : Number of pixels to step on in * source. * unsigned int source_scale : Scale for source (UNUSED). * unsigned int source_length : Length of source (UNUSED). * unsigned char *dest : Pointer to output data array. * int dest_step : Number of pixels to step on in * destination. * unsigned int dest_scale : Scale for destination * (UNUSED). * unsigned int dest_length : Length of destination. * * OUTPUTS : None. * * RETURNS : void * * FUNCTION : Performs 2-to-1 point subsampled scaling. * * SPECIAL NOTES : None. * ****************************************************************************/ static void scale1d_2t1_ps(const unsigned char *source, int source_step, unsigned int source_scale, unsigned int source_length, unsigned char *dest, int dest_step, unsigned int dest_scale, unsigned int dest_length) { … } /**************************************************************************** * * ROUTINE : scale1d_c * * INPUTS : const unsigned char *source : Pointer to data to be scaled. * int source_step : Number of pixels to step on in * source. * unsigned int source_scale : Scale for source. * unsigned int source_length : Length of source (UNUSED). * unsigned char *dest : Pointer to output data array. * int dest_step : Number of pixels to step on in * destination. * unsigned int dest_scale : Scale for destination. * unsigned int dest_length : Length of destination. * * OUTPUTS : None. * * RETURNS : void * * FUNCTION : Performs linear interpolation in one dimension. * * SPECIAL NOTES : None. * ****************************************************************************/ static void scale1d_c(const unsigned char *source, int source_step, unsigned int source_scale, unsigned int source_length, unsigned char *dest, int dest_step, unsigned int dest_scale, unsigned int dest_length) { … } /**************************************************************************** * * ROUTINE : Scale2D * * INPUTS : const unsigned char *source : Pointer to data to be * scaled. * int source_pitch : Stride of source image. * unsigned int source_width : Width of input image. * unsigned int source_height : Height of input image. * unsigned char *dest : Pointer to output data * array. * int dest_pitch : Stride of destination * image. * unsigned int dest_width : Width of destination image. * unsigned int dest_height : Height of destination * image. * unsigned char *temp_area : Pointer to temp work area. * unsigned char temp_area_height : Height of temp work area. * unsigned int hscale : Horizontal scale factor * numerator. * unsigned int hratio : Horizontal scale factor * denominator. * unsigned int vscale : Vertical scale factor * numerator. * unsigned int vratio : Vertical scale factor * denominator. * unsigned int interlaced : Interlace flag. * * OUTPUTS : None. * * RETURNS : void * * FUNCTION : Performs 2-tap linear interpolation in two dimensions. * * SPECIAL NOTES : Expansion is performed one band at a time to help with * caching. * ****************************************************************************/ static void Scale2D( /*const*/ unsigned char *source, int source_pitch, unsigned int source_width, unsigned int source_height, unsigned char *dest, int dest_pitch, unsigned int dest_width, unsigned int dest_height, unsigned char *temp_area, unsigned char temp_area_height, unsigned int hscale, unsigned int hratio, unsigned int vscale, unsigned int vratio, unsigned int interlaced) { … } /**************************************************************************** * * ROUTINE : vpx_scale_frame * * INPUTS : YV12_BUFFER_CONFIG *src : Pointer to frame to be * scaled. * YV12_BUFFER_CONFIG *dst : Pointer to buffer to hold * scaled frame. * unsigned char *temp_area : Pointer to temp work area. * unsigned char temp_area_height : Height of temp work area. * unsigned int hscale : Horizontal scale factor * numerator. * unsigned int hratio : Horizontal scale factor * denominator. * unsigned int vscale : Vertical scale factor * numerator. * unsigned int vratio : Vertical scale factor * denominator. * unsigned int interlaced : Interlace flag. * * OUTPUTS : None. * * RETURNS : void * * FUNCTION : Performs 2-tap linear interpolation in two dimensions. * * SPECIAL NOTES : Expansion is performed one band at a time to help with * caching. * ****************************************************************************/ void vpx_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, unsigned char *temp_area, unsigned char temp_height, unsigned int hscale, unsigned int hratio, unsigned int vscale, unsigned int vratio, unsigned int interlaced) { … }