Commit 618b3ae7 authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde

avcodec/simple_idct: use predefined M_SQRT2

M_SQRT2 is defined in math.h, or in avutil/mathematics.h for
compatibility hacks. This uses this value instead of a floating literal.

Fixed point values produced by C_FIX(), R_FIX() remain identical.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanagadde@gmail.com>
parent 11f0acf8
...@@ -132,7 +132,7 @@ void ff_simple_idct248_put(uint8_t *dest, int line_size, int16_t *block) ...@@ -132,7 +132,7 @@ void ff_simple_idct248_put(uint8_t *dest, int line_size, int16_t *block)
#undef C1 #undef C1
#undef C2 #undef C2
#define CN_SHIFT 12 #define CN_SHIFT 12
#define C_FIX(x) ((int)((x) * 1.414213562 * (1 << CN_SHIFT) + 0.5)) #define C_FIX(x) ((int)((x) * M_SQRT2 * (1 << CN_SHIFT) + 0.5))
#define C1 C_FIX(0.6532814824) #define C1 C_FIX(0.6532814824)
#define C2 C_FIX(0.2705980501) #define C2 C_FIX(0.2705980501)
#define C3 C_FIX(0.5) #define C3 C_FIX(0.5)
...@@ -159,7 +159,7 @@ static inline void idct4col_add(uint8_t *dest, int line_size, const int16_t *col ...@@ -159,7 +159,7 @@ static inline void idct4col_add(uint8_t *dest, int line_size, const int16_t *col
} }
#define RN_SHIFT 15 #define RN_SHIFT 15
#define R_FIX(x) ((int)((x) * 1.414213562 * (1 << RN_SHIFT) + 0.5)) #define R_FIX(x) ((int)((x) * M_SQRT2 * (1 << RN_SHIFT) + 0.5))
#define R1 R_FIX(0.6532814824) #define R1 R_FIX(0.6532814824)
#define R2 R_FIX(0.2705980501) #define R2 R_FIX(0.2705980501)
#define R3 R_FIX(0.5) #define R3 R_FIX(0.5)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment