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