]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ac3enc.c
More okayed chunks of AAC encoder
[ffmpeg] / libavcodec / ac3enc.c
index 9694639fbeb300be8b2ac7a4a2d53a650ad63f4c..faea64a928464e07c094f913ae035d2f79a6f85c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * The simplest AC3 encoder
+ * The simplest AC-3 encoder
  * Copyright (c) 2000 Fabrice Bellard.
  *
  * This file is part of FFmpeg.
 
 /**
  * @file ac3enc.c
- * The simplest AC3 encoder.
+ * The simplest AC-3 encoder.
  */
 //#define DEBUG
 //#define DEBUG_BITALLOC
+#include "libavutil/crc.h"
 #include "avcodec.h"
 #include "bitstream.h"
-#include "crc.h"
 #include "ac3.h"
 
 typedef struct AC3EncodeContext {
@@ -463,7 +463,8 @@ static int bit_alloc(AC3EncodeContext *s,
         for(ch=0;ch<s->nb_all_channels;ch++) {
             ff_ac3_bit_alloc_calc_bap(mask[i][ch], psd[i][ch], 0,
                                       s->nb_coefs[ch], snr_offset,
-                                      s->bit_alloc.floor, bap[i][ch]);
+                                      s->bit_alloc.floor, ff_ac3_bap_tab,
+                                      bap[i][ch]);
             frame_bits += compute_mantissa_size(s, bap[i][ch],
                                                  s->nb_coefs[ch]);
         }
@@ -489,7 +490,7 @@ static int compute_bit_allocation(AC3EncodeContext *s,
     uint8_t bap1[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
     int16_t psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
     int16_t mask[NB_BLOCKS][AC3_MAX_CHANNELS][50];
-    static int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 };
+    static const int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 };
 
     /* init default parameters */
     s->slow_decay_code = 2;
@@ -704,7 +705,7 @@ static av_cold int AC3_encode_init(AVCodecContext *avctx)
     return 0;
 }
 
-/* output the AC3 frame header */
+/* output the AC-3 frame header */
 static void output_frame_header(AC3EncodeContext *s, unsigned char *frame)
 {
     init_put_bits(&s->pb, frame, AC3_MAX_CODED_FRAME_SIZE);
@@ -771,7 +772,7 @@ static inline int asym_quant(int c, int e, int qbits)
     return v & ((1 << qbits)-1);
 }
 
-/* Output one audio block. There are NB_BLOCKS audio blocks in one AC3
+/* Output one audio block. There are NB_BLOCKS audio blocks in one AC-3
    frame */
 static void output_audio_block(AC3EncodeContext *s,
                                uint8_t exp_strategy[AC3_MAX_CHANNELS],
@@ -1363,5 +1364,6 @@ AVCodec ac3_encoder = {
     AC3_encode_frame,
     AC3_encode_close,
     NULL,
-    .long_name = "ATSC A/52 / AC-3",
+    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 / AC-3"),
 };