Skip to content

Commit

Permalink
build(ffmpeg): update to FFmpeg 7.1 (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman authored Oct 5, 2024
1 parent b2459cc commit ff50cf8
Show file tree
Hide file tree
Showing 14 changed files with 366 additions and 620 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build-ffmpeg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,12 @@ jobs:
- name: patch
working-directory: ffmpeg_sources/ffmpeg
run: |
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/01-amf-colorspace-v3.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/01-amf-colorspace.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/02-idr-on-amf.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/03-amfenc-disable-buffering.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/04-mfenc-lowlatency.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/05-amfenc-new-av1-usages.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/06-vaapi-customized-surface-alignment.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/07-amfenc-query-timeout.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/05-vaapi-customized-surface-alignment.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/06-amfenc-query-timeout.patch
- name: Setup cross compilation
id: cross
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[submodule "ffmpeg_sources/ffmpeg"]
path = ffmpeg_sources/ffmpeg
url = https://github.com/FFmpeg/FFmpeg
branch = release/6.1
branch = release/7.1
[submodule "ffmpeg_sources/SVT-AV1"]
path = ffmpeg_sources/SVT-AV1
url = https://gitlab.com/AOMediaCodec/SVT-AV1.git
Expand Down
8 changes: 6 additions & 2 deletions cmake/ffmpeg_cbs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ configure_file(${AVCODEC_GENERATED_SRC_PATH}/cbs_h265.h ${CBS_INCLUDE_PATH}/cbs_
configure_file(${AVCODEC_GENERATED_SRC_PATH}/cbs_jpeg.h ${CBS_INCLUDE_PATH}/cbs_jpeg.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/cbs_mpeg2.h ${CBS_INCLUDE_PATH}/cbs_mpeg2.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/cbs_sei.h ${CBS_INCLUDE_PATH}/cbs_sei.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/cbs_vp8.h ${CBS_INCLUDE_PATH}/cbs_vp8.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/cbs_vp9.h ${CBS_INCLUDE_PATH}/cbs_vp9.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/codec_desc.h ${CBS_INCLUDE_PATH}/codec_desc.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/codec_id.h ${CBS_INCLUDE_PATH}/codec_id.h COPYONLY)
Expand All @@ -87,7 +88,7 @@ configure_file(${AVCODEC_GENERATED_SRC_PATH}/get_bits.h ${CBS_INCLUDE_PATH}/get_
configure_file(${AVCODEC_GENERATED_SRC_PATH}/h264_levels.h ${CBS_INCLUDE_PATH}/h264_levels.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/h2645_parse.h ${CBS_INCLUDE_PATH}/h2645_parse.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/h264.h ${CBS_INCLUDE_PATH}/h264.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/hevc.h ${CBS_INCLUDE_PATH}/hevc.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/hevc/hevc.h ${CBS_INCLUDE_PATH}/hevc/hevc.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/mathops.h ${CBS_INCLUDE_PATH}/mathops.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/packet.h ${CBS_INCLUDE_PATH}/packet.h COPYONLY)
configure_file(${AVCODEC_GENERATED_SRC_PATH}/sei.h ${CBS_INCLUDE_PATH}/sei.h COPYONLY)
Expand All @@ -112,6 +113,7 @@ set(CBS_SOURCE_FILES
${CBS_INCLUDE_PATH}/cbs_jpeg.h
${CBS_INCLUDE_PATH}/cbs_mpeg2.h
${CBS_INCLUDE_PATH}/cbs_sei.h
${CBS_INCLUDE_PATH}/cbs_vp8.h
${CBS_INCLUDE_PATH}/cbs_vp9.h
${CBS_INCLUDE_PATH}/codec_desc.h
${CBS_INCLUDE_PATH}/codec_id.h
Expand All @@ -121,7 +123,7 @@ set(CBS_SOURCE_FILES
${CBS_INCLUDE_PATH}/h264_levels.h
${CBS_INCLUDE_PATH}/h2645_parse.h
${CBS_INCLUDE_PATH}/h264.h
${CBS_INCLUDE_PATH}/hevc.h
${CBS_INCLUDE_PATH}/hevc/hevc.h
${CBS_INCLUDE_PATH}/mathops.h
${CBS_INCLUDE_PATH}/packet.h
${CBS_INCLUDE_PATH}/sei.h
Expand All @@ -133,12 +135,14 @@ set(CBS_SOURCE_FILES
${AVCODEC_GENERATED_SRC_PATH}/cbs.c
${AVCODEC_GENERATED_SRC_PATH}/cbs_h2645.c
${AVCODEC_GENERATED_SRC_PATH}/cbs_av1.c
${AVCODEC_GENERATED_SRC_PATH}/cbs_vp8.c
${AVCODEC_GENERATED_SRC_PATH}/cbs_vp9.c
${AVCODEC_GENERATED_SRC_PATH}/cbs_mpeg2.c
${AVCODEC_GENERATED_SRC_PATH}/cbs_jpeg.c
${AVCODEC_GENERATED_SRC_PATH}/cbs_sei.c
${AVCODEC_GENERATED_SRC_PATH}/h264_levels.c
${AVCODEC_GENERATED_SRC_PATH}/h2645_parse.c
${AVCODEC_GENERATED_SRC_PATH}/vp8data.c
${FFMPEG_GENERATED_SRC_PATH}/libavutil/intmath.c)

# conditional headers based on architecture
Expand Down
16 changes: 8 additions & 8 deletions ffmpeg_patches/cbs/01-explicit-intmath.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Explicitly imports intmath as our subset of sources doesn't have it included

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 1229480567..600a24c47a 100644
index 458381f038..c4a6561706 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -17,6 +17,7 @@
Expand All @@ -13,19 +13,19 @@ index 1229480567..600a24c47a 100644
#include "libavutil/pixfmt.h"

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 12e38c80b5..03970520e7 100644
index 2de74691cb..e3a5e5b5df 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -18,6 +18,7 @@

@@ -19,6 +19,7 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
+#include "libavutil/intmath.h"

#include "bytestream.h"
#include "cbs.h"
diff --git a/libavcodec/cbs_sei_syntax_template.c b/libavcodec/cbs_sei_syntax_template.c
index 0ef7b42ed9..b6242367c8 100644
index 0205bb47aa..7d4d0fd14d 100644
--- a/libavcodec/cbs_sei_syntax_template.c
+++ b/libavcodec/cbs_sei_syntax_template.c
@@ -16,6 +16,8 @@
Expand All @@ -34,6 +34,6 @@ index 0ef7b42ed9..b6242367c8 100644

+#include "libavutil/intmath.h"
+
static int FUNC(filler_payload)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawFillerPayload *current, SEIMessageState *state)
SEI_FUNC(filler_payload, (CodedBitstreamContext *ctx, RWContext *rw,
SEIRawFillerPayload *current,
SEIMessageState *state))
34 changes: 17 additions & 17 deletions ffmpeg_patches/cbs/02-include-cbs-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,9 @@ index dc57c5571c..972fcb101f 100644
+#include "cbs/config.h"
#include "libavutil/common.h"

#if HAVE_INLINE_ASM
diff --git a/libavcodec/avr32/mathops.h b/libavcodec/avr32/mathops.h
index 85f42b594d..26df237710 100644
--- a/libavcodec/avr32/mathops.h
+++ b/libavcodec/avr32/mathops.h
@@ -23,7 +23,7 @@
#define AVCODEC_AVR32_MATHOPS_H

#include <stdint.h>
-#include "config.h"
+#include "cbs/config.h"
#include "libavutil/common.h"

#if HAVE_INLINE_ASM
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index a1dc323304..85e8872aef 100644
index 84a924f31b..b21a1852b1 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -26,7 +26,7 @@
Expand Down Expand Up @@ -66,7 +53,7 @@ index dbd714fcd4..3bdea7cd8f 100644

#if HAVE_PPC4XX
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index 6298f5ed19..6488b39a45 100644
index ca7e2dffc1..f5cf8e1d70 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -22,7 +22,7 @@
Expand All @@ -92,7 +79,7 @@ index f19b21e98d..96b4ad4fe3 100644

#if HAVE_INLINE_ASM
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index c54d23b7bf..c5ec231eb9 100644
index 52e11a8d5f..ae69932edf 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -23,7 +23,7 @@
Expand All @@ -104,6 +91,19 @@ index c54d23b7bf..c5ec231eb9 100644
#include "attributes.h"

#if ARCH_ARM
diff --git a/libavutil/riscv/intmath.h b/libavutil/riscv/intmath.h
index a09248f903..a93c646594 100644
--- a/libavutil/riscv/intmath.h
+++ b/libavutil/riscv/intmath.h
@@ -24,7 +24,7 @@
#include <stdint.h>
#include <math.h>

-#include "config.h"
+#include "cbs/config.h"
#include "libavutil/attributes.h"
#include "libavutil/riscv/cpu.h"

diff --git a/libavutil/x86/asm.h b/libavutil/x86/asm.h
index 9bff42d628..6977f019bc 100644
--- a/libavutil/x86/asm.h
Expand All @@ -118,7 +118,7 @@ index 9bff42d628..6977f019bc 100644
typedef struct xmm_reg { uint64_t a, b; } xmm_reg;
typedef struct ymm_reg { uint64_t a, b, c, d; } ymm_reg;
diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index 8a6b5ae261..e8a5b5eeee 100644
index 4893a1f1b4..ac259e6335 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -30,7 +30,7 @@
Expand Down
14 changes: 7 additions & 7 deletions ffmpeg_patches/cbs/03-remove-register.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Register storage specifier is an error for modern compiler and generally ignored anyway.

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 65dc080ddb..7cf7650efe 100644
index fe2f6378b4..477bd11746 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -281,8 +281,8 @@ static inline void skip_bits_long(GetBitContext *s, int n)
@@ -291,8 +291,8 @@ static inline void skip_bits_long(GetBitContext *s, int n)
*/
static inline int get_xbits(GetBitContext *s, int n)
{
Expand All @@ -15,7 +15,7 @@ index 65dc080ddb..7cf7650efe 100644
OPEN_READER(re, s);
av_assert2(n>0 && n<=25);
UPDATE_CACHE(re, s);
@@ -295,8 +295,8 @@ static inline int get_xbits(GetBitContext *s, int n)
@@ -305,8 +305,8 @@ static inline int get_xbits(GetBitContext *s, int n)

static inline int get_xbits_le(GetBitContext *s, int n)
{
Expand All @@ -26,7 +26,7 @@ index 65dc080ddb..7cf7650efe 100644
OPEN_READER(re, s);
av_assert2(n>0 && n<=25);
UPDATE_CACHE_LE(re, s);
@@ -309,7 +309,7 @@ static inline int get_xbits_le(GetBitContext *s, int n)
@@ -319,7 +319,7 @@ static inline int get_xbits_le(GetBitContext *s, int n)

static inline int get_sbits(GetBitContext *s, int n)
{
Expand All @@ -35,7 +35,7 @@ index 65dc080ddb..7cf7650efe 100644
OPEN_READER(re, s);
av_assert2(n>0 && n<=25);
UPDATE_CACHE(re, s);
@@ -324,7 +324,7 @@ static inline int get_sbits(GetBitContext *s, int n)
@@ -334,7 +334,7 @@ static inline int get_sbits(GetBitContext *s, int n)
*/
static inline unsigned int get_bits(GetBitContext *s, int n)
{
Expand All @@ -44,7 +44,7 @@ index 65dc080ddb..7cf7650efe 100644
OPEN_READER(re, s);
av_assert2(n>0 && n<=25);
UPDATE_CACHE(re, s);
@@ -345,7 +345,7 @@ static av_always_inline int get_bitsz(GetBitContext *s, int n)
@@ -355,7 +355,7 @@ static av_always_inline int get_bitsz(GetBitContext *s, int n)

static inline unsigned int get_bits_le(GetBitContext *s, int n)
{
Expand All @@ -53,7 +53,7 @@ index 65dc080ddb..7cf7650efe 100644
OPEN_READER(re, s);
av_assert2(n>0 && n<=25);
UPDATE_CACHE_LE(re, s);
@@ -360,7 +360,7 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n)
@@ -370,7 +370,7 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n)
*/
static inline unsigned int show_bits(GetBitContext *s, int n)
{
Expand Down
18 changes: 9 additions & 9 deletions ffmpeg_patches/cbs/04-size-specifier.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Patch macro in logs that isn't handled by ./configure

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 8c0a5b5719..4594abe022 100644
index b26e39eab4..c83a87e2cb 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -352,7 +352,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx,
@@ -367,7 +367,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx,
if (ret < 0) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Unable to allocate a "
"sufficiently large write buffer (last attempt "
Expand All @@ -14,10 +14,10 @@ index 8c0a5b5719..4594abe022 100644
}
}
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 1229480567..c3e2dd8694 100644
index c4a6561706..c5d8ece526 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -754,7 +754,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
@@ -690,7 +690,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,

if (INT_MAX / 8 < size) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid fragment: "
Expand All @@ -26,7 +26,7 @@ index 1229480567..c3e2dd8694 100644
err = AVERROR_INVALIDDATA;
goto fail;
}
@@ -805,7 +805,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
@@ -741,7 +741,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
if (header.obu_has_size_field) {
if (get_bits_left(&gbc) < 8) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment "
Expand All @@ -35,7 +35,7 @@ index 1229480567..c3e2dd8694 100644
err = AVERROR_INVALIDDATA;
goto fail;
}
@@ -822,7 +822,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
@@ -758,7 +758,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,

if (size < obu_length) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU length: "
Expand All @@ -44,7 +44,7 @@ index 1229480567..c3e2dd8694 100644
obu_length, size);
err = AVERROR_INVALIDDATA;
goto fail;
@@ -901,7 +901,7 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
@@ -837,7 +837,7 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
} else {
if (unit->data_size < 1 + obu->header.obu_extension_flag) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU length: "
Expand All @@ -54,10 +54,10 @@ index 1229480567..c3e2dd8694 100644
}
obu->obu_size = unit->data_size - 1 - obu->header.obu_extension_flag;
diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c
index ae7f88a8a3..322215cbf2 100644
index 816d06da04..203cc83b32 100644
--- a/libavcodec/cbs_vp9.c
+++ b/libavcodec/cbs_vp9.c
@@ -461,7 +461,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
@@ -415,7 +415,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
}
if (pos + index_size != frag->data_size) {
av_log(ctx->log_ctx, AV_LOG_WARNING, "Extra padding at "
Expand Down
Loading

0 comments on commit ff50cf8

Please sign in to comment.