Update patches for 8.1.2

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
nyanmisaka
2026-06-30 01:00:05 +08:00
parent 621dde56e2
commit 43bd4629f6
12 changed files with 173 additions and 895 deletions
@@ -2324,7 +2324,7 @@ Index: FFmpeg/libavfilter/vf_tonemap_opencl.c
+
+ if (max_compute_units >= 40)
+ ctx->tradeoff = 0;
+ else if (device_name) {
+ else if (device_name) {
+ const char *excluded_devices[5] = { "Arc", "Iris", "Xe", "770", "750" };
+ for (i = 0; i < FF_ARRAY_ELEMS(excluded_devices); i++) {
+ if (strstr(device_name, excluded_devices[i])) {
@@ -2,10 +2,11 @@ Index: FFmpeg/libavcodec/dxva2.c
===================================================================
--- FFmpeg.orig/libavcodec/dxva2.c
+++ FFmpeg/libavcodec/dxva2.c
@@ -616,6 +616,16 @@ int ff_dxva2_common_frame_params(AVCodec
@@ -616,6 +616,18 @@ int ff_dxva2_common_frame_params(AVCodec
else
surface_alignment = 16;
+#if CONFIG_D3D11VA
+ /* align surfaces to 32 on Intel to keep in line with the MSDK impl,
+ which avoids the unnecessary resizing when mapping to QSV */
+ if (device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) {
@@ -15,11 +16,12 @@ Index: FFmpeg/libavcodec/dxva2.c
+ surface_alignment = 32;
+ }
+ }
+#endif
+
/* 1 base work surface */
num_surfaces = 1;
@@ -623,9 +633,9 @@ int ff_dxva2_common_frame_params(AVCodec
@@ -623,9 +635,9 @@ int ff_dxva2_common_frame_params(AVCodec
if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC)
num_surfaces += 16;
else if (avctx->codec_id == AV_CODEC_ID_VP9 || avctx->codec_id == AV_CODEC_ID_AV1)
@@ -1,22 +0,0 @@
Index: FFmpeg/fftools/ffmpeg_demux.c
===================================================================
--- FFmpeg.orig/fftools/ffmpeg_demux.c
+++ FFmpeg/fftools/ffmpeg_demux.c
@@ -534,7 +534,7 @@ static void readrate_sleep(Demuxer *d)
ds->lag = lag;
ds->resume_wc = now;
ds->resume_pts = pts;
- av_log_once(ds, AV_LOG_WARNING, AV_LOG_DEBUG, &resume_warn,
+ av_log_once(ds, AV_LOG_VERBOSE, AV_LOG_DEBUG, &resume_warn,
"Resumed reading at pts %0.3f with rate %0.3f after a lag of %0.3fs\n",
(float)pts/AV_TIME_BASE, d->readrate_catchup, (float)lag/AV_TIME_BASE);
}
@@ -2152,7 +2152,7 @@ int ifile_open(const OptionsContext *o,
d->readrate_initial_burst);
return AVERROR(EINVAL);
}
- d->readrate_catchup = o->readrate_catchup ? o->readrate_catchup : d->readrate * 1.05;
+ d->readrate_catchup = o->readrate_catchup ? o->readrate_catchup : d->readrate * 100;
if (d->readrate_catchup < d->readrate) {
av_log(d, AV_LOG_ERROR,
"Option -readrate_catchup is %0.3f; it must be at least equal to %0.3f.\n",
@@ -0,0 +1,116 @@
Index: FFmpeg/fftools/ffmpeg_demux.c
===================================================================
--- FFmpeg.orig/fftools/ffmpeg_demux.c
+++ FFmpeg/fftools/ffmpeg_demux.c
@@ -96,12 +96,6 @@ typedef struct DemuxStream {
uint64_t nb_packets;
// combined size of all the packets read
uint64_t data_size;
- // latest wallclock time at which packet reading resumed after a stall - used for readrate
- int64_t resume_wc;
- // timestamp of first packet sent after the latest stall - used for readrate
- int64_t resume_pts;
- // measure of how far behind packet reading is against spceified readrate
- int64_t lag;
} DemuxStream;
typedef struct DemuxStreamGroup {
@@ -144,6 +138,13 @@ typedef struct Demuxer {
double readrate_initial_burst;
float readrate_catchup;
+ // latest wallclock time at which packet reading resumed after a stall - used for readrate
+ int64_t resume_wc;
+ // relative timestamp of first packet sent after the latest stall - used for readrate
+ int64_t resume_progress;
+ // measure of how far behind packet reading is against spceified readrate
+ int64_t lag;
+
Scheduler *sch;
AVPacket *pkt_heartbeat;
@@ -514,43 +515,55 @@ static void readrate_sleep(Demuxer *d)
int64_t initial_burst = AV_TIME_BASE * d->readrate_initial_burst;
int resume_warn = 0;
+ DemuxStream *slowest = NULL;
+ int64_t progress = INT64_MAX;
+
for (int i = 0; i < f->nb_streams; i++) {
InputStream *ist = f->streams[i];
DemuxStream *ds = ds_from_ist(ist);
- int64_t stream_ts_offset, pts, now, wc_elapsed, elapsed, lag, max_pts, limit_pts;
-
- if (ds->discard) continue;
+ int64_t stream_ts_offset, pts, pts_diff;
+ if (ds->discard || ds->finished || ds->first_dts == AV_NOPTS_VALUE)
+ continue;
- stream_ts_offset = FFMAX(ds->first_dts != AV_NOPTS_VALUE ? ds->first_dts : 0, file_start);
+ stream_ts_offset = FFMAX(ds->first_dts, file_start);
pts = av_rescale(ds->dts, 1000000, AV_TIME_BASE);
- now = av_gettime_relative();
- wc_elapsed = now - d->wallclock_start;
-
- if (pts <= stream_ts_offset + initial_burst) continue;
-
- max_pts = stream_ts_offset + initial_burst + (int64_t)(wc_elapsed * d->readrate);
- lag = FFMAX(max_pts - pts, 0);
- if ( (!ds->lag && lag > 0.3 * AV_TIME_BASE) || ( lag > ds->lag + 0.3 * AV_TIME_BASE) ) {
- ds->lag = lag;
- ds->resume_wc = now;
- ds->resume_pts = pts;
- av_log_once(ds, AV_LOG_WARNING, AV_LOG_DEBUG, &resume_warn,
- "Resumed reading at pts %0.3f with rate %0.3f after a lag of %0.3fs\n",
- (float)pts/AV_TIME_BASE, d->readrate_catchup, (float)lag/AV_TIME_BASE);
- }
- if (ds->lag && !lag)
- ds->lag = ds->resume_wc = ds->resume_pts = 0;
- if (ds->resume_wc) {
- elapsed = now - ds->resume_wc;
- limit_pts = ds->resume_pts + (int64_t)(elapsed * d->readrate_catchup);
- } else {
- elapsed = wc_elapsed;
- limit_pts = max_pts;
+ pts_diff = pts - stream_ts_offset;
+ if (pts_diff < progress) {
+ progress = pts_diff;
+ slowest = ds;
}
+ }
- if (pts > limit_pts)
- av_usleep(pts - limit_pts);
+ if (!slowest || progress <= initial_burst)
+ return;
+
+ int64_t now = av_gettime_relative();
+ int64_t wc_elapsed = now - d->wallclock_start;
+ int64_t max_prog = initial_burst + (int64_t)(wc_elapsed * d->readrate);
+ int64_t lag = FFMAX(max_prog - progress, 0);
+ int64_t limit;
+
+ if ( (!d->lag && lag > 0.3 * AV_TIME_BASE) || ( lag > d->lag + 0.3 * AV_TIME_BASE) ) {
+ d->lag = lag;
+ d->resume_wc = now;
+ d->resume_progress = progress;
+
+ int64_t pts = FFMAX(slowest->first_dts, file_start) + progress;
+ av_log_once(slowest, AV_LOG_VERBOSE, AV_LOG_DEBUG, &resume_warn,
+ "Resumed reading at pts %0.3f with rate %0.3f after a lag of %0.3fs\n",
+ (float)pts/AV_TIME_BASE, d->readrate_catchup, (float)lag/AV_TIME_BASE);
+ }
+ if (d->lag && !lag)
+ d->lag = d->resume_wc = d->resume_progress = 0;
+ if (d->resume_wc) {
+ int64_t elapsed = now - d->resume_wc;
+ limit = d->resume_progress + (int64_t)(elapsed * d->readrate_catchup);
+ } else {
+ limit = max_prog;
}
+
+ if (progress > limit)
+ av_usleep(progress - limit);
}
static int do_send(Demuxer *d, DemuxStream *ds, AVPacket *pkt, unsigned flags,
@@ -83,18 +83,6 @@ Index: FFmpeg/libavcodec/nvenc.c
===================================================================
--- FFmpeg.orig/libavcodec/nvenc.c
+++ FFmpeg/libavcodec/nvenc.c
@@ -266,8 +266,10 @@ static void nvenc_map_preset(NvencContex
static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level)
{
-#if NVENCAPI_CHECK_VERSION(13, 1)
+#if NVENCAPI_CHECK_VERSION(13, 2)
const char *minver = "(unknown)";
+#elif NVENCAPI_CHECK_VERSION(13, 1)
+ const char *minver = "610.00";
#elif NVENCAPI_CHECK_VERSION(13, 0)
const char *minver = "570.0";
#elif NVENCAPI_CHECK_VERSION(12, 2)
@@ -592,12 +594,24 @@ static int nvenc_check_capabilities(AVCo
#ifdef NVENC_HAVE_BFRAME_REF_MODE
tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : NV_ENC_BFRAME_REF_MODE_DISABLED;
@@ -163,35 +151,6 @@ Index: FFmpeg/libavcodec/nvenc.c
break;
case NV_ENC_H264_PROFILE_MAIN:
cc->profileGUID = NV_ENC_H264_PROFILE_MAIN_GUID;
@@ -2529,7 +2557,12 @@ static void nvenc_fill_time_code(AVCodec
unsigned hh, mm, ss, ff, drop;
ff_timecode_set_smpte(&drop, &hh, &mm, &ss, &ff, avctx->framerate, tc[i + 1], 0, 0);
+#ifdef NVENC_NEW_COUNTING_TYPE
+ time_code->clockTimestamp[i].countingTypeLSB = 0;
+ time_code->clockTimestamp[i].countingTypeMSB = 0;
+#else
time_code->clockTimestamp[i].countingType = 0;
+#endif
time_code->clockTimestamp[i].discontinuityFlag = 0;
time_code->clockTimestamp[i].cntDroppedFrames = drop;
time_code->clockTimestamp[i].nFrames = ff;
Index: FFmpeg/libavcodec/nvenc.h
===================================================================
--- FFmpeg.orig/libavcodec/nvenc.h
+++ FFmpeg/libavcodec/nvenc.h
@@ -111,6 +111,11 @@ typedef void ID3D11Device;
#define NVENC_HAVE_MVHEVC
#endif
+// SDK 13.1 compile time feature checks
+#if NVENCAPI_CHECK_VERSION(13, 1)
+#define NVENC_NEW_COUNTING_TYPE
+#endif
+
typedef struct NvencSurface
{
NV_ENC_INPUT_PTR input_surface;
Index: FFmpeg/libavfilter/vf_scale_cuda.h
===================================================================
--- FFmpeg.orig/libavfilter/vf_scale_cuda.h
@@ -1,44 +0,0 @@
Index: FFmpeg/libavcodec/magicyuv.c
===================================================================
--- FFmpeg.orig/libavcodec/magicyuv.c
+++ FFmpeg/libavcodec/magicyuv.c
@@ -225,7 +225,8 @@ static int magy_decode_slice10(AVCodecCo
s->llviddsp.add_left_pred_int16(dst, dst, max, width, 0);
dst += stride;
}
- lefttop = left = dst[0];
+ if (1 + interlaced < height)
+ lefttop = left = dst[0];
for (k = 1 + interlaced; k < height; k++) {
magicyuv_median_pred16(dst, dst - fake_stride, dst, width, &left, &lefttop, max);
lefttop = left = dst[0];
@@ -584,6 +585,13 @@ static int magy_decode_frame(AVCodecCont
"invalid slice height: %d\n", s->slice_height);
return AVERROR_INVALIDDATA;
}
+ if (s->vshift[1] && (s->slice_height & ((1 << s->vshift[1]) - 1))) {
+ av_log(avctx, AV_LOG_ERROR,
+ "slice_height %d is not aligned to chroma vertical "
+ "subsampling (must be a multiple of %d)\n",
+ s->slice_height, 1 << s->vshift[1]);
+ return AVERROR_INVALIDDATA;
+ }
bytestream2_skipu(&gb, 4);
@@ -594,11 +602,11 @@ static int magy_decode_frame(AVCodecCont
return AVERROR_INVALIDDATA;
}
+ if ((s->slice_height >> s->vshift[1]) <= s->interlaced) {
+ av_log(avctx, AV_LOG_ERROR, "impossible slice height\n");
+ return AVERROR_INVALIDDATA;
+ }
if (s->interlaced) {
- if ((s->slice_height >> s->vshift[1]) < 2) {
- av_log(avctx, AV_LOG_ERROR, "impossible slice height\n");
- return AVERROR_INVALIDDATA;
- }
if ((avctx->coded_height % s->slice_height) && ((avctx->coded_height % s->slice_height) >> s->vshift[1]) < 2) {
av_log(avctx, AV_LOG_ERROR, "impossible height\n");
return AVERROR_INVALIDDATA;
@@ -2,7 +2,35 @@ Index: FFmpeg/fftools/ffmpeg_demux.c
===================================================================
--- FFmpeg.orig/fftools/ffmpeg_demux.c
+++ FFmpeg/fftools/ffmpeg_demux.c
@@ -1789,18 +1789,21 @@ static int safe_filename(const char *f,
@@ -1757,10 +1757,26 @@ static int is_windows_reserved_device_na
{
#if HAVE_DOS_PATHS
for (const char *p = f; p && *p; ) {
- char stem[6], *s;
+ char stem[16], *s;
+ size_t len;
av_strlcpy(stem, p, sizeof(stem));
+
+ if ((s = strchr(stem, '/')))
+ *s = 0;
+
+ /* Trim trailing spaces and dots */
+ len = strlen(stem);
+ while (len > 0 && (stem[len - 1] == ' ' || stem[len - 1] == '.'))
+ stem[--len] = 0;
+
if ((s = strchr(stem, '.')))
*s = 0;
+
+ /* Trim again after stripping extension */
+ len = strlen(stem);
+ while (len > 0 && (stem[len - 1] == ' ' || stem[len - 1] == '.'))
+ stem[--len] = 0;
+
if ((s = strpbrk(stem, "123456789")))
*s = '1';
@@ -1789,18 +1805,35 @@ static int safe_filename(const char *f,
return 0;
for (; *f; f++) {
@@ -10,10 +38,6 @@ Index: FFmpeg/fftools/ffmpeg_demux.c
- if (!((unsigned)((*f | 32) - 'a') < 26 ||
- (unsigned)(*f - '0') < 10 || *f == '_' || *f == '-')) {
- if (f == start)
- return 0;
- else if (allow_subdir && *f == '/')
- start = f + 1;
- else if (*f != '.')
+ /* Non-ASCII bytes cannot be '/' or '.' */
+ if ((unsigned char)*f > 127)
+ continue;
@@ -23,17 +47,34 @@ Index: FFmpeg/fftools/ffmpeg_demux.c
+ if (*f == '/') {
+ if (!allow_subdir || f == start)
return 0;
- else if (allow_subdir && *f == '/')
- start = f + 1;
- else if (*f != '.')
+
+#if HAVE_DOS_PATHS
+ /* Reject intermediate dirs ending with trailing spaces or dots */
+ if (f > start && (*(f - 1) == ' ' || *(f - 1) == '.'))
return 0;
+#endif
+
+ start = f + 1;
+ } else if (*f == '.' && f == start) {
+ return 0;
}
}
- return 1;
+
+#if HAVE_DOS_PATHS
+ /* Reject final filenames ending with trailing spaces or dots */
+ if (f > start && (*(f - 1) == ' ' || *(f - 1) == '.'))
+ return 0;
+#endif
+
+ return f != start;
}
static int dump_attachment(InputStream *ist, const char *filename)
@@ -1817,8 +1820,8 @@ static int dump_attachment(InputStream *
@@ -1817,8 +1850,8 @@ static int dump_attachment(InputStream *
if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0))) {
filename = e->value;
if (!safe_filename(filename, 0)) {
@@ -12,11 +12,3 @@ Index: FFmpeg/libavcodec/codec_par.c
par->width = codec->width;
par->height = codec->height;
par->field_order = codec->field_order;
@@ -219,6 +220,7 @@ int avcodec_parameters_to_context(AVCode
switch (par->codec_type) {
case AVMEDIA_TYPE_VIDEO:
+ codec->sw_pix_fmt =
codec->pix_fmt = par->format;
codec->width = par->width;
codec->height = par->height;
@@ -1,764 +0,0 @@
Index: FFmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S
===================================================================
--- FFmpeg.orig/libavcodec/aarch64/vp9lpf_16bpp_neon.S
+++ FFmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S
@@ -56,9 +56,7 @@
mov x11, v4.d[0]
mov x12, v4.d[1]
adds x11, x11, x12
- b.ne 1f
- ret x10
-1:
+ b.eq 9f
.if \wd >= 8
dup v0.8h, w5
@@ -189,13 +187,7 @@
// If no pixels need flat8in, jump to flat8out
// (or to a writeout of the inner 4 pixels, for wd=8)
.if \wd >= 8
-.if \wd == 16
b.eq 6f
-.else
- b.ne 1f
- ret x13
-1:
-.endif
// flat8in
add \tmp1\().8h, v20.8h, v21.8h
@@ -249,20 +241,16 @@
mov x11, v2.d[0]
mov x12, v2.d[1]
adds x11, x11, x12
- b.ne 1f
// If no pixels needed flat8in nor flat8out, jump to a
// writeout of the inner 4 pixels
- ret x14
-1:
+ b.eq 7f
mov x11, v7.d[0]
mov x12, v7.d[1]
adds x11, x11, x12
- b.ne 1f
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
- ret x15
+ b.eq 8f
-1:
// flat8out
// This writes all outputs into v2-v17 (skipping v6 and v16).
// If this part is skipped, the output is read from v21-v26 (which is the input
@@ -378,35 +366,57 @@
// while we need those for inputs/outputs in wd=16 and use v8-v15
// for temp registers there instead.
function vp9_loop_filter_4
+ mov x13, #0
loop_filter 4, v16, v17, v18, v19, v28, v29, v30, v31
ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8
+ mov x13, #0
loop_filter 8, v16, v17, v18, v19, v28, v29, v30, v31
ret
+6:
+ mov x13, #(1<<6)
+ ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16
+ mov x13, #0
loop_filter 16, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
.macro loop_filter_4
bl vp9_loop_filter_4
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8
- // calculate alternative 'return' targets
- adr x13, 6f
bl vp9_loop_filter_8
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
@@ -540,7 +550,7 @@ function vp9_loop_filter_v_4_8_16_neon
st1 {v23.8h}, [x9], x1
st1 {v25.8h}, [x0], x1
sub x0, x0, x1, lsl #1
-
+9:
ret x10
endfunc
@@ -588,7 +598,7 @@ function vp9_loop_filter_h_4_8_16_neon
st1 {v25.d}[1], [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, #4
-
+9:
ret x10
endfunc
@@ -619,7 +629,7 @@ function vp9_loop_filter_v_8_8_16_neon
st1 {v26.8h}, [x0], x1
sub x0, x0, x1, lsl #1
sub x0, x0, x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -670,7 +680,7 @@ function vp9_loop_filter_h_8_8_16_neon
st1 {v27.8h}, [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, #8
-
+9:
ret x10
6:
// If we didn't need to do the flat8in part, we use the same writeback
@@ -742,7 +752,7 @@ function vp9_loop_filter_v_16_8_16_neon
st1 {v17.8h}, [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, x1
-
+9:
ret x10
8:
add x9, x9, x1, lsl #2
@@ -820,7 +830,7 @@ function vp9_loop_filter_h_16_8_16_neon
st1 {v9.8h}, [x9], x1
st1 {v31.8h}, [x0], x1
sub x0, x0, x1, lsl #3
-
+9:
ret x10
8:
// The same writeback as in loop_filter_h_8_8
Index: FFmpeg/libavcodec/aarch64/vp9lpf_neon.S
===================================================================
--- FFmpeg.orig/libavcodec/aarch64/vp9lpf_neon.S
+++ FFmpeg/libavcodec/aarch64/vp9lpf_neon.S
@@ -388,32 +388,28 @@
.endif
.if \wd == 16
6:
+ // If no pixels needed flat8in nor flat8out, jump to a
+ // writeout of the inner 4 pixels
orr v2\sz, v6\sz, v7\sz
mov x5, v2.d[0]
.ifc \sz, .16b
mov x6, v2.d[1]
adds x5, x5, x6
- b.ne 1f
+ b.eq 7f
.else
- cbnz x5, 1f
+ cbz x5, 7f
.endif
- // If no pixels needed flat8in nor flat8out, jump to a
- // writeout of the inner 4 pixels
- ret x14
-1:
+ // If no pixels need flat8out, jump to a writeout of the inner 6 pixels
mov x5, v7.d[0]
.ifc \sz, .16b
mov x6, v7.d[1]
adds x5, x5, x6
- b.ne 1f
+ b.eq 8f
.else
- cbnz x5, 1f
+ cbz x5, 8f
.endif
- // If no pixels need flat8out, jump to a writeout of the inner 6 pixels
- ret x15
-1:
// flat8out
// This writes all outputs into v2-v17 (skipping v6 and v16).
// If this part is skipped, the output is read from v21-v26 (which is the input
@@ -529,76 +525,94 @@
// while we need those for inputs/outputs in wd=16 and use v8-v15
// for temp registers there instead.
function vp9_loop_filter_4
+ mov x13, #0
loop_filter 4, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_4_16b_mix_44
+ mov x13, #0
loop_filter 4, .16b, 44, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8
+ mov x13, #0
loop_filter 8, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
- ret x13
+ mov x13, #(1<<6)
+ ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8_16b_mix
+ mov x13, #0
loop_filter 8, .16b, 88, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
- ret x13
+ mov x13, #(1<<6)
+ ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16
+ mov x13, #0
loop_filter 16, .8b, 0, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
9:
- ldp d10, d11, [sp, #0x10]
- ldp d12, d13, [sp, #0x20]
- ldp d14, d15, [sp, #0x30]
- ldp d8, d9, [sp], #0x40
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16_16b
+ mov x13, #0
loop_filter 16, .16b, 0, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
9:
- ldp d10, d11, [sp, #0x10]
- ldp d12, d13, [sp, #0x20]
- ldp d14, d15, [sp, #0x30]
- ldp d8, d9, [sp], #0x40
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
.macro loop_filter_4
bl vp9_loop_filter_4
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_4_16b_mix mix
bl vp9_loop_filter_4_16b_mix_\mix
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8
- // calculate alternative 'return' targets
- adr x13, 6f
bl vp9_loop_filter_8
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8_16b_mix mix
- // calculate alternative 'return' targets
- adr x13, 6f
.if \mix == 48
mov x11, #0xffffffff00000000
.elseif \mix == 84
@@ -607,20 +621,22 @@ endfunc
mov x11, #0xffffffffffffffff
.endif
bl vp9_loop_filter_8_16b_mix
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16_16b
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16_16b
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
@@ -647,7 +663,7 @@ function ff_vp9_loop_filter_v_4_8_neon,
st1 {v24.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v25.8b}, [x0], x1
-
+9:
ret x10
endfunc
@@ -671,7 +687,7 @@ function ff_vp9_loop_filter_v_44_16_neon
st1 {v24.16b}, [x0], x1
st1 {v23.16b}, [x9], x1
st1 {v25.16b}, [x0], x1
-
+9:
ret x10
endfunc
@@ -713,7 +729,7 @@ function ff_vp9_loop_filter_h_4_8_neon,
st1 {v24.s}[1], [x0], x1
st1 {v25.s}[0], [x9], x1
st1 {v25.s}[1], [x0], x1
-
+9:
ret x10
endfunc
@@ -765,7 +781,7 @@ function ff_vp9_loop_filter_h_44_16_neon
st1 {v24.s}[3], [x0], x1
st1 {v25.s}[1], [x9], x1
st1 {v25.s}[3], [x0], x1
-
+9:
ret x10
endfunc
@@ -792,7 +808,7 @@ function ff_vp9_loop_filter_v_8_8_neon,
st1 {v25.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v26.8b}, [x0], x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -827,7 +843,7 @@ function ff_vp9_loop_filter_v_\mix\()_16
st1 {v25.16b}, [x0], x1
st1 {v23.16b}, [x9], x1
st1 {v26.16b}, [x0], x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -875,7 +891,7 @@ function ff_vp9_loop_filter_h_8_8_neon,
st1 {v26.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v27.8b}, [x0], x1
-
+9:
ret x10
6:
// If we didn't need to do the flat8in part, we use the same writeback
@@ -941,7 +957,7 @@ function ff_vp9_loop_filter_h_\mix\()_16
st1 {v26.d}[1], [x0], x1
st1 {v27.8b}, [x9], x1
st1 {v27.d}[1], [x0], x1
-
+9:
ret x10
6:
add x9, x9, #2
Index: FFmpeg/libavcodec/vulkan_encode.c
===================================================================
--- FFmpeg.orig/libavcodec/vulkan_encode.c
+++ FFmpeg/libavcodec/vulkan_encode.c
@@ -772,14 +772,6 @@ av_cold int ff_vulkan_encode_init(AVCode
return AVERROR(EINVAL);
}
- if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
- feedback_flags) {
- av_log (avctx, AV_LOG_ERROR,
- "Driver does not support required encode feedback flags "
- "(BUFFER_OFFSET and BYTES_WRITTEN).\n");
- return AVERROR(ENOTSUP);
- }
-
ctx->base.op = &vulkan_base_encode_ops;
ctx->codec = codec;
@@ -881,6 +873,14 @@ av_cold int ff_vulkan_encode_init(AVCode
return AVERROR_EXTERNAL;
}
+ if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
+ feedback_flags) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Driver does not support required encode feedback flags "
+ "(BUFFER_OFFSET and BYTES_WRITTEN).\n");
+ return AVERROR(ENOTSUP);
+ }
+
err = init_rc(avctx, ctx);
if (err < 0)
return err;
Index: FFmpeg/libavformat/dashdec.c
===================================================================
--- FFmpeg.orig/libavformat/dashdec.c
+++ FFmpeg/libavformat/dashdec.c
@@ -447,7 +447,7 @@ static int open_url(AVFormatContext *s,
av_freep(pb);
av_dict_copy(&tmp, *opts, 0);
av_dict_copy(&tmp, opts2, 0);
- ret = ffio_open_whitelist(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp, s->protocol_whitelist, s->protocol_blacklist);
+ ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp);
if (ret >= 0) {
// update cookies on http response with setcookies.
char *new_cookies = NULL;
@@ -1255,7 +1255,7 @@ static int parse_manifest(AVFormatContex
close_in = 1;
av_dict_copy(&opts, c->avio_opts, 0);
- ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ, c->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist);
+ ret = s->io_open(s, &in, url, AVIO_FLAG_READ, &opts);
av_dict_free(&opts);
if (ret < 0)
return ret;
@@ -1398,7 +1398,7 @@ cleanup:
av_bprint_finalize(&buf, NULL);
if (close_in) {
- avio_close(in);
+ ff_format_io_close(s, &in);
}
return ret;
}
Index: FFmpeg/libavformat/dashenc.c
===================================================================
--- FFmpeg.orig/libavformat/dashenc.c
+++ FFmpeg/libavformat/dashenc.c
@@ -490,7 +490,7 @@ static void dash_free(AVFormatContext *s
if (!c->single_file)
ffio_free_dyn_buf(&os->ctx->pb);
else
- avio_close(os->ctx->pb);
+ ff_format_io_close(s, &os->ctx->pb);
}
ff_format_io_close(s, &os->out);
avformat_free_context(os->ctx);
@@ -1458,7 +1458,7 @@ static int dash_init(AVFormatContext *s)
ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, &opts);
} else {
ctx->url = av_strdup(filename);
- ret = avio_open2(&ctx->pb, filename, AVIO_FLAG_WRITE, NULL, &opts);
+ ret = s->io_open(s, &ctx->pb, filename, AVIO_FLAG_WRITE, &opts);
}
av_dict_free(&opts);
if (ret < 0)
Index: FFmpeg/libavformat/demux.c
===================================================================
--- FFmpeg.orig/libavformat/demux.c
+++ FFmpeg/libavformat/demux.c
@@ -368,7 +368,7 @@ fail:
ff_id3v2_free_extra_meta(&id3v2_extra_meta);
av_dict_free(&tmp);
if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))
- avio_closep(&s->pb);
+ ff_format_io_close(s, &s->pb);
avformat_free_context(s);
*ps = NULL;
return ret;
Index: FFmpeg/libavformat/hlsenc.c
===================================================================
--- FFmpeg.orig/libavformat/hlsenc.c
+++ FFmpeg/libavformat/hlsenc.c
@@ -703,7 +703,7 @@ static int do_encrypt(AVFormatContext *s
return ret;
avio_seek(pb, 0, SEEK_CUR);
avio_write(pb, key, KEYSIZE);
- avio_close(pb);
+ ff_format_io_close(s, &pb);
}
return 0;
}
@@ -1171,9 +1171,7 @@ static int parse_playlist(AVFormatContex
const char *end;
double discont_program_date_time = 0;
- if ((ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ,
- &s->interrupt_callback, NULL,
- s->protocol_whitelist, s->protocol_blacklist)) < 0)
+ if ((ret = s->io_open(s, &in, url, AVIO_FLAG_READ, NULL)) < 0)
return ret;
ff_get_chomp_line(in, line, sizeof(line));
@@ -1283,7 +1281,7 @@ static int parse_playlist(AVFormatContex
}
fail:
- avio_close(in);
+ ff_format_io_close(s, &in);
return ret;
}
Index: FFmpeg/libavformat/mov.c
===================================================================
--- FFmpeg.orig/libavformat/mov.c
+++ FFmpeg/libavformat/mov.c
@@ -1237,15 +1237,13 @@ static int mov_read_chnl(MOVContext *c,
version = avio_r8(pb);
flags = avio_rb24(pb);
if (version != 0 || flags != 0) {
- av_log(c->fc, AV_LOG_ERROR,
- "Unsupported 'chnl' box with version %d, flags: %#x",
+ av_log(c->fc, AV_LOG_WARNING,
+ "Unsupported 'chnl' box with version %d, flags: %#x\n",
version, flags);
- return AVERROR_INVALIDDATA;
+ return 0;
}
- ret = ff_mov_read_chnl(c->fc, pb, st);
- if (ret < 0)
- return ret;
+ ff_mov_read_chnl(c->fc, pb, st);
if (avio_tell(pb) != end) {
av_log(c->fc, AV_LOG_WARNING, "skip %" PRId64 " bytes of unknown data inside chnl\n",
Index: FFmpeg/libavformat/mov_chan.c
===================================================================
--- FFmpeg.orig/libavformat/mov_chan.c
+++ FFmpeg/libavformat/mov_chan.c
@@ -375,6 +375,7 @@ static int mov_get_channel_layout(AVChan
/* find the channel layout for the specified layout tag */
layout_map = find_layout_map(tag, map);
if (layout_map) {
+ AVChannelLayout tmp = { 0 };
int ret;
int map_layout_nb_channels = tag & 0xFFFF;
int nb_channels = ch_layout->nb_channels;
@@ -383,19 +384,23 @@ static int mov_get_channel_layout(AVChan
if (omitted_channel_map >> map_layout_nb_channels)
return AVERROR_INVALIDDATA;
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
return ret;
for (int i = 0, idx = 0; i < map_layout_nb_channels && idx < nb_channels; i++, omitted_channel_map >>= 1) {
if (!(omitted_channel_map & 1)) {
enum AVChannel id = layout_map[i].id;
- ch_layout->u.map[idx++].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN);
+ tmp.u.map[idx++].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN);
}
}
- return av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ if (ret < 0)
+ return ret;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
}
return 0;
}
@@ -543,6 +548,7 @@ int ff_mov_read_chan(AVFormatContext *s,
return 0;
if (layout_tag == MOV_CH_LAYOUT_USE_DESCRIPTIONS) {
+ AVChannelLayout tmp = { 0 };
int nb_channels = ch_layout->nb_channels;
if (!num_descr || num_descr < nb_channels) {
@@ -562,8 +568,7 @@ int ff_mov_read_chan(AVFormatContext *s,
num_descr = nb_channels;
}
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
goto out;
@@ -580,12 +585,15 @@ int ff_mov_read_chan(AVFormatContext *s,
avio_rl32(pb); // mCoordinates[1]
avio_rl32(pb); // mCoordinates[2]
size -= 20;
- ch_layout->u.map[i].id = mov_get_channel_id(label);
+ tmp.u.map[i].id = mov_get_channel_id(label);
}
- ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
if (ret < 0)
goto out;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
} else if (layout_tag == MOV_CH_LAYOUT_USE_BITMAP) {
if (!ch_layout->nb_channels || av_popcount(bitmap) == ch_layout->nb_channels) {
if (bitmap < 0x40000) {
@@ -737,11 +745,10 @@ int ff_mov_read_chnl(AVFormatContext *s,
av_log(s, AV_LOG_TRACE, "'chnl' layout %d\n", layout);
if (!layout) {
- AVChannelLayout *ch_layout = &st->codecpar->ch_layout;
+ AVChannelLayout tmp = { 0 }, *ch_layout = &st->codecpar->ch_layout;
int nb_channels = ch_layout->nb_channels;
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
return ret;
@@ -762,12 +769,15 @@ int ff_mov_read_chnl(AVFormatContext *s,
channel = AV_CHAN_UNKNOWN;
}
- ch_layout->u.map[i].id = channel;
+ tmp.u.map[i].id = channel;
}
- ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
if (ret < 0)
return ret;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
} else {
uint64_t omitted_channel_map = avio_rb64(pb);
ret = ff_mov_get_channel_layout_from_config(layout, &st->codecpar->ch_layout, omitted_channel_map);
Index: FFmpeg/libavformat/oggparsecelt.c
===================================================================
--- FFmpeg.orig/libavformat/oggparsecelt.c
+++ FFmpeg/libavformat/oggparsecelt.c
@@ -27,6 +27,9 @@
#include "internal.h"
#include "oggdec.h"
+/* CELT-over-Ogg streams use at most a couple of vorbiscomment "extra" headers. */
+#define CELT_MAX_EXTRA_HEADERS 16
+
struct oggcelt_private {
int extra_headers_left;
};
@@ -62,6 +65,12 @@ static int celt_header(AVFormatContext *
overlap = AV_RL32(p + 48);
/* unused bytes per packet field skipped */
extra_headers = AV_RL32(p + 56);
+ if (extra_headers > CELT_MAX_EXTRA_HEADERS) {
+ av_log(s, AV_LOG_ERROR,
+ "Too many CELT extra headers (%u)\n", extra_headers);
+ av_free(priv);
+ return AVERROR_INVALIDDATA;
+ }
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_CODEC_ID_CELT;
st->codecpar->sample_rate = sample_rate;
Index: FFmpeg/libavformat/oggparsevorbis.c
===================================================================
--- FFmpeg.orig/libavformat/oggparsevorbis.c
+++ FFmpeg/libavformat/oggparsevorbis.c
@@ -230,8 +230,11 @@ static int fixup_vorbis_headers(AVFormat
int i, offset, len, err;
int buf_len;
unsigned char *ptr;
+ uint64_t total_len = (uint64_t)priv->len[0] + priv->len[1] + priv->len[2];
+ if (total_len + total_len / 255 + 64 > INT_MAX)
+ return AVERROR_INVALIDDATA;
- len = priv->len[0] + priv->len[1] + priv->len[2];
+ len = total_len;
buf_len = len + len / 255 + 64;
if (*buf)
Index: FFmpeg/libavformat/rtpdec_av1.c
===================================================================
--- FFmpeg.orig/libavformat/rtpdec_av1.c
+++ FFmpeg/libavformat/rtpdec_av1.c
@@ -249,7 +249,7 @@ static int av1_handle_packet(AVFormatCon
// ignore and remove OBUs according to spec
if ((obu_type == AV1_OBU_TEMPORAL_DELIMITER) ||
(obu_type == AV1_OBU_TILE_LIST)) {
- pktpos += obu_size;
+ buf_ptr += obu_size;
rem_pkt_size -= obu_size;
// TODO: This probably breaks if the OBU_TILE_LIST is fragmented
// into the next RTP packet, so at least check and fail here
Index: FFmpeg/libavformat/version.h
===================================================================
--- FFmpeg.orig/libavformat/version.h
+++ FFmpeg/libavformat/version.h
@@ -32,7 +32,7 @@
#include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 12
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
+5 -7
View File
@@ -74,7 +74,7 @@
0074-fix-mapped-hwframe-to-swframe-swscale-conversion.patch
0075-fix-hwupload-filter-cannot-use-devices-created-by-hwaccel.patch
0076-fix-seeking-h264-open-gop-videos-with-d3d11va-on-amd.patch
0077-fix-low-default-readrate-catchup-caused-remuxing-to-stall.patch
0077-fix-readrate-catchup-caused-remuxing-to-stall.patch
0078-backport-fixes-for-vulkan-from-upstream.patch
0079-add-fixes-for-vaapi-drm-prime-vulkan-interop.patch
0080-prefer-vulkan-device-with-higher-api-version.patch
@@ -84,9 +84,7 @@
0084-backport-fixes-for-detecting-ac4-streams-in-mpegts.patch
0085-fix-hdr10-sidedata-not-removed-in-libplacebo-outlink.patch
0086-workaround-amd-hevc-vaapi-encoder-out-of-band-vtag-hvc1.patch
0087-backport-a-fix-from-upstream-for-magicyuv-decoder.patch
0088-add-dtsx-detect-for-dts-hd-hra.patch
0089-add-webp-to-matroskadec-image-mime-types.patch
0090-relax-to-allow-safe-filenames-in-mkv-attachments.patch
0091-backport-a-fix-to-use-sw-pix-fmt-in-codec-par-if-set.patch
0092-backport-fixes-by-comparing-n8-1-1-and-release-8-1.patch
0087-add-dtsx-detect-for-dts-hd-hra.patch
0088-add-webp-to-matroskadec-image-mime-types.patch
0089-relax-to-allow-safe-filenames-in-mkv-attachments.patch
0090-backport-a-fix-to-use-sw-pix-fmt-in-codec-par-if-set.patch