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