diff options
-rw-r--r-- | contrib/ffmpeg/A01-vc1-numref.patch | 39 | ||||
-rw-r--r-- | contrib/ffmpeg/A02-ac3dec-asymmetric-drc.patch | 44 | ||||
-rw-r--r-- | contrib/ffmpeg/A03-reget-buffer-pkt-pts.patch | 30 | ||||
-rw-r--r-- | contrib/ffmpeg/module.defs | 2 | ||||
-rw-r--r-- | libhb/audio_resample.c | 9 | ||||
-rw-r--r-- | libhb/audio_resample.h | 7 | ||||
-rw-r--r-- | libhb/deca52.c | 3 | ||||
-rw-r--r-- | libhb/decavcodec.c | 23 | ||||
-rw-r--r-- | libhb/hbffmpeg.h | 1 |
9 files changed, 41 insertions, 117 deletions
diff --git a/contrib/ffmpeg/A01-vc1-numref.patch b/contrib/ffmpeg/A01-vc1-numref.patch deleted file mode 100644 index 29e84e5a6..000000000 --- a/contrib/ffmpeg/A01-vc1-numref.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 1ad55faa4d730f437bce612531132f00556d29fb Mon Sep 17 00:00:00 2001 -From: Michael Niedermayer <[email protected]> -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: [email protected] -Signed-off-by: Tim Walker <[email protected]> ---- - 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 index b87de1602..000000000 --- a/contrib/ffmpeg/A02-ac3dec-asymmetric-drc.patch +++ /dev/null @@ -1,44 +0,0 @@ -From e275318cecee53cf8ce13e4ab41df91c8c7fdcd4 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -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 index c64c39e40..000000000 --- a/contrib/ffmpeg/A03-reget-buffer-pkt-pts.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 091f3393401f7eb83fef4fb9cbb2e5ed2837b623 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -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 - diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 875065505..3884487c2 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -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 = diff --git a/libhb/audio_resample.c b/libhb/audio_resample.c index 913186cc0..577c66dad 100644 --- a/libhb/audio_resample.c +++ b/libhb/audio_resample.c @@ -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; } diff --git a/libhb/audio_resample.h b/libhb/audio_resample.h index 9242d78a5..3b9c646ff 100644 --- a/libhb/audio_resample.h +++ b/libhb/audio_resample.h @@ -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); diff --git a/libhb/deca52.c b/libhb/deca52.c index 925e824b2..d8bf497c2 100644 --- a/libhb/deca52.c +++ b/libhb/deca52.c @@ -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)) { diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 7409bc8db..c158bcf1b 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -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, diff --git a/libhb/hbffmpeg.h b/libhb/hbffmpeg.h index b1379d006..218ac34a5 100644 --- a/libhb/hbffmpeg.h +++ b/libhb/hbffmpeg.h @@ -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" |