Go to the documentation of this file.
63 #define MONO 0x1000001
64 #define STEREO 0x1000002
65 #define JOINT_STEREO 0x1000003
66 #define MC_COOK 0x2000000
68 #define SUBBAND_SIZE 20
69 #define MAX_SUBPACKETS 5
71 #define QUANT_VLC_BITS 9
72 #define COUPLING_VLC_BITS 6
114 int *subband_coef_index,
int *subband_coef_sign,
121 float *decode_buffer,
122 float *mlt_buffer1,
float *mlt_buffer2);
125 cook_gains *gains_ptr,
float *previous_buffer);
128 int gain_index,
int gain_index_next);
178 static const float exp2_tab[2] = {1,
M_SQRT2};
179 float exp2_val =
powf(2, -63);
180 float root_val =
powf(2, -32);
181 for (
i = -63;
i < 64;
i++) {
194 q->gain_size_factor = q->samples_per_channel / 8;
195 for (
i = 0;
i < 31;
i++)
197 (1.0 / (
double) q->gain_size_factor));
201 const void *syms,
int symbol_size,
int offset,
207 for (
int i = 0;
i < 16;
i++)
208 for (
unsigned count = num + counts[
i]; num < count; num++)
212 syms, symbol_size, symbol_size,
221 for (
i = 0;
i < 13;
i++) {
227 for (
i = 0;
i < 7;
i++) {
228 int sym_size = 1 + (
i == 3);
234 for (
i = 0;
i < q->num_subpackets;
i++) {
235 if (q->subpacket[
i].joint_stereo == 1) {
251 int mlt_size = q->samples_per_channel;
252 const float scale = 1.0 / 32768.0;
254 if (!(q->mlt_window =
av_malloc_array(mlt_size,
sizeof(*q->mlt_window))))
259 for (j = 0; j < mlt_size; j++)
260 q->mlt_window[j] *= sqrt(2.0 / q->samples_per_channel);
274 for (
i = 0;
i < 5;
i++)
280 #define DECODE_BYTES_PAD1(bytes) (3 - ((bytes) + 3) % 4)
281 #define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes)))
305 static const uint32_t
tab[4] = {
312 uint32_t *obuf = (uint32_t *)
out;
319 off = (intptr_t) inbuffer & 3;
320 buf = (
const uint32_t *) (inbuffer - off);
323 for (
i = 0;
i < bytes / 4;
i++)
324 obuf[
i] =
c ^ buf[
i];
343 for (
i = 0;
i < 13;
i++)
345 for (
i = 0;
i < 7;
i++)
347 for (
i = 0;
i < q->num_subpackets;
i++)
373 gaininfo[
i++] = gain;
386 int *quant_index_table)
390 quant_index_table[0] =
get_bits(&q->gb, 6) - 6;
404 j =
get_vlc2(&q->gb, q->envelope_quant_index[vlc_index - 1].table,
406 quant_index_table[
i] = quant_index_table[
i - 1] + j;
407 if (quant_index_table[
i] > 63 || quant_index_table[
i] < -63) {
409 "Invalid quantizer %d at position %d, outside [-63, 63] range\n",
410 quant_index_table[
i],
i);
430 int exp_index2[102] = { 0 };
431 int exp_index1[102] = { 0 };
433 int tmp_categorize_array[128 * 2] = { 0 };
441 ((
bits_left - q->samples_per_channel) * 5) / 8;
446 for (
i = 32;
i > 0;
i =
i / 2) {
463 exp_index1[
i] = exp_idx;
464 exp_index2[
i] = exp_idx;
466 tmpbias1 = tmpbias2 = num_bits;
469 if (tmpbias1 + tmpbias2 > 2 *
bits_left) {
473 if (exp_index1[
i] < 7) {
474 v = (-2 * exp_index1[
i]) - quant_index_table[
i] +
bias;
483 tmp_categorize_array[tmp_categorize_array1_idx++] =
index;
491 if (exp_index2[
i] > 0) {
492 v = (-2 * exp_index2[
i]) - quant_index_table[
i] +
bias;
501 tmp_categorize_array[--tmp_categorize_array2_idx] =
index;
512 category_index[
i] = tmp_categorize_array[tmp_categorize_array2_idx++];
527 for (
i = 0;
i < q->num_vectors;
i++)
529 int idx = category_index[
i];
546 int *subband_coef_index,
int *subband_coef_sign,
553 if (subband_coef_index[
i]) {
555 if (subband_coef_sign[
i])
560 if (
av_lfg_get(&q->random_state) < 0x80000000)
575 int *subband_coef_index,
int *subband_coef_sign)
588 for (j = vd - 1; j >= 0; j--) {
593 for (j = 0; j < vd; j++) {
594 if (subband_coef_index[
i * vd + j]) {
596 subband_coef_sign[
i * vd + j] =
get_bits1(&q->gb);
599 subband_coef_sign[
i * vd + j] = 0;
602 subband_coef_sign[
i * vd + j] = 0;
619 int *quant_index_table,
float *mlt_buffer)
640 memset(subband_coef_index, 0,
sizeof(subband_coef_index));
641 memset(subband_coef_sign, 0,
sizeof(subband_coef_sign));
643 q->scalar_dequant(q,
index, quant_index_table[band],
644 subband_coef_index, subband_coef_sign,
656 int category_index[128] = { 0 };
658 int quant_index_table[102];
685 int gain_index,
int gain_index_next)
689 fc1 =
pow2tab[gain_index + 63];
691 if (gain_index == gain_index_next) {
692 for (
i = 0;
i < q->gain_size_factor;
i++)
695 fc2 = q->gain_table[15 + (gain_index_next - gain_index)];
696 for (
i = 0;
i < q->gain_size_factor;
i++) {
712 cook_gains *gains_ptr,
float *previous_buffer)
723 for (
i = 0;
i < q->samples_per_channel;
i++)
724 inbuffer[
i] = inbuffer[
i] *
fc * q->mlt_window[
i] -
725 previous_buffer[
i] * q->mlt_window[q->samples_per_channel - 1 -
i];
740 cook_gains *gains_ptr,
float *previous_buffer)
742 float *buffer0 = q->mono_mdct_output;
743 float *buffer1 = q->mono_mdct_output + q->samples_per_channel;
747 q->mdct_fn(q->mdct_ctx, q->mono_mdct_output, inbuffer,
sizeof(
float));
749 q->imlt_window(q, buffer1, gains_ptr, previous_buffer);
752 for (
i = 0;
i < 8;
i++)
753 if (gains_ptr->
now[
i] || gains_ptr->
now[
i + 1])
754 q->interpolate(q, &buffer1[q->gain_size_factor *
i],
755 gains_ptr->
now[
i], gains_ptr->
now[
i + 1]);
758 memcpy(previous_buffer, buffer0,
759 q->samples_per_channel *
sizeof(*previous_buffer));
775 int length = end - start + 1;
781 for (
i = 0;
i < length;
i++)
782 decouple_tab[start +
i] =
get_vlc2(&q->gb,
786 for (
i = 0;
i < length;
i++) {
792 decouple_tab[start +
i] = v;
812 float *decode_buffer,
813 float *mlt_buffer1,
float *mlt_buffer2)
818 mlt_buffer1[
SUBBAND_SIZE * subband + j] = f1 * decode_buffer[tmp_idx];
819 mlt_buffer2[
SUBBAND_SIZE * subband + j] = f2 * decode_buffer[tmp_idx];
831 float *mlt_buffer_left,
float *mlt_buffer_right)
835 float *decode_buffer = q->decode_buffer_0;
838 const float *cplscale;
840 memset(decode_buffer, 0,
sizeof(q->decode_buffer_0));
843 memset(mlt_buffer_left, 0, 1024 *
sizeof(*mlt_buffer_left));
844 memset(mlt_buffer_right, 0, 1024 *
sizeof(*mlt_buffer_right));
852 mlt_buffer_left[
i * 20 + j] = decode_buffer[
i * 40 + j];
853 mlt_buffer_right[
i * 20 + j] = decode_buffer[
i * 40 + 20 + j];
862 idx -= decouple_tab[cpl_tmp];
864 f1 = cplscale[decouple_tab[cpl_tmp] + 1];
866 q->decouple(q, p,
i, f1, f2, decode_buffer,
867 mlt_buffer_left, mlt_buffer_right);
883 const uint8_t *inbuffer,
906 q->adsp.vector_clipf(
out, q->mono_mdct_output + q->samples_per_channel,
907 FFALIGN(q->samples_per_channel, 8), -1.0f, 1.0f);
923 cook_gains *gains_ptr,
float *previous_buffer,
926 imlt_gain(q, decode_buffer, gains_ptr, previous_buffer);
928 q->saturate_output(q,
out);
941 const uint8_t *inbuffer,
float **outbuffer)
943 int sub_packet_size = p->
size;
946 memset(q->decode_buffer_1, 0,
sizeof(q->decode_buffer_1));
950 if ((res =
joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2)) < 0)
953 if ((res =
mono_decode(q, p, q->decode_buffer_1)) < 0)
958 if ((res =
mono_decode(q, p, q->decode_buffer_2)) < 0)
983 int *got_frame_ptr,
AVPacket *avpkt)
985 const uint8_t *buf = avpkt->
data;
986 int buf_size = avpkt->
size;
993 if (buf_size < avctx->block_align)
997 if (q->discarded_packets >= 2) {
1007 for (
i = 1;
i < q->num_subpackets;
i++) {
1009 q->subpacket[0].size -= q->subpacket[
i].size + 1;
1010 if (q->subpacket[0].size < 0) {
1012 "frame subpacket size total > avctx->block_align!\n");
1018 for (
i = 0;
i < q->num_subpackets;
i++) {
1019 q->subpacket[
i].bits_per_subpacket = (q->subpacket[
i].size * 8) >>
1020 q->subpacket[
i].bits_per_subpdiv;
1021 q->subpacket[
i].ch_idx = chidx;
1023 "subpacket[%i] size %i js %i %i block_align %i\n",
1024 i, q->subpacket[
i].size, q->subpacket[
i].joint_stereo,
offset,
1029 offset += q->subpacket[
i].size;
1030 chidx += q->subpacket[
i].num_channels;
1036 if (q->discarded_packets < 2) {
1037 q->discarded_packets++;
1050 #define PRINT(a, b) ff_dlog(q->avctx, " %s = %d\n", a, b);
1051 ff_dlog(q->avctx,
"COOKextradata\n");
1052 ff_dlog(q->avctx,
"cookversion=%x\n", q->subpacket[0].cookversion);
1053 if (q->subpacket[0].cookversion >
STEREO) {
1054 PRINT(
"js_subband_start", q->subpacket[0].js_subband_start);
1055 PRINT(
"js_vlc_bits", q->subpacket[0].js_vlc_bits);
1057 ff_dlog(q->avctx,
"COOKContext\n");
1058 PRINT(
"nb_channels", q->avctx->ch_layout.nb_channels);
1059 PRINT(
"bit_rate", (
int)q->avctx->bit_rate);
1060 PRINT(
"sample_rate", q->avctx->sample_rate);
1061 PRINT(
"samples_per_channel", q->subpacket[0].samples_per_channel);
1062 PRINT(
"subbands", q->subpacket[0].subbands);
1063 PRINT(
"js_subband_start", q->subpacket[0].js_subband_start);
1064 PRINT(
"log2_numvector_size", q->subpacket[0].log2_numvector_size);
1065 PRINT(
"numvector_size", q->subpacket[0].numvector_size);
1066 PRINT(
"total_subbands", q->subpacket[0].total_subbands);
1080 unsigned int channel_mask = 0;
1081 int samples_per_frame = 0;
1117 q->subpacket[
s].cookversion = bytestream2_get_be32(&
gb);
1118 samples_per_frame = bytestream2_get_be16(&
gb);
1119 q->subpacket[
s].subbands = bytestream2_get_be16(&
gb);
1120 bytestream2_get_be32(&
gb);
1121 q->subpacket[
s].js_subband_start = bytestream2_get_be16(&
gb);
1122 if (q->subpacket[
s].js_subband_start >= 51) {
1126 q->subpacket[
s].js_vlc_bits = bytestream2_get_be16(&
gb);
1129 q->subpacket[
s].samples_per_channel = samples_per_frame /
channels;
1133 q->subpacket[
s].log2_numvector_size = 5;
1134 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands;
1135 q->subpacket[
s].num_channels = 1;
1140 q->subpacket[
s].cookversion);
1141 q->subpacket[
s].joint_stereo = 0;
1142 switch (q->subpacket[
s].cookversion) {
1152 q->subpacket[
s].bits_per_subpdiv = 1;
1153 q->subpacket[
s].num_channels = 2;
1164 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands +
1165 q->subpacket[
s].js_subband_start;
1166 q->subpacket[
s].joint_stereo = 1;
1167 q->subpacket[
s].num_channels = 2;
1169 if (q->subpacket[
s].samples_per_channel > 256) {
1170 q->subpacket[
s].log2_numvector_size = 6;
1172 if (q->subpacket[
s].samples_per_channel > 512) {
1173 q->subpacket[
s].log2_numvector_size = 7;
1178 channel_mask |= q->subpacket[
s].channel_mask = bytestream2_get_be32(&
gb);
1181 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands +
1182 q->subpacket[
s].js_subband_start;
1183 q->subpacket[
s].joint_stereo = 1;
1184 q->subpacket[
s].num_channels = 2;
1185 q->subpacket[
s].samples_per_channel = samples_per_frame >> 1;
1187 if (q->subpacket[
s].samples_per_channel > 256) {
1188 q->subpacket[
s].log2_numvector_size = 6;
1190 if (q->subpacket[
s].samples_per_channel > 512) {
1191 q->subpacket[
s].log2_numvector_size = 7;
1194 q->subpacket[
s].samples_per_channel = samples_per_frame;
1199 q->subpacket[
s].cookversion);
1203 if (
s > 1 && q->subpacket[
s].samples_per_channel != q->samples_per_channel) {
1207 q->samples_per_channel = q->subpacket[0].samples_per_channel;
1211 q->subpacket[
s].numvector_size = (1 << q->subpacket[
s].log2_numvector_size);
1214 if (q->subpacket[
s].total_subbands > 53) {
1219 if ((q->subpacket[
s].js_vlc_bits > 6) ||
1220 (q->subpacket[
s].js_vlc_bits < 2 * q->subpacket[
s].joint_stereo)) {
1222 q->subpacket[
s].js_vlc_bits, 2 * q->subpacket[
s].joint_stereo);
1226 if (q->subpacket[
s].subbands > 50) {
1230 if (q->subpacket[
s].subbands == 0) {
1234 q->subpacket[
s].gains1.now = q->subpacket[
s].gain_1;
1235 q->subpacket[
s].gains1.previous = q->subpacket[
s].gain_2;
1236 q->subpacket[
s].gains2.now = q->subpacket[
s].gain_3;
1237 q->subpacket[
s].gains2.previous = q->subpacket[
s].gain_4;
1239 if (q->num_subpackets + q->subpacket[
s].num_channels >
channels) {
1244 q->num_subpackets++;
1249 if (q->samples_per_channel != 256 && q->samples_per_channel != 512 &&
1250 q->samples_per_channel != 1024) {
1252 q->samples_per_channel);
1267 q->decoded_bytes_buffer =
1271 if (!q->decoded_bytes_buffer)
1305 .priv_data_size =
sizeof(COOKContext),
static void decode_vectors(COOKContext *q, COOKSubpacket *p, int *category, int *quant_index_table, float *mlt_buffer)
Fill the mlt_buffer with mlt coefficients.
static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer)
@ AV_SAMPLE_FMT_FLTP
float, planar
int ff_vlc_init_from_lengths(VLC *vlc, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
Build VLC decoding tables suitable for use with get_vlc2()
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static av_cold int cook_decode_init(AVCodecContext *avctx)
Cook initialization.
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static av_cold void init_pow2table(void)
static void decode_gain_info(GetBitContext *gb, int *gaininfo)
Fill the gain array for the timedomain quantization.
void(* interpolate)(struct cook *q, float *buffer, int gain_index, int gain_index_next)
static int get_bits_count(const GetBitContext *s)
static int unpack_SQVH(COOKContext *q, COOKSubpacket *p, int category, int *subband_coef_index, int *subband_coef_sign)
Unpack the subband_coef_index and subband_coef_sign vectors.
This structure describes decoded (raw) audio or video data.
static void scalar_dequant_float(COOKContext *q, int index, int quant_index, int *subband_coef_index, int *subband_coef_sign, float *mlt_p)
The real requantization of the mltcoefs.
av_cold void ff_audiodsp_init(AudioDSPContext *c)
#define fc(width, name, range_min, range_max)
void(* scalar_dequant)(struct cook *q, int index, int quant_index, int *subband_coef_index, int *subband_coef_sign, float *mlt_p)
#define COUPLING_VLC_BITS
int nb_channels
Number of channels in this layout.
static av_cold int cook_decode_close(AVCodecContext *avctx)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define DECODE_BYTES_PAD1(bytes)
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...
static av_cold int init_cook_mlt(COOKContext *q)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const int expbits_tab[8]
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
static const struct twinvq_data tab
static int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes)
Cook indata decoding, every 32 bits are XORed with 0x37c511f2.
static int decode_subpacket(COOKContext *q, COOKSubpacket *p, const uint8_t *inbuffer, float **outbuffer)
Cook subpacket decoding.
static const float dither_tab[9]
static av_cold void init_cplscales_table(COOKContext *q)
static void saturate_output_float(COOKContext *q, float *out)
Saturate the output signal and interleave.
static int ff_thread_once(char *control, void(*routine)(void))
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
static const float quant_centroid_tab[7][14]
@ AV_TX_FLOAT_MDCT
Standard MDCT with a sample data type of float, double or int32_t, respecively.
#define FF_CODEC_DECODE_CB(func)
const float * cplscales[5]
static av_cold int init_cook_vlc_tables(COOKContext *q)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
static const int vhvlcsize_tab[7]
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void(* decouple)(struct cook *q, COOKSubpacket *p, int subband, float f1, float f2, float *decode_buffer, float *mlt_buffer1, float *mlt_buffer2)
float decode_buffer_1[1024]
#define CODEC_LONG_NAME(str)
const FFCodec ff_cook_decoder
@ AV_TX_FULL_IMDCT
Performs a full inverse MDCT rather than leaving out samples that can be derived through symmetry.
static const int vd_tab[7]
and forward the result(frame or status change) to the corresponding input. If nothing is possible
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int bias(int x, int c)
static void imlt_window_float(COOKContext *q, float *inbuffer, cook_gains *gains_ptr, float *previous_buffer)
Apply transform window, overlap buffers.
static void decouple_float(COOKContext *q, COOKSubpacket *p, int subband, float f1, float f2, float *decode_buffer, float *mlt_buffer1, float *mlt_buffer2)
function decouples a pair of signals from a single signal via multiplication.
static unsigned int get_bits1(GetBitContext *s)
static void dump_cook_context(COOKContext *q)
static void mlt_compensate_output(COOKContext *q, float *decode_buffer, cook_gains *gains_ptr, float *previous_buffer, float *out)
Final part of subpacket decoding: Apply modulated lapped transform, gain compensation,...
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static const int vpr_tab[7]
static av_cold int build_vlc(VLC *vlc, int nb_bits, const uint8_t counts[16], const void *syms, int symbol_size, int offset, void *logctx)
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
COOKSubpacket subpacket[MAX_SUBPACKETS]
static const float *const cplscales[5]
static const uint8_t cvh_huffcounts[7][16]
Context structure for the Lagged Fibonacci PRNG.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static void scale(int *out, const int *in, const int w, const int h, const int shift)
#define DECLARE_ALIGNED(n, t, v)
enum AVSampleFormat sample_fmt
audio sample format
static void imlt_gain(COOKContext *q, float *inbuffer, cook_gains *gains_ptr, float *previous_buffer)
The modulated lapped transform, this takes transform coefficients and transforms them into timedomain...
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
unsigned int channel_mask
void ff_sine_window_init(float *window, int n)
Generate a sine window.
#define MAX_COOK_VLC_ENTRIES
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
static const int kmax_tab[7]
int nb_samples
number of audio samples (per channel) described by this frame
#define i(width, name, range_min, range_max)
float mono_previous_buffer1[1024]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
uint8_t ** extended_data
pointers to the data planes/channels.
#define av_malloc_array(a, b)
AVSampleFormat
Audio sample formats.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
static int decode_envelope(COOKContext *q, COOKSubpacket *p, int *quant_index_table)
Create the quant index table needed for the envelope.
void ff_vlc_free(VLC *vlc)
static int decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab)
function for getting the jointstereo coupling information
static float pow2tab[127]
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
#define FFSWAP(type, a, b)
static void interpolate_float(COOKContext *q, float *buffer, int gain_index, int gain_index_next)
the actual requantization of the timedomain samples
#define AV_INPUT_BUFFER_PADDING_SIZE
main external API structure.
static float rootpow2tab[127]
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
static const uint8_t *const ccpl_huffsyms[5]
float mono_previous_buffer2[1024]
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
uint8_t * decoded_bytes_buffer
static int cook_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static av_cold void init_gain_table(COOKContext *q)
Filter the word “frame” indicates either a video frame or a group of audio samples
static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer_left, float *mlt_buffer_right)
function for decoding joint stereo data
static const uint8_t envelope_quant_index_huffcounts[13][16]
VLC envelope_quant_index[13]
void(* imlt_window)(struct cook *q, float *buffer1, cook_gains *gains_ptr, float *previous_buffer)
#define avpriv_request_sample(...)
This structure stores compressed data.
static const uint8_t ccpl_huffcounts[5][16]
void(* saturate_output)(struct cook *q, float *out)
static const void *const cvh_huffsyms[7]
float decode_buffer_0[1060]
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_table, int *category, int *category_index)
Calculate the category and category_index vector.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static const int cplband[51]
float mono_mdct_output[2048]
static const uint8_t envelope_quant_index_huffsyms[13][24]
float decode_buffer_2[1024]
static void expand_category(COOKContext *q, int *category, int *category_index)
Expand the category vector.
static const int invradix_tab[7]
static void decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p, const uint8_t *inbuffer, cook_gains *gains_ptr)
First part of subpacket decoding: decode raw stream bytes and read gain info.