]> granicus.if.org Git - handbrake/commitdiff
contrib: Update to FFmpeg 4.1.0.
authorBradley Sepos <bradley@bradleysepos.com>
Tue, 20 Nov 2018 12:25:36 +0000 (07:25 -0500)
committerBradley Sepos <bradley@bradleysepos.com>
Mon, 26 Nov 2018 22:46:43 +0000 (17:46 -0500)
Includes additional patches applied to the release branch shortly after tagging, including a patch that fixes #1595.

contrib/ffmpeg/A03-mp4-pcm.patch [deleted file]
contrib/ffmpeg/A05-hevc-nonref.patch [new file with mode: 0644]
contrib/ffmpeg/A06-cbs-av1-field-storage.patch [new file with mode: 0644]
contrib/ffmpeg/A07-cbs-av1-sint-parse.patch [new file with mode: 0644]
contrib/ffmpeg/A08-mpeg-er-clear-chroma.patch [new file with mode: 0644]
contrib/ffmpeg/A09-mov-eac3.patch [new file with mode: 0644]
contrib/ffmpeg/module.defs

diff --git a/contrib/ffmpeg/A03-mp4-pcm.patch b/contrib/ffmpeg/A03-mp4-pcm.patch
deleted file mode 100644 (file)
index d9f4932..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-From d2047c14c0789ce3059b840472fb96fd8bd854a9 Mon Sep 17 00:00:00 2001
-From: Justin Ruggles <justin.ruggles@gmail.com>
-Date: Wed, 5 Sep 2018 17:54:57 -0400
-Subject: [PATCH 1/2] Use QT format for audio sample descriptors depending on
- stsd version.
-
-ISOBMFF does not allow AudioSampleEntryV1 in stsd version 0, so
-assume the descriptor format is QTFF SoundDescriptionV1. ISOBMFF does
-not define a version 2.
-
-This fixes audio decoding for some MP4 files generated with Apple
-tools. The additional fields present in SoundDescriptionV1/V2 need to
-be read in order to correctly read additional boxes that contain
-information required for decoding the stream.
-
-Fixes #7376.
-
-Also see: https://github.com/HandBrake/HandBrake/issues/1555
-
-Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
----
- libavformat/isom.h | 1 +
- libavformat/mov.c  | 6 +++---
- 2 files changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/libavformat/isom.h b/libavformat/isom.h
-index f3a7a8633d..e629663949 100644
---- a/libavformat/isom.h
-+++ b/libavformat/isom.h
-@@ -218,6 +218,7 @@ typedef struct MOVStreamContext {
-     int *extradata_size;
-     int last_stsd_index;
-     int stsd_count;
-+    int stsd_version;
-     int32_t *display_matrix;
-     AVStereo3D *stereo3d;
-diff --git a/libavformat/mov.c b/libavformat/mov.c
-index 02c8ec66ed..ec57a05803 100644
---- a/libavformat/mov.c
-+++ b/libavformat/mov.c
-@@ -2122,8 +2122,8 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
-     // Read QT version 1 fields. In version 0 these do not exist.
-     av_log(c->fc, AV_LOG_TRACE, "version =%d, isom =%d\n", version, c->isom);
-     if (!c->isom ||
--        (compatible_brands && strstr(compatible_brands->value, "qt  "))) {
--
-+        (compatible_brands && strstr(compatible_brands->value, "qt  ")) ||
-+        (sc->stsd_version == 0 && version > 0)) {
-         if (version == 1) {
-             sc->samples_per_frame = avio_rb32(pb);
-             avio_rb32(pb); /* bytes per packet */
-@@ -2554,7 +2554,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
-     st = c->fc->streams[c->fc->nb_streams - 1];
-     sc = st->priv_data;
--    avio_r8(pb); /* version */
-+    sc->stsd_version = avio_r8(pb);
-     avio_rb24(pb); /* flags */
-     entries = avio_rb32(pb);
--- 
-2.17.1
-
diff --git a/contrib/ffmpeg/A05-hevc-nonref.patch b/contrib/ffmpeg/A05-hevc-nonref.patch
new file mode 100644 (file)
index 0000000..8f1c7f2
--- /dev/null
@@ -0,0 +1,35 @@
+From 11dff170ef79d26d1de2bcd13b603a6c4c5c9815 Mon Sep 17 00:00:00 2001
+From: Mark Wu <wfwf1997@gmail.com>
+Date: Tue, 23 Oct 2018 12:49:08 +0800
+Subject: [PATCH] avcodec/hevcdec: fix non-ref frame judgement
+
+After inspecting the source code of x265, mpv and ffmpeg, I've found that
+ffmpeg mistakenly regards EVC_NAL_BLA_N_LP and HEVC_NAL_IDR_N_LP as non-
+reference frames, which are acutally reference frames according to the
+specification in x265, and drops them.
+
+This patch should address the problem. I have tested it with mpv.
+
+Signed-off-by: Mark Wu <wfwf1997@gmail.com>
+Signed-off-by: James Almer <jamrial@gmail.com>
+(cherry picked from commit 10bc4c3a7df7bb26303067b97311b7eeedfd453e)
+---
+ libavcodec/hevcdec.h | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
+index f0f588f..dd951aa 100644
+--- a/libavcodec/hevcdec.h
++++ b/libavcodec/hevcdec.h
+@@ -559,8 +559,6 @@ static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
+     case HEVC_NAL_VCL_N10:
+     case HEVC_NAL_VCL_N12:
+     case HEVC_NAL_VCL_N14:
+-    case HEVC_NAL_BLA_N_LP:
+-    case HEVC_NAL_IDR_N_LP:
+         return 1;
+         break;
+     default: break;
+-- 
+1.9.1
+
diff --git a/contrib/ffmpeg/A06-cbs-av1-field-storage.patch b/contrib/ffmpeg/A06-cbs-av1-field-storage.patch
new file mode 100644 (file)
index 0000000..55503ff
--- /dev/null
@@ -0,0 +1,31 @@
+From 49bc641e89f7c89648f28feafa2daa3756ba9c7d Mon Sep 17 00:00:00 2001
+From: James Almer <jamrial@gmail.com>
+Date: Sat, 10 Nov 2018 22:51:18 -0300
+Subject: [PATCH] avcodec/cbs_av1: fix storage size for segmentation_params
+ feature_value fields
+
+The valid range is -255 to 255.
+
+Reviewed-by: Mark Thompson <sw@jkqxz.net>
+Signed-off-by: James Almer <jamrial@gmail.com>
+(cherry picked from commit 79831f4531d98c3c1eab96c10f1135d08abef5f3)
+---
+ libavcodec/cbs_av1.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h
+index f662265..84622ed 100644
+--- a/libavcodec/cbs_av1.h
++++ b/libavcodec/cbs_av1.h
+@@ -210,7 +210,7 @@ typedef struct AV1RawFrameHeader {
+     uint8_t segmentation_temporal_update;
+     uint8_t segmentation_update_data;
+     uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
+-    uint8_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
++    int16_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
+     uint8_t delta_q_present;
+     uint8_t delta_q_res;
+-- 
+1.9.1
+
diff --git a/contrib/ffmpeg/A07-cbs-av1-sint-parse.patch b/contrib/ffmpeg/A07-cbs-av1-sint-parse.patch
new file mode 100644 (file)
index 0000000..ce09f25
--- /dev/null
@@ -0,0 +1,89 @@
+From a9e9303f26597b2a166374cd46b00adc0401e634 Mon Sep 17 00:00:00 2001
+From: James Almer <jamrial@gmail.com>
+Date: Sat, 10 Nov 2018 22:52:12 -0300
+Subject: [PATCH] avcodec/cbs_av1: fix parsing signed integer values
+
+Reviewed-by: Mark Thompson <sw@jkqxz.net>
+Signed-off-by: James Almer <jamrial@gmail.com>
+(cherry picked from commit f0f2832a5ce93bad9b1d29f99df6bda2380fc41c)
+---
+ libavcodec/cbs_av1.c | 30 +++++++++---------------------
+ 1 file changed, 9 insertions(+), 21 deletions(-)
+
+diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
+index ff32a6f..ed5211b 100644
+--- a/libavcodec/cbs_av1.c
++++ b/libavcodec/cbs_av1.c
+@@ -189,30 +189,26 @@ static int cbs_av1_read_su(CodedBitstreamContext *ctx, GetBitContext *gbc,
+                            int width, const char *name,
+                            const int *subscripts, int32_t *write_to)
+ {
+-    uint32_t magnitude;
+-    int position, sign;
++    int position;
+     int32_t value;
+     if (ctx->trace_enable)
+         position = get_bits_count(gbc);
+-    if (get_bits_left(gbc) < width + 1) {
++    if (get_bits_left(gbc) < width) {
+         av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at "
+                "%s: bitstream ended.\n", name);
+         return AVERROR_INVALIDDATA;
+     }
+-    magnitude = get_bits(gbc, width);
+-    sign      = get_bits1(gbc);
+-    value     = sign ? -(int32_t)magnitude : magnitude;
++    value = get_sbits(gbc, width);
+     if (ctx->trace_enable) {
+         char bits[33];
+         int i;
+         for (i = 0; i < width; i++)
+-            bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
+-        bits[i] = sign ? '1' : '0';
+-        bits[i + 1] = 0;
++            bits[i] = value & (1 << (width - i - 1)) ? '1' : '0';
++        bits[i] = 0;
+         ff_cbs_trace_syntax_element(ctx, position,
+                                     name, subscripts, bits, value);
+@@ -226,29 +222,21 @@ static int cbs_av1_write_su(CodedBitstreamContext *ctx, PutBitContext *pbc,
+                             int width, const char *name,
+                             const int *subscripts, int32_t value)
+ {
+-    uint32_t magnitude;
+-    int sign;
+-
+-    if (put_bits_left(pbc) < width + 1)
++    if (put_bits_left(pbc) < width)
+         return AVERROR(ENOSPC);
+-    sign      = value < 0;
+-    magnitude = sign ? -value : value;
+-
+     if (ctx->trace_enable) {
+         char bits[33];
+         int i;
+         for (i = 0; i < width; i++)
+-            bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
+-        bits[i] = sign ? '1' : '0';
+-        bits[i + 1] = 0;
++            bits[i] = value & (1 << (width - i - 1)) ? '1' : '0';
++        bits[i] = 0;
+         ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc),
+                                     name, subscripts, bits, value);
+     }
+-    put_bits(pbc, width, magnitude);
+-    put_bits(pbc, 1, sign);
++    put_sbits(pbc, width, value);
+     return 0;
+ }
+-- 
+1.9.1
+
diff --git a/contrib/ffmpeg/A08-mpeg-er-clear-chroma.patch b/contrib/ffmpeg/A08-mpeg-er-clear-chroma.patch
new file mode 100644 (file)
index 0000000..8850421
--- /dev/null
@@ -0,0 +1,29 @@
+From d4c5f515f09076635bf5e1591e5ff9d21ac13572 Mon Sep 17 00:00:00 2001
+From: Marton Balint <cus@passwd.hu>
+Date: Sat, 17 Nov 2018 23:26:24 +0100
+Subject: [PATCH] avcodec/mpeg_er: fix clearing chroma blocks for 422 and 444
+
+Fixes ticket #7494.
+
+Signed-off-by: Marton Balint <cus@passwd.hu>
+(cherry picked from commit e3a96309826dd0ea33db0300f7c75414fdbea0a4)
+---
+ libavcodec/mpeg_er.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c
+index ada1a16..f54cb85 100644
+--- a/libavcodec/mpeg_er.c
++++ b/libavcodec/mpeg_er.c
+@@ -78,6 +78,8 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
+     ff_update_block_index(s);
+     s->bdsp.clear_blocks(s->block[0]);
++    if (!s->chroma_y_shift)
++        s->bdsp.clear_blocks(s->block[6]);
+     s->dest[0] = s->current_picture.f->data[0] +
+                  s->mb_y * 16 * s->linesize +
+-- 
+1.9.1
+
diff --git a/contrib/ffmpeg/A09-mov-eac3.patch b/contrib/ffmpeg/A09-mov-eac3.patch
new file mode 100644 (file)
index 0000000..adf1e5f
--- /dev/null
@@ -0,0 +1,75 @@
+From fcffed470a5236bc1799bc3022d588704d9ae5ef Mon Sep 17 00:00:00 2001
+From: Paul B Mahol <onemda@gmail.com>
+Date: Wed, 21 Nov 2018 11:45:02 +0100
+Subject: [PATCH] avformat/movenc: fix size calculation in mov_write_eac3_tag()
+
+Otherwise it would assert when flushing bits.
+
+(cherry picked from commit 027f032bbce9bdf7bbec40665b98590cade33416)
+---
+ libavformat/movenc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavformat/movenc.c b/libavformat/movenc.c
+index 33978ee..bee8e89 100644
+--- a/libavformat/movenc.c
++++ b/libavformat/movenc.c
+@@ -541,7 +541,7 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
+         return AVERROR(EINVAL);
+     info = track->eac3_priv;
+-    size = 2 + 4 * (info->num_ind_sub + 1);
++    size = 2 + ((34 * (info->num_ind_sub + 1) + 7) >> 3);
+     buf = av_malloc(size);
+     if (!buf) {
+         size = AVERROR(ENOMEM);
+-- 
+1.9.1
+
+From 59e30c05d74e59d28f2ec4ffd4dbf1822f921f06 Mon Sep 17 00:00:00 2001
+From: Paul B Mahol <onemda@gmail.com>
+Date: Thu, 22 Nov 2018 21:28:59 +0100
+Subject: [PATCH] avformat/movenc: get number of written bytes from bitstream
+ writer
+
+Update fate test.
+
+(cherry picked from commit 97d1ee437bbf67d7e3897bc73df4f7d9771ac309)
+---
+ libavformat/movenc.c         | 2 +-
+ tests/ref/fate/copy-trac3074 | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libavformat/movenc.c b/libavformat/movenc.c
+index bee8e89..6dab519 100644
+--- a/libavformat/movenc.c
++++ b/libavformat/movenc.c
+@@ -563,12 +563,12 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
+         put_bits(&pbc, 4, info->substream[i].num_dep_sub);
+         if (!info->substream[i].num_dep_sub) {
+             put_bits(&pbc, 1, 0); /* reserved */
+-            size--;
+         } else {
+             put_bits(&pbc, 9, info->substream[i].chan_loc);
+         }
+     }
+     flush_put_bits(&pbc);
++    size = put_bits_count(&pbc) >> 3;
+     avio_wb32(pb, size + 8);
+     ffio_wfourcc(pb, "dec3");
+diff --git a/tests/ref/fate/copy-trac3074 b/tests/ref/fate/copy-trac3074
+index 5ce5694..ff66900 100644
+--- a/tests/ref/fate/copy-trac3074
++++ b/tests/ref/fate/copy-trac3074
+@@ -1,5 +1,5 @@
+-39aef1afff761d673fd1be07182941d1 *tests/data/fate/copy-trac3074.mp4
+-333991 tests/data/fate/copy-trac3074.mp4
++f92a201033712bda262f1e071e25544a *tests/data/fate/copy-trac3074.mp4
++333992 tests/data/fate/copy-trac3074.mp4
+ #tb 0: 1/48000
+ #media_type 0: audio
+ #codec_id 0: eac3
+-- 
+1.9.1
+
index d2b41be0cbd9e1f15dfa76c8230ea73509ee7afe..0065859c84b483607ce721806a16475a1b193b50 100644 (file)
@@ -12,9 +12,9 @@ endif
 $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,$(__deps__)))
 $(eval $(call import.CONTRIB.defs,FFMPEG))
 
-FFMPEG.FETCH.url  = https://download.handbrake.fr/handbrake/contrib/ffmpeg-4.0.1.tar.bz2
-FFMPEG.FETCH.url += https://www.ffmpeg.org/releases/ffmpeg-4.0.1.tar.bz2
-FFMPEG.FETCH.sha256 = 7ee591b1e7fb66f055fa514fbd5d98e092ddb3dbe37d2e50ea5c16ab51c21670
+FFMPEG.FETCH.url  = https://download.handbrake.fr/handbrake/contrib/ffmpeg-4.1.tar.bz2
+FFMPEG.FETCH.url += https://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2
+FFMPEG.FETCH.sha256 = b684fb43244a5c4caae652af9022ed5d85ce15210835bce054a33fb26033a1a5
 
 FFMPEG.CONFIGURE.deps  =
 FFMPEG.CONFIGURE.host  =