]> git.sesse.net Git - vlc/blob - src/ac3_decoder/ac3_exponent.c
* AC3 IMDCT and downmix functions are now in plugins, --imdct and
[vlc] / src / ac3_decoder / ac3_exponent.c
1 /*****************************************************************************
2  * ac3_exponent.c: ac3 exponent calculations
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: ac3_exponent.c,v 1.25 2001/05/15 16:19:42 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 "defs.h"
30
31 #include <string.h>                                    /* memcpy(), memset() */
32
33 #include "config.h"
34 #include "common.h"
35 #include "threads.h"
36 #include "mtime.h"
37
38 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
39
40 #include "stream_control.h"
41 #include "input_ext-dec.h"
42
43 #include "audio_output.h"
44
45 #include "ac3_imdct.h"
46 #include "ac3_downmix.h"
47 #include "ac3_decoder.h"
48
49 #include "ac3_internal.h"
50
51 #include "ac3_exponent.h"
52
53 int exponent_unpack (ac3dec_t * p_ac3dec)
54 {
55     u16 i;
56
57     for (i = 0; i < p_ac3dec->bsi.nfchans; i++)
58     {
59         if (exp_unpack_ch (p_ac3dec, UNPACK_FBW, p_ac3dec->audblk.chexpstr[i],
60                            p_ac3dec->audblk.nchgrps[i],
61                            p_ac3dec->audblk.exps[i][0],
62                            &p_ac3dec->audblk.exps[i][1],
63                            p_ac3dec->audblk.fbw_exp[i]))
64         {
65             return 1;
66         }
67     }
68
69     if (p_ac3dec->audblk.cplinu)
70     {
71         if (exp_unpack_ch (p_ac3dec, UNPACK_CPL, p_ac3dec->audblk.cplexpstr,
72                            p_ac3dec->audblk.ncplgrps,
73                            p_ac3dec->audblk.cplabsexp << 1,
74                            p_ac3dec->audblk.cplexps,
75                            &p_ac3dec->audblk.cpl_exp[p_ac3dec->audblk.cplstrtmant]))
76         {
77             return 1;
78         }
79     }
80
81     if (p_ac3dec->bsi.lfeon)
82     {
83         if (exp_unpack_ch (p_ac3dec, UNPACK_LFE, p_ac3dec->audblk.lfeexpstr,
84                            2, p_ac3dec->audblk.lfeexps[0],
85                            &p_ac3dec->audblk.lfeexps[1],
86                            p_ac3dec->audblk.lfe_exp))
87         {
88             return 1;
89         }
90     }
91
92     return 0;
93 }
94