#include "libavutil/channel_layout.h"
#include "libavutil/lfg.h"
+
+#include "audiodsp.h"
#include "avcodec.h"
#include "get_bits.h"
-#include "dsputil.h"
#include "bytestream.h"
#include "fft.h"
#include "internal.h"
#define SUBBAND_SIZE 20
#define MAX_SUBPACKETS 5
-typedef struct {
+typedef struct cook_gains {
int *now;
int *previous;
} cook_gains;
-typedef struct {
+typedef struct COOKSubpacket {
int ch_idx;
int size;
int num_channels;
void (*saturate_output)(struct cook *q, float *out);
AVCodecContext* avctx;
- DSPContext dsp;
+ AudioDSPContext adsp;
GetBitContext gb;
/* stream data */
int num_vectors;
*/
static void saturate_output_float(COOKContext *q, float *out)
{
- q->dsp.vector_clipf(out, q->mono_mdct_output + q->samples_per_channel,
- -1.0f, 1.0f, FFALIGN(q->samples_per_channel, 8));
+ q->adsp.vector_clipf(out, q->mono_mdct_output + q->samples_per_channel,
+ -1.0f, 1.0f, FFALIGN(q->samples_per_channel, 8));
}
q->avctx = avctx;
/* Take care of the codec specific extradata. */
- if (extradata_size <= 0) {
+ if (extradata_size < 8) {
av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n");
return AVERROR_INVALIDDATA;
}
/* Initialize RNG. */
av_lfg_init(&q->random_state, 0);
- ff_dsputil_init(&q->dsp, avctx);
+ ff_audiodsp_init(&q->adsp);
while (edata_ptr < edata_ptr_end) {
/* 8 for mono, 16 for stereo, ? for multichannel
av_mallocz(avctx->block_align
+ DECODE_BYTES_PAD1(avctx->block_align)
+ FF_INPUT_BUFFER_PADDING_SIZE);
- if (q->decoded_bytes_buffer == NULL)
+ if (!q->decoded_bytes_buffer)
return AVERROR(ENOMEM);
/* Initialize transform. */
AVCodec ff_cook_decoder = {
.name = "cook",
+ .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_COOK,
.priv_data_size = sizeof(COOKContext),
.close = cook_decode_close,
.decode = cook_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"),
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
};