]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ra144enc.c
dca: Move data tables from a header to an object file
[ffmpeg] / libavcodec / ra144enc.c
index bbea9d7f2a3dc41646451700ba930aef5b5f413d..fd04766561c4b8a038928edb972632ce55b7eef2 100644 (file)
 
 #include "avcodec.h"
 #include "audio_frame_queue.h"
+#include "celp_filters.h"
 #include "internal.h"
+#include "mathops.h"
 #include "put_bits.h"
-#include "celp_filters.h"
 #include "ra144.h"
 
 
@@ -40,9 +41,6 @@ static av_cold int ra144_encode_close(AVCodecContext *avctx)
     RA144Context *ractx = avctx->priv_data;
     ff_lpc_end(&ractx->lpc_ctx);
     ff_af_queue_close(&ractx->afq);
-#if FF_API_OLD_ENCODE_AUDIO
-    av_freep(&avctx->coded_frame);
-#endif
     return 0;
 }
 
@@ -58,7 +56,7 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
         return -1;
     }
     avctx->frame_size = NBLOCKS * BLOCKSIZE;
-    avctx->delay      = avctx->frame_size;
+    avctx->initial_padding = avctx->frame_size;
     avctx->bit_rate = 8000;
     ractx = avctx->priv_data;
     ractx->lpc_coef[0] = ractx->lpc_tables[0];
@@ -71,14 +69,6 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
 
     ff_af_queue_init(avctx, &ractx->afq);
 
-#if FF_API_OLD_ENCODE_AUDIO
-    avctx->coded_frame = avcodec_alloc_frame();
-    if (!avctx->coded_frame) {
-        ret = AVERROR(ENOMEM);
-        goto error;
-    }
-#endif
-
     return 0;
 error:
     ra144_encode_close(avctx);
@@ -342,7 +332,7 @@ static void ra144_encode_subblock(RA144Context *ractx,
                                   const int16_t *lpc_coefs, unsigned int rms,
                                   PutBitContext *pb)
 {
-    float data[BLOCKSIZE], work[LPC_ORDER + BLOCKSIZE];
+    float data[BLOCKSIZE] = { 0 }, work[LPC_ORDER + BLOCKSIZE];
     float coefs[LPC_ORDER];
     float zero[BLOCKSIZE], cba[BLOCKSIZE], cb1[BLOCKSIZE], cb2[BLOCKSIZE];
     int16_t cba_vect[BLOCKSIZE];
@@ -360,7 +350,6 @@ static void ra144_encode_subblock(RA144Context *ractx,
      * Calculate the zero-input response of the LPC filter and subtract it from
      * input data.
      */
-    memset(data, 0, sizeof(data));
     ff_celp_lp_synthesis_filterf(work + LPC_ORDER, coefs, data, BLOCKSIZE,
                                  LPC_ORDER);
     for (i = 0; i < BLOCKSIZE; i++) {
@@ -538,7 +527,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
         for (; i < frame->nb_samples; i++)
             ractx->curr_block[i] = samples[i] >> 2;
 
-        if ((ret = ff_af_queue_add(&ractx->afq, frame) < 0))
+        if ((ret = ff_af_queue_add(&ractx->afq, frame)) < 0)
             return ret;
     } else
         ractx->last_frame = 1;
@@ -557,8 +546,9 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 
 AVCodec ff_ra_144_encoder = {
     .name           = "real_144",
+    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
     .type           = AVMEDIA_TYPE_AUDIO,
-    .id             = CODEC_ID_RA_144,
+    .id             = AV_CODEC_ID_RA_144,
     .priv_data_size = sizeof(RA144Context),
     .init           = ra144_encode_init,
     .encode2        = ra144_encode_frame,
@@ -566,5 +556,4 @@ AVCodec ff_ra_144_encoder = {
     .capabilities   = CODEC_CAP_DELAY | CODEC_CAP_SMALL_LAST_FRAME,
     .sample_fmts    = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
                                                      AV_SAMPLE_FMT_NONE },
-    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
 };