aom: remove aom_scale.[ch] & gen_scalers.c

From b0f8fecae01ad7890d8a95c4e6c166572d6511ef Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Tue, 13 Aug 2024 18:51:13 -0700
Subject: [PATCH] remove aom_scale.[ch] & gen_scalers.c

The last reference to aom_scale_frame() was removed in:
3897e2df73 Simple upscaler w/ frame superres + loop-rest

This also removes `CONFIG_SPATIAL_RESAMPLING` which is a carryover from
VP8 and not used in the code.

Bug: aomedia:3416
Change-Id: I3c5e6b4eeed0bb2d4dbe2c235798e3d8d0d1f922
---
 aom_scale/aom_scale.cmake             |   5 +-
 aom_scale/aom_scale.h                 |  23 --
 aom_scale/aom_scale_rtcd.pl           |  11 -
 aom_scale/generic/aom_scale.c         | 506 --------------------------
 aom_scale/generic/gen_scalers.c       | 201 ----------
 av1/common/resize.c                   |   1 -
 av1/decoder/decodeframe.c             |   1 -
 av1/decoder/decoder.c                 |   1 -
 av1/encoder/encoder.c                 |   1 -
 av1/encoder/firstpass.c               |   1 -
 av1/encoder/temporal_filter.c         |   1 -
 build/cmake/aom_config_defaults.cmake |   1 -
 12 files changed, 1 insertion(+), 752 deletions(-)
 delete mode 100644 aom_scale/aom_scale.h
 delete mode 100644 aom_scale/generic/aom_scale.c
 delete mode 100644 aom_scale/generic/gen_scalers.c

diff --git a/aom_scale/aom_scale.cmake b/aom_scale/aom_scale.cmake
index 3fe7fb752a..7ad4214bc1 100644
--- a/aom_scale/aom_scale.cmake
+++ b/aom_scale/aom_scale.cmake
@@ -13,10 +13,7 @@ if(AOM_AOM_SCALE_AOM_SCALE_CMAKE_)
 endif() # AOM_AOM_SCALE_AOM_SCALE_CMAKE_
 set(AOM_AOM_SCALE_AOM_SCALE_CMAKE_ 1)
 
-list(APPEND AOM_SCALE_SOURCES "${AOM_ROOT}/aom_scale/aom_scale.h"
-            "${AOM_ROOT}/aom_scale/generic/aom_scale.c"
-            "${AOM_ROOT}/aom_scale/generic/gen_scalers.c"
-            "${AOM_ROOT}/aom_scale/generic/yv12config.c"
+list(APPEND AOM_SCALE_SOURCES "${AOM_ROOT}/aom_scale/generic/yv12config.c"
             "${AOM_ROOT}/aom_scale/generic/yv12extend.c"
             "${AOM_ROOT}/aom_scale/yv12config.h")
 
diff --git a/aom_scale/aom_scale.h b/aom_scale/aom_scale.h
deleted file mode 100644
index 4411397bb2..0000000000
--- a/aom_scale/aom_scale.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AOM_AOM_SCALE_AOM_SCALE_H_
-#define AOM_AOM_SCALE_AOM_SCALE_H_
-
-#include "aom_scale/yv12config.h"
-
-extern void aom_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, const int num_planes);
-
-#endif  // AOM_AOM_SCALE_AOM_SCALE_H_
diff --git a/aom_scale/aom_scale_rtcd.pl b/aom_scale/aom_scale_rtcd.pl
index 2988383c8d..273e3f9cc1 100644
--- a/aom_scale/aom_scale_rtcd.pl
+++ b/aom_scale/aom_scale_rtcd.pl
@@ -17,17 +17,6 @@ ()
 }
 forward_decls qw/aom_scale_forward_decls/;
 
-# Scaler functions
-if (aom_config("CONFIG_SPATIAL_RESAMPLING") eq "yes") {
-  add_proto qw/void aom_horizontal_line_5_4_scale/, "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width";
-  add_proto qw/void aom_vertical_band_5_4_scale/, "unsigned char *source, int src_pitch, unsigned char *dest, int dest_pitch, unsigned int dest_width";
-  add_proto qw/void aom_horizontal_line_5_3_scale/, "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width";
-  add_proto qw/void aom_vertical_band_5_3_scale/, "unsigned char *source, int src_pitch, unsigned char *dest, int dest_pitch, unsigned int dest_width";
-  add_proto qw/void aom_horizontal_line_2_1_scale/, "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width";
-  add_proto qw/void aom_vertical_band_2_1_scale/, "unsigned char *source, int src_pitch, unsigned char *dest, int dest_pitch, unsigned int dest_width";
-  add_proto qw/void aom_vertical_band_2_1_scale_i/, "unsigned char *source, int src_pitch, unsigned char *dest, int dest_pitch, unsigned int dest_width";
-}
-
 add_proto qw/int aom_yv12_realloc_with_new_border/, "struct yv12_buffer_config *ybf, int new_border, int byte_alignment, bool alloc_pyramid, int num_planes";
 
 add_proto qw/void aom_yv12_extend_frame_borders/, "struct yv12_buffer_config *ybf, const int num_planes";
