diff options
-rw-r--r-- | contrib/ffmpeg/A04-aacenc.patch | 82 | ||||
-rw-r--r-- | gtk/configure.ac | 10 | ||||
-rw-r--r-- | gtk/module.defs | 4 | ||||
-rw-r--r-- | libhb/common.c | 9 | ||||
-rw-r--r-- | libhb/encfaac.c | 3 | ||||
-rw-r--r-- | libhb/hb.c | 2 | ||||
-rw-r--r-- | libhb/module.defs | 10 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | macosx/module.defs | 7 | ||||
-rw-r--r-- | make/configure.py | 15 | ||||
-rw-r--r-- | make/include/main.defs | 5 | ||||
-rw-r--r-- | test/module.defs | 6 |
12 files changed, 141 insertions, 18 deletions
diff --git a/contrib/ffmpeg/A04-aacenc.patch b/contrib/ffmpeg/A04-aacenc.patch new file mode 100644 index 000000000..b58441a17 --- /dev/null +++ b/contrib/ffmpeg/A04-aacenc.patch @@ -0,0 +1,82 @@ +commit 8bbdd20a293eab2cfac9f332613ead02a4e3c0c2 +Author: Claudio Freire <[email protected]> +Date: Sun May 12 09:38:40 2013 +0200 + + aacenc: Fix erasure of surround channels + + This was due to a miscomputation of s->cur_channel, which led to + psy-based encoders using the psy coefficients for the wrong channel. + + Signed-off-by: Martin Storsjö <[email protected]> + +diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c +index 60eca59..b2ad47b 100644 +--- a/libavcodec/aacenc.c ++++ b/libavcodec/aacenc.c +@@ -597,7 +597,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, + coeffs[ch] = cpe->ch[ch].coeffs; + s->psy.model->analyze(&s->psy, start_ch, coeffs, wi); + for (ch = 0; ch < chans; ch++) { +- s->cur_channel = start_ch * 2 + ch; ++ s->cur_channel = start_ch + ch; + s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda); + } + cpe->common_window = 0; +@@ -613,7 +613,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, + } + } + } +- s->cur_channel = start_ch * 2; ++ s->cur_channel = start_ch; + if (s->options.stereo_mode && cpe->common_window) { + if (s->options.stereo_mode > 0) { + IndividualChannelStream *ics = &cpe->ch[0].ics; + +commit f4d0a63b5b5c682c18df3bba730f97a9067408ba +Author: Claudio Freire <[email protected]> +Date: Sat May 4 18:36:37 2013 -0300 + + aacenc: Fix target bitrate for twoloop quantiser search + + This fixes a case where multichannel bitrate isn't accurately + targetted by psy model alone, never achieving the target bitrate. + + Signed-off-by: Martin Storsjö <[email protected]> + +diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c +index d65d8d9..35b98a9 100644 +--- a/libavcodec/aaccoder.c ++++ b/libavcodec/aaccoder.c +@@ -710,7 +710,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, + const float lambda) + { + int start = 0, i, w, w2, g; +- int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels; ++ int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f); + float dists[128] = { 0 }, uplims[128]; + float maxvals[128]; + int fflag, minscaler; + +commit 7c71ada4cad3c6aab5fa24155c379465c41cfd76 +Author: Claudio Freire <[email protected]> +Date: Sat May 4 18:35:49 2013 -0300 + + aacenc: Fix a rounding bug in aacpsy channel bitrate computation + + Signed-off-by: Martin Storsjö <[email protected]> + +diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c +index 6f1ac05..66cf6d5 100644 +--- a/libavcodec/aacpsy.c ++++ b/libavcodec/aacpsy.c +@@ -312,7 +312,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { + AacPsyCoeffs *coeffs = pctx->psy_coef[j]; + const uint8_t *band_sizes = ctx->bands[j]; + float line_to_frequency = ctx->avctx->sample_rate / (j ? 256.f : 2048.0f); +- float avg_chan_bits = chan_bitrate / ctx->avctx->sample_rate * (j ? 128.0f : 1024.0f); ++ float avg_chan_bits = chan_bitrate * (j ? 128.0f : 1024.0f) / ctx->avctx->sample_rate; + /* reference encoder uses 2.4% here instead of 60% like the spec says */ + float bark_pe = 0.024f * PSY_3GPP_BITS_TO_PE(avg_chan_bits) / num_bark; + float en_spread_low = j ? PSY_3GPP_EN_SPREAD_LOW_S : PSY_3GPP_EN_SPREAD_LOW_L; + + diff --git a/gtk/configure.ac b/gtk/configure.ac index 6d013f935..64aa72744 100644 --- a/gtk/configure.ac +++ b/gtk/configure.ac @@ -60,6 +60,10 @@ AC_ARG_ENABLE(fdk-aac, AS_HELP_STRING([--enable-fdk-aac], [enable fdk aac encoder]), use_fdk_aac=yes, use_fdk_aac=no) +AC_ARG_ENABLE(faac, + AS_HELP_STRING([--enable-faac], [enable faac encoder]), + use_faac=yes, use_faac=no) + AC_ARG_ENABLE(gst, AS_HELP_STRING([--disable-gst], [disable gstreamer (live preview)]), gst_disable=yes, gst_disable=no) @@ -203,12 +207,16 @@ case $host in ;; esac -HB_LIBS="-lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -lxml2" +HB_LIBS="-lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldvdnav -ldvdread -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -lxml2" if test "x$use_fdk_aac" = "xyes" ; then HB_LIBS+=" -lfdk-aac" fi +if test "x$use_faac" = "xyes" ; then + HB_LIBS+=" -lfaac" +fi + AC_SUBST(HB_LIBS) AC_SUBST(GHB_TOOLS_CFLAGS) AC_SUBST(GHB_TOOLS_LIBS) diff --git a/gtk/module.defs b/gtk/module.defs index 8eddc6d91..cee9d7790 100644 --- a/gtk/module.defs +++ b/gtk/module.defs @@ -32,3 +32,7 @@ endif ifeq (1,$(FEATURE.fdk_aac)) GTK.CONFIGURE.extra += --enable-fdk-aac endif + +ifeq (1,$(FEATURE.faac)) + GTK.CONFIGURE.extra += --enable-faac +endif diff --git a/libhb/common.c b/libhb/common.c index bdfefa3f9..2a090e638 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -229,10 +229,10 @@ hb_encoder_internal_t hb_audio_encoders[] = // actual encoders { { "AAC (CoreAudio)", "ca_aac", HB_ACODEC_CA_AAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, { { "HE-AAC (CoreAudio)", "ca_haac", HB_ACODEC_CA_HAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC_HE, }, - { { "AAC (FDK)", "fdk_aac", HB_ACODEC_FDK_AAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, - { { "HE-AAC (FDK)", "fdk_haac", HB_ACODEC_FDK_HAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC_HE, }, { { "AAC (faac)", "faac", HB_ACODEC_FAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, { { "AAC (ffmpeg)", "ffaac", HB_ACODEC_FFAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, + { { "AAC (FDK)", "fdk_aac", HB_ACODEC_FDK_AAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, + { { "HE-AAC (FDK)", "fdk_haac", HB_ACODEC_FDK_HAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC_HE, }, { { "AAC Passthru", "copy:aac", HB_ACODEC_AAC_PASS, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC_PASS, }, { { "AC3 (ffmpeg)", "ffac3", HB_ACODEC_AC3, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AC3, }, { { "AC3 Passthru", "copy:ac3", HB_ACODEC_AC3_PASS, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AC3_PASS, }, @@ -261,12 +261,12 @@ static int hb_audio_encoder_is_enabled(int encoder) return 1; #endif -#if 1 //#ifdef USE_FAAC +#ifdef USE_FAAC case HB_ACODEC_FAAC: return 1; #endif -#if 1 //#ifdef USE_LIBAV_AAC +#ifdef USE_LIBAV_AAC case HB_ACODEC_FFAAC: return 1; #endif @@ -1314,7 +1314,6 @@ int hb_mixdown_has_codec_support(int mixdown, uint32_t codec) return (mixdown <= HB_AMIXDOWN_7POINT1); case HB_ACODEC_LAME: - case HB_ACODEC_FFAAC: return (mixdown <= HB_AMIXDOWN_DOLBYPLII); case HB_ACODEC_FAAC: diff --git a/libhb/encfaac.c b/libhb/encfaac.c index ffdddc8d4..3bdd7cee0 100644 --- a/libhb/encfaac.c +++ b/libhb/encfaac.c @@ -7,6 +7,7 @@ For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html */ +#ifdef USE_FAAC #include "hb.h" #include "audio_remap.h" @@ -286,4 +287,4 @@ int encfaacWork( hb_work_object_t * w, hb_buffer_t ** buf_in, return HB_WORK_OK; } - +#endif // USE_FAAC diff --git a/libhb/hb.c b/libhb/hb.c index a55575f8e..0c475abd2 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -1645,7 +1645,9 @@ int hb_global_init() hb_register(&hb_encca_aac); hb_register(&hb_encca_haac); #endif +#ifdef USE_FAAC hb_register(&hb_encfaac); +#endif hb_register(&hb_enclame); hb_register(&hb_enctheora); hb_register(&hb_encvorbis); diff --git a/libhb/module.defs b/libhb/module.defs index bb7ffccb5..bd300bafb 100644 --- a/libhb/module.defs +++ b/libhb/module.defs @@ -40,6 +40,12 @@ endif ifeq (1,$(FEATURE.fdk_aac)) LIBHB.GCC.D += USE_FDK_AAC endif +ifeq (1,$(FEATURE.libav_aac)) +LIBHB.GCC.D += USE_LIBAV_AAC +endif +ifeq (1,$(FEATURE.faac)) +LIBHB.GCC.D += USE_FAAC +endif LIBHB.GCC.D += __LIBHB__ USE_PTHREAD LIBHB.GCC.I += $(LIBHB.build/) $(CONTRIB.build/)include @@ -104,6 +110,10 @@ ifeq (1,$(FEATURE.fdk_aac)) LIBHB.dll.libs += $(CONTRIB.build/)lib/libfdk-aac.a endif +ifeq (1,$(FEATURE.faac)) +LIBHB.dll.libs += $(CONTRIB.build/)lib/libfaac.a +endif + ifneq ($(HAS.iconv),1) LIBHB.dll.libs += $(CONTRIB.build/)lib/libiconv.a else diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index df3329743..6762c87e8 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -92,8 +92,6 @@ 27D6C75014B102DA00B785E4 /* libdvdnav.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72E14B102DA00B785E4 /* libdvdnav.a */; }; 27D6C75114B102DA00B785E4 /* libdvdread.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72F14B102DA00B785E4 /* libdvdread.a */; }; 27D6C75214B102DA00B785E4 /* libdvdread.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72F14B102DA00B785E4 /* libdvdread.a */; }; - 27D6C75314B102DA00B785E4 /* libfaac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C73014B102DA00B785E4 /* libfaac.a */; }; - 27D6C75414B102DA00B785E4 /* libfaac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C73014B102DA00B785E4 /* libfaac.a */; }; 27D6C75514B102DA00B785E4 /* libfontconfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C73114B102DA00B785E4 /* libfontconfig.a */; }; 27D6C75614B102DA00B785E4 /* libfontconfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C73114B102DA00B785E4 /* libfontconfig.a */; }; 27D6C75714B102DA00B785E4 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C73214B102DA00B785E4 /* libfreetype.a */; }; @@ -294,7 +292,6 @@ 27D6C72C14B102DA00B785E4 /* libbluray.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbluray.a; path = external/contrib/lib/libbluray.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C72E14B102DA00B785E4 /* libdvdnav.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdvdnav.a; path = external/contrib/lib/libdvdnav.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C72F14B102DA00B785E4 /* libdvdread.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdvdread.a; path = external/contrib/lib/libdvdread.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 27D6C73014B102DA00B785E4 /* libfaac.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfaac.a; path = external/contrib/lib/libfaac.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C73114B102DA00B785E4 /* libfontconfig.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfontconfig.a; path = external/contrib/lib/libfontconfig.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C73214B102DA00B785E4 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = external/contrib/lib/libfreetype.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C73314B102DA00B785E4 /* libfribidi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfribidi.a; path = external/contrib/lib/libfribidi.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -368,7 +365,6 @@ 27D6C74C14B102DA00B785E4 /* libbluray.a in Frameworks */, 27D6C75014B102DA00B785E4 /* libdvdnav.a in Frameworks */, 27D6C75214B102DA00B785E4 /* libdvdread.a in Frameworks */, - 27D6C75414B102DA00B785E4 /* libfaac.a in Frameworks */, 27D6C75614B102DA00B785E4 /* libfontconfig.a in Frameworks */, 27D6C75814B102DA00B785E4 /* libfreetype.a in Frameworks */, 27D6C75A14B102DA00B785E4 /* libfribidi.a in Frameworks */, @@ -411,7 +407,6 @@ 27D6C74B14B102DA00B785E4 /* libbluray.a in Frameworks */, 27D6C74F14B102DA00B785E4 /* libdvdnav.a in Frameworks */, 27D6C75114B102DA00B785E4 /* libdvdread.a in Frameworks */, - 27D6C75314B102DA00B785E4 /* libfaac.a in Frameworks */, 27D6C75514B102DA00B785E4 /* libfontconfig.a in Frameworks */, 27D6C75714B102DA00B785E4 /* libfreetype.a in Frameworks */, 27D6C75914B102DA00B785E4 /* libfribidi.a in Frameworks */, @@ -446,7 +441,6 @@ 27D6C72C14B102DA00B785E4 /* libbluray.a */, 27D6C72E14B102DA00B785E4 /* libdvdnav.a */, 27D6C72F14B102DA00B785E4 /* libdvdread.a */, - 27D6C73014B102DA00B785E4 /* libfaac.a */, 27D6C73114B102DA00B785E4 /* libfontconfig.a */, 27D6C73214B102DA00B785E4 /* libfreetype.a */, 27D6C73314B102DA00B785E4 /* libfribidi.a */, diff --git a/macosx/module.defs b/macosx/module.defs index 1870d5fe9..1a2b6f81d 100644 --- a/macosx/module.defs +++ b/macosx/module.defs @@ -26,9 +26,14 @@ MACOSX.map.g.std = debug MACOSX.map.g.max = debug ifeq (1,$(FEATURE.fdk_aac)) -MACOSX.extra_ldflags = OTHER_LDFLAGS='$(abspath $(BUILD))/contrib/lib/libfdk-aac.a' + extra_libs += $(abspath $(BUILD))/contrib/lib/libfdk-aac.a endif +ifeq (1,$(FEATURE.faac)) + extra_libs += $(abspath $(BUILD))/contrib/lib/libfaac.a +endif +MACOSX.extra_ldflags = OTHER_LDFLAGS='$(extra_libs)' + ## xcconfig: must be one of macosx/xcconfig/*.xcconfig MACOSX.xcconfig = $(foreach x,$(XCODE.xcconfig),-xcconfig $(MACOSX.src/)xcconfig/$(x)) MACOSX.sdk = $(foreach sdk,$(GCC.sysroot),-sdk $(sdk)) diff --git a/make/configure.py b/make/configure.py index b3da14dd8..af893ddae 100644 --- a/make/configure.py +++ b/make/configure.py @@ -1177,7 +1177,16 @@ def createCLI(): grp.add_option( '--enable-ff-mpeg2', default=False, action='store_true', help=h ) h = IfHost( 'enable use of fdk-aac encoder', '*-*-*', none=optparse.SUPPRESS_HELP ).value - grp.add_option( '--enable-fdk-aac', default=False, action='store_true', help=h ) + grp.add_option( '--enable-fdk-aac', dest="enable_fdk_aac", default=not host.match( '*-*-darwin*' ), action='store_true', help=h ) + grp.add_option( '--disable-fdk-aac', dest="enable_fdk_aac", action='store_false' ) + + h = IfHost( 'enable use of libav aac encoder', '*-*-*', none=optparse.SUPPRESS_HELP ).value + grp.add_option( '--enable-libav-aac', dest="enable_libav_aac", default=not host.match( '*-*-darwin*' ), action='store_true', help=h ) + grp.add_option( '--disable-libav-aac', dest="enable_libav_aac", action='store_false' ) + + h = IfHost( 'enable use of faac encoder', '*-*-*', none=optparse.SUPPRESS_HELP ).value + grp.add_option( '--enable-faac', dest="enable_faac", default=False, action='store_true', help=h ) + grp.add_option( '--disable-faac', dest="enable_faac", action='store_false' ) cli.add_option_group( grp ) @@ -1618,7 +1627,9 @@ int main () doc.add( 'FEATURE.gtk.mingw', int( options.enable_gtk_mingw )) doc.add( 'FEATURE.gst', int( not options.disable_gst )) doc.add( 'FEATURE.ff.mpeg2', int( options.enable_ff_mpeg2 )) - doc.add( 'FEATURE.fdk_aac', int( options.enable_fdk_aac )) + doc.add( 'FEATURE.fdk_aac', int( options.enable_fdk_aac )) + doc.add( 'FEATURE.libav_aac', int( options.enable_libav_aac )) + doc.add( 'FEATURE.faac', int( options.enable_faac )) doc.add( 'FEATURE.xcode', int( not (Tools.xcodebuild.fail or options.disable_xcode or options.cross) )) if not Tools.xcodebuild.fail and not options.disable_xcode: diff --git a/make/include/main.defs b/make/include/main.defs index 45d375c36..08901bd27 100644 --- a/make/include/main.defs +++ b/make/include/main.defs @@ -43,8 +43,11 @@ ifeq (1,$(FEATURE.fdk_aac)) MODULES += contrib/fdk-aac endif +ifeq (1,$(FEATURE.faac)) + MODULES += contrib/faac +endif + MODULES += contrib/lame -MODULES += contrib/faac MODULES += contrib/ffmpeg MODULES += contrib/libdvdread MODULES += contrib/libdvdnav diff --git a/test/module.defs b/test/module.defs index 7898a86ed..2150ed906 100644 --- a/test/module.defs +++ b/test/module.defs @@ -14,7 +14,7 @@ TEST.GCC.L = $(CONTRIB.build/)lib TEST.libs = $(LIBHB.a) TEST.GCC.l = \ - a52 ass avcodec avformat avutil avresample dvdnav dvdread faac \ + a52 ass avcodec avformat avutil avresample dvdnav dvdread \ fontconfig freetype fribidi mkv mpeg2 mp3lame mp4v2 ogg \ samplerate swscale theoraenc theoradec vorbis vorbisenc x264 \ bluray xml2 bz2 z @@ -23,6 +23,10 @@ ifeq (1,$(FEATURE.fdk_aac)) TEST.GCC.l += fdk-aac endif +ifeq (1,$(FEATURE.faac)) +TEST.GCC.l += faac +endif + TEST.install.exe = $(DESTDIR)$(PREFIX/)bin/$(notdir $(TEST.exe)) ############################################################################### |