Browse code

avcodec: Remove libvo-aacenc support.

The internal encoder is superior to libvo-aacenc.

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Kieran Kunhya authored on 2016/01/30 10:23:33
Showing 8 changed files
... ...
@@ -60,7 +60,7 @@ version <next>:
60 60
 - convolution filter
61 61
 - libquvi support removed
62 62
 - support for dvaudio in wav and avi
63
-- libaacplus support removed
63
+- libaacplus and libvo-aacenc support removed
64 64
 
65 65
 
66 66
 version 2.8:
... ...
@@ -254,7 +254,6 @@ External library support:
254 254
   --enable-libutvideo      enable Ut Video encoding and decoding via libutvideo [no]
255 255
   --enable-libv4l2         enable libv4l2/v4l-utils [no]
256 256
   --enable-libvidstab      enable video stabilization using vid.stab [no]
257
-  --enable-libvo-aacenc    enable AAC encoding via libvo-aacenc [no]
258 257
   --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
259 258
   --enable-libvorbis       enable Vorbis en/decoding via libvorbis,
260 259
                            native implementation exists [no]
... ...
@@ -1479,7 +1478,6 @@ EXTERNAL_LIBRARY_LIST="
1479 1479
     libutvideo
1480 1480
     libv4l2
1481 1481
     libvidstab
1482
-    libvo_aacenc
1483 1482
     libvo_amrwbenc
1484 1483
     libvorbis
1485 1484
     libvpx
... ...
@@ -2641,8 +2639,6 @@ libtheora_encoder_deps="libtheora"
2641 2641
 libtwolame_encoder_deps="libtwolame"
2642 2642
 libutvideo_decoder_deps="libutvideo"
2643 2643
 libutvideo_encoder_deps="libutvideo"
2644
-libvo_aacenc_encoder_deps="libvo_aacenc"
2645
-libvo_aacenc_encoder_select="audio_frame_queue"
2646 2644
 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2647 2645
 libvorbis_decoder_deps="libvorbis"
2648 2646
 libvorbis_encoder_deps="libvorbis"
... ...
@@ -4894,7 +4890,6 @@ die_license_disabled version3 gmp
4894 4894
 die_license_disabled version3 libopencore_amrnb
4895 4895
 die_license_disabled version3 libopencore_amrwb
4896 4896
 die_license_disabled version3 libsmbclient
4897
-die_license_disabled version3 libvo_aacenc
4898 4897
 die_license_disabled version3 libvo_amrwbenc
4899 4898
 
4900 4899
 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
... ...
@@ -5519,7 +5514,6 @@ enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
5519 5519
 enabled libutvideo        && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
5520 5520
 enabled libv4l2           && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
5521 5521
 enabled libvidstab        && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
5522
-enabled libvo_aacenc      && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
5523 5522
 enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
5524 5523
 enabled libvorbis         && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
5525 5524
 
... ...
@@ -1075,31 +1075,6 @@ Set MPEG audio original flag when set to 1. The default value is 0
1075 1075
 
1076 1076
 @end table
1077 1077
 
1078
-@anchor{libvo-aacenc}
1079
-@section libvo-aacenc
1080
-
1081
-VisualOn AAC encoder.
1082
-
1083
-Requires the presence of the libvo-aacenc headers and library during
1084
-configuration. You need to explicitly configure the build with
1085
-@code{--enable-libvo-aacenc --enable-version3}.
1086
-
1087
-This encoder is considered to be worse than the
1088
-@ref{aacenc,,native FFmpeg AAC encoder}, according to
1089
-multiple sources.
1090
-
1091
-@subsection Options
1092
-
1093
-The VisualOn AAC encoder only support encoding AAC-LC and up to 2
1094
-channels. It is also CBR-only.
1095
-
1096
-@table @option
1097
-
1098
-@item b
1099
-Set bit rate in bits/s.
1100
-
1101
-@end table
1102
-
1103 1078
 @section libvo-amrwbenc
