38#define BITSTREAM_READER_LE
51#define V_MAX_VLCS (1 << 16)
52#define V_MAX_PARTITIONS (1 << 20)
66struct vorbis_context_s;
130typedef struct vorbis_context_s {
171 (13.1f * atan(0.00074f * (x)) + 2.24f * atan(1.85e-8f * (x) * (x)) + 1e-4f * (x))
173static const char idx_err_str[] =
"Index value %d out of range (0 - %d) for %s at %s:%i\n";
174#define VALIDATE_INDEX(idx, limit) \
176 av_log(vc->avctx, AV_LOG_ERROR,\
178 (int)(idx), (int)(limit - 1), #idx, __FILE__, __LINE__);\
179 return AVERROR_INVALIDDATA;\
181#define GET_VALIDATED_INDEX(idx, bits, limit) \
183 idx = get_bits(gb, bits);\
184 VALIDATE_INDEX(idx, limit)\
189 float mant =
val & 0x1fffff;
190 int exp = (
val & 0x7fe00000) >> 21;
191 if (
val & 0x80000000)
193 return ldexpf(mant,
exp - 20 - 768);
252 uint8_t *tmp_vlc_bits =
NULL;
253 uint32_t *tmp_vlc_codes =
NULL;
255 uint16_t *codebook_multiplicands =
NULL;
267 !tmp_vlc_bits || !tmp_vlc_codes || !codebook_multiplicands) {
274 unsigned ordered, t, entries, used_entries = 0;
280 " %u. Codebook setup data corrupt.\n",
cb);
288 " %u. Codebook's dimension is invalid (%d).\n",
296 " %u. Codebook has too many entries (%u).\n",
304 ff_dlog(
NULL,
" codebook_dimensions %d, codebook_entries %u\n",
317 for (ce = 0; ce < entries; ++ce) {
320 tmp_vlc_bits[ce] =
get_bits(gb, 5) + 1;
323 tmp_vlc_bits[ce] = 0;
328 used_entries = entries;
329 for (ce = 0; ce < entries; ++ce)
330 tmp_vlc_bits[ce] =
get_bits(gb, 5) + 1;
333 unsigned current_entry = 0;
334 unsigned current_length =
get_bits(gb, 5) + 1;
336 ff_dlog(
NULL,
" ordered, current length: %u\n", current_length);
338 used_entries = entries;
339 for (; current_entry < used_entries && current_length <= 32; ++current_length) {
348 for (
i = current_entry;
i < number+current_entry; ++
i)
349 if (
i < used_entries)
350 tmp_vlc_bits[
i] = current_length;
352 current_entry+=number;
354 if (current_entry>used_entries) {
374 unsigned codebook_value_bits =
get_bits(gb, 4) + 1;
375 unsigned codebook_sequence_p =
get_bits1(gb);
377 if (!isfinite(codebook_minimum_value) || !isfinite(codebook_delta_value)) {
381 ff_dlog(
NULL,
" We expect %d numbers for building the codevectors. \n",
382 codebook_lookup_values);
384 codebook_delta_value, codebook_minimum_value);
386 for (
i = 0;
i < codebook_lookup_values; ++
i) {
387 codebook_multiplicands[
i] =
get_bits(gb, codebook_value_bits);
389 ff_dlog(
NULL,
" multiplicands*delta+minimum : %e \n",
390 (
float)codebook_multiplicands[
i] * codebook_delta_value + codebook_minimum_value);
391 ff_dlog(
NULL,
" multiplicand %u\n", codebook_multiplicands[
i]);
406 for (j = 0,
i = 0;
i < entries; ++
i) {
409 if (tmp_vlc_bits[
i]) {
411 unsigned lookup_offset =
i;
415 for (k = 0; k <
dim; ++k) {
416 unsigned multiplicand_offset = lookup_offset % codebook_lookup_values;
417 codebook_setup->
codevectors[j *
dim + k] = codebook_multiplicands[multiplicand_offset] * codebook_delta_value + codebook_minimum_value + last;
418 if (codebook_sequence_p)
420 lookup_offset/=codebook_lookup_values;
422 tmp_vlc_bits[j] = tmp_vlc_bits[
i];
424 ff_dlog(vc->
avctx,
"real lookup offset %u, vector: ", j);
425 for (k = 0; k <
dim; ++k)
433 if (j != used_entries) {
438 entries = used_entries;
452 for (t = 0; t < entries; ++t)
453 if (tmp_vlc_bits[t] >= codebook_setup->
maxdepth)
454 codebook_setup->
maxdepth = tmp_vlc_bits[t];
464 entries, tmp_vlc_bits,
sizeof(*tmp_vlc_bits),
465 sizeof(*tmp_vlc_bits), tmp_vlc_codes,
466 sizeof(*tmp_vlc_codes),
sizeof(*tmp_vlc_codes),
475 av_free(codebook_multiplicands);
482 av_free(codebook_multiplicands);
491 unsigned i, vorbis_time_count =
get_bits(gb, 6) + 1;
493 for (
i = 0;
i < vorbis_time_count; ++
i) {
494 unsigned vorbis_tdtransform =
get_bits(gb, 16);
496 ff_dlog(
NULL,
" Vorbis time domain transform %u: %u\n",
497 vorbis_time_count, vorbis_tdtransform);
499 if (vorbis_tdtransform) {
533 int maximum_class = -1;
534 unsigned rangebits, rangemax, floor1_values = 2;
548 ff_dlog(
NULL,
" %d. floor %d partition class %d \n",
553 ff_dlog(
NULL,
" maximum class %d \n", maximum_class);
555 for (j = 0; j <= maximum_class; ++j) {
559 ff_dlog(
NULL,
" %d floor %d class dim: %d subclasses %d \n",
i, j,
593 "A rangebits value of 0 is not compliant with the Vorbis I specification.\n");
596 rangemax = (1 << rangebits);
599 "Floor value is too large for blocksize: %u (%"PRIu32
")\n",
610 ff_dlog(
NULL,
" %u. floor1 Y coord. %d\n", floor1_values,
622 unsigned max_codebook_dim = 0;
639 "Floor 0 bark map size is 0.\n");
719 unsigned high_bits, low_bits;
729 if (res_setup->
begin>res_setup->
end ||
732 "partition out of bounds: type, begin, end, size, blocksize: %"PRIu16
", %"PRIu32
", %"PRIu32
", %u, %"PRIu32
"\n",
749 ff_dlog(
NULL,
" begin %"PRIu32
" end %"PRIu32
" part.size %u classif.s %"PRIu8
" classbook %"PRIu8
"\n",
758 cascade[j] = (high_bits << 3) + low_bits;
765 for (k = 0; k < 8; ++k) {
766 if (cascade[j]&(1 << k)) {
769 ff_dlog(
NULL,
" %u class cascade depth %u book: %d\n",
770 j, k, res_setup->
books[j][k]);
775 res_setup->
books[j][k] = -1;
801 av_log(vc->
avctx,
AV_LOG_ERROR,
"Other mappings than type 0 are not compliant with the Vorbis I specification. \n");
814 "Square polar channel mapping with less than two channels is not compliant with the Vorbis I specification.\n");
820 sizeof(*mapping_setup->
angle));
840 if (mapping_setup->
submaps>1) {
842 sizeof(*mapping_setup->
mux));
843 if (!mapping_setup->
mux)
850 for (j = 0; j < mapping_setup->
submaps; ++j) {
855 ff_dlog(
NULL,
" %u mapping %u submap : floor %d, residue %d\n",
i, j,
873 for (blockflag = 0; blockflag < 2; ++blockflag) {
875 floors[floor_number].
data.
t0.
map[blockflag] =
877 if (!floors[floor_number].
data.t0.map[blockflag])
883 for (idx = 0; idx < n; ++idx) {
885 (
vf->bark_map_size /
BARK(
vf->rate / 2.0f)));
886 if (
vf->bark_map_size-1 <
map[idx])
887 map[idx] =
vf->bark_map_size - 1;
890 vf->map_size[blockflag] = n;
893 for (idx = 0; idx <= n; ++idx) {
894 ff_dlog(
NULL,
"floor0 map: map at pos %d is %"PRId32
"\n", idx,
map[idx]);
920 "Invalid mode: windowtype %u, transformtype %u (both must be 0)\n",
925 ff_dlog(
NULL,
" %u mode: blockflag %d, windowtype %d, transformtype %d, mapping %d\n",
1010 if (bl0 > 13 || bl0 < 6 || bl1 > 13 || bl1 < 6 || bl1 < bl0) {
1045 ff_dlog(
NULL,
" vorbis version %"PRIu32
" \n audio_channels %"PRIu8
" \n audio_samplerate %"PRIu32
" \n bitrate_max %"PRIu32
" \n bitrate_nom %"PRIu32
" \n bitrate_min %"PRIu32
" \n blk_0 %"PRIu32
" blk_1 %"PRIu32
" \n ",
1061 const uint8_t *headers,
int headers_len)
1064 const uint8_t *header_start[3];
1076 if (hdr_type != 1) {
1088 if (hdr_type != 5) {
1137 float *lsp =
vf->lsp;
1142 if (!
vf->amplitude_bits)
1146 if (amplitude > 0) {
1148 unsigned idx, lsp_len = 0;
1152 if (book_idx >=
vf->num_books) {
1156 ff_dlog(
NULL,
"floor0 dec: booknumber: %u\n", book_idx);
1162 while (lsp_len<vf->order) {
1173 ff_dlog(
NULL,
"floor0 dec: vector offset: %d\n", vec_off);
1175 for (idx = 0; idx <
codebook.dimensions; ++idx)
1176 lsp[lsp_len+idx] =
codebook.codevectors[vec_off+idx] + last;
1177 last = lsp[lsp_len+idx-1];
1184 for (idx = 0; idx < lsp_len; ++idx)
1185 ff_dlog(
NULL,
"floor0 dec: coeff at %d is %f\n", idx, lsp[idx]);
1191 int order =
vf->order;
1192 float wstep =
M_PI /
vf->bark_map_size;
1194 for (
i = 0;
i < order;
i++)
1195 lsp[
i] = 2.0f * cos(lsp[
i]);
1197 ff_dlog(
NULL,
"floor0 synth: map_size = %"PRIu32
"; m = %d; wstep = %f\n",
1198 vf->map_size[blockflag], order, wstep);
1201 while (
i < vf->map_size[blockflag]) {
1202 int j, iter_cond =
vf->map[blockflag][
i];
1205 float two_cos_w = 2.0f * cos(wstep * iter_cond);
1208 for (j = 0; j + 1 < order; j += 2) {
1209 q *= lsp[j] - two_cos_w;
1210 p *= lsp[j + 1] - two_cos_w;
1213 p *= p * (2.0f - two_cos_w);
1214 q *= q * (2.0f + two_cos_w);
1216 q *= two_cos_w-lsp[j];
1219 p *= p * (4.f - two_cos_w * two_cos_w);
1227 q =
exp((((amplitude*
vf->amplitude_offset) /
1228 (((1ULL <<
vf->amplitude_bits) - 1) * sqrt(p + q)))
1229 -
vf->amplitude_offset) * .11512925f);
1234 }
while (
vf->map[blockflag][
i] == iter_cond);
1252 uint16_t range_v[4] = { 256, 128, 86, 64 };
1253 unsigned range = range_v[
vf->multiplier - 1];
1254 uint16_t floor1_Y[258];
1255 uint16_t floor1_Y_final[258];
1256 int floor1_flag[258];
1257 unsigned partition_class, cdim, cbits, csub, cval,
offset,
i, j;
1258 int book, adx, ady, dy, off, predicted, err;
1269 ff_dlog(
NULL,
"floor 0 Y %d floor 1 Y %d \n", floor1_Y[0], floor1_Y[1]);
1272 for (
i = 0;
i <
vf->partitions; ++
i) {
1273 partition_class =
vf->partition_class[
i];
1274 cdim =
vf->class_dimensions[partition_class];
1275 cbits =
vf->class_subclasses[partition_class];
1276 csub = (1 << cbits) - 1;
1285 for (j = 0; j < cdim; ++j) {
1286 book =
vf->subclass_books[partition_class][cval & csub];
1288 ff_dlog(
NULL,
"book %d Cbits %u cval %u bits:%d\n",
1291 cval = cval >> cbits;
1312 floor1_Y_final[0] = floor1_Y[0];
1313 floor1_Y_final[1] = floor1_Y[1];
1315 for (
i = 2;
i <
vf->x_list_dim; ++
i) {
1316 unsigned val, highroom, lowroom, room, high_neigh_offs, low_neigh_offs;
1318 low_neigh_offs =
vf->list[
i].low;
1319 high_neigh_offs =
vf->list[
i].high;
1320 dy = floor1_Y_final[high_neigh_offs] - floor1_Y_final[low_neigh_offs];
1321 adx =
vf->list[high_neigh_offs].x -
vf->list[low_neigh_offs].x;
1323 err = ady * (
vf->list[
i].x -
vf->list[low_neigh_offs].x);
1326 predicted = floor1_Y_final[low_neigh_offs] - off;
1328 predicted = floor1_Y_final[low_neigh_offs] + off;
1332 highroom =
range-predicted;
1333 lowroom = predicted;
1334 if (highroom < lowroom) {
1335 room = highroom * 2;
1340 floor1_flag[low_neigh_offs] = 1;
1341 floor1_flag[high_neigh_offs] = 1;
1344 if (highroom > lowroom) {
1361 ff_dlog(
NULL,
" Decoded floor(%d) = %u / val %u\n",
1362 vf->list[
i].x, floor1_Y_final[
i],
val);
1376 uint8_t *do_not_decode,
1378 int partition_count,
1384 unsigned c_p_c =
codebook->dimensions;
1387 for (p = 0, j = 0; j < ch_used; ++j) {
1388 if (!do_not_decode[j]) {
1398 "Invalid vlc code decoding %d channel.", j);
1403 for (
i = partition_count + c_p_c - 1;
i >= partition_count;
i--) {
1404 if (
i < ptns_to_read)
1408 for (
i = partition_count + c_p_c - 1;
i >= partition_count;
i--) {
1409 temp2 = (((uint64_t)
temp) * inverse_class) >> 32;
1411 if (
i < ptns_to_read)
1426 uint8_t *do_not_decode,
1435 unsigned pass, ch_used,
i, j, k, l;
1436 unsigned max_output = (ch - 1) * vlen;
1438 int libvorbis_bug = 0;
1441 for (j = 1; j < ch; ++j)
1442 do_not_decode[0] &= do_not_decode[j];
1443 if (do_not_decode[0])
1446 max_output += vr->
end / ch;
1449 max_output += vr->
end;
1452 if (max_output > ch_left * vlen) {
1453 if (max_output <= ch_left * vlen + vr->partition_size*ch_used/ch) {
1462 ff_dlog(
NULL,
" residue type 0/1/2 decode begin, ch: %d cpc %d \n", ch, c_p_c);
1464 for (pass = 0; pass <= vr->
maxpass; ++pass) {
1465 int voffset, partition_count, j_times_ptns_to_read;
1467 voffset = vr->
begin;
1468 for (partition_count = 0; partition_count < ptns_to_read;) {
1470 int ret =
setup_classifs(vc, vr, do_not_decode, ch_used, partition_count, ptns_to_read);
1474 for (
i = 0; (
i < c_p_c) && (partition_count < ptns_to_read); ++
i) {
1475 for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) {
1478 if (!do_not_decode[j]) {
1479 unsigned vqclass = classifs[j_times_ptns_to_read + partition_count];
1480 int vqbook = vr->
books[vqclass][pass];
1495 voffs = voffset+j*vlen;
1496 for (k = 0; k < step; ++k) {
1501 for (l = 0; l <
dim; ++l)
1502 vec[voffs + k + l * step] +=
codebook.codevectors[coffs + l];
1504 }
else if (vr_type == 1) {
1505 voffs = voffset + j * vlen;
1506 for (k = 0; k < step; ++k) {
1511 for (l = 0; l <
dim; ++l, ++voffs) {
1512 vec[voffs]+=
codebook.codevectors[coffs+l];
1514 ff_dlog(
NULL,
" pass %d offs: %d curr: %f change: %f cv offs.: %d \n",
1515 pass, voffs, vec[voffs],
codebook.codevectors[coffs+l], coffs);
1518 }
else if (vr_type == 2 && ch == 2 && (voffset & 1) == 0 && (
dim & 1) == 0) {
1519 voffs = voffset >> 1;
1522 for (k = 0; k < step; ++k) {
1527 vec[voffs + k ] +=
codebook.codevectors[coffs ];
1528 vec[voffs + k + vlen] +=
codebook.codevectors[coffs + 1];
1530 }
else if (
dim == 4) {
1531 for (k = 0; k < step; ++k, voffs += 2) {
1536 vec[voffs ] +=
codebook.codevectors[coffs ];
1537 vec[voffs + 1 ] +=
codebook.codevectors[coffs + 2];
1538 vec[voffs + vlen ] +=
codebook.codevectors[coffs + 1];
1539 vec[voffs + vlen + 1] +=
codebook.codevectors[coffs + 3];
1542 for (k = 0; k < step; ++k) {
1547 for (l = 0; l <
dim; l += 2, voffs++) {
1548 vec[voffs ] +=
codebook.codevectors[coffs + l ];
1549 vec[voffs + vlen] +=
codebook.codevectors[coffs + l + 1];
1551 ff_dlog(
NULL,
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n",
1552 pass, voffset / ch + (voffs % ch) * vlen,
1553 vec[voffset / ch + (voffs % ch) * vlen],
1554 codebook.codevectors[coffs + l], coffs, l);
1558 }
else if (vr_type == 2) {
1559 unsigned voffs_div = ch == 1 ? voffset :
FASTDIV(voffset, ch);
1560 unsigned voffs_mod = voffset - voffs_div * ch;
1562 for (k = 0; k < step; ++k) {
1567 for (l = 0; l <
dim; ++l) {
1568 vec[voffs_div + voffs_mod * vlen] +=
1571 ff_dlog(
NULL,
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n",
1572 pass, voffs_div + voffs_mod * vlen,
1573 vec[voffs_div + voffs_mod * vlen],
1574 codebook.codevectors[coffs + l], coffs, l);
1576 if (++voffs_mod == ch) {
1585 j_times_ptns_to_read += ptns_to_read;
1591 if (libvorbis_bug && !pass) {
1592 for (j = 0; j < ch_used; ++j) {
1593 if (!do_not_decode[j]) {
1605 uint8_t *do_not_decode,
1606 float *vec,
unsigned vlen,
1611 else if (vr->
type == 1)
1613 else if (vr->
type == 0)
1629 unsigned mode_number, blockflag, blocksize;
1631 uint8_t no_residue[255];
1632 uint8_t do_not_decode[255];
1635 uint8_t res_chan[255];
1636 unsigned res_num = 0;
1654 ff_dlog(
NULL,
" Mode number: %u , mapping: %d , blocktype %d\n", mode_number,
1659 vlen = blocksize / 2;
1662 if (previous_window < 0)
1663 previous_window =
code>>1;
1664 }
else if (previous_window < 0)
1665 previous_window = 0;
1667 memset(ch_res_ptr, 0,
sizeof(
float) * vc->
audio_channels * vlen);
1669 memset(floor_ptr[
i], 0, vlen *
sizeof(floor_ptr[0][0]));
1688 no_residue[
i] =
ret;
1694 if (!(no_residue[mapping->
magnitude[
i]] & no_residue[mapping->
angle[
i]])) {
1696 no_residue[mapping->
angle[
i]] = 0;
1708 if ((mapping->
submaps == 1) || (
i == mapping->
mux[j])) {
1709 res_chan[j] = res_num;
1710 if (no_residue[j]) {
1711 do_not_decode[ch] = 1;
1713 do_not_decode[ch] = 0;
1730 ch_res_ptr += ch * vlen;
1749 mdct = vc->
mdct[blockflag];
1750 mdct_fn = vc->
mdct_fn[blockflag];
1754 if (no_residue[j]) {
1755 memset(ch_res_ptr, 0, (blocksize / 2) *
sizeof(
float));
1758 vc->
fdsp->
vector_fmul(floor_ptr[j], floor_ptr[j], ch_res_ptr, blocksize / 2);
1759 mdct_fn(mdct, ch_res_ptr, floor_ptr[j],
sizeof(
float));
1764 retlen = (blocksize + vc->
blocksize[previous_window]) / 4;
1769 float *saved = vc->
saved + j * bs1 / 4;
1770 float *
ret = floor_ptr[j];
1771 float *buf = residue;
1772 const float *
win = vc->
win[blockflag & previous_window];
1774 if (blockflag == previous_window) {
1776 }
else if (blockflag > previous_window) {
1778 memcpy(
ret+bs0/2, buf+bs0/4, ((bs1-bs0)/4) *
sizeof(
float));
1780 memcpy(
ret, saved, ((bs1 - bs0) / 4) *
sizeof(
float));
1783 memcpy(saved, buf + blocksize / 4, blocksize / 4 *
sizeof(
float));
1793 int *got_frame_ptr,
AVPacket *avpkt)
1795 const uint8_t *buf = avpkt->
data;
1796 int buf_size = avpkt->
size;
1799 float *channel_ptrs[255];
1800 const uint8_t *new_headers;
1801 size_t new_headers_size;
1809 if (new_headers_size > INT_MAX)
1817 if (*buf == 1 && buf_size > 7) {
1840 if (*buf == 3 && buf_size > 7) {
1869 channel_ptrs[
i] = (
float *)
frame->extended_data[
i];
1873 channel_ptrs[ch] = (
float *)
frame->extended_data[
i];
1892 if (!
frame->metadata) {
1904 ff_dlog(
NULL,
"parsed %d bytes %d bits, returned %d samples (*ch*bits) \n",
1932 sizeof(*vc->
saved));
uint8_t ptrdiff_t const uint8_t ptrdiff_t int const int8_t const int8_t * vf
static double val(void *priv, double ch)
static float win(SuperEqualizerContext *s, float n, int N)
const FFCodec ff_vorbis_decoder
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
static const unsigned codebook[256][2]
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static __device__ float floor(float a)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
static const uint8_t bits[8]
bitstream reader API header.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
static int get_bits_left(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static uint64_t get_bits64(GetBitContext *s, int n)
Read 0-64 bits.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define AV_CODEC_FLAG2_SKIP_MANUAL
Do not skip samples and export skip information as frame side data.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_FLTP
float, planar
static av_always_inline void scale(vec_s32 res[4], vec_s16 res_packed[2], const int shift)
const VDPAUPixFmtMap * map
av_cold void CBS_FUNC close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
common internal api header.
unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n)
void ff_vorbis_floor1_render_list(vorbis_floor1_entry *list, int values, uint16_t *y_list, int *flag, int multiplier, float *out, int samples)
int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
int ff_vorbis_ready_floor1_list(void *logctx, vorbis_floor1_entry *list, int values)
av_cold void ff_vorbisdsp_init(VorbisDSPContext *dsp)
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
const uint32_t ff_inverse[257]
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
int flags2
AV_CODEC_FLAG2_*.
enum AVSampleFormat sample_fmt
audio sample format
int sample_rate
samples per second
int flags
AV_CODEC_FLAG_*.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
struct AVCodecInternal * internal
Private context used for internal data.
int skip_samples
Number of audio samples to skip at the start of the next decoded frame.
void(* vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len)
Overlap/add with window function.
void(* vector_fmul)(float *dst, const float *src0, const float *src1, int len)
Calculate the entry wise product of two vectors of floats and store the result in a vector of floats.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
void(* vorbis_inverse_coupling)(float *mag, float *ang, ptrdiff_t blocksize)
vorbis_mapping * mappings
vorbis_residue * residues
AVDictionary * pending_metadata
Tags of a dropped priming frame, added to the first frame with samples.
vorbis_codebook * codebooks
uint32_t audio_samplerate
uint8_t partition_class[32]
int16_t subclass_books[16][8]
vorbis_floor1_entry * list
uint8_t class_masterbook[16]
uint8_t class_dimensions[16]
uint8_t class_subclasses[16]
vorbis_floor_decode_func decode
union vorbis_floor::vorbis_floor_u data
uint8_t submap_residue[16]
#define av_malloc_array(a, b)
static void error(const char *err)
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
@ AV_TX_FLOAT_MDCT
Standard MDCT with a sample data type of float, double or int32_t, respectively.
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
struct vorbis_floor::vorbis_floor_u::vorbis_floor1_s t1
struct vorbis_floor::vorbis_floor_u::vorbis_floor0_s t0
static double cb(void *priv, double x, double y)
void ff_vlc_free(VLC *vlc)
#define vlc_init(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
const AVChannelLayout ff_vorbis_ch_layouts[9]
const uint8_t ff_vorbis_channel_layout_offsets[8][8]
const float *const ff_vorbis_vwin[8]
int(* vorbis_floor_decode_func)(struct vorbis_context_s *, vorbis_floor_data *, float *)
#define GET_VALIDATED_INDEX(idx, bits, limit)
static av_cold int vorbis_decode_init(AVCodecContext *avctx)
static float vorbisfloat2float(unsigned val)
struct vorbis_floor0_s vorbis_floor0
static av_cold void vorbis_decode_flush(AVCodecContext *avctx)
static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)
union vorbis_floor_u vorbis_floor_data
static int vorbis_parse_headers(AVCodecContext *avctx, const uint8_t *headers, int headers_len)
static int vorbis_parse_id_hdr(vorbis_context *vc)
static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, vorbis_residue *vr, unsigned ch, uint8_t *do_not_decode, float *vec, unsigned vlen, unsigned ch_left, int vr_type)
static int vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *vfu, float *vec)
struct vorbis_floor1_s vorbis_floor1
#define VALIDATE_INDEX(idx, limit)
static int vorbis_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static int vorbis_parse_setup_hdr_tdtransforms(vorbis_context *vc)
static int vorbis_floor0_decode(vorbis_context *vc, vorbis_floor_data *vfu, float *vec)
static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, unsigned ch, uint8_t *do_not_decode, float *vec, unsigned vlen, unsigned ch_left)
static void vorbis_free(vorbis_context *vc)
static const char idx_err_str[]
static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
static av_cold int vorbis_decode_close(AVCodecContext *avctx)
static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
static av_always_inline int setup_classifs(vorbis_context *vc, vorbis_residue *vr, uint8_t *do_not_decode, unsigned ch_used, int partition_count, int ptns_to_read)
static int vorbis_parse_setup_hdr(vorbis_context *vc)
static int create_map(vorbis_context *vc, unsigned floor_number)
int avpriv_split_xiph_headers(const uint8_t *extradata, int extradata_size, int first_header_size, const uint8_t *header_start[3], int header_len[3])
Split a single extradata buffer into the three headers that most Xiph codecs use.