vpx_scale: apply clang-format

Change-Id: Ia07ba57756f75911d3d06318e1f9b1982e1ca8c5
This commit is contained in:
clang-format
2016-07-25 14:32:36 -07:00
committed by James Zern
parent fbf256da41
commit f4be884466
8 changed files with 336 additions and 391 deletions

View File

@@ -21,7 +21,7 @@
* INPUTS : const unsigned char *source : Pointer to source data. * 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 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. * OUTPUTS : None.
* *
@@ -61,12 +61,8 @@ void vp8_horizontal_line_5_4_scale_c(const unsigned char *source,
} }
} }
void vp8_vertical_band_5_4_scale_c(unsigned char *source, void vp8_vertical_band_5_4_scale_c(unsigned char *source,
unsigned int src_pitch, unsigned int src_pitch, unsigned char *dest,
unsigned char *dest,
unsigned int dest_pitch, unsigned int dest_pitch,
unsigned int dest_width) { unsigned int dest_width) {
unsigned int i; unsigned int i;
@@ -75,7 +71,6 @@ void vp8_vertical_band_5_4_scale_c(unsigned char *source,
unsigned char *src = source; unsigned char *src = source;
for (i = 0; i < dest_width; i++) { for (i = 0; i < dest_width; i++) {
a = src[0 * src_pitch]; a = src[0 * src_pitch];
b = src[1 * src_pitch]; b = src[1 * src_pitch];
c = src[2 * src_pitch]; c = src[2 * src_pitch];
@@ -89,11 +84,9 @@ void vp8_vertical_band_5_4_scale_c(unsigned char *source,
src++; src++;
des++; des++;
} }
} }
/*7*************************************************************************** /*7***************************************************************************
* *
* ROUTINE : vp8_horizontal_line_3_5_scale_c * ROUTINE : vp8_horizontal_line_3_5_scale_c
@@ -101,7 +94,7 @@ void vp8_vertical_band_5_4_scale_c(unsigned char *source,
* INPUTS : const unsigned char *source : Pointer to source data. * 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 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. * OUTPUTS : None.
* *
@@ -139,12 +132,10 @@ void vp8_horizontal_line_5_3_scale_c(const unsigned char *source,
src += 5; src += 5;
des += 3; des += 3;
} }
} }
void vp8_vertical_band_5_3_scale_c(unsigned char *source, void vp8_vertical_band_5_3_scale_c(unsigned char *source,
unsigned int src_pitch, unsigned int src_pitch, unsigned char *dest,
unsigned char *dest,
unsigned int dest_pitch, unsigned int dest_pitch,
unsigned int dest_width) { unsigned int dest_width) {
unsigned int i; unsigned int i;
@@ -153,7 +144,6 @@ void vp8_vertical_band_5_3_scale_c(unsigned char *source,
unsigned char *src = source; unsigned char *src = source;
for (i = 0; i < dest_width; i++) { for (i = 0; i < dest_width; i++) {
a = src[0 * src_pitch]; a = src[0 * src_pitch];
b = src[1 * src_pitch]; b = src[1 * src_pitch];
c = src[2 * src_pitch]; c = src[2 * src_pitch];
@@ -166,7 +156,6 @@ void vp8_vertical_band_5_3_scale_c(unsigned char *source,
src++; src++;
des++; des++;
} }
} }
@@ -177,7 +166,7 @@ void vp8_vertical_band_5_3_scale_c(unsigned char *source,
* INPUTS : const unsigned char *source : Pointer to source data. * 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 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. * OUTPUTS : None.
* *
@@ -209,8 +198,7 @@ void vp8_horizontal_line_2_1_scale_c(const unsigned char *source,
} }
void vp8_vertical_band_2_1_scale_c(unsigned char *source, void vp8_vertical_band_2_1_scale_c(unsigned char *source,
unsigned int src_pitch, unsigned int src_pitch, unsigned char *dest,
unsigned char *dest,
unsigned int dest_pitch, unsigned int dest_pitch,
unsigned int dest_width) { unsigned int dest_width) {
(void)dest_pitch; (void)dest_pitch;

View File

@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
/**************************************************************************** /****************************************************************************
* *
* Module Title : scale.c * Module Title : scale.c
@@ -44,12 +43,15 @@ typedef struct {
* ROUTINE : scale1d_2t1_i * ROUTINE : scale1d_2t1_i
* *
* INPUTS : const unsigned char *source : Pointer to data to be scaled. * INPUTS : const unsigned char *source : Pointer to data to be scaled.
* int source_step : Number of pixels to step on in source. * int source_step : Number of pixels to step on in
* source.
* unsigned int source_scale : Scale for source (UNUSED). * unsigned int source_scale : Scale for source (UNUSED).
* unsigned int source_length : Length of source (UNUSED). * unsigned int source_length : Length of source (UNUSED).
* unsigned char *dest : Pointer to output data array. * unsigned char *dest : Pointer to output data array.
* int dest_step : Number of pixels to step on in destination. * int dest_step : Number of pixels to step on in
* unsigned int dest_scale : Scale for destination (UNUSED). * destination.
* unsigned int dest_scale : Scale for destination
* (UNUSED).
* unsigned int dest_length : Length of destination. * unsigned int dest_length : Length of destination.
* *
* OUTPUTS : None. * OUTPUTS : None.
@@ -61,18 +63,10 @@ typedef struct {
* SPECIAL NOTES : None. * SPECIAL NOTES : None.
* *
****************************************************************************/ ****************************************************************************/
static static void scale1d_2t1_i(const unsigned char *source, int source_step,
void scale1d_2t1_i unsigned int source_scale, unsigned int source_length,
( unsigned char *dest, int dest_step,
const unsigned char *source, unsigned int dest_scale, unsigned int dest_length) {
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 i, j;
unsigned int temp; unsigned int temp;
int source_pitch = source_step; int source_pitch = source_step;
@@ -83,7 +77,8 @@ void scale1d_2t1_i
source_step *= 2; source_step *= 2;
dest[0] = source[0]; 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 = 8;
temp += 3 * source[j - source_pitch]; temp += 3 * source[j - source_pitch];
temp += 10 * source[j]; temp += 10 * source[j];
@@ -98,12 +93,15 @@ void scale1d_2t1_i
* ROUTINE : scale1d_2t1_ps * ROUTINE : scale1d_2t1_ps
* *
* INPUTS : const unsigned char *source : Pointer to data to be scaled. * INPUTS : const unsigned char *source : Pointer to data to be scaled.
* int source_step : Number of pixels to step on in source. * int source_step : Number of pixels to step on in
* source.
* unsigned int source_scale : Scale for source (UNUSED). * unsigned int source_scale : Scale for source (UNUSED).
* unsigned int source_length : Length of source (UNUSED). * unsigned int source_length : Length of source (UNUSED).
* unsigned char *dest : Pointer to output data array. * unsigned char *dest : Pointer to output data array.
* int dest_step : Number of pixels to step on in destination. * int dest_step : Number of pixels to step on in
* unsigned int dest_scale : Scale for destination (UNUSED). * destination.
* unsigned int dest_scale : Scale for destination
* (UNUSED).
* unsigned int dest_length : Length of destination. * unsigned int dest_length : Length of destination.
* *
* OUTPUTS : None. * OUTPUTS : None.
@@ -115,18 +113,11 @@ void scale1d_2t1_i
* SPECIAL NOTES : None. * SPECIAL NOTES : None.
* *
****************************************************************************/ ****************************************************************************/
static static void scale1d_2t1_ps(const unsigned char *source, int source_step,
void scale1d_2t1_ps
(
const unsigned char *source,
int source_step,
unsigned int source_scale, unsigned int source_scale,
unsigned int source_length, unsigned int source_length, unsigned char *dest,
unsigned char *dest, int dest_step, unsigned int dest_scale,
int dest_step, unsigned int dest_length) {
unsigned int dest_scale,
unsigned int dest_length
) {
unsigned int i, j; unsigned int i, j;
(void)source_length; (void)source_length;
@@ -144,11 +135,13 @@ void scale1d_2t1_ps
* ROUTINE : scale1d_c * ROUTINE : scale1d_c
* *
* INPUTS : const unsigned char *source : Pointer to data to be scaled. * INPUTS : const unsigned char *source : Pointer to data to be scaled.
* int source_step : Number of pixels to step on in source. * int source_step : Number of pixels to step on in
* source.
* unsigned int source_scale : Scale for source. * unsigned int source_scale : Scale for source.
* unsigned int source_length : Length of source (UNUSED). * unsigned int source_length : Length of source (UNUSED).
* unsigned char *dest : Pointer to output data array. * unsigned char *dest : Pointer to output data array.
* int dest_step : Number of pixels to step on in destination. * int dest_step : Number of pixels to step on in
* destination.
* unsigned int dest_scale : Scale for destination. * unsigned int dest_scale : Scale for destination.
* unsigned int dest_length : Length of destination. * unsigned int dest_length : Length of destination.
* *
@@ -161,18 +154,10 @@ void scale1d_2t1_ps
* SPECIAL NOTES : None. * SPECIAL NOTES : None.
* *
****************************************************************************/ ****************************************************************************/
static static void scale1d_c(const unsigned char *source, int source_step,
void scale1d_c unsigned int source_scale, unsigned int source_length,
( unsigned char *dest, int dest_step,
const unsigned char *source, unsigned int dest_scale, unsigned int dest_length) {
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 i;
unsigned int round_value = dest_scale / 2; unsigned int round_value = dest_scale / 2;
unsigned int left_modifier = dest_scale; unsigned int left_modifier = dest_scale;
@@ -184,10 +169,13 @@ void scale1d_c
/* These asserts are needed if there are boundary issues... */ /* These asserts are needed if there are boundary issues... */
/*assert ( dest_scale > source_scale );*/ /*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) { 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; right_modifier += source_scale;
@@ -206,20 +194,28 @@ void scale1d_c
* *
* ROUTINE : Scale2D * ROUTINE : Scale2D
* *
* INPUTS : const unsigned char *source : Pointer to data to be scaled. * INPUTS : const unsigned char *source : Pointer to data to be
* scaled.
* int source_pitch : Stride of source image. * int source_pitch : Stride of source image.
* unsigned int source_width : Width of input image. * unsigned int source_width : Width of input image.
* unsigned int source_height : Height of input image. * unsigned int source_height : Height of input image.
* unsigned char *dest : Pointer to output data array. * unsigned char *dest : Pointer to output data
* int dest_pitch : Stride of destination image. * array.
* int dest_pitch : Stride of destination
* image.
* unsigned int dest_width : Width of destination image. * unsigned int dest_width : Width of destination image.
* unsigned int dest_height : Height of destination image. * unsigned int dest_height : Height of destination
* image.
* unsigned char *temp_area : Pointer to temp work area. * unsigned char *temp_area : Pointer to temp work area.
* unsigned char temp_area_height : Height of temp work area. * unsigned char temp_area_height : Height of temp work area.
* unsigned int hscale : Horizontal scale factor numerator. * unsigned int hscale : Horizontal scale factor
* unsigned int hratio : Horizontal scale factor denominator. * numerator.
* unsigned int vscale : Vertical scale factor numerator. * unsigned int hratio : Horizontal scale factor
* unsigned int vratio : Vertical scale factor denominator. * denominator.
* unsigned int vscale : Vertical scale factor
* numerator.
* unsigned int vratio : Vertical scale factor
* denominator.
* unsigned int interlaced : Interlace flag. * unsigned int interlaced : Interlace flag.
* *
* OUTPUTS : None. * OUTPUTS : None.
@@ -232,48 +228,38 @@ void scale1d_c
* caching. * caching.
* *
****************************************************************************/ ****************************************************************************/
static static void Scale2D(
void Scale2D
(
/*const*/ /*const*/
unsigned char *source, unsigned char *source, int source_pitch, unsigned int source_width,
int source_pitch, unsigned int source_height, unsigned char *dest, int dest_pitch,
unsigned int source_width, unsigned int dest_width, unsigned int dest_height, unsigned char *temp_area,
unsigned int source_height, unsigned char temp_area_height, unsigned int hscale, unsigned int hratio,
unsigned char *dest, unsigned int vscale, unsigned int vratio, unsigned int interlaced) {
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*/ /*unsigned*/
int i, j, k; int i, j, k;
int bands; int bands;
int dest_band_height; int dest_band_height;
int source_band_height; int source_band_height;
typedef void (*Scale1D)(const unsigned char * source, int source_step, unsigned int source_scale, unsigned int source_length, typedef void (*Scale1D)(const unsigned char *source, int source_step,
unsigned char * dest, int dest_step, unsigned int dest_scale, unsigned int dest_length); 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 Scale1Dv = scale1d_c;
Scale1D Scale1Dh = scale1d_c; Scale1D Scale1Dh = scale1d_c;
void (*horiz_line_scale)(const unsigned char *, unsigned int, unsigned char *, unsigned int) = NULL; void (*horiz_line_scale)(const unsigned char *, unsigned int, unsigned char *,
void (*vert_band_scale)(unsigned char *, unsigned int, unsigned char *, unsigned int, unsigned int) = NULL; unsigned int) = NULL;
void (*vert_band_scale)(unsigned char *, unsigned int, unsigned char *,
unsigned int, unsigned int) = NULL;
int ratio_scalable = 1; int ratio_scalable = 1;
int interpolation = 0; 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; unsigned char *line_src;
source_base = (unsigned char *)source; source_base = (unsigned char *)source;
if (source_pitch < 0) { if (source_pitch < 0) {
@@ -326,11 +312,9 @@ void Scale2D
/* if the content is interlaced, point sampling is used */ /* 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 { } else {
interpolation = 1; interpolation = 1;
/* if the content is progressive, interplo */ /* 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; source_band_height = 2;
@@ -356,31 +340,33 @@ void Scale2D
} }
if (interpolation) { if (interpolation) {
if (source < source_base) if (source < source_base) source = source_base;
source = source_base;
horiz_line_scale(source, source_width, temp_area, dest_width); 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 */ /* scale one band horizontally */
for (i = 0; i < source_band_height; i++) { for (i = 0; i < source_band_height; i++) {
/* Trap case where we could read off the base of the source buffer */ /* Trap case where we could read off the base of the source buffer */
line_src = (unsigned char *)source + i * source_pitch; line_src = (unsigned char *)source + i * source_pitch;
if (line_src < source_base) if (line_src < source_base) line_src = source_base;
line_src = source_base;
horiz_line_scale(line_src, source_width, 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 */ /* 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) 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... */ /* Next band... */
source += (unsigned long)source_band_height * source_pitch; source += (unsigned long)source_band_height * source_pitch;
@@ -390,8 +376,7 @@ void Scale2D
return; return;
} }
if (hscale == 2 && hratio == 1) if (hscale == 2 && hratio == 1) Scale1Dh = scale1d_2t1_ps;
Scale1Dh = scale1d_2t1_ps;
if (vscale == 2 && vratio == 1) { if (vscale == 2 && vratio == 1) {
if (interlaced) if (interlaced)
@@ -403,7 +388,8 @@ void Scale2D
if (source_height == dest_height) { if (source_height == dest_height) {
/* for each band of the image */ /* for each band of the image */
for (k = 0; k < (int)dest_height; k++) { 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; source += source_pitch;
dest += dest_pitch; dest += dest_pitch;
} }
@@ -419,8 +405,10 @@ void Scale2D
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 */ /* first row needs to be done so that we can stay one row ahead for vertical
Scale1Dh(source, 1, hscale, source_width + 1, temp_area, 1, hratio, dest_width); * zoom */
Scale1Dh(source, 1, hscale, source_width + 1, temp_area, 1, hratio,
dest_width);
/* for each band of the image */ /* for each band of the image */
bands = (dest_height + dest_band_height - 1) / dest_band_height; bands = (dest_height + dest_band_height - 1) / dest_band_height;
@@ -433,7 +421,8 @@ void Scale2D
temp_area + i * dest_pitch, 1, hratio, dest_width); temp_area + i * dest_pitch, 1, hratio, dest_width);
} else { /* Duplicate the last row */ } else { /* Duplicate the last row */
/* copy temp_area row 0 over from last row in the past */ /* 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);
} }
} }
@@ -456,14 +445,20 @@ void Scale2D
* *
* ROUTINE : vpx_scale_frame * ROUTINE : vpx_scale_frame
* *
* INPUTS : YV12_BUFFER_CONFIG *src : Pointer to frame to be scaled. * INPUTS : YV12_BUFFER_CONFIG *src : Pointer to frame to be
* YV12_BUFFER_CONFIG *dst : Pointer to buffer to hold scaled frame. * 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 : Pointer to temp work area.
* unsigned char temp_area_height : Height of temp work area. * unsigned char temp_area_height : Height of temp work area.
* unsigned int hscale : Horizontal scale factor numerator. * unsigned int hscale : Horizontal scale factor
* unsigned int hratio : Horizontal scale factor denominator. * numerator.
* unsigned int vscale : Vertical scale factor numerator. * unsigned int hratio : Horizontal scale factor
* unsigned int vratio : Vertical scale factor denominator. * denominator.
* unsigned int vscale : Vertical scale factor
* numerator.
* unsigned int vratio : Vertical scale factor
* denominator.
* unsigned int interlaced : Interlace flag. * unsigned int interlaced : Interlace flag.
* *
* OUTPUTS : None. * OUTPUTS : None.
@@ -476,56 +471,59 @@ void Scale2D
* caching. * caching.
* *
****************************************************************************/ ****************************************************************************/
void vpx_scale_frame void vpx_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
( unsigned char *temp_area, unsigned char temp_height,
YV12_BUFFER_CONFIG *src, unsigned int hscale, unsigned int hratio,
YV12_BUFFER_CONFIG *dst, unsigned int vscale, unsigned int vratio,
unsigned char *temp_area, unsigned int interlaced) {
unsigned char temp_height,
unsigned int hscale,
unsigned int hratio,
unsigned int vscale,
unsigned int vratio,
unsigned int interlaced
) {
int i; int i;
int dw = (hscale - 1 + src->y_width * hratio) / hscale; int dw = (hscale - 1 + src->y_width * hratio) / hscale;
int dh = (vscale - 1 + src->y_height * vratio) / vscale; int dh = (vscale - 1 + src->y_height * vratio) / vscale;
/* call our internal scaling routines!! */ /* call our internal scaling routines!! */
Scale2D((unsigned char *) src->y_buffer, src->y_stride, src->y_width, src->y_height, Scale2D((unsigned char *)src->y_buffer, src->y_stride, src->y_width,
(unsigned char *) dst->y_buffer, dst->y_stride, dw, dh, src->y_height, (unsigned char *)dst->y_buffer, dst->y_stride, dw, dh,
temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
if (dw < (int)dst->y_width) if (dw < (int)dst->y_width)
for (i = 0; i < dh; i++) 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) if (dh < (int)dst->y_height)
for (i = dh - 1; i < (int)dst->y_height; i++) 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, Scale2D((unsigned char *)src->u_buffer, src->uv_stride, src->uv_width,
(unsigned char *) dst->u_buffer, dst->uv_stride, dw / 2, dh / 2, src->uv_height, (unsigned char *)dst->u_buffer, dst->uv_stride,
temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); dw / 2, dh / 2, temp_area, temp_height, hscale, hratio, vscale,
vratio, interlaced);
if (dw / 2 < (int)dst->uv_width) if (dw / 2 < (int)dst->uv_width)
for (i = 0; i < dst->uv_height; i++) 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) if (dh / 2 < (int)dst->uv_height)
for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++) 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, Scale2D((unsigned char *)src->v_buffer, src->uv_stride, src->uv_width,
(unsigned char *) dst->v_buffer, dst->uv_stride, dw / 2, dh / 2, src->uv_height, (unsigned char *)dst->v_buffer, dst->uv_stride,
temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); dw / 2, dh / 2, temp_area, temp_height, hscale, hratio, vscale,
vratio, interlaced);
if (dw / 2 < (int)dst->uv_width) if (dw / 2 < (int)dst->uv_width)
for (i = 0; i < dst->uv_height; i++) 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++) 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);
} }

View File

@@ -24,8 +24,7 @@
#define yv12_align_addr(addr, align) \ #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 int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
if (ybf) { if (ybf) {
// If libvpx is using frame buffer callbacks then buffer_alloc_sz must // If libvpx is using frame buffer callbacks then buffer_alloc_sz must
// not be set. // not be set.
@@ -44,8 +43,8 @@ vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
return 0; return 0;
} }
int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width,
int width, int height, int border) { int height, int border) {
if (ybf) { if (ybf) {
int aligned_width = (width + 15) & ~15; int aligned_width = (width + 15) & ~15;
int aligned_height = (height + 15) & ~15; int aligned_height = (height + 15) & ~15;
@@ -64,16 +63,14 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
ybf->buffer_alloc_sz = frame_size; ybf->buffer_alloc_sz = frame_size;
} }
if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size) if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size) return -1;
return -1;
/* Only support allocating buffers that have a border that's a multiple /* 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 * of 32. The border restriction is required to get 16-byte alignment of
* the start of the chroma rows without introducing an arbitrary gap * the start of the chroma rows without introducing an arbitrary gap
* between planes, which would break the semantics of things like * between planes, which would break the semantics of things like
* vpx_img_set_rect(). */ * vpx_img_set_rect(). */
if (border & 0x1f) if (border & 0x1f) return -3;
return -3;
ybf->y_crop_width = width; ybf->y_crop_width = width;
ybf->y_crop_height = height; ybf->y_crop_height = height;
@@ -95,8 +92,10 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
ybf->frame_size = frame_size; ybf->frame_size = frame_size;
ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border; 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->u_buffer =
ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * uv_stride) + border / 2; 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->alpha_buffer = NULL;
ybf->corrupted = 0; /* assume not currupted by errors */ ybf->corrupted = 0; /* assume not currupted by errors */
@@ -105,8 +104,8 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
return -2; return -2;
} }
int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int width, int height, int border) { int border) {
if (ybf) { if (ybf) {
vp8_yv12_de_alloc_frame_buffer(ybf); vp8_yv12_de_alloc_frame_buffer(ybf);
return vp8_yv12_realloc_frame_buffer(ybf, width, height, border); return vp8_yv12_realloc_frame_buffer(ybf, width, height, border);
@@ -134,31 +133,28 @@ int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
return 0; return 0;
} }
int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int width, int height,
int ss_x, int ss_y, int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth, int use_highbitdepth,
#endif #endif
int border, int border, int byte_alignment,
int byte_alignment,
vpx_codec_frame_buffer_t *fb, vpx_codec_frame_buffer_t *fb,
vpx_get_frame_buffer_cb_fn_t cb, vpx_get_frame_buffer_cb_fn_t cb, void *cb_priv) {
void *cb_priv) {
if (ybf) { if (ybf) {
const int vp9_byte_align = (byte_alignment == 0) ? 1 : byte_alignment; const int vp9_byte_align = (byte_alignment == 0) ? 1 : byte_alignment;
const int aligned_width = (width + 7) & ~7; const int aligned_width = (width + 7) & ~7;
const int aligned_height = (height + 7) & ~7; const int aligned_height = (height + 7) & ~7;
const int y_stride = ((aligned_width + 2 * border) + 31) & ~31; const int y_stride = ((aligned_width + 2 * border) + 31) & ~31;
const uint64_t yplane_size = (aligned_height + 2 * border) * const uint64_t yplane_size =
(uint64_t)y_stride + byte_alignment; (aligned_height + 2 * border) * (uint64_t)y_stride + byte_alignment;
const int uv_width = aligned_width >> ss_x; const int uv_width = aligned_width >> ss_x;
const int uv_height = aligned_height >> ss_y; const int uv_height = aligned_height >> ss_y;
const int uv_stride = y_stride >> ss_x; const int uv_stride = y_stride >> ss_x;
const int uv_border_w = border >> ss_x; const int uv_border_w = border >> ss_x;
const int uv_border_h = border >> ss_y; const int uv_border_h = border >> ss_y;
const uint64_t uvplane_size = (uv_height + 2 * uv_border_h) * const uint64_t uvplane_size =
(uint64_t)uv_stride + byte_alignment; (uv_height + 2 * uv_border_h) * (uint64_t)uv_stride + byte_alignment;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
const uint64_t frame_size = const uint64_t frame_size =
@@ -175,15 +171,12 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
assert(fb != NULL); assert(fb != NULL);
if (external_frame_size != (size_t)external_frame_size) if (external_frame_size != (size_t)external_frame_size) return -1;
return -1;
// Allocation to hold larger frame, or first allocation. // Allocation to hold larger frame, or first allocation.
if (cb(cb_priv, (size_t)external_frame_size, fb) < 0) if (cb(cb_priv, (size_t)external_frame_size, fb) < 0) return -1;
return -1;
if (fb->data == NULL || fb->size < external_frame_size) if (fb->data == NULL || fb->size < external_frame_size) return -1;
return -1;
ybf->buffer_alloc = (uint8_t *)yv12_align_addr(fb->data, 32); ybf->buffer_alloc = (uint8_t *)yv12_align_addr(fb->data, 32);
@@ -200,12 +193,10 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
vpx_free(ybf->buffer_alloc); vpx_free(ybf->buffer_alloc);
ybf->buffer_alloc = NULL; ybf->buffer_alloc = NULL;
if (frame_size != (size_t)frame_size) if (frame_size != (size_t)frame_size) return -1;
return -1;
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, (size_t)frame_size); ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, (size_t)frame_size);
if (!ybf->buffer_alloc) if (!ybf->buffer_alloc) return -1;
return -1;
ybf->buffer_alloc_sz = (int)frame_size; ybf->buffer_alloc_sz = (int)frame_size;
@@ -220,8 +211,7 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
* the start of the chroma rows without introducing an arbitrary gap * the start of the chroma rows without introducing an arbitrary gap
* between planes, which would break the semantics of things like * between planes, which would break the semantics of things like
* vpx_img_set_rect(). */ * vpx_img_set_rect(). */
if (border & 0x1f) if (border & 0x1f) return -3;
return -3;
ybf->y_crop_width = width; ybf->y_crop_width = width;
ybf->y_crop_height = height; ybf->y_crop_height = height;
@@ -256,9 +246,10 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
ybf->u_buffer = (uint8_t *)yv12_align_addr( ybf->u_buffer = (uint8_t *)yv12_align_addr(
buf + yplane_size + (uv_border_h * uv_stride) + uv_border_w, buf + yplane_size + (uv_border_h * uv_stride) + uv_border_w,
vp9_byte_align); vp9_byte_align);
ybf->v_buffer = (uint8_t *)yv12_align_addr( ybf->v_buffer =
buf + yplane_size + uvplane_size + (uv_border_h * uv_stride) + (uint8_t *)yv12_align_addr(buf + yplane_size + uvplane_size +
uv_border_w, vp9_byte_align); (uv_border_h * uv_stride) + uv_border_w,
vp9_byte_align);
ybf->corrupted = 0; /* assume not corrupted by errors */ ybf->corrupted = 0; /* assume not corrupted by errors */
return 0; return 0;
@@ -266,14 +257,12 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
return -2; return -2;
} }
int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int width, int height,
int ss_x, int ss_y, int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth, int use_highbitdepth,
#endif #endif
int border, int border, int byte_alignment) {
int byte_alignment) {
if (ybf) { if (ybf) {
vpx_free_frame_buffer(ybf); vpx_free_frame_buffer(ybf);
return vpx_realloc_frame_buffer(ybf, width, height, ss_x, ss_y, return vpx_realloc_frame_buffer(ybf, width, height, ss_x, ss_y,

View File

@@ -19,9 +19,8 @@
#include "vp9/common/vp9_common.h" #include "vp9/common/vp9_common.h"
#endif #endif
static void extend_plane(uint8_t *const src, int src_stride, static void extend_plane(uint8_t *const src, int src_stride, int width,
int width, int height, int height, int extend_top, int extend_left,
int extend_top, int extend_left,
int extend_bottom, int extend_right) { int extend_bottom, int extend_right) {
int i; int i;
const int linesize = extend_left + extend_right + width; const int linesize = extend_left + extend_right + width;
@@ -61,9 +60,8 @@ static void extend_plane(uint8_t *const src, int src_stride,
} }
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
static void extend_plane_high(uint8_t *const src8, int src_stride, static void extend_plane_high(uint8_t *const src8, int src_stride, int width,
int width, int height, int height, int extend_top, int extend_left,
int extend_top, int extend_left,
int extend_bottom, int extend_right) { int extend_bottom, int extend_right) {
int i; int i;
const int linesize = extend_left + extend_right + width; const int linesize = extend_left + extend_right + width;
@@ -115,44 +113,35 @@ void vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) { if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
extend_plane_high( extend_plane_high(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_buffer, ybf->y_stride, ybf->y_crop_height, ybf->border, ybf->border,
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_height - ybf->y_crop_height,
ybf->border + ybf->y_width - ybf->y_crop_width); ybf->border + ybf->y_width - ybf->y_crop_width);
extend_plane_high( extend_plane_high(ybf->u_buffer, ybf->uv_stride, ybf->uv_crop_width,
ybf->u_buffer, ybf->uv_stride, ybf->uv_crop_height, uv_border, uv_border,
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_height - ybf->uv_crop_height,
uv_border + ybf->uv_width - ybf->uv_crop_width); uv_border + ybf->uv_width - ybf->uv_crop_width);
extend_plane_high( extend_plane_high(ybf->v_buffer, ybf->uv_stride, ybf->uv_crop_width,
ybf->v_buffer, ybf->uv_stride, ybf->uv_crop_height, uv_border, uv_border,
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_height - ybf->uv_crop_height,
uv_border + ybf->uv_width - ybf->uv_crop_width); uv_border + ybf->uv_width - ybf->uv_crop_width);
return; return;
} }
#endif #endif
extend_plane(ybf->y_buffer, ybf->y_stride, extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_crop_width, ybf->y_crop_height, ybf->y_crop_height, ybf->border, ybf->border,
ybf->border, ybf->border,
ybf->border + ybf->y_height - ybf->y_crop_height, ybf->border + ybf->y_height - ybf->y_crop_height,
ybf->border + ybf->y_width - ybf->y_crop_width); ybf->border + ybf->y_width - ybf->y_crop_width);
extend_plane(ybf->u_buffer, ybf->uv_stride, extend_plane(ybf->u_buffer, ybf->uv_stride, ybf->uv_crop_width,
ybf->uv_crop_width, ybf->uv_crop_height, ybf->uv_crop_height, uv_border, uv_border,
uv_border, uv_border,
uv_border + ybf->uv_height - ybf->uv_crop_height, uv_border + ybf->uv_height - ybf->uv_crop_height,
uv_border + ybf->uv_width - ybf->uv_crop_width); uv_border + ybf->uv_width - ybf->uv_crop_width);
extend_plane(ybf->v_buffer, ybf->uv_stride, extend_plane(ybf->v_buffer, ybf->uv_stride, ybf->uv_crop_width,
ybf->uv_crop_width, ybf->uv_crop_height, ybf->uv_crop_height, uv_border, uv_border,
uv_border, uv_border,
uv_border + ybf->uv_height - ybf->uv_crop_height, uv_border + ybf->uv_height - ybf->uv_crop_height,
uv_border + ybf->uv_width - ybf->uv_crop_width); uv_border + ybf->uv_width - ybf->uv_crop_width);
} }
@@ -175,29 +164,25 @@ static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) { if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
extend_plane_high(ybf->y_buffer, ybf->y_stride, extend_plane_high(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_crop_width, ybf->y_crop_height, ybf->y_crop_height, ext_size, ext_size,
ext_size, ext_size,
ext_size + ybf->y_height - ybf->y_crop_height, ext_size + ybf->y_height - ybf->y_crop_height,
ext_size + ybf->y_width - ybf->y_crop_width); ext_size + ybf->y_width - ybf->y_crop_width);
extend_plane_high(ybf->u_buffer, ybf->uv_stride, extend_plane_high(ybf->u_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb,
c_w, c_h, c_et, c_el, c_eb, c_er); c_er);
extend_plane_high(ybf->v_buffer, ybf->uv_stride, extend_plane_high(ybf->v_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb,
c_w, c_h, c_et, c_el, c_eb, c_er); c_er);
return; return;
} }
#endif #endif
extend_plane(ybf->y_buffer, ybf->y_stride, extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_crop_width, ybf->y_crop_height, ybf->y_crop_height, ext_size, ext_size,
ext_size, ext_size,
ext_size + ybf->y_height - ybf->y_crop_height, ext_size + ybf->y_height - ybf->y_crop_height,
ext_size + ybf->y_width - ybf->y_crop_width); ext_size + ybf->y_width - ybf->y_crop_width);
extend_plane(ybf->u_buffer, ybf->uv_stride, extend_plane(ybf->u_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
c_w, c_h, c_et, c_el, c_eb, c_er);
extend_plane(ybf->v_buffer, ybf->uv_stride, extend_plane(ybf->v_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
c_w, c_h, c_et, c_el, c_eb, c_er);
} }
void vpx_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) { void vpx_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
@@ -205,8 +190,9 @@ void vpx_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
} }
void vpx_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf) { void vpx_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf) {
const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS) ? const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS)
VP9INNERBORDERINPIXELS : ybf->border; ? VP9INNERBORDERINPIXELS
: ybf->border;
extend_frame(ybf, inner_bw); extend_frame(ybf, inner_bw);
} }

