avcodec/ac3: use M_SQRT1_2, M_SQRT2
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>
Wed, 11 Nov 2015 03:26:25 +0000 (22:26 -0500)
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>
Sun, 22 Nov 2015 21:16:16 +0000 (16:16 -0500)
This uses M_SQRT1_2, M_SQRT2 instead of the actual literals. This yields
greater precision in some places in avcodec/ac3, while fixed point
values remain unchanged.

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
libavcodec/ac3.h

index ff36249..747f2f5 100644 (file)
@@ -97,13 +97,13 @@ typedef float                   SHORTFLOAT;
 
 #endif /* USE_FIXED */
 
-#define AC3_LEVEL(x)            ROUND15((x) * FIXR15(0.7071067811865476))
+#define AC3_LEVEL(x)            ROUND15((x) * FIXR15(M_SQRT1_2))
 
 /* pre-defined gain values */
-#define LEVEL_PLUS_3DB          1.4142135623730950
+#define LEVEL_PLUS_3DB          M_SQRT2
 #define LEVEL_PLUS_1POINT5DB    1.1892071150027209
 #define LEVEL_MINUS_1POINT5DB   0.8408964152537145
-#define LEVEL_MINUS_3DB         0.7071067811865476
+#define LEVEL_MINUS_3DB         M_SQRT1_2
 #define LEVEL_MINUS_4POINT5DB   0.5946035575013605
 #define LEVEL_MINUS_6DB         0.5000000000000000
 #define LEVEL_MINUS_9DB         0.3535533905932738