[FFmpeg-devel] [PATCH] all: use predefined mathematics macros
Clément Bœsch
u at pkh.me
Wed Nov 11 16:21:12 CET 2015
On Tue, Nov 10, 2015 at 10:35:23PM -0500, Ganesh Ajjanagadde wrote:
> This uses M_SQRT2, M_PI, and M_E instead of the actual literals.
> Benefits include:
> 1. Reduced scope for copy/paste errors and improved readability.
> 2. Consistency across the codebase.
> 3. Actually fixes an incorrect sqrt(2) in avcodec/ppc.
> 4. Greater precision in avcodec/ac3.
>
> Patch tested with FATE on x86, ppc untested.
>
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
> libavcodec/ac3.h | 2 +-
> libavcodec/cos_tablegen.c | 4 +++-
> libavcodec/mpegaudioenc_template.c | 4 ++--
> libavcodec/mpegaudiotab.h | 2 --
> libavcodec/mpegvideo.c | 4 ++--
> libavcodec/ppc/fdctdsp.c | 21 ++++++++++-----------
> libavcodec/ratecontrol.c | 4 ----
> libavcodec/simple_idct.c | 4 ++--
> libavfilter/af_dynaudnorm.c | 4 +---
> 9 files changed, 21 insertions(+), 28 deletions(-)
>
> diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
> index 3f67e09..4dc7373 100644
> --- a/libavcodec/ac3.h
> +++ b/libavcodec/ac3.h
> @@ -100,7 +100,7 @@
> #define AC3_LEVEL(x) ROUND15((x) * FIXR15(0.7071067811865476))
>
> /* 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
M_SQRT1_2?
[...]
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151111/00686920/attachment.sig>
More information about the ffmpeg-devel
mailing list