View File

@@ -16,9 +16,8 @@
#include "vpx_scale/vpx_scale.h" #include "vpx_scale/vpx_scale.h"
#if HAVE_DSPR2 #if HAVE_DSPR2
static void extend_plane(uint8_t *const src, int src_stride, static void extend_plane(uint8_t *const src, int src_stride, int width,
int width, int height, int height, int extend_top, int extend_left,
int extend_top, int extend_left,
int extend_bottom, int extend_right) { int extend_bottom, int extend_right) {
int i, j; int i, j;
uint8_t *left_src, *right_src; uint8_t *left_src, *right_src;
@@ -47,8 +46,7 @@ static void extend_plane(uint8_t *const src, int src_stride,
"replv.qb %[right_pix], %[right_pix] \n\t" "replv.qb %[right_pix], %[right_pix] \n\t"
: [left_pix] "=&r"(left_pix), [right_pix] "=&r"(right_pix) : [left_pix] "=&r"(left_pix), [right_pix] "=&r"(right_pix)
: [left_src] "r" (left_src), [right_src] "r" (right_src) : [left_src] "r"(left_src), [right_src] "r"(right_src));
);
for (j = extend_left / 4; j--;) { for (j = extend_left / 4; j--;) {
__asm__ __volatile__( __asm__ __volatile__(
@@ -57,8 +55,7 @@ static void extend_plane(uint8_t *const src, int src_stride,
: :
: [left_dst] "r"(left_dst), [left_pix] "r"(left_pix), : [left_dst] "r"(left_dst), [left_pix] "r"(left_pix),
[right_dst] "r" (right_dst), [right_pix] "r" (right_pix) [right_dst] "r"(right_dst), [right_pix] "r"(right_pix));
);
left_dst += 4; left_dst += 4;
right_dst += 4; right_dst += 4;
@@ -71,8 +68,7 @@ static void extend_plane(uint8_t *const src, int src_stride,
: :
: [left_dst] "r"(left_dst), [left_pix] "r"(left_pix), : [left_dst] "r"(left_dst), [left_pix] "r"(left_pix),
[right_dst] "r" (right_dst), [right_pix] "r" (right_pix) [right_dst] "r"(right_dst), [right_pix] "r"(right_pix));
);
left_dst += 1; left_dst += 1;
right_dst += 1; right_dst += 1;
@@ -119,17 +115,14 @@ static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
assert(ybf->y_height - ybf->y_crop_height >= 0); assert(ybf->y_height - ybf->y_crop_height >= 0);
assert(ybf->y_width - ybf->y_crop_width >= 0); assert(ybf->y_width - ybf->y_crop_width >= 0);
extend_plane(ybf->y_buffer, ybf->y_stride, extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_crop_width, ybf->y_crop_height, ybf->y_crop_height, ext_size, ext_size,
ext_size, ext_size,
ext_size + ybf->y_height - ybf->y_crop_height, ext_size + ybf->y_height - ybf->y_crop_height,
ext_size + ybf->y_width - ybf->y_crop_width); ext_size + ybf->y_width - ybf->y_crop_width);
extend_plane(ybf->u_buffer, ybf->uv_stride, extend_plane(ybf->u_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
c_w, c_h, c_et, c_el, c_eb, c_er);
extend_plane(ybf->v_buffer, ybf->uv_stride, extend_plane(ybf->v_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
c_w, c_h, c_et, c_el, c_eb, c_er);
} }
void vpx_extend_frame_borders_dspr2(YV12_BUFFER_CONFIG *ybf) { void vpx_extend_frame_borders_dspr2(YV12_BUFFER_CONFIG *ybf) {
@@ -137,8 +130,9 @@ void vpx_extend_frame_borders_dspr2(YV12_BUFFER_CONFIG *ybf) {
} }
void vpx_extend_frame_inner_borders_dspr2(YV12_BUFFER_CONFIG *ybf) { void vpx_extend_frame_inner_borders_dspr2(YV12_BUFFER_CONFIG *ybf) {
const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS) ? const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS)
VP9INNERBORDERINPIXELS : ybf->border; ? VP9INNERBORDERINPIXELS
: ybf->border;
extend_frame(ybf, inner_bw); extend_frame(ybf, inner_bw);
} }
#endif #endif

View File

@@ -8,20 +8,15 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef VPX_SCALE_VPX_SCALE_H_ #ifndef VPX_SCALE_VPX_SCALE_H_
#define VPX_SCALE_VPX_SCALE_H_ #define VPX_SCALE_VPX_SCALE_H_
#include "vpx_scale/yv12config.h" #include "vpx_scale/yv12config.h"
extern void vpx_scale_frame(YV12_BUFFER_CONFIG *src, extern void vpx_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
YV12_BUFFER_CONFIG *dst, unsigned char *temp_area, unsigned char temp_height,
unsigned char *temp_area, unsigned int hscale, unsigned int hratio,
unsigned char temp_height, unsigned int vscale, unsigned int vratio,
unsigned int hscale,
unsigned int hratio,
unsigned int vscale,
unsigned int vratio,
unsigned int interlaced); unsigned int interlaced);
#endif // VPX_SCALE_VPX_SCALE_H_ #endif // VPX_SCALE_VPX_SCALE_H_

