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:		line_pe.h
18
19	Content:	Perceptual entropie module structure and functions
20
21*******************************************************************************/
22
23#ifndef __LINE_PE_H
24#define __LINE_PE_H
25
26
27#include "psy_const.h"
28#include "interface.h"
29
30
31typedef struct {
32   Word16 sfbLdEnergy[MAX_GROUPED_SFB];     /* 4*log(sfbEnergy)/log(2) */
33   Word16 sfbNLines4[MAX_GROUPED_SFB];      /* 4*number of relevant lines in sfb */
34   Word16 sfbPe[MAX_GROUPED_SFB];           /* pe for each sfb */
35   Word16 sfbConstPart[MAX_GROUPED_SFB];    /* constant part for each sfb */
36   Word16 sfbNActiveLines[MAX_GROUPED_SFB]; /* number of active lines in sfb */
37   Word16 pe;                               /* sum of sfbPe */
38   Word16 constPart;                        /* sum of sfbConstPart */
39   Word16 nActiveLines;                     /* sum of sfbNActiveLines */
40} PE_CHANNEL_DATA; /* size Word16: 303 */
41
42
43typedef struct {
44   PE_CHANNEL_DATA peChannelData[MAX_CHANNELS];
45   Word16 pe;
46   Word16 constPart;
47   Word16 nActiveLines;
48   Word16 offset;
49   Word16 ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB];
50   Word32 thrExp[MAX_CHANNELS][MAX_GROUPED_SFB];
51   Word32 sfbPeFactors[MAX_CHANNELS][MAX_GROUPED_SFB];
52} PE_DATA; /* size Word16: 303 + 4 + 120 + 240 = 667 */
53
54
55
56
57void prepareSfbPe(PE_DATA *peData,
58                  PSY_OUT_CHANNEL  psyOutChannel[MAX_CHANNELS],
59                  Word16 logSfbEnergy[MAX_CHANNELS][MAX_GROUPED_SFB],
60                  Word16 sfbNRelevantLines[MAX_CHANNELS][MAX_GROUPED_SFB],
61                  const Word16 nChannels,
62                  const Word16 peOffset);
63
64
65
66
67
68void calcSfbPe(PE_DATA *peData,
69               PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
70               const Word16 nChannels);
71
72
73
74
75#endif
76