ref: f4be8844665bc85178fac245ca5ae3ce53927c59
parent: fbf256da41db9624e6a3392da0ba6e8778335ad3
author: clang-format <[email protected]>
date: Mon Jul 25 10:32:36 EDT 2016
vpx_scale: apply clang-format Change-Id: Ia07ba57756f75911d3d06318e1f9b1982e1ca8c5
--- a/vpx_scale/generic/gen_scalers.c
+++ b/vpx_scale/generic/gen_scalers.c
@@ -19,9 +19,9 @@
*
*
* INPUTS : const unsigned char *source : Pointer to source data.
- * unsigned int source_width : Stride of source.
+ * unsigned int source_width : Stride of source.
* unsigned char *dest : Pointer to destination data.
- * unsigned int dest_width : Stride of destination (NOT USED).
+ * unsigned int dest_width : Stride of dest (UNUSED).
*
* OUTPUTS : None.
*
@@ -42,7 +42,7 @@
unsigned char *des = dest;
const unsigned char *src = source;
- (void) dest_width;
+ (void)dest_width;
for (i = 0; i < source_width; i += 5) {
a = src[0];
@@ -51,7 +51,7 @@
d = src[3];
e = src[4];
- des[0] = (unsigned char) a;
+ des[0] = (unsigned char)a;
des[1] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
des[2] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
des[3] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
@@ -61,12 +61,8 @@
}
}
-
-
-
void vp8_vertical_band_5_4_scale_c(unsigned char *source,
- unsigned int src_pitch,
- unsigned char *dest,
+ unsigned int src_pitch, unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
@@ -75,7 +71,6 @@
unsigned char *src = source;
for (i = 0; i < dest_width; i++) {
-
a = src[0 * src_pitch];
b = src[1 * src_pitch];
c = src[2 * src_pitch];
@@ -82,7 +77,7 @@
d = src[3 * src_pitch];
e = src[4 * src_pitch];
- des[0 * dest_pitch] = (unsigned char) a;
+ des[0 * dest_pitch] = (unsigned char)a;
des[1 * dest_pitch] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
des[2 * dest_pitch] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
des[3 * dest_pitch] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
@@ -89,19 +84,17 @@
src++;
des++;
-
}
}
-
/*7***************************************************************************
*
* ROUTINE : vp8_horizontal_line_3_5_scale_c
*
* INPUTS : const unsigned char *source : Pointer to source data.
- * unsigned int source_width : Stride of source.
+ * unsigned int source_width : Stride of source.
* unsigned char *dest : Pointer to destination data.
- * unsigned int dest_width : Stride of destination (NOT USED).
+ * unsigned int dest_width : Stride of dest (UNUSED).
*
* OUTPUTS : None.
*
@@ -123,7 +116,7 @@
unsigned char *des = dest;
const unsigned char *src = source;
- (void) dest_width;
+ (void)dest_width;
for (i = 0; i < source_width; i += 5) {
a = src[0];
@@ -132,19 +125,17 @@
d = src[3];
e = src[4];
- des[0] = (unsigned char) a;
- des[1] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
+ des[0] = (unsigned char)a;
+ des[1] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
des[2] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
src += 5;
des += 3;
}
-
}
void vp8_vertical_band_5_3_scale_c(unsigned char *source,
- unsigned int src_pitch,
- unsigned char *dest,
+ unsigned int src_pitch, unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
@@ -153,7 +144,6 @@
unsigned char *src = source;
for (i = 0; i < dest_width; i++) {
-
a = src[0 * src_pitch];
b = src[1 * src_pitch];
c = src[2 * src_pitch];
@@ -160,13 +150,12 @@
d = src[3 * src_pitch];
e = src[4 * src_pitch];
- des[0 * dest_pitch] = (unsigned char) a;
+ des[0 * dest_pitch] = (unsigned char)a;
des[1 * dest_pitch] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
des[2 * dest_pitch] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
src++;
des++;
-
}
}
@@ -175,9 +164,9 @@
* ROUTINE : vp8_horizontal_line_1_2_scale_c
*
* INPUTS : const unsigned char *source : Pointer to source data.
- * unsigned int source_width : Stride of source.
+ * unsigned int source_width : Stride of source.
* unsigned char *dest : Pointer to destination data.
- * unsigned int dest_width : Stride of destination (NOT USED).
+ * unsigned int dest_width : Stride of dest (UNUSED).
*
* OUTPUTS : None.
*
@@ -198,11 +187,11 @@
unsigned char *des = dest;
const unsigned char *src = source;
- (void) dest_width;
+ (void)dest_width;
for (i = 0; i < source_width; i += 2) {
a = src[0];
- des [0] = (unsigned char)(a);
+ des[0] = (unsigned char)(a);
src += 2;
des += 1;
}
@@ -209,12 +198,11 @@
}
void vp8_vertical_band_2_1_scale_c(unsigned char *source,
- unsigned int src_pitch,
- unsigned char *dest,
+ unsigned int src_pitch, unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
- (void) dest_pitch;
- (void) src_pitch;
+ (void)dest_pitch;
+ (void)src_pitch;
memcpy(dest, source, dest_width);
}
@@ -227,7 +215,7 @@
int temp;
int width = dest_width;
- (void) dest_pitch;
+ (void)dest_pitch;
for (i = 0; i < width; i++) {
temp = 8;
--- a/vpx_scale/generic/vpx_scale.c
+++ b/vpx_scale/generic/vpx_scale.c
@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
/****************************************************************************
*
* Module Title : scale.c
@@ -26,8 +25,8 @@
#include "vpx_scale/yv12config.h"
typedef struct {
- int expanded_frame_width;
- int expanded_frame_height;
+ int expanded_frame_width;
+ int expanded_frame_height;
int HScale;
int HRatio;
@@ -44,13 +43,16 @@
* 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).
+ * 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.
+ * 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.
*
@@ -61,29 +63,22 @@
* 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
-) {
+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) {
unsigned int i, j;
unsigned int temp;
int source_pitch = source_step;
- (void) source_length;
- (void) source_scale;
- (void) dest_scale;
+ (void)source_length;
+ (void)source_scale;
+ (void)dest_scale;
source_step *= 2;
dest[0] = source[0];
- for (i = dest_step, j = source_step; i < dest_length * dest_step; i += dest_step, j += source_step) {
+ for (i = dest_step, j = source_step; i < dest_length * dest_step;
+ i += dest_step, j += source_step) {
temp = 8;
temp += 3 * source[j - source_pitch];
temp += 10 * source[j];
@@ -98,13 +93,16 @@
* 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).
+ * 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.
+ * 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.
*
@@ -115,23 +113,16 @@
* 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
-) {
+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) {
unsigned int i, j;
- (void) source_length;
- (void) source_scale;
- (void) dest_scale;
+ (void)source_length;
+ (void)source_scale;
+ (void)dest_scale;
source_step *= 2;
j = 0;
@@ -144,13 +135,15 @@
* 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).
+ * 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.
+ * 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.
*
@@ -161,18 +154,10 @@
* 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
-) {
+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) {
unsigned int i;
unsigned int round_value = dest_scale / 2;
unsigned int left_modifier = dest_scale;
@@ -180,14 +165,17 @@
unsigned char left_pixel = *source;
unsigned char right_pixel = *(source + source_step);
- (void) source_length;
+ (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 );*/
+ /*assert ( (source_length-1) * dest_scale >= (dest_length-1) * source_scale
+ * );*/
for (i = 0; i < dest_length * dest_step; i += dest_step) {
- dest[i] = (char)((left_modifier * left_pixel + right_modifier * right_pixel + round_value) / dest_scale);
+ dest[i] = (char)((left_modifier * left_pixel +
+ right_modifier * right_pixel + round_value) /
+ dest_scale);
right_modifier += source_scale;
@@ -206,21 +194,29 @@
*
* 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.
+ * 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.
+ * 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.
*
@@ -232,26 +228,13 @@
* 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
-) {
+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;
int bands;
@@ -258,22 +241,25 @@
int dest_band_height;
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);
+ 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 *, unsigned int, unsigned char *, unsigned int, unsigned int) = NULL;
+ void (*horiz_line_scale)(const unsigned char *, unsigned int, unsigned char *,
+ unsigned int) = NULL;
+ void (*vert_band_scale)(unsigned char *, unsigned int, unsigned char *,
+ unsigned int, unsigned int) = NULL;
int ratio_scalable = 1;
int interpolation = 0;
- unsigned char *source_base; /* = (unsigned char *) ((source_pitch >= 0) ? source : (source + ((source_height-1) * source_pitch))); */
+ unsigned char *source_base;
unsigned char *line_src;
-
source_base = (unsigned char *)source;
if (source_pitch < 0) {
@@ -309,15 +295,15 @@
switch (vratio * 10 / vscale) {
case 8:
/* 4-5 Scale in vertical direction */
- vert_band_scale = vp8_vertical_band_5_4_scale;
- source_band_height = 5;
- dest_band_height = 4;
+ vert_band_scale = vp8_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 = vp8_vertical_band_5_3_scale;
- source_band_height = 5;
- dest_band_height = 3;
+ vert_band_scale = vp8_vertical_band_5_3_scale;
+ source_band_height = 5;
+ dest_band_height = 3;
break;
case 5:
/* 1-2 Scale in vertical direction */
@@ -324,17 +310,15 @@
if (interlaced) {
/* if the content is interlaced, point sampling is used */
- vert_band_scale = vp8_vertical_band_2_1_scale;
+ vert_band_scale = vp8_vertical_band_2_1_scale;
} else {
-
interpolation = 1;
/* if the content is progressive, interplo */
- vert_band_scale = vp8_vertical_band_2_1_scale_i;
-
+ vert_band_scale = vp8_vertical_band_2_1_scale_i;
}
- source_band_height = 2;
- dest_band_height = 1;
+ source_band_height = 2;
+ dest_band_height = 1;
break;
default:
/* The ratio is not acceptable now */
@@ -349,7 +333,7 @@
for (k = 0; k < (int)dest_height; k++) {
horiz_line_scale(source, source_width, dest, dest_width);
source += source_pitch;
- dest += dest_pitch;
+ dest += dest_pitch;
}
return;
@@ -356,13 +340,14 @@
}
if (interpolation) {
- if (source < source_base)
- source = source_base;
+ if (source < source_base) source = source_base;
horiz_line_scale(source, source_width, temp_area, dest_width);
}
- for (k = 0; k < (int)(dest_height + dest_band_height - 1) / dest_band_height; k++) {
+ for (k = 0;
+ k < (int)(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 */
@@ -369,29 +354,29 @@
line_src = (unsigned char *)source + i * source_pitch;
- if (line_src < source_base)
- line_src = source_base;
+ if (line_src < source_base) line_src = source_base;
horiz_line_scale(line_src, source_width,
- temp_area + (i + 1)*dest_pitch, dest_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);
+ 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);
+ 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;
+ 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 (hscale == 2 && hratio == 1) Scale1Dh = scale1d_2t1_ps;
if (vscale == 2 && vratio == 1) {
if (interlaced)
@@ -403,9 +388,10 @@
if (source_height == dest_height) {
/* for each band of the image */
for (k = 0; k < (int)dest_height; k++) {
- Scale1Dh(source, 1, hscale, source_width + 1, dest, 1, hratio, dest_width);
+ Scale1Dh(source, 1, hscale, source_width + 1, dest, 1, hratio,
+ dest_width);
source += source_pitch;
- dest += dest_pitch;
+ dest += dest_pitch;
}
return;
@@ -412,15 +398,17 @@
}
if (dest_height > source_height) {
- dest_band_height = temp_area_height - 1;
+ 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;
+ 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);
+ /* 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;
@@ -428,12 +416,13 @@
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 < (int) source_height) {
+ if (k * source_band_height + i < (int)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);
+ memcpy(temp_area + i * dest_pitch, temp_area + (i - 1) * dest_pitch,
+ dest_pitch);
}
}
@@ -448,7 +437,7 @@
/* move to the next band */
source += source_band_height * source_pitch;
- dest += dest_band_height * dest_pitch;
+ dest += dest_band_height * dest_pitch;
}
}
@@ -456,15 +445,21 @@
*
* 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.
+ * 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.
+ * 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.
*
@@ -476,56 +471,59 @@
* 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
-) {
+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) {
int i;
int dw = (hscale - 1 + src->y_width * hratio) / hscale;
int dh = (vscale - 1 + src->y_height * vratio) / vscale;
/* call our internal scaling routines!! */
- Scale2D((unsigned char *) src->y_buffer, src->y_stride, src->y_width, src->y_height,
- (unsigned char *) dst->y_buffer, dst->y_stride, dw, dh,
+ Scale2D((unsigned char *)src->y_buffer, src->y_stride, src->y_width,
+ src->y_height, (unsigned char *)dst->y_buffer, dst->y_stride, dw, dh,
temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
if (dw < (int)dst->y_width)
for (i = 0; i < dh; i++)
- memset(dst->y_buffer + i * dst->y_stride + dw - 1, dst->y_buffer[i * dst->y_stride + dw - 2], dst->y_width - dw + 1);
+ memset(dst->y_buffer + i * dst->y_stride + dw - 1,
+ dst->y_buffer[i * dst->y_stride + dw - 2], dst->y_width - dw + 1);
if (dh < (int)dst->y_height)
for (i = dh - 1; i < (int)dst->y_height; i++)
- memcpy(dst->y_buffer + i * dst->y_stride, dst->y_buffer + (dh - 2) * dst->y_stride, dst->y_width + 1);
+ memcpy(dst->y_buffer + i * dst->y_stride,
+ dst->y_buffer + (dh - 2) * dst->y_stride, dst->y_width + 1);
- Scale2D((unsigned char *) src->u_buffer, src->uv_stride, src->uv_width, src->uv_height,
- (unsigned char *) dst->u_buffer, dst->uv_stride, dw / 2, dh / 2,
- temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
+ Scale2D((unsigned char *)src->u_buffer, src->uv_stride, src->uv_width,
+ src->uv_height, (unsigned char *)dst->u_buffer, dst->uv_stride,
+ dw / 2, dh / 2, temp_area, temp_height, hscale, hratio, vscale,
+ vratio, interlaced);
if (dw / 2 < (int)dst->uv_width)
for (i = 0; i < dst->uv_height; i++)
- memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1, dst->u_buffer[i * dst->uv_stride + dw / 2 - 2], dst->uv_width - dw / 2 + 1);
+ memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1,
+ dst->u_buffer[i * dst->uv_stride + dw / 2 - 2],
+ dst->uv_width - dw / 2 + 1);
if (dh / 2 < (int)dst->uv_height)
for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++)
- memcpy(dst->u_buffer + i * dst->uv_stride, dst->u_buffer + (dh / 2 - 2)*dst->uv_stride, dst->uv_width);
+ memcpy(dst->u_buffer + i * dst->uv_stride,
+ dst->u_buffer + (dh / 2 - 2) * dst->uv_stride, dst->uv_width);
- Scale2D((unsigned char *) src->v_buffer, src->uv_stride, src->uv_width, src->uv_height,
- (unsigned char *) dst->v_buffer, dst->uv_stride, dw / 2, dh / 2,
- temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
+ Scale2D((unsigned char *)src->v_buffer, src->uv_stride, src->uv_width,
+ src->uv_height, (unsigned char *)dst->v_buffer, dst->uv_stride,
+ dw / 2, dh / 2, temp_area, temp_height, hscale, hratio, vscale,
+ vratio, interlaced);
if (dw / 2 < (int)dst->uv_width)
for (i = 0; i < dst->uv_height; i++)
- memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1, dst->v_buffer[i * dst->uv_stride + dw / 2 - 2], dst->uv_width - dw / 2 + 1);
+ memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1,
+ dst->v_buffer[i * dst->uv_stride + dw / 2 - 2],
+ dst->uv_width - dw / 2 + 1);
- if (dh / 2 < (int) dst->uv_height)
+ if (dh / 2 < (int)dst->uv_height)
for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++)
- memcpy(dst->v_buffer + i * dst->uv_stride, dst->v_buffer + (dh / 2 - 2)*dst->uv_stride, dst->uv_width);
+ memcpy(dst->v_buffer + i * dst->uv_stride,
+ dst->v_buffer + (dh / 2 - 2) * dst->uv_stride, dst->uv_width);
}
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -22,10 +22,9 @@
*
****************************************************************************/
#define yv12_align_addr(addr, align) \
- (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align))
+ (void *)(((size_t)(addr) + ((align)-1)) & (size_t) - (align))
-int
-vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
+int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
if (ybf) {
// If libvpx is using frame buffer callbacks then buffer_alloc_sz must
// not be set.
@@ -44,8 +43,8 @@
return 0;
}
-int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border) {
+int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width,
+ int height, int border) {
if (ybf) {
int aligned_width = (width + 15) & ~15;
int aligned_height = (height + 15) & ~15;
@@ -64,8 +63,7 @@
ybf->buffer_alloc_sz = frame_size;
}
- if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size)
- return -1;
+ if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size) return -1;
/* Only support allocating buffers that have a border that's a multiple
* of 32. The border restriction is required to get 16-byte alignment of
@@ -72,12 +70,11 @@
* the start of the chroma rows without introducing an arbitrary gap
* between planes, which would break the semantics of things like
* vpx_img_set_rect(). */
- if (border & 0x1f)
- return -3;
+ if (border & 0x1f) return -3;
ybf->y_crop_width = width;
ybf->y_crop_height = height;
- ybf->y_width = aligned_width;
+ ybf->y_width = aligned_width;
ybf->y_height = aligned_height;
ybf->y_stride = y_stride;
@@ -95,8 +92,10 @@
ybf->frame_size = frame_size;
ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
- ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * uv_stride) + border / 2;
- ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * uv_stride) + border / 2;
+ ybf->u_buffer =
+ ybf->buffer_alloc + yplane_size + (border / 2 * uv_stride) + border / 2;
+ ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size +
+ (border / 2 * uv_stride) + border / 2;
ybf->alpha_buffer = NULL;
ybf->corrupted = 0; /* assume not currupted by errors */
@@ -105,8 +104,8 @@
return -2;
}
-int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border) {
+int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
+ int border) {
if (ybf) {
vp8_yv12_de_alloc_frame_buffer(ybf);
return vp8_yv12_realloc_frame_buffer(ybf, width, height, border);
@@ -134,31 +133,28 @@
return 0;
}
-int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height,
+int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
- int border,
- int byte_alignment,
+ int border, int byte_alignment,
vpx_codec_frame_buffer_t *fb,
- vpx_get_frame_buffer_cb_fn_t cb,
- void *cb_priv) {
+ vpx_get_frame_buffer_cb_fn_t cb, void *cb_priv) {
if (ybf) {
const int vp9_byte_align = (byte_alignment == 0) ? 1 : byte_alignment;
const int aligned_width = (width + 7) & ~7;
const int aligned_height = (height + 7) & ~7;
const int y_stride = ((aligned_width + 2 * border) + 31) & ~31;
- const uint64_t yplane_size = (aligned_height + 2 * border) *
- (uint64_t)y_stride + byte_alignment;
+ const uint64_t yplane_size =
+ (aligned_height + 2 * border) * (uint64_t)y_stride + byte_alignment;
const int uv_width = aligned_width >> ss_x;
const int uv_height = aligned_height >> ss_y;
const int uv_stride = y_stride >> ss_x;
const int uv_border_w = border >> ss_x;
const int uv_border_h = border >> ss_y;
- const uint64_t uvplane_size = (uv_height + 2 * uv_border_h) *
- (uint64_t)uv_stride + byte_alignment;
+ const uint64_t uvplane_size =
+ (uv_height + 2 * uv_border_h) * (uint64_t)uv_stride + byte_alignment;
#if CONFIG_VP9_HIGHBITDEPTH
const uint64_t frame_size =
@@ -175,15 +171,12 @@
assert(fb != NULL);
- if (external_frame_size != (size_t)external_frame_size)
- return -1;
+ if (external_frame_size != (size_t)external_frame_size) return -1;
// Allocation to hold larger frame, or first allocation.
- if (cb(cb_priv, (size_t)external_frame_size, fb) < 0)
- return -1;
+ if (cb(cb_priv, (size_t)external_frame_size, fb) < 0) return -1;
- if (fb->data == NULL || fb->size < external_frame_size)
- return -1;
+ if (fb->data == NULL || fb->size < external_frame_size) return -1;
ybf->buffer_alloc = (uint8_t *)yv12_align_addr(fb->data, 32);
@@ -200,12 +193,10 @@
vpx_free(ybf->buffer_alloc);
ybf->buffer_alloc = NULL;
- if (frame_size != (size_t)frame_size)
- return -1;
+ if (frame_size != (size_t)frame_size) return -1;
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, (size_t)frame_size);
- if (!ybf->buffer_alloc)
- return -1;
+ if (!ybf->buffer_alloc) return -1;
ybf->buffer_alloc_sz = (int)frame_size;
@@ -220,12 +211,11 @@
* the start of the chroma rows without introducing an arbitrary gap
* between planes, which would break the semantics of things like
* vpx_img_set_rect(). */
- if (border & 0x1f)
- return -3;
+ if (border & 0x1f) return -3;
ybf->y_crop_width = width;
ybf->y_crop_height = height;
- ybf->y_width = aligned_width;
+ ybf->y_width = aligned_width;
ybf->y_height = aligned_height;
ybf->y_stride = y_stride;
@@ -256,9 +246,10 @@
ybf->u_buffer = (uint8_t *)yv12_align_addr(
buf + yplane_size + (uv_border_h * uv_stride) + uv_border_w,
vp9_byte_align);
- ybf->v_buffer = (uint8_t *)yv12_align_addr(
- buf + yplane_size + uvplane_size + (uv_border_h * uv_stride) +
- uv_border_w, vp9_byte_align);
+ ybf->v_buffer =
+ (uint8_t *)yv12_align_addr(buf + yplane_size + uvplane_size +
+ (uv_border_h * uv_stride) + uv_border_w,
+ vp9_byte_align);
ybf->corrupted = 0; /* assume not corrupted by errors */
return 0;
@@ -266,14 +257,12 @@
return -2;
}
-int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height,
+int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
- int border,
- int byte_alignment) {
+ int border, int byte_alignment) {
if (ybf) {
vpx_free_frame_buffer(ybf);
return vpx_realloc_frame_buffer(ybf, width, height, ss_x, ss_y,
--- a/vpx_scale/generic/yv12extend.c
+++ b/vpx_scale/generic/yv12extend.c
@@ -19,9 +19,8 @@
#include "vp9/common/vp9_common.h"
#endif
-static void extend_plane(uint8_t *const src, int src_stride,
- int width, int height,
- int extend_top, int extend_left,
+static void extend_plane(uint8_t *const src, int src_stride, int width,
+ int height, int extend_top, int extend_left,
int extend_bottom, int extend_right) {
int i;
const int linesize = extend_left + extend_right + width;
@@ -61,9 +60,8 @@
}
#if CONFIG_VP9_HIGHBITDEPTH
-static void extend_plane_high(uint8_t *const src8, int src_stride,
- int width, int height,
- int extend_top, int extend_left,
+static void extend_plane_high(uint8_t *const src8, int src_stride, int width,
+ int height, int extend_top, int extend_left,
int extend_bottom, int extend_right) {
int i;
const int linesize = extend_left + extend_right + width;
@@ -115,44 +113,35 @@
#if CONFIG_VP9_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
- extend_plane_high(
- ybf->y_buffer, ybf->y_stride,
- ybf->y_crop_width, ybf->y_crop_height,
- ybf->border, ybf->border,
- ybf->border + ybf->y_height - ybf->y_crop_height,
- ybf->border + ybf->y_width - ybf->y_crop_width);
+ extend_plane_high(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
+ ybf->y_crop_height, ybf->border, ybf->border,
+ ybf->border + ybf->y_height - ybf->y_crop_height,
+ ybf->border + ybf->y_width - ybf->y_crop_width);
- extend_plane_high(
- ybf->u_buffer, ybf->uv_stride,
- ybf->uv_crop_width, ybf->uv_crop_height,
- uv_border, uv_border,
- uv_border + ybf->uv_height - ybf->uv_crop_height,
- uv_border + ybf->uv_width - ybf->uv_crop_width);
+ extend_plane_high(ybf->u_buffer, ybf->uv_stride, ybf->uv_crop_width,
+ ybf->uv_crop_height, uv_border, uv_border,
+ uv_border + ybf->uv_height - ybf->uv_crop_height,
+ uv_border + ybf->uv_width - ybf->uv_crop_width);
- extend_plane_high(
- ybf->v_buffer, ybf->uv_stride,
- ybf->uv_crop_width, ybf->uv_crop_height,
- uv_border, uv_border,
- uv_border + ybf->uv_height - ybf->uv_crop_height,
- uv_border + ybf->uv_width - ybf->uv_crop_width);
+ extend_plane_high(ybf->v_buffer, ybf->uv_stride, ybf->uv_crop_width,
+ ybf->uv_crop_height, uv_border, uv_border,
+ uv_border + ybf->uv_height - ybf->uv_crop_height,
+ uv_border + ybf->uv_width - ybf->uv_crop_width);
return;
}
#endif
- extend_plane(ybf->y_buffer, ybf->y_stride,
- ybf->y_crop_width, ybf->y_crop_height,
- ybf->border, ybf->border,
+ extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
+ ybf->y_crop_height, ybf->border, ybf->border,
ybf->border + ybf->y_height - ybf->y_crop_height,
ybf->border + ybf->y_width - ybf->y_crop_width);
- extend_plane(ybf->u_buffer, ybf->uv_stride,
- ybf->uv_crop_width, ybf->uv_crop_height,
- uv_border, uv_border,
+ extend_plane(ybf->u_buffer, ybf->uv_stride, ybf->uv_crop_width,
+ ybf->uv_crop_height, uv_border, uv_border,
uv_border + ybf->uv_height - ybf->uv_crop_height,
uv_border + ybf->uv_width - ybf->uv_crop_width);
- extend_plane(ybf->v_buffer, ybf->uv_stride,
- ybf->uv_crop_width, ybf->uv_crop_height,
- uv_border, uv_border,
+ extend_plane(ybf->v_buffer, ybf->uv_stride, ybf->uv_crop_width,
+ ybf->uv_crop_height, uv_border, uv_border,
uv_border + ybf->uv_height - ybf->uv_crop_height,
uv_border + ybf->uv_width - ybf->uv_crop_width);
}
@@ -175,29 +164,25 @@
#if CONFIG_VP9_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
- extend_plane_high(ybf->y_buffer, ybf->y_stride,
- ybf->y_crop_width, ybf->y_crop_height,
- ext_size, ext_size,
+ extend_plane_high(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
+ ybf->y_crop_height, ext_size, ext_size,
ext_size + ybf->y_height - ybf->y_crop_height,
ext_size + ybf->y_width - ybf->y_crop_width);
- extend_plane_high(ybf->u_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
- extend_plane_high(ybf->v_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
+ extend_plane_high(ybf->u_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb,
+ c_er);
+ extend_plane_high(ybf->v_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb,
+ c_er);
return;
}
#endif
- extend_plane(ybf->y_buffer, ybf->y_stride,
- ybf->y_crop_width, ybf->y_crop_height,
- ext_size, ext_size,
+ extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
+ ybf->y_crop_height, ext_size, ext_size,
ext_size + ybf->y_height - ybf->y_crop_height,
ext_size + ybf->y_width - ybf->y_crop_width);
- extend_plane(ybf->u_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
+ extend_plane(ybf->u_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
- extend_plane(ybf->v_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
+ extend_plane(ybf->v_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
}
void vpx_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
@@ -205,8 +190,9 @@
}
void vpx_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf) {
- const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS) ?
- VP9INNERBORDERINPIXELS : ybf->border;
+ const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS)
+ ? VP9INNERBORDERINPIXELS
+ : ybf->border;
extend_frame(ybf, inner_bw);
}
--- a/vpx_scale/mips/dspr2/yv12extend_dspr2.c
+++ b/vpx_scale/mips/dspr2/yv12extend_dspr2.c
@@ -16,69 +16,65 @@
#include "vpx_scale/vpx_scale.h"
#if HAVE_DSPR2
-static void extend_plane(uint8_t *const src, int src_stride,
- int width, int height,
- int extend_top, int extend_left,
+static void extend_plane(uint8_t *const src, int src_stride, int width,
+ int height, int extend_top, int extend_left,
int extend_bottom, int extend_right) {
- int i, j;
- uint8_t *left_src, *right_src;
- uint8_t *left_dst_start, *right_dst_start;
- uint8_t *left_dst, *right_dst;
- uint8_t *top_src, *bot_src;
- uint8_t *top_dst, *bot_dst;
- uint32_t left_pix;
- uint32_t right_pix;
- uint32_t linesize;
+ int i, j;
+ uint8_t *left_src, *right_src;
+ uint8_t *left_dst_start, *right_dst_start;
+ uint8_t *left_dst, *right_dst;
+ uint8_t *top_src, *bot_src;
+ uint8_t *top_dst, *bot_dst;
+ uint32_t left_pix;
+ uint32_t right_pix;
+ uint32_t linesize;
/* copy the left and right most columns out */
- left_src = src;
+ left_src = src;
right_src = src + width - 1;
left_dst_start = src - extend_left;
right_dst_start = src + width;
- for (i = height; i--; ) {
- left_dst = left_dst_start;
+ for (i = height; i--;) {
+ left_dst = left_dst_start;
right_dst = right_dst_start;
- __asm__ __volatile__ (
+ __asm__ __volatile__(
"lb %[left_pix], 0(%[left_src]) \n\t"
"lb %[right_pix], 0(%[right_src]) \n\t"
"replv.qb %[left_pix], %[left_pix] \n\t"
"replv.qb %[right_pix], %[right_pix] \n\t"
- : [left_pix] "=&r" (left_pix), [right_pix] "=&r" (right_pix)
- : [left_src] "r" (left_src), [right_src] "r" (right_src)
- );
+ : [left_pix] "=&r"(left_pix), [right_pix] "=&r"(right_pix)
+ : [left_src] "r"(left_src), [right_src] "r"(right_src));
- for (j = extend_left/4; j--; ) {
- __asm__ __volatile__ (
- "sw %[left_pix], 0(%[left_dst]) \n\t"
- "sw %[right_pix], 0(%[right_dst]) \n\t"
+ for (j = extend_left / 4; j--;) {
+ __asm__ __volatile__(
+ "sw %[left_pix], 0(%[left_dst]) \n\t"
+ "sw %[right_pix], 0(%[right_dst]) \n\t"
- :
- : [left_dst] "r" (left_dst), [left_pix] "r" (left_pix),
- [right_dst] "r" (right_dst), [right_pix] "r" (right_pix)
- );
+ :
+ : [left_dst] "r"(left_dst), [left_pix] "r"(left_pix),
+ [right_dst] "r"(right_dst), [right_pix] "r"(right_pix));
left_dst += 4;
right_dst += 4;
}
- for (j = extend_left%4; j--; ) {
- __asm__ __volatile__ (
- "sb %[left_pix], 0(%[left_dst]) \n\t"
- "sb %[right_pix], 0(%[right_dst]) \n\t"
+ for (j = extend_left % 4; j--;) {
+ __asm__ __volatile__(
+ "sb %[left_pix], 0(%[left_dst]) \n\t"
+ "sb %[right_pix], 0(%[right_dst]) \n\t"
- :
- : [left_dst] "r" (left_dst), [left_pix] "r" (left_pix),
- [right_dst] "r" (right_dst), [right_pix] "r" (right_pix)
- );
+ :
+ : [left_dst] "r"(left_dst), [left_pix] "r"(left_pix),
+ [right_dst] "r"(right_dst), [right_pix] "r"(right_pix));
left_dst += 1;
right_dst += 1;
}
- left_src += src_stride;
+ left_src += src_stride;
right_src += src_stride;
left_dst_start += src_stride;
right_dst_start += src_stride;
@@ -90,7 +86,7 @@
top_src = src - extend_left;
bot_src = src + src_stride * (height - 1) - extend_left;
top_dst = src + src_stride * (-extend_top) - extend_left;
- bot_dst = src + src_stride * (height) - extend_left;
+ bot_dst = src + src_stride * (height)-extend_left;
linesize = extend_left + extend_right + width;
for (i = 0; i < extend_top; i++) {
@@ -119,17 +115,14 @@
assert(ybf->y_height - ybf->y_crop_height >= 0);
assert(ybf->y_width - ybf->y_crop_width >= 0);
- extend_plane(ybf->y_buffer, ybf->y_stride,
- ybf->y_crop_width, ybf->y_crop_height,
- ext_size, ext_size,
+ extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
+ ybf->y_crop_height, ext_size, ext_size,
ext_size + ybf->y_height - ybf->y_crop_height,
ext_size + ybf->y_width - ybf->y_crop_width);
- extend_plane(ybf->u_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
+ extend_plane(ybf->u_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
- extend_plane(ybf->v_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
+ extend_plane(ybf->v_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
}
void vpx_extend_frame_borders_dspr2(YV12_BUFFER_CONFIG *ybf) {
@@ -137,8 +130,9 @@
}
void vpx_extend_frame_inner_borders_dspr2(YV12_BUFFER_CONFIG *ybf) {
- const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS) ?
- VP9INNERBORDERINPIXELS : ybf->border;
+ const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS)
+ ? VP9INNERBORDERINPIXELS
+ : ybf->border;
extend_frame(ybf, inner_bw);
}
#endif
--- a/vpx_scale/vpx_scale.h
+++ b/vpx_scale/vpx_scale.h
@@ -8,20 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
#ifndef VPX_SCALE_VPX_SCALE_H_
#define VPX_SCALE_VPX_SCALE_H_
#include "vpx_scale/yv12config.h"
-extern 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,
+extern 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);
#endif // VPX_SCALE_VPX_SCALE_H_
--- a/vpx_scale/vpx_scale_rtcd.c
+++ b/vpx_scale/vpx_scale_rtcd.c
@@ -12,7 +12,4 @@
#include "./vpx_scale_rtcd.h"
#include "vpx_ports/vpx_once.h"
-void vpx_scale_rtcd()
-{
- once(setup_rtcd_internal);
-}
+void vpx_scale_rtcd() { once(setup_rtcd_internal); }
--- a/vpx_scale/yv12config.h
+++ b/vpx_scale/yv12config.h
@@ -20,28 +20,28 @@
#include "vpx/vpx_frame_buffer.h"
#include "vpx/vpx_integer.h"
-#define VP8BORDERINPIXELS 32
-#define VP9INNERBORDERINPIXELS 96
-#define VP9_INTERP_EXTEND 4
-#define VP9_ENC_BORDER_IN_PIXELS 160
-#define VP9_DEC_BORDER_IN_PIXELS 32
+#define VP8BORDERINPIXELS 32
+#define VP9INNERBORDERINPIXELS 96
+#define VP9_INTERP_EXTEND 4
+#define VP9_ENC_BORDER_IN_PIXELS 160
+#define VP9_DEC_BORDER_IN_PIXELS 32
typedef struct yv12_buffer_config {
- int y_width;
- int y_height;
- int y_crop_width;
- int y_crop_height;
- int y_stride;
+ int y_width;
+ int y_height;
+ int y_crop_width;
+ int y_crop_height;
+ int y_stride;
- int uv_width;
- int uv_height;
- int uv_crop_width;
- int uv_crop_height;
- int uv_stride;
+ int uv_width;
+ int uv_height;
+ int uv_crop_width;
+ int uv_crop_height;
+ int uv_stride;
- int alpha_width;
- int alpha_height;
- int alpha_stride;
+ int alpha_width;
+ int alpha_height;
+ int alpha_stride;
uint8_t *y_buffer;
uint8_t *u_buffer;
@@ -66,14 +66,14 @@
#define YV12_FLAG_HIGHBITDEPTH 8
-int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border);
-int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border);
+int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
+ int border);
+int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width,
+ int height, int border);
int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf);
-int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int ss_x, int ss_y,
+int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
+ int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
@@ -86,16 +86,14 @@
// to decode the current frame. If cb is NULL, libvpx will allocate memory
// internally to decode the current frame. Returns 0 on success. Returns < 0
// on failure.
-int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int ss_x, int ss_y,
+int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
+ int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
- int border,
- int byte_alignment,
+ int border, int byte_alignment,
vpx_codec_frame_buffer_t *fb,
- vpx_get_frame_buffer_cb_fn_t cb,
- void *cb_priv);
+ vpx_get_frame_buffer_cb_fn_t cb, void *cb_priv);
int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf);
#ifdef __cplusplus