Sound Open Firmware
Loading...
Searching...
No Matches
compress_params.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) AND MIT) */
2/*
3 * compress_params.h - codec types and parameters for compressed data
4 * streaming interface
5 *
6 * Copyright (C) 2011 Intel Corporation
7 * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
8 * Vinod Koul <vinod.koul@linux.intel.com>
9 *
10 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; version 2 of the License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 *
25 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 *
27 * The definitions in this file are derived from the OpenMAX AL version 1.1
28 * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below.
29 *
30 * Copyright (c) 2007-2010 The Khronos Group Inc.
31 *
32 * Permission is hereby granted, free of charge, to any person obtaining
33 * a copy of this software and/or associated documentation files (the
34 * "Materials "), to deal in the Materials without restriction, including
35 * without limitation the rights to use, copy, modify, merge, publish,
36 * distribute, sublicense, and/or sell copies of the Materials, and to
37 * permit persons to whom the Materials are furnished to do so, subject to
38 * the following conditions:
39 *
40 * The above copyright notice and this permission notice shall be included
41 * in all copies or substantial portions of the Materials.
42 *
43 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
44 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
47 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
48 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
49 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
50 *
51 */
52#ifndef __SND_COMPRESS_PARAMS_H
53#define __SND_COMPRESS_PARAMS_H
54
55#include <stdint.h>
56
57/* AUDIO CODECS SUPPORTED */
58#define MAX_NUM_CODECS 32
59#define MAX_NUM_CODEC_DESCRIPTORS 32
60#define MAX_NUM_BITRATES 32
61#define MAX_NUM_SAMPLE_RATES 32
62
63/* Codecs are listed linearly to allow for extensibility */
64#define SND_AUDIOCODEC_PCM ((uint32_t) 0x00000001)
65#define SND_AUDIOCODEC_MP3 ((uint32_t) 0x00000002)
66#define SND_AUDIOCODEC_AMR ((uint32_t) 0x00000003)
67#define SND_AUDIOCODEC_AMRWB ((uint32_t) 0x00000004)
68#define SND_AUDIOCODEC_AMRWBPLUS ((uint32_t) 0x00000005)
69#define SND_AUDIOCODEC_AAC ((uint32_t) 0x00000006)
70#define SND_AUDIOCODEC_WMA ((uint32_t) 0x00000007)
71#define SND_AUDIOCODEC_REAL ((uint32_t) 0x00000008)
72#define SND_AUDIOCODEC_VORBIS ((uint32_t) 0x00000009)
73#define SND_AUDIOCODEC_FLAC ((uint32_t) 0x0000000A)
74#define SND_AUDIOCODEC_IEC61937 ((uint32_t) 0x0000000B)
75#define SND_AUDIOCODEC_G723_1 ((uint32_t) 0x0000000C)
76#define SND_AUDIOCODEC_G729 ((uint32_t) 0x0000000D)
77#define SND_AUDIOCODEC_BESPOKE ((uint32_t) 0x0000000E)
78#define SND_AUDIOCODEC_ALAC ((uint32_t) 0x0000000F)
79#define SND_AUDIOCODEC_APE ((uint32_t) 0x00000010)
80#define SND_AUDIOCODEC_OPUS_RAW ((uint32_t) 0x00000011)
81#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_OPUS_RAW
82
83/*
84 * Profile and modes are listed with bit masks. This allows for a
85 * more compact representation of fields that will not evolve
86 * (in contrast to the list of codecs)
87 */
88
89#define SND_AUDIOPROFILE_PCM ((uint32_t) 0x00000001)
90
91/* MP3 modes are only useful for encoders */
92#define SND_AUDIOCHANMODE_MP3_MONO ((uint32_t) 0x00000001)
93#define SND_AUDIOCHANMODE_MP3_STEREO ((uint32_t) 0x00000002)
94#define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((uint32_t) 0x00000004)
95#define SND_AUDIOCHANMODE_MP3_DUAL ((uint32_t) 0x00000008)
96
97#define SND_AUDIOPROFILE_AMR ((uint32_t) 0x00000001)
98
99/* AMR modes are only useful for encoders */
100#define SND_AUDIOMODE_AMR_DTX_OFF ((uint32_t) 0x00000001)
101#define SND_AUDIOMODE_AMR_VAD1 ((uint32_t) 0x00000002)
102#define SND_AUDIOMODE_AMR_VAD2 ((uint32_t) 0x00000004)
103
104#define SND_AUDIOSTREAMFORMAT_UNDEFINED ((uint32_t) 0x00000000)
105#define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((uint32_t) 0x00000001)
106#define SND_AUDIOSTREAMFORMAT_IF1 ((uint32_t) 0x00000002)
107#define SND_AUDIOSTREAMFORMAT_IF2 ((uint32_t) 0x00000004)
108#define SND_AUDIOSTREAMFORMAT_FSF ((uint32_t) 0x00000008)
109#define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((uint32_t) 0x00000010)
110#define SND_AUDIOSTREAMFORMAT_ITU ((uint32_t) 0x00000020)
111
112#define SND_AUDIOPROFILE_AMRWB ((uint32_t) 0x00000001)
113
114/* AMRWB modes are only useful for encoders */
115#define SND_AUDIOMODE_AMRWB_DTX_OFF ((uint32_t) 0x00000001)
116#define SND_AUDIOMODE_AMRWB_VAD1 ((uint32_t) 0x00000002)
117#define SND_AUDIOMODE_AMRWB_VAD2 ((uint32_t) 0x00000004)
118
119#define SND_AUDIOPROFILE_AMRWBPLUS ((uint32_t) 0x00000001)
120
121#define SND_AUDIOPROFILE_AAC ((uint32_t) 0x00000001)
122
123/* AAC modes are required for encoders and decoders */
124#define SND_AUDIOMODE_AAC_MAIN ((uint32_t) 0x00000001)
125#define SND_AUDIOMODE_AAC_LC ((uint32_t) 0x00000002)
126#define SND_AUDIOMODE_AAC_SSR ((uint32_t) 0x00000004)
127#define SND_AUDIOMODE_AAC_LTP ((uint32_t) 0x00000008)
128#define SND_AUDIOMODE_AAC_HE ((uint32_t) 0x00000010)
129#define SND_AUDIOMODE_AAC_SCALABLE ((uint32_t) 0x00000020)
130#define SND_AUDIOMODE_AAC_ERLC ((uint32_t) 0x00000040)
131#define SND_AUDIOMODE_AAC_LD ((uint32_t) 0x00000080)
132#define SND_AUDIOMODE_AAC_HE_PS ((uint32_t) 0x00000100)
133#define SND_AUDIOMODE_AAC_HE_MPS ((uint32_t) 0x00000200)
134
135/* AAC formats are required for encoders and decoders */
136#define SND_AUDIOSTREAMFORMAT_MP2ADTS ((uint32_t) 0x00000001)
137#define SND_AUDIOSTREAMFORMAT_MP4ADTS ((uint32_t) 0x00000002)
138#define SND_AUDIOSTREAMFORMAT_MP4LOAS ((uint32_t) 0x00000004)
139#define SND_AUDIOSTREAMFORMAT_MP4LATM ((uint32_t) 0x00000008)
140#define SND_AUDIOSTREAMFORMAT_ADIF ((uint32_t) 0x00000010)
141#define SND_AUDIOSTREAMFORMAT_MP4FF ((uint32_t) 0x00000020)
142#define SND_AUDIOSTREAMFORMAT_RAW ((uint32_t) 0x00000040)
143
144#define SND_AUDIOPROFILE_WMA7 ((uint32_t) 0x00000001)
145#define SND_AUDIOPROFILE_WMA8 ((uint32_t) 0x00000002)
146#define SND_AUDIOPROFILE_WMA9 ((uint32_t) 0x00000004)
147#define SND_AUDIOPROFILE_WMA10 ((uint32_t) 0x00000008)
148#define SND_AUDIOPROFILE_WMA9_PRO ((uint32_t) 0x00000010)
149#define SND_AUDIOPROFILE_WMA9_LOSSLESS ((uint32_t) 0x00000020)
150#define SND_AUDIOPROFILE_WMA10_LOSSLESS ((uint32_t) 0x00000040)
151
152#define SND_AUDIOMODE_WMA_LEVEL1 ((uint32_t) 0x00000001)
153#define SND_AUDIOMODE_WMA_LEVEL2 ((uint32_t) 0x00000002)
154#define SND_AUDIOMODE_WMA_LEVEL3 ((uint32_t) 0x00000004)
155#define SND_AUDIOMODE_WMA_LEVEL4 ((uint32_t) 0x00000008)
156#define SND_AUDIOMODE_WMAPRO_LEVELM0 ((uint32_t) 0x00000010)
157#define SND_AUDIOMODE_WMAPRO_LEVELM1 ((uint32_t) 0x00000020)
158#define SND_AUDIOMODE_WMAPRO_LEVELM2 ((uint32_t) 0x00000040)
159#define SND_AUDIOMODE_WMAPRO_LEVELM3 ((uint32_t) 0x00000080)
160
161#define SND_AUDIOSTREAMFORMAT_WMA_ASF ((uint32_t) 0x00000001)
162/*
163 * Some implementations strip the ASF header and only send ASF packets
164 * to the DSP
165 */
166#define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((uint32_t) 0x00000002)
167
168#define SND_AUDIOPROFILE_REALAUDIO ((uint32_t) 0x00000001)
169
170#define SND_AUDIOMODE_REALAUDIO_G2 ((uint32_t) 0x00000001)
171#define SND_AUDIOMODE_REALAUDIO_8 ((uint32_t) 0x00000002)
172#define SND_AUDIOMODE_REALAUDIO_10 ((uint32_t) 0x00000004)
173#define SND_AUDIOMODE_REALAUDIO_SURROUND ((uint32_t) 0x00000008)
174
175#define SND_AUDIOPROFILE_VORBIS ((uint32_t) 0x00000001)
176
177#define SND_AUDIOMODE_VORBIS ((uint32_t) 0x00000001)
178
179#define SND_AUDIOPROFILE_FLAC ((uint32_t) 0x00000001)
180
181/*
182 * Define quality levels for FLAC encoders, from LEVEL0 (fast)
183 * to LEVEL8 (best)
184 */
185#define SND_AUDIOMODE_FLAC_LEVEL0 ((uint32_t) 0x00000001)
186#define SND_AUDIOMODE_FLAC_LEVEL1 ((uint32_t) 0x00000002)
187#define SND_AUDIOMODE_FLAC_LEVEL2 ((uint32_t) 0x00000004)
188#define SND_AUDIOMODE_FLAC_LEVEL3 ((uint32_t) 0x00000008)
189#define SND_AUDIOMODE_FLAC_LEVEL4 ((uint32_t) 0x00000010)
190#define SND_AUDIOMODE_FLAC_LEVEL5 ((uint32_t) 0x00000020)
191#define SND_AUDIOMODE_FLAC_LEVEL6 ((uint32_t) 0x00000040)
192#define SND_AUDIOMODE_FLAC_LEVEL7 ((uint32_t) 0x00000080)
193#define SND_AUDIOMODE_FLAC_LEVEL8 ((uint32_t) 0x00000100)
194
195#define SND_AUDIOSTREAMFORMAT_FLAC ((uint32_t) 0x00000001)
196#define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((uint32_t) 0x00000002)
197
198/* IEC61937 payloads without CUVP and preambles */
199#define SND_AUDIOPROFILE_IEC61937 ((uint32_t) 0x00000001)
200/* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */
201#define SND_AUDIOPROFILE_IEC61937_SPDIF ((uint32_t) 0x00000002)
202
203/*
204 * IEC modes are mandatory for decoders. Format autodetection
205 * will only happen on the DSP side with mode 0. The PCM mode should
206 * not be used, the PCM codec should be used instead.
207 */
208#define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((uint32_t) 0x00000000)
209#define SND_AUDIOMODE_IEC_LPCM ((uint32_t) 0x00000001)
210#define SND_AUDIOMODE_IEC_AC3 ((uint32_t) 0x00000002)
211#define SND_AUDIOMODE_IEC_MPEG1 ((uint32_t) 0x00000004)
212#define SND_AUDIOMODE_IEC_MP3 ((uint32_t) 0x00000008)
213#define SND_AUDIOMODE_IEC_MPEG2 ((uint32_t) 0x00000010)
214#define SND_AUDIOMODE_IEC_AACLC ((uint32_t) 0x00000020)
215#define SND_AUDIOMODE_IEC_DTS ((uint32_t) 0x00000040)
216#define SND_AUDIOMODE_IEC_ATRAC ((uint32_t) 0x00000080)
217#define SND_AUDIOMODE_IEC_SACD ((uint32_t) 0x00000100)
218#define SND_AUDIOMODE_IEC_EAC3 ((uint32_t) 0x00000200)
219#define SND_AUDIOMODE_IEC_DTS_HD ((uint32_t) 0x00000400)
220#define SND_AUDIOMODE_IEC_MLP ((uint32_t) 0x00000800)
221#define SND_AUDIOMODE_IEC_DST ((uint32_t) 0x00001000)
222#define SND_AUDIOMODE_IEC_WMAPRO ((uint32_t) 0x00002000)
223#define SND_AUDIOMODE_IEC_REF_CXT ((uint32_t) 0x00004000)
224#define SND_AUDIOMODE_IEC_HE_AAC ((uint32_t) 0x00008000)
225#define SND_AUDIOMODE_IEC_HE_AAC2 ((uint32_t) 0x00010000)
226#define SND_AUDIOMODE_IEC_MPEG_SURROUND ((uint32_t) 0x00020000)
227
228#define SND_AUDIOPROFILE_G723_1 ((uint32_t) 0x00000001)
229
230#define SND_AUDIOMODE_G723_1_ANNEX_A ((uint32_t) 0x00000001)
231#define SND_AUDIOMODE_G723_1_ANNEX_B ((uint32_t) 0x00000002)
232#define SND_AUDIOMODE_G723_1_ANNEX_C ((uint32_t) 0x00000004)
233
234#define SND_AUDIOPROFILE_G729 ((uint32_t) 0x00000001)
235
236#define SND_AUDIOMODE_G729_ANNEX_A ((uint32_t) 0x00000001)
237#define SND_AUDIOMODE_G729_ANNEX_B ((uint32_t) 0x00000002)
238
239/* <FIXME: multichannel encoders aren't supported for now. Would need
240 an additional definition of channel arrangement> */
241
242/* VBR/CBR definitions */
243#define SND_RATECONTROLMODE_CONSTANTBITRATE ((uint32_t) 0x00000001)
244#define SND_RATECONTROLMODE_VARIABLEBITRATE ((uint32_t) 0x00000002)
245
246/* Encoder options */
247
249 uint32_t super_block_align; /* WMA Type-specific data */
250};
251
252
275 int32_t quality;
276 uint32_t managed;
277 uint32_t max_bit_rate;
278 uint32_t min_bit_rate;
279 uint32_t downmix;
280} __attribute__((packed, aligned(4)));
281
282
294 uint32_t quant_bits;
295 uint32_t start_region;
296 uint32_t num_regions;
297} __attribute__((packed, aligned(4)));
298
320 uint32_t num;
321 uint32_t gain;
322} __attribute__((packed, aligned(4)));
323
325 uint32_t bw; /* encoder bandwidth */
326 int32_t reserved[15]; /* Can be used for SND_AUDIOCODEC_BESPOKE */
327} __attribute__((packed, aligned(4)));
328
330 uint16_t sample_size;
331 uint16_t min_blk_size;
332 uint16_t max_blk_size;
335 uint16_t reserved;
336} __attribute__((packed, aligned(4)));
337
342 uint32_t reserved;
343} __attribute__((packed, aligned(4)));
344
346 uint32_t frame_length;
348 uint8_t pb;
349 uint8_t mb;
350 uint8_t kb;
351 uint32_t max_run;
353} __attribute__((packed, aligned(4)));
354
358 uint32_t format_flags;
361 uint32_t total_frames;
363} __attribute__((packed, aligned(4)));
364
376
402 uint32_t max_ch;
406 uint32_t num_bitrates;
407 uint32_t rate_control;
408 uint32_t profiles;
409 uint32_t modes;
410 uint32_t formats;
411 uint32_t min_buffer;
412 uint32_t reserved[15];
413} __attribute__((packed, aligned(4)));
414
441struct snd_codec {
442 uint32_t id;
443 uint32_t ch_in;
444 uint32_t ch_out;
445 uint32_t sample_rate;
446 uint32_t bit_rate;
447 uint32_t rate_control;
448 uint32_t profile;
449 uint32_t level;
450 uint32_t ch_mode;
451 uint32_t format;
452 uint32_t align;
454 uint32_t reserved[3];
455} __attribute__((packed, aligned(4)));
456
457#endif
#define MAX_NUM_SAMPLE_RATES
Definition compress_params.h:61
#define MAX_NUM_BITRATES
Definition compress_params.h:60
struct snd_codec_desc - description of codec capabilities
Definition compress_params.h:401
uint32_t profiles
Definition compress_params.h:408
uint32_t sample_rates[MAX_NUM_SAMPLE_RATES]
Definition compress_params.h:403
uint32_t reserved[15]
Definition compress_params.h:412
uint32_t modes
Definition compress_params.h:409
uint32_t rate_control
Definition compress_params.h:407
uint32_t max_ch
Definition compress_params.h:402
uint32_t num_bitrates
Definition compress_params.h:406
uint32_t min_buffer
Definition compress_params.h:411
uint32_t bit_rate[MAX_NUM_BITRATES]
Definition compress_params.h:405
uint32_t num_sample_rates
Definition compress_params.h:404
uint32_t formats
Definition compress_params.h:410
struct snd_codec
Definition compress_params.h:441
uint32_t profile
Definition compress_params.h:448
uint32_t sample_rate
Definition compress_params.h:445
uint32_t align
Definition compress_params.h:452
uint32_t id
Definition compress_params.h:442
uint32_t rate_control
Definition compress_params.h:447
uint32_t bit_rate
Definition compress_params.h:446
uint32_t reserved[3]
Definition compress_params.h:454
uint32_t format
Definition compress_params.h:451
union snd_codec_options options
Definition compress_params.h:453
uint32_t level
Definition compress_params.h:449
uint32_t ch_out
Definition compress_params.h:444
uint32_t ch_in
Definition compress_params.h:443
uint32_t ch_mode
Definition compress_params.h:450
Definition compress_params.h:345
uint32_t frame_length
Definition compress_params.h:346
uint8_t mb
Definition compress_params.h:349
uint8_t compatible_version
Definition compress_params.h:347
uint8_t kb
Definition compress_params.h:350
uint32_t max_run
Definition compress_params.h:351
uint8_t pb
Definition compress_params.h:348
uint32_t max_frame_bytes
Definition compress_params.h:352
Definition compress_params.h:355
uint32_t blocks_per_frame
Definition compress_params.h:359
uint32_t final_frame_blocks
Definition compress_params.h:360
uint16_t compression_level
Definition compress_params.h:357
uint32_t seek_table_present
Definition compress_params.h:362
uint16_t compatible_version
Definition compress_params.h:356
uint32_t format_flags
Definition compress_params.h:358
uint32_t total_frames
Definition compress_params.h:361
Definition compress_params.h:329
uint16_t sample_size
Definition compress_params.h:330
uint16_t min_frame_size
Definition compress_params.h:333
uint16_t reserved
Definition compress_params.h:335
uint16_t max_blk_size
Definition compress_params.h:332
uint16_t max_frame_size
Definition compress_params.h:334
uint16_t min_blk_size
Definition compress_params.h:331
Definition compress_params.h:338
uint32_t reserved
Definition compress_params.h:342
uint32_t adv_encoder_option
Definition compress_params.h:340
uint32_t encoder_option
Definition compress_params.h:339
uint32_t adv_encoder_option2
Definition compress_params.h:341
struct snd_enc_flac
Definition compress_params.h:319
uint32_t num
Definition compress_params.h:320
uint32_t gain
Definition compress_params.h:321
Definition compress_params.h:324
uint32_t bw
Definition compress_params.h:325
int32_t reserved[15]
Definition compress_params.h:326
struct snd_enc_real
Definition compress_params.h:293
uint32_t num_regions
Definition compress_params.h:296
uint32_t quant_bits
Definition compress_params.h:294
uint32_t start_region
Definition compress_params.h:295
struct snd_enc_vorbis
Definition compress_params.h:274
int32_t quality
Definition compress_params.h:275
uint32_t managed
Definition compress_params.h:276
uint32_t downmix
Definition compress_params.h:279
uint32_t max_bit_rate
Definition compress_params.h:277
uint32_t min_bit_rate
Definition compress_params.h:278
Definition compress_params.h:248
uint32_t super_block_align
Definition compress_params.h:249
Definition compress_params.h:365
struct snd_enc_wma wma
Definition compress_params.h:366
struct snd_enc_flac flac
Definition compress_params.h:369
struct snd_enc_real real
Definition compress_params.h:368
struct snd_enc_generic generic
Definition compress_params.h:370
struct snd_dec_ape ape_d
Definition compress_params.h:374
struct snd_dec_alac alac_d
Definition compress_params.h:373
struct snd_enc_vorbis vorbis
Definition compress_params.h:367
struct snd_dec_flac flac_d
Definition compress_params.h:371
struct snd_dec_wma wma_d
Definition compress_params.h:372