mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
Unify signature for transform functions.
- Some used block, coeff and some src, dst. Now all signatures are const input and non-const output.
This commit is contained in:
parent
b932cf4b21
commit
f6272f06fc
|
@ -481,9 +481,7 @@ static void mul_clip_matrix_32x32_avx2(const int16_t *first, const int16_t *seco
|
|||
}
|
||||
}
|
||||
|
||||
#define TRANSFORM(type, n) \
|
||||
\
|
||||
static void matrix_ ## type ## _ ## n ## x ## n ## _avx2(int8_t bitdepth, const int16_t *src, int16_t *dst)\
|
||||
#define TRANSFORM(type, n) static void matrix_ ## type ## _ ## n ## x ## n ## _avx2(int8_t bitdepth, const int16_t *input, int16_t *output)\
|
||||
{\
|
||||
int32_t shift_1st = g_convert_to_bit[n] + 1 + (bitdepth - 8); \
|
||||
int32_t shift_2nd = g_convert_to_bit[n] + 8; \
|
||||
|
@ -491,13 +489,12 @@ static void matrix_ ## type ## _ ## n ## x ## n ## _avx2(int8_t bitdepth, const
|
|||
const int16_t *tdct = &g_ ## type ## _ ## n ## _t[0][0];\
|
||||
const int16_t *dct = &g_ ## type ## _ ## n ## [0][0];\
|
||||
\
|
||||
mul_clip_matrix_ ## n ## x ## n ## _avx2(src, tdct, tmp, shift_1st);\
|
||||
mul_clip_matrix_ ## n ## x ## n ## _avx2(dct, tmp, dst, shift_2nd);\
|
||||
mul_clip_matrix_ ## n ## x ## n ## _avx2(input, tdct, tmp, shift_1st);\
|
||||
mul_clip_matrix_ ## n ## x ## n ## _avx2(dct, tmp, output, shift_2nd);\
|
||||
}\
|
||||
|
||||
#define ITRANSFORM(type, n) \
|
||||
\
|
||||
static void matrix_i ## type ## _## n ## x ## n ## _avx2(int8_t bitdepth, const int16_t *dst, int16_t *src)\
|
||||
static void matrix_i ## type ## _## n ## x ## n ## _avx2(int8_t bitdepth, const int16_t *input, int16_t *output)\
|
||||
{\
|
||||
int32_t shift_1st = 7; \
|
||||
int32_t shift_2nd = 12 - (bitdepth - 8); \
|
||||
|
@ -505,8 +502,8 @@ static void matrix_i ## type ## _## n ## x ## n ## _avx2(int8_t bitdepth, const
|
|||
const int16_t *tdct = &g_ ## type ## _ ## n ## _t[0][0];\
|
||||
const int16_t *dct = &g_ ## type ## _ ## n ## [0][0];\
|
||||
\
|
||||
mul_clip_matrix_ ## n ## x ## n ## _avx2(tdct, src, tmp, shift_1st);\
|
||||
mul_clip_matrix_ ## n ## x ## n ## _avx2(tmp, dct, dst, shift_2nd);\
|
||||
mul_clip_matrix_ ## n ## x ## n ## _avx2(tdct, input, tmp, shift_1st);\
|
||||
mul_clip_matrix_ ## n ## x ## n ## _avx2(tmp, dct, output, shift_2nd);\
|
||||
}\
|
||||
|
||||
TRANSFORM(dst, 4);
|
||||
|
|
|
@ -568,25 +568,25 @@ static void partial_butterfly_inverse_32_generic(int16_t *src, int16_t *dst,
|
|||
}
|
||||
|
||||
#define DCT_NXN_GENERIC(n) \
|
||||
static void dct_ ## n ## x ## n ## _generic(int8_t bitdepth, int16_t *block, int16_t *coeff) { \
|
||||
static void dct_ ## n ## x ## n ## _generic(int8_t bitdepth, const int16_t *input, int16_t *output) { \
|
||||
\
|
||||
int16_t tmp[ n * n ]; \
|
||||
int32_t shift_1st = g_convert_to_bit[ n ] + 1 + (bitdepth - 8); \
|
||||
int32_t shift_2nd = g_convert_to_bit[ n ] + 8; \
|
||||
\
|
||||
partial_butterfly_ ## n ## _generic(block, tmp, shift_1st); \
|
||||
partial_butterfly_ ## n ## _generic(tmp, coeff, shift_2nd); \
|
||||
partial_butterfly_ ## n ## _generic(input, tmp, shift_1st); \
|
||||
partial_butterfly_ ## n ## _generic(tmp, output, shift_2nd); \
|
||||
}
|
||||
|
||||
#define IDCT_NXN_GENERIC(n) \
|
||||
static void idct_ ## n ## x ## n ## _generic(int8_t bitdepth, int16_t *block, int16_t *coeff) { \
|
||||
static void idct_ ## n ## x ## n ## _generic(int8_t bitdepth, const int16_t *input, int16_t *output) { \
|
||||
\
|
||||
int16_t tmp[ n * n ]; \
|
||||
int32_t shift_1st = 7; \
|
||||
int32_t shift_2nd = 12 - (bitdepth - 8); \
|
||||
\
|
||||
partial_butterfly_inverse_ ## n ## _generic(coeff, tmp, shift_1st); \
|
||||
partial_butterfly_inverse_ ## n ## _generic(tmp, block, shift_2nd); \
|
||||
partial_butterfly_inverse_ ## n ## _generic(input, tmp, shift_1st); \
|
||||
partial_butterfly_inverse_ ## n ## _generic(tmp, output, shift_2nd); \
|
||||
}
|
||||
|
||||
DCT_NXN_GENERIC(4);
|
||||
|
@ -599,24 +599,24 @@ IDCT_NXN_GENERIC(8);
|
|||
IDCT_NXN_GENERIC(16);
|
||||
IDCT_NXN_GENERIC(32);
|
||||
|
||||
static void fast_forward_dst_4x4_generic(int8_t bitdepth, int16_t *block, int16_t *coeff)
|
||||
static void fast_forward_dst_4x4_generic(int8_t bitdepth, const int16_t *input, int16_t *output)
|
||||
{
|
||||
int16_t tmp[4*4];
|
||||
int32_t shift_1st = g_convert_to_bit[4] + 1 + (bitdepth - 8);
|
||||
int32_t shift_2nd = g_convert_to_bit[4] + 8;
|
||||
|
||||
fast_forward_dst_4_generic(block, tmp, shift_1st);
|
||||
fast_forward_dst_4_generic(tmp, coeff, shift_2nd);
|
||||
fast_forward_dst_4_generic(input, tmp, shift_1st);
|
||||
fast_forward_dst_4_generic(tmp, output, shift_2nd);
|
||||
}
|
||||
|
||||
static void fast_inverse_dst_4x4_generic(int8_t bitdepth, int16_t *block, int16_t *coeff)
|
||||
static void fast_inverse_dst_4x4_generic(int8_t bitdepth, const int16_t *input, int16_t *output)
|
||||
{
|
||||
int16_t tmp[4 * 4];
|
||||
int32_t shift_1st = 7;
|
||||
int32_t shift_2nd = 12 - (bitdepth - 8);
|
||||
|
||||
fast_inverse_dst_4_generic(coeff, tmp, shift_1st);
|
||||
fast_inverse_dst_4_generic(tmp, block, shift_2nd);
|
||||
fast_inverse_dst_4_generic(input, tmp, shift_1st);
|
||||
fast_inverse_dst_4_generic(tmp, output, shift_2nd);
|
||||
}
|
||||
|
||||
int strategy_register_dct_generic(void* opaque)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
****************************************************************************/
|
||||
#include <stdint.h>
|
||||
|
||||
typedef unsigned (dct_func)(int8_t bitdepth, int16_t *block, int16_t *coeff);
|
||||
typedef unsigned (dct_func)(int8_t bitdepth, const int16_t *input, int16_t *output);
|
||||
|
||||
|
||||
// Declare function pointers.
|
||||
|
|
|
@ -116,16 +116,14 @@ void itransformskip(const encoder_control * const encoder, int16_t *block,int16_
|
|||
*/
|
||||
void transform2d(const encoder_control * const encoder, int16_t *block, int16_t *coeff, int8_t block_size, int32_t mode)
|
||||
{
|
||||
|
||||
dct_func *dct_func = get_dct_func(block_size, mode);
|
||||
dct_func(encoder->bitdepth, block, coeff);
|
||||
}
|
||||
|
||||
void itransform2d(const encoder_control * const encoder, int16_t *block, int16_t *coeff, int8_t block_size, int32_t mode)
|
||||
{
|
||||
|
||||
dct_func *idct_func = get_idct_func(block_size, mode);
|
||||
idct_func(encoder->bitdepth, block, coeff);
|
||||
idct_func(encoder->bitdepth, coeff, block);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ static void setup_tests()
|
|||
)
|
||||
{
|
||||
idct_generic = strat->fptr;
|
||||
idct_generic(BIT_DEPTH, idct_result[block], dct_bufs[block]);
|
||||
idct_generic(BIT_DEPTH, dct_bufs[block], idct_result[block]);
|
||||
++block;
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ TEST idct(void)
|
|||
int16_t *buf = dct_bufs[index];
|
||||
int16_t test_result[LCU_WIDTH*LCU_WIDTH] = { 0 };
|
||||
|
||||
test_env.tested_func(BIT_DEPTH, test_result, buf);
|
||||
test_env.tested_func(BIT_DEPTH, buf, test_result);
|
||||
|
||||
for (int i = 0; i < LCU_WIDTH*LCU_WIDTH; ++i){
|
||||
ASSERT_EQ(test_result[i], idct_result[index][i]);
|
||||
|
|
Loading…
Reference in a new issue