1104 1079
 
1105 1080
 VisualOn Adaptive Multi-Rate Wideband encoder.
... ...
@@ -53,14 +53,6 @@ instructions for installing the libraries.
53 53
 Then pass @code{--enable-libopencore-amrnb} and/or
54 54
 @code{--enable-libopencore-amrwb} to configure to enable them.
55 55
 
56
-@subsection VisualOn AAC encoder library
57
-
58
-FFmpeg can make use of the VisualOn AACenc library for AAC encoding.
59
-
60
-Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the
61
-instructions for installing the library.
62
-Then pass @code{--enable-libvo-aacenc} to configure to enable it.
63
-
64 56
 @subsection VisualOn AMR-WB encoder library
65 57
 
66 58
 FFmpeg can make use of the VisualOn AMR-WBenc library for AMR-WB encoding.
... ...
@@ -881,8 +873,8 @@ following image formats are supported:
881 881
 @item Name @tab Encoding @tab Decoding @tab Comments
882 882
 @item 8SVX exponential       @tab     @tab  X
883 883
 @item 8SVX fibonacci         @tab     @tab  X
884
-@item AAC                    @tab  E  @tab  X
885
-    @tab encoding supported through external library libfaac, libfdk-aac and libvo-aacenc
884
+@item AAC                    @tab EX  @tab  X
885
+    @tab encoding supported through internal encoder and external libraries libfaac and libfdk-aac
886 886
 @item AAC+                   @tab  E  @tab  IX
887 887
     @tab encoding supported through external library libfdk-aac
888 888
 @item AC-3                   @tab IX  @tab  IX
... ...
@@ -832,7 +832,6 @@ OBJS-$(CONFIG_LIBTHEORA_ENCODER)          += libtheoraenc.o
832 832
 OBJS-$(CONFIG_LIBTWOLAME_ENCODER)         += libtwolame.o
833 833
 OBJS-$(CONFIG_LIBUTVIDEO_DECODER)         += libutvideodec.o
834 834
 OBJS-$(CONFIG_LIBUTVIDEO_ENCODER)         += libutvideoenc.o
835
-OBJS-$(CONFIG_LIBVO_AACENC_ENCODER)       += libvo-aacenc.o mpeg4audio.o
836 835
 OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER)     += libvo-amrwbenc.o
837 836
 OBJS-$(CONFIG_LIBVORBIS_DECODER)          += libvorbisdec.o
838 837
 OBJS-$(CONFIG_LIBVORBIS_ENCODER)          += libvorbisenc.o \
... ...
@@ -578,7 +578,6 @@ void avcodec_register_all(void)
578 578
     REGISTER_ENCODER(LIBTHEORA,         libtheora);
579 579
     REGISTER_ENCODER(LIBTWOLAME,        libtwolame);
580 580
     REGISTER_ENCDEC (LIBUTVIDEO,        libutvideo);
581
-    REGISTER_ENCODER(LIBVO_AACENC,      libvo_aacenc);
582 581
     REGISTER_ENCODER(LIBVO_AMRWBENC,    libvo_amrwbenc);
583 582
     REGISTER_ENCDEC (LIBVORBIS,         libvorbis);
584 583
     REGISTER_ENCDEC (LIBVPX_VP8,        libvpx_vp8);
