Fix ARM params for custom ASDT params
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_arm / framework / itopo / params.c
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 // PAF_DEVICE_VERSION Symbol Definitions
39 #define PAF_DEVICE_VERSION (PAF_DEVICE & 0xffff)
41 #include <xdc/cfg/global.h>
42 //#include <ti/procsdk_audio/procsdk_audio_typ.h>
43 #include <procsdk_audio_typ.h>
45 #include <stdasp.h>
46 #include <pafsio_ialg.h>
48 #include "paf_heapMgr.h"
50 #include "asp1.h"
51 #include "audioStreamProc_params.h"
52 #include "audioStreamDecodeProc.h"
54 //
55 // Framework Declarations
56 //
58 //#define PAF_AST_params_fxnsPA PAF_AST_params_fxnsPA17
60 //
61 // Audio Data Representation Definitions
62 //
63 //   External declarations to patched IROM provide standard functionality.
64 //
66 #if 1
67 // FL: extern this, making it look like shared information between ARM/DSP.
68 // FL: Note could just define the same thing in separate file for ARM application (i.e. add "Slave" at end of identifier).
69 /* audio frame "width" in channels */
70 const SmInt PAF_AST_params_numchan[1] =
71 {
72     32,
73 };
74 #else
75 extern const SmInt PAF_AST_params_numchan[];
76 #endif
78 ///
79 // Audio Stream Processing Function Table Definition
80 //
82 const PAF_AudioFunctions PAF_ASDT_params_audioFrameFunctions =
83 {
84     &PAF_ASP_dB2ToLinear,
85     &PAF_ASP_channelMask,
86     &PAF_ASP_programFormat,
87     &PAF_ASP_sampleRateHz,
88     &PAF_ASP_delay,
89 };
91 //
92 // Source Select Array Declarations -- algorithm keys & sio map
93 //
94 //   External declarations to patched IROM provide standard functionality.
95 //
97 #if 1
98 // FL: extern this, making it look like shared information between ARM/DSP.
99 // FL: Note could just define the same thing in separate file for ARM application (i.e. add "Slave" at end of identifier).
100 const PAF_ASP_AlgKey PAF_ASP_params_decAlgKey =
102     PAF_SOURCE_N,                                           // length
103     /* Relies on the fact that ACP_SERIES_* != 0 here */
104     0,                                                      // PAF_SOURCE_UNKNOWN
105     0,                                                      // PAF_SOURCE_NONE
106     0,                                                      // PAF_SOURCE_PASS
107     PAF_ASP_ALPHACODE (STD, SNG),                           // PAF_SOURCE_SNG
108     0,                                                      // PAF_SOURCE_AUTO
109     0,                                                      // PAF_SOURCE_BITSTREAM
110     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTSALL
111     PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCMAUTO
112     PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCM
113     PAF_ASP_ALPHACODE (STD, PCN),                           // PAF_SOURCE_PC8 /* unused */
114     PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_AC3
115     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS
116     PAF_ASP_ALPHACODE (STD, AAC),                           // PAF_SOURCE_AAC
117     PAF_ASP_ALPHACODE (STD, MPG),                           // PAF_SOURCE_MPEG /* unused */
118     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS12
119     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS13
120     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS14
121     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS16
122     0,                                                      // PAF_SOURCE_WMA9PRO
123     0,                                                      // PAF_SOURCE_MP3
124     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD1
125     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD2
126     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD3
127     PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_DDP
128     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTSHD
129     PAF_ASP_ALPHACODE (STD, THD),                           // PAF_SOURCE_THD
130     PAF_ASP_ALPHACODE (STD, DXP),                           // PAF_SOURCE_DXP
131 };
132 #else
133 extern const PAF_ASP_AlgKey PAF_ASP_params_decAlgKey;
134 #endif
136 #if 1
137 // FL: This MUST be shared between ARM/DSP.
138 // FL: extern this, making it look like shared information between ARM/DSP.
139 //
140 // Mapping Declarations -- from *coders to *puts
141 //
142 //   External declarations to patched IROM provide standard functionality.
143 //
144 const SmInt PAF_AST_streamsFromDecodes_std[DECODEN_MAX] =
146     0, 1, 2,
147 };
148 #else
149 extern const SmInt PAF_AST_streamsFromDecodes_std[DECODEN_MAX];
150 #endif
152 const SmInt PAF_AST_inputsFromDecodes_std[DECODEN_MAX] =
154     0, 1, 2,
155 };
157 //
158 // Audio Framework Initialization Function Table Declarations
159 //
160 //   External declarations to patched IROM provide standard functionality.
161 //
163 extern const PAF_ASDT_Fxns PAF_ASDT_params_fxns;
165 #if 1
166 // FL: This MUST be shared between ARM/DSP.
167 // FL: extern this, making it look like shared information between ARM/DSP.
168 const PAF_DecodeStatus PAF_AST_params_decodeStatus_primary =
170     sizeof (PAF_DecodeStatus),                              // size
171     1,                                                      // mode
172     0,                                                      // unused1
173     0,                                                      // command.action
174     0,                                                      // command.result
175     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
176     PAF_SOURCE_NONE,                                        // sourceSelect
177     PAF_SOURCE_UNKNOWN,                                     // sourceProgram
178     PAF_SOURCE_UNKNOWN,                                     // sourceDecode
179     PAF_SOURCE_DUAL_STEREO,                                 // sourceDual
180     4,                                                      // sourceKaraoke: both
181     0,                                                      // aspGearControl: unused
182     0,                                                      // aspGearStatus: unused
183     0, 0, 0, 0,                                                // Unused
184     0, 0, 0, 0,                                                // Unused
185     0, 0, 0, 0,                                                // Unused
186     0, 0, 0, 0,                                                // Unused
187     0, 0, 0, 0,                                                // Unused
188     0,                                                      // frameCount
189     0x40,                                                   // karaoka: Vocal 1 Level
190     0x40,                                                   // karaoka: Vocal 1 Pan
191     0x40,                                                   // karaoka: Vocal 2 Level
192     0xc0,                                                   // karaoka: Vocal 2 Pan
193     0x40,                                                   // karaoka: Melody Level
194     0x00,                                                   // karaoka: Melody Pan
195     0,                                                      // decBypass
196     0,                                                      // unused
197     0,                                                         // frameLength: reset later
198     1,                                                      // bufferRatio: unity
199     PAF_IEC_PREEMPHASIS_UNKNOWN,                            // emphasis
200     0,                                                        // bufferDrift
201     0, 0,
202     PAF_CC_SAT_SURROUND4, PAF_CC_SUB_ONE, PAF_CC_AUX_SURROUND4_UNKNOWN, 0, 0, 0, 0, 0,    
203     // channelConfigurationRequest.full
204     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
205     // channelConfigurationProgram.full
206     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
207     // channelConfigurationDecode.full
208     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
209     // channelConfigurationDownmix.full
210     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
211     // channelConfigurationOverride.full 
212     -3,                                                     // channelMap.from[0]
213     -3,                                                     // channelMap.from[1]
214     -3,                                                     // channelMap.from[2]
215     -3,                                                     // channelMap.from[3]
216     -3,                                                     // channelMap.from[4]
217     -3,                                                     // channelMap.from[5]
218     -3,                                                     // channelMap.from[6]
219     -3,                                                     // channelMap.from[7]
220     -3,                                                     // channelMap.from[8]
221     -3,                                                     // channelMap.from[9]
222     -3,                                                     // channelMap.from[10]
223     -3,                                                     // channelMap.from[11]
224     -3,                                                     // channelMap.from[12]
225     -3,                                                     // channelMap.from[13]
226     -3,                                                     // channelMap.from[14]
227     -3,                                                     // channelMap.from[15]
228     -3,                                                     // channelMap.from[16]
229     -3,                                                     // channelMap.from[17]
230     -3,                                                     // channelMap.from[18]
231     -3,                                                     // channelMap.from[19]
232     -3,                                                     // channelMap.from[20]
233     -3,                                                     // channelMap.from[21]
234     -3,                                                     // channelMap.from[22]
235     -3,                                                     // channelMap.from[23]
236     -3,                                                     // channelMap.from[24]
237     -3,                                                     // channelMap.from[25]
238     -3,                                                     // channelMap.from[26]
239     -3,                                                     // channelMap.from[27]
240     -3,                                                     // channelMap.from[28]
241     -3,                                                     // channelMap.from[29]
242     -3,                                                     // channelMap.from[30]
243     -3,                                                     // channelMap.from[31]
244     -3,                                                     // channelMap.to[0]
245     -3,                                                     // channelMap.to[1]
246     -3,                                                     // channelMap.to[2]
247     -3,                                                     // channelMap.to[3]
248     -3,                                                     // channelMap.to[4]
249     -3,                                                     // channelMap.to[5]
250     -3,                                                     // channelMap.to[6]
251     -3,                                                     // channelMap.to[7]
252     -3,                                                     // channelMap.to[8]
253     -3,                                                     // channelMap.to[9]
254     -3,                                                     // channelMap.to[10]
255     -3,                                                     // channelMap.to[11]
256     -3,                                                     // channelMap.to[12]
257     -3,                                                     // channelMap.to[13]
258     -3,                                                     // channelMap.to[14]
259     -3,                                                     // channelMap.to[15]
260     -3,                                                     // channelMap.to[16]
261     -3,                                                     // channelMap.to[17]
262     -3,                                                     // channelMap.to[18]
263     -3,                                                     // channelMap.to[19]
264     -3,                                                     // channelMap.to[20]
265     -3,                                                     // channelMap.to[21]
266     -3,                                                     // channelMap.to[22]
267     -3,                                                     // channelMap.to[23]
268     -3,                                                     // channelMap.to[24]
269     -3,                                                     // channelMap.to[25]
270     -3,                                                     // channelMap.to[26]
271     -3,                                                     // channelMap.to[27]
272     -3,                                                     // channelMap.to[28]
273     -3,                                                     // channelMap.to[29]
274     -3,                                                     // channelMap.to[30]
275     -3,                                                     // channelMap.to[31]
276     0,                                                      // programFormat.mask
277     0,                                                      // programFormat.form
278    
279 };
280 #else
281 //extern const PAF_DecodeStatus PAF_AST_params_decodeStatus_primary;
282 #endif
284 #if 1
285 // FL: extern this, making it look like shared information between ARM/DSP.
286 // FL: Note could just define the same thing in separate file for ARM application (i.e. add "Slave" at end of identifier).
287 /* audio frame "width" in channels */
288 const PAF_DecodeStatus *const PAF_ASDT_params_decodeStatus[] =
290     &PAF_AST_params_decodeStatus_primary,
291 };
292 #else   
293 //extern const PAF_DecodeStatus *const PAF_AST_params_decodeStatus[];
294 #endif // FL: #if 0
296 //
297 // Common Space Parameter Declarations and Definitions
298 //
299 //   Local definitions in RAM provide non-standard functionality.
300 //   The NULL pointer provides standard functionality.
301 //
303 /* baseline definition - NULL equivalent */
304 /* May be used for overrides of IALG_MemSpace */
306 static const IALG_MemSpace params_memspace_PAi_Slave[] = {
307     PAF_IALG_NONE,                                          // Scratch
308     PAF_IALG_NONE,                                          // Persistant
309     PAF_IALG_NONE,                                          // Write once
310     PAF_IALG_NONE,                                          // Common 1
311     PAF_IALG_NONE,                                          // Common 2
312     PAF_IALG_NONE,                                          // Common 3
313     PAF_IALG_NONE,                                          // Common 4
314     PAF_IALG_NONE,                                          // Common 5
315     PAF_IALG_NONE,                                          // Common 6
316     PAF_IALG_NONE,                                          // Common 7
317     IALG_EXTERNAL,                                          // Common 8
318     PAF_IALG_NONE,                                          // Common 9
319     PAF_IALG_NONE,                                          // Common 10
320     PAF_IALG_NONE,                                          // Common 11
321     PAF_IALG_NONE,                                          // Common 12
322     PAF_IALG_NONE,                                          // Common 13
323     PAF_IALG_NONE,                                          // Common 14
324     PAF_IALG_NONE,                                          // Common 15
325 };
327 //
328 // Heap Declarations
329 //
331 //#include <pafhjt.h>
333 //extern int IRAM;
334 //extern int SDRAM;
335 //extern int L3RAM;
337 // .............................................................................
338 const PAF_MetadataBufStatus PAF_ASDT_params_MetadataBufStatus[] =
340     4 * 1024,               // bufSize
341     PAF_MAX_NUM_PRIVATE_MD, // NumBuf
342     128,                    // alignment
343     &gPafHeapIdExt //&SDRAM // &IRAM,        // pSpace
344 };
346 #if 0 // FL: maybe needed on ARM if there's an audio frame buffer defined for decode (and possible stream)
347 // .............................................................................
348 //
349 // This structure defines the memory allocation of audio frame buffers (channel buffers). Users can customize this structure based
350 // on their requirement. IALG_SARAM specifies the audio frame buffer is allocated in IRAM and IALG_EXTERNAL
351 // specifies the audio frame buffer is allocated in SDRAM. By allocating few channel buffers in SDRAM, users can save internal memory
352 // but trading performance
353 // This structure defined for PAF_MAXNUMCHAN number of channels. But channel buffers will be allocated  for "PAF_AST_params_numchan"
354 // number of channels only.
355 //
357 const PAF_AudioFrameBufStatus    PAF_AST_params_AudioFrameBufStatus[PAF_MAXNUMCHAN] =
359     IALG_SARAM, // 0
360     IALG_SARAM,
361     IALG_SARAM,
362     IALG_SARAM,
363     IALG_SARAM,
364     IALG_SARAM,
365     IALG_SARAM,
366     IALG_SARAM,
367     IALG_SARAM,
368     IALG_SARAM,
369     IALG_SARAM,
370     IALG_SARAM,
371     IALG_SARAM,
372     IALG_SARAM,
373     IALG_SARAM,
374     IALG_SARAM,
375     IALG_SARAM, // 16
376     IALG_SARAM,
377     IALG_SARAM,
378     IALG_SARAM,
379     IALG_SARAM,
380     IALG_SARAM,
381     IALG_SARAM,
382     IALG_SARAM,
383     IALG_SARAM,
384     IALG_SARAM,
385     IALG_SARAM,
386     IALG_SARAM,
387     IALG_SARAM,
388     IALG_SARAM,
389     IALG_SARAM,
390     IALG_SARAM, // 31
391     //IALG_EXTERNAL, // 16
392     //IALG_EXTERNAL,
393     //IALG_EXTERNAL,
394     //IALG_EXTERNAL,
395     //IALG_EXTERNAL,
396     //IALG_EXTERNAL,
397     //IALG_EXTERNAL,
398     //IALG_EXTERNAL,
399     //IALG_EXTERNAL,
400     //IALG_EXTERNAL,
401     //IALG_EXTERNAL,
402     //IALG_EXTERNAL,
403     //IALG_EXTERNAL,
404     //IALG_EXTERNAL,
405     //IALG_EXTERNAL,
406     //IALG_EXTERNAL // 31
407 };
408 #endif // FL: #if 0
410 // .............................................................................
411 //
412 // Audio Stream Parameter Definitions
413 //
414 //   Global definition in RAM provides standard & non-standard functionality.
415 //
417 const PAF_ASDT_Params asdp_params_PAi =
419     &PAF_ASDT_params_fxns,                                     // fxns
420     {                                                          // zone
421         0,                                                     // master
422         1,                                                     // decodes
423         0,                                                     // decode1
424         1,                                                     // decodeN
425         1,                                                     // streams
426     },
427     PAF_AST_inputsFromDecodes_std,
428     {                                                       // heap
429         &gPafHeapIdInt1,    //&IRAM                         // pIntern
430         &gPafHeapIdExt,     //&SDRAM,                       // pExtern
431         &gPafHeapIdInt1,    //&IRAM,                        // pFrmbuf
432         &gPafHeapIdInt1,    //&L3RAM,                       // pIntern1
433         1,                                                  // clear
434     },
435     {                                                       // common
436         params_memspace_PAi_Slave,                          // space
437     },
438     PAF_AST_params_numchan,                                 // z_numchan
439     256,                                                    // framelength
440     &PAF_ASDT_params_audioFrameFunctions,                   // pAudioFrameFunctions
441     &PAF_ASP_chainFxns,                                     // pChainFxns
442     PAF_ASDT_params_decodeStatus,                           // z_pDecodeStatus
443     &PAF_ASP_params_decAlgKey,                              // pDecAlgKey
444     PAF_AST_streamsFromDecodes_std,                         // streamsFromDecodes
445     1536,                                                   // maxFramelength
446     PAF_ASDT_params_MetadataBufStatus,                      //metadata buffer status
447     NULL //PAF_AST_params_AudioFrameBufStatus                      //Audio frame buffer status
448 };
450 // EOF