[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_arm / framework / audioStreamDecodeProc.h
2 /*
3 Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
4 All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
36 /*
37 * ======== audioStreamDecdeProc.h ========
38 */
40 #ifndef _ASDP_H_
41 #define _ASDP_H_
43 #include <xdc/std.h>
45 #include "audioStreamProc_params.h"
46 #include "audioStreamProc_patchs.h"
47 #include "audioStreamProc_config.h"
48 #include "aspDecOpCircBuf_common.h"
50 struct PAF_ASDT_Params;
51 struct PAF_ASDT_Patchs;
52 struct PAF_ASDT_Config;
54 // Audio Stream Decode Task (ASDT) parameters, functions
55 typedef struct PAF_ASDT_Fxns {
56 Int (*initPhase[8]) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *);
57 Int (*initFrame0) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *, Int);
58 Int (*initFrame1) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *, Int, Int);
60 // For RAM_report
61 Void (*headerPrint)();
62 Int (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
63 Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
64 Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
65 Void (*memStatusPrint)(HeapMem_Handle hInternalHeap, HeapMem_Handle hInternal1Heap, HeapMem_Handle hExternalHeap, HeapMem_Handle hInternal1HeapShm);
66 } PAF_ASDT_Fxns;
68 // Audio Stream Decode Task (ASDT) parameters
69 typedef struct PAF_ASDT_Params {
70 const PAF_ASDT_Fxns *fxns;
71 struct {
72 SmInt master;
73 SmInt decodes;
74 SmInt decode1;
75 SmInt decodeN;
76 SmInt streams;
77 } zone;
78 const SmInt *inputsFromDecodes;
79 struct {
80 int *pHeapIdIntern; //int *pIntern;
81 int *pHeapIdExtern; //int *pExtern;
82 int *pHeapIdFrmbuf; //int *pFrmbuf;
83 int *pHeapIdIntern1; //int *pIntern1;
84 int clear;
85 } heap;
86 struct {
87 const IALG_MemSpace *space;
88 } common;
89 const SmInt *z_numchan;
90 MdInt framelength;
91 const PAF_AudioFunctions *pAudioFrameFunctions;
92 const struct PAF_ASP_ChainFxns *pChainFxns;
93 const PAF_DecodeStatus * const *z_pDecodeStatus;
94 const PAF_ASP_AlgKey *pDecAlgKey;
95 const SmInt *streamsFromDecodes;
96 const MdInt maxFramelength;
97 const PAF_MetadataBufStatus *pMetadataBufStatus;
98 const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
99 } PAF_ASDT_Params;
101 // Audio Stream Decode Task (ASDT) patchs
102 typedef struct PAF_ASDT_Patchs {
103 const PAF_ASP_LinkInit * const (*i_decLinkInit);
104 const PAF_ASP_LinkInit * const (*i_aspLinkInit)[GEARS];
105 } PAF_ASDT_Patchs;
107 // Audio Stream Decode Task (ASDT) configuration
108 typedef struct PAF_ASDT_Config
109 {
110 ACP_Handle acp;
111 PAF_AST_DecOpCircBufCtl decOpCircBufCtl; // decoder output circular buffer control
112 PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
113 } PAF_ASDT_Config;
116 // Purpose: Audio Stream Decode Task Function for initialization of data pointers
117 // by allocation of memory.
118 Int
119 PAF_ASDT_initPhaseMalloc(
120 const PAF_ASDT_Params *pP,
121 const PAF_ASDT_Patchs *pQ,
122 PAF_ASDT_Config *pC
123 );
125 // Purpose: Audio Stream Decode Task Function for initialization of data values
126 // from parameters.
127 Int
128 PAF_ASDT_initPhaseConfig(
129 const PAF_ASDT_Params *pP,
130 const PAF_ASDT_Patchs *pQ,
131 PAF_ASDT_Config *pC
132 );
134 // Purpose: Audio Stream Decode Task Function for initialization of ACP by
135 // instantiation of the algorithm.
136 Int
137 PAF_ASDT_initPhaseAcpAlg(
138 const PAF_ASDT_Params *pP,
139 const PAF_ASDT_Patchs *pQ,
140 PAF_ASDT_Config *pC
141 );
143 // Purpose: Audio Stream Decode Task Function for initialization of data pointers
144 // by allocation for common memory and by instantiation for
145 // algorithms.
146 Int
147 PAF_ASDT_initPhaseCommon(
148 const PAF_ASDT_Params *pP,
149 const PAF_ASDT_Patchs *pQ,
150 PAF_ASDT_Config *pC
151 );
153 // Purpose: Audio Stream Decode Task Function for initialization of data values
154 // from parameters for Algorithm Keys.
155 Int
156 PAF_ASDT_initPhaseAlgKey(
157 const PAF_ASDT_Params *pP,
158 const PAF_ASDT_Patchs *pQ,
159 PAF_ASDT_Config *pC
160 );
162 // Purpose: Audio Stream Decode Task Function for initialization of the Audio
163 // Frame(s) by memory allocation and loading of data pointers
164 // and values.
165 Int
166 PAF_ASDT_initFrame0(
167 const PAF_ASDT_Params *pP,
168 const PAF_ASDT_Patchs *pQ,
169 PAF_ASDT_Config *pC,
170 Int z
171 );
173 // Purpose: Audio Stream Task Function for initialization or reinitialization
174 // of the Audio Frame(s) by loading of data values of a
175 // time-varying nature.
176 Int
177 PAF_ASDT_initFrame1(
178 const PAF_ASDT_Params *pP,
179 const PAF_ASDT_Patchs *pQ,
180 PAF_ASDT_Config *pC,
181 Int z,
182 Int sourceSelect
183 );
185 // Reset AF, invoked during activate (INIT stage from Master)
186 Int resetAf(
187 const PAF_ASDT_Params *pP,
188 Int z,
189 Int sourceSelect
190 );
192 // Reset AF samsiz, invoked during DECODE
193 Int resetAfSamsiz(
194 Int z
195 );
197 extern PAF_ASDT_Config gPAF_ASDT_config;
199 #endif /* _ASDP_H_ */