]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - pasdk/test_arm/framework/itopo/params.c
PASDK-516:First version of ASOT refactoring
[processor-sdk/performance-audio-sr.git] / pasdk / test_arm / 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>
42 //#include <ti/procsdk_audio/procsdk_audio_typ.h>
43 #include <procsdk_audio_typ.h>
45 #include "paftyp.h"
46 #include <stdasp.h>
47 #include <pafsio_ialg.h>
49 #include "paf_heapMgr.h"
51 #include "asp1.h"
52 #include "audioStreamProc_params.h"
53 #include "audioStreamDecodeProc.h"
55 #include "dbgBenchmark.h" // PCM high-sampling rate + SRC + CAR benchmarking
57 //
58 // Framework Declarations
59 //
61 //#define PAF_AST_params_fxnsPA PAF_AST_params_fxnsPA17
63 //
64 // Audio Data Representation Definitions
65 //
66 //   External declarations to patched IROM provide standard functionality.
67 //
69 /* audio frame "width" in channels */
70 const SmInt PAF_AST_params_numchan[1] =
71 {
72     32,
73 };
75 ///
76 // Audio Stream Processing Function Table Definition
77 //
79 const PAF_AudioFunctions PAF_ASDT_params_audioFrameFunctions =
80 {
81     &PAF_ASP_dB2ToLinear,
82     &PAF_ASP_channelMask,
83     &PAF_ASP_programFormat,
84     &PAF_ASP_sampleRateHz,
85     &PAF_ASP_delay,
86 };
88 //
89 // Source Select Array Declarations -- algorithm keys & sio map
90 //
91 //   External declarations to patched IROM provide standard functionality.
92 //
94 const PAF_ASP_AlgKey PAF_ASP_params_decAlgKey =
95 {
96     PAF_SOURCE_N,                                           // length
97     /* Relies on the fact that ACP_SERIES_* != 0 here */
98     0,                                                      // PAF_SOURCE_UNKNOWN
99     0,                                                      // PAF_SOURCE_NONE
100     0,                                                      // PAF_SOURCE_PASS
101     PAF_ASP_ALPHACODE (STD, SNG),                           // PAF_SOURCE_SNG
102     0,                                                      // PAF_SOURCE_AUTO
103     0,                                                      // PAF_SOURCE_BITSTREAM
104     PAF_ASP_ALPHACODE (STD, DTSUHDA),                         // PAF_SOURCE_DTSALL
105     PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCMAUTO
106     PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCM
107     PAF_ASP_ALPHACODE (STD, PCN),                           // PAF_SOURCE_PC8 /* unused */
108     PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_AC3
109     PAF_ASP_ALPHACODE (STD, DTSUHDA),                         // PAF_SOURCE_DTS
110     PAF_ASP_ALPHACODE (STD, AAC),                           // PAF_SOURCE_AAC
111     PAF_ASP_ALPHACODE (STD, MPG),                           // PAF_SOURCE_MPEG /* unused */
112     PAF_ASP_ALPHACODE (STD, DTSUHDA),                         // PAF_SOURCE_DTS12
113     PAF_ASP_ALPHACODE (STD, DTSUHDA),                         // PAF_SOURCE_DTS13
114     PAF_ASP_ALPHACODE (STD, DTSUHDA),                         // PAF_SOURCE_DTS14
115     PAF_ASP_ALPHACODE (STD, DTSUHDA),                         // PAF_SOURCE_DTS16
116     0,                                                      // PAF_SOURCE_WMA9PRO
117     0,                                                      // PAF_SOURCE_MP3
118     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD1
119     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD2
120     PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD3
121     PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_DDP
122     PAF_ASP_ALPHACODE (STD, DTSUHDA),                       // PAF_SOURCE_DTSHD
123     PAF_ASP_ALPHACODE (STD, THD),                           // PAF_SOURCE_THD
124     PAF_ASP_ALPHACODE (STD, DXP),                           // PAF_SOURCE_DXP
125 };
127 //
128 // Mapping Declarations -- from *coders to *puts
129 //
130 //   External declarations to patched IROM provide standard functionality.
131 //
132 const SmInt PAF_AST_streamsFromDecodes_std[DECODEN_MAX] =
134     0, 1, 2,
135 };
137 const SmInt PAF_AST_inputsFromDecodes_std[DECODEN_MAX] =
139     0, 1, 2,
140 };
142 //
143 // Audio Framework Initialization Function Table Declarations
144 //
145 //   External declarations to patched IROM provide standard functionality.
146 //
148 extern const PAF_ASDT_Fxns PAF_ASDT_params_fxns;
150 const PAF_DecodeStatus PAF_AST_params_decodeStatus_primary =
152     sizeof (PAF_DecodeStatus),                              // size
153     1,                                                      // mode
154     0,                                                      // unused1
155     0,                                                      // command.action
156     0,                                                      // command.result
157     PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
158     PAF_SOURCE_NONE,                                        // sourceSelect
159     PAF_SOURCE_UNKNOWN,                                     // sourceProgram
160     PAF_SOURCE_UNKNOWN,                                     // sourceDecode
161     PAF_SOURCE_DUAL_STEREO,                                 // sourceDual
162     4,                                                      // sourceKaraoke: both
163     0,                                                      // aspGearControl: unused
164     0,                                                      // aspGearStatus: unused
165     0, 0, 0, 0,                                             // Unused
166     0, 0, 0, 0,                                             // Unused
167     0, 0, 0, 0,                                             // Unused
168     0, 0, 0, 0,                                             // Unused
169     0, 0, 0, 0,                                             // Unused
170     0,                                                      // frameCount
171     0x40,                                                   // karaoka: Vocal 1 Level
172     0x40,                                                   // karaoka: Vocal 1 Pan
173     0x40,                                                   // karaoka: Vocal 2 Level
174     0xc0,                                                   // karaoka: Vocal 2 Pan
175     0x40,                                                   // karaoka: Melody Level
176     0x00,                                                   // karaoka: Melody Pan
177     0,                                                      // decBypass
178     0,                                                      // unused
179     0,                                                      // frameLength: reset later
180     1,                                                      // bufferRatio: unity
181     PAF_IEC_PREEMPHASIS_UNKNOWN,                            // emphasis
182     0,                                                      // bufferDrift
183     0, 0,
184     PAF_CC_SAT_SURROUND4, PAF_CC_SUB_ONE, PAF_CC_AUX_SURROUND4_UNKNOWN, 0, 0, 0, 0, 0,    
185     // channelConfigurationRequest.full
186     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
187     // channelConfigurationProgram.full
188     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
189     // channelConfigurationDecode.full
190     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
191     // channelConfigurationDownmix.full
192     PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,    
193     // channelConfigurationOverride.full 
194     -3,                                                     // channelMap.from[0]
195     -3,                                                     // channelMap.from[1]
196     -3,                                                     // channelMap.from[2]
197     -3,                                                     // channelMap.from[3]
198     -3,                                                     // channelMap.from[4]
199     -3,                                                     // channelMap.from[5]
200     -3,                                                     // channelMap.from[6]
201     -3,                                                     // channelMap.from[7]
202     -3,                                                     // channelMap.from[8]
203     -3,                                                     // channelMap.from[9]
204     -3,                                                     // channelMap.from[10]
205     -3,                                                     // channelMap.from[11]
206     -3,                                                     // channelMap.from[12]
207     -3,                                                     // channelMap.from[13]
208     -3,                                                     // channelMap.from[14]
209     -3,                                                     // channelMap.from[15]
210     -3,                                                     // channelMap.from[16]
211     -3,                                                     // channelMap.from[17]
212     -3,                                                     // channelMap.from[18]
213     -3,                                                     // channelMap.from[19]
214     -3,                                                     // channelMap.from[20]
215     -3,                                                     // channelMap.from[21]
216     -3,                                                     // channelMap.from[22]
217     -3,                                                     // channelMap.from[23]
218     -3,                                                     // channelMap.from[24]
219     -3,                                                     // channelMap.from[25]
220     -3,                                                     // channelMap.from[26]
221     -3,                                                     // channelMap.from[27]
222     -3,                                                     // channelMap.from[28]
223     -3,                                                     // channelMap.from[29]
224     -3,                                                     // channelMap.from[30]
225     -3,                                                     // channelMap.from[31]
226     -3,                                                     // channelMap.to[0]
227     -3,                                                     // channelMap.to[1]
228     -3,                                                     // channelMap.to[2]
229     -3,                                                     // channelMap.to[3]
230     -3,                                                     // channelMap.to[4]
231     -3,                                                     // channelMap.to[5]
232     -3,                                                     // channelMap.to[6]
233     -3,                                                     // channelMap.to[7]
234     -3,                                                     // channelMap.to[8]
235     -3,                                                     // channelMap.to[9]
236     -3,                                                     // channelMap.to[10]
237     -3,                                                     // channelMap.to[11]
238     -3,                                                     // channelMap.to[12]
239     -3,                                                     // channelMap.to[13]
240     -3,                                                     // channelMap.to[14]
241     -3,                                                     // channelMap.to[15]
242     -3,                                                     // channelMap.to[16]
243     -3,                                                     // channelMap.to[17]
244     -3,                                                     // channelMap.to[18]
245     -3,                                                     // channelMap.to[19]
246     -3,                                                     // channelMap.to[20]
247     -3,                                                     // channelMap.to[21]
248     -3,                                                     // channelMap.to[22]
249     -3,                                                     // channelMap.to[23]
250     -3,                                                     // channelMap.to[24]
251     -3,                                                     // channelMap.to[25]
252     -3,                                                     // channelMap.to[26]
253     -3,                                                     // channelMap.to[27]
254     -3,                                                     // channelMap.to[28]
255     -3,                                                     // channelMap.to[29]
256     -3,                                                     // channelMap.to[30]
257     -3,                                                     // channelMap.to[31]
258     0,                                                      // programFormat.mask
259     0,                                                      // programFormat.form
260    
261 };
263 const PAF_DecodeStatus *const PAF_ASDT_params_decodeStatus[] =
265     &PAF_AST_params_decodeStatus_primary,
266 };
268 //
269 // Common Space Parameter Declarations and Definitions
270 //
271 //   Local definitions in RAM provide non-standard functionality.
272 //   The NULL pointer provides standard functionality.
273 //
275 /* baseline definition - NULL equivalent */
276 /* May be used for overrides of IALG_MemSpace */
278 static const IALG_MemSpace params_memspace_PAi_Slave[] = {
279     PAF_IALG_NONE,                                          // Scratch
280     PAF_IALG_NONE,                                          // Persistant
281     PAF_IALG_NONE,                                          // Write once
282     PAF_IALG_NONE,                                          // Common 1
283     PAF_IALG_NONE,                                          // Common 2
284     PAF_IALG_NONE,                                          // Common 3
285     PAF_IALG_NONE,                                          // Common 4
286     PAF_IALG_NONE,                                          // Common 5
287     PAF_IALG_NONE,                                          // Common 6
288     PAF_IALG_NONE,                                          // Common 7
289     IALG_EXTERNAL,                                          // Common 8
290     PAF_IALG_NONE,                                          // Common 9
291     PAF_IALG_NONE,                                          // Common 10
292     PAF_IALG_NONE,                                          // Common 11
293     PAF_IALG_NONE,                                          // Common 12
294     PAF_IALG_NONE,                                          // Common 13
295     PAF_IALG_NONE,                                          // Common 14
296     PAF_IALG_NONE,                                          // Common 15
297 };
299 //
300 // Heap Declarations
301 //
303 //#include <pafhjt.h>
305 // .............................................................................
306 const PAF_MetadataBufStatus PAF_ASDT_params_MetadataBufStatus[] =
308     PAF_MAX_PRIVATE_MD_SZ,  // bufSize
309     PAF_MAX_NUM_PRIVATE_MD, // NumBuf
310     128,                    // alignment
311     &gPafHeapIdExt          // pHeapIdMdbuf
312 };
314 // .............................................................................
315 //
316 // Audio Stream Parameter Definitions
317 //
318 //   Global definition in RAM provides standard & non-standard functionality.
319 //
321 const PAF_ASDT_Params asdp_params_PAi =
323     &PAF_ASDT_params_fxns,                                  // fxns
324     {                                                       // zone
325         0,                                                  // zone.master
326         1,                                                  // zone.decodes
327         0,                                                  // zone.decode1
328         1,                                                  // zone.decodeN
329         1,                                                  // zone.streams
330     },
331     PAF_AST_inputsFromDecodes_std,
332     {                                                       // heap
333         &gPafHeapIdInt1,                                    // heap.pHeapIdIntern
334         &gPafHeapIdExt,                                     // heap.pHeapIdExtern
335         &gPafHeapIdExt,                                     // heap.pHeapIdFrmbuf
336         &gPafHeapIdInt1,                                    // heap.pHeapIdIntern1
337         &gPafHeapIdInt1Shm,                                 // heap.pHeapIdInt1Shm
338         &gPafHeapIdExtShm,                                  // heap.pHeapIdExtShm
339         &gPafHeapIdExtNonCachedShm,                         // heap.pHeapIdExtNonCachedShm
340         1,                                                  // heap.clear
341     },
342     {                                                       // common
343         params_memspace_PAi_Slave,                          // common.space
344     },
345     PAF_AST_params_numchan,                                 // z_numchan
346     PAF_SYS_FRAMELENGTH,                                    // framelength
347     &PAF_ASDT_params_audioFrameFunctions,                   // pAudioFrameFunctions
348     &PAF_ASP_chainFxns,                                     // pChainFxns
349     PAF_ASDT_params_decodeStatus,                           // z_pDecodeStatus
350     &PAF_ASP_params_decAlgKey,                              // pDecAlgKey
351     PAF_AST_streamsFromDecodes_std,                         // streamsFromDecodes
352     14592,                                                  // maxFramelength set to match maximum value possible for a stream,
353                                                             // max for 192k THD:
354                                                             // 14592 = ((nearest 256 mutiple of (90AUs/frame * 160sample/AU))
355                                                             // + 256 samples remaining in wrapper from previous deccode)
356     PAF_ASDT_params_MetadataBufStatus,                      //metadata buffer status
357     NULL //PAF_AST_params_AudioFrameBufStatus                      //Audio frame buffer status
358 };
360 // EOF