Update dec status & beta table sharing between ARM & DSP
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / framework / itopo / params.c
2 /*
3 Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
4 All rights reserved.
6 * Redistribution and use in source and binary forms, with or without 
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
36 //
37 // PAF_DEVICE_VERSION Symbol Definitions
39 #define PAF_DEVICE_VERSION (PAF_DEVICE & 0xffff)
41 #include <xdc/cfg/global.h>
43 //#include <ti/procsdk_audio/procsdk_audio_typ.h>
44 #include <procsdk_audio_typ.h>
46 #include <stdasp.h>
47 #include <pafsio_ialg.h>
49 #include "paf_heapMgr.h"
51 #include "asp1.h"
52 #include "audioStreamProc_params.h"
54 //
55 // Framework Declarations
56 //
58 //#define PAF_AST_params_fxnsPA PAF_AST_params_fxnsPA17
60 //
61 // Audio Data Representation Definitions
62 //
63 //   External declarations to patched IROM provide standard functionality.
64 //
66 /* audio frame "width" in channels */
68 const SmInt PAF_AST_params_numchan[1] =
69 {
70     32,
71 };
73 ///
74 // Audio Stream Processing Function Table Definition
75 //
77 const PAF_AudioFunctions PAF_AST_params_audioFrameFunctions =
78 {
79     &PAF_ASP_dB2ToLinear,
80     &PAF_ASP_channelMask,
81     &PAF_ASP_programFormat,
82     &PAF_ASP_sampleRateHz,
83     &PAF_ASP_delay,
84 };
86 //
87 // Source Select Array Declarations -- algorithm keys & sio map
88 //
89 //   External declarations to patched IROM provide standard functionality.
90 //
92 const PAF_ASP_AlgKey PAF_ASP_params_decAlgKey =
93 {
94     PAF_SOURCE_N,                                           // length
95     /* Relies on the fact that ACP_SERIES_* != 0 here */
96     0,                                                      // PAF_SOURCE_UNKNOWN
97     0,                                                      // PAF_SOURCE_NONE
98     0,                                                      // PAF_SOURCE_PASS
99     PAF_ASP_ALPHACODE (STD, SNG),                           // PAF_SOURCE_SNG
100     0,                                                      // PAF_SOURCE_AUTO
101     0,                                                      // PAF_SOURCE_BITSTREAM
102     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTSALL
103     PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCMAUTO
104     PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCM
105     PAF_ASP_ALPHACODE (STD, PCN),                           // PAF_SOURCE_PC8 /* unused */
106     PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_AC3
107     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS
108     PAF_ASP_ALPHACODE (STD, AAC),                           // PAF_SOURCE_AAC
109     PAF_ASP_ALPHACODE (STD, MPG),                           // PAF_SOURCE_MPEG /* unused */
110     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS12
111     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS13
112     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS14
113     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS16
114     0,                                                      // PAF_SOURCE_WMA9PRO
115     0,                                                      // PAF_SOURCE_MP3
116     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD1
117     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD2
118     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD3
119     PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_DDP
120     PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTSHD
121     PAF_ASP_ALPHACODE (STD, THD),                           // PAF_SOURCE_THD
122     PAF_ASP_ALPHACODE (STD, DXP),                           // PAF_SOURCE_DXP
123 };
125 const PAF_ASP_AlgKey PAF_ASP_params_encAlgKey =
127     PAF_SOURCE_N,                                           // length
128     /* Relies on the fact that ACP_SERIES_* != 0 here */
129     0,                                                      // PAF_SOURCE_UNKNOWN
130     0,                                                      // PAF_SOURCE_NONE
131     0,                                                      // PAF_SOURCE_PASS
132     0,                                                      // PAF_SOURCE_SNG
133     0,                                                      // PAF_SOURCE_AUTO
134     0,                                                      // PAF_SOURCE_BITSTREAM
135     0,                                                      // PAF_SOURCE_DTSALL
136     0,                                                      // PAF_SOURCE_PCMAUTO
137     PAF_ASP_ALPHACODE (STD, PCE),                           // PAF_SOURCE_PCM
138     0,                                                      // PAF_SOURCE_PC8
139     0,                                                      // PAF_SOURCE_AC3
140     0,                                                      // PAF_SOURCE_DTS
141     0,                                                      // PAF_SOURCE_AAC
142     0,                                                      // PAF_SOURCE_MPEG
143     0,                                                      // PAF_SOURCE_DTS12
144     0,                                                      // PAF_SOURCE_DTS13
145     0,                                                      // PAF_SOURCE_DTS14
146     0,                                                      // PAF_SOURCE_DTS16
147     0,                                                      // PAF_SOURCE_WMA9PRO
148     PAF_ASP_ALPHACODE (STD, MPE),                           // PAF_SOURCE_MP3
149     0,                                                      // PAF_SOURCE_DSD1
150     0,                                                      // PAF_SOURCE_DSD2
151     0                                                       // PAF_SOURCE_DSD3
152 };
154 const PAF_ASP_SioMap PAF_ASP_params_decSioMap =
156     PAF_SOURCE_N,                                           // length
157     PAF_SOURCE_UNKNOWN,                                     // PAF_SOURCE_UNKNOWN -> ...
158     PAF_SOURCE_NONE,                                        // PAF_SOURCE_NONE -> ...
159     PAF_SOURCE_PASS,                                        // PAF_SOURCE_PASS -> ...
160     PAF_SOURCE_PCM,                                         // PAF_SOURCE_SNG -> PCM
161     PAF_SOURCE_AUTO,                                        // PAF_SOURCE_AUTO -> ...
162     PAF_SOURCE_BITSTREAM,                                   // PAF_SOURCE_BITSTREAM -> ...
163     PAF_SOURCE_DTSALL,                                      // PAF_SOURCE_UNUSED1 -> ...
164     PAF_SOURCE_PCMAUTO,                                     // PAF_SOURCE_UNUSED2 -> ...
165     PAF_SOURCE_PCM,                                         // PAF_SOURCE_PCM -> ...
166     PAF_SOURCE_PC8,                                         // PAF_SOURCE_PC8 -> ...
167     PAF_SOURCE_AC3,                                         // PAF_SOURCE_AC3 -> ...
168     PAF_SOURCE_DTS,                                         // PAF_SOURCE_DTS -> ...
169     PAF_SOURCE_AAC,                                         // PAF_SOURCE_AAC -> ...
170     PAF_SOURCE_MPEG,                                        // PAF_SOURCE_MPEG -> ...
171     PAF_SOURCE_DTS12,                                       // PAF_SOURCE_DTS12 -> ...
172     PAF_SOURCE_DTS13,                                       // PAF_SOURCE_DTS13 -> ...
173     PAF_SOURCE_DTS14,                                       // PAF_SOURCE_DTS14 -> ...
174     PAF_SOURCE_DTS16,                                       // PAF_SOURCE_DTS16 -> ...
175     PAF_SOURCE_WMA9PRO,                                     // PAF_SOURCE_WMA9PRO -> ...
176     PAF_SOURCE_MP3,                                         // PAF_SOURCE_MP3 -> ...
177     PAF_SOURCE_DSD1,                                        // PAF_SOURCE_DSD1 -> ...
178     PAF_SOURCE_DSD2,                                        // PAF_SOURCE_DSD2 -> ...
179     PAF_SOURCE_DSD3,                                        // PAF_SOURCE_DSD3 -> ...
180     PAF_SOURCE_DDP,                                         // PAF_SOURCE_DDP -> ...
181     PAF_SOURCE_DTSHD,                                       // PAF_SOURCE_DTSHD -> ...
182     PAF_SOURCE_THD,                                         // PAF_SOURCE_THD -> ...
183     PAF_SOURCE_DXP,                                         // PAF_SOURCE_DXP -> ...
184 };
186 //
187 // Mapping Declarations -- from *coders to *puts
188 //
189 //   External declarations to patched IROM provide standard functionality.
190 //
191 const SmInt PAF_AST_streamsFromDecodes_std[DECODEN_MAX] =
193     0, 1, 2,
194 };
195 const SmInt PAF_AST_streamsFromEncodes_std[ENCODEN_MAX] =
197     0, 1, 2,
198 };
199 const SmInt PAF_AST_inputsFromDecodes_std[DECODEN_MAX] =
201     0, 1, 2,
202 };
203 extern const SmInt PAF_AST_outputsFromEncodes_std[ENCODEN_MAX];
204 #ifndef __TI_EABI__
205 asm ("_PAF_AST_outputsFromEncodes_std .set _PAF_AST_inputsFromDecodes_std");
206 #else
207 asm ("PAF_AST_outputsFromEncodes_std .set PAF_AST_inputsFromDecodes_std");
208 #endif
210 //
211 // Setting of audio stream order
212 //
214 const SmInt PAF_AST_streamOrder[1] =
216     0,
217 };
219 //
220 // Audio Framework Initialization Function Table Declarations
221 //
222 //   External declarations to patched IROM provide standard functionality.
223 //
225 extern const PAF_AST_Fxns PAF_ASIT_params_fxns;
227 //
228 // Audio Framework Status Initialization Declarations
229 //
230 //   External declarations to patched IROM provide standard functionality.
231 //
233 const PAF_InpBufStatus PAF_AST_params_inpBufStatus =
235     sizeof (PAF_InpBufStatus),                              // size
236     0,                                                      // mode
237     0,                                                      // sioSelect
238     0x80,                                                   // lockOverride = none
239     0,                                                      // unused
240     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRateOverride
241     PAF_SAMPLERATE_NONE,                                    // sampleRateData
242     PAF_SAMPLERATE_NONE,                                    // sampleRateMeasured
243     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRateStatus
244     PAF_IEC_AUDIOMODE_UNKNOWN,                              // nonaudio
245     PAF_IEC_PREEMPHASIS_UNKNOWN,                            // emphasisData
246     0,                                                      // emphasisOverride
247     PAF_IEC_PREEMPHASIS_NO,                                 // emphasisStatus
248     0,                                                      // lock
249     0,                                                      // scanAtHighSampleRateMode
250     0,                                                      // zeroRun
251     0,                                                      // unused2[1] // FL: rateTrackMode
252     24,                                                     // precisionDefault
253     -1,                                                     // precisionDetect
254     0,                                                      // precisionOverride
255     0,                                                      // precisionInput
256     100,                                                    // zeroRunTrigger
257     100,                                                    // zeroRunRestart
258     2048,                                                   // unknownTimeout
259     0,                                                      // lastFrameMask
260     0,                                                      // lastFrameFlag
261     0,                                                      // reportDTS16AsDTSForLargeSampleRate
262     0, 0                                                    // reserved
263 };
265 #if 0 // FL: slave
266 const PAF_DecodeStatus PAF_AST_params_decodeStatus_primary =
268     sizeof (PAF_DecodeStatus),                              // size
269     1,                                                      // mode
270     0,                                                      // unused1
271     0,                                                      // command.action
272     0,                                                      // command.result
273     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
274     PAF_SOURCE_NONE,                                        // sourceSelect
275     PAF_SOURCE_UNKNOWN,                                     // sourceProgram
276     PAF_SOURCE_UNKNOWN,                                     // sourceDecode
277     PAF_SOURCE_DUAL_STEREO,                                 // sourceDual
278     4,                                                      // sourceKaraoke: both
279     0,                                                      // aspGearControl: unused
280     0,                                                      // aspGearStatus: unused
281     0, 0, 0, 0,                                             // Unused
282     0, 0, 0, 0,                                             // Unused
283     0, 0, 0, 0,                                             // Unused
284     0, 0, 0, 0,                                             // Unused
285     0, 0, 0, 0,                                             // Unused
286     0,                                                      // frameCount
287     0x40,                                                   // karaoka: Vocal 1 Level
288     0x40,                                                   // karaoka: Vocal 1 Pan
289     0x40,                                                   // karaoka: Vocal 2 Level
290     0xc0,                                                   // karaoka: Vocal 2 Pan
291     0x40,                                                   // karaoka: Melody Level
292     0x00,                                                   // karaoka: Melody Pan
293     0,                                                      // decBypass
294     0,                                                      // unused
295     0,                                                      // frameLength: reset later
296     1,                                                      // bufferRatio: unity
297     PAF_IEC_PREEMPHASIS_UNKNOWN,                            // emphasis
298     0,                                                      // bufferDrift
299     0, 0,
300     PAF_CC_SAT_SURROUND4, PAF_CC_SUB_ONE, PAF_CC_AUX_SURROUND4_UNKNOWN, 0, 0, 0, 0, 0,    
301     // channelConfigurationRequest.full
302     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
303     // channelConfigurationProgram.full
304     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
305     // channelConfigurationDecode.full
306     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
307     // channelConfigurationDownmix.full
308     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
309     // channelConfigurationOverride.full 
310     -3,                                                     // channelMap.from[0]
311     -3,                                                     // channelMap.from[1]
312     -3,                                                     // channelMap.from[2]
313     -3,                                                     // channelMap.from[3]
314     -3,                                                     // channelMap.from[4]
315     -3,                                                     // channelMap.from[5]
316     -3,                                                     // channelMap.from[6]
317     -3,                                                     // channelMap.from[7]
318     -3,                                                     // channelMap.from[8]
319     -3,                                                     // channelMap.from[9]
320     -3,                                                     // channelMap.from[10]
321     -3,                                                     // channelMap.from[11]
322     -3,                                                     // channelMap.from[12]
323     -3,                                                     // channelMap.from[13]
324     -3,                                                     // channelMap.from[14]
325     -3,                                                     // channelMap.from[15]
326     -3,                                                     // channelMap.from[16]
327     -3,                                                     // channelMap.from[17]
328     -3,                                                     // channelMap.from[18]
329     -3,                                                     // channelMap.from[19]
330     -3,                                                     // channelMap.from[20]
331     -3,                                                     // channelMap.from[21]
332     -3,                                                     // channelMap.from[22]
333     -3,                                                     // channelMap.from[23]
334     -3,                                                     // channelMap.from[24]
335     -3,                                                     // channelMap.from[25]
336     -3,                                                     // channelMap.from[26]
337     -3,                                                     // channelMap.from[27]
338     -3,                                                     // channelMap.from[28]
339     -3,                                                     // channelMap.from[29]
340     -3,                                                     // channelMap.from[30]
341     -3,                                                     // channelMap.from[31]
342     -3,                                                     // channelMap.to[0]
343     -3,                                                     // channelMap.to[1]
344     -3,                                                     // channelMap.to[2]
345     -3,                                                     // channelMap.to[3]
346     -3,                                                     // channelMap.to[4]
347     -3,                                                     // channelMap.to[5]
348     -3,                                                     // channelMap.to[6]
349     -3,                                                     // channelMap.to[7]
350     -3,                                                     // channelMap.to[8]
351     -3,                                                     // channelMap.to[9]
352     -3,                                                     // channelMap.to[10]
353     -3,                                                     // channelMap.to[11]
354     -3,                                                     // channelMap.to[12]
355     -3,                                                     // channelMap.to[13]
356     -3,                                                     // channelMap.to[14]
357     -3,                                                     // channelMap.to[15]
358     -3,                                                     // channelMap.to[16]
359     -3,                                                     // channelMap.to[17]
360     -3,                                                     // channelMap.to[18]
361     -3,                                                     // channelMap.to[19]
362     -3,                                                     // channelMap.to[20]
363     -3,                                                     // channelMap.to[21]
364     -3,                                                     // channelMap.to[22]
365     -3,                                                     // channelMap.to[23]
366     -3,                                                     // channelMap.to[24]
367     -3,                                                     // channelMap.to[25]
368     -3,                                                     // channelMap.to[26]
369     -3,                                                     // channelMap.to[27]
370     -3,                                                     // channelMap.to[28]
371     -3,                                                     // channelMap.to[29]
372     -3,                                                     // channelMap.to[30]
373     -3,                                                     // channelMap.to[31]
374     0,                                                      // programFormat.mask
375     0,                                                      // programFormat.form
376    
377 };
378 const PAF_DecodeStatus *const PAF_AST_params_decodeStatus[] =
380     &PAF_AST_params_decodeStatus_primary,
381 };
382 #endif // #if 0
384 const PAF_OutBufStatus PAF_AST_params_outBufStatus =
386     sizeof (PAF_OutBufStatus),                              // size
387     1,                                                      // mode
388     0,                                                      // sioSelect
389     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
390     0,                                                      // audio
391     PAF_OB_CLOCK_INTERNAL,                                  // clock
392     PAF_OB_FLUSH_ENABLE,                                    // flush
393     0,                                                      // unused[2] // FL: rateTrackMode
394     0,                                                      // PAF_OB_MARKER_ENABLED // FL: markerMode
395     0                                                       // FL: maxNumBufOverride
396                                                             // FL: (*** ?) missing init. values for numBufOverride[PAF_SOURCE_N]
397 };
399 const PAF_EncodeStatus PAF_AST_params_encodeStatus_primary =
401     sizeof (PAF_EncodeStatus),                              // size
402     1,                                                      // mode
403     0,                                                      // unused1
404     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
405     0,                                                      // channelCount
406     0, 0, 0, 0,                                             // Unused                                        
407     0, 0, 0, 0,                                             // Unused
408     0, 0, 0, 0,                                             // Unused
409     0, 0, 0, 0,                                             // Unused
410     0, 0, 0, 0,                                             // Unused
411     0,                                                      // frameLength
412     0,                                                      // encBypass
413     PAF_SOURCE_PCM,                                         // select
414     PAF_CC_SAT_SURROUND4, PAF_CC_SUB_ONE, PAF_CC_AUX_SURROUND4_UNKNOWN, 0,0,0,0,0,
415     // channelConfigurationRequest.full
416     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0,0,0,0,0,
417     // channelConfigurationStream.full
418     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0,0,0,0,0,
419     // channelConfigurationEncode.full
420     0, 0, 0, 0,    0, 0, 0, 0,                              // Unused
421     -3,                                                     // channelMap.from[0]
422     -3,                                                     // channelMap.from[1]
423     -3,                                                     // channelMap.from[2]
424     -3,                                                     // channelMap.from[3]
425     -3,                                                     // channelMap.from[4]
426     -3,                                                     // channelMap.from[5]
427     -3,                                                     // channelMap.from[6]
428     -3,                                                     // channelMap.from[7]
429     -3,                                                     // channelMap.from[8]
430     -3,                                                     // channelMap.from[9]
431     -3,                                                     // channelMap.from[10]
432     -3,                                                     // channelMap.from[11]
433     -3,                                                     // channelMap.from[12]
434     -3,                                                     // channelMap.from[13]
435     -3,                                                     // channelMap.from[14]
436     -3,                                                     // channelMap.from[15]
437     -3,                                                     // channelMap.to[0]
438     -3,                                                     // channelMap.to[1]
439     -3,                                                     // channelMap.to[2]
440     -3,                                                     // channelMap.to[3]
441     -3,                                                     // channelMap.to[4]
442     -3,                                                     // channelMap.to[5]
443     -3,                                                     // channelMap.to[6]
444     -3,                                                     // channelMap.to[7]
445     -3,                                                     // channelMap.to[8]
446     -3,                                                     // channelMap.to[9]
447     -3,                                                     // channelMap.to[10]
448     -3,                                                     // channelMap.to[11]
449     -3,                                                     // channelMap.to[12]
450     -3,                                                     // channelMap.to[13]
451     -3,                                                     // channelMap.to[14]
452     -3,                                                     // channelMap.to[15]
453     -3,                                                     // channelMap.from[0]
454     -3,                                                     // channelMap.from[1]
455     -3,                                                     // channelMap.from[2]
456     -3,                                                     // channelMap.from[3]
457     -3,                                                     // channelMap.from[4]
458     -3,                                                     // channelMap.from[5]
459     -3,                                                     // channelMap.from[6]
460     -3,                                                     // channelMap.from[7]
461     -3,                                                     // channelMap.from[8]
462     -3,                                                     // channelMap.from[9]
463     -3,                                                     // channelMap.from[10]
464     -3,                                                     // channelMap.from[11]
465     -3,                                                     // channelMap.from[12]
466     -3,                                                     // channelMap.from[13]
467     -3,                                                     // channelMap.from[14]
468     -3,                                                     // channelMap.from[15]
469     -3,                                                     // channelMap.to[0]
470     -3,                                                     // channelMap.to[1]
471     -3,                                                     // channelMap.to[2]
472     -3,                                                     // channelMap.to[3]
473     -3,                                                     // channelMap.to[4]
474     -3,                                                     // channelMap.to[5]
475     -3,                                                     // channelMap.to[6]
476     -3,                                                     // channelMap.to[7]
477     -3,                                                     // channelMap.to[8]
478     -3,                                                     // channelMap.to[9]
479     -3,                                                     // channelMap.to[10]
480     -3,                                                     // channelMap.to[11]
481     -3,                                                     // channelMap.to[12]
482     -3,                                                     // channelMap.to[13]
483     -3,                                                     // channelMap.to[14]
484     -3,                                                     // channelMap.to[15]
485     0,                                                      // programFormat.mask
486     0,                                                      // programFormat.form
487     0,                                                      // sampleProcess[0]
488 };
492 const PAF_EncodeStatus *const PAF_AST_params_encodeStatus[] =
494     &PAF_AST_params_encodeStatus_primary,
495 };
497 const PAF_VolumeStatus PAF_AST_params_volumeStatus =
499     sizeof (PAF_VolumeStatus),                              // size
500     1,                                                      // mode
501     PAF_MAXNUMCHAN,                                         // channelCount
502     0x0f,                                                   // implementation
503     0,                                                      // unused1
504     50,                                                     // rampTime: 50 msec/dB (20 dB/sec)
505     0,                                                      // unused2
506     0,                                                      // unused3
507     -2 * 20, 0, 0, 0,                                       // master
508     -2 * 0, 0, 0, 0,                                        // trim
509     -2 * 0, 0, 0, 0,                                        //
510     -2 * 0, 0, 0, 0,                                        //
511     -2 * 0, 0, 0, 0,                                        //
512     -2 * 0, 0, 0, 0,                                        //
513     -2 * 0, 0, 0, 0,                                        //
514     -2 * 0, 0, 0, 0,                                        //
515     -2 * 0, 0, 0, 0,                                        //
516     -2 * 0, 0, 0, 0,                                        //
517     -2 * 0, 0, 0, 0,                                        //
518     -2 * 0, 0, 0, 0,                                        //
519     -2 * 0, 0, 0, 0,                                        //
520     -2 * 0, 0, 0, 0,                                        //
521     -2 * 0, 0, 0, 0,                                        //
522     -2 * 0, 0, 0, 0,                                        //
523     -2 * 0, 0, 0, 0,                                        //  
524     -2 * 0, 0, 0, 0,                                        // trim - upper16
525     -2 * 0, 0, 0, 0,                                        //
526     -2 * 0, 0, 0, 0,                                        //
527     -2 * 0, 0, 0, 0,                                        //
528     -2 * 0, 0, 0, 0,                                        //
529     -2 * 0, 0, 0, 0,                                        //
530     -2 * 0, 0, 0, 0,                                        //
531     -2 * 0, 0, 0, 0,                                        //
532     -2 * 0, 0, 0, 0,                                        //
533     -2 * 0, 0, 0, 0,                                        //
534     -2 * 0, 0, 0, 0,                                        //
535     -2 * 0, 0, 0, 0,                                        //
536     -2 * 0, 0, 0, 0,                                        //
537     -2 * 0, 0, 0, 0,                                        //
538     -2 * 0, 0, 0, 0,                                        //
539     -2 * 0, 0, 0, 0,                                        //
541 };
543 //
544 // Common Space Parameter Declarations and Definitions
545 //
546 //   Local definitions in RAM provide non-standard functionality.
547 //   The NULL pointer provides standard functionality.
548 //
550 /* baseline definition - NULL equivalent */
551 /* May be used for overrides of IALG_MemSpace */
553 static const IALG_MemSpace params_memspace_PAi[] = {
554     PAF_IALG_NONE,                                          // Scratch
555     PAF_IALG_NONE,                                          // Persistant
556     PAF_IALG_NONE,                                          // Write once
557     PAF_IALG_NONE,                                          // Common 1
558     PAF_IALG_NONE,                                          // Common 2
559     PAF_IALG_NONE,                                          // Common 3
560     PAF_IALG_NONE,                                          // Common 4
561     PAF_IALG_NONE,                                          // Common 5
562     PAF_IALG_NONE,                                          // Common 6
563     PAF_IALG_NONE,                                          // Common 7
564     IALG_EXTERNAL,                                          // Common 8
565     PAF_IALG_NONE,                                          // Common 9
566     PAF_IALG_NONE,                                          // Common 10
567     PAF_IALG_NONE,                                          // Common 11
568     PAF_IALG_NONE,                                          // Common 12
569     PAF_IALG_NONE,                                          // Common 13
570     PAF_IALG_NONE,                                          // Common 14
571     PAF_IALG_NONE,                                          // Common 15
572 };
574 //
575 // Heap Declarations
576 //
578 //#include <pafhjt.h>
580 //extern int IRAM;
581 //extern int SDRAM;
582 //extern int L3RAM;
584 // .............................................................................
585 // DIB memory requirements
587 // primary input
588 const IALG_MemRec inpMemTabPrimary[] =
590     // SDRAM circular buffer
591     // 2 buffers * 256 samples/buffer * 8 words/sample * 3 bytes/word
592     {
593         3 * 60 * 1024,                                          // size
594         //180 * 1024,                                           // size
595         //6 * 60 * 1024,                                        // size
596         128,                                                    // alignment
597         IALG_SARAM2, //IALG_SARAM1, //IALG_EXTERNAL,                           // space
598         IALG_PERSIST,                                           // attrs
599         NULL,                                                   // base
600      },
602     // IRAM scratch memory for autodetection and stereo PCM input
603     // High watermark needs are set by the latter:
604     // double buffer stereo 32bit PCM input 512 max frame size
605     // 1 buffers * 512 samples/buffer * 2 words/sample * 4 bytes/word
606     {
607         8 * 1024,                                              // size
608         128,                                                   // alignment
609         IALG_SARAM,                                            // space
610         IALG_SCRATCH,                                          // attrs
611         NULL,                                                  // base
612     }
613 };
615 const PAF_SIO_IALG_Params inpSioAlgParamsPrimary =
617     2,
618     inpMemTabPrimary
619 };
621 const PAF_ASP_LinkInit inpLinkInitPrimary[] =
623     PAF_ASP_LINKINITPARAMS (STD, IB, TIH, &inpSioAlgParamsPrimary),
624     PAF_ASP_LINKNONE
625 };
627 const PAF_ASP_LinkInit *const inpLinkInit[] =
629     inpLinkInitPrimary
630 };
632 // .............................................................................
633 // DOB memory requirements
635 // primary output
636 const IALG_MemRec outMemTabPrimary[] =
638     // SDRAM buffer
639     // 4 buffers * 256 samples * 32 ch * 4 bytes
640         {
641             4 * 256 * 32 * 4,                                      // size: note:
642             //6 * 256 * 32 * 4,                                      // size: note:
643             //16 * 256 * 32 * 4,                                      // size: note:
644             128,                                                   // alignment
645             IALG_EXTERNAL,                                         // space
646             IALG_PERSIST,                                          // attrs
647             NULL,                                                  // base
648         }
649 };
652 const PAF_SIO_IALG_Params outSioAlgParamsPrimary =
654     1,
655     outMemTabPrimary
656 };
658 const PAF_ASP_LinkInit outLinkInitPrimary[] =
660     PAF_ASP_LINKINITPARAMS (STD, OB, TIH, &outSioAlgParamsPrimary),
661     PAF_ASP_LINKNONE
662 };
664 const PAF_ASP_LinkInit * const outLinkInit[] =
666     outLinkInitPrimary,
667 };
670 // .............................................................................
671 // sourceProgram mapped to DOB num of buffers
672 const PAF_ASP_outNumBufMap outPrimaryNumBufMap =
674     4,                                                      // maxNumBuf
675 //    6,                                                      // maxNumBuf
676 //    16,                                                      // maxNumBuf
677     PAF_SOURCE_N,                                           // length
678     0,                                                      // PAF_SOURCE_UNKNOWN
679     0,                                                      // PAF_SOURCE_NONE
680     2,                                                      // PAF_SOURCE_PASS
681     2,                                                      // PAF_SOURCE_SNG
682     0,                                                      // PAF_SOURCE_AUTO
683     0,                                                      // PAF_SOURCE_BITSTREAM
684     0,                                                      // PAF_SOURCE_DTSALL
685     0,                                                      // PAF_SOURCE_PCMAUTO
686     2,                                                      // PAF_SOURCE_PCM
687     0,                                                      // PAF_SOURCE_PC8
688     2,                                                      // PAF_SOURCE_AC3
689     2,                                                      // PAF_SOURCE_DTS
690     2,                                                      // PAF_SOURCE_AAC
691     0,                                                      // PAF_SOURCE_MPEG
692     2,                                                      // PAF_SOURCE_DTS12
693     2,                                                      // PAF_SOURCE_DTS13
694     2,                                                      // PAF_SOURCE_DTS14
695     2,                                                      // PAF_SOURCE_DTS16
696     0,                                                      // PAF_SOURCE_WMA9PRO
697     0,                                                      // PAF_SOURCE_MP3
698     2,                                                      // PAF_SOURCE_DSD1,
699     2,                                                      // PAF_SOURCE_DSD2,
700     2,                                                      // PAF_SOURCE_DSD3,
701     4,                                                      // PAF_SOURCE_DDP
702     4,                                                      // PAF_SOURCE_DTSHD
703     4,                                                      // PAF_SOURCE_THD
704 //    6,                                                      // PAF_SOURCE_THD
705 //    16,                                                      // PAF_SOURCE_THD
706     4,                                                      // PAF_SOURCE_DXP
708 };
710 const PAF_ASP_outNumBufMap *const outNumBufMap[] =
712     &outPrimaryNumBufMap,
713 };
715 // .............................................................................
716 const PAF_MetadataBufStatus PAF_AST_params_MetadataBufStatus[] =
718     4 * 1024,               // bufSize
719     PAF_MAX_NUM_PRIVATE_MD, // NumBuf
720     128,                    // alignment
721     &gPafHeapIdExt //&SDRAM // &IRAM,        // pSpace
722 };
724 // .............................................................................
725 //
726 // This structure defines the memory allocation of audio frame buffers (channel buffers). Users can customize this structure based
727 // on their requirement. IALG_SARAM specifies the audio frame buffer is allocated in IRAM and IALG_EXTERNAL
728 // specifies the audio frame buffer is allocated in SDRAM. By allocating few channel buffers in SDRAM, users can save internal memory
729 // but trading performance
730 // This structure defined for PAF_MAXNUMCHAN number of channels. But channel buffers will be allocated  for "PAF_AST_params_numchan"
731 // number of channels only.
732 //
734 const PAF_AudioFrameBufStatus    PAF_AST_params_AudioFrameBufStatus[PAF_MAXNUMCHAN] =
736     IALG_SARAM, // 0
737     IALG_SARAM,
738     IALG_SARAM,
739     IALG_SARAM,
740     IALG_SARAM,
741     IALG_SARAM,
742     IALG_SARAM,
743     IALG_SARAM,
744     IALG_SARAM,
745     IALG_SARAM,
746     IALG_SARAM,
747     IALG_SARAM,
748     IALG_SARAM,
749     IALG_SARAM,
750     IALG_SARAM,
751     IALG_SARAM,
752     IALG_SARAM, // 16
753     IALG_SARAM,
754     IALG_SARAM,
755     IALG_SARAM,
756     IALG_SARAM,
757     IALG_SARAM,
758     IALG_SARAM,
759     IALG_SARAM,
760     IALG_SARAM,
761     IALG_SARAM,
762     IALG_SARAM,
763     IALG_SARAM,
764     IALG_SARAM,
765     IALG_SARAM,
766     IALG_SARAM,
767     IALG_SARAM, // 31
768     //IALG_EXTERNAL, // 16
769     //IALG_EXTERNAL,
770     //IALG_EXTERNAL,
771     //IALG_EXTERNAL,
772     //IALG_EXTERNAL,
773     //IALG_EXTERNAL,
774     //IALG_EXTERNAL,
775     //IALG_EXTERNAL,
776     //IALG_EXTERNAL,
777     //IALG_EXTERNAL,
778     //IALG_EXTERNAL,
779     //IALG_EXTERNAL,
780     //IALG_EXTERNAL,
781     //IALG_EXTERNAL,
782     //IALG_EXTERNAL,
783     //IALG_EXTERNAL // 31
784 };
786 // .............................................................................
787 //
788 // Audio Stream Parameter Definitions
789 //
790 //   Global definition in RAM provides standard & non-standard functionality.
791 //
793 const PAF_AST_Params asip_params_PAi =
795     &PAF_ASIT_params_fxns,                                     // fxns
796     {                                                          // zone
797         0,                                                     // master
798         1,                                                     // inputs
799         0,                                                     // input1
800         1,                                                     // inputN
801         1,                                                     // decodes
802         0,                                                     // decode1
803         1,                                                     // decodeN
804         1,                                                     // streams
805         0,                                                     // stream1 /* unused */
806         1,                                                     // streamN /* unused */
807         1,                                                     // encodes
808         0,                                                     // encode1
809         1,                                                     // encodeN
810         1,                                                     // outputs
811         0,                                                     // output1
812         1,                                                     // outputN
813     },
814     PAF_AST_inputsFromDecodes_std,
815     PAF_AST_outputsFromEncodes_std,
816     {                                                       // heap
817         &gPafHeapIdInt,    //&IRAM,                         // pIntern
818         &gPafHeapIdExt,    //&SDRAM,                        // pExtern
819         &gPafHeapIdInt,    //&IRAM,                         // pInpbuf
820         &gPafHeapIdInt,    //&IRAM,                         // pOutbuf
821         &gPafHeapIdInt,    //&IRAM,                         // pFrmbuf
822         &gPafHeapIdInt1,   //&L3RAM,                        // pIntern1
823         1,                                                  // clear
824     },
825     {                                                       // common
826         params_memspace_PAi,                                // space
827     },
828     NULL,                                                   // z_rx_bufsiz
829     NULL,                                                   // z_tx_bufsiz
830     PAF_AST_params_numchan,                                 // z_numchan
831     256,                                                    // framelength
832     &PAF_AST_params_audioFrameFunctions,                    // pAudioFrameFunctions
833     &PAF_ASP_chainFxns,                                     // pChainFxns
834     &PAF_AST_params_inpBufStatus,                           // pInpBufStatus
835     NULL, //PAF_AST_params_decodeStatus,                            // z_pDecodeStatus
836     &PAF_AST_params_outBufStatus,                           // pOutBufStatus
837     PAF_AST_params_encodeStatus,                            // z_pEncodeStatus
838     &PAF_AST_params_volumeStatus,                           // pVolumeStatus
839     &PAF_ASP_params_decAlgKey,                              // pDecAlgKey
840     &PAF_ASP_params_encAlgKey,                              // pEncAlgKey
841     &PAF_ASP_params_decSioMap,                              // pDecSioMap
842     PAF_AST_streamsFromDecodes_std,                         // streamsFromDecodes
843     PAF_AST_streamsFromEncodes_std,                         // streamsFromEncodes
844     256,                                                    // maxFramelength
845     PAF_AST_streamOrder,                                    // streamOrder
846     inpLinkInit,                                            // i_inpLinkInit
847     outLinkInit,                                            // i_outLinkInit
848     outNumBufMap,                                           // outNumBufMap // FL: poutNumBufMap
849     PAF_AST_params_MetadataBufStatus,                       //metadata buffer status
850     PAF_AST_params_AudioFrameBufStatus                      //Audio frame buffer status
851 };
853 extern const PAF_AST_Fxns PAF_ASOT_params_fxns;
855 // (***) FL: initially a copy of asip
856 const PAF_AST_Params asop_params_PAi =
858     &PAF_ASOT_params_fxns,                                     // fxns
859     {                                                          // zone
860         0,                                                     // master
861         1,                                                     // inputs
862         0,                                                     // input1
863         1,                                                     // inputN
864         1,                                                     // decodes
865         0,                                                     // decode1
866         1,                                                     // decodeN
867         1,                                                     // streams
868         0,                                                     // stream1 /* unused */
869         1,                                                     // streamN /* unused */
870         1,                                                     // encodes
871         0,                                                     // encode1
872         1,                                                     // encodeN
873         1,                                                     // outputs
874         0,                                                     // output1
875         1,                                                     // outputN
876     },
877     PAF_AST_inputsFromDecodes_std,
878     PAF_AST_outputsFromEncodes_std,
879     {                                                       // heap
880         &gPafHeapIdInt,    //&IRAM,                         // pIntern
881         &gPafHeapIdExt,    //&SDRAM,                        // pExtern
882         &gPafHeapIdInt,    //&IRAM,                         // pInpbuf
883         &gPafHeapIdInt,    //&IRAM,                         // pOutbuf
884         &gPafHeapIdInt,    //&IRAM,                         // pFrmbuf
885         &gPafHeapIdInt1,   //&L3RAM,                        // pIntern1
886         1,                                                  // clear
887     },
888     {                                                       // common
889         params_memspace_PAi,                                // space
890     },
891     NULL,                                                   // z_rx_bufsiz
892     NULL,                                                   // z_tx_bufsiz
893     PAF_AST_params_numchan,                                 // z_numchan
894     256,                                                    // framelength
895     &PAF_AST_params_audioFrameFunctions,                    // pAudioFrameFunctions
896     &PAF_ASP_chainFxns,                                     // pChainFxns
897     &PAF_AST_params_inpBufStatus,                           // pInpBufStatus
898     NULL, //PAF_AST_params_decodeStatus,                            // z_pDecodeStatus
899     &PAF_AST_params_outBufStatus,                           // pOutBufStatus
900     PAF_AST_params_encodeStatus,                            // z_pEncodeStatus
901     &PAF_AST_params_volumeStatus,                           // pVolumeStatus
902     &PAF_ASP_params_decAlgKey,                              // pDecAlgKey
903     &PAF_ASP_params_encAlgKey,                              // pEncAlgKey
904     &PAF_ASP_params_decSioMap,                              // pDecSioMap
905     PAF_AST_streamsFromDecodes_std,                         // streamsFromDecodes
906     PAF_AST_streamsFromEncodes_std,                         // streamsFromEncodes
907     256,                                                    // maxFramelength
908     PAF_AST_streamOrder,                                    // streamOrder
909     inpLinkInit,                                            // i_inpLinkInit
910     outLinkInit,                                            // i_outLinkInit
911     outNumBufMap,                                           // outNumBufMap // FL: poutNumBufMap
912     PAF_AST_params_MetadataBufStatus,                       //metadata buffer status
913     PAF_AST_params_AudioFrameBufStatus                      //Audio frame buffer status
914 };
917 // EOF