From f2975c712d75b2c901e41f89897501ed292ac4c4 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 26 Apr 2001 11:23:16 +0000 Subject: [PATCH] * Fixed the ac3dec compilation under BeOS. * Removed a useless #include in aout_sdl.c. --- plugins/sdl/aout_sdl.c | 3 +-- src/ac3_decoder/ac3_bit_allocate.c | 38 +++++++++++++++++++------------------- src/ac3_decoder/ac3_imdct.c | 6 +++++- src/ac3_decoder/ac3_rematrix.c | 6 +++--- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/plugins/sdl/aout_sdl.c b/plugins/sdl/aout_sdl.c index a6d2977421..cd17ca4b2c 100644 --- a/plugins/sdl/aout_sdl.c +++ b/plugins/sdl/aout_sdl.c @@ -2,7 +2,7 @@ * aout_sdl.c : audio sdl functions library ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: aout_sdl.c,v 1.10 2001/03/21 13:42:34 sam Exp $ + * $Id: aout_sdl.c,v 1.11 2001/04/26 11:23:16 sam Exp $ * * Authors: Michel Kaempf * Samuel Hocevar @@ -33,7 +33,6 @@ #include /* ENOMEM */ #include /* open(), O_WRONLY */ -#include /* ioctl() */ #include /* strerror() */ #include /* write(), close() */ #include /* "intf_msg.h" */ diff --git a/src/ac3_decoder/ac3_bit_allocate.c b/src/ac3_decoder/ac3_bit_allocate.c index e8af098886..ebf474b86f 100644 --- a/src/ac3_decoder/ac3_bit_allocate.c +++ b/src/ac3_decoder/ac3_bit_allocate.c @@ -2,7 +2,7 @@ * ac3_bit_allocate.c: ac3 allocation tables ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: ac3_bit_allocate.c,v 1.18 2001/04/20 12:14:34 reno Exp $ + * $Id: ac3_bit_allocate.c,v 1.19 2001/04/26 11:23:16 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -152,12 +152,12 @@ static const s16 baptab[] = { 0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15 }; -static __inline__ u16 max (s16 a, s16 b) +static __inline__ u16 max_value (s16 a, s16 b) { return (a > b ? a : b); } -static __inline__ u16 min (s16 a, s16 b) +static __inline__ u16 min_value (s16 a, s16 b) { return (a < b ? a : b); } @@ -167,9 +167,9 @@ static __inline__ s16 logadd (s16 a, s16 b) s16 c; if ((c = a - b) >= 0) { - return (a + latab[min(((c) >> 1), 255)]); + return (a + latab[min_value(((c) >> 1), 255)]); } else { - return (b + latab[min(((-c) >> 1), 255)]); + return (b + latab[min_value(((-c) >> 1), 255)]); } } @@ -179,14 +179,14 @@ static __inline__ s16 calc_lowcomp (s16 a, s16 b0, s16 b1, s16 bin) if ((b0 + 256) == b1) a = 384; else if (b0 > b1) - a = max(0, a - 64); + a = max_value(0, a - 64); } else if (bin < 20) { if ((b0 + 256) == b1) a = 320; else if (b0 > b1) - a = max(0, a - 64) ; + a = max_value(0, a - 64) ; } else - a = max(0, a - 128); + a = max_value(0, a - 128); return a; } @@ -306,7 +306,7 @@ static void ba_compute_psd (bit_allocate_t * p_bit, s16 start, s16 end, s16 exps k = masktab[start]; do { - lastbin = min(bndtab[k] + bndsz[k], end); + lastbin = min_value(bndtab[k] + bndsz[k], end); p_bit->bndpsd[k] = p_bit->psd[j]; j++; @@ -356,15 +356,15 @@ static void ba_compute_excitation (bit_allocate_t * p_bit, s16 start, s16 end, } } - for (bin = begin; bin < min(bndend, 22); bin++) { + for (bin = begin; bin < min_value(bndend, 22); bin++) { if (!(is_lfe && (bin == 6))) lowcomp = calc_lowcomp (lowcomp, p_bit->bndpsd[bin], p_bit->bndpsd[bin+1], bin); fastleak -= p_bit->fdecay ; - fastleak = max(fastleak, p_bit->bndpsd[bin] - fgain); + fastleak = max_value(fastleak, p_bit->bndpsd[bin] - fgain); slowleak -= p_bit->sdecay ; - slowleak = max(slowleak, p_bit->bndpsd[bin] - p_bit->sgain); - p_bit->excite[bin] = max(fastleak - lowcomp, slowleak); + slowleak = max_value(slowleak, p_bit->bndpsd[bin] - p_bit->sgain); + p_bit->excite[bin] = max_value(fastleak - lowcomp, slowleak); } begin = 22; } else { /* For coupling channel */ @@ -373,10 +373,10 @@ static void ba_compute_excitation (bit_allocate_t * p_bit, s16 start, s16 end, for (bin = begin; bin < bndend; bin++) { fastleak -= p_bit->fdecay; - fastleak = max(fastleak, p_bit->bndpsd[bin] - fgain); + fastleak = max_value(fastleak, p_bit->bndpsd[bin] - fgain); slowleak -= p_bit->sdecay; - slowleak = max(slowleak, p_bit->bndpsd[bin] - p_bit->sgain); - p_bit->excite[bin] = max(fastleak, slowleak) ; + slowleak = max_value(slowleak, p_bit->bndpsd[bin] - p_bit->sgain); + p_bit->excite[bin] = max_value(fastleak, slowleak) ; } } @@ -397,7 +397,7 @@ static void ba_compute_mask (bit_allocate_t * p_bit, s16 start, s16 end, u16 fsc if (p_bit->bndpsd[bin] < p_bit->dbknee) { p_bit->excite[bin] += ((p_bit->dbknee - p_bit->bndpsd[bin]) >> 2); } - p_bit->mask[bin] = max(p_bit->excite[bin], hth[fscod][bin]); + p_bit->mask[bin] = max_value(p_bit->excite[bin], hth[fscod][bin]); } /* Perform delta bit modulation if necessary */ @@ -432,7 +432,7 @@ static void ba_compute_bap (bit_allocate_t * p_bit, s16 start, s16 end, s16 snro j = masktab[start]; do { - lastbin = min(bndtab[j] + bndsz[j], end); + lastbin = min_value(bndtab[j] + bndsz[j], end); p_bit->mask[j] -= snroffset; p_bit->mask[j] -= p_bit->floor; @@ -443,7 +443,7 @@ static void ba_compute_bap (bit_allocate_t * p_bit, s16 start, s16 end, s16 snro p_bit->mask[j] += p_bit->floor; for (k = i; k < lastbin; k++) { address = (p_bit->psd[i] - p_bit->mask[j]) >> 5; - address = min(63, max(0, address)); + address = min_value(63, max_value(0, address)); bap[i] = baptab[address]; i++; } diff --git a/src/ac3_decoder/ac3_imdct.c b/src/ac3_decoder/ac3_imdct.c index fe1a81b5f0..ae8bc17ded 100644 --- a/src/ac3_decoder/ac3_imdct.c +++ b/src/ac3_decoder/ac3_imdct.c @@ -2,7 +2,7 @@ * ac3_imdct.c: ac3 DCT ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct.c,v 1.15 2001/04/20 12:14:34 reno Exp $ + * $Id: ac3_imdct.c,v 1.16 2001/04/26 11:23:16 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -41,6 +41,10 @@ #include "ac3_downmix.h" +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + void imdct_do_256(imdct_t * p_imdct, float x[],float y[], int id); void imdct_do_512(imdct_t * p_imdct, float x[],float y[], int id); diff --git a/src/ac3_decoder/ac3_rematrix.c b/src/ac3_decoder/ac3_rematrix.c index d53b8b561e..a70194ffc7 100644 --- a/src/ac3_decoder/ac3_rematrix.c +++ b/src/ac3_decoder/ac3_rematrix.c @@ -2,7 +2,7 @@ * ac3_rematrix.c: ac3 audio rematrixing ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_rematrix.c,v 1.13 2001/04/20 12:14:34 reno Exp $ + * $Id: ac3_rematrix.c,v 1.14 2001/04/26 11:23:16 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -41,7 +41,7 @@ struct rematrix_band_s { static const struct rematrix_band_s rematrix_band[] = { {13,24}, {25,36}, {37 ,60}, {61,252}}; -static __inline__ u32 min (u32 a, u32 b) +static __inline__ u32 min_value (u32 a, u32 b) { return (a < b ? a : b); } @@ -68,7 +68,7 @@ void rematrix (ac3dec_t * p_ac3dec) continue; start = rematrix_band[i].start; - end = min(rematrix_band[i].end ,12 * p_ac3dec->audblk.cplbegf + 36); + end = min_value(rematrix_band[i].end ,12 * p_ac3dec->audblk.cplbegf + 36); for (j=start;j < end; j++) { left = 0.5f * (p_ac3dec->coeffs.fbw[0][j] + p_ac3dec->coeffs.fbw[1][j]); -- 2.11.4.GIT