Go to the documentation of this file.
64 #define MONO 0x1000001
65 #define STEREO 0x1000002
66 #define JOINT_STEREO 0x1000003
67 #define MC_COOK 0x2000000
69 #define SUBBAND_SIZE 20
70 #define MAX_SUBPACKETS 5
72 #define QUANT_VLC_BITS 9
73 #define COUPLING_VLC_BITS 6
115 int *subband_coef_index,
int *subband_coef_sign,
122 float *decode_buffer,
123 float *mlt_buffer1,
float *mlt_buffer2);
126 cook_gains *gains_ptr,
float *previous_buffer);
129 int gain_index,
int gain_index_next);
179 static const float exp2_tab[2] = {1,
M_SQRT2};
180 float exp2_val =
powf(2, -63);
181 float root_val =
powf(2, -32);
182 for (
i = -63;
i < 64;
i++) {
195 q->gain_size_factor = q->samples_per_channel / 8;
196 for (
i = 0;
i < 31;
i++)
198 (1.0 / (
double) q->gain_size_factor));
202 const void *syms,
int symbol_size,
int offset,
208 for (
int i = 0;
i < 16;
i++)
209 for (
unsigned count = num + counts[
i]; num < count; num++)
213 syms, symbol_size, symbol_size,
222 for (
i = 0;
i < 13;
i++) {
228 for (
i = 0;
i < 7;
i++) {
229 int sym_size = 1 + (
i == 3);
235 for (
i = 0;
i < q->num_subpackets;
i++) {
236 if (q->subpacket[
i].joint_stereo == 1) {
252 int mlt_size = q->samples_per_channel;
253 const float scale = 1.0 / 32768.0;
255 if (!(q->mlt_window =
av_malloc_array(mlt_size,
sizeof(*q->mlt_window))))
260 for (j = 0; j < mlt_size; j++)
261 q->mlt_window[j] *= sqrt(2.0 / q->samples_per_channel);
275 for (
i = 0;
i < 5;
i++)
281 #define DECODE_BYTES_PAD1(bytes) (3 - ((bytes) + 3) % 4)
282 #define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes)))
306 static const uint32_t
tab[4] = {
313 uint32_t *obuf = (uint32_t *)
out;
320 off = (intptr_t) inbuffer & 3;
321 buf = (
const uint32_t *) (inbuffer - off);
324 for (
i = 0;
i < bytes / 4;
i++)
325 obuf[
i] =
c ^ buf[
i];
344 for (
i = 0;
i < 13;
i++)
346 for (
i = 0;
i < 7;
i++)
348 for (
i = 0;
i < q->num_subpackets;
i++)
374 gaininfo[
i++] = gain;
387 int *quant_index_table)
391 quant_index_table[0] =
get_bits(&q->gb, 6) - 6;
405 j =
get_vlc2(&q->gb, q->envelope_quant_index[vlc_index - 1].table,
407 quant_index_table[
i] = quant_index_table[
i - 1] + j;
408 if (quant_index_table[
i] > 63 || quant_index_table[
i] < -63) {
410 "Invalid quantizer %d at position %d, outside [-63, 63] range\n",
411 quant_index_table[
i],
i);
431 int exp_index2[102] = { 0 };
432 int exp_index1[102] = { 0 };
434 int tmp_categorize_array[128 * 2] = { 0 };
442 ((
bits_left - q->samples_per_channel) * 5) / 8;
447 for (
i = 32;
i > 0;
i =
i / 2) {
464 exp_index1[
i] = exp_idx;
465 exp_index2[
i] = exp_idx;
467 tmpbias1 = tmpbias2 = num_bits;
470 if (tmpbias1 + tmpbias2 > 2 *
bits_left) {
474 if (exp_index1[
i] < 7) {
475 v = (-2 * exp_index1[
i]) - quant_index_table[
i] +
bias;
484 tmp_categorize_array[tmp_categorize_array1_idx++] =
index;
492 if (exp_index2[
i] > 0) {
493 v = (-2 * exp_index2[
i]) - quant_index_table[
i] +
bias;
502 tmp_categorize_array[--tmp_categorize_array2_idx] =
index;
513 category_index[
i] = tmp_categorize_array[tmp_categorize_array2_idx++];
528 for (
i = 0;
i < q->num_vectors;
i++)
530 int idx = category_index[
i];
547 int *subband_coef_index,
int *subband_coef_sign,
554 if (subband_coef_index[
i]) {
556 if (subband_coef_sign[
i])
561 if (
av_lfg_get(&q->random_state) < 0x80000000)
576 int *subband_coef_index,
int *subband_coef_sign)
589 for (j = vd - 1; j >= 0; j--) {
594 for (j = 0; j < vd; j++) {
595 if (subband_coef_index[
i * vd + j]) {
597 subband_coef_sign[
i * vd + j] =
get_bits1(&q->gb);
600 subband_coef_sign[
i * vd + j] = 0;
603 subband_coef_sign[
i * vd + j] = 0;
620 int *quant_index_table,
float *mlt_buffer)
641 memset(subband_coef_index, 0,
sizeof(subband_coef_index));
642 memset(subband_coef_sign, 0,
sizeof(subband_coef_sign));
644 q->scalar_dequant(q,
index, quant_index_table[band],
645 subband_coef_index, subband_coef_sign,
657 int category_index[128] = { 0 };
659 int quant_index_table[102];
686 int gain_index,
int gain_index_next)
690 fc1 =
pow2tab[gain_index + 63];
692 if (gain_index == gain_index_next) {
693 for (
i = 0;
i < q->gain_size_factor;
i++)
696 fc2 = q->gain_table[15 + (gain_index_next - gain_index)];
697 for (
i = 0;
i < q->gain_size_factor;
i++) {
713 cook_gains *gains_ptr,
float *previous_buffer)
724 for (
i = 0;
i < q->samples_per_channel;
i++)
725 inbuffer[
i] = inbuffer[
i] *
fc * q->mlt_window[
i] -
726 previous_buffer[
i] * q->mlt_window[q->samples_per_channel - 1 -
i];
741 cook_gains *gains_ptr,
float *previous_buffer)
743 float *buffer0 = q->mono_mdct_output;
744 float *buffer1 = q->mono_mdct_output + q->samples_per_channel;
748 q->mdct_fn(q->mdct_ctx, q->mono_mdct_output, inbuffer,
sizeof(
float));
750 q->imlt_window(q, buffer1, gains_ptr, previous_buffer);
753 for (
i = 0;
i < 8;
i++)
754 if (gains_ptr->
now[
i] || gains_ptr->
now[
i + 1])
755 q->interpolate(q, &buffer1[q->gain_size_factor *
i],
756 gains_ptr->
now[
i], gains_ptr->
now[
i + 1]);
759 memcpy(previous_buffer, buffer0,
760 q->samples_per_channel *
sizeof(*previous_buffer));
776 int length = end - start + 1;
782 for (
i = 0;
i < length;
i++)
783 decouple_tab[start +
i] =
get_vlc2(&q->gb,
787 for (
i = 0;
i < length;
i++) {
793 decouple_tab[start +
i] = v;
813 float *decode_buffer,
814 float *mlt_buffer1,
float *mlt_buffer2)
819 mlt_buffer1[
SUBBAND_SIZE * subband + j] = f1 * decode_buffer[tmp_idx];
820 mlt_buffer2[
SUBBAND_SIZE * subband + j] = f2 * decode_buffer[tmp_idx];
832 float *mlt_buffer_left,
float *mlt_buffer_right)
836 float *decode_buffer = q->decode_buffer_0;
839 const float *cplscale;
841 memset(decode_buffer, 0,
sizeof(q->decode_buffer_0));
844 memset(mlt_buffer_left, 0, 1024 *
sizeof(*mlt_buffer_left));
845 memset(mlt_buffer_right, 0, 1024 *
sizeof(*mlt_buffer_right));
853 mlt_buffer_left[
i * 20 + j] = decode_buffer[
i * 40 + j];
854 mlt_buffer_right[
i * 20 + j] = decode_buffer[
i * 40 + 20 + j];
863 idx -= decouple_tab[cpl_tmp];
865 f1 = cplscale[decouple_tab[cpl_tmp] + 1];
867 q->decouple(q, p,
i, f1, f2, decode_buffer,
868 mlt_buffer_left, mlt_buffer_right);
884 const uint8_t *inbuffer,
907 q->adsp.vector_clipf(
out, q->mono_mdct_output + q->samples_per_channel,
908 FFALIGN(q->samples_per_channel, 8), -1.0f, 1.0f);
924 cook_gains *gains_ptr,
float *previous_buffer,
927 imlt_gain(q, decode_buffer, gains_ptr, previous_buffer);
929 q->saturate_output(q,
out);
942 const uint8_t *inbuffer,
float **outbuffer)
944 int sub_packet_size = p->
size;
947 memset(q->decode_buffer_1, 0,
sizeof(q->decode_buffer_1));
951 if ((res =
joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2)) < 0)
954 if ((res =
mono_decode(q, p, q->decode_buffer_1)) < 0)
959 if ((res =
mono_decode(q, p, q->decode_buffer_2)) < 0)
984 int *got_frame_ptr,
AVPacket *avpkt)
986 const uint8_t *buf = avpkt->
data;
987 int buf_size = avpkt->
size;
994 if (buf_size < avctx->block_align)
998 if (q->discarded_packets >= 2) {
999 frame->nb_samples = q->samples_per_channel;
1008 for (
i = 1;
i < q->num_subpackets;
i++) {
1010 q->subpacket[0].size -= q->subpacket[
i].size + 1;
1011 if (q->subpacket[0].size < 0) {
1013 "frame subpacket size total > avctx->block_align!\n");
1019 for (
i = 0;
i < q->num_subpackets;
i++) {
1020 q->subpacket[
i].bits_per_subpacket = (q->subpacket[
i].size * 8) >>
1021 q->subpacket[
i].bits_per_subpdiv;
1022 q->subpacket[
i].ch_idx = chidx;
1024 "subpacket[%i] size %i js %i %i block_align %i\n",
1025 i, q->subpacket[
i].size, q->subpacket[
i].joint_stereo,
offset,
1030 offset += q->subpacket[
i].size;
1031 chidx += q->subpacket[
i].num_channels;
1037 if (q->discarded_packets < 2) {
1038 q->discarded_packets++;
1051 #define PRINT(a, b) ff_dlog(q->avctx, " %s = %d\n", a, b);
1052 ff_dlog(q->avctx,
"COOKextradata\n");
1053 ff_dlog(q->avctx,
"cookversion=%x\n", q->subpacket[0].cookversion);
1054 if (q->subpacket[0].cookversion >
STEREO) {
1055 PRINT(
"js_subband_start", q->subpacket[0].js_subband_start);
1056 PRINT(
"js_vlc_bits", q->subpacket[0].js_vlc_bits);
1058 ff_dlog(q->avctx,
"COOKContext\n");
1059 PRINT(
"nb_channels", q->avctx->ch_layout.nb_channels);
1060 PRINT(
"bit_rate", (
int)q->avctx->bit_rate);
1061 PRINT(
"sample_rate", q->avctx->sample_rate);
1062 PRINT(
"samples_per_channel", q->subpacket[0].samples_per_channel);
1063 PRINT(
"subbands", q->subpacket[0].subbands);
1064 PRINT(
"js_subband_start", q->subpacket[0].js_subband_start);
1065 PRINT(
"log2_numvector_size", q->subpacket[0].log2_numvector_size);
1066 PRINT(
"numvector_size", q->subpacket[0].numvector_size);
1067 PRINT(
"total_subbands", q->subpacket[0].total_subbands);
1081 unsigned int channel_mask = 0;
1082 int samples_per_frame = 0;
1118 q->subpacket[
s].cookversion = bytestream2_get_be32(&
gb);
1119 samples_per_frame = bytestream2_get_be16(&
gb);
1120 q->subpacket[
s].subbands = bytestream2_get_be16(&
gb);
1121 bytestream2_get_be32(&
gb);
1122 q->subpacket[
s].js_subband_start = bytestream2_get_be16(&
gb);
1123 if (q->subpacket[
s].js_subband_start >= 51) {
1127 q->subpacket[
s].js_vlc_bits = bytestream2_get_be16(&
gb);
1130 q->subpacket[
s].samples_per_channel = samples_per_frame /
channels;
1134 q->subpacket[
s].log2_numvector_size = 5;
1135 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands;
1136 q->subpacket[
s].num_channels = 1;
1141 q->subpacket[
s].cookversion);
1142 q->subpacket[
s].joint_stereo = 0;
1143 switch (q->subpacket[
s].cookversion) {
1153 q->subpacket[
s].bits_per_subpdiv = 1;
1154 q->subpacket[
s].num_channels = 2;
1165 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands +
1166 q->subpacket[
s].js_subband_start;
1167 q->subpacket[
s].joint_stereo = 1;
1168 q->subpacket[
s].num_channels = 2;
1170 if (q->subpacket[
s].samples_per_channel > 256) {
1171 q->subpacket[
s].log2_numvector_size = 6;
1173 if (q->subpacket[
s].samples_per_channel > 512) {
1174 q->subpacket[
s].log2_numvector_size = 7;
1179 channel_mask |= q->subpacket[
s].channel_mask = bytestream2_get_be32(&
gb);
1182 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands +
1183 q->subpacket[
s].js_subband_start;
1184 q->subpacket[
s].joint_stereo = 1;
1185 q->subpacket[
s].num_channels = 2;
1186 q->subpacket[
s].samples_per_channel = samples_per_frame >> 1;
1188 if (q->subpacket[
s].samples_per_channel > 256) {
1189 q->subpacket[
s].log2_numvector_size = 6;
1191 if (q->subpacket[
s].samples_per_channel > 512) {
1192 q->subpacket[
s].log2_numvector_size = 7;
1195 q->subpacket[
s].samples_per_channel = samples_per_frame;
1200 q->subpacket[
s].cookversion);
1204 if (
s > 1 && q->subpacket[
s].samples_per_channel != q->samples_per_channel) {
1208 q->samples_per_channel = q->subpacket[0].samples_per_channel;
1212 q->subpacket[
s].numvector_size = (1 << q->subpacket[
s].log2_numvector_size);
1215 if (q->subpacket[
s].total_subbands > 53) {
1220 if ((q->subpacket[
s].js_vlc_bits > 6) ||
1221 (q->subpacket[
s].js_vlc_bits < 2 * q->subpacket[
s].joint_stereo)) {
1223 q->subpacket[
s].js_vlc_bits, 2 * q->subpacket[
s].joint_stereo);
1227 if (q->subpacket[
s].subbands > 50) {
1231 if (q->subpacket[
s].subbands == 0) {
1235 q->subpacket[
s].gains1.now = q->subpacket[
s].gain_1;
1236 q->subpacket[
s].gains1.previous = q->subpacket[
s].gain_2;
1237 q->subpacket[
s].gains2.now = q->subpacket[
s].gain_3;
1238 q->subpacket[
s].gains2.previous = q->subpacket[
s].gain_4;
1240 if (q->num_subpackets + q->subpacket[
s].num_channels >
channels) {
1245 q->num_subpackets++;
1250 if (q->samples_per_channel != 256 && q->samples_per_channel != 512 &&
1251 q->samples_per_channel != 1024) {
1253 q->samples_per_channel);
1268 q->decoded_bytes_buffer =
1272 if (!q->decoded_bytes_buffer)
1306 .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.
#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]
#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.
#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)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
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(...)
static void scale(int *out, const int *in, const int w, const int h, const int shift)
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.