summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/aacdec/s_tdec_int_file.h
blob: d0ffb0b54733d1d3347f49d566a9b0c5eca66162 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/* ------------------------------------------------------------------
 * Copyright (C) 1998-2009 PacketVideo
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 * -------------------------------------------------------------------
 */
/*

 Pathname: s_tDec_Int_File.h

------------------------------------------------------------------------------
 REVISION HISTORY

 Description: Remove unneeded structure elements, clean up.

 Description: Remove block.h, not needed, chains in other not needed files.

 Description: Added declaration of scratch memory, scratchTnsDecCoefMem,
 which will be utilized by tns_decode_coef().

 Description:
 (1) Modified to include the lines...

    #ifdef __cplusplus
    extern "C" {
    #endif

    #ifdef __cplusplus
    }
    #endif

 (2) Updated the copyright header.

 Description: Per review comments...
 (1) Removed declaration of unused variable, savedMCInfo
 (2) Commented out ADTS related variables.
 (3) Slight re-wording of comment for clarity.

 Description:
 (1) Moved scratch_prog_config into the scratch union.

 Description:
 (1) Added ltp state variable.

 Description: Make tDec_Int_perChan an array of structures.
              In the user applications, the malloc command will allocate a
              continuous chunk of memory.

 Description:
           (1) Added the array data_stream_bytes[] to structure tDec_Int_File.
               This to support Data Streaming Elements (DSE).
           (2) Updated the copyright header.


 Who:                                       Date:
 Description:

------------------------------------------------------------------------------
 INCLUDE DESCRIPTION

 This include file defines the structure, tDec_Int_Chan

------------------------------------------------------------------------------
*/

/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef S_TDEC_INT_FILE_H
#define S_TDEC_INT_FILE_H

#ifdef __cplusplus
extern "C"
{
#endif

    /*----------------------------------------------------------------------------
    ; INCLUDES
    ----------------------------------------------------------------------------*/
#include "pv_audio_type_defs.h"
#include "s_progconfig.h"
#include "s_frameinfo.h"
#include "s_mc_info.h"
#include "s_adif_header.h"
#include "s_tdec_int_chan.h"
#include "s_pulseinfo.h"
#include "s_bits.h"
#include "s_hcb.h"
#include "e_infoinitconst.h"

#include "s_sbr_channel.h"
#include "s_sbr_dec.h"
#include "s_sbrbitstream.h"

    /*----------------------------------------------------------------------------
    ; MACROS
    ; Define module specific macros here
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; DEFINES
    ; Include all pre-processor statements here.
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; EXTERNAL VARIABLES REFERENCES
    ; Declare variables used in this module but defined elsewhere
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; SIMPLE TYPEDEF'S
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; ENUMERATED TYPEDEF'S
    ----------------------------------------------------------------------------*/

    /*----------------------------------------------------------------------------
    ; STRUCTURES TYPEDEF'S
    ----------------------------------------------------------------------------*/





    /*
     * Note: most of the names of the variables put into this structure were kept
     * the same because the name is also used in called functions.
     *
     * bno - block number
     *
     */
    typedef struct
    {
        UInt32         bno;
        Int            status;  /* save the status */

        bool           aacPlusEnabled;
        bool           aacConfigUtilityEnabled;

        Int            current_program;
        Int            frameLength;
        Int            adif_test;

        BITS           inputStream;

        ProgConfig     prog_config;

        Int            SFBWidth128[(1<<LEN_MAX_SFBS)];

        /*
         * One of the two arrays should be deleted in the final version.
         */
        FrameInfo      longFrameInfo;
        FrameInfo      shortFrameInfo;
        FrameInfo     *winmap[NUM_WIN_SEQ];

        /*
         * Pns variables.
         */
        Int32          pns_cur_noise_state;

        /*
         *
         */
        MC_Info        mc_info;

        Int            ltp_buffer_state;

        /*
         *  For eaac+, a scratch matrix is created with the rigth element ( perChan[1] is not used)
         *  and the fxpCoef matrix. These  2 matrices are [2][38][64] == 4864 Int32
         *    2349 coming from the perChan[1] plus 4096 coming from fxpCoef
         */
        tDec_Int_Chan  perChan[Chans];

        Int32          fxpCoef[2][LN];         /* LN  = 2048     */



#ifdef AAC_PLUS

        SBRDECODER_DATA sbrDecoderData;/* allocates 2 SBR_CHANNEL, each has a SBR_FRAME_DATA */
        SBR_DEC         sbrDec;
        SBRBITSTREAM    sbrBitStr;

#endif


        /*
         * If ADTS support is needed, the following variables will
         * be required.
         */
        UInt32         syncword;
        Int            invoke;

        Int         mask[MAXBANDS];
        Int         hasmask;


        /*  SBR usage
         *  These two unions are used for the SBR tool and used
         *  as a single 2560 int32 continuous memory for circular
         *  buffering the synthesis QMF's bank history
         */

        /* This union specifies memory for arrays which are used
         * by only one function.  This is the simplest type of scratch
         * memory to implement, since there are no worries about
         * function interaction.
         */
        union scratch_memory
        {
            Int32  fft[LONG_WINDOW];    /* 1024, as needed by the FFT */
            Int32  tns_inv_filter[TNS_MAX_ORDER];
            Int32  tns_decode_coef[2*TNS_MAX_ORDER];
            Int    huffbook_used[248];
            Int16  tmp_spec[LN2];  /* Used in conjunction with quant_spec */

            ADIF_Header    adif_header;

            ProgConfig     scratch_prog_config;


            Int32  scratch_mem[16][64];
        } scratch;

        /* This union tries to take advantage of the fact that
         * some variables are only used before LTP, and
         * the long array, predictedSamples, is only used after LTP.
         */

        /*
         *  also used by the circular buffer scheme on aac+ (needs 4096 + 1152)
         *  from scratch_mem[2] + 5248  (uses most of shared_memory).
         *  For eaac+, shared memory is used by sbrQmfBufferReal which needs
         *  1824 bytes
         */
        union shared_memory
        {
            Int32       predictedSamples[LONG_BLOCK1];  /* 2048 Int32 */

            Char        data_stream_bytes[(1<<LEN_D_CNT)+1];

            struct
            {
                Int16         quantSpec[LN2];
                SectInfo    sect[MAXBANDS + 1];
                PulseInfo   pulseInfo;
            } a;

        } share;


    } tDec_Int_File;

    /*----------------------------------------------------------------------------
    ; GLOBAL FUNCTION DEFINITIONS
    ; Function Prototype declaration
    ----------------------------------------------------------------------------*/

#ifdef __cplusplus
}
#endif

#endif /* S_TDEC_INT_FILE_H */