]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamOutProc.h
Fix metadata buffer size in ARM/DSP params
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / framework / audioStreamOutProc.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  *  ======== audioStreamOutProc.h ========
38  */
40 #ifndef _ASOP_H_
41 #define _ASOP_H_
42  
43 #include <xdc/std.h>
45 #include "audioStreamProc_params.h"
46 #include "audioStreamProc_patchs.h"
47 #include "audioStreamProc_config.h"
48 #include "audioStreamProc_master.h"
50 // Global debug counter */
51 extern Uint32 gTaskAsopCnt; // debug counter for ASOP task
53 struct PAF_ASOT_Params;
54 struct PAF_ASOT_Patchs;
55 struct PAF_ASOT_Config;
57 // Audio Stream Output Task (ASOT) parameters, functions
58 typedef struct PAF_ASOT_Fxns {
59     Int (*initPhase[8]) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
60     Int (*initFrame0) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int);
61     Int (*initFrame1) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
62     //Int (*passProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
63     //Int (*passProcessingCopy) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
64     //Int (*autoProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, ALG_Handle);
65     Int (*decodeProcessing) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int);    
66     //Int (*decodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
67     Int (*encodeCommand) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
68     Int (*decodeInit) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int);
69     //Int (*decodeInfo) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
70     Int (*decodeInfo1) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
71     Int (*decodeInfo2) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
72     //Int (*decodeCont) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
73     //Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
74     Int (*decodeStream) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
75     Int (*decodeEncode) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
76     //Int (*decodeFinalTest) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);    
77     Int (*decodeComplete) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, ALG_Handle *, Int, Int);
78     Int (*selectDevices) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
79     //Int (*sourceDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
80     Int (*startOutput) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
81     Int (*stopOutput) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
82     Int (*setCheckRateX) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int);
83     Int (*streamChainFunction) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int, Int);
84     Int (*deviceAllocate) (SIO_Handle *, int, int, int, Ptr);
85     Int (*deviceSelect) (SIO_Handle *, int, int, Ptr);
86     //Int (*computeFrameLength) (Int, Int, Int);
87     //Int (*updateInputStatus) (SIO_Handle, PAF_InpBufStatus *, PAF_InpBufConfig *);
88     //Int (*copy) (Uns, PAF_InpBufConfig *, Uns, PAF_OutBufConfig *);
90     // For RAM_report
91     Void (*headerPrint)();
92     Int  (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
93     Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
94     Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
95     Void (*memStatusPrint)(HeapMem_Handle hInternalHeap, HeapMem_Handle hInternal1Heap, HeapMem_Handle hExternalHeap, HeapMem_Handle hInternal1HeapShm);
96 } PAF_ASOT_Fxns;
98 // Audio Stream Output Task (ASOT) parameters
99 typedef struct PAF_ASOT_Params {
100     const PAF_ASOT_Fxns *fxns;
101     struct {
102         SmInt master;
103         SmInt inputs;
104         SmInt input1;
105         SmInt inputN;
106         SmInt decodes;
107         SmInt decode1;
108         SmInt decodeN;
109         SmInt streams;
110         SmInt stream1; /* unused */
111         SmInt streamN; /* unused */
112         SmInt encodes;
113         SmInt encode1;
114         SmInt encodeN;
115         SmInt outputs;
116         SmInt output1;
117         SmInt outputN;
118     } zone;
119     const SmInt *inputsFromDecodes;
120     const SmInt *outputsFromEncodes;
121     struct {
122         int *pHeapIdIntern;   //int *pIntern;
123         int *pHeapIdExtern;   //int *pExtern;
124         int *pHeapIdInpbuf;   //int *pInpbuf;
125         int *pHeapIdOutbuf;   //int *pOutbuf;
126         int *pHeapIdFrmbuf;   //int *pFrmbuf;
127         int *pHeapIdIntern1;  //int *pIntern1;
128         int clear; 
129     } heap;
130     struct {
131         const IALG_MemSpace *space;
132     } common;
133     const LgInt *z_rx_bufsiz;
134     const LgInt *z_tx_bufsiz;
135     const SmInt *z_numchan;
136     MdInt framelength;
137     const PAF_AudioFunctions *pAudioFrameFunctions;
138     const struct PAF_ASP_ChainFxns *pChainFxns;
139     const PAF_InpBufStatus *pInpBufStatus;
140     const PAF_DecodeStatus * const *z_pDecodeStatus;
141     const PAF_OutBufStatus *pOutBufStatus;
142     const PAF_EncodeStatus * const *z_pEncodeStatus;
143     const PAF_VolumeStatus *pVolumeStatus;
144     const PAF_ASP_AlgKey *pDecAlgKey;
145     const PAF_ASP_AlgKey *pEncAlgKey;
146     const PAF_ASP_SioMap *pDecSioMap;
147     const SmInt *streamsFromDecodes;
148     const SmInt *streamsFromEncodes;
149     const MdInt maxFramelength;
150     const SmInt *streamOrder;
151     const PAF_ASP_LinkInit * const (*i_inpLinkInit);
152     const PAF_ASP_LinkInit * const (*i_outLinkInit);
153     const PAF_ASP_outNumBufMap *  const (*poutNumBufMap);
154     const PAF_MetadataBufStatus *pMetadataBufStatus;
155     const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
156 } PAF_ASOT_Params;
158 // Audio Stream Output Task (ASOT) patchs
159 typedef struct PAF_ASOT_Patchs {
160     //const PAF_SIO_ParamsN * devinp;
161     const PAF_SIO_ParamsN * devout;
162     //const PAF_ASP_LinkInit * const (*i_decLinkInit);
163     const PAF_ASP_LinkInit * const (*i_aspLinkInit)[GEARS];
164     const PAF_ASP_LinkInit * const (*i_encLinkInit);
165 } PAF_ASOT_Patchs;
167 // Audio Stream Input Task (ASOT) configuration
168 typedef struct PAF_ASOT_Config {
169     ACP_Handle acp;
170     PAF_ASPM_Config *pAspmCfg;  // ASIT/ASOT shared configuration
171     PAF_AST_Config *pAstCfg;    // ASIT/ASOT/ASDT shared configuration
172 } PAF_ASOT_Config;
175 //   Purpose:   Audio Stream Outpu Task Function for initialization of data pointers
176 //              by allocation of memory.
177 Int 
178 PAF_ASOT_initPhaseMalloc(
179     const PAF_ASOT_Params *pP, 
180     const PAF_ASOT_Patchs *pQ, 
181     PAF_ASOT_Config *pC
182 );
183     
184 //   Purpose:   Audio Stream Output Task Function for initialization of data values
185 //              from parameters.
186 Int
187 PAF_ASOT_initPhaseConfig(
188     const PAF_ASOT_Params *pP, 
189     const PAF_ASOT_Patchs *pQ, 
190     PAF_ASOT_Config *pC
191 );
193 //   Purpose:   Audio Stream Output Task Function for initialization of ACP by
194 //              instantiation of the algorithm.
195 Int
196 PAF_ASOT_initPhaseAcpAlg(
197     const PAF_ASOT_Params *pP, 
198     const PAF_ASOT_Patchs *pQ, 
199     PAF_ASOT_Config *pC
200 );
202 //   (***) FL: ASIT/ASOT currently consider common memory independently.
203 //             Should simultaneously consider all algs in ASIT/ASOT.
204 //   Purpose:   Audio Stream Output Task Function for allocation of common memory.
205 Int
206 PAF_ASOT_initPhaseCommon(
207     const PAF_ASOT_Params *pP, 
208     const PAF_ASOT_Patchs *pQ, 
209     PAF_ASOT_Config *pC
210 );
212 //   Purpose:   Audio Stream Output Task Function for initialization of ASP algorithms.
213 Int
214 PAF_ASOT_initPhaseAspAlg(
215     const PAF_ASOT_Params *pP, 
216     const PAF_ASOT_Patchs *pQ, 
217     PAF_ASOT_Config *pC
218 );
220 //   Purpose:   Audio Stream Output Task Function for initialization of data values
221 //              from parameters for Algorithm Keys.
222 Int
223 PAF_ASOT_initPhaseAlgKey(
224     const PAF_ASOT_Params *pP, 
225     const PAF_ASOT_Patchs *pQ, 
226     PAF_ASOT_Config *pC
227 );
229 //   Purpose:   Audio Stream Output Task Function for initialization of Input Devices.
230 Int
231 PAF_ASOT_initPhaseDevice(
232     const PAF_ASOT_Params *pP, 
233     const PAF_ASOT_Patchs *pQ, 
234     PAF_ASOT_Config *pC
235 );
237 //   Purpose:   Audio Stream Output Task Function for initialization of the Audio
238 //              Frame(s) by memory allocation and loading of data pointers
239 //              and values.
240 Int
241 PAF_ASOT_initFrame0(
242     const PAF_ASOT_Params *pP, 
243     const PAF_ASOT_Patchs *pQ, 
244     PAF_ASOT_Config *pC, 
245     Int z
246 );
248 //   Purpose:   Audio Stream Task Function for initialization or reinitiali-
249 //              zation of the Audio Frame(s) by loading of data values of a
250 //              time-varying nature.
251 Int
252 PAF_ASOT_initFrame1(
253     const PAF_ASOT_Params *pP, 
254     const PAF_ASOT_Patchs *pQ, 
255     PAF_ASOT_Config *pC, 
256     Int z, 
257     Int apply
258 );
260 //   Purpose:   Audio Stream Output Task Function for selecting the devices used
261 //              for output.
262 Int
263 PAF_ASOT_selectDevices(
264     const PAF_ASOT_Params *pP, 
265     const PAF_ASOT_Patchs *pQ, 
266     PAF_ASOT_Config *pC
267 );
269 //   Purpose:   Audio Stream Output Task Function for processing audio data.
270 //
271 Int
272 PAF_ASOT_decodeProcessing(
273     const PAF_ASOT_Params *pP, 
274     const PAF_ASOT_Patchs *pQ, 
275     PAF_ASOT_Config *pC, 
276     Int sourceSelect
277 );
279 //   Purpose:   Decoding Function for processing Encode Commands.
280 Int
281 PAF_ASOT_encodeCommand(
282     const PAF_ASOT_Params *pP, 
283     const PAF_ASOT_Patchs *pQ, 
284     PAF_ASOT_Config *pC
285 );
287 //   Purpose:   Decoding Function for reinitializing the decoding process.
288 Int
289 PAF_ASOT_decodeInit(
290     const PAF_ASOT_Params *pP, 
291     const PAF_ASOT_Patchs *pQ, 
292     PAF_ASOT_Config *pC, 
293     Int sourceSelect
294 );
296 //   Purpose:   Decoding Function for processing information in a manner that
297 //              is unique to initial frames of input data.
298 Int
299 PAF_ASOT_decodeInfo(
300     const PAF_ASOT_Params *pP, 
301     const PAF_ASOT_Patchs *pQ, 
302     PAF_ASOT_Config *pC, 
303     Int frame, 
304     Int block
305 );
307 //   Purpose:   Decoding Function for processing information in a manner that
308 //              is unique to initial frames of input data.
309 Int
310 PAF_ASOT_decodeInfo1(
311     const PAF_ASOT_Params *pP, 
312     const PAF_ASOT_Patchs *pQ, 
313     PAF_ASOT_Config *pC, 
314     Int frame, 
315     Int block
316 );
318 //   Purpose:   Decoding Function for processing information in a manner that
319 //              is unique to frames of input data other than the initial one.
320 Int
321 PAF_ASOT_decodeInfo2(
322     const PAF_ASOT_Params *pP, 
323     const PAF_ASOT_Patchs *pQ, 
324     PAF_ASOT_Config *pC, 
325     Int frame, 
326     Int block
327 );
329 //   Purpose:   Decoding Function for processing of audio frame data by the
330 //              ASP Algorithms.
331 Int
332 PAF_ASOT_decodeStream(
333     const PAF_ASOT_Params *pP, 
334     const PAF_ASOT_Patchs *pQ, 
335     PAF_ASOT_Config *pC, 
336     Int frame, 
337     Int block
338 );
340 //   Purpose:   Decoding Function for processing of audio frame data by the
341 //              Encode Algorithm.
342 Int
343 PAF_ASOT_decodeEncode(
344     const PAF_ASOT_Params *pP, 
345     const PAF_ASOT_Patchs *pQ, 
346     PAF_ASOT_Config *pC, 
347     Int frame, 
348     Int block
349 );
351 //   Purpose:   Decoding Function for terminating the decoding process.
352 Int
353 PAF_ASOT_decodeComplete(
354     const PAF_ASOT_Params *pP, 
355     const PAF_ASOT_Patchs *pQ, 
356     PAF_ASOT_Config *pC, 
357     ALG_Handle decAlg[], 
358     Int frame, 
359     Int block
360 );
362 //   Purpose:   Decoding Function for initiating output.
363 Int
364 PAF_ASOT_startOutput(
365     const PAF_ASOT_Params *pP, 
366     const PAF_ASOT_Patchs *pQ, 
367     PAF_ASOT_Config *pC
368 );
370 //   Purpose:   Decoding Function for terminating output.
371 Int
372 PAF_ASOT_stopOutput(
373     const PAF_ASOT_Params *pP, 
374     const PAF_ASOT_Patchs *pQ, 
375     PAF_ASOT_Config *pC
376 );
378 //   Purpose:   Decoding Function for re-initiating output.
379 Int
380 PAF_ASOT_setCheckRateX(
381     const PAF_ASOT_Params *pP, 
382     const PAF_ASOT_Patchs *pQ, 
383     PAF_ASOT_Config *pC, 
384     Int check
385 );
387 //   Purpose:   Common Function for processing algorithm chains.
388 Int
389 PAF_ASOT_streamChainFunction(
390     const PAF_ASOT_Params *pP, 
391     const PAF_ASOT_Patchs *pQ, 
392     PAF_ASOT_Config *pC, 
393     Int iChainFrameFxns, 
394     Int abortOnError, 
395     Int logArg
396 );
398 #endif /* _ASOP_H_ */