Merge "vpx_scale: sync from experimental"

This commit is contained in:
John Koleszar 2012-11-02 09:16:41 -07:00 committed by Gerrit Code Review
commit 3b783d2217
12 changed files with 2640 additions and 2822 deletions

View File

@ -8,14 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vpx_rtcd.h"
#include "./vpx_rtcd.h"
extern void vp8_yv12_copy_frame_func_neon(struct yv12_buffer_config *src_ybc,
struct yv12_buffer_config *dst_ybc);
void vp8_yv12_copy_frame_neon(struct yv12_buffer_config *src_ybc,
struct yv12_buffer_config *dst_ybc)
{
struct yv12_buffer_config *dst_ybc) {
vp8_yv12_copy_frame_func_neon(src_ybc, dst_ybc);
vp8_yv12_extend_frame_borders_neon(dst_ybc);

View File

@ -46,8 +46,7 @@ static float a = -0.6;
// 3 2
// C0 = a*t - a*t
//
static short c0_fixed(unsigned int t)
{
static short c0_fixed(unsigned int t) {
// put t in Q16 notation
unsigned short v1, v2;
@ -67,8 +66,7 @@ static short c0_fixed(unsigned int t)
// 2 3
// C1 = a*t + (3-2*a)*t - (2-a)*t
//
static short c1_fixed(unsigned int t)
{
static short c1_fixed(unsigned int t) {
unsigned short v1, v2, v3;
unsigned short two, three;
@ -96,8 +94,7 @@ static short c1_fixed(unsigned int t)
// 2 3
// C2 = 1 - (3-a)*t + (2-a)*t
//
static short c2_fixed(unsigned int t)
{
static short c2_fixed(unsigned int t) {
unsigned short v1, v2, v3;
unsigned short two, three;
@ -124,8 +121,7 @@ static short c2_fixed(unsigned int t)
// 2 3
// C3 = a*t - 2*a*t + a*t
//
static short c3_fixed(unsigned int t)
{
static short c3_fixed(unsigned int t) {
int v1, v2, v3;
// Q16
@ -148,47 +144,41 @@ static short c3_fixed(unsigned int t)
// 3 2
// C0 = -a*t + a*t
//
float C0(float t)
{
float C0(float t) {
return -a * t * t * t + a * t * t;
}
// 2 3
// C1 = -a*t + (2*a+3)*t - (a+2)*t
//
float C1(float t)
{
float C1(float t) {
return -(a + 2.0f) * t * t * t + (2.0f * a + 3.0f) * t * t - a * t;
}
// 2 3
// C2 = 1 - (a+3)*t + (a+2)*t
//
float C2(float t)
{
float C2(float t) {
return (a + 2.0f) * t * t * t - (a + 3.0f) * t * t + 1.0f;
}
// 2 3
// C3 = a*t - 2*a*t + a*t
//
float C3(float t)
{
float C3(float t) {
return a * t * t * t - 2.0f * a * t * t + a * t;
}
#endif
#if 0
int compare_real_fixed()
{
int compare_real_fixed() {
int i, errors = 0;
float mult = 1.0 / 10000.0;
unsigned int fixed_mult = mult * 4294967296;// 65536;
unsigned int phase_offset_int;
float phase_offset_real;
for (i = 0; i < 10000; i++)
{
for (i = 0; i < 10000; i++) {
int fixed0, fixed1, fixed2, fixed3, fixed_total;
int real0, real1, real2, real3, real_total;
@ -236,8 +226,7 @@ int compare_real_fixed()
// Find greatest common denominator between two integers. Method used here is
// slow compared to Euclid's algorithm, but does not require any division.
int gcd(int a, int b)
{
int gcd(int a, int b) {
// Problem with this algorithm is that if a or b = 0 this function
// will never exit. Don't want to return 0 because any computation
// that was based on a common denoninator and tried to reduce by
@ -246,12 +235,10 @@ int gcd(int a, int b)
if (a <= 0 || b <= 0)
return 1;
while (a != b)
{
while (a != b) {
if (b > a)
b = b - a;
else
{
else {
int tmp = a;// swap large and
a = b; // small
b = tmp;
@ -261,16 +248,13 @@ int gcd(int a, int b)
return b;
}
void bicubic_coefficient_init()
{
void bicubic_coefficient_init() {
vpx_memset(&g_b_scaler, 0, sizeof(BICUBIC_SCALER_STRUCT));
g_first_time = 0;
}
void bicubic_coefficient_destroy()
{
if (!g_first_time)
{
void bicubic_coefficient_destroy() {
if (!g_first_time) {
vpx_free(g_b_scaler.l_w);
vpx_free(g_b_scaler.l_h);
@ -292,8 +276,7 @@ void bicubic_coefficient_destroy()
// regimes the phase offsets will be different. There are 4 coefficents
// for each point, two on each side. The layout is that there are the
// 4 coefficents for each phase in the array and then the next phase.
int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int out_height)
{
int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int out_height) {
int i;
#ifdef FIXED_POINT
int phase_offset_int;
@ -374,8 +357,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
product_val = 0;
for (i = 0; i < g_b_scaler.nw; i++)
{
for (i = 0; i < g_b_scaler.nw; i++) {
if (product_val > g_b_scaler.nw)
product_val -= g_b_scaler.nw;
@ -394,8 +376,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
product_val = 0;
for (i = 0; i < g_b_scaler.nh; i++)
{
for (i = 0; i < g_b_scaler.nh; i++) {
if (product_val > g_b_scaler.nh)
product_val -= g_b_scaler.nh;
@ -413,8 +394,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
product_val = 0;
for (i = 0; i < g_b_scaler.nh_uv; i++)
{
for (i = 0; i < g_b_scaler.nh_uv; i++) {
if (product_val > g_b_scaler.nh_uv)
product_val -= g_b_scaler.nh_uv;
@ -430,8 +410,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
#else
for (i = 0; i < g_nw; i++)
{
for (i = 0; i < g_nw; i++) {
phase_offset = (float)((i * d_w) % g_nw) / (float)g_nw;
g_c_w[i * 4] = (C3(phase_offset) * 4096.0);
g_c_w[i * 4 + 1] = (C2(phase_offset) * 4096.0);
@ -439,8 +418,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
g_c_w[i * 4 + 3] = (C0(phase_offset) * 4096.0);
}
for (i = 0; i < g_nh; i++)
{
for (i = 0; i < g_nh; i++) {
phase_offset = (float)((i * d_h) % g_nh) / (float)g_nh;
g_c_h[i * 4] = (C0(phase_offset) * 4096.0);
g_c_h[i * 4 + 1] = (C1(phase_offset) * 4096.0);
@ -448,8 +426,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
g_c_h[i * 4 + 3] = (C3(phase_offset) * 4096.0);
}
for (i = 0; i < g_nh_uv; i++)
{
for (i = 0; i < g_nh_uv; i++) {
phase_offset = (float)((i * d_h_uv) % g_nh_uv) / (float)g_nh_uv;
g_c_h_uv[i * 4] = (C0(phase_offset) * 4096.0);
g_c_h_uv[i * 4 + 1] = (C1(phase_offset) * 4096.0);
@ -463,8 +440,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
// This doesn't require floating point math, but it does require
// a division and because hardware division is not present that
// is a call.
for (i = 0; i < out_width; i++)
{
for (i = 0; i < out_width; i++) {
g_b_scaler.l_w[i] = (i * d_w) / g_b_scaler.nw;
if ((g_b_scaler.l_w[i] + 2) <= in_width)
@ -472,8 +448,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
}
for (i = 0; i < out_height + 1; i++)
{
for (i = 0; i < out_height + 1; i++) {
g_b_scaler.l_h[i] = (i * d_h) / g_b_scaler.nh;
g_b_scaler.l_h_uv[i] = (i * d_h_uv) / g_b_scaler.nh_uv;
}
@ -483,8 +458,7 @@ int bicubic_coefficient_setup(int in_width, int in_height, int out_width, int ou
int bicubic_scale(int in_width, int in_height, int in_stride,
int out_width, int out_height, int out_stride,
unsigned char *input_image, unsigned char *output_image)
{
unsigned char *input_image, unsigned char *output_image) {
short *RESTRICT l_w, * RESTRICT l_h;
short *RESTRICT c_w, * RESTRICT c_h;
unsigned char *RESTRICT ip, * RESTRICT op;
@ -503,8 +477,7 @@ int bicubic_scale(int in_width, int in_height, int in_stride,
phase_offset_h = 0;
for (h = 0; h < out_height; h++)
{
for (h = 0; h < out_height; h++) {
// select the row to work on
lh = l_h[h];
ip = input_image + (in_stride * lh);
@ -515,12 +488,10 @@ int bicubic_scale(int in_width, int in_height, int in_stride,
// So instead point the temporary buffer to the input.
// Also handle the boundry condition of not being able to
// filter that last lines.
if (phase_offset_h && (lh < in_height - 2))
{
if (phase_offset_h && (lh < in_height - 2)) {
hbuf = g_b_scaler.hbuf;
for (w = 0; w < in_width; w++)
{
for (w = 0; w < in_width; w++) {
temp_sum = c_h[phase_offset_h * 4 + 3] * ip[w - in_stride];
temp_sum += c_h[phase_offset_h * 4 + 2] * ip[w];
temp_sum += c_h[phase_offset_h * 4 + 1] * ip[w + in_stride];
@ -528,8 +499,7 @@ int bicubic_scale(int in_width, int in_height, int in_stride,
hbuf[w] = temp_sum >> 12;
}
}
else
} else
hbuf = ip;
// increase the phase offset for the next time around.
@ -540,8 +510,7 @@ int bicubic_scale(int in_width, int in_height, int in_stride,
// output buffer
phase_offset_w = 0;
for (w = 0; w < out_width; w++)
{
for (w = 0; w < out_width; w++) {
// get the index to use to expand the image
lw = l_w[w];
@ -570,15 +539,13 @@ int bicubic_scale(int in_width, int in_height, int in_stride,
return 0;
}
void bicubic_scale_frame_reset()
{
void bicubic_scale_frame_reset() {
g_b_scaler.out_width = 0;
g_b_scaler.out_height = 0;
}
void bicubic_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
int new_width, int new_height)
{
int new_width, int new_height) {
dst->y_width = new_width;
dst->y_height = new_height;

View File

@ -34,14 +34,10 @@
* SPECIAL NOTES : None.
*
****************************************************************************/
void vp8_horizontal_line_4_5_scale_c
(
const unsigned char *source,
void vp8_horizontal_line_4_5_scale_c(const unsigned char *source,
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
unsigned int dest_width) {
unsigned i;
unsigned int a, b, c;
unsigned char *des = dest;
@ -49,8 +45,7 @@ void vp8_horizontal_line_4_5_scale_c
(void) dest_width;
for (i = 0; i < source_width - 4; i += 4)
{
for (i = 0; i < source_width - 4; i += 4) {
a = src[0];
b = src[1];
des [0] = (unsigned char) a;
@ -97,14 +92,14 @@ void vp8_horizontal_line_4_5_scale_c
* the current band.
*
****************************************************************************/
void vp8_vertical_band_4_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_4_5_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c, d;
unsigned char *des = dest;
for (i = 0; i < dest_width; i++)
{
for (i = 0; i < dest_width; i++) {
a = des [0];
b = des [dest_pitch];
@ -144,14 +139,14 @@ void vp8_vertical_band_4_5_scale_c(unsigned char *dest, unsigned int dest_pitch,
* last band.
*
****************************************************************************/
void vp8_last_vertical_band_4_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_last_vertical_band_4_5_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c, d;
unsigned char *des = dest;
for (i = 0; i < dest_width; ++i)
{
for (i = 0; i < dest_width; ++i) {
a = des[0];
b = des[dest_pitch];
@ -190,14 +185,10 @@ void vp8_last_vertical_band_4_5_scale_c(unsigned char *dest, unsigned int dest_p
*
*
****************************************************************************/
void vp8_horizontal_line_2_3_scale_c
(
const unsigned char *source,
void vp8_horizontal_line_2_3_scale_c(const unsigned char *source,
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c;
unsigned char *des = dest;
@ -205,8 +196,7 @@ void vp8_horizontal_line_2_3_scale_c
(void) dest_width;
for (i = 0; i < source_width - 2; i += 2)
{
for (i = 0; i < source_width - 2; i += 2) {
a = src[0];
b = src[1];
c = src[2];
@ -246,14 +236,14 @@ void vp8_horizontal_line_2_3_scale_c
* the current band.
*
****************************************************************************/
void vp8_vertical_band_2_3_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_2_3_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c;
unsigned char *des = dest;
for (i = 0; i < dest_width; i++)
{
for (i = 0; i < dest_width; i++) {
a = des [0];
b = des [dest_pitch];
c = des[dest_pitch * 3];
@ -284,14 +274,14 @@ void vp8_vertical_band_2_3_scale_c(unsigned char *dest, unsigned int dest_pitch,
* last band.
*
****************************************************************************/
void vp8_last_vertical_band_2_3_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_last_vertical_band_2_3_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b;
unsigned char *des = dest;
for (i = 0; i < dest_width; ++i)
{
for (i = 0; i < dest_width; ++i) {
a = des [0];
b = des [dest_pitch];
@ -321,14 +311,10 @@ void vp8_last_vertical_band_2_3_scale_c(unsigned char *dest, unsigned int dest_p
*
*
****************************************************************************/
void vp8_horizontal_line_3_5_scale_c
(
const unsigned char *source,
void vp8_horizontal_line_3_5_scale_c(const unsigned char *source,
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c;
unsigned char *des = dest;
@ -336,8 +322,7 @@ void vp8_horizontal_line_3_5_scale_c
(void) dest_width;
for (i = 0; i < source_width - 3; i += 3)
{
for (i = 0; i < source_width - 3; i += 3) {
a = src[0];
b = src[1];
des [0] = (unsigned char)(a);
@ -385,14 +370,14 @@ void vp8_horizontal_line_3_5_scale_c
* the current band.
*
****************************************************************************/
void vp8_vertical_band_3_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_3_5_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c;
unsigned char *des = dest;
for (i = 0; i < dest_width; i++)
{
for (i = 0; i < dest_width; i++) {
a = des [0];
b = des [dest_pitch];
des [dest_pitch] = (unsigned char)((a * 102 + 154 * b + 128) >> 8);
@ -429,14 +414,14 @@ void vp8_vertical_band_3_5_scale_c(unsigned char *dest, unsigned int dest_pitch,
* last band.
*
****************************************************************************/
void vp8_last_vertical_band_3_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_last_vertical_band_3_5_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c;
unsigned char *des = dest;
for (i = 0; i < dest_width; ++i)
{
for (i = 0; i < dest_width; ++i) {
a = des [0];
b = des [dest_pitch];
@ -473,14 +458,10 @@ void vp8_last_vertical_band_3_5_scale_c(unsigned char *dest, unsigned int dest_p
*
*
****************************************************************************/
void vp8_horizontal_line_3_4_scale_c
(
const unsigned char *source,
void vp8_horizontal_line_3_4_scale_c(const unsigned char *source,
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c;
unsigned char *des = dest;
@ -488,8 +469,7 @@ void vp8_horizontal_line_3_4_scale_c
(void) dest_width;
for (i = 0; i < source_width - 3; i += 3)
{
for (i = 0; i < source_width - 3; i += 3) {
a = src[0];
b = src[1];
des [0] = (unsigned char)(a);
@ -534,14 +514,14 @@ void vp8_horizontal_line_3_4_scale_c
* the current band.
*
****************************************************************************/
void vp8_vertical_band_3_4_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_3_4_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c;
unsigned char *des = dest;
for (i = 0; i < dest_width; i++)
{
for (i = 0; i < dest_width; i++) {
a = des [0];
b = des [dest_pitch];
des [dest_pitch] = (unsigned char)((a * 64 + b * 192 + 128) >> 8);
@ -577,14 +557,14 @@ void vp8_vertical_band_3_4_scale_c(unsigned char *dest, unsigned int dest_pitch,
* last band.
*
****************************************************************************/
void vp8_last_vertical_band_3_4_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_last_vertical_band_3_4_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c;
unsigned char *des = dest;
for (i = 0; i < dest_width; ++i)
{
for (i = 0; i < dest_width; ++i) {
a = des [0];
b = des [dest_pitch];
@ -619,14 +599,10 @@ void vp8_last_vertical_band_3_4_scale_c(unsigned char *dest, unsigned int dest_p
* SPECIAL NOTES : None.
*
****************************************************************************/
void vp8_horizontal_line_1_2_scale_c
(
const unsigned char *source,
void vp8_horizontal_line_1_2_scale_c(const unsigned char *source,
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
unsigned int dest_width) {
unsigned int i;
unsigned int a, b;
unsigned char *des = dest;
@ -634,8 +610,7 @@ void vp8_horizontal_line_1_2_scale_c
(void) dest_width;
for (i = 0; i < source_width - 1; i += 1)
{
for (i = 0; i < source_width - 1; i += 1) {
a = src[0];
b = src[1];
des [0] = (unsigned char)(a);
@ -668,14 +643,14 @@ void vp8_horizontal_line_1_2_scale_c
* the current band.
*
****************************************************************************/
void vp8_vertical_band_1_2_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_1_2_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b;
unsigned char *des = dest;
for (i = 0; i < dest_width; i++)
{
for (i = 0; i < dest_width; i++) {
a = des [0];
b = des [dest_pitch * 2];
@ -705,13 +680,13 @@ void vp8_vertical_band_1_2_scale_c(unsigned char *dest, unsigned int dest_pitch,
* last band.
*
****************************************************************************/
void vp8_last_vertical_band_1_2_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_last_vertical_band_1_2_scale_c(unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned char *des = dest;
for (i = 0; i < dest_width; ++i)
{
for (i = 0; i < dest_width; ++i) {
des[dest_pitch] = des[0];
des++;
}
@ -740,14 +715,10 @@ void vp8_last_vertical_band_1_2_scale_c(unsigned char *dest, unsigned int dest_p
* SPECIAL NOTES : None.
*
****************************************************************************/
void vp8_horizontal_line_5_4_scale_c
(
const unsigned char *source,
void vp8_horizontal_line_5_4_scale_c(const unsigned char *source,
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
unsigned int dest_width) {
unsigned i;
unsigned int a, b, c, d, e;
unsigned char *des = dest;
@ -755,8 +726,7 @@ void vp8_horizontal_line_5_4_scale_c
(void) dest_width;
for (i = 0; i < source_width; i += 5)
{
for (i = 0; i < source_width; i += 5) {
a = src[0];
b = src[1];
c = src[2];
@ -776,15 +746,17 @@ void vp8_horizontal_line_5_4_scale_c
void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_5_4_scale_c(unsigned char *source,
unsigned int src_pitch,
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c, d, e;
unsigned char *des = dest;
unsigned char *src = source;
for (i = 0; i < dest_width; i++)
{
for (i = 0; i < dest_width; i++) {
a = src[0 * src_pitch];
b = src[1 * src_pitch];
@ -824,14 +796,10 @@ void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch
*
*
****************************************************************************/
void vp8_horizontal_line_5_3_scale_c
(
const unsigned char *source,
void vp8_horizontal_line_5_3_scale_c(const unsigned char *source,
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c, d, e;
unsigned char *des = dest;
@ -839,8 +807,7 @@ void vp8_horizontal_line_5_3_scale_c
(void) dest_width;
for (i = 0; i < source_width; i += 5)
{
for (i = 0; i < source_width; i += 5) {
a = src[0];
b = src[1];
c = src[2];
@ -857,15 +824,17 @@ void vp8_horizontal_line_5_3_scale_c
}
void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_5_3_scale_c(unsigned char *source,
unsigned int src_pitch,
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
unsigned int i;
unsigned int a, b, c, d, e;
unsigned char *des = dest;
unsigned char *src = source;
for (i = 0; i < dest_width; i++)
{
for (i = 0; i < dest_width; i++) {
a = src[0 * src_pitch];
b = src[1 * src_pitch];
@ -902,14 +871,10 @@ void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch
* SPECIAL NOTES : None.
*
****************************************************************************/
void vp8_horizontal_line_2_1_scale_c
(
const unsigned char *source,
void vp8_horizontal_line_2_1_scale_c(const unsigned char *source,
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
unsigned int dest_width) {
unsigned int i;
unsigned int a;
unsigned char *des = dest;
@ -917,34 +882,36 @@ void vp8_horizontal_line_2_1_scale_c
(void) dest_width;
for (i = 0; i < source_width; i += 2)
{
for (i = 0; i < source_width; i += 2) {
a = src[0];
des [0] = (unsigned char)(a);
src += 2;
des += 1;
}
}
void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_2_1_scale_c(unsigned char *source,
unsigned int src_pitch,
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
(void) dest_pitch;
(void) src_pitch;
vpx_memcpy(dest, source, dest_width);
}
void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vp8_vertical_band_2_1_scale_i_c(unsigned char *source,
unsigned int src_pitch,
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width) {
int i;
int temp;
int width = dest_width;
(void) dest_pitch;
for (i = 0; i < width; i++)
{
for (i = 0; i < width; i++) {
temp = 8;
temp += source[i - (int)src_pitch] * 3;
temp += source[i] * 10;
@ -952,5 +919,4 @@ void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pit
temp >>= 4;
dest[i] = (unsigned char)(temp);
}
}

View File

@ -20,13 +20,12 @@
/****************************************************************************
* Header Files
****************************************************************************/
#include "vpx_rtcd.h"
#include "./vpx_rtcd.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_scale/yv12config.h"
#include "vpx_scale/scale_mode.h"
typedef struct
{
typedef struct {
int expanded_frame_width;
int expanded_frame_height;
@ -64,8 +63,7 @@ void horizontal_line_copy(
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
) {
(void) dest_width;
duck_memcpy(dest, source, source_width);
@ -93,8 +91,7 @@ void null_scale(
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width
)
{
) {
(void) dest;
(void) dest_pitch;
(void) dest_width;
@ -135,8 +132,7 @@ void scale1d_2t1_i
int dest_step,
unsigned int dest_scale,
unsigned int dest_length
)
{
) {
unsigned int i, j;
unsigned int temp;
int source_pitch = source_step;
@ -147,8 +143,7 @@ void scale1d_2t1_i
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];
@ -191,8 +186,7 @@ void scale1d_2t1_ps
int dest_step,
unsigned int dest_scale,
unsigned int dest_length
)
{
) {
unsigned int i, j;
(void) source_length;
@ -238,8 +232,7 @@ void scale1d_c
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;
@ -253,14 +246,12 @@ void scale1d_c
/*assert ( dest_scale > 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);
right_modifier += source_scale;
while (right_modifier > dest_scale)
{
while (right_modifier > dest_scale) {
right_modifier -= dest_scale;
source += source_step;
left_pixel = *source;
@ -320,8 +311,7 @@ void Scale2D
unsigned int vscale,
unsigned int vratio,
unsigned int interlaced
)
{
) {
/*unsigned*/
int i, j, k;
int bands;
@ -346,8 +336,7 @@ void Scale2D
source_base = (unsigned char *)source;
if (source_pitch < 0)
{
if (source_pitch < 0) {
int offset;
offset = (source_height - 1);
@ -357,8 +346,7 @@ void Scale2D
}
/* find out the ratio for each direction */
switch (hratio * 10 / hscale)
{
switch (hratio * 10 / hscale) {
case 8:
/* 4-5 Scale in Width direction */
horiz_line_scale = vp8_horizontal_line_5_4_scale;
@ -378,8 +366,7 @@ void Scale2D
break;
}
switch (vratio * 10 / vscale)
{
switch (vratio * 10 / vscale) {
case 8:
/* 4-5 Scale in vertical direction */
vert_band_scale = vp8_vertical_band_5_4_scale;
@ -395,13 +382,10 @@ void Scale2D
case 5:
/* 1-2 Scale in vertical direction */
if (interlaced)
{
if (interlaced) {
/* if the content is interlaced, point sampling is used */
vert_band_scale = vp8_vertical_band_2_1_scale;
}
else
{
} else {
interpolation = 1;
/* if the content is progressive, interplo */
@ -419,13 +403,10 @@ void Scale2D
break;
}
if (ratio_scalable)
{
if (source_height == dest_height)
{
if (ratio_scalable) {
if (source_height == dest_height) {
/* for each band of the image */
for (k = 0; k < (int)dest_height; k++)
{
for (k = 0; k < (int)dest_height; k++) {
horiz_line_scale(source, source_width, dest, dest_width);
source += source_pitch;
dest += dest_pitch;
@ -434,19 +415,16 @@ void Scale2D
return;
}
if (interpolation)
{
if (interpolation) {
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++)
{
for (i = 0; i < source_band_height; i++) {
/* Trap case where we could read off the base of the source buffer */
line_src = (unsigned char *)source + i * source_pitch;
@ -475,19 +453,16 @@ void Scale2D
if (hscale == 2 && hratio == 1)
Scale1Dh = scale1d_2t1_ps;
if (vscale == 2 && vratio == 1)
{
if (vscale == 2 && vratio == 1) {
if (interlaced)
Scale1Dv = scale1d_2t1_ps;
else
Scale1Dv = scale1d_2t1_i;
}
if (source_height == dest_height)
{
if (source_height == dest_height) {
/* 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);
source += source_pitch;
dest += dest_pitch;
@ -496,13 +471,10 @@ void Scale2D
return;
}
if (dest_height > source_height)
{
if (dest_height > source_height) {
dest_band_height = temp_area_height - 1;
source_band_height = dest_band_height * source_height / dest_height;
}
else
{
} else {
source_band_height = temp_area_height - 1;
dest_band_height = source_band_height * vratio / vscale;
}
@ -513,26 +485,20 @@ void Scale2D
/* for each band of the image */
bands = (dest_height + dest_band_height - 1) / dest_band_height;
for (k = 0; k < bands; k++)
{
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)
{
for (i = 1; i < source_band_height + 1; i++) {
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 */
{
} else { /* Duplicate the last row */
/* copy temp_area row 0 over from last row in the past */
duck_memcpy(temp_area + i * dest_pitch, temp_area + (i - 1)*dest_pitch, dest_pitch);
}
}
/* scale one band vertically */
for (j = 0; j < (int)dest_width; j++)
{
for (j = 0; j < (int)dest_width; j++) {
Scale1Dv(&temp_area[j], dest_pitch, vscale, source_band_height + 1,
&dest[j], dest_pitch, vratio, dest_band_height);
}
@ -581,8 +547,7 @@ void vp8_scale_frame
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;
@ -660,8 +625,7 @@ int any_ratio_2d_scale
unsigned int dest_pitch,
unsigned int dest_width,
unsigned int dest_height
)
{
) {
unsigned int i, k;
unsigned int src_band_height = 0;
unsigned int dest_band_height = 0;
@ -685,8 +649,7 @@ int any_ratio_2d_scale
(void) si;
/* find out the ratio for each direction */
switch (hr * 30 / hs)
{
switch (hr * 30 / hs) {
case 24:
/* 4-5 Scale in Width direction */
horiz_line_scale = vp8_horizontal_line_4_5_scale;
@ -719,8 +682,7 @@ int any_ratio_2d_scale
break;
}
switch (vr * 30 / vs)
{
switch (vr * 30 / vs) {
case 24:
/* 4-5 Scale in vertical direction */
vert_band_scale = vp8_vertical_band_4_5_scale;
@ -776,11 +738,9 @@ int any_ratio_2d_scale
horiz_line_scale(source, source_width, dest, dest_width);
/* except last band */
for (k = 0; k < (dest_height + dest_band_height - 1) / dest_band_height - 1; k++)
{
for (k = 0; k < (dest_height + dest_band_height - 1) / dest_band_height - 1; k++) {
/* scale one band horizontally */
for (i = 1; i < src_band_height; i++)
{
for (i = 1; i < src_band_height; i++) {
/* Trap case where we could read off the base of the source buffer */
line_src = source + i * source_pitch;
@ -811,8 +771,7 @@ int any_ratio_2d_scale
}
/* scale one band horizontally */
for (i = 1; i < src_band_height; i++)
{
for (i = 1; i < src_band_height; i++) {
/* Trap case where we could read off the base of the source buffer */
line_src = source + i * source_pitch;
@ -849,8 +808,7 @@ int any_ratio_2d_scale
*
****************************************************************************/
static
int any_ratio_frame_scale(SCALE_VARS *scale_vars, int YOffset, int UVOffset)
{
int any_ratio_frame_scale(SCALE_VARS *scale_vars, int YOffset, int UVOffset) {
int i;
int ew;
int eh;
@ -931,8 +889,7 @@ int any_ratio_frame_scale(SCALE_VARS *scale_vars, int YOffset, int UVOffset)
*
****************************************************************************/
static void
center_image(YV12_BUFFER_CONFIG *src_yuv_config, YV12_BUFFER_CONFIG *dst_yuv_config)
{
center_image(YV12_BUFFER_CONFIG *src_yuv_config, YV12_BUFFER_CONFIG *dst_yuv_config) {
int i;
int row_offset, col_offset;
unsigned char *src_data_pointer;
@ -946,8 +903,7 @@ center_image(YV12_BUFFER_CONFIG *src_yuv_config, YV12_BUFFER_CONFIG *dst_yuv_con
src_data_pointer = src_yuv_config->y_buffer;
dst_data_pointer = (unsigned char *)dst_yuv_config->y_buffer + (row_offset * dst_yuv_config->y_stride) + col_offset;
for (i = 0; i < src_yuv_config->y_height; i++)
{
for (i = 0; i < src_yuv_config->y_height; i++) {
duck_memcpy(dst_data_pointer, src_data_pointer, src_yuv_config->y_width);
dst_data_pointer += dst_yuv_config->y_stride;
src_data_pointer += src_yuv_config->y_stride;
@ -960,8 +916,7 @@ center_image(YV12_BUFFER_CONFIG *src_yuv_config, YV12_BUFFER_CONFIG *dst_yuv_con
src_data_pointer = src_yuv_config->u_buffer;
dst_data_pointer = (unsigned char *)dst_yuv_config->u_buffer + (row_offset * dst_yuv_config->uv_stride) + col_offset;
for (i = 0; i < src_yuv_config->uv_height; i++)
{
for (i = 0; i < src_yuv_config->uv_height; i++) {
duck_memcpy(dst_data_pointer, src_data_pointer, src_yuv_config->uv_width);
dst_data_pointer += dst_yuv_config->uv_stride;
src_data_pointer += src_yuv_config->uv_stride;
@ -971,8 +926,7 @@ center_image(YV12_BUFFER_CONFIG *src_yuv_config, YV12_BUFFER_CONFIG *dst_yuv_con
src_data_pointer = src_yuv_config->v_buffer;
dst_data_pointer = (unsigned char *)dst_yuv_config->v_buffer + (row_offset * dst_yuv_config->uv_stride) + col_offset;
for (i = 0; i < src_yuv_config->uv_height; i++)
{
for (i = 0; i < src_yuv_config->uv_height; i++) {
duck_memcpy(dst_data_pointer, src_data_pointer, src_yuv_config->uv_width);
dst_data_pointer += dst_yuv_config->uv_stride;
src_data_pointer += src_yuv_config->uv_stride;
@ -1008,17 +962,14 @@ vp8_yv12_scale_or_center
int HRatio,
int VScale,
int VRatio
)
{
) {
/*if ( ppi->post_processing_level )
update_umvborder ( ppi, frame_buffer );*/
switch (scaling_mode)
{
switch (scaling_mode) {
case SCALE_TO_FIT:
case MAINTAIN_ASPECT_RATIO:
{
case MAINTAIN_ASPECT_RATIO: {
SCALE_VARS scale_vars;
/* center values */
#if 1

View File

@ -20,19 +20,15 @@
*
****************************************************************************/
int
vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf)
{
if (ybf)
{
vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
if (ybf) {
vpx_free(ybf->buffer_alloc);
/* buffer_alloc isn't accessed by most functions. Rather y_buffer,
u_buffer and v_buffer point to buffer_alloc and are used. Clear out
all of this so that a freed pointer isn't inadvertently used */
vpx_memset(ybf, 0, sizeof(YV12_BUFFER_CONFIG));
}
else
{
} else {
return -1;
}
@ -43,12 +39,10 @@ vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf)
*
****************************************************************************/
int
vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border)
{
vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border) {
/*NOTE:*/
if (ybf)
{
if (ybf) {
int y_stride = ((width + 2 * border) + 31) & ~31;
int yplane_size = (height + 2 * border) * y_stride;
int uv_width = width >> 1;
@ -90,9 +84,7 @@ vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int
ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * uv_stride) + border / 2;
ybf->corrupted = 0; /* assume not currupted by errors */
}
else
{
} else {
return -2;
}

View File

@ -21,8 +21,7 @@
*
****************************************************************************/
void
vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf)
{
vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
int i;
unsigned char *src_ptr1, *src_ptr2;
unsigned char *dest_ptr1, *dest_ptr2;
@ -46,8 +45,7 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf)
dest_ptr1 = src_ptr1 - Border;
dest_ptr2 = src_ptr2 + 1;
for (i = 0; i < plane_height; i++)
{
for (i = 0; i < plane_height; i++) {
vpx_memset(dest_ptr1, src_ptr1[0], Border);
vpx_memset(dest_ptr2, src_ptr2[0], Border);
src_ptr1 += plane_stride;
@ -62,8 +60,7 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf)
dest_ptr1 = src_ptr1 - (Border * plane_stride);
dest_ptr2 = src_ptr2 + plane_stride;
for (i = 0; i < (int)Border; i++)
{
for (i = 0; i < (int)Border; i++) {
vpx_memcpy(dest_ptr1, src_ptr1, plane_stride);
vpx_memcpy(dest_ptr2, src_ptr2, plane_stride);
dest_ptr1 += plane_stride;
@ -85,8 +82,7 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf)
dest_ptr1 = src_ptr1 - Border;
dest_ptr2 = src_ptr2 + 1;
for (i = 0; i < plane_height; i++)
{
for (i = 0; i < plane_height; i++) {
vpx_memset(dest_ptr1, src_ptr1[0], Border);
vpx_memset(dest_ptr2, src_ptr2[0], Border);
src_ptr1 += plane_stride;
@ -101,8 +97,7 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf)
dest_ptr1 = src_ptr1 - (Border * plane_stride);
dest_ptr2 = src_ptr2 + plane_stride;
for (i = 0; i < (int)(Border); i++)
{
for (i = 0; i < (int)(Border); i++) {
vpx_memcpy(dest_ptr1, src_ptr1, plane_stride);
vpx_memcpy(dest_ptr2, src_ptr2, plane_stride);
dest_ptr1 += plane_stride;
@ -119,8 +114,7 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf)
dest_ptr1 = src_ptr1 - Border;
dest_ptr2 = src_ptr2 + 1;
for (i = 0; i < plane_height; i++)
{
for (i = 0; i < plane_height; i++) {
vpx_memset(dest_ptr1, src_ptr1[0], Border);
vpx_memset(dest_ptr2, src_ptr2[0], Border);
src_ptr1 += plane_stride;
@ -135,8 +129,7 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf)
dest_ptr1 = src_ptr1 - (Border * plane_stride);
dest_ptr2 = src_ptr2 + plane_stride;
for (i = 0; i < (int)(Border); i++)
{
for (i = 0; i < (int)(Border); i++) {
vpx_memcpy(dest_ptr1, src_ptr1, plane_stride);
vpx_memcpy(dest_ptr2, src_ptr2, plane_stride);
dest_ptr1 += plane_stride;
@ -146,8 +139,7 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf)
static void
extend_frame_borders_yonly_c(YV12_BUFFER_CONFIG *ybf)
{
extend_frame_borders_yonly_c(YV12_BUFFER_CONFIG *ybf) {
int i;
unsigned char *src_ptr1, *src_ptr2;
unsigned char *dest_ptr1, *dest_ptr2;
@ -171,8 +163,7 @@ extend_frame_borders_yonly_c(YV12_BUFFER_CONFIG *ybf)
dest_ptr1 = src_ptr1 - Border;
dest_ptr2 = src_ptr2 + 1;
for (i = 0; i < plane_height; i++)
{
for (i = 0; i < plane_height; i++) {
vpx_memset(dest_ptr1, src_ptr1[0], Border);
vpx_memset(dest_ptr2, src_ptr2[0], Border);
src_ptr1 += plane_stride;
@ -187,8 +178,7 @@ extend_frame_borders_yonly_c(YV12_BUFFER_CONFIG *ybf)
dest_ptr1 = src_ptr1 - (Border * plane_stride);
dest_ptr2 = src_ptr2 + plane_stride;
for (i = 0; i < (int)Border; i++)
{
for (i = 0; i < (int)Border; i++) {
vpx_memcpy(dest_ptr1, src_ptr1, plane_stride);
vpx_memcpy(dest_ptr2, src_ptr2, plane_stride);
dest_ptr1 += plane_stride;
@ -221,16 +211,15 @@ extend_frame_borders_yonly_c(YV12_BUFFER_CONFIG *ybf)
*
****************************************************************************/
void
vp8_yv12_copy_frame_c(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc)
{
vp8_yv12_copy_frame_c(YV12_BUFFER_CONFIG *src_ybc,
YV12_BUFFER_CONFIG *dst_ybc) {
int row;
unsigned char *source, *dest;
source = src_ybc->y_buffer;
dest = dst_ybc->y_buffer;
for (row = 0; row < src_ybc->y_height; row++)
{
for (row = 0; row < src_ybc->y_height; row++) {
vpx_memcpy(dest, source, src_ybc->y_width);
source += src_ybc->y_stride;
dest += dst_ybc->y_stride;
@ -239,8 +228,7 @@ vp8_yv12_copy_frame_c(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc)
source = src_ybc->u_buffer;
dest = dst_ybc->u_buffer;
for (row = 0; row < src_ybc->uv_height; row++)
{
for (row = 0; row < src_ybc->uv_height; row++) {
vpx_memcpy(dest, source, src_ybc->uv_width);
source += src_ybc->uv_stride;
dest += dst_ybc->uv_stride;
@ -249,8 +237,7 @@ vp8_yv12_copy_frame_c(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc)
source = src_ybc->v_buffer;
dest = dst_ybc->v_buffer;
for (row = 0; row < src_ybc->uv_height; row++)
{
for (row = 0; row < src_ybc->uv_height; row++) {
vpx_memcpy(dest, source, src_ybc->uv_width);
source += src_ybc->uv_stride;
dest += dst_ybc->uv_stride;
@ -259,8 +246,8 @@ vp8_yv12_copy_frame_c(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc)
vp8_yv12_extend_frame_borders_c(dst_ybc);
}
void vp8_yv12_copy_y_c(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc)
{
void vp8_yv12_copy_y_c(YV12_BUFFER_CONFIG *src_ybc,
YV12_BUFFER_CONFIG *dst_ybc) {
int row;
unsigned char *source, *dest;
@ -268,8 +255,7 @@ void vp8_yv12_copy_y_c(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc)
source = src_ybc->y_buffer;
dest = dst_ybc->y_buffer;
for (row = 0; row < src_ybc->y_height; row++)
{
for (row = 0; row < src_ybc->y_height; row++) {
vpx_memcpy(dest, source, src_ybc->y_width);
source += src_ybc->y_stride;
dest += dst_ybc->y_stride;

View File

@ -14,8 +14,7 @@
#include "vpx_scale/yv12config.h"
typedef struct
{
typedef struct {
int in_width;
int in_height;

View File

@ -17,8 +17,7 @@
#ifndef SCALE_MODE_H
#define SCALE_MODE_H
typedef enum
{
typedef enum {
MAINTAIN_ASPECT_RATIO = 0x0,
SCALE_TO_FIT = 0x1,
CENTER = 0x2,

View File

@ -14,9 +14,7 @@
#include "vpx_scale/yv12config.h"
extern void vp8_yv12_scale_or_center
(
YV12_BUFFER_CONFIG *src_yuv_config,
extern void vp8_yv12_scale_or_center(YV12_BUFFER_CONFIG *src_yuv_config,
YV12_BUFFER_CONFIG *dst_yuv_config,
int expanded_frame_width,
int expanded_frame_height,
@ -24,11 +22,9 @@ extern void vp8_yv12_scale_or_center
int HScale,
int HRatio,
int VScale,
int VRatio
);
extern void vp8_scale_frame
(
YV12_BUFFER_CONFIG *src,
int VRatio);
extern void vp8_scale_frame(YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst,
unsigned char *temp_area,
unsigned char temp_height,
@ -36,7 +32,6 @@ extern void vp8_scale_frame
unsigned int hratio,
unsigned int vscale,
unsigned int vratio,
unsigned int interlaced
);
unsigned int interlaced);
#endif

View File

@ -65,12 +65,10 @@ void horizontal_line_3_5_scale_mmx
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
) {
(void) dest_width;
__asm
{
__asm {
push ebx
@ -198,12 +196,10 @@ void horizontal_line_4_5_scale_mmx
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
) {
(void)dest_width;
__asm
{
__asm {
mov esi, source
mov edi, dest
@ -335,10 +331,8 @@ void vertical_band_4_5_scale_mmx
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width
)
{
__asm
{
) {
__asm {
mov esi, dest // Get the source and destination pointer
mov ecx, dest_pitch // Get the pitch size
@ -520,10 +514,8 @@ void last_vertical_band_4_5_scale_mmx
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width
)
{
__asm
{
) {
__asm {
mov esi, dest // Get the source and destination pointer
mov ecx, dest_pitch // Get the pitch size
@ -677,10 +669,8 @@ void vertical_band_3_5_scale_mmx
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width
)
{
__asm
{
) {
__asm {
mov esi, dest // Get the source and destination pointer
mov ecx, dest_pitch // Get the pitch size
@ -848,10 +838,8 @@ void last_vertical_band_3_5_scale_mmx
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width
)
{
__asm
{
) {
__asm {
mov esi, dest // Get the source and destination pointer
mov ecx, dest_pitch // Get the pitch size
@ -995,10 +983,8 @@ void vertical_band_1_2_scale_mmx
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width
)
{
__asm
{
) {
__asm {
mov esi, dest // Get the source and destination pointer
mov ecx, dest_pitch // Get the pitch size
@ -1066,10 +1052,8 @@ void last_vertical_band_1_2_scale_mmx
unsigned char *dest,
unsigned int dest_pitch,
unsigned int dest_width
)
{
__asm
{
) {
__asm {
mov esi, dest // Get the source and destination pointer
mov ecx, dest_pitch // Get the pitch size
@ -1112,12 +1096,10 @@ void horizontal_line_1_2_scale_mmx
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
) {
(void) dest_width;
__asm
{
__asm {
mov esi, source
mov edi, dest
@ -1244,8 +1226,7 @@ void horizontal_line_5_4_scale_mmx
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
) {
/*
unsigned i;
unsigned int a, b, c, d, e;
@ -1273,8 +1254,7 @@ void horizontal_line_5_4_scale_mmx
*/
(void) dest_width;
__asm
{
__asm {
mov esi, source;
mov edi, dest;
@ -1327,11 +1307,9 @@ __declspec(align(16)) const static unsigned short two_fourths[] = { 128, 128,
__declspec(align(16)) const static unsigned short three_fourths[] = { 192, 192, 192, 192 };
static
void vertical_band_5_4_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vertical_band_5_4_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) {
__asm
{
__asm {
push ebx
mov esi, source // Get the source and destination pointer
@ -1421,12 +1399,10 @@ void horizontal_line_5_3_scale_mmx
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
) {
(void) dest_width;
__asm
{
__asm {
mov esi, source;
mov edi, dest;
@ -1514,11 +1490,9 @@ __declspec(align(16)) const static unsigned short one_thirds[] = { 85, 85, 85
__declspec(align(16)) const static unsigned short two_thirds[] = { 171, 171, 171, 171 };
static
void vertical_band_5_3_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vertical_band_5_3_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) {
__asm
{
__asm {
push ebx
mov esi, source // Get the source and destination pointer
@ -1613,12 +1587,10 @@ void horizontal_line_2_1_scale_mmx
unsigned int source_width,
unsigned char *dest,
unsigned int dest_width
)
{
) {
(void) dest_width;
(void) source_width;
__asm
{
__asm {
mov esi, source
mov edi, dest
@ -1646,8 +1618,7 @@ void horizontal_line_2_1_scale_mmx
static
void vertical_band_2_1_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vertical_band_2_1_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) {
(void) dest_pitch;
(void) src_pitch;
vpx_memcpy(dest, source, dest_width);
@ -1658,12 +1629,10 @@ __declspec(align(16)) const static unsigned short three_sixteenths[] = { 48, 4
__declspec(align(16)) const static unsigned short ten_sixteenths[] = { 160, 160, 160, 160 };
static
void vertical_band_2_1_scale_i_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
{
void vertical_band_2_1_scale_i_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) {
(void) dest_pitch;
__asm
{
__asm {
mov esi, source
mov edi, dest
@ -1715,8 +1684,7 @@ void vertical_band_2_1_scale_i_mmx(unsigned char *source, unsigned int src_pitch
void
register_mmxscalers(void)
{
register_mmxscalers(void) {
vp8_horizontal_line_1_2_scale = horizontal_line_1_2_scale_mmx;
vp8_vertical_band_1_2_scale = vertical_band_1_2_scale_mmx;
vp8_last_vertical_band_1_2_scale = last_vertical_band_1_2_scale_mmx;

View File

@ -46,8 +46,7 @@ extern void register_mmxscalers(void);
*
****************************************************************************/
void
vp8_scale_machine_specific_config(void)
{
vp8_scale_machine_specific_config(void) {
// If MMX supported then set to use MMX versions of functions else
// use original 'C' versions.
int mmx_enabled;
@ -56,12 +55,9 @@ vp8_scale_machine_specific_config(void)
vpx_get_processor_flags(&mmx_enabled, &xmm_enabled, &wmt_enabled);
if (mmx_enabled || xmm_enabled || wmt_enabled)
{
if (mmx_enabled || xmm_enabled || wmt_enabled) {
register_mmxscalers();
}
else
{
} else {
vp8_horizontal_line_1_2_scale = vp8cx_horizontal_line_1_2_scale_c;
vp8_vertical_band_1_2_scale = vp8cx_vertical_band_1_2_scale_c;
vp8_last_vertical_band_1_2_scale = vp8cx_last_vertical_band_1_2_scale_c;

View File

@ -16,8 +16,9 @@ extern "C"
{
#endif
#define VP7BORDERINPIXELS 48
#define VP8BORDERINPIXELS 32
#define VP9BORDERINPIXELS 64
#define VP9_INTERP_EXTEND 4
/*************************************
For INT_YUV:
@ -37,8 +38,7 @@ extern "C"
}
YUV_TYPE;
typedef struct yv12_buffer_config
{
typedef struct yv12_buffer_config {
int y_width;
int y_height;
int y_stride;