1 /*
2 * DCA compatible decoder
3 * Copyright (C) 2004 Gildas Bazin
4 * Copyright (C) 2004 Benjamin Zores
5 * Copyright (C) 2006 Benjamin Larsson
6 * Copyright (C) 2007 Konstantin Shishkov
7 * Copyright (C) 2016 foo86
8 *
9 * This file is part of FFmpeg.
10 *
11 * FFmpeg is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * FFmpeg is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with FFmpeg; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #ifndef AVCODEC_DCA_H
27 #define AVCODEC_DCA_H
28
29 #include <stdint.h>
30
34
36
37 #define DCA_CORE_FRAME_HEADER_SIZE 18
38
50 };
51
78
88
90 };
91
121 };
122
123 #define DCA_SPEAKER_LAYOUT_MONO (DCA_SPEAKER_MASK_C)
124 #define DCA_SPEAKER_LAYOUT_STEREO (DCA_SPEAKER_MASK_L | DCA_SPEAKER_MASK_R)
125 #define DCA_SPEAKER_LAYOUT_2POINT1 (DCA_SPEAKER_LAYOUT_STEREO | DCA_SPEAKER_MASK_LFE1)
126 #define DCA_SPEAKER_LAYOUT_3_0 (DCA_SPEAKER_LAYOUT_STEREO | DCA_SPEAKER_MASK_C)
127 #define DCA_SPEAKER_LAYOUT_2_1 (DCA_SPEAKER_LAYOUT_STEREO | DCA_SPEAKER_MASK_Cs)
128 #define DCA_SPEAKER_LAYOUT_3_1 (DCA_SPEAKER_LAYOUT_3_0 | DCA_SPEAKER_MASK_Cs)
129 #define DCA_SPEAKER_LAYOUT_2_2 (DCA_SPEAKER_LAYOUT_STEREO | DCA_SPEAKER_MASK_Ls | DCA_SPEAKER_MASK_Rs)
130 #define DCA_SPEAKER_LAYOUT_5POINT0 (DCA_SPEAKER_LAYOUT_3_0 | DCA_SPEAKER_MASK_Ls | DCA_SPEAKER_MASK_Rs)
131 #define DCA_SPEAKER_LAYOUT_5POINT1 (DCA_SPEAKER_LAYOUT_5POINT0 | DCA_SPEAKER_MASK_LFE1)
132 #define DCA_SPEAKER_LAYOUT_7POINT0_WIDE (DCA_SPEAKER_LAYOUT_5POINT0 | DCA_SPEAKER_MASK_Lw | DCA_SPEAKER_MASK_Rw)
133 #define DCA_SPEAKER_LAYOUT_7POINT1_WIDE (DCA_SPEAKER_LAYOUT_7POINT0_WIDE | DCA_SPEAKER_MASK_LFE1)
134
135 #define DCA_HAS_STEREO(mask) \
136 ((mask & DCA_SPEAKER_LAYOUT_STEREO) == DCA_SPEAKER_LAYOUT_STEREO)
137
155 };
156
157 /**
158 * Return number of individual channels in DCASpeakerPair mask
159 */
161 {
162 return av_popcount((mask & 0xffff) | ((mask & 0xae66) << 16));
163 }
164
168 };
169
185 };
186
195
197 };
198
200
204
205
206 /**
207 * Convert bitstream to one representation based on sync marker
208 */
210 int max_size);
211
212 /**
213 * Parse and validate core frame header
214 * @return 0 on success, negative DCA_PARSE_ERROR_ code on failure
215 */
217
219
220 #endif /* AVCODEC_DCA_H */
int avpriv_dca_parse_core_frame_header(DCACoreFrameHeader *h, uint8_t *buf, int size)
Parse and validate core frame header.
bitstream reader API header.
int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size)
Convert bitstream to one representation based on sync marker.
static const uint16_t mask[17]
const uint8_t ff_dca_freq_ranges[16]
common internal API header
av_export const uint32_t avpriv_dca_sample_rates[16]
const uint8_t ff_dca_bits_per_sample[8]
int ff_dca_parse_core_frame_header(DCACoreFrameHeader *h, GetBitContext *gb)
static int ff_dca_count_chs_for_mask(unsigned int mask)
Return number of individual channels in DCASpeakerPair mask.
common internal and external API header
const uint32_t ff_dca_sampling_freqs[16]