Go to the documentation of this file.
62 #define MONO 0x1000001
63 #define STEREO 0x1000002
64 #define JOINT_STEREO 0x1000003
65 #define MC_COOK 0x2000000
67 #define SUBBAND_SIZE 20
68 #define MAX_SUBPACKETS 5
70 #define QUANT_VLC_BITS 9
71 #define COUPLING_VLC_BITS 6
113 int *subband_coef_index,
int *subband_coef_sign,
120 float *decode_buffer,
121 float *mlt_buffer1,
float *mlt_buffer2);
124 cook_gains *gains_ptr,
float *previous_buffer);
127 int gain_index,
int gain_index_next);
176 static const float exp2_tab[2] = {1,
M_SQRT2};
177 float exp2_val =
powf(2, -63);
178 float root_val =
powf(2, -32);
179 for (
i = -63;
i < 64;
i++) {
192 q->gain_size_factor = q->samples_per_channel / 8;
193 for (
i = 0;
i < 31;
i++)
195 (1.0 / (
double) q->gain_size_factor));
199 const void *syms,
int symbol_size,
int offset,
205 for (
int i = 0;
i < 16;
i++)
206 for (
unsigned count = num + counts[
i]; num < count; num++)
210 syms, symbol_size, symbol_size,
219 for (
i = 0;
i < 13;
i++) {
225 for (
i = 0;
i < 7;
i++) {
226 int sym_size = 1 + (
i == 3);
232 for (
i = 0;
i < q->num_subpackets;
i++) {
233 if (q->subpacket[
i].joint_stereo == 1) {
249 int mlt_size = q->samples_per_channel;
251 if (!(q->mlt_window =
av_malloc_array(mlt_size,
sizeof(*q->mlt_window))))
256 for (j = 0; j < mlt_size; j++)
257 q->mlt_window[j] *= sqrt(2.0 / q->samples_per_channel);
272 for (
i = 0;
i < 5;
i++)
278 #define DECODE_BYTES_PAD1(bytes) (3 - ((bytes) + 3) % 4)
279 #define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes)))
303 static const uint32_t
tab[4] = {
310 uint32_t *obuf = (uint32_t *)
out;
317 off = (intptr_t) inbuffer & 3;
318 buf = (
const uint32_t *) (inbuffer - off);
321 for (
i = 0;
i < bytes / 4;
i++)
322 obuf[
i] =
c ^ buf[
i];
341 for (
i = 0;
i < 13;
i++)
343 for (
i = 0;
i < 7;
i++)
345 for (
i = 0;
i < q->num_subpackets;
i++)
371 gaininfo[
i++] = gain;
384 int *quant_index_table)
388 quant_index_table[0] =
get_bits(&q->gb, 6) - 6;
402 j =
get_vlc2(&q->gb, q->envelope_quant_index[vlc_index - 1].table,
404 quant_index_table[
i] = quant_index_table[
i - 1] + j;
405 if (quant_index_table[
i] > 63 || quant_index_table[
i] < -63) {
407 "Invalid quantizer %d at position %d, outside [-63, 63] range\n",
408 quant_index_table[
i],
i);
427 int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits,
index, v,
i, j;
428 int exp_index2[102] = { 0 };
429 int exp_index1[102] = { 0 };
431 int tmp_categorize_array[128 * 2] = { 0 };
437 if (bits_left > q->samples_per_channel)
438 bits_left = q->samples_per_channel +
439 ((bits_left - q->samples_per_channel) * 5) / 8;
444 for (
i = 32;
i > 0;
i =
i / 2) {
452 if (num_bits >= bits_left - 32)
461 exp_index1[
i] = exp_idx;
462 exp_index2[
i] = exp_idx;
464 tmpbias1 = tmpbias2 = num_bits;
467 if (tmpbias1 + tmpbias2 > 2 * bits_left) {
471 if (exp_index1[
i] < 7) {
472 v = (-2 * exp_index1[
i]) - quant_index_table[
i] + bias;
481 tmp_categorize_array[tmp_categorize_array1_idx++] =
index;
489 if (exp_index2[
i] > 0) {
490 v = (-2 * exp_index2[
i]) - quant_index_table[
i] + bias;
499 tmp_categorize_array[--tmp_categorize_array2_idx] =
index;
510 category_index[
i] = tmp_categorize_array[tmp_categorize_array2_idx++];
525 for (
i = 0;
i < q->num_vectors;
i++)
527 int idx = category_index[
i];
544 int *subband_coef_index,
int *subband_coef_sign,
551 if (subband_coef_index[
i]) {
553 if (subband_coef_sign[
i])
558 if (
av_lfg_get(&q->random_state) < 0x80000000)
573 int *subband_coef_index,
int *subband_coef_sign)
586 for (j = vd - 1; j >= 0; j--) {
591 for (j = 0; j < vd; j++) {
592 if (subband_coef_index[
i * vd + j]) {
594 subband_coef_sign[
i * vd + j] =
get_bits1(&q->gb);
597 subband_coef_sign[
i * vd + j] = 0;
600 subband_coef_sign[
i * vd + j] = 0;
617 int *quant_index_table,
float *mlt_buffer)
638 memset(subband_coef_index, 0,
sizeof(subband_coef_index));
639 memset(subband_coef_sign, 0,
sizeof(subband_coef_sign));
641 q->scalar_dequant(q,
index, quant_index_table[band],
642 subband_coef_index, subband_coef_sign,
654 int category_index[128] = { 0 };
656 int quant_index_table[102];
683 int gain_index,
int gain_index_next)
687 fc1 =
pow2tab[gain_index + 63];
689 if (gain_index == gain_index_next) {
690 for (
i = 0;
i < q->gain_size_factor;
i++)
693 fc2 = q->gain_table[15 + (gain_index_next - gain_index)];
694 for (
i = 0;
i < q->gain_size_factor;
i++) {
710 cook_gains *gains_ptr,
float *previous_buffer)
721 for (
i = 0;
i < q->samples_per_channel;
i++)
722 inbuffer[
i] = inbuffer[
i] *
fc * q->mlt_window[
i] -
723 previous_buffer[
i] * q->mlt_window[q->samples_per_channel - 1 -
i];
738 cook_gains *gains_ptr,
float *previous_buffer)
740 float *buffer0 = q->mono_mdct_output;
741 float *buffer1 = q->mono_mdct_output + q->samples_per_channel;
745 q->mdct_ctx.imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
747 q->imlt_window(q, buffer1, gains_ptr, previous_buffer);
750 for (
i = 0;
i < 8;
i++)
751 if (gains_ptr->
now[
i] || gains_ptr->
now[
i + 1])
752 q->interpolate(q, &buffer1[q->gain_size_factor *
i],
753 gains_ptr->
now[
i], gains_ptr->
now[
i + 1]);
756 memcpy(previous_buffer, buffer0,
757 q->samples_per_channel *
sizeof(*previous_buffer));
773 int length = end - start + 1;
779 for (
i = 0;
i < length;
i++)
780 decouple_tab[start +
i] =
get_vlc2(&q->gb,
784 for (
i = 0;
i < length;
i++) {
790 decouple_tab[start +
i] = v;
810 float *decode_buffer,
811 float *mlt_buffer1,
float *mlt_buffer2)
816 mlt_buffer1[
SUBBAND_SIZE * subband + j] = f1 * decode_buffer[tmp_idx];
817 mlt_buffer2[
SUBBAND_SIZE * subband + j] = f2 * decode_buffer[tmp_idx];
829 float *mlt_buffer_left,
float *mlt_buffer_right)
833 float *decode_buffer = q->decode_buffer_0;
836 const float *cplscale;
838 memset(decode_buffer, 0,
sizeof(q->decode_buffer_0));
841 memset(mlt_buffer_left, 0, 1024 *
sizeof(*mlt_buffer_left));
842 memset(mlt_buffer_right, 0, 1024 *
sizeof(*mlt_buffer_right));
850 mlt_buffer_left[
i * 20 + j] = decode_buffer[
i * 40 + j];
851 mlt_buffer_right[
i * 20 + j] = decode_buffer[
i * 40 + 20 + j];
860 idx -= decouple_tab[cpl_tmp];
862 f1 = cplscale[decouple_tab[cpl_tmp] + 1];
864 q->decouple(q, p,
i, f1, f2, decode_buffer,
865 mlt_buffer_left, mlt_buffer_right);
881 const uint8_t *inbuffer,
904 q->adsp.vector_clipf(
out, q->mono_mdct_output + q->samples_per_channel,
905 FFALIGN(q->samples_per_channel, 8), -1.0f, 1.0f);
921 cook_gains *gains_ptr,
float *previous_buffer,
924 imlt_gain(q, decode_buffer, gains_ptr, previous_buffer);
926 q->saturate_output(q,
out);
939 const uint8_t *inbuffer,
float **outbuffer)
941 int sub_packet_size = p->
size;
944 memset(q->decode_buffer_1, 0,
sizeof(q->decode_buffer_1));
948 if ((res =
joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2)) < 0)
951 if ((res =
mono_decode(q, p, q->decode_buffer_1)) < 0)
956 if ((res =
mono_decode(q, p, q->decode_buffer_2)) < 0)
981 int *got_frame_ptr,
AVPacket *avpkt)
984 const uint8_t *buf = avpkt->
data;
985 int buf_size = avpkt->
size;
992 if (buf_size < avctx->block_align)
996 if (q->discarded_packets >= 2) {
997 frame->nb_samples = q->samples_per_channel;
1006 for (
i = 1;
i < q->num_subpackets;
i++) {
1008 q->subpacket[0].size -= q->subpacket[
i].size + 1;
1009 if (q->subpacket[0].size < 0) {
1011 "frame subpacket size total > avctx->block_align!\n");
1017 for (
i = 0;
i < q->num_subpackets;
i++) {
1018 q->subpacket[
i].bits_per_subpacket = (q->subpacket[
i].size * 8) >>
1019 q->subpacket[
i].bits_per_subpdiv;
1020 q->subpacket[
i].ch_idx = chidx;
1022 "subpacket[%i] size %i js %i %i block_align %i\n",
1023 i, q->subpacket[
i].size, q->subpacket[
i].joint_stereo,
offset,
1028 offset += q->subpacket[
i].size;
1029 chidx += q->subpacket[
i].num_channels;
1035 if (q->discarded_packets < 2) {
1036 q->discarded_packets++;
1049 #define PRINT(a, b) ff_dlog(q->avctx, " %s = %d\n", a, b);
1050 ff_dlog(q->avctx,
"COOKextradata\n");
1051 ff_dlog(q->avctx,
"cookversion=%x\n", q->subpacket[0].cookversion);
1052 if (q->subpacket[0].cookversion >
STEREO) {
1053 PRINT(
"js_subband_start", q->subpacket[0].js_subband_start);
1054 PRINT(
"js_vlc_bits", q->subpacket[0].js_vlc_bits);
1056 ff_dlog(q->avctx,
"COOKContext\n");
1057 PRINT(
"nb_channels", q->avctx->channels);
1058 PRINT(
"bit_rate", (
int)q->avctx->bit_rate);
1059 PRINT(
"sample_rate", q->avctx->sample_rate);
1060 PRINT(
"samples_per_channel", q->subpacket[0].samples_per_channel);
1061 PRINT(
"subbands", q->subpacket[0].subbands);
1062 PRINT(
"js_subband_start", q->subpacket[0].js_subband_start);
1063 PRINT(
"log2_numvector_size", q->subpacket[0].log2_numvector_size);
1064 PRINT(
"numvector_size", q->subpacket[0].numvector_size);
1065 PRINT(
"total_subbands", q->subpacket[0].total_subbands);
1079 unsigned int channel_mask = 0;
1080 int samples_per_frame = 0;
1114 q->subpacket[
s].cookversion = bytestream2_get_be32(&
gb);
1115 samples_per_frame = bytestream2_get_be16(&
gb);
1116 q->subpacket[
s].subbands = bytestream2_get_be16(&
gb);
1117 bytestream2_get_be32(&
gb);
1118 q->subpacket[
s].js_subband_start = bytestream2_get_be16(&
gb);
1119 if (q->subpacket[
s].js_subband_start >= 51) {
1123 q->subpacket[
s].js_vlc_bits = bytestream2_get_be16(&
gb);
1126 q->subpacket[
s].samples_per_channel = samples_per_frame /
avctx->
channels;
1130 q->subpacket[
s].log2_numvector_size = 5;
1131 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands;
1132 q->subpacket[
s].num_channels = 1;
1137 q->subpacket[
s].cookversion);
1138 q->subpacket[
s].joint_stereo = 0;
1139 switch (q->subpacket[
s].cookversion) {
1149 q->subpacket[
s].bits_per_subpdiv = 1;
1150 q->subpacket[
s].num_channels = 2;
1161 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands +
1162 q->subpacket[
s].js_subband_start;
1163 q->subpacket[
s].joint_stereo = 1;
1164 q->subpacket[
s].num_channels = 2;
1166 if (q->subpacket[
s].samples_per_channel > 256) {
1167 q->subpacket[
s].log2_numvector_size = 6;
1169 if (q->subpacket[
s].samples_per_channel > 512) {
1170 q->subpacket[
s].log2_numvector_size = 7;
1175 channel_mask |= q->subpacket[
s].channel_mask = bytestream2_get_be32(&
gb);
1178 q->subpacket[
s].total_subbands = q->subpacket[
s].subbands +
1179 q->subpacket[
s].js_subband_start;
1180 q->subpacket[
s].joint_stereo = 1;
1181 q->subpacket[
s].num_channels = 2;
1182 q->subpacket[
s].samples_per_channel = samples_per_frame >> 1;
1184 if (q->subpacket[
s].samples_per_channel > 256) {
1185 q->subpacket[
s].log2_numvector_size = 6;
1187 if (q->subpacket[
s].samples_per_channel > 512) {
1188 q->subpacket[
s].log2_numvector_size = 7;
1191 q->subpacket[
s].samples_per_channel = samples_per_frame;
1196 q->subpacket[
s].cookversion);
1200 if (
s > 1 && q->subpacket[
s].samples_per_channel != q->samples_per_channel) {
1204 q->samples_per_channel = q->subpacket[0].samples_per_channel;
1208 q->subpacket[
s].numvector_size = (1 << q->subpacket[
s].log2_numvector_size);
1211 if (q->subpacket[
s].total_subbands > 53) {
1216 if ((q->subpacket[
s].js_vlc_bits > 6) ||
1217 (q->subpacket[
s].js_vlc_bits < 2 * q->subpacket[
s].joint_stereo)) {
1219 q->subpacket[
s].js_vlc_bits, 2 * q->subpacket[
s].joint_stereo);
1223 if (q->subpacket[
s].subbands > 50) {
1227 if (q->subpacket[
s].subbands == 0) {
1231 q->subpacket[
s].gains1.now = q->subpacket[
s].gain_1;
1232 q->subpacket[
s].gains1.previous = q->subpacket[
s].gain_2;
1233 q->subpacket[
s].gains2.now = q->subpacket[
s].gain_3;
1234 q->subpacket[
s].gains2.previous = q->subpacket[
s].gain_4;
1236 if (q->num_subpackets + q->subpacket[
s].num_channels > q->avctx->channels) {
1237 av_log(
avctx,
AV_LOG_ERROR,
"Too many subpackets %d for channels %d\n", q->num_subpackets, q->avctx->channels);
1241 q->num_subpackets++;
1246 if (q->samples_per_channel != 256 && q->samples_per_channel != 512 &&
1247 q->samples_per_channel != 1024) {
1249 q->samples_per_channel);
1264 q->decoded_bytes_buffer =
1268 if (!q->decoded_bytes_buffer)
1301 .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
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
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
uint64_t channel_layout
Audio channel layout.
static av_cold int cook_decode_init(AVCodecContext *avctx)
Cook initialization.
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static enum AVSampleFormat sample_fmts[]
static av_cold void init_pow2table(void)
static void decode_gain_info(GetBitContext *gb, int *gaininfo)
Fill the gain array for the timedomain quantization.
#define AV_CH_LAYOUT_MONO
static int cook_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
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)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
#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
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)
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]
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]
#define AV_CH_LAYOUT_STEREO
static av_cold void init_cplscales_table(COOKContext *q)
int ff_init_vlc_from_lengths(VLC *vlc_arg, 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()
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)
static const float quant_centroid_tab[7][14]
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
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]
#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)
void ff_free_vlc(VLC *vlc)
float decode_buffer_1[1024]
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 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,...
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]
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
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.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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
unsigned int channel_mask
void ff_sine_window_init(float *window, int n)
Generate a sine window.
#define MAX_COOK_VLC_ENTRIES
int channels
number of audio channels
static const int kmax_tab[7]
#define DECLARE_ALIGNED(n, t, v)
#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 FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#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.
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)
const AVCodec ff_cook_decoder
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]
uint8_t * decoded_bytes_buffer
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]
VLC_TYPE(* table)[2]
code, bits
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.