585 584
deleted file mode 100644
... ...
@@ -1,200 +0,0 @@
1
-/*
2
- * AAC encoder wrapper
3
- * Copyright (c) 2010 Martin Storsjo
4
- *
5
- * This file is part of FFmpeg.
6
- *
7
- * FFmpeg is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * FFmpeg is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with FFmpeg; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
- */
21
-
22
-#include <vo-aacenc/voAAC.h>
23
-#include <vo-aacenc/cmnMemory.h>
24
-
25
-#include "avcodec.h"
26
-#include "audio_frame_queue.h"
27
-#include "internal.h"
28
-#include "mpeg4audio.h"
29
-
30
-#define FRAME_SIZE 1024
31
-#define ENC_DELAY  1600
32
-
33
-typedef struct AACContext {
34
-    VO_AUDIO_CODECAPI codec_api;
35
-    VO_HANDLE handle;
36
-    VO_MEM_OPERATOR mem_operator;
37
-    VO_CODEC_INIT_USERDATA user_data;
38
-    VO_PBYTE end_buffer;
39
-    AudioFrameQueue afq;
40
-    int last_frame;
41
-    int last_samples;
42
-} AACContext;
43
-
44
-
45
-static int aac_encode_close(AVCodecContext *avctx)
46
-{
47
-    AACContext *s = avctx->priv_data;
48
-
49
-    s->codec_api.Uninit(s->handle);
50
-    av_freep(&avctx->extradata);
51
-    ff_af_queue_close(&s->afq);
52
-    av_freep(&s->end_buffer);
53
-
54
-    return 0;
55
-}
56
-
57
-static av_cold int aac_encode_init(AVCodecContext *avctx)
58
-{
59
-    AACContext *s = avctx->priv_data;
60
-    AACENC_PARAM params = { 0 };
61
-    int index, ret;
62
-
63
-    avctx->frame_size = FRAME_SIZE;
64
-    avctx->initial_padding = ENC_DELAY;
65
-    s->last_frame     = 2;
66
-    ff_af_queue_init(avctx, &s->afq);
67
-
68
-    s->end_buffer = av_mallocz_array(avctx->channels, avctx->frame_size * 2);
69
-    if (!s->end_buffer) {
70
-        ret = AVERROR(ENOMEM);
71
-        goto error;
72
-    }
73
-
74
-    voGetAACEncAPI(&s->codec_api);
75
-
76
-    s->mem_operator.Alloc = cmnMemAlloc;
77
-    s->mem_operator.Copy = cmnMemCopy;
78
-    s->mem_operator.Free = cmnMemFree;
79
-    s->mem_operator.Set = cmnMemSet;
80
-    s->mem_operator.Check = cmnMemCheck;
81
-    s->user_data.memflag = VO_IMF_USERMEMOPERATOR;
82
-    s->user_data.memData = &s->mem_operator;
83
-    s->codec_api.Init(&s->handle, VO_AUDIO_CodingAAC, &s->user_data);
84
-
85
-    params.sampleRate = avctx->sample_rate;
86
-    params.bitRate    = avctx->bit_rate;
87
-    params.nChannels  = avctx->channels;
88
-    params.adtsUsed   = !(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER);
89
-    if (s->codec_api.SetParam(s->handle, VO_PID_AAC_ENCPARAM, &params)
90
-        != VO_ERR_NONE) {
91
-        av_log(avctx, AV_LOG_ERROR, "Unable to set encoding parameters\n");
92
-        ret = AVERROR(EINVAL);
93
-        goto error;
94
-    }
95
-
96
-    for (index = 0; index < 16; index++)
97
-        if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[index])
98
-            break;
99
-    if (index == 16) {
100
-        av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n",
101
-                                    avctx->sample_rate);
102
-        ret = AVERROR(ENOSYS);
103
-        goto error;
104
-    }
105
-    if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
106
-        avctx->extradata_size = 2;
107
-        avctx->extradata      = av_mallocz(avctx->extradata_size +
108
-                                           AV_INPUT_BUFFER_PADDING_SIZE);
109
-        if (!avctx->extradata) {
110
-            ret = AVERROR(ENOMEM);
111
-            goto error;
112
-        }
113
-
114
-        avctx->extradata[0] = 0x02 << 3 | index >> 1;
115
-        avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3;
116
-    }
117
-    return 0;
118
-error:
119
-    aac_encode_close(avctx);
120
-    return ret;
121
-}
122
-
123
-static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
124
-                            const AVFrame *frame, int *got_packet_ptr)
125
-{
126
-    AACContext *s = avctx->priv_data;
127
-    VO_CODECBUFFER input = { 0 }, output = { 0 };
128
-    VO_AUDIO_OUTPUTINFO output_info = { { 0 } };
129
-    VO_PBYTE samples;
130
-    int ret;
131
-
132
-    /* handle end-of-stream small frame and flushing */
133
-    if (!frame) {
134
-        if (s->last_frame <= 0)
135
-            return 0;
136
-        if (s->last_samples > 0 && s->last_samples < ENC_DELAY - FRAME_SIZE) {
137
-            s->last_samples = 0;
138
-            s->last_frame--;
139
-        }
140
-        s->last_frame--;
141
-        memset(s->end_buffer, 0, 2 * avctx->channels * avctx->frame_size);
142
-        samples = s->end_buffer;
143
-    } else {
144
-        if (frame->nb_samples < avctx->frame_size) {
145
-            s->last_samples = frame->nb_samples;
146
-            memcpy(s->end_buffer, frame->data[0], 2 * avctx->channels * frame->nb_samples);
147
-            samples = s->end_buffer;
148
-        } else {
149
-            samples = (VO_PBYTE)frame->data[0];
150
-        }
151
-        /* add current frame to the queue */
152
-        if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
153
-            return ret;
154
-    }
155
-
156
-    if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels), 0)) < 0)
157
-        return ret;
158
-
159
-    input.Buffer  = samples;
160
-    input.Length  = 2 * avctx->channels * avctx->frame_size;
161
-    output.Buffer = avpkt->data;
162
-    output.Length = avpkt->size;
163
-
164
-    s->codec_api.SetInputData(s->handle, &input);
165
-    if (s->codec_api.GetOutputData(s->handle, &output, &output_info)
166
-        != VO_ERR_NONE) {
167
-        av_log(avctx, AV_LOG_ERROR, "Unable to encode frame\n");
168
-        return AVERROR(EINVAL);
169
-    }
170
-
171
-    /* Get the next frame pts/duration */
172
-    ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
173
-                       &avpkt->duration);
174
-
175
-    avpkt->size = output.Length;
176
-    *got_packet_ptr = 1;
177
-    return 0;
178
-}
179
-
180
-/* duplicated from avpriv_mpeg4audio_sample_rates to avoid shared build
181
- * failures */
182
-static const int mpeg4audio_sample_rates[16] = {
183
-    96000, 88200, 64000, 48000, 44100, 32000,
184
-    24000, 22050, 16000, 12000, 11025, 8000, 7350
185
-};
186
-
187
-AVCodec ff_libvo_aacenc_encoder = {
188
-    .name           = "libvo_aacenc",
189
-    .long_name      = NULL_IF_CONFIG_SMALL("Android VisualOn AAC (Advanced Audio Coding)"),
190
-    .type           = AVMEDIA_TYPE_AUDIO,
191
-    .id             = AV_CODEC_ID_AAC,
192
-    .priv_data_size = sizeof(AACContext),
193
-    .init           = aac_encode_init,
194
-    .encode2        = aac_encode_frame,
195
-    .close          = aac_encode_close,
196
-    .supported_samplerates = mpeg4audio_sample_rates,
197
-    .capabilities   = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY,
198
-    .sample_fmts    = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
199
-                                                     AV_SAMPLE_FMT_NONE },
200
-};
... ...
@@ -29,8 +29,8 @@
29 29
 #include "libavutil/version.h"
30 30
 
31 31
 #define LIBAVCODEC_VERSION_MAJOR  57
32
-#define LIBAVCODEC_VERSION_MINOR  22
33
-#define LIBAVCODEC_VERSION_MICRO 102
32
+#define LIBAVCODEC_VERSION_MINOR  23
33
+#define LIBAVCODEC_VERSION_MICRO 100
34 34
 
35 35
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
36 36
                                                LIBAVCODEC_VERSION_MINOR, \