summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/aacdec/s_sbr_frame_data.h
blob: 89d1bb189e0a81e4200f80d628925a72c8725b58 (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
/* ------------------------------------------------------------------
 * 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.
 * -------------------------------------------------------------------
 */
/*

 Filename: s_sbr_frame_data.h
 Funtions:

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


 Who:                                   Date: MM/DD/YYYY
 Description:
------------------------------------------------------------------------------


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

/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include    "pv_audio_type_defs.h"
#include    "s_sbr_header_data.h"
#include    "e_invf_mode.h"
#include    "e_coupling_mode.h"
#include    "sbr_constants.h"
#include    "s_patch.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
----------------------------------------------------------------------------*/
typedef struct
{
    Int32 nScaleFactors;            /* total number of scalefactors in frame */
    Int32 nNoiseFactors;
    Int32 crcCheckSum;
    Int32 frameClass;
    Int32 frameInfo[LENGTH_FRAME_INFO];
    Int32 nSfb[2];
    Int32 nNfb;
    Int32 offset;
    Int32 ampRes;
    Int32 nNoiseFloorEnvelopes;
    Int32 p;
    Int32 prevEnvIsShort;

    Int32 reset_flag;


    SBR_HEADER_DATA sbr_header;


    /* dynamic control signals */
    Int32 domain_vec1[MAX_ENVELOPES];
    Int32 domain_vec2[MAX_ENVELOPES];


    INVF_MODE sbr_invf_mode[MAX_NUM_NOISE_VALUES];
    INVF_MODE sbr_invf_mode_prev[MAX_NUM_NOISE_VALUES];

    COUPLING_MODE coupling;               /*  3 possibilities: off, level, pan */


    Int32 addHarmonics[MAX_NUM_ENVELOPE_VALUES];

    /* Used by calc_sbr_envelope */
    Int32 hFp[64];
    Int32 harm_index;
    Int32 phase_index;
    Int32 sUp;

    /*
     *    envelope data
     */

    Int32 iEnvelope_man[MAX_NUM_ENVELOPE_VALUES]; /* mantissa */
    Int32 iEnvelope_exp[MAX_NUM_ENVELOPE_VALUES]; /* exponent */
    Int32 sfb_nrg_prev_man[MAX_FREQ_COEFFS];      /* mantissa */


    /*
     *    noise data
     */

    Int32 sbrNoiseFloorLevel_man[MAX_NUM_NOISE_VALUES]; /* mantissa */
    Int32 sbrNoiseFloorLevel_exp[MAX_NUM_NOISE_VALUES]; /* exponent */
    Int32 prevNoiseLevel_man[MAX_NUM_NOISE_VALUES]; /* mantissa */

    Int32  BwVector[MAX_NUM_PATCHES];
    Int32  BwVectorOld[MAX_NUM_PATCHES];
    /* Both implement a pseudo circular buffer  */

    /*
     * 40 ==  Biggest of  autoCorrLength(38) + sbrDec->bufReadOffs (2)  and
     *    sbrDec->noCols (32) + sbrDec->bufWriteOffs  (6)
     */
    Int32 codecQmfBufferReal[40][32];
    Int32 *sbrQmfBufferReal;
    Int32 HistsbrQmfBufferReal[6*SBR_NUM_BANDS];
#ifdef HQ_SBR
    Int32 codecQmfBufferImag[40][32];
    Int32 *sbrQmfBufferImag;
    Int32 HistsbrQmfBufferImag[6*SBR_NUM_BANDS];
#endif
    Int16  V[1152];     /* Used by calc_sbr_synfilterbank as freq. history buffer */


    Int32 degreeAlias[64];


#ifdef HQ_SBR

    Int32 fBuffer_man[5][64];        /* smoothing history buffers */
    Int32 fBufferN_man[5][64];
    Int32 fBuffer_exp[5][64];        /* smoothing history buffers */
    Int32 fBufferN_exp[5][64];

    Int32 *fBuf_man[64];        /* pointer to smoothing history buffers */
    Int32 *fBuf_exp[64];        /* pointer to smoothing history buffers */
    Int32 *fBufN_man[64];
    Int32 *fBufN_exp[64];


#endif

}
SBR_FRAME_DATA;


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


/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#endif