Commit 8092f480 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

contrib: ffmpeg: upgrade to FFmpeg 4.4


Co-Authored-By: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8dd0de97
From 5cbf399500744af87ab8f29a70080af2255994da Mon Sep 17 00:00:00 2001
From 833195704700ba3fa326473292e91524964eeeaa Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 3 Oct 2019 14:05:40 +0200
Subject: [PATCH] avcodec/dxva2_hevc: add support for parsing HEVC Range
Subject: [PATCH 1/3] avcodec/dxva2_hevc: add support for parsing HEVC Range
Extension data
---
......@@ -160,5 +160,5 @@ index dbb701fb1c..98b3e74bd7 100644
commit_bitstream_and_slice_buffer);
return ret;
--
2.19.1.windows.1
2.27.0.windows.1
From ef1c4233ee7b694916c5b6059ea3fb57faf7f8ba Mon Sep 17 00:00:00 2001
From 1c727e8cbbd91391c5eb769c525a07ce5e058e20 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Fri, 12 Feb 2021 08:20:56 +0100
Subject: [PATCH 1/2] avcodec/mpeg12dec: don't call hw->end_frame when starting
......@@ -8,19 +8,18 @@ This call is unbalanced with a hwaccel->start_frame. It fixes some crashes
because this call ends up using uninitialized memory. Decoding works as
expected after this patch.
---
libavcodec/mpeg12dec.c | 9 ---------
1 file changed, 9 deletions(-)
libavcodec/mpeg12dec.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 775579f9f0..5dfea63b71 100644
index 94221da2c1..335c3713c2 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1669,15 +1669,6 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
@@ -1667,14 +1667,6 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
return AVERROR_INVALIDDATA;
}
- if (s->avctx->hwaccel &&
- (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
- if (s->avctx->hwaccel) {
- if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
- av_log(avctx, AV_LOG_ERROR,
- "hardware accelerator failed to decode first field\n");
......
From b503a9056d2daf3763b49aab9ba5bebe80b70e16 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 31 May 2021 13:36:39 +0200
Subject: [PATCH] fix mf_utils compilation with mingw64
In mingw64 and Windows Kits the MF_MT_VIDEO_ROTATION is defined if WINVER is at
least 0x0602. Normally WINVER would default to _WIN32_WINNT but here it's not
the case, so just force it manually.
---
libavcodec/mf_utils.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/mf_utils.c b/libavcodec/mf_utils.c
index eeabd0ce0b..9b82dacf41 100644
--- a/libavcodec/mf_utils.c
+++ b/libavcodec/mf_utils.c
@@ -19,7 +19,9 @@
#define COBJMACROS
#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
#undef _WIN32_WINNT
+#undef WINVER
#define _WIN32_WINNT 0x0602
+#define WINVER 0x0602
#endif
#include "mf_utils.h"
--
2.27.0.windows.1
From 664c8dd63b8fc90019e279bc34d3415deb542bcf Mon Sep 17 00:00:00 2001
From 98c122a14739c6153c98472483e56ea2f56a4806 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Tue, 20 Aug 2019 13:10:24 +0200
Subject: [PATCH 2/3] avcodec/hevcdec: allow HEVC 444 8/10/12 bits decoding
......@@ -10,10 +10,10 @@ And 4:2:0 12 bits as well.
1 file changed, 14 insertions(+)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 8f1c162ace..04496a002b 100644
index 2231aed259..d400eff338 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -420,6 +420,13 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
@@ -442,6 +442,13 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
#endif
break;
case AV_PIX_FMT_YUV444P:
......@@ -27,7 +27,7 @@ index 8f1c162ace..04496a002b 100644
#if CONFIG_HEVC_VDPAU_HWACCEL
*fmt++ = AV_PIX_FMT_VDPAU;
#endif
@@ -430,6 +437,13 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
@@ -458,6 +465,13 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
case AV_PIX_FMT_YUV420P12:
case AV_PIX_FMT_YUV444P10:
case AV_PIX_FMT_YUV444P12:
......@@ -38,9 +38,9 @@ index 8f1c162ace..04496a002b 100644
+ *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
+ *fmt++ = AV_PIX_FMT_D3D11;
+#endif
#if CONFIG_HEVC_NVDEC_HWACCEL
*fmt++ = AV_PIX_FMT_CUDA;
#if CONFIG_HEVC_VDPAU_HWACCEL
*fmt++ = AV_PIX_FMT_VDPAU;
#endif
--
2.19.1.windows.1
2.27.0.windows.1
From e2cfacf5501fbe5d6a56de56f4f5e4f47f6ad484 Mon Sep 17 00:00:00 2001
From 57c0b0ffa1508f6400ea034d6c0403e686794fdf Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Fri, 12 Feb 2021 11:10:03 +0100
Subject: [PATCH 2/2] avcodec/mpeg12dec: don't end a slice without first_slice
......@@ -14,10 +14,10 @@ for this check to work.
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 5dfea63b71..2689446cfd 100644
index 335c3713c2..42c580b8a5 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2476,13 +2476,19 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
@@ -2484,13 +2484,19 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
s2->er.error_count += s2->thread_context[i]->er.error_count;
}
......@@ -26,7 +26,7 @@ index 5dfea63b71..2689446cfd 100644
- return ret;
- else if (ret) {
- // FIXME: merge with the stuff in mpeg_decode_slice
- if (s2->last_picture_ptr || s2->low_delay)
- if (s2->last_picture_ptr || s2->low_delay || s2->pict_type == AV_PICTURE_TYPE_B)
- *got_output = 1;
+ if (s->first_slice) // not started yet. don't end it
+ ret = 0;
......@@ -36,7 +36,7 @@ index 5dfea63b71..2689446cfd 100644
+ return ret;
+ else if (ret) {
+ // FIXME: merge with the stuff in mpeg_decode_slice
+ if (s2->last_picture_ptr || s2->low_delay)
+ if (s2->last_picture_ptr || s2->low_delay || s2->pict_type == AV_PICTURE_TYPE_B)
+ *got_output = 1;
+ }
+ // slice ended, don't end it again later
......
From b95fd27cf95683b00d1612b62c0c5a5104a7ba01 Mon Sep 17 00:00:00 2001
From c37fc0d2276dc00cbdffa81f66c8c8805c742bd1 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Fri, 4 Oct 2019 12:42:11 +0200
Subject: [PATCH 3/3] avcodec/hevcdec: allow HEVC 422 10/12 bits decoding with
DXVA2/D3D11VA
---
libavcodec/hevcdec.c | 10 ++++++++++
1 file changed, 10 insertions(+)
libavcodec/hevcdec.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 04496a002b..4c1650c416 100644
index d400eff338..46712a9385 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -432,6 +432,16 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
@@ -457,9 +457,29 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
#endif
#if CONFIG_HEVC_NVDEC_HWACCEL
*fmt++ = AV_PIX_FMT_CUDA;
break;
case AV_PIX_FMT_YUV422P:
+#if CONFIG_HEVC_VAAPI_HWACCEL
+ *fmt++ = AV_PIX_FMT_VAAPI;
+#endif
+ break;
case AV_PIX_FMT_YUV422P10LE:
#if CONFIG_HEVC_VAAPI_HWACCEL
*fmt++ = AV_PIX_FMT_VAAPI;
+#endif
+#if CONFIG_HEVC_DXVA2_HWACCEL
+ *fmt++ = AV_PIX_FMT_DXVA2_VLD;
+#endif
+#if CONFIG_HEVC_D3D11VA_HWACCEL
+ *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
+ *fmt++ = AV_PIX_FMT_D3D11;
+#endif
+ break;
+ case AV_PIX_FMT_YUV422P10:
+ case AV_PIX_FMT_YUV422P12:
+ case AV_PIX_FMT_YUV422P12LE:
+#if CONFIG_HEVC_DXVA2_HWACCEL
+ *fmt++ = AV_PIX_FMT_DXVA2_VLD;
+#endif
......@@ -30,5 +43,5 @@ index 04496a002b..4c1650c416 100644
break;
case AV_PIX_FMT_YUV420P12:
--
2.19.1.windows.1
2.27.0.windows.1
......@@ -5,12 +5,14 @@
#USE_FFMPEG ?= 1
ifndef USE_LIBAV
FFMPEG_HASH=1e35519fe0b8bbad84641e83d49138152720b544
FFMPEG_HASH=dc91b913b6260e85e1304c74ff7bb3c22a8c9fb1
FFMPEG_BRANCH=release/4.4
FFMPEG_GITURL := http://git.videolan.org/git/ffmpeg.git
FFMPEG_LAVC_MIN := 57.37.100
USE_FFMPEG := 1
else
FFMPEG_HASH=e5afa1b556542fd7a52a0a9b409c80f2e6e1e9bb
FFMPEG_BRANCH=
FFMPEG_GITURL := git://git.libav.org/libav.git
FFMPEG_LAVC_MIN := 57.16.0
endif
......@@ -222,7 +224,7 @@ endif
FFMPEGCONF += --nm="$(NM)" --ar="$(AR)" --ranlib="$(RANLIB)"
$(TARBALLS)/ffmpeg-$(FFMPEG_BASENAME).tar.xz:
$(call download_git,$(FFMPEG_GITURL),,$(FFMPEG_HASH))
$(call download_git,$(FFMPEG_GITURL),$(FFMPEG_BRANCH),$(FFMPEG_HASH))
.sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_BASENAME).tar.xz
$(call check_githash,$(FFMPEG_HASH))
......@@ -239,6 +241,7 @@ ifdef USE_FFMPEG
$(APPLY) $(SRC)/ffmpeg/0003-avcodec-hevcdec-allow-HEVC-422-10-12-bits-decoding-w.patch
$(APPLY) $(SRC)/ffmpeg/0001-avcodec-mpeg12dec-don-t-call-hw-end_frame-when-start.patch
$(APPLY) $(SRC)/ffmpeg/0002-avcodec-mpeg12dec-don-t-end-a-slice-without-first_sl.patch
$(APPLY) $(SRC)/ffmpeg/0001-fix-mf_utils-compilation-with-mingw64.patch
endif
ifdef USE_LIBAV
$(APPLY) $(SRC)/ffmpeg/libav_gsm.patch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment