]> git.sesse.net Git - vlc/blob - plugins/ac3_adec/ac3_exponent.c
4f5b851eddadd2dab8f3bfe7f05f94c1025ff139
[vlc] / plugins / ac3_adec / ac3_exponent.c
1 /*****************************************************************************
2  * ac3_exponent.c: ac3 exponent calculations
3  *****************************************************************************
4  * Copyright (C) 1999-2001 VideoLAN
5  * $Id: ac3_exponent.c,v 1.6 2001/12/30 07:09:54 sam Exp $
6  *
7  * Authors: Michel Kaempf <maxx@via.ecp.fr>
8  *          Michel Lespinasse <walken@zoy.org>
9  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 /*****************************************************************************
27  * Preamble
28  *****************************************************************************/
29 #include <string.h>                                    /* memcpy(), memset() */
30
31 #include <videolan/vlc.h>
32
33 #include "audio_output.h"
34
35 #include "stream_control.h"
36 #include "input_ext-dec.h"
37
38 #include "ac3_imdct.h"
39 #include "ac3_downmix.h"
40 #include "ac3_decoder.h"
41
42 #include "ac3_internal.h"
43
44 #include "ac3_exponent.h"
45
46 int exponent_unpack (ac3dec_t * p_ac3dec)
47 {
48     u16 i;
49
50     for (i = 0; i < p_ac3dec->bsi.nfchans; i++)
51     {
52         if (exp_unpack_ch (p_ac3dec, UNPACK_FBW, p_ac3dec->audblk.chexpstr[i],
53                            p_ac3dec->audblk.nchgrps[i],
54                            p_ac3dec->audblk.exps[i][0],
55                            &p_ac3dec->audblk.exps[i][1],
56                            p_ac3dec->audblk.fbw_exp[i]))
57         {
58             return 1;
59         }
60     }
61
62     if (p_ac3dec->audblk.cplinu)
63     {
64         if (exp_unpack_ch (p_ac3dec, UNPACK_CPL, p_ac3dec->audblk.cplexpstr,
65                            p_ac3dec->audblk.ncplgrps,
66                            p_ac3dec->audblk.cplabsexp << 1,
67                            p_ac3dec->audblk.cplexps,
68                            &p_ac3dec->audblk.cpl_exp[p_ac3dec->audblk.cplstrtmant]))
69         {
70             return 1;
71         }
72     }
73
74     if (p_ac3dec->bsi.lfeon)
75     {
76         if (exp_unpack_ch (p_ac3dec, UNPACK_LFE, p_ac3dec->audblk.lfeexpstr,
77                            2, p_ac3dec->audblk.lfeexps[0],
78                            &p_ac3dec->audblk.lfeexps[1],
79                            p_ac3dec->audblk.lfe_exp))
80         {
81             return 1;
82         }
83     }
84
85     return 0;
86 }
87