[FFmpeg-soc] [soc]: r2429 - aacenc/aac_enc.patch

kostya subversion at mplayerhq.hu
Sat Jun 14 06:54:31 CEST 2008


Author: kostya
Date: Sat Jun 14 06:54:30 2008
New Revision: 2429

Log:
Delete redundant part from patch

Modified:
   aacenc/aac_enc.patch

Modified: aacenc/aac_enc.patch
==============================================================================
--- aacenc/aac_enc.patch	(original)
+++ aacenc/aac_enc.patch	Sat Jun 14 06:54:30 2008
@@ -10,122 +10,6 @@ index d4f6d1c..0ed9057 100644
  OBJS-$(CONFIG_AASC_DECODER)            += aasc.o
  OBJS-$(CONFIG_AC3_DECODER)             += ac3dec.o ac3tab.o ac3.o mdct.o fft.o
  OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc.o ac3tab.o ac3.o
-diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
-new file mode 100644
-index 0000000..1c44007
---- /dev/null
-+++ b/libavcodec/aacenc.c
-@@ -0,0 +1,110 @@
-+/*
-+ * AAC encoder
-+ * Copyright (C) 2008 Konstantin Shishkov
-+ *
-+ * This file is part of FFmpeg.
-+ *
-+ * FFmpeg is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * FFmpeg is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with FFmpeg; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ */
-+
-+/**
-+ * @file aacenc.c
-+ * AAC encoder
-+ */
-+
-+#include "avcodec.h"
-+#include "bitstream.h"
-+#include "dsputil.h"
-+#include "mpeg4audio.h"
-+
-+typedef struct {
-+    PutBitContext pb;
-+    MDCTContext mdct;
-+    DECLARE_ALIGNED_16(float, kbd_long_1024[1024]);
-+} AACEncContext;
-+
-+/**
-+ * Make AAC audio config object.
-+ * @see 1.6.2.1
-+ */
-+static int put_audio_specific_config(AVCodecContext *avctx)
-+{
-+    PutBitContext pb;    
-+    init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
-+    put_bits(&pb, 5, 2); //object type - AAC-LC
-+    for(i = 0; i < 16; i++)
-+        if(avctx->sample_rate == ff_mpeg4audio_sample_rates[i])
-+            break;
-+    if(i == 16){
-+        av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate);
-+        return -1;
-+    }
-+    put_bits(&pb, 4, i); //sample rate index
-+    put_bits(&pb, 4, avctx->channels); //channel config - stereo
-+    //GASpecificConfig
-+    put_bits(&pb, 1, 0); //frame length - 1024 samples
-+    put_bits(&pb, 1, 0); //does not depend on core coder
-+    put_bits(&pb, 1, 0); //is not extension
-+    flush_put_bits(&pb);
-+}
-+
-+static int aac_encode_init(AVCodecContext *avctx)
-+{
-+    AACEncContext *c = avctx->priv_data;
-+    int i;
-+
-+    avctx->frame_size = 1024;
-+
-+    ff_mdct_init(&c->mdct, 11, 1);
-+    // windows init
-+    ff_kbd_window_init(c->kbd_long_1024, 4.0, 1024);
-+
-+    // produce AAC audio config object
-+    // see 1.6.2.1
-+    avctx->extradata = av_malloc(2);
-+    avctx->extradata_size = 2;
-+    put_audio_specific_config(avctx);
-+    return 0;
-+}
-+
-+static int aac_encode_frame(AVCodecContext *avctx,
-+                            uint8_t *frame, int buf_size, void *data)
-+{
-+    int i,k,channel;
-+    AACEncContext *s = avctx->priv_data;
-+    int16_t *samples = data;
-+    
-+    init_put_bits(&s->pb, frame, buf_size*8);
-+    put_bits(&s->pb, 8, 0xAB);
-+
-+    flush_put_bits(&s->pb);
-+    return put_bits_count(&s->pb)>>3;
-+}
-+
-+static void sine_window_init(float *window, int n) {
-+    const float alpha = M_PI / n;
-+    int i;
-+    for(i = 0; i < n/2; i++)
-+        window[i] = sin((i + 0.5) * alpha);
-+}
-+
-+AVCodec aac_encoder = {
-+    "aac",
-+    CODEC_TYPE_AUDIO,
-+    CODEC_ID_AAC,
-+    sizeof(AACEncContext),
-+    aac_encode_init,
-+    aac_encode_frame,
-+};
 diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
 index 33a4242..6871496 100644
 --- a/libavcodec/allcodecs.c



More information about the FFmpeg-soc mailing list