interface.h revision f3664ae9369a861ffbc2354e8e93e48983802062
1/*
2 ** Copyright 2003-2010, VisualOn, Inc.
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 **     http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16/*******************************************************************************
17	File:		interface.h
18
19	Content:	psychoaccoustic/quantizer structures and interface
20
21*******************************************************************************/
22
23#ifndef _INTERFACE_H
24#define _INTERFACE_H
25
26#include "config.h"
27#include "psy_const.h"
28#include "psy_data.h"
29#include "typedefs.h"
30
31
32enum
33{
34  MS_NONE = 0,
35  MS_SOME = 1,
36  MS_ALL  = 2
37};
38
39enum
40{
41  MS_ON = 1
42};
43
44struct TOOLSINFO {
45  Word16 msDigest;
46  Word16 msMask[MAX_GROUPED_SFB];
47};
48
49
50typedef struct {
51  Word16  sfbCnt;
52  Word16  sfbPerGroup;
53  Word16  maxSfbPerGroup;
54  Word16  windowSequence;
55  Word16  windowShape;
56  Word16  groupingMask;
57  Word16  sfbOffsets[MAX_GROUPED_SFB+1];
58  Word16  mdctScale;
59  Word32 *sfbEnergy;
60  Word32 *sfbSpreadedEnergy;
61  Word32 *sfbThreshold;
62  Word32 *mdctSpectrum;
63  Word32  sfbEnSumLR;
64  Word32  sfbEnSumMS;
65  Word32 sfbDist[MAX_GROUPED_SFB];
66  Word32 sfbDistNew[MAX_GROUPED_SFB];
67  Word16  sfbMinSnr[MAX_GROUPED_SFB];
68  Word16 minSfMaxQuant[MAX_GROUPED_SFB];
69  Word16 minScfCalculated[MAX_GROUPED_SFB];
70  Word16 prevScfLast[MAX_GROUPED_SFB];
71  Word16 prevScfNext[MAX_GROUPED_SFB];
72  Word16 deltaPeLast[MAX_GROUPED_SFB];
73  TNS_INFO tnsInfo;
74} PSY_OUT_CHANNEL; /* Word16 size: 14 + 60(MAX_GROUPED_SFB) + 112(TNS_INFO) = 186 */
75
76typedef struct {
77  struct TOOLSINFO toolsInfo;
78  Word16 groupedSfbOffset[MAX_CHANNELS][MAX_GROUPED_SFB+1];  /* plus one for last dummy offset ! */
79  Word16 groupedSfbMinSnr[MAX_CHANNELS][MAX_GROUPED_SFB];
80} PSY_OUT_ELEMENT;
81
82typedef struct {
83  /* information shared by both channels  */
84  PSY_OUT_ELEMENT  psyOutElement;
85  /* information specific to each channel */
86  PSY_OUT_CHANNEL  psyOutChannel[MAX_CHANNELS];
87}PSY_OUT;
88
89void BuildInterface(Word32                 *mdctSpectrum,
90                    const Word16            mdctScale,
91                    SFB_THRESHOLD          *sfbThreshold,
92                    SFB_ENERGY             *sfbEnergy,
93                    SFB_ENERGY             *sfbSpreadedEnergy,
94                    const SFB_ENERGY_SUM    sfbEnergySumLR,
95                    const SFB_ENERGY_SUM    sfbEnergySumMS,
96                    const Word16            windowSequence,
97                    const Word16            windowShape,
98                    const Word16            sfbCnt,
99                    const Word16           *sfbOffset,
100                    const Word16            maxSfbPerGroup,
101                    const Word16           *groupedSfbMinSnr,
102                    const Word16            noOfGroups,
103                    const Word16           *groupLen,
104                    PSY_OUT_CHANNEL        *psyOutCh);
105
106#endif /* _INTERFACE_H */
107