diff --git a/aom_scale/generic/aom_scale.c b/aom_scale/generic/aom_scale.c
deleted file mode 100644
index 85ae1e2c43..0000000000
--- a/aom_scale/generic/aom_scale.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-/****************************************************************************
- *
- *   Module Title :     scale.c
- *
- *   Description  :     Image scaling functions.
- *
- ***************************************************************************/
-
-/****************************************************************************
- *  Header Files
- ****************************************************************************/
-#include "config/aom_scale_rtcd.h"
-
-#include "aom_mem/aom_mem.h"
-#include "aom_scale/aom_scale.h"
-#include "aom_scale/yv12config.h"
-
-typedef struct {
-  int expanded_frame_width;
-  int expanded_frame_height;
-
-  int HScale;
-  int HRatio;
-  int VScale;
-  int VRatio;
-
-  YV12_BUFFER_CONFIG *src_yuv_config;
-  YV12_BUFFER_CONFIG *dst_yuv_config;
-
-} 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) {
-  const unsigned char *const dest_end = dest + dest_length * dest_step;
-  (void)source_length;
-  (void)source_scale;
-  (void)dest_scale;
-
-  source_step *= 2;  // Every other row.
-
-  dest[0] = source[0];  // Special case: 1st pixel.
-  source += source_step;
-  dest += dest_step;
-
-  while (dest < dest_end) {
-    const unsigned int a = 3 * source[-source_step];
-    const unsigned int b = 10 * source[0];
-    const unsigned int c = 3 * source[source_step];
-    *dest = (unsigned char)((8 + a + b + c) >> 4);
-    source += source_step;
-    dest += dest_step;
-  }
-}
-
-/****************************************************************************
- *
- *  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) {
-  const unsigned char *const dest_end = dest + dest_length * dest_step;
-  (void)source_length;
-  (void)source_scale;
-  (void)dest_scale;
-
-  source_step *= 2;  // Every other row.
-
-  while (dest < dest_end) {
-    *dest = *source;
-    source += source_step;
-    dest += dest_step;
-  }
-}
-/****************************************************************************
- *
- *  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) {
-  const unsigned char *const dest_end = dest + dest_length * dest_step;
-  const unsigned int round_value = dest_scale / 2;
-  unsigned int left_modifier = dest_scale;
-  unsigned int right_modifier = 0;
-  unsigned char left_pixel = source[0];
-  unsigned char right_pixel = source[source_step];
-
-  (void)source_length;
-
-  /* These asserts are needed if there are boundary issues... */
-  /* assert ( dest_scale > source_scale );*/
-  /* assert ( (source_length - 1) * dest_scale >= (dest_length - 1) *
-   * source_scale);*/
-
-  while (dest < dest_end) {
-    *dest = (unsigned char)((left_modifier * left_pixel +
-                             right_modifier * right_pixel + round_value) /
-                            dest_scale);
-
-    right_modifier += source_scale;
-
-    while (right_modifier > dest_scale) {
-      right_modifier -= dest_scale;
-      source += source_step;
-      left_pixel = source[0];
-      right_pixel = source[source_step];
-    }
-
-    left_modifier = dest_scale - right_modifier;
-  }
-}
-
-/****************************************************************************
- *
- *  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) {
-  unsigned int i, j, k;
-  unsigned int bands;
-  unsigned int dest_band_height;
-  unsigned int source_band_height;
-
-  typedef void (*Scale1D)(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);
-
-  Scale1D Scale1Dv = scale1d_c;
-  Scale1D Scale1Dh = scale1d_c;
-
-  void (*horiz_line_scale)(const unsigned char *, unsigned int, unsigned char *,
-                           unsigned int) = NULL;
-  void (*vert_band_scale)(unsigned char *, int, unsigned char *, int,
-                          unsigned int) = NULL;
-
-  int ratio_scalable = 1;
-  int interpolation = 0;
-
-  unsigned char *source_base;
-  unsigned char *line_src;
-
-  source_base = (unsigned char *)source;
-
-  if (source_pitch < 0) {
-    int offset;
-
-    offset = (source_height - 1);
-    offset *= source_pitch;
-
-    source_base += offset;
-  }
-
-  /* find out the ratio for each direction */
-  switch (hratio * 10 / hscale) {
-    case 8:
-      /* 4-5 Scale in Width direction */
-      horiz_line_scale = aom_horizontal_line_5_4_scale;
-      break;
-    case 6:
-      /* 3-5 Scale in Width direction */
-      horiz_line_scale = aom_horizontal_line_5_3_scale;
-      break;
-    case 5:
-      /* 1-2 Scale in Width direction */
-      horiz_line_scale = aom_horizontal_line_2_1_scale;
-      break;
-    default:
-      /* The ratio is not acceptable now */
-      /* throw("The ratio is not acceptable for now!"); */
-      ratio_scalable = 0;
-      break;
-  }
-
-  switch (vratio * 10 / vscale) {
-    case 8:
-      /* 4-5 Scale in vertical direction */
-      vert_band_scale = aom_vertical_band_5_4_scale;
-      source_band_height = 5;
-      dest_band_height = 4;
-      break;
-    case 6:
-      /* 3-5 Scale in vertical direction */
-      vert_band_scale = aom_vertical_band_5_3_scale;
-      source_band_height = 5;
-      dest_band_height = 3;
-      break;
-    case 5:
-      /* 1-2 Scale in vertical direction */
-
-      if (interlaced) {
-        /* if the content is interlaced, point sampling is used */
-        vert_band_scale = aom_vertical_band_2_1_scale;
-      } else {
-        interpolation = 1;
-        /* if the content is progressive, interplo */
-        vert_band_scale = aom_vertical_band_2_1_scale_i;
-      }
-
-      source_band_height = 2;
-      dest_band_height = 1;
-      break;
-    default:
-      /* The ratio is not acceptable now */
-      /* throw("The ratio is not acceptable for now!"); */
-      ratio_scalable = 0;
-      break;
-  }
-
-  if (ratio_scalable) {
-    if (source_height == dest_height) {
-      /* for each band of the image */
-      for (k = 0; k < dest_height; ++k) {
-        horiz_line_scale(source, source_width, dest, dest_width);
-        source += source_pitch;
-        dest += dest_pitch;
-      }
-
-      return;
-    }
-
-    if (interpolation) {
-      if (source < source_base) source = source_base;
-
-      horiz_line_scale(source, source_width, temp_area, dest_width);
-    }
-
-    for (k = 0; k < (dest_height + dest_band_height - 1) / dest_band_height;
-         ++k) {
-      /* scale one band horizontally */
-      for (i = 0; i < source_band_height; ++i) {
-        /* Trap case where we could read off the base of the source buffer */
-
-        line_src = source + i * source_pitch;
-
-        if (line_src < source_base) line_src = source_base;
-
-        horiz_line_scale(line_src, source_width,
-                         temp_area + (i + 1) * dest_pitch, dest_width);
-      }
-
-      /* Vertical scaling is in place */
-      vert_band_scale(temp_area + dest_pitch, dest_pitch, dest, dest_pitch,
-                      dest_width);
-
-      if (interpolation)
-        memcpy(temp_area, temp_area + source_band_height * dest_pitch,
-               dest_width);
-
-      /* Next band... */
-      source += (unsigned long)source_band_height * source_pitch;
-      dest += (unsigned long)dest_band_height * dest_pitch;
-    }
-
-    return;
-  }
-
-  if (hscale == 2 && hratio == 1) Scale1Dh = scale1d_2t1_ps;
-
-  if (vscale == 2 && vratio == 1) {
-    if (interlaced)
-      Scale1Dv = scale1d_2t1_ps;
-    else
-      Scale1Dv = scale1d_2t1_i;
-  }
-
-  if (source_height == dest_height) {
-    /* for each band of the image */
-    for (k = 0; k < dest_height; ++k) {
-      Scale1Dh(source, 1, hscale, source_width + 1, dest, 1, hratio,
-               dest_width);
-      source += source_pitch;
-      dest += dest_pitch;
-    }
-
-    return;
-  }
-
-  if (dest_height > source_height) {
-    dest_band_height = temp_area_height - 1;
-    source_band_height = dest_band_height * source_height / dest_height;
-  } else {
-    source_band_height = temp_area_height - 1;
-    dest_band_height = source_band_height * vratio / vscale;
-  }
-
-  /* first row needs to be done so that we can stay one row ahead for vertical
-   * zoom */
-  Scale1Dh(source, 1, hscale, source_width + 1, temp_area, 1, hratio,
-           dest_width);
-
-  /* for each band of the image */
-  bands = (dest_height + dest_band_height - 1) / dest_band_height;
-
-  for (k = 0; k < bands; ++k) {
-    /* scale one band horizontally */
-    for (i = 1; i < source_band_height + 1; ++i) {
-      if (k * source_band_height + i < source_height) {
-        Scale1Dh(source + i * source_pitch, 1, hscale, source_width + 1,
-                 temp_area + i * dest_pitch, 1, hratio, dest_width);
-      } else { /*  Duplicate the last row */
-        /* copy temp_area row 0 over from last row in the past */
-        memcpy(temp_area + i * dest_pitch, temp_area + (i - 1) * dest_pitch,
-               dest_pitch);
-      }
-    }
-
-    /* scale one band vertically */
-    for (j = 0; j < dest_width; ++j) {
-      Scale1Dv(&temp_area[j], dest_pitch, vscale, source_band_height + 1,
-               &dest[j], dest_pitch, vratio, dest_band_height);
-    }
-
-    /* copy temp_area row 0 over from last row in the past */
-    memcpy(temp_area, temp_area + source_band_height * dest_pitch, dest_pitch);
-
-    /* move to the next band */
-    source += source_band_height * source_pitch;
-    dest += dest_band_height * dest_pitch;
-  }
-}
-
-/****************************************************************************
- *
- *  ROUTINE       : aom_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 aom_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, const int num_planes) {
-  const int dw = (hscale - 1 + src->y_width * hratio) / hscale;
-  const int dh = (vscale - 1 + src->y_height * vratio) / vscale;
-
-  for (int plane = 0; plane < num_planes; ++plane) {
-    const int is_uv = plane > 0;
-    const int plane_dw = dw >> is_uv;
-    const int plane_dh = dh >> is_uv;
-
-    Scale2D((unsigned char *)src->buffers[plane], src->strides[is_uv],
-            src->widths[is_uv], src->heights[is_uv],
-            (unsigned char *)dst->buffers[plane], dst->strides[is_uv], plane_dw,
-            plane_dh, temp_area, temp_height, hscale, hratio, vscale, vratio,
-            interlaced);
-
-    if (plane_dw < dst->widths[is_uv])
-      for (int i = 0; i < plane_dh; ++i)
-        memset(dst->buffers[plane] + i * dst->strides[is_uv] + plane_dw - 1,
-               dst->buffers[plane][i * dst->strides[is_uv] + plane_dw - 2],
-               dst->widths[is_uv] - plane_dw + 1);
-
-    if (plane_dh < dst->heights[is_uv])
-      for (int i = plane_dh - 1; i < dst->heights[is_uv]; ++i)
-        memcpy(dst->buffers[plane] + i * dst->strides[is_uv],
-               dst->buffers[plane] + (plane_dh - 2) * dst->strides[is_uv],
-               dst->widths[is_uv] + 1);
-  }
-}
diff --git a/aom_scale/generic/gen_scalers.c b/aom_scale/generic/gen_scalers.c
deleted file mode 100644
index 6c8df70d96..0000000000
--- a/aom_scale/generic/gen_scalers.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#include "config/aom_scale_rtcd.h"
-
-#include "aom_scale/aom_scale.h"
-#include "aom_mem/aom_mem.h"
-/****************************************************************************
- *  Imports
- ****************************************************************************/
-
-/****************************************************************************
- *
- *
- *  INPUTS        : const unsigned char *source : Pointer to source data.
- *                  unsigned int source_width   : Stride of source.
- *                  unsigned char *dest         : Pointer to destination data.
- *                  unsigned int dest_width     : Stride of destination
- *                                                (NOT USED).
- *
- *  OUTPUTS       : None.
- *
- *  RETURNS       : void
- *
- *  FUNCTION      : Copies horizontal line of pixels from source to
- *                  destination scaling up by 4 to 5.
- *
- *  SPECIAL NOTES : None.
- *
- ****************************************************************************/
-void aom_horizontal_line_5_4_scale_c(const unsigned char *source,
-                                     unsigned int source_width,
-                                     unsigned char *dest,
-                                     unsigned int dest_width) {
-  const unsigned char *const source_end = source + source_width;
-  (void)dest_width;
-
-  while (source < source_end) {
-    const unsigned int a = source[0];
-    const unsigned int b = source[1];
-    const unsigned int c = source[2];
-    const unsigned int d = source[3];
-    const unsigned int e = source[4];
-
-    dest[0] = (unsigned char)a;
-    dest[1] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
-    dest[2] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
-    dest[3] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
-
-    source += 5;
-    dest += 4;
-  }
-}
-
-void aom_vertical_band_5_4_scale_c(unsigned char *source, int src_pitch,
-                                   unsigned char *dest, int dest_pitch,
-                                   unsigned int dest_width) {
-  const unsigned char *const dest_end = dest + dest_width;
-  while (dest < dest_end) {
-    const unsigned int a = source[0 * src_pitch];
-    const unsigned int b = source[1 * src_pitch];
-    const unsigned int c = source[2 * src_pitch];
-    const unsigned int d = source[3 * src_pitch];
-    const unsigned int e = source[4 * src_pitch];
-
-    dest[0 * dest_pitch] = (unsigned char)a;
-    dest[1 * dest_pitch] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
-    dest[2 * dest_pitch] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
-    dest[3 * dest_pitch] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
-
-    ++source;
-    ++dest;
-  }
-}
-
-/*7***************************************************************************
- *
- *  ROUTINE       : aom_horizontal_line_3_5_scale_c
- *
- *  INPUTS        : const unsigned char *source : Pointer to source data.
- *                  unsigned int source_width   : Stride of source.
- *                  unsigned char *dest         : Pointer to destination data.
- *                  unsigned int dest_width     : Stride of destination
- *                                                (NOT USED).
- *
- *  OUTPUTS       : None.
- *
- *  RETURNS       : void
- *
- *  FUNCTION      : Copies horizontal line of pixels from source to
- *                  destination scaling up by 3 to 5.
- *
- *  SPECIAL NOTES : None.
- *
- *
- ****************************************************************************/
-void aom_horizontal_line_5_3_scale_c(const unsigned char *source,
-                                     unsigned int source_width,
-                                     unsigned char *dest,
-                                     unsigned int dest_width) {
-  const unsigned char *const source_end = source + source_width;
-  (void)dest_width;
-  while (source < source_end) {
-    const unsigned int a = source[0];
-    const unsigned int b = source[1];
-    const unsigned int c = source[2];
-    const unsigned int d = source[3];
-    const unsigned int e = source[4];
-
-    dest[0] = (unsigned char)a;
-    dest[1] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
-    dest[2] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
-
-    source += 5;
-    dest += 3;
-  }
-}
-
-void aom_vertical_band_5_3_scale_c(unsigned char *source, int src_pitch,
-                                   unsigned char *dest, int dest_pitch,
-                                   unsigned int dest_width) {
-  const unsigned char *const dest_end = dest + dest_width;
-  while (dest < dest_end) {
-    const unsigned int a = source[0 * src_pitch];
-    const unsigned int b = source[1 * src_pitch];
-    const unsigned int c = source[2 * src_pitch];
-    const unsigned int d = source[3 * src_pitch];
-    const unsigned int e = source[4 * src_pitch];
-
-    dest[0 * dest_pitch] = (unsigned char)a;
-    dest[1 * dest_pitch] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
-    dest[2 * dest_pitch] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
-
-    ++source;
-    ++dest;
-  }
-}
-
-/****************************************************************************
- *
- *  ROUTINE       : aom_horizontal_line_1_2_scale_c
- *
- *  INPUTS        : const unsigned char *source : Pointer to source data.
- *                  unsigned int source_width   : Stride of source.
- *                  unsigned char *dest         : Pointer to destination data.
- *                  unsigned int dest_width     : Stride of destination
- *                                                (NOT USED).
- *
- *  OUTPUTS       : None.
- *
- *  RETURNS       : void
- *
- *  FUNCTION      : Copies horizontal line of pixels from source to
- *                  destination scaling up by 1 to 2.
- *
- *  SPECIAL NOTES : None.
- *
- ****************************************************************************/
-void aom_horizontal_line_2_1_scale_c(const unsigned char *source,
-                                     unsigned int source_width,
-                                     unsigned char *dest,
-                                     unsigned int dest_width) {
-  const unsigned char *const source_end = source + source_width;
-  (void)dest

(Patch may be truncated, please check the link at the top of this post.)