PASDK-218:Add rudimentary Dec Op CB status and alpha command interface
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / itopo / params.c
2 /*
3 Copyright (c) 2017, 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>
43 //#include <ti/procsdk_audio/procsdk_audio_typ.h>
44 #include <procsdk_audio_typ.h>
46 #include "paftyp.h"
47 #include "paf_ialg.h"
48 #include <stdasp.h>
49 #include <pafsio_ialg.h>
51 #include "paf_heapMgr.h"
53 #include "asp1.h"
54 #include "audioStreamProc_params.h"
55 #include "audioStreamInpProc.h"
56 #include "audioStreamOutProc.h"
58 #include "dbgBenchmark.h" // PCM high-sampling rate + SRC + CAR benchmarking
60 /* !!!!!!!!! Revisit !!!!!!!!!!!!!!
61  * Purpose : Temporary ASOT FL sizes.
62  *                       Deprecate PAF_SYS_FRAMELENGTH in phases.*/
63 #define PAF_ASOT_FRAMELENGTH            256
64 #define PAF_ASOT_MAX_FRAMELENGTH        1024
66 //
67 // Framework Declarations
68 //
70 //#define PAF_AST_params_fxnsPA PAF_AST_params_fxnsPA17
72 //
73 // Audio Data Representation Definitions
74 //
75 //   External declarations to patched IROM provide standard functionality.
76 //
78 /* audio frame "width" in channels */
80 const SmInt PAF_AST_params_numchan[1] =
81 {
82     32,
83 };
85 ///
86 // Audio Stream Processing Function Table Definition
87 //
89 const PAF_AudioFunctions PAF_AST_params_audioFrameFunctions =
90 {
91     &PAF_ASP_dB2ToLinear,
92     &PAF_ASP_channelMask,
93     &PAF_ASP_programFormat,
94     &PAF_ASP_sampleRateHz,
95     &PAF_ASP_delay,
96 };
98 //
99 // Source Select Array Declarations -- algorithm keys & sio map
100 //
101 //   External declarations to patched IROM provide standard functionality.
102 //
104 const PAF_ASP_AlgKey PAF_ASP_params_decAlgKey =
106     PAF_SOURCE_N,                                           // length
107     /* Relies on the fact that ACP_SERIES_* != 0 here */
108     0,                                                      // PAF_SOURCE_UNKNOWN
109     0,                                                      // PAF_SOURCE_NONE
110     0,                                                      // PAF_SOURCE_PASS
111     PAF_ASP_ALPHACODE (STD, SNG),                           // PAF_SOURCE_SNG
112     0,                                                      // PAF_SOURCE_AUTO
113     0,                                                      // PAF_SOURCE_BITSTREAM
114     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTSALL
115     PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCMAUTO
116     PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCM
117     PAF_ASP_ALPHACODE (STD, PCN),                           // PAF_SOURCE_PC8 /* unused */
118     PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_AC3
119     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS
120     PAF_ASP_ALPHACODE (STD, AAC),                           // PAF_SOURCE_AAC
121     PAF_ASP_ALPHACODE (STD, MPG),                           // PAF_SOURCE_MPEG /* unused */
122     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS12
123     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS13
124     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS14
125     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS16
126     0,                                                      // PAF_SOURCE_WMA9PRO
127     0,                                                      // PAF_SOURCE_MP3
128     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD1
129     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD2
130     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD3
131     PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_DDP
132     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTSHD
133     PAF_ASP_ALPHACODE (STD, THD),                           // PAF_SOURCE_THD
134     PAF_ASP_ALPHACODE (STD, DXP),                           // PAF_SOURCE_DXP
135 };
137 const PAF_ASP_AlgKey PAF_ASP_params_encAlgKey =
139     PAF_SOURCE_N,                                           // length
140     /* Relies on the fact that ACP_SERIES_* != 0 here */
141     0,                                                      // PAF_SOURCE_UNKNOWN
142     0,                                                      // PAF_SOURCE_NONE
143     0,                                                      // PAF_SOURCE_PASS
144     0,                                                      // PAF_SOURCE_SNG
145     0,                                                      // PAF_SOURCE_AUTO
146     0,                                                      // PAF_SOURCE_BITSTREAM
147     0,                                                      // PAF_SOURCE_DTSALL
148     0,                                                      // PAF_SOURCE_PCMAUTO
149     PAF_ASP_ALPHACODE (STD, PCE),                           // PAF_SOURCE_PCM
150     0,                                                      // PAF_SOURCE_PC8
151     0,                                                      // PAF_SOURCE_AC3
152     0,                                                      // PAF_SOURCE_DTS
153     0,                                                      // PAF_SOURCE_AAC
154     0,                                                      // PAF_SOURCE_MPEG
155     0,                                                      // PAF_SOURCE_DTS12
156     0,                                                      // PAF_SOURCE_DTS13
157     0,                                                      // PAF_SOURCE_DTS14
158     0,                                                      // PAF_SOURCE_DTS16
159     0,                                                      // PAF_SOURCE_WMA9PRO
160     PAF_ASP_ALPHACODE (STD, MPE),                           // PAF_SOURCE_MP3
161     0,                                                      // PAF_SOURCE_DSD1
162     0,                                                      // PAF_SOURCE_DSD2
163     0                                                       // PAF_SOURCE_DSD3
164 };
166 const PAF_ASP_SioMap PAF_ASP_params_decSioMap =
168     PAF_SOURCE_N,                                           // length
169     PAF_SOURCE_UNKNOWN,                                     // PAF_SOURCE_UNKNOWN -> ...
170     PAF_SOURCE_NONE,                                        // PAF_SOURCE_NONE -> ...
171     PAF_SOURCE_PASS,                                        // PAF_SOURCE_PASS -> ...
172     PAF_SOURCE_PCM,                                         // PAF_SOURCE_SNG -> PCM
173     PAF_SOURCE_AUTO,                                        // PAF_SOURCE_AUTO -> ...
174     PAF_SOURCE_BITSTREAM,                                   // PAF_SOURCE_BITSTREAM -> ...
175     PAF_SOURCE_DTSALL,                                      // PAF_SOURCE_UNUSED1 -> ...
176     PAF_SOURCE_PCMAUTO,                                     // PAF_SOURCE_UNUSED2 -> ...
177     PAF_SOURCE_PCM,                                         // PAF_SOURCE_PCM -> ...
178     PAF_SOURCE_PC8,                                         // PAF_SOURCE_PC8 -> ...
179     PAF_SOURCE_AC3,                                         // PAF_SOURCE_AC3 -> ...
180     PAF_SOURCE_DTS,                                         // PAF_SOURCE_DTS -> ...
181     PAF_SOURCE_AAC,                                         // PAF_SOURCE_AAC -> ...
182     PAF_SOURCE_MPEG,                                        // PAF_SOURCE_MPEG -> ...
183     PAF_SOURCE_DTS12,                                       // PAF_SOURCE_DTS12 -> ...
184     PAF_SOURCE_DTS13,                                       // PAF_SOURCE_DTS13 -> ...
185     PAF_SOURCE_DTS14,                                       // PAF_SOURCE_DTS14 -> ...
186     PAF_SOURCE_DTS16,                                       // PAF_SOURCE_DTS16 -> ...
187     PAF_SOURCE_WMA9PRO,                                     // PAF_SOURCE_WMA9PRO -> ...
188     PAF_SOURCE_MP3,                                         // PAF_SOURCE_MP3 -> ...
189     PAF_SOURCE_DSD1,                                        // PAF_SOURCE_DSD1 -> ...
190     PAF_SOURCE_DSD2,                                        // PAF_SOURCE_DSD2 -> ...
191     PAF_SOURCE_DSD3,                                        // PAF_SOURCE_DSD3 -> ...
192     PAF_SOURCE_DDP,                                         // PAF_SOURCE_DDP -> ...
193     PAF_SOURCE_DTSHD,                                       // PAF_SOURCE_DTSHD -> ...
194     PAF_SOURCE_THD,                                         // PAF_SOURCE_THD -> ...
195     PAF_SOURCE_DXP,                                         // PAF_SOURCE_DXP -> ...
196 };
198 //
199 // Mapping Declarations -- from *coders to *puts
200 //
201 //   External declarations to patched IROM provide standard functionality.
202 //
203 const SmInt PAF_AST_streamsFromDecodes_std[DECODEN_MAX] =
205     0, 1, 2,
206 };
207 const SmInt PAF_AST_streamsFromEncodes_std[ENCODEN_MAX] =
209     0, 1, 2,
210 };
211 const SmInt PAF_AST_inputsFromDecodes_std[DECODEN_MAX] =
213     0, 1, 2,
214 };
215 extern const SmInt PAF_AST_outputsFromEncodes_std[ENCODEN_MAX];
216 #ifndef __TI_EABI__
217 asm ("_PAF_AST_outputsFromEncodes_std .set _PAF_AST_inputsFromDecodes_std");
218 #else
219 asm ("PAF_AST_outputsFromEncodes_std .set PAF_AST_inputsFromDecodes_std");
220 #endif
222 //
223 // Setting of audio stream order
224 //
226 const SmInt PAF_AST_streamOrder[1] =
228     0,
229 };
231 //
232 // Audio Framework Initialization Function Table Declarations
233 //
234 //   External declarations to patched IROM provide standard functionality.
235 //
237 extern const PAF_ASIT_Fxns PAF_ASIT_params_fxns;
239 //
240 // Audio Framework Status Initialization Declarations
241 //
242 //   External declarations to patched IROM provide standard functionality.
243 //
245 const PAF_InpBufStatus PAF_AST_params_inpBufStatus =
247     sizeof (PAF_InpBufStatus),                              // size
248     0,                                                      // mode
249     0,                                                      // sioSelect
250     0x80,                                                   // lockOverride = none
251     0,                                                      // unused
252     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRateOverride
253     PAF_SAMPLERATE_NONE,                                    // sampleRateData
254     PAF_SAMPLERATE_NONE,                                    // sampleRateMeasured
255     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRateStatus
256     PAF_IEC_AUDIOMODE_UNKNOWN,                              // nonaudio
257     PAF_IEC_PREEMPHASIS_UNKNOWN,                            // emphasisData
258     0,                                                      // emphasisOverride
259     PAF_IEC_PREEMPHASIS_NO,                                 // emphasisStatus
260     0,                                                      // lock
261     0,                                                      // scanAtHighSampleRateMode
262     0,                                                      // zeroRun
263     0,                                                      // unused2[1] // FL: rateTrackMode
264     24,                                                     // precisionDefault
265     -1,                                                     // precisionDetect
266     0,                                                      // precisionOverride
267     0,                                                      // precisionInput
268     100,                                                    // zeroRunTrigger
269     100,                                                    // zeroRunRestart
270     2048,                                                   // unknownTimeout
271     0,                                                      // lastFrameMask
272     0,                                                      // lastFrameFlag
273     0,                                                      // reportDTS16AsDTSForLargeSampleRate
274     0, 0                                                    // reserved
275 };
277 #if 0 // FL: slave
278 const PAF_DecodeStatus PAF_AST_params_decodeStatus_primary =
280     sizeof (PAF_DecodeStatus),                              // size
281     1,                                                      // mode
282     0,                                                      // unused1
283     0,                                                      // command.action
284     0,                                                      // command.result
285     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
286     PAF_SOURCE_NONE,                                        // sourceSelect
287     PAF_SOURCE_UNKNOWN,                                     // sourceProgram
288     PAF_SOURCE_UNKNOWN,                                     // sourceDecode
289     PAF_SOURCE_DUAL_STEREO,                                 // sourceDual
290     4,                                                      // sourceKaraoke: both
291     0,                                                      // aspGearControl: unused
292     0,                                                      // aspGearStatus: unused
293     0, 0, 0, 0,                                             // Unused
294     0, 0, 0, 0,                                             // Unused
295     0, 0, 0, 0,                                             // Unused
296     0, 0, 0, 0,                                             // Unused
297     0, 0, 0, 0,                                             // Unused
298     0,                                                      // frameCount
299     0x40,                                                   // karaoka: Vocal 1 Level
300     0x40,                                                   // karaoka: Vocal 1 Pan
301     0x40,                                                   // karaoka: Vocal 2 Level
302     0xc0,                                                   // karaoka: Vocal 2 Pan
303     0x40,                                                   // karaoka: Melody Level
304     0x00,                                                   // karaoka: Melody Pan
305     0,                                                      // decBypass
306     0,                                                      // unused
307     0,                                                      // frameLength: reset later
308     1,                                                      // bufferRatio: unity
309     PAF_IEC_PREEMPHASIS_UNKNOWN,                            // emphasis
310     0,                                                      // bufferDrift
311     0, 0,
312     PAF_CC_SAT_SURROUND4, PAF_CC_SUB_ONE, PAF_CC_AUX_SURROUND4_UNKNOWN, 0, 0, 0, 0, 0,    
313     // channelConfigurationRequest.full
314     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
315     // channelConfigurationProgram.full
316     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
317     // channelConfigurationDecode.full
318     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
319     // channelConfigurationDownmix.full
320     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
321     // channelConfigurationOverride.full 
322     -3,                                                     // channelMap.from[0]
323     -3,                                                     // channelMap.from[1]
324     -3,                                                     // channelMap.from[2]
325     -3,                                                     // channelMap.from[3]
326     -3,                                                     // channelMap.from[4]
327     -3,                                                     // channelMap.from[5]
328     -3,                                                     // channelMap.from[6]
329     -3,                                                     // channelMap.from[7]
330     -3,                                                     // channelMap.from[8]
331     -3,                                                     // channelMap.from[9]
332     -3,                                                     // channelMap.from[10]
333     -3,                                                     // channelMap.from[11]
334     -3,                                                     // channelMap.from[12]
335     -3,                                                     // channelMap.from[13]
336     -3,                                                     // channelMap.from[14]
337     -3,                                                     // channelMap.from[15]
338     -3,                                                     // channelMap.from[16]
339     -3,                                                     // channelMap.from[17]
340     -3,                                                     // channelMap.from[18]
341     -3,                                                     // channelMap.from[19]
342     -3,                                                     // channelMap.from[20]
343     -3,                                                     // channelMap.from[21]
344     -3,                                                     // channelMap.from[22]
345     -3,                                                     // channelMap.from[23]
346     -3,                                                     // channelMap.from[24]
347     -3,                                                     // channelMap.from[25]
348     -3,                                                     // channelMap.from[26]
349     -3,                                                     // channelMap.from[27]
350     -3,                                                     // channelMap.from[28]
351     -3,                                                     // channelMap.from[29]
352     -3,                                                     // channelMap.from[30]
353     -3,                                                     // channelMap.from[31]
354     -3,                                                     // channelMap.to[0]
355     -3,                                                     // channelMap.to[1]
356     -3,                                                     // channelMap.to[2]
357     -3,                                                     // channelMap.to[3]
358     -3,                                                     // channelMap.to[4]
359     -3,                                                     // channelMap.to[5]
360     -3,                                                     // channelMap.to[6]
361     -3,                                                     // channelMap.to[7]
362     -3,                                                     // channelMap.to[8]
363     -3,                                                     // channelMap.to[9]
364     -3,                                                     // channelMap.to[10]
365     -3,                                                     // channelMap.to[11]
366     -3,                                                     // channelMap.to[12]
367     -3,                                                     // channelMap.to[13]
368     -3,                                                     // channelMap.to[14]
369     -3,                                                     // channelMap.to[15]
370     -3,                                                     // channelMap.to[16]
371     -3,                                                     // channelMap.to[17]
372     -3,                                                     // channelMap.to[18]
373     -3,                                                     // channelMap.to[19]
374     -3,                                                     // channelMap.to[20]
375     -3,                                                     // channelMap.to[21]
376     -3,                                                     // channelMap.to[22]
377     -3,                                                     // channelMap.to[23]
378     -3,                                                     // channelMap.to[24]
379     -3,                                                     // channelMap.to[25]
380     -3,                                                     // channelMap.to[26]
381     -3,                                                     // channelMap.to[27]
382     -3,                                                     // channelMap.to[28]
383     -3,                                                     // channelMap.to[29]
384     -3,                                                     // channelMap.to[30]
385     -3,                                                     // channelMap.to[31]
386     0,                                                      // programFormat.mask
387     0,                                                      // programFormat.form
388    
389 };
390 const PAF_DecodeStatus *const PAF_AST_params_decodeStatus[] =
392     &PAF_AST_params_decodeStatus_primary,
393 };
394 #endif // #if 0
396 const PAF_OutBufStatus PAF_AST_params_outBufStatus =
398     sizeof (PAF_OutBufStatus),                              // size
399     1,                                                      // mode
400     0,                                                      // sioSelect
401     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
402     0,                                                      // audio
403     PAF_OB_CLOCK_INTERNAL,                                  // clock
404     PAF_OB_FLUSH_DISABLE,                                    // flush           !!! FLUSH_ENABLE not supported, yet !!!
405     0,                                                      // rateTrackMode // unused
406     PAF_OB_MARKER_DISABLED,                                 // markerMode
407     0,                                                      // maxNumBufOverride
408                                                             // this is the start of numBufOverride[PAF_SOURCE_N]                                                            
409     0,                                                      // PAF_SOURCE_UNKNOWN
410     0,                                                      // PAF_SOURCE_NONE
411     0,                                                      // PAF_SOURCE_PASS
412     0,                                                      // PAF_SOURCE_SNG
413     0,                                                      // PAF_SOURCE_AUTO
414     0,                                                      // PAF_SOURCE_BITSTREAM
415     0,                                                      // PAF_SOURCE_DTSALL
416     0,                                                      // PAF_SOURCE_PCMAUTO
417     0,                                                      // PAF_SOURCE_PCM
418     0,                                                      // PAF_SOURCE_PC8
419     0,                                                      // PAF_SOURCE_AC3
420     0,                                                      // PAF_SOURCE_DTS
421     0,                                                      // PAF_SOURCE_AAC
422     0,                                                      // PAF_SOURCE_MPEG
423     0,                                                      // PAF_SOURCE_DTS12
424     0,                                                      // PAF_SOURCE_DTS13
425     0,                                                      // PAF_SOURCE_DTS14
426     0,                                                      // PAF_SOURCE_DTS16
427     0,                                                      // PAF_SOURCE_WMA9PRO
428     0,                                                      // PAF_SOURCE_MP3
429     0,                                                      // PAF_SOURCE_DSD1,
430     0,                                                      // PAF_SOURCE_DSD2,
431     0,                                                      // PAF_SOURCE_DSD3,
432     0,                                                      // PAF_SOURCE_DDP
433     0,                                                      // PAF_SOURCE_DTSHD
434     0,                                                      // PAF_SOURCE_THD
435     0,                                                      // PAF_SOURCE_DXP                                                          
436 };
438 const PAF_EncodeStatus PAF_AST_params_encodeStatus_primary =
440     sizeof (PAF_EncodeStatus),                              // size
441     1,                                                      // mode
442     0,                                                      // command2
443     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
444     0,                                                      // channelCount
445     0, 0, 0, 0,                                             // Unused                                        
446     0, 0, 0, 0,                                             // Unused
447     0, 0, 0, 0,                                             // Unused
448     0, 0, 0, 0,                                             // Unused
449     0, 0, 0, 0,                                             // Unused
450     0,                                                      // frameLength
451     0,                                                      // encBypass
452     PAF_SOURCE_PCM,                                         // select
453     // channelConfigurationRequest.full
454     PAF_CC_SAT_SURROUND4, PAF_CC_SUB_ONE, PAF_CC_AUX_SURROUND4_UNKNOWN, 0,0,0,0,0,
455     // channelConfigurationStream.full
456     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0,0,0,0,0,
457     // channelConfigurationEncode.full
458     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0,0,0,0,0,    
459     0, 0, 0, 0,    0, 0, 0, 0,                              // Unused
460     -3,                                                     // channelMap.from[0]
461     -3,                                                     // channelMap.from[1]
462     -3,                                                     // channelMap.from[2]
463     -3,                                                     // channelMap.from[3]
464     -3,                                                     // channelMap.from[4]
465     -3,                                                     // channelMap.from[5]
466     -3,                                                     // channelMap.from[6]
467     -3,                                                     // channelMap.from[7]
468     -3,                                                     // channelMap.from[8]
469     -3,                                                     // channelMap.from[9]
470     -3,                                                     // channelMap.from[10]
471     -3,                                                     // channelMap.from[11]
472     -3,                                                     // channelMap.from[12]
473     -3,                                                     // channelMap.from[13]
474     -3,                                                     // channelMap.from[14]
475     -3,                                                     // channelMap.from[15]
476     -3,                                                     // channelMap.from[16]
477     -3,                                                     // channelMap.from[17]
478     -3,                                                     // channelMap.from[18]
479     -3,                                                     // channelMap.from[19]
480     -3,                                                     // channelMap.from[20]
481     -3,                                                     // channelMap.from[21]
482     -3,                                                     // channelMap.from[22]
483     -3,                                                     // channelMap.from[23]
484     -3,                                                     // channelMap.from[24]
485     -3,                                                     // channelMap.from[25]
486     -3,                                                     // channelMap.from[26]
487     -3,                                                     // channelMap.from[27]
488     -3,                                                     // channelMap.from[27]
489     -3,                                                     // channelMap.from[28]
490     -3,                                                     // channelMap.from[30]
491     -3,                                                     // channelMap.from[31]
492     -3,                                                     // channelMap.to[0]
493     -3,                                                     // channelMap.to[1]
494     -3,                                                     // channelMap.to[2]
495     -3,                                                     // channelMap.to[3]
496     -3,                                                     // channelMap.to[4]
497     -3,                                                     // channelMap.to[5]
498     -3,                                                     // channelMap.to[6]
499     -3,                                                     // channelMap.to[7]
500     -3,                                                     // channelMap.to[8]
501     -3,                                                     // channelMap.to[9]
502     -3,                                                     // channelMap.to[10]
503     -3,                                                     // channelMap.to[11]
504     -3,                                                     // channelMap.to[12]
505     -3,                                                     // channelMap.to[13]
506     -3,                                                     // channelMap.to[14]
507     -3,                                                     // channelMap.to[15]
508     -3,                                                     // channelMap.to[16]
509     -3,                                                     // channelMap.to[17]
510     -3,                                                     // channelMap.to[18]
511     -3,                                                     // channelMap.to[19]
512     -3,                                                     // channelMap.to[20]
513     -3,                                                     // channelMap.to[21]
514     -3,                                                     // channelMap.to[22]
515     -3,                                                     // channelMap.to[23]
516     -3,                                                     // channelMap.to[24]
517     -3,                                                     // channelMap.to[25]
518     -3,                                                     // channelMap.to[26]
519     -3,                                                     // channelMap.to[27]
520     -3,                                                     // channelMap.to[28]
521     -3,                                                     // channelMap.to[29]
522     -3,                                                     // channelMap.to[30]
523     -3,                                                     // channelMap.to[31]
524     1,                                                      // programFormat.mask
525     0,                                                      // programFormat.form
526     0,                                                      // listeningFormat.mask
527     0,                                                      // listeningFormat.form
528     0,                                                      // sampleProcess[0]
529     0, 0, 0, 0,                                             // Unused     
530     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,  // channelConfigurationCompact                                      
531     0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, //channelCompact[PAF_MAXNUMCHAN_HD]
532 };
533                                        
537 const PAF_EncodeStatus *const PAF_AST_params_encodeStatus[] =
539     &PAF_AST_params_encodeStatus_primary,
540 };
542 const PAF_VolumeStatus PAF_AST_params_volumeStatus =
544     sizeof (PAF_VolumeStatus),                              // size
545     1,                                                      // mode
546     PAF_MAXNUMCHAN,                                         // channelCount
547     0x0f,                                                   // implementation
548     0,                                                      // unused1
549     50,                                                     // rampTime: 50 msec/dB (20 dB/sec)
550     0,                                                      // unused2
551     0,                                                      // unused3
552     -2 * 20, 0, 0, 0,                                       // master
553     -2 * 0, 0, 0, 0,                                        // trim
554     -2 * 0, 0, 0, 0,                                        //
555     -2 * 0, 0, 0, 0,                                        //
556     -2 * 0, 0, 0, 0,                                        //
557     -2 * 0, 0, 0, 0,                                        //
558     -2 * 0, 0, 0, 0,                                        //
559     -2 * 0, 0, 0, 0,                                        //
560     -2 * 0, 0, 0, 0,                                        //
561     -2 * 0, 0, 0, 0,                                        //
562     -2 * 0, 0, 0, 0,                                        //
563     -2 * 0, 0, 0, 0,                                        //
564     -2 * 0, 0, 0, 0,                                        //
565     -2 * 0, 0, 0, 0,                                        //
566     -2 * 0, 0, 0, 0,                                        //
567     -2 * 0, 0, 0, 0,                                        //
568     -2 * 0, 0, 0, 0,                                        //  
569     -2 * 0, 0, 0, 0,                                        // trim - upper16
570     -2 * 0, 0, 0, 0,                                        //
571     -2 * 0, 0, 0, 0,                                        //
572     -2 * 0, 0, 0, 0,                                        //
573     -2 * 0, 0, 0, 0,                                        //
574     -2 * 0, 0, 0, 0,                                        //
575     -2 * 0, 0, 0, 0,                                        //
576     -2 * 0, 0, 0, 0,                                        //
577     -2 * 0, 0, 0, 0,                                        //
578     -2 * 0, 0, 0, 0,                                        //
579     -2 * 0, 0, 0, 0,                                        //
580     -2 * 0, 0, 0, 0,                                        //
581     -2 * 0, 0, 0, 0,                                        //
582     -2 * 0, 0, 0, 0,                                        //
583     -2 * 0, 0, 0, 0,                                        //
584     -2 * 0, 0, 0, 0,                                        //
586 };
588 //
589 // Common Space Parameter Declarations and Definitions
590 //
591 //   Local definitions in RAM provide non-standard functionality.
592 //   The NULL pointer provides standard functionality.
593 //
595 /* baseline definition - NULL equivalent */
596 /* May be used for overrides of IALG_MemSpace */
598 static const IALG_MemSpace params_memspace_PAi[] = {
599     PAF_IALG_NONE,                                          // Scratch
600     PAF_IALG_NONE,                                          // Persistant
601     PAF_IALG_NONE,                                          // Write once
602     PAF_IALG_NONE,                                          // Common 1
603     PAF_IALG_NONE,                                          // Common 2
604     PAF_IALG_NONE,                                          // Common 3
605     PAF_IALG_NONE,                                          // Common 4
606     PAF_IALG_NONE,                                          // Common 5
607     PAF_IALG_NONE,                                          // Common 6
608     PAF_IALG_NONE,                                          // Common 7
609     IALG_EXTERNAL,                                          // Common 8
610     PAF_IALG_NONE,                                          // Common 9
611     PAF_IALG_NONE,                                          // Common 10
612     PAF_IALG_NONE,                                          // Common 11
613     PAF_IALG_NONE,                                          // Common 12
614     PAF_IALG_NONE,                                          // Common 13
615     PAF_IALG_NONE,                                          // Common 14
616     PAF_IALG_NONE,                                          // Common 15
617 };
619 //
620 // Heap Declarations
621 //
623 //#include <pafhjt.h>
625 //extern int IRAM;
626 //extern int SDRAM;
627 //extern int L3RAM;
629 // .............................................................................
630 // DIB memory requirements
632 // primary input
633 // IALG_SARAM_SHM: MSMC shared memory heap
634 // IALG_EXTERNAL_SHM: DDR shared memory heap
635 const IALG_MemRec inpMemTabPrimary[] =
637     // SDRAM circular buffer
638     // 2 buffers * 256 samples/buffer * 8 words/sample * 3 bytes/word
639     {
640         (3 * 60 * 1024) + 2,                                    // size 184320 + 1 16-bit word for EDMA padding // GJ Debug.
641         //180 * 1024,                                           // size
642         //6 * 60 * 1024,                                        // size
643         128,                                                    // alignment
644                 IALG_SARAM_SHM, //IALG_EXTERNAL_SHM, //IALG_SARAM2, //IALG_SARAM1, //IALG_EXTERNAL,                           // space
645         IALG_PERSIST,                                           // attrs
646         NULL,                                                   // base
647      },
649          // GJ Debug: The below is not required; hence 0
651 #if 0
652         // IRAM scratch memory for autodetection and stereo PCM input
653     // High watermark needs are set by the latter:
654     // double buffer stereo 32bit PCM input 512 max frame size
655     // 1 buffers * 512 samples/buffer * 2 words/sample * 4 bytes/word
656     {
657         0 * 1024,                                              // size
658         128,                                                   // alignment
659                 IALG_EXTERNAL_SHM,                                            // space
660         IALG_SCRATCH,                                          // attrs
661         NULL,                                                  // base
662     }
663 #endif
665 };
667 const PAF_SIO_IALG_Params inpSioAlgParamsPrimary =
669     1,
670     inpMemTabPrimary
671 };
673 const PAF_ASP_LinkInit inpLinkInitPrimary[] =
675     PAF_ASP_LINKINITPARAMS (STD, IB, TIH, &inpSioAlgParamsPrimary),
676     PAF_ASP_LINKNONE
677 };
679 const PAF_ASP_LinkInit *const inpLinkInit[] =
681     inpLinkInitPrimary
682 };
684 // .............................................................................
685 // DOB memory requirements
687 // primary output
688 const IALG_MemRec outMemTabPrimary[] =
690     // SDRAM buffer
691     // 4 buffers * PAF_ASOT_MAX_FRAMELENGTH samples * 16 ch (assumed MAX) * 4 bytes
692         {
693             4 * PAF_ASOT_MAX_FRAMELENGTH * 16 * 4,                                      // size: note:
694             //6 * 256 * 32 * 4,                                      // size: note:
695             //16 * 256 * 32 * 4,                                      // size: note:
696             128,                                                   // alignment
697             IALG_SARAM,                                         // space
698             IALG_PERSIST,                                          // attrs
699             NULL,                                                  // base
700         }
701 };
704 const PAF_SIO_IALG_Params outSioAlgParamsPrimary =
706     1,
707     outMemTabPrimary
708 };
710 const PAF_ASP_LinkInit outLinkInitPrimary[] =
712     PAF_ASP_LINKINITPARAMS (STD, OB, TIH, &outSioAlgParamsPrimary),
713     PAF_ASP_LINKNONE
714 };
716 const PAF_ASP_LinkInit * const outLinkInit[] =
718     outLinkInitPrimary,
719 };
722 // .............................................................................
723 // sourceProgram mapped to DOB num of buffers
724 const PAF_ASP_outNumBufMap outPrimaryNumBufMap =
726     4,                                                      // maxNumBuf
727     PAF_SOURCE_N,                                           // length
728                                                             // this is the start of map[PAF_SOURCE_N]                                                            
729     0,                                                      // PAF_SOURCE_UNKNOWN
730     0,                                                      // PAF_SOURCE_NONE
731     2,                                                      // PAF_SOURCE_PASS
732     2,                                                      // PAF_SOURCE_SNG
733     0,                                                      // PAF_SOURCE_AUTO
734     0,                                                      // PAF_SOURCE_BITSTREAM
735     0,                                                      // PAF_SOURCE_DTSALL
736     0,                                                      // PAF_SOURCE_PCMAUTO
737     2,                                                      // PAF_SOURCE_PCM
738     0,                                                      // PAF_SOURCE_PC8
739     2,                                                      // PAF_SOURCE_AC3
740     2,                                                      // PAF_SOURCE_DTS
741     2,                                                      // PAF_SOURCE_AAC
742     0,                                                      // PAF_SOURCE_MPEG
743     2,                                                      // PAF_SOURCE_DTS12
744     2,                                                      // PAF_SOURCE_DTS13
745     2,                                                      // PAF_SOURCE_DTS14
746     2,                                                      // PAF_SOURCE_DTS16
747     0,                                                      // PAF_SOURCE_WMA9PRO
748     0,                                                      // PAF_SOURCE_MP3
749     2,                                                      // PAF_SOURCE_DSD1,
750     2,                                                      // PAF_SOURCE_DSD2,
751     2,                                                      // PAF_SOURCE_DSD3,
752     4,                                                      // PAF_SOURCE_DDP
753     4,                                                      // PAF_SOURCE_DTSHD
754     4,                                                      // PAF_SOURCE_THD
755     4,                                                      // PAF_SOURCE_DXP
756 };
758 const PAF_ASP_outNumBufMap *const outNumBufMap[] =
760     &outPrimaryNumBufMap,
761 };
763 // .............................................................................
764 const PAF_MetadataBufStatus PAF_AST_params_MetadataBufStatus[] =
766     PAF_MAX_PRIVATE_MD_SZ,  // bufSize
767     PAF_MAX_NUM_PRIVATE_MD, // NumBuf
768     128,                    // alignment
769     &gPafHeapIdExt          // pHeapIdMdbuf
770 };
772 // .............................................................................
773 //
774 // This structure defines the memory allocation of audio frame buffers (channel buffers). Users can customize this structure based
775 // on their requirement. IALG_SARAM specifies the audio frame buffer is allocated in IRAM and IALG_EXTERNAL
776 // specifies the audio frame buffer is allocated in SDRAM. By allocating few channel buffers in SDRAM, users can save internal memory
777 // but trading performance
778 // This structure defined for PAF_MAXNUMCHAN number of channels. But channel buffers will be allocated  for "PAF_AST_params_numchan"
779 // number of channels only.
780 //
782 const PAF_AudioFrameBufStatus    PAF_AST_params_AudioFrameBufStatus[PAF_MAXNUMCHAN] =
784     IALG_SARAM, // 0
785     IALG_SARAM,
786     IALG_SARAM,
787     IALG_SARAM,
788     IALG_SARAM,
789     IALG_SARAM,
790     IALG_SARAM,
791     IALG_SARAM,
792     IALG_SARAM,
793     IALG_SARAM,
794     IALG_SARAM,
795     IALG_SARAM,
796     IALG_SARAM,
797     IALG_SARAM,
798     IALG_SARAM,
799     IALG_SARAM,
800     IALG_SARAM, // 16
801     IALG_SARAM,
802     IALG_SARAM,
803     IALG_SARAM,
804     IALG_SARAM,
805     IALG_SARAM,
806     IALG_SARAM,
807     IALG_SARAM,
808     IALG_SARAM,
809     IALG_SARAM,
810     IALG_SARAM,
811     IALG_SARAM,
812     IALG_SARAM,
813     IALG_SARAM,
814     IALG_SARAM,
815     IALG_SARAM, // 31
816     //IALG_EXTERNAL, // 16
817     //IALG_EXTERNAL,
818     //IALG_EXTERNAL,
819     //IALG_EXTERNAL,
820     //IALG_EXTERNAL,
821     //IALG_EXTERNAL,
822     //IALG_EXTERNAL,
823     //IALG_EXTERNAL,
824     //IALG_EXTERNAL,
825     //IALG_EXTERNAL,
826     //IALG_EXTERNAL,
827     //IALG_EXTERNAL,
828     //IALG_EXTERNAL,
829     //IALG_EXTERNAL,
830     //IALG_EXTERNAL,
831     //IALG_EXTERNAL // 31
832 };
834 const PAF_AST_DecOpCircBufStatus PAF_AST_params_decOpCircBufStatus_primary =
836     sizeof(PAF_AST_DecOpCircBufStatus),
837     PAF_ASOT_FRAMELENGTH
838 };
840 const PAF_AST_DecOpCircBufStatus *const PAF_AST_params_decOpCircBufStatus[] =
842     &PAF_AST_params_decOpCircBufStatus_primary,
843 };
846 //(***) FL: re-visit, clean this up (remove unused members)
847 // .............................................................................
848 //
849 // Audio Stream Parameter Definitions
850 //
851 //   Global definition in RAM provides standard & non-standard functionality.
852 //
854 const PAF_ASIT_Params asip_params_PAi =
856     &PAF_ASIT_params_fxns,                                  // fxns
857     {                                                       // zone
858         0,                                                  // zone.master
859         1,                                                  // zone.inputs
860         0,                                                  // zone.input1
861         1,                                                  // zone.inputN
862         1,                                                  // zone.decodes
863         0,                                                  // zone.decode1
864         1,                                                  // zone.decodeN
865         1,                                                  // zone.streams
866         0,                                                  // zone.stream1 /* unused */
867         1,                                                  // zone.streamN /* unused */
868         1,                                                  // zone.encodes
869         0,                                                  // zone.encode1
870         1,                                                  // zone.encodeN
871         1,                                                  // zone.outputs
872         0,                                                  // zone.output1
873         1,                                                  // zone.outputN
874     },
875     PAF_AST_inputsFromDecodes_std,
876     PAF_AST_outputsFromEncodes_std,
877     {                                                       // heap
878         &gPafHeapIdInt,                                     // heap.pHeapIdIntern
879         &gPafHeapIdExt,                                     // heap.pHeapIdExtern
880         &gPafHeapIdInt,                                     // heap.pHeapIdInpbuf
881         &gPafHeapIdInt,                                     // heap.pHeapIdOutbuf
882         &gPafHeapIdInt,                                     // heap.pHeapIdFrmbuf
883         &gPafHeapIdInt1,                                    // heap.pHeapIdIntern1
884         &gPafHeapIdInt1Shm,                                 // heap.pHeapIdInt1Shm
885         &gPafHeapIdExtShm,                                  // heap.pHeapIdExtShm
886         &gPafHeapIdExtNonCachedShm,                         // heap.pHeapIdExtNonCachedShm
887         1,                                                  // heap.clear
888     },
889     {                                                       // common
890         params_memspace_PAi,                                // common.space
891     },
892     NULL,                                                   // z_rx_bufsiz
893     NULL,                                                   // z_tx_bufsiz
894     PAF_AST_params_numchan,                                 // z_numchan
895     PAF_SYS_FRAMELENGTH,                                    // framelength
896     &PAF_AST_params_audioFrameFunctions,                    // pAudioFrameFunctions
897     &PAF_ASP_chainFxns,                                     // pChainFxns
898     &PAF_AST_params_inpBufStatus,                           // pInpBufStatus
899     NULL, //PAF_AST_params_decodeStatus,                            // z_pDecodeStatus
900     &PAF_AST_params_outBufStatus,                           // pOutBufStatus
901     PAF_AST_params_encodeStatus,                            // z_pEncodeStatus
902     &PAF_AST_params_volumeStatus,                           // pVolumeStatus
903     &PAF_ASP_params_decAlgKey,                              // pDecAlgKey
904     &PAF_ASP_params_encAlgKey,                              // pEncAlgKey
905     &PAF_ASP_params_decSioMap,                              // pDecSioMap
906     PAF_AST_streamsFromDecodes_std,                         // streamsFromDecodes
907     PAF_AST_streamsFromEncodes_std,                         // streamsFromEncodes
908     PAF_MAX_SYS_FRAMELENGTH,                                // maxFramelength
909     PAF_AST_streamOrder,                                    // streamOrder
910     inpLinkInit,                                            // i_inpLinkInit
911     outLinkInit,                                            // i_outLinkInit
912     outNumBufMap,                                           // outNumBufMap // FL: poutNumBufMap
913     PAF_AST_params_MetadataBufStatus,                       // metadata buffer status
914     PAF_AST_params_AudioFrameBufStatus,                     // Audio frame buffer status
915     PAF_AST_params_decOpCircBufStatus                       // z_pDecOpCircBufStatus
916 };
918 extern const PAF_ASOT_Fxns PAF_ASOT_params_fxns;
920 //(***) FL: initially a copy of asip
921 //(***) FL: re-visit, clean this up (remove unused members)
922 const PAF_ASOT_Params asop_params_PAi =
924     &PAF_ASOT_params_fxns,                                  // fxns
925     {                                                       // zone
926         0,                                                  // zone.master
927         1,                                                  // zone.inputs
928         0,                                                  // zone.input1
929         1,                                                  // zone.inputN
930         1,                                                  // zone.decodes
931         0,                                                  // zone.decode1
932         1,                                                  // zone.decodeN
933         1,                                                  // zone.streams
934         0,                                                  // zone.stream1 /* unused */
935         1,                                                  // zone.streamN /* unused */
936         1,                                                  // zone.encodes
937         0,                                                  // zone.encode1
938         1,                                                  // zone.encodeN
939         1,                                                  // zone.outputs
940         0,                                                  // zone.output1
941         1,                                                  // zone.outputN
942     },
943     PAF_AST_inputsFromDecodes_std,
944     PAF_AST_outputsFromEncodes_std,
945     {                                                       // heap
946         &gPafHeapIdInt,                                     // heap.pHeapIdIntern
947         &gPafHeapIdExt,                                     // heap.pHeapIdExtern
948         &gPafHeapIdInt,                                     // heap.pHeapIdInpbuf
949         &gPafHeapIdInt,                                     // heap.pHeapIdOutbuf
950         &gPafHeapIdInt,                                     // heap.pHeapIdFrmbuf
951         &gPafHeapIdInt1,                                    // heap.pHeapIdIntern1
952         &gPafHeapIdInt1Shm,                                 // heap.pHeapIdInt1Shm
953         &gPafHeapIdExtShm,                                  // heap.pHeapIdExtShm
954         &gPafHeapIdExtNonCachedShm,                         // heap.pHeapIdExtNonCachedShm
955         1,                                                  // heap.clear
956     },
957     {                                                       // common
958         params_memspace_PAi,                                // common.space
959     },
960     NULL,                                                   // z_rx_bufsiz
961     NULL,                                                   // z_tx_bufsiz
962     PAF_AST_params_numchan,                                 // z_numchan
963         PAF_ASOT_FRAMELENGTH,                                   // framelength
964     &PAF_AST_params_audioFrameFunctions,                    // pAudioFrameFunctions
965     &PAF_ASP_chainFxns,                                     // pChainFxns
966     &PAF_AST_params_inpBufStatus,                           // pInpBufStatus
967     NULL, //PAF_AST_params_decodeStatus,                            // z_pDecodeStatus
968     &PAF_AST_params_outBufStatus,                           // pOutBufStatus
969     PAF_AST_params_encodeStatus,                            // z_pEncodeStatus
970     &PAF_AST_params_volumeStatus,                           // pVolumeStatus
971     &PAF_ASP_params_decAlgKey,                              // pDecAlgKey
972     &PAF_ASP_params_encAlgKey,                              // pEncAlgKey
973     &PAF_ASP_params_decSioMap,                              // pDecSioMap
974     PAF_AST_streamsFromDecodes_std,                         // streamsFromDecodes
975     PAF_AST_streamsFromEncodes_std,                         // streamsFromEncodes
976         PAF_ASOT_MAX_FRAMELENGTH,                               // maxFramelength
977     PAF_AST_streamOrder,                                    // streamOrder
978     inpLinkInit,                                            // i_inpLinkInit
979     outLinkInit,                                            // i_outLinkInit
980     outNumBufMap,                                           // outNumBufMap // FL: poutNumBufMap
981     PAF_AST_params_MetadataBufStatus,                       // metadata buffer status
982     PAF_AST_params_AudioFrameBufStatus                      // Audio frame buffer status
983 };
986 // EOF