26 #define BITSTREAM_READER_LE 61 float fft_buffer[4][8192 * 2];
62 float noise2_buffer[4096 * 2];
63 float noise_buffer[4096 * 2];
76 0x0, 0x1, 0x2, 0x3, 0x4, 0x6, 0x8, 0xA,
77 0xC, 0x10, 0x14, 0x18, 0x1C, 0x24, 0x2C, 0x34,
78 0x3C, 0x4C, 0x5C, 0x6C, 0x7C, 0x9C, 0xBC, 0xDC,
79 0xFC, 0x13C, 0x17C, 0x1BC, 0x1FC, 0x27C, 0x2FC, 0x37C,
80 0x3FC, 0x4FC, 0x5FC, 0x6FC, 0x7FC, 0x9FC, 0xBFC, 0xDFC,
81 0xFFC, 0x13FC, 0x17FC, 0x1BFC, 0x1FFC, 0x27FC, 0x2FFC, 0x37FC,
82 0x3FFC, 0x4FFC, 0x5FFC, 0x6FFC, 0x7FFC, 0x9FFC, 0xBFFC, 0xDFFC,
83 0xFFFC, 0x13FFC, 0x17FFC, 0x1BFFC, 0x1FFFC, 0x27FFC, 0x2FFFC, 0x37FFC,
88 1.18750000f, 1.68359380f, 2.37500000f, 3.36718750f, 4.75000000f,
89 6.73437500f, 9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f,
90 38.0000000f, 53.8750000f, 76.0000000f, 107.750000f, 152.000000f,
91 215.500000f, 304.000000f, 431.000000f, 608.000000f, 862.000000f,
92 1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f, 4864.00000f,
93 6896.00000f, 9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f,
94 38912.0000f, 55168.0000f, 77824.0000f, 110336.000f, 155648.000f,
95 220672.000f, 311296.000f, 441344.000f, 622592.000f, 882688.000f,
96 1245184.00f, 1765376.00f, 2490368.00f, 3530752.00f, 4980736.00f,
97 7061504.00f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
101 0, 1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 56, 64,
102 80, 96, 120, 144, 176, 208, 240, 256,
103 0, 2, 4, 8, 16, 24, 32, 48, 56, 64, 80, 104,
104 128, 160, 208, 256, 0, 0, 0, 0, 0,
105 0, 2, 4, 8, 16, 32, 48, 64, 80, 112, 160, 208,
106 256, 0, 0, 0, 0, 0, 0, 0, 0,
107 0, 4, 8, 16, 32, 48, 64, 96, 144, 208, 256,
108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 4, 16, 32, 64, 256, 0, 0, 0, 0, 0, 0, 0, 0,
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
114 19, 14, 11, 9, 4, 2, 0
122 12, 7, 9, 7, 10, 9, 11, 9, 9, 2, 9, 9, 9, 9,
123 9, 3, 9, 10, 10, 12, 2, 3, 3, 5, 5, 6, 7,
127 0, 10, 11, 12, 13, 14, 15, 16, 18, 1, 20, 22, 24,
128 26, 28, 2, 30, 32, 34, 36, 3, 4, 5, 6, 7, 8, 9,
132 0xC7A, 0x002, 0x0FA, 0x03A, 0x35A, 0x1C2, 0x07A, 0x1FA,
133 0x17A, 0x000, 0x0DA, 0x142, 0x0C2, 0x042, 0x1DA, 0x001,
134 0x05A, 0x15A, 0x27A, 0x47A, 0x003, 0x005, 0x006, 0x012,
139 10, 8, 5, 1, 2, 4, 4, 4, 6, 7, 9, 10,
143 0, 13, 17, 1, 2, 3, 4, 5, 6, 7, 8, 9,
147 0x30B, 0x8B, 0x1B, 0x0, 0x1, 0x3, 0x7, 0xF, 0x2b, 0x4B, 0xB, 0x10B,
151 18, 2, 4, 4, 5, 4, 4, 5, 5, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 6,
152 7, 6, 6, 6, 7, 7, 7, 7, 7, 8, 9, 9, 8, 9, 11, 11, 12, 12, 13, 12,
157 0x2AD46, 0x1, 0x0, 0x3, 0xC, 0xA, 0x7, 0x18, 0x12, 0xE, 0x4, 0x16,
158 0xF, 0x1C, 0x8, 0x22, 0x26, 0x2, 0x3B, 0x34, 0x74, 0x1F, 0x14, 0x2B,
159 0x1B, 0x3F, 0x28, 0x54, 0x6, 0x4B, 0xB, 0x68, 0xE8, 0x46, 0xC6, 0x1E8,
160 0x146, 0x346, 0x546, 0x746, 0x1D46, 0xF46, 0xD46, 0x6D46, 0xAD46, 0x2D46,
165 13, 7, 8, 9, 10, 10, 10, 10, 10, 9, 8, 7, 6,
166 5, 4, 3, 3, 2, 3, 3, 4, 5, 7, 8, 9, 11, 12, 13,
170 0x1EC6, 0x6, 0xC2, 0x142, 0x242, 0x246, 0xC6, 0x46, 0x42, 0x146, 0xA2,
171 0x62, 0x26, 0x16, 0xE, 0x5, 0x4, 0x3, 0x0, 0x1, 0xA, 0x12, 0x2, 0x22,
172 0x1C6, 0x2C6, 0x6C6, 0xEC6,
176 8, 2, 1, 3, 4, 5, 6, 7, 8,
180 0xFE, 0x0, 0x1, 0x2, 0x6, 0xE, 0x1E, 0x3E, 0x7E,
184 6, 2, 2, 4, 4, 6, 5, 4, 2,
188 0x35, 0x2, 0x0, 0x1, 0xD, 0x15, 0x5, 0x9, 0x3,
191 #define INIT_VLC_STATIC_LE(vlc, nb_bits, nb_codes, \ 192 bits, bits_wrap, bits_size, \ 193 codes, codes_wrap, codes_size, \ 194 symbols, symbols_wrap, symbols_size, \ 197 static VLC_TYPE table[static_size][2]; \ 198 (vlc)->table = table; \ 199 (vlc)->table_allocated = static_size; \ 200 ff_init_vlc_sparse(vlc, nb_bits, nb_codes, \ 201 bits, bits_wrap, bits_size, \ 202 codes, codes_wrap, codes_size, \ 203 symbols, symbols_wrap, symbols_size, \ 204 INIT_VLC_LE | INIT_VLC_USE_NEW_STATIC); \ 225 for (i = 0; i < 512; i++)
231 int i, j, n0, n1, n2,
diff;
240 for (i = 0; i + n0 < n1; i++, nptr++)
241 nptr[0] = i / (
float)(n1 - n0);
246 for (i = n1; i < n2; i++, nptr++, diff--)
247 nptr[0] = diff / (
float)(n2 - n1);
254 int fft_size, fft_order,
size,
g, j, x;
265 if (bytestream2_peek_be64(&b) == (((uint64_t)
MKBETAG(
'f',
'r',
'm',
'a') << 32) |
266 (uint64_t)
MKBETAG(
'Q',
'D',
'M',
'C')))
278 size = bytestream2_get_be32u(&b);
285 if (bytestream2_get_be32u(&b) !=
MKBETAG(
'Q',
'D',
'C',
'A')) {
300 avctx->
bit_rate = bytestream2_get_be32u(&b);
302 fft_size = bytestream2_get_be32u(&b);
303 fft_order =
av_log2(fft_size) + 1;
327 if ((fft_order < 7) || (fft_order > 9)) {
332 if (fft_size != (1 << (fft_order - 1))) {
341 for (g = 5; g > 0; g--) {
342 for (j = 0; j < (1 <<
g) - 1; j++)
391 if (label !=
MKTAG(
'Q',
'M',
'C', 1))
402 int ch, j, k, v, idx,
band, lastval, newval,
len;
417 for (j = 0; j < 15;) {
428 newval = lastval + (v + 1) / 2;
430 newval = lastval - v / 2;
436 for (k = 1; idx <= j +
len; k++, idx++)
437 s->
noise[ch][band][idx] = lastval + k * (newval - lastval) / len - 1;
467 int amp,
phase, stereo_mode = 0, i, group,
freq, group_size, group_bits;
468 int amp2, phase2, pos2, off;
470 for (group = 0; group < 5; group++) {
471 group_size = 1 << (s->
frame_bits - group - 1);
472 group_bits = 4 - group;
476 for (i = 1; ; i = freq + 1) {
484 while (freq >= group_size - 1) {
485 freq += 2 - group_size;
487 off += 1 << group_bits;
501 if (stereo_mode > 1) {
510 phase2 = phase - phase2;
517 add_tone(s, group, off, freq, stereo_mode & 1, amp, phase);
519 add_tone(s, group, off, freq, ~stereo_mode & 1, amp2, phase2);
529 int subframe_size, i, j, k,
length;
530 float scale, *noise_ptr;
534 if (subframe_size >= node2)
535 subframe_size = node2;
536 length = (subframe_size - node1) & 0xFFFC;
540 for (i = 0; i <
length; i += 4, j+= 4, noise_ptr += 4) {
549 for (i = length; i < subframe_size - node1; i++, k++, noise_ptr++)
566 aindex = s->
noise[
ch][i][current_subframe / 2];
567 amplitude = aindex > 0 ?
amplitude_tab[aindex & 0x3F] : 0.0f;
574 float rnd_re, rnd_im;
589 int j, group_bits, pos, pindex;
595 group_bits = 4 - group;
596 pos = freqs >> (4 - group);
600 pindex = (phase << 6) - ((2 * (freqs >> (4 - group)) + 1) << 7);
601 for (j = 0; j < (1 << (group_bits + 1)) - 1; j++) {
602 pindex += (2 * freqs + 1) << (7 - group_bits);
603 level = amplitude * s->
alt_sin[group][j];
605 re = level * sin_table[(pindex + 128) & 0x1FF];
628 im = level *
sin_table[ (phase << 6) & 0x1FF];
629 re = level *
sin_table[((phase << 6) + 128) & 0x1FF];
641 for (g = 0; g < 4; g++) {
642 for (w = s->
cur_tone[g]; w < s->nb_tones[g]; w++) {
645 if (current_subframe < t->
offset)
651 for (w = s->
cur_tone[4]; w < s->nb_tones[4]; w++) {
654 if (current_subframe < t->
offset)
679 for (n = 0; n < 32; n++) {
710 out[i] = av_clipf(r[i], INT16_MIN, INT16_MAX);
741 int *got_frame_ptr,
AVPacket *avpkt)
static const uint32_t freq_diff_codes[]
static const uint16_t qdmc_nodes[112]
static const uint16_t amplitude_codes[]
static int qdmc_get_vlc(GetBitContext *gb, VLC *table, int flag)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
static int noise(AVBSFContext *ctx, AVPacket *out)
static void flush(AVCodecContext *avctx)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
static av_cold int init(AVCodecContext *avctx)
static const uint8_t noise_bands_size[]
#define avpriv_request_sample(...)
static const uint16_t noise_segment_length_codes[]
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AV_CH_LAYOUT_STEREO
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static float sin_table[512]
static av_cold int qdmc_decode_close(AVCodecContext *avctx)
enum AVSampleFormat sample_fmt
audio sample format
static const uint8_t amplitude_bits[]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
bitstream reader API header.
static av_cold void qdmc_flush(AVCodecContext *avctx)
static const uint8_t phase_diff_bits[]
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void(* fft_permute)(struct FFTContext *s, FFTComplex *z)
Do the permutation needed BEFORE calling fft_calc().
float fft_buffer[4][8192 *2]
static const struct endianess table[]
static const uint8_t noise_bands_selector[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
const char * name
Name of the codec implementation.
static void add_wave(QDMCContext *s, int offset, int freqs, int group, int stereo_mode, int amp, int phase)
static const uint8_t freq_diff_bits[]
uint64_t channel_layout
Audio channel layout.
#define INIT_VLC_STATIC_LE(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, symbols, symbols_wrap, symbols_size, static_size)
audio channel layout utility functions
static int decode_frame(QDMCContext *s, GetBitContext *gb, int16_t *out)
static const uint8_t noise_segment_length_bits[]
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static const uint8_t amplitude_diff_codes[]
static void add_noise(QDMCContext *s, int ch, int current_subframe)
static volatile int checksum
#define FF_ARRAY_ELEMS(a)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static const uint16_t noise_value_codes[]
static void add_tone(QDMCContext *s, int group, int offset, int freq, int stereo_mode, int amplitude, int phase)
static int skip_label(QDMCContext *s, GetBitContext *gb)
Libavcodec external API header.
int sample_rate
samples per second
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static void make_noises(QDMCContext *s)
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static int read_noise_data(QDMCContext *s, GetBitContext *gb)
static const uint8_t noise_value_bits[]
static void lin_calc(QDMCContext *s, float amplitude, int node1, int node2, int index)
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(INT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&HAVE_MMX) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch ch
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
float noise2_buffer[4096 *2]
static const uint8_t phase_diff_codes[]
static const uint8_t amplitude_diff_bits[]
static void add_waves(QDMCContext *s, int current_subframe)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void add_wave0(QDMCContext *s, int offset, int freqs, int stereo_mode, int amp, int phase)
common internal api header.
static const float amplitude_tab[64]
void(* fft_calc)(struct FFTContext *s, FFTComplex *z)
Do a complex FFT with the parameters defined in ff_fft_init().
static const unsigned code_prefix[]
static const uint8_t noise_value_symbols[]
#define MKBETAG(a, b, c, d)
static av_always_inline int diff(const uint32_t a, const uint32_t b)
int channels
number of audio channels
VLC_TYPE(* table)[2]
code, bits
static av_cold void qdmc_init_static_data(AVCodec *codec)
static av_cold int qdmc_decode_init(AVCodecContext *avctx)
#define AV_CH_LAYOUT_MONO
#define MKTAG(a, b, c, d)
This structure stores compressed data.
static int read_wave_data(QDMCContext *s, GetBitContext *gb)
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static const uint8_t noise_segment_length_symbols[]
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
float noise_buffer[4096 *2]
static int qdmc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)