*/
/**
- * @file libavcodec/nellymoserenc.c
+ * @file
* Nellymoser encoder
* by Bartlomiej Wolowiec
*
#include "avcodec.h"
#include "dsputil.h"
#include "fft.h"
+#include "sinewin.h"
#define BITSTREAM_WRITER_LE
#include "put_bits.h"
static void apply_mdct(NellyMoserEncodeContext *s)
{
- memcpy(s->in_buff, s->buf[s->bufsel], NELLY_BUF_LEN * sizeof(float));
- s->dsp.vector_fmul(s->in_buff, ff_sine_128, NELLY_BUF_LEN);
+ s->dsp.vector_fmul(s->in_buff, s->buf[s->bufsel], ff_sine_128, NELLY_BUF_LEN);
s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128,
NELLY_BUF_LEN);
- ff_mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
+ s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
- s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128, NELLY_BUF_LEN);
+ s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN,
+ ff_sine_128, NELLY_BUF_LEN);
s->dsp.vector_fmul_reverse(s->buf[s->bufsel] + 2 * NELLY_BUF_LEN, s->buf[1 - s->bufsel], ff_sine_128,
NELLY_BUF_LEN);
- ff_mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);
+ s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);
}
static av_cold int encode_init(AVCodecContext *avctx)
}
/**
- * Encodes NELLY_SAMPLES samples. It assumes, that samples contains 3 * NELLY_BUF_LEN values
+ * Encode NELLY_SAMPLES samples. It assumes, that samples contains 3 * NELLY_BUF_LEN values
* @param s encoder context
* @param output output buffer
* @param output_size size of output buffer
static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, void *data)
{
NellyMoserEncodeContext *s = avctx->priv_data;
- int16_t *samples = data;
+ const int16_t *samples = data;
int i;
if (s->last_frame)
return 0;
}
-AVCodec nellymoser_encoder = {
+AVCodec ff_nellymoser_encoder = {
.name = "nellymoser",
- .type = CODEC_TYPE_AUDIO,
+ .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_NELLYMOSER,
.priv_data_size = sizeof(NellyMoserEncodeContext),
.init = encode_init,
.close = encode_end,
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
.long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
+ .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
};