Merge "Code cleanup." into experimental
This commit is contained in:
Коммит
0287d20a05
|
@ -24,12 +24,20 @@
|
|||
**************************************************************************/
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vp9/common/vp9_systemdependent.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_common.h"
|
||||
#include "vp9/common/vp9_idct.h"
|
||||
|
||||
#define ROUND_POWER_OF_TWO(value, n) (((value) + (1 << ((n) - 1))) >> (n))
|
||||
|
||||
/* If we don't want to use ROUND_POWER_OF_TWO macro
|
||||
static INLINE int16_t round_power_of_two(int16_t value, int n) {
|
||||
return (value + (1 << (n - 1))) >> n;
|
||||
}*/
|
||||
|
||||
void vp9_short_inv_walsh4x4_x8_c(int16_t *input, int16_t *output, int pitch) {
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
|
@ -38,10 +46,10 @@ void vp9_short_inv_walsh4x4_x8_c(int16_t *input, int16_t *output, int pitch) {
|
|||
int shortpitch = pitch >> 1;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ((ip[0] + ip[3])) >> WHT_UPSCALE_FACTOR;
|
||||
b1 = ((ip[1] + ip[2])) >> WHT_UPSCALE_FACTOR;
|
||||
c1 = ((ip[1] - ip[2])) >> WHT_UPSCALE_FACTOR;
|
||||
d1 = ((ip[0] - ip[3])) >> WHT_UPSCALE_FACTOR;
|
||||
a1 = (ip[0] + ip[3]) >> WHT_UPSCALE_FACTOR;
|
||||
b1 = (ip[1] + ip[2]) >> WHT_UPSCALE_FACTOR;
|
||||
c1 = (ip[1] - ip[2]) >> WHT_UPSCALE_FACTOR;
|
||||
d1 = (ip[0] - ip[3]) >> WHT_UPSCALE_FACTOR;
|
||||
|
||||
op[0] = (a1 + b1 + 1) >> 1;
|
||||
op[1] = (c1 + d1) >> 1;
|
||||
|
@ -79,7 +87,7 @@ void vp9_short_inv_walsh4x4_1_x8_c(int16_t *in, int16_t *out, int pitch) {
|
|||
int shortpitch = pitch >> 1;
|
||||
|
||||
op[0] = ((ip[0] >> WHT_UPSCALE_FACTOR) + 1) >> 1;
|
||||
op[1] = op[2] = op[3] = ((ip[0] >> WHT_UPSCALE_FACTOR) >> 1);
|
||||
op[1] = op[2] = op[3] = (ip[0] >> WHT_UPSCALE_FACTOR) >> 1;
|
||||
|
||||
|
||||
ip = tmp;
|
||||
|
@ -101,9 +109,8 @@ void vp9_dc_only_inv_walsh_add_c(int input_dc, uint8_t *pred_ptr,
|
|||
vp9_short_inv_walsh4x4_1_x8_c(&dc, tmp, 4 << 1);
|
||||
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
for (c = 0; c < 4; c++)
|
||||
dst_ptr[c] = clip_pixel(tmp[r * 4 + c] + pred_ptr[c]);
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
pred_ptr += pitch;
|
||||
|
@ -150,7 +157,7 @@ void vp9_short_idct4x4llm_c(int16_t *input, int16_t *output, int pitch) {
|
|||
temp_in[j] = out[j * 4 + i];
|
||||
idct4_1d(temp_in, temp_out);
|
||||
for (j = 0; j < 4; ++j)
|
||||
output[j * short_pitch + i] = (temp_out[j] + 8) >> 4;
|
||||
output[j * short_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,19 +166,12 @@ void vp9_short_idct4x4llm_1_c(int16_t *input, int16_t *output, int pitch) {
|
|||
int a1;
|
||||
int16_t *op = output;
|
||||
int shortpitch = pitch >> 1;
|
||||
int tmp;
|
||||
int16_t out;
|
||||
tmp = input[0] * cospi_16_64;
|
||||
out = dct_const_round_shift(tmp);
|
||||
tmp = out * cospi_16_64;
|
||||
out = dct_const_round_shift(tmp);
|
||||
a1 = (out + 8) >> 4;
|
||||
int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
|
||||
out = dct_const_round_shift(out * cospi_16_64);
|
||||
a1 = ROUND_POWER_OF_TWO(out, 4);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
op[0] = a1;
|
||||
op[1] = a1;
|
||||
op[2] = a1;
|
||||
op[3] = a1;
|
||||
op[0] = op[1] = op[2] = op[3] = a1;
|
||||
op += shortpitch;
|
||||
}
|
||||
}
|
||||
|
@ -180,18 +180,14 @@ void vp9_dc_only_idct_add_c(int input_dc, uint8_t *pred_ptr,
|
|||
uint8_t *dst_ptr, int pitch, int stride) {
|
||||
int a1;
|
||||
int r, c;
|
||||
int tmp;
|
||||
int16_t out;
|
||||
tmp = input_dc * cospi_16_64;
|
||||
out = dct_const_round_shift(tmp);
|
||||
tmp = out * cospi_16_64;
|
||||
out = dct_const_round_shift(tmp);
|
||||
a1 = (out + 8) >> 4;
|
||||
int16_t out = dct_const_round_shift(input_dc * cospi_16_64);
|
||||
out = dct_const_round_shift(out * cospi_16_64);
|
||||
a1 = ROUND_POWER_OF_TWO(out, 4);
|
||||
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
for (c = 0; c < 4; c++)
|
||||
dst_ptr[c] = clip_pixel(a1 + pred_ptr[c]);
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
pred_ptr += pitch;
|
||||
}
|
||||
|
@ -262,7 +258,7 @@ void vp9_short_idct8x8_c(int16_t *input, int16_t *output, int pitch) {
|
|||
temp_in[j] = out[j * 8 + i];
|
||||
idct8_1d(temp_in, temp_out);
|
||||
for (j = 0; j < 8; ++j)
|
||||
output[j * short_pitch + i] = (temp_out[j] + 16) >> 5;
|
||||
output[j * short_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,7 +350,7 @@ void vp9_short_iht4x4_c(int16_t *input, int16_t *output,
|
|||
temp_in[j] = out[j * 4 + i];
|
||||
invc(temp_in, temp_out);
|
||||
for (j = 0; j < 4; ++j)
|
||||
output[j * short_pitch + i] = (temp_out[j] + 8) >> 4;
|
||||
output[j * short_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,7 +369,7 @@ static void iadst8_1d(int16_t *input, int16_t *output) {
|
|||
|
||||
if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7)) {
|
||||
output[0] = output[1] = output[2] = output[3] = output[4]
|
||||
= output[5] = output[6] = output[7] = 0;
|
||||
= output[5] = output[6] = output[7] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -483,7 +479,7 @@ void vp9_short_iht8x8_c(int16_t *input, int16_t *output,
|
|||
temp_in[j] = out[j * 8 + i];
|
||||
invc(temp_in, temp_out);
|
||||
for (j = 0; j < 8; ++j)
|
||||
output[j * short_pitch + i] = (temp_out[j] + 16) >> 5;
|
||||
output[j * short_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,14 +505,14 @@ void vp9_short_idct10_8x8_c(int16_t *input, int16_t *output, int pitch) {
|
|||
temp_in[j] = out[j * 8 + i];
|
||||
idct8_1d(temp_in, temp_out);
|
||||
for (j = 0; j < 8; ++j)
|
||||
output[j * short_pitch + i] = (temp_out[j] + 16) >> 5;
|
||||
output[j * short_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 5);
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_short_idct1_8x8_c(int16_t *input, int16_t *output) {
|
||||
int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
|
||||
out = dct_const_round_shift(out * cospi_16_64);
|
||||
output[0] = (out + 16) >> 5;
|
||||
output[0] = ROUND_POWER_OF_TWO(out, 5);
|
||||
}
|
||||
|
||||
void idct16_1d(int16_t *input, int16_t *output) {
|
||||
|
@ -703,7 +699,7 @@ void vp9_short_idct16x16_c(int16_t *input, int16_t *output, int pitch) {
|
|||
temp_in[j] = out[j * 16 + i];
|
||||
idct16_1d(temp_in, temp_out);
|
||||
for (j = 0; j < 16; ++j)
|
||||
output[j * 16 + i] = (temp_out[j] + 32) >> 6;
|
||||
output[j * 16 + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -924,7 +920,7 @@ void vp9_short_iht16x16_c(int16_t *input, int16_t *output,
|
|||
temp_in[j] = out[j * 16 + i];
|
||||
invc(temp_in, temp_out);
|
||||
for (j = 0; j < 16; ++j)
|
||||
output[j * 16 + i] = (temp_out[j] + 32) >> 6;
|
||||
output[j * 16 + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -951,19 +947,15 @@ void vp9_short_idct10_16x16_c(int16_t *input, int16_t *output, int pitch) {
|
|||
temp_in[j] = out[j*16 + i];
|
||||
idct16_1d(temp_in, temp_out);
|
||||
for (j = 0; j < 16; ++j)
|
||||
output[j*16 + i] = (temp_out[j] + 32) >> 6;
|
||||
output[j*16 + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vp9_short_idct1_16x16_c(int16_t *input, int16_t *output) {
|
||||
int tmp;
|
||||
int16_t out;
|
||||
tmp = input[0] * cospi_16_64;
|
||||
out = dct_const_round_shift(tmp);
|
||||
tmp = out * cospi_16_64;
|
||||
out = dct_const_round_shift(tmp);
|
||||
*output = (out + 32) >> 6;
|
||||
int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
|
||||
out = dct_const_round_shift(out * cospi_16_64);
|
||||
output[0] = ROUND_POWER_OF_TWO(out, 6);
|
||||
}
|
||||
|
||||
void idct32_1d(int16_t *input, int16_t *output) {
|
||||
|
@ -1352,12 +1344,12 @@ void vp9_short_idct32x32_c(int16_t *input, int16_t *output, int pitch) {
|
|||
temp_in[j] = out[j * 32 + i];
|
||||
idct32_1d(temp_in, temp_out);
|
||||
for (j = 0; j < 32; ++j)
|
||||
output[j * 32 + i] = (temp_out[j] + 32) >> 6;
|
||||
output[j * 32 + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_short_idct1_32x32_c(int16_t *input, int16_t *output) {
|
||||
int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
|
||||
out = dct_const_round_shift(out * cospi_16_64);
|
||||
output[0] = (out + 32) >> 6;
|
||||
output[0] = ROUND_POWER_OF_TWO(out, 6);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче