diff options
author | Ganesh Ajjanagadde <gajjanagadde@gmail.com> | 2015-11-21 17:04:58 +0300 |
---|---|---|
committer | Ganesh Ajjanagadde <gajjanagadde@gmail.com> | 2015-11-23 00:16:16 +0300 |
commit | 61a1ca13ea9f869e8c7423784d12815efc06dc32 (patch) | |
tree | 147cc78cafcbd1140e64b76c0684d721fdae8f60 | |
parent | ccf3c694032bd84c7672979fa89f437980d717ba (diff) |
avcodec/ppc/fdctdsp: use M_SQRT2 instead of ad-hoc SQRT2
This actually fixes an incorrect float literal. It is believed by
examining the precision that the literals were all pre-computed as
floats, resulting in this needless loss of precision. There is no
benefit to keeping such reduced precision:
1. These constants are used for static array computation, hence
compile-time.
2. They will be treated as doubles anyway, since f specifier was not
present.
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
-rw-r--r-- | libavcodec/ppc/fdctdsp.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libavcodec/ppc/fdctdsp.c b/libavcodec/ppc/fdctdsp.c index 40f4c6c967..924d12c911 100644 --- a/libavcodec/ppc/fdctdsp.c +++ b/libavcodec/ppc/fdctdsp.c @@ -44,20 +44,19 @@ #define C5 0.55557024478912353515625000 /* cos(5 * PI / 16) */ #define C6 0.38268342614173889160156250 /* cos(6 * PI / 16) */ #define C7 0.19509032368659973144531250 /* cos(7 * PI / 16) */ -#define SQRT_2 1.41421353816986083984375000 /* sqrt(2) */ #define W0 -(2 * C2) #define W1 (2 * C6) -#define W2 (SQRT_2 * C6) -#define W3 (SQRT_2 * C3) -#define W4 (SQRT_2 * (-C1 + C3 + C5 - C7)) -#define W5 (SQRT_2 * (C1 + C3 - C5 + C7)) -#define W6 (SQRT_2 * (C1 + C3 + C5 - C7)) -#define W7 (SQRT_2 * (C1 + C3 - C5 - C7)) -#define W8 (SQRT_2 * (C7 - C3)) -#define W9 (SQRT_2 * (-C1 - C3)) -#define WA (SQRT_2 * (-C3 - C5)) -#define WB (SQRT_2 * (C5 - C3)) +#define W2 (M_SQRT2 * C6) +#define W3 (M_SQRT2 * C3) +#define W4 (M_SQRT2 * (-C1 + C3 + C5 - C7)) +#define W5 (M_SQRT2 * (C1 + C3 - C5 + C7)) +#define W6 (M_SQRT2 * (C1 + C3 + C5 - C7)) +#define W7 (M_SQRT2 * (C1 + C3 - C5 - C7)) +#define W8 (M_SQRT2 * (C7 - C3)) +#define W9 (M_SQRT2 * (-C1 - C3)) +#define WA (M_SQRT2 * (-C3 - C5)) +#define WB (M_SQRT2 * (C5 - C3)) static const vector float fdctconsts[3] = { { W0, W1, W2, W3 }, |