]> granicus.if.org Git - handbrake/commitdiff
Bump libav to v10_beta1
authorRodeo <tdskywalker@gmail.com>
Tue, 18 Feb 2014 02:26:52 +0000 (02:26 +0000)
committerRodeo <tdskywalker@gmail.com>
Tue, 18 Feb 2014 02:26:52 +0000 (02:26 +0000)
Remove some patches that have been applied upstream.

Add support for AVDownmixInfo side data (i.e. mix levels).

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6039 b64f7644-9d1e-0410-96f1-a4d463321fa5

contrib/ffmpeg/A01-vc1-numref.patch [deleted file]
contrib/ffmpeg/A02-ac3dec-asymmetric-drc.patch [deleted file]
contrib/ffmpeg/A03-reget-buffer-pkt-pts.patch [deleted file]
contrib/ffmpeg/module.defs
libhb/audio_resample.c
libhb/audio_resample.h
libhb/deca52.c
libhb/decavcodec.c
libhb/hbffmpeg.h

diff --git a/contrib/ffmpeg/A01-vc1-numref.patch b/contrib/ffmpeg/A01-vc1-numref.patch
deleted file mode 100644 (file)
index 29e84e5..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-From 1ad55faa4d730f437bce612531132f00556d29fb Mon Sep 17 00:00:00 2001
-From: Michael Niedermayer <michaelni@gmx.at>
-Date: Sun, 19 Jan 2014 17:13:51 +0100
-Subject: [PATCH] vc1: Always reset numref when parsing a new frame header.
-
-Fixes an issue where the B-frame coding mode switches from interlaced
-fields to interlaced frames, causing incorrect decisions in the motion
-compensation code and resulting in visual artifacts.
-
-CC: libav-stable@libav.org
-Signed-off-by: Tim Walker <tdskywalker@gmail.com>
----
- libavcodec/vc1.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
-index acefce6..a7f2aab 100644
---- a/libavcodec/vc1.c
-+++ b/libavcodec/vc1.c
-@@ -842,6 +842,7 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
-     int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; /* useful only for debugging */
-     int field_mode, fcm;
-+    v->numref          = 0;
-     v->p_frame_skipped = 0;
-     if (v->second_field) {
-         v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
-@@ -1011,8 +1012,6 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
-                 v->reffield          = get_bits1(gb);
-                 v->ref_field_type[0] = v->reffield ^ !v->cur_field_type;
-             }
--        } else {
--            v->numref = 0;
-         }
-         if (v->extended_mv)
-             v->mvrange = get_unary(gb, 0, 3);
--- 
-1.8.3.4 (Apple Git-47)
-
diff --git a/contrib/ffmpeg/A02-ac3dec-asymmetric-drc.patch b/contrib/ffmpeg/A02-ac3dec-asymmetric-drc.patch
deleted file mode 100644 (file)
index b87de16..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-From e275318cecee53cf8ce13e4ab41df91c8c7fdcd4 Mon Sep 17 00:00:00 2001
-From: John Stebbins <stebbins@jetheaddev.com>
-Date: Mon, 13 Jan 2014 17:04:30 +0000
-Subject: [PATCH] ac3dec: Allow asymmetric application of DRC when drc_scale >
- 1
-
-Amplification of quiet sounds is enhanced.
-Inspired by gbooker's A52Decoder.
----
- libavcodec/ac3dec.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
-index 87638e7..0416dbc 100644
---- a/libavcodec/ac3dec.c
-+++ b/libavcodec/ac3dec.c
-@@ -772,8 +772,13 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
-     i = !s->channel_mode;
-     do {
-         if (get_bits1(gbc)) {
--            s->dynamic_range[i] = powf(dynamic_range_tab[get_bits(gbc, 8)],
--                                       s->drc_scale);
-+            /* Allow asymmetric application of DRC when drc_scale > 1.
-+               Amplification of quiet sounds is enhanced */
-+            float range = dynamic_range_tab[get_bits(gbc, 8)];
-+            if (range > 1.0 || s->drc_scale <= 1.0)
-+                s->dynamic_range[i] = powf(range, s->drc_scale);
-+            else
-+                s->dynamic_range[i] = range;
-         } else if (blk == 0) {
-             s->dynamic_range[i] = 1.0f;
-         }
-@@ -1487,7 +1492,7 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx)
- #define OFFSET(x) offsetof(AC3DecodeContext, x)
- #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
- static const AVOption options[] = {
--    { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 1.0, PAR },
-+    { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR },
-     { NULL},
- };
--- 
-1.8.3.4 (Apple Git-47)
-
diff --git a/contrib/ffmpeg/A03-reget-buffer-pkt-pts.patch b/contrib/ffmpeg/A03-reget-buffer-pkt-pts.patch
deleted file mode 100644 (file)
index c64c39e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-From 091f3393401f7eb83fef4fb9cbb2e5ed2837b623 Mon Sep 17 00:00:00 2001
-From: John Stebbins <stebbins@jetheaddev.com>
-Date: Mon, 10 Feb 2014 08:52:07 -0700
-Subject: [PATCH] lavc: set AVFrame pkt_pts and reordered_opaque in
- reget_buffer
-
----
- libavcodec/utils.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/libavcodec/utils.c b/libavcodec/utils.c
-index 46f339f..b2b11ef 100644
---- a/libavcodec/utils.c
-+++ b/libavcodec/utils.c
-@@ -762,8 +762,11 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
-     if (!frame->data[0])
-         return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
--    if (av_frame_is_writable(frame))
-+    if (av_frame_is_writable(frame)) {
-+        frame->pkt_pts = avctx->internal->pkt ? avctx->internal->pkt->pts : AV_NOPTS_VALUE;
-+        frame->reordered_opaque = avctx->reordered_opaque;
-         return 0;
-+    }
-     av_frame_move_ref(&tmp, frame);
--- 
-1.8.5.3
-
index 8750655050fe94cff092162635f6e85ce40b30d1..3884487c294cb6e505473341bc37afbfb9ba5027 100644 (file)
@@ -5,7 +5,7 @@ $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,YASM BZIP2 ZLIB FDKAAC))
 endif
 $(eval $(call import.CONTRIB.defs,FFMPEG))
 
-FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v10_alpha2.tar.bz2
+FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v10_beta1.tar.bz2
 
 FFMPEG.CONFIGURE.deps =
 FFMPEG.CONFIGURE.env  =
index 913186cc0c11901e312c4a29e6d4eafb12833907..577c66dada877ad2feb784331891824b7bece4cc 100644 (file)
@@ -62,6 +62,7 @@ hb_audio_resample_t* hb_audio_resample_init(enum AVSampleFormat sample_fmt,
     // set default input characteristics
     resample->in.sample_fmt         = resample->out.sample_fmt;
     resample->in.channel_layout     = resample->out.channel_layout;
+    resample->in.lfe_mix_level      = HB_MIXLEV_ZERO;
     resample->in.center_mix_level   = HB_MIXLEV_DEFAULT;
     resample->in.surround_mix_level = HB_MIXLEV_DEFAULT;
 
@@ -90,10 +91,12 @@ void hb_audio_resample_set_channel_layout(hb_audio_resample_t *resample,
 
 void hb_audio_resample_set_mix_levels(hb_audio_resample_t *resample,
                                       double surround_mix_level,
-                                      double center_mix_level)
+                                      double center_mix_level,
+                                      double lfe_mix_level)
 {
     if (resample != NULL)
     {
+        resample->in.lfe_mix_level      = lfe_mix_level;
         resample->in.center_mix_level   = center_mix_level;
         resample->in.surround_mix_level = surround_mix_level;
     }
@@ -126,6 +129,7 @@ int hb_audio_resample_update(hb_audio_resample_t *resample)
         (resample->resample_needed &&
          (resample->resample.sample_fmt != resample->in.sample_fmt ||
           resample->resample.channel_layout != resample->in.channel_layout ||
+          resample->resample.lfe_mix_level != resample->in.lfe_mix_level ||
           resample->resample.center_mix_level != resample->in.center_mix_level ||
           resample->resample.surround_mix_level != resample->in.surround_mix_level));
 
@@ -159,6 +163,8 @@ int hb_audio_resample_update(hb_audio_resample_t *resample)
                        resample->in.sample_fmt, 0);
         av_opt_set_int(resample->avresample, "in_channel_layout",
                        resample->in.channel_layout, 0);
+        av_opt_set_double(resample->avresample, "lfe_mix_level",
+                          resample->in.lfe_mix_level, 0);
         av_opt_set_double(resample->avresample, "center_mix_level",
                           resample->in.center_mix_level, 0);
         av_opt_set_double(resample->avresample, "surround_mix_level",
@@ -179,6 +185,7 @@ int hb_audio_resample_update(hb_audio_resample_t *resample)
         resample->resample.channel_layout     = resample->in.channel_layout;
         resample->resample.channels           =
             av_get_channel_layout_nb_channels(resample->in.channel_layout);
+        resample->resample.lfe_mix_level      = resample->in.lfe_mix_level;
         resample->resample.center_mix_level   = resample->in.center_mix_level;
         resample->resample.surround_mix_level = resample->in.surround_mix_level;
     }
index 9242d78a52a5ba04fbba1d5c3b44e27e7f1428e3..3b9c646fff9b435801bcbbe3a5e3985ecb493bb9 100644 (file)
@@ -24,6 +24,8 @@
 
 /* Default mix level for center and surround channels */
 #define HB_MIXLEV_DEFAULT ((double)M_SQRT1_2)
+/* Default mix level for LFE channel */
+#define HB_MIXLEV_ZERO    ((double)0.0)
 
 typedef struct
 {
@@ -36,6 +38,7 @@ typedef struct
     struct
     {
         uint64_t channel_layout;
+        double lfe_mix_level;
         double center_mix_level;
         double surround_mix_level;
         enum AVSampleFormat sample_fmt;
@@ -45,6 +48,7 @@ typedef struct
     {
         int channels;
         uint64_t channel_layout;
+        double lfe_mix_level;
         double center_mix_level;
         double surround_mix_level;
         enum AVSampleFormat sample_fmt;
@@ -81,7 +85,8 @@ void                 hb_audio_resample_set_channel_layout(hb_audio_resample_t *r
 
 void                 hb_audio_resample_set_mix_levels(hb_audio_resample_t *resample,
                                                       double surround_mix_level,
-                                                      double center_mix_level);
+                                                      double center_mix_level,
+                                                      double lfe_mix_level);
 
 void                 hb_audio_resample_set_sample_fmt(hb_audio_resample_t *resample,
                                                       enum AVSampleFormat sample_fmt);
index 925e824b22f8e5de99c7614cf539c573e970c9d6..d8bf497c221c45df50dd9e316ac6778f8ca8abc1 100644 (file)
@@ -391,7 +391,8 @@ static hb_buffer_t* Decode(hb_work_object_t *w)
         {
             hb_audio_resample_set_mix_levels(pv->resample,
                                              (double)pv->state->slev,
-                                             (double)pv->state->clev);
+                                             (double)pv->state->clev,
+                                             HB_MIXLEV_ZERO);
         }
         if (hb_audio_resample_update(pv->resample))
         {
index 7409bc8db2d019b7a7ab57ec3cfd646dbe21c004..c158bcf1b3dbf6d5ac275de5e62dcf3b7a49d4f1 100644 (file)
@@ -2176,6 +2176,29 @@ static void decodeAudio(hb_audio_t *audio, hb_work_private_t *pv, uint8_t *data,
             }
             else
             {
+                AVFrameSideData *side_data;
+                if ((side_data =
+                     av_frame_get_side_data(pv->frame,
+                                            AV_FRAME_DATA_DOWNMIX_INFO)) != NULL)
+                {
+                    double surround_mix_level, center_mix_level;
+                    AVDownmixInfo *downmix_info = (AVDownmixInfo*)side_data->data;
+                    if (audio->config.out.mixdown == HB_AMIXDOWN_DOLBY ||
+                        audio->config.out.mixdown == HB_AMIXDOWN_DOLBYPLII)
+                    {
+                        surround_mix_level = downmix_info->surround_mix_level_ltrt;
+                        center_mix_level   = downmix_info->center_mix_level_ltrt;
+                    }
+                    else
+                    {
+                        surround_mix_level = downmix_info->surround_mix_level;
+                        center_mix_level   = downmix_info->center_mix_level;
+                    }
+                    hb_audio_resample_set_mix_levels(pv->resample,
+                                                     surround_mix_level,
+                                                     center_mix_level,
+                                                     downmix_info->lfe_mix_level);
+                }
                 hb_audio_resample_set_channel_layout(pv->resample,
                                                      pv->frame->channel_layout);
                 hb_audio_resample_set_sample_fmt(pv->resample,
index b1379d006e965faf58f814df6a0ca698246d2ab8..218ac34a551ac5bdd3e538bff3a19c19a305a645 100644 (file)
@@ -14,6 +14,7 @@
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "libavutil/avutil.h"
+#include "libavutil/downmix_info.h"
 #include "libswscale/swscale.h"
 #include "libavresample/avresample.h"
 #include "common.h"