[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"
49 struct PAF_ASDT_Params;
50 struct PAF_ASDT_Patchs;
51 struct PAF_ASDT_Config;
53 // Audio Stream Decode Task (ASDT) parameters, functions
54 typedef struct PAF_ASDT_Fxns {
55 Int (*initPhase[8]) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *);
56 Int (*initFrame0) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *, Int);
57 Int (*initFrame1) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *, Int, Int);
59 // For RAM_report
60 Void (*headerPrint)();
61 Int (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
62 Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
63 Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
64 Void (*memStatusPrint)(HeapMem_Handle hInternalHeap, HeapMem_Handle hInternal1Heap, HeapMem_Handle hExternalHeap, HeapMem_Handle hInternal1HeapShm);
65 } PAF_ASDT_Fxns;
67 // Audio Stream Decode Task (ASDT) parameters
68 typedef struct PAF_ASDT_Params {
69 const PAF_ASDT_Fxns *fxns;
70 struct {
71 SmInt master;
72 SmInt decodes;
73 SmInt decode1;
74 SmInt decodeN;
75 SmInt streams;
76 } zone;
77 const SmInt *inputsFromDecodes;
78 struct {
79 int *pHeapIdIntern; //int *pIntern;
80 int *pHeapIdExtern; //int *pExtern;
81 int *pHeapIdFrmbuf; //int *pFrmbuf;
82 int *pHeapIdIntern1; //int *pIntern1;
83 int clear;
84 } heap;
85 struct {
86 const IALG_MemSpace *space;
87 } common;
88 const SmInt *z_numchan;
89 MdInt framelength;
90 const PAF_AudioFunctions *pAudioFrameFunctions;
91 const struct PAF_ASP_ChainFxns *pChainFxns;
92 const PAF_DecodeStatus * const *z_pDecodeStatus;
93 const PAF_ASP_AlgKey *pDecAlgKey;
94 const SmInt *streamsFromDecodes;
95 const MdInt maxFramelength;
96 const PAF_MetadataBufStatus *pMetadataBufStatus;
97 const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
98 } PAF_ASDT_Params;
100 // Audio Stream Decode Task (ASDT) patchs
101 typedef struct PAF_ASDT_Patchs {
102 const PAF_ASP_LinkInit * const (*i_decLinkInit);
103 const PAF_ASP_LinkInit * const (*i_aspLinkInit)[GEARS];
104 } PAF_ASDT_Patchs;
106 // Audio Stream Decode Task (ASDT) configuration
107 typedef struct PAF_ASDT_Config
108 {
109 ACP_Handle acp;
110 PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
111 } PAF_ASDT_Config;
114 // Purpose: Audio Stream Decode Task Function for initialization of data pointers
115 // by allocation of memory.
116 Int
117 PAF_ASDT_initPhaseMalloc(
118 const PAF_ASDT_Params *pP,
119 const PAF_ASDT_Patchs *pQ,
120 PAF_ASDT_Config *pC
121 );
123 // Purpose: Audio Stream Decode Task Function for initialization of data values
124 // from parameters.
125 Int
126 PAF_ASDT_initPhaseConfig(
127 const PAF_ASDT_Params *pP,
128 const PAF_ASDT_Patchs *pQ,
129 PAF_ASDT_Config *pC
130 );
132 // Purpose: Audio Stream Decode Task Function for initialization of ACP by
133 // instantiation of the algorithm.
134 Int
135 PAF_ASDT_initPhaseAcpAlg(
136 const PAF_ASDT_Params *pP,
137 const PAF_ASDT_Patchs *pQ,
138 PAF_ASDT_Config *pC
139 );
141 // Purpose: Audio Stream Decode Task Function for initialization of data pointers
142 // by allocation for common memory and by instantiation for
143 // algorithms.
144 Int
145 PAF_ASDT_initPhaseCommon(
146 const PAF_ASDT_Params *pP,
147 const PAF_ASDT_Patchs *pQ,
148 PAF_ASDT_Config *pC
149 );
151 // Purpose: Audio Stream Decode Task Function for initialization of data values
152 // from parameters for Algorithm Keys.
153 Int
154 PAF_ASDT_initPhaseAlgKey(
155 const PAF_ASDT_Params *pP,
156 const PAF_ASDT_Patchs *pQ,
157 PAF_ASDT_Config *pC
158 );
160 // Purpose: Audio Stream Decode Task Function for initialization of the Audio
161 // Frame(s) by memory allocation and loading of data pointers
162 // and values.
163 Int
164 PAF_ASDT_initFrame0(
165 const PAF_ASDT_Params *pP,
166 const PAF_ASDT_Patchs *pQ,
167 PAF_ASDT_Config *pC,
168 Int z
169 );
171 // Purpose: Audio Stream Task Function for initialization or reinitialization
172 // of the Audio Frame(s) by loading of data values of a
173 // time-varying nature.
174 Int
175 PAF_ASDT_initFrame1(
176 const PAF_ASDT_Params *pP,
177 const PAF_ASDT_Patchs *pQ,
178 PAF_ASDT_Config *pC,
179 Int z,
180 Int sourceSelect
181 );
183 // Reset AF, invoked during activate (INIT stage from Master)
184 Int resetAf(
185 const PAF_ASDT_Params *pP,
186 Int z,
187 Int sourceSelect
188 );
190 // Reset AF samsiz, invoked during DECODE
191 Int resetAfSamsiz(
192 Int z
193 );
196 #endif /* _ASDP_H_ */