]> git.sesse.net Git - vlc/blob - modules/codec/a52old/exponent.c
* ./modules/*: moved plugins to the new tree. Yet untested builds include
[vlc] / modules / codec / a52old / exponent.c
1 /*****************************************************************************
2  * exponent.c: A52 exponent calculations
3  *****************************************************************************
4  * Copyright (C) 1999-2001 VideoLAN
5  * $Id: exponent.c,v 1.1 2002/08/04 17:23: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 <string.h>                                    /* memcpy(), memset() */
30
31 #include <vlc/vlc.h>
32 #include <vlc/decoder.h>
33
34 #include "imdct.h"
35 #include "downmix.h"
36 #include "adec.h"
37
38 #include "internal.h"
39
40 #include "exponent.h"
41
42 int exponent_unpack (a52dec_t * p_a52dec)
43 {
44     u16 i;
45
46     for (i = 0; i < p_a52dec->bsi.nfchans; i++)
47     {
48         if (exp_unpack_ch (p_a52dec, UNPACK_FBW, p_a52dec->audblk.chexpstr[i],
49                            p_a52dec->audblk.nchgrps[i],
50                            p_a52dec->audblk.exps[i][0],
51                            &p_a52dec->audblk.exps[i][1],
52                            p_a52dec->audblk.fbw_exp[i]))
53         {
54             return 1;
55         }
56     }
57
58     if (p_a52dec->audblk.cplinu)
59     {
60         if (exp_unpack_ch (p_a52dec, UNPACK_CPL, p_a52dec->audblk.cplexpstr,
61                            p_a52dec->audblk.ncplgrps,
62                            p_a52dec->audblk.cplabsexp << 1,
63                            p_a52dec->audblk.cplexps,
64                            &p_a52dec->audblk.cpl_exp[p_a52dec->audblk.cplstrtmant]))
65         {
66             return 1;
67         }
68     }
69
70     if (p_a52dec->bsi.lfeon)
71     {
72         if (exp_unpack_ch (p_a52dec, UNPACK_LFE, p_a52dec->audblk.lfeexpstr,
73                            2, p_a52dec->audblk.lfeexps[0],
74                            &p_a52dec->audblk.lfeexps[1],
75                            p_a52dec->audblk.lfe_exp))
76         {
77             return 1;
78         }
79     }
80
81     return 0;
82 }
83