View File

@@ -12,7 +12,4 @@
#include "./vpx_scale_rtcd.h" #include "./vpx_scale_rtcd.h"
#include "vpx_ports/vpx_once.h" #include "vpx_ports/vpx_once.h"
void vpx_scale_rtcd() void vpx_scale_rtcd() { once(setup_rtcd_internal); }
{
once(setup_rtcd_internal);
}

View File

@@ -66,14 +66,14 @@ typedef struct yv12_buffer_config {
#define YV12_FLAG_HIGHBITDEPTH 8 #define YV12_FLAG_HIGHBITDEPTH 8
int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int width, int height, int border); int border);
int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width,
int width, int height, int border); int height, int border);
int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf); int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf);
int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int width, int height, int ss_x, int ss_y, int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth, int use_highbitdepth,
#endif #endif
@@ -86,16 +86,14 @@ int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
// to decode the current frame. If cb is NULL, libvpx will allocate memory // 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 // internally to decode the current frame. Returns 0 on success. Returns < 0
// on failure. // on failure.
int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int width, int height, int ss_x, int ss_y, int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth, int use_highbitdepth,
#endif #endif
int border, int border, int byte_alignment,
int byte_alignment,
vpx_codec_frame_buffer_t *fb, vpx_codec_frame_buffer_t *fb,
vpx_get_frame_buffer_cb_fn_t cb, vpx_get_frame_buffer_cb_fn_t cb, void *cb_priv);
void *cb_priv);
int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf); int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf);
#ifdef __cplusplus #ifdef __cplusplus