summaryrefslogtreecommitdiffstats
path: root/libAACenc/src/aacEnc_ram.cpp
blob: 3122bb8cf64697f6dda5a62d6b9b842ed3608455 (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
/******************************************************************************

                     (C) Copyright Fraunhofer IIS (2005)
                               All Rights Reserved

    Please be advised that this software and/or program delivery is
    Confidential Information of Fraunhofer and subject to and covered by the

    Fraunhofer IIS Software Evaluation Agreement
    between Google Inc. and  Fraunhofer
    effective and in full force since March 1, 2012.

    You may use this software and/or program only under the terms and
    conditions described in the above mentioned Fraunhofer IIS Software
    Evaluation Agreement. Any other and/or further use requires a separate agreement.


   This software and/or program is protected by copyright law and international
   treaties. Any reproduction or distribution of this software and/or program,
   or any portion of it, may result in severe civil and criminal penalties, and
   will be prosecuted to the maximum extent possible under law.

   $Id:
   Initial authors:      M. Lohwasser, M. Gayer
   Contents/description:

******************************************************************************/
/*!
  \file
  \brief  Memory layout  $Revision: 36838 $
  \author Markus Lohwasser
*/

#include "aacEnc_ram.h"

  C_ALLOC_MEM (AACdynamic_RAM, FIXP_DBL, AAC_ENC_DYN_RAM_SIZE/sizeof(FIXP_DBL))

/*
  Static memory areas, must not be overwritten in other sections of the decoder !
*/

/*
 The structure AacEncoder contains all Encoder structures.
*/

C_ALLOC_MEM (Ram_aacEnc_AacEncoder,           AAC_ENC,          1)


/*
   The structure PSY_INTERNAl contains all psych configuration and data pointer.
   * PsyStatic holds last and current Psych data.
   * PsyInputBuffer contains time input. Signal is needed at the beginning of Psych.
     Memory can be reused after signal is in time domain.
   * PsyData contains spectral, nrg and threshold information. Necessary data are
     copied into PsyOut, so memory is available after leaving psych.
   * TnsData, ChaosMeasure, PnsData are temporarily necessary, e.g. use memory from
     PsyInputBuffer.
*/

C_ALLOC_MEM2 (Ram_aacEnc_PsyElement, PSY_ELEMENT, 1, (6))

C_ALLOC_MEM  (Ram_aacEnc_PsyInternal, PSY_INTERNAL, 1)
C_ALLOC_MEM2 (Ram_aacEnc_PsyStatic,   PSY_STATIC,   1, (6))

C_ALLOC_MEM2 (Ram_aacEnc_PsyInputBuffer, INT_PCM, MAX_INPUT_BUFFER_SIZE, (6))

  PSY_DYNAMIC *GetRam_aacEnc_PsyDynamic (int n, UCHAR* dynamic_RAM) {
      FDK_ASSERT(dynamic_RAM!=0);
      return ((PSY_DYNAMIC*) (dynamic_RAM + P_BUF_1 + n*sizeof(PSY_DYNAMIC)));
  }

  C_ALLOC_MEM (Ram_bsOutbuffer, UCHAR, OUTPUTBUFFER_SIZE)

/*
   The structure PSY_OUT holds all psychoaccoustic data needed
   in quantization module
*/
C_ALLOC_MEM2 (Ram_aacEnc_PsyOut,         PSY_OUT, 1, (1))

C_ALLOC_MEM2 (Ram_aacEnc_PsyOutElements, PSY_OUT_ELEMENT, 1, (1)*(6))
C_ALLOC_MEM2 (Ram_aacEnc_PsyOutChannel,  PSY_OUT_CHANNEL, 1, (1)*(6))


/*
   The structure QC_STATE contains preinitialized settings and quantizer structures.
   * AdjustThreshold structure contains element-wise settings.
   * ElementBits contains elemnt-wise bit consumption settings.
   * When CRC is active, lookup table is necessary for fast crc calculation.
   * Bitcounter contains buffer to find optimal codebooks and minimal bit consumption.
     Values are temporarily, so dynamic memory can be used.
*/

C_ALLOC_MEM (Ram_aacEnc_QCstate, QC_STATE, 1)
C_ALLOC_MEM (Ram_aacEnc_AdjustThreshold, ADJ_THR_STATE, 1)

C_ALLOC_MEM2 (Ram_aacEnc_AdjThrStateElement, ATS_ELEMENT, 1, (6))
C_ALLOC_MEM2 (Ram_aacEnc_ElementBits, ELEMENT_BITS, 1, (6))
C_ALLOC_MEM (Ram_aacEnc_BitCntrState, BITCNTR_STATE, 1)

  INT *GetRam_aacEnc_BitLookUp(int n, UCHAR* dynamic_RAM) {
    FDK_ASSERT(dynamic_RAM!=0);
    return ((INT*) (dynamic_RAM + P_BUF_1));
  }
  INT *GetRam_aacEnc_MergeGainLookUp(int n, UCHAR* dynamic_RAM) {
    FDK_ASSERT(dynamic_RAM!=0);
    return ((INT*) (dynamic_RAM + P_BUF_1 + sizeof(INT)*(MAX_SFB_LONG*(CODE_BOOK_ESC_NDX+1))));
  }


/*
   The structure QC_OUT contains settings and structures holding all necessary information
   needed in bitstreamwriter.
*/

C_ALLOC_MEM2 (Ram_aacEnc_QCout, QC_OUT, 1, (1))
C_ALLOC_MEM2 (Ram_aacEnc_QCelement, QC_OUT_ELEMENT, 1, (1)*(6))
  QC_OUT_CHANNEL *GetRam_aacEnc_QCchannel (int n, UCHAR* dynamic_RAM) {
      FDK_ASSERT(dynamic_RAM!=0);
      return ((QC_OUT_CHANNEL*) (dynamic_RAM + P_BUF_0 + n*sizeof(QC_OUT_CHANNEL)));
  }