[FFmpeg-cvslog] fftools: do not access out of bounds filtergraph
ffmpeg | branch: release/7.1 | Marvin Scholz | Tue Oct 1 02:57:11 2024 +0200| [e14a3a4b116122899dc8d251d6b890ae378f9802] | committer: James Almer fftools: do not access out of bounds filtergraph The log message was logged for `filtergraphs[j]` which would cause a heap buffer overflow in certain circumstances. Correctly it should be logged for the current filtergraph, so just use `fg` here. (cherry picked from commit 5beeb3a1f97d8f6d4076fe83aaf5e2e5871f945e) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e14a3a4b116122899dc8d251d6b890ae378f9802 --- fftools/ffmpeg_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 7ec328e04e..2f2b297932 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1408,7 +1408,7 @@ int fg_finalise_bindings(void) for (int j = 0; j < fg->nb_outputs; j++) { OutputFilter *output = fg->outputs[j]; if (!output->bound) { -av_log(filtergraphs[j], AV_LOG_FATAL, +av_log(fg, AV_LOG_FATAL, "Filter %s has an unconnected output\n", output->name); return AVERROR(EINVAL); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools: log unconnected filter output label
ffmpeg | branch: release/7.1 | Marvin Scholz | Tue Oct 1 03:20:04 2024 +0200| [9b061291ad3c38944ab628be52e9338090d2f3a7] | committer: James Almer fftools: log unconnected filter output label (cherry picked from commit f25c9cc213c7e3eb585d3339eb775b16921c4d98) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b061291ad3c38944ab628be52e9338090d2f3a7 --- fftools/ffmpeg_filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 2f2b297932..4e3a47e3b6 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1409,7 +1409,9 @@ int fg_finalise_bindings(void) OutputFilter *output = fg->outputs[j]; if (!output->bound) { av_log(fg, AV_LOG_FATAL, - "Filter %s has an unconnected output\n", output->name); + "Filter '%s' has output %d (%s) unconnected\n", + output->name, j, + output->linklabel ? (const char *)output->linklabel : "unlabeled"); return AVERROR(EINVAL); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodecenc: Fix access of uninitialized value
ffmpeg | branch: master | Zhao Zhili | Fri Oct 4 01:30:57 2024 +0800| [eff9ed7bff45998ea370e3d6f627529ad47e2e74] | committer: Zhao Zhili avcodec/mediacodecenc: Fix access of uninitialized value When crop is skipped, av_strlcatf will access `str` which isn't initialized properly. Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eff9ed7bff45998ea370e3d6f627529ad47e2e74 --- libavcodec/mediacodecenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 6ca3968a24..e76ea81236 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -134,7 +134,7 @@ static int extract_extradata_support(AVCodecContext *avctx) static int mediacodec_init_bsf(AVCodecContext *avctx) { MediaCodecEncContext *s = avctx->priv_data; -char str[128]; +char str[128] = {0}; int ret; int crop_right = s->width - avctx->width; int crop_bottom = s->height - avctx->height; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodecenc: Fix access of uninitialized value
ffmpeg | branch: release/7.1 | Zhao Zhili | Fri Oct 4 01:30:57 2024 +0800| [4c0ef3bfae1473902f8ec8ee0a1a95607827b390] | committer: Zhao Zhili avcodec/mediacodecenc: Fix access of uninitialized value When crop is skipped, av_strlcatf will access `str` which isn't initialized properly. Signed-off-by: Zhao Zhili (cherry picked from commit eff9ed7bff45998ea370e3d6f627529ad47e2e74) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c0ef3bfae1473902f8ec8ee0a1a95607827b390 --- libavcodec/mediacodecenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 6ca3968a24..e76ea81236 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -134,7 +134,7 @@ static int extract_extradata_support(AVCodecContext *avctx) static int mediacodec_init_bsf(AVCodecContext *avctx) { MediaCodecEncContext *s = avctx->priv_data; -char str[128]; +char str[128] = {0}; int ret; int crop_right = s->width - avctx->width; int crop_bottom = s->height - avctx->height; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/executor: remove unused ready callback
ffmpeg | branch: master | Nuo Mi | Tue Sep 24 22:16:57 2024 +0800| [40a14ef970f7210c64ccfc5625871ef577f3e3a3] | committer: Nuo Mi avcodec/executor: remove unused ready callback Due to the nature of multithreading, using a "ready check" mechanism may introduce a deadlock. For example: Suppose all tasks have been submitted to the executor, and the last thread checks the entire list and finds no ready tasks. It then goes to sleep, waiting for a new task. However, for some multithreading-related reason, a task becomes ready after the check. Since no other thread is aware of this and no new tasks are being added to the executor, a deadlock occurs. In VVC, this function is unnecessary because we use a scoreboard. All tasks submitted to the executor are ready tasks. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40a14ef970f7210c64ccfc5625871ef577f3e3a3 --- libavcodec/executor.c | 6 ++ libavcodec/executor.h | 3 --- libavcodec/vvc/thread.c | 8 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/libavcodec/executor.c b/libavcodec/executor.c index 574c5c7be7..21ebad3def 100644 --- a/libavcodec/executor.c +++ b/libavcodec/executor.c @@ -79,10 +79,8 @@ static void add_task(FFTask **prev, FFTask *t) static int run_one_task(FFExecutor *e, void *lc) { FFTaskCallbacks *cb = &e->cb; -FFTask **prev; +FFTask **prev = &e->tasks; -for (prev = &e->tasks; *prev && !cb->ready(*prev, cb->user_data); prev = &(*prev)->next) -/* nothing */; if (*prev) { FFTask *t = remove_task(prev, *prev); if (e->thread_count > 0) @@ -143,7 +141,7 @@ FFExecutor* ff_executor_alloc(const FFTaskCallbacks *cb, int thread_count) { FFExecutor *e; int has_lock = 0, has_cond = 0; -if (!cb || !cb->user_data || !cb->ready || !cb->run || !cb->priority_higher) +if (!cb || !cb->user_data || !cb->run || !cb->priority_higher) return NULL; e = av_mallocz(sizeof(*e)); diff --git a/libavcodec/executor.h b/libavcodec/executor.h index 2d02734ad6..51763ec25e 100644 --- a/libavcodec/executor.h +++ b/libavcodec/executor.h @@ -42,9 +42,6 @@ typedef struct FFTaskCallbacks { // return 1 if a's priority > b's priority int (*priority_higher)(const FFTask *a, const FFTask *b); -// task is ready for run -int (*ready)(const FFTask *t, void *user_data); - // run the task int (*run)(FFTask *t, void *local_context, void *user_data); } FFTaskCallbacks; diff --git a/libavcodec/vvc/thread.c b/libavcodec/vvc/thread.c index e6907fd764..a8c19b17cf 100644 --- a/libavcodec/vvc/thread.c +++ b/libavcodec/vvc/thread.c @@ -372,13 +372,6 @@ static int task_is_stage_ready(VVCTask *t, int add) return task_has_target_score(t, stage, score); } -static int task_ready(const FFTask *_t, void *user_data) -{ -VVCTask *t = (VVCTask*)_t; - -return task_is_stage_ready(t, 0); -} - #define CHECK(a, b) \ do {\ if ((a) != (b)) \ @@ -689,7 +682,6 @@ FFExecutor* ff_vvc_executor_alloc(VVCContext *s, const int thread_count) s, sizeof(VVCLocalContext), task_priority_higher, -task_ready, task_run, }; return ff_executor_alloc(&callbacks, thread_count); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvc: simplify priority logical to improve performance for 4K/8K
ffmpeg | branch: master | Nuo Mi | Tue Sep 24 22:16:58 2024 +0800| [846fbc395be77ebc76b578ee74d424d2e44a4e96] | committer: Nuo Mi avcodec/vvc: simplify priority logical to improve performance for 4K/8K For 4K/8K video processing, it's possible to have over 1,000 tasks pending on the executor. In such cases, O(n) and O(log(n)) insertion times are too costly. Reducing this to O(1) will significantly decrease the time spent in critical sections clip| before | after | delta |||--- VVC_HDR_UHDTV2_OpenGOP_7680x4320_50fps_HLG10.bit|24 | 27 | 12.5% VVC_HDR_UHDTV2_OpenGOP_7680x4320_50fps_HLG10_HighBitrate.bit|12 | 17 | 41.7% tears_of_steel_4k_8M_8bit_2000.vvc |34 | 102 | 200.0% VVC_UHDTV1_OpenGOP_3840x2160_60fps_HLG10.bit| 126 | 128 | 1.6% RitualDance_1920x1080_60_10_420_37_RA.266 | 350 | 378 | 8.0% NovosobornayaSquare_1920x1080.bin | 341 | 369 | 8.2% Tango2_3840x2160_60_10_420_27_LD.266|69 | 70 | 1.4% RitualDance_1920x1080_60_10_420_32_LD.266 | 243 | 259 | 6.6% Chimera_8bit_1080P_1000_frames.vvc | 420 | 392 | -6.7% BQTerrace_1920x1080_60_10_420_22_RA.vvc | 148 | 144 | -2.7% > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=846fbc395be77ebc76b578ee74d424d2e44a4e96 --- libavcodec/executor.c | 52 +++-- libavcodec/executor.h | 5 +++-- libavcodec/vvc/thread.c | 48 ++--- 3 files changed, 55 insertions(+), 50 deletions(-) diff --git a/libavcodec/executor.c b/libavcodec/executor.c index 21ebad3def..7a86e894f8 100644 --- a/libavcodec/executor.c +++ b/libavcodec/executor.c @@ -48,6 +48,11 @@ typedef struct ThreadInfo { ExecutorThread thread; } ThreadInfo; +typedef struct Queue { +FFTask *head; +FFTask *tail; +} Queue; + struct FFExecutor { FFTaskCallbacks cb; int thread_count; @@ -60,29 +65,39 @@ struct FFExecutor { AVCond cond; int die; -FFTask *tasks; +Queue *q; }; -static FFTask* remove_task(FFTask **prev, FFTask *t) +static FFTask* remove_task(Queue *q) { -*prev = t->next; -t->next = NULL; +FFTask *t = q->head; +if (t) { +q->head = t->next; +t->next = NULL; +if (!q->head) +q->tail = NULL; +} return t; } -static void add_task(FFTask **prev, FFTask *t) +static void add_task(Queue *q, FFTask *t) { -t->next = *prev; -*prev = t; +t->next = NULL; +if (!q->head) +q->tail = q->head = t; +else +q->tail = q->tail->next = t; } static int run_one_task(FFExecutor *e, void *lc) { FFTaskCallbacks *cb = &e->cb; -FFTask **prev = &e->tasks; +FFTask *t = NULL; + +for (int i = 0; i < e->cb.priorities && !t; i++) +t = remove_task(e->q + i); -if (*prev) { -FFTask *t = remove_task(prev, *prev); +if (t) { if (e->thread_count > 0) ff_mutex_unlock(&e->lock); cb->run(t, lc, cb->user_data); @@ -132,6 +147,7 @@ static void executor_free(FFExecutor *e, const int has_lock, const int has_cond) ff_mutex_destroy(&e->lock); av_free(e->threads); +av_free(e->q); av_free(e->local_contexts); av_free(e); @@ -141,7 +157,7 @@ FFExecutor* ff_executor_alloc(const FFTaskCallbacks *cb, int thread_count) { FFExecutor *e; int has_lock = 0, has_cond = 0; -if (!cb || !cb->user_data || !cb->run || !cb->priority_higher) +if (!cb || !cb->user_data || !cb->run || !cb->priorities) return NULL; e = av_mallocz(sizeof(*e)); @@ -153,6 +169,10 @@ FFExecutor* ff_executor_alloc(const FFTaskCallbacks *cb, int thread_count) if (!e->local_contexts) goto free_executor; +e->q = av_calloc(e->cb.priorities, sizeof(Queue)); +if (!e->q) +goto free_executor; + e->threads = av_calloc(FFMAX(thread_count, 1), sizeof(*e->threads)); if (!e->threads) goto free_executor; @@ -192,16 +212,10 @@ void ff_executor_free(FFExecutor **executor) void ff_executor_execute(FFExecutor *e, FFTask *t) { -FFTaskCallbacks *cb = &e->cb; -FFTask **prev; - if (e->thread_count) ff_mutex_lock(&e->lock); -if (t) { -for (prev = &e->tasks; *prev && cb->priority_higher(*prev, t); prev = &(*prev)->next) -/* nothing */; -add_task(prev, t); -} +if (t) +add_task(e->q + t->priority % e->cb.priorities, t); if (e->thread_count) { ff_cond_signal(&e->cond); ff_mutex_unlock(&e->lock); diff --git a/libavcodec/executor.h b/libavcodec/executor.h index 51763ec25e..cd13d4c5
[FFmpeg-cvslog] avcodec: make a local copy of executor
ffmpeg | branch: master | Nuo Mi | Tue Oct 1 14:25:00 2024 +0800| [8446e27bf3b6d9be9dd151399d6739d8e1e910d4] | committer: Nuo Mi avcodec: make a local copy of executor We still need several refactors to improve the current VVC decoder's performance, which will frequently break the API/ABI. To mitigate this, we've copied the executor from avutil to avcodec. Once the API/ABI is stable, we will move this class back to avutil > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8446e27bf3b6d9be9dd151399d6739d8e1e910d4 --- libavcodec/Makefile | 1 + libavcodec/executor.c | 221 libavcodec/executor.h | 73 libavcodec/vvc/dec.h| 2 +- libavcodec/vvc/thread.c | 22 ++--- libavcodec/vvc/thread.h | 4 +- 6 files changed, 309 insertions(+), 14 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 5aed2fff28..4eed81ed03 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -43,6 +43,7 @@ OBJS = ac3_parser.o \ dirac.o \ dv_profile.o \ encode.o \ + executor.o \ get_buffer.o \ imgconvert.o \ jni.o\ diff --git a/libavcodec/executor.c b/libavcodec/executor.c new file mode 100644 index 00..574c5c7be7 --- /dev/null +++ b/libavcodec/executor.c @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2024 Nuo Mi + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include + +#include "libavutil/mem.h" +#include "libavutil/thread.h" + +#include "executor.h" + +#if !HAVE_THREADS + +#define ExecutorThread char + +#define executor_thread_create(t, a, s, ar) 0 +#define executor_thread_join(t, r) do {} while(0) + +#else + +#define ExecutorThread pthread_t + +#define executor_thread_create(t, a, s, ar) pthread_create(t, a, s, ar) +#define executor_thread_join(t, r) pthread_join(t, r) + +#endif //!HAVE_THREADS + +typedef struct ThreadInfo { +FFExecutor *e; +ExecutorThread thread; +} ThreadInfo; + +struct FFExecutor { +FFTaskCallbacks cb; +int thread_count; +bool recursive; + +ThreadInfo *threads; +uint8_t *local_contexts; + +AVMutex lock; +AVCond cond; +int die; + +FFTask *tasks; +}; + +static FFTask* remove_task(FFTask **prev, FFTask *t) +{ +*prev = t->next; +t->next = NULL; +return t; +} + +static void add_task(FFTask **prev, FFTask *t) +{ +t->next = *prev; +*prev = t; +} + +static int run_one_task(FFExecutor *e, void *lc) +{ +FFTaskCallbacks *cb = &e->cb; +FFTask **prev; + +for (prev = &e->tasks; *prev && !cb->ready(*prev, cb->user_data); prev = &(*prev)->next) +/* nothing */; +if (*prev) { +FFTask *t = remove_task(prev, *prev); +if (e->thread_count > 0) +ff_mutex_unlock(&e->lock); +cb->run(t, lc, cb->user_data); +if (e->thread_count > 0) +ff_mutex_lock(&e->lock); +return 1; +} +return 0; +} + +#if HAVE_THREADS +static void *executor_worker_task(void *data) +{ +ThreadInfo *ti = (ThreadInfo*)data; +FFExecutor *e = ti->e; +void *lc = e->local_contexts + (ti - e->threads) * e->cb.local_context_size; + +ff_mutex_lock(&e->lock); +while (1) { +if (e->die) break; + +if (!run_one_task(e, lc)) { +//no task in one loop +ff_cond_wait(&e->cond, &e->lock); +} +} +ff_mutex_unlock(&e->lock); +return NULL; +} +#endif + +static void executor_free(FFExecutor *e, const int has_lock, const int has_cond) +{ +if (e->thread_count) { +//signal die +ff_mutex_lock(&e->lock); +e->die = 1; +ff_cond_broadcast(&e->cond); +ff_mutex_unlock(&e->lock); + +for (int i = 0; i < e->thread
[FFmpeg-cvslog] hwcontext_vulkan: guard all uses of new spec defines and fix stray bracket
ffmpeg | branch: master | Lynne | Fri Oct 4 10:37:54 2024 +0200| [ac092c6707d8fc9adee1f20c45ff384280fafe3a] | committer: Lynne hwcontext_vulkan: guard all uses of new spec defines and fix stray bracket This fixes compilation with less recent Vulkan headers. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac092c6707d8fc9adee1f20c45ff384280fafe3a --- libavutil/hwcontext_vulkan.c | 5 - libavutil/vulkan_loader.h| 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index af187d6840..278848fc1b 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -281,7 +281,10 @@ static void device_features_copy_needed(VulkanDeviceFeatures *dst, VulkanDeviceF COPY_VAL(atomic_float.shaderBufferFloat32Atomics); COPY_VAL(atomic_float.shaderBufferFloat32AtomicAdd); + +#ifdef VK_KHR_shader_relaxed_extended_instruction COPY_VAL(relaxed_extended_instruction.shaderRelaxedExtendedInstruction); +#endif COPY_VAL(optical_flow.opticalFlow); #undef COPY_VAL @@ -774,8 +777,8 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, err = AVERROR(EINVAL); goto fail; } -#endif } +#endif if (user_exts_str) { char *save, *token = av_strtok(user_exts_str, "+", &save); diff --git a/libavutil/vulkan_loader.h b/libavutil/vulkan_loader.h index 12e9884b8c..3253863a62 100644 --- a/libavutil/vulkan_loader.h +++ b/libavutil/vulkan_loader.h @@ -44,7 +44,9 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions, { VK_EXT_DEBUG_UTILS_EXTENSION_NAME, FF_VK_EXT_DEBUG_UTILS}, /* Device extensions */ +#ifdef VK_KHR_shader_relaxed_extended_instruction { VK_KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME, FF_VK_EXT_RELAXED_EXTENDED_INSTR }, +#endif { VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_DMABUF_MEMORY }, { VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME, FF_VK_EXT_DRM_MODIFIER_FLAGS }, { VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_MEMORY }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] av1dec: Don't crash if decoding of some frames have failed
ffmpeg | branch: master | Martin Storsjö | Wed Sep 25 15:04:57 2024 +0300| [a27f3c590f08bdc91e26ba39f9ea4adc1bbe79a5] | committer: Martin Storsjö av1dec: Don't crash if decoding of some frames have failed If decoding with hwaccel, but decoding fails, these pointers are null at this point. Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a27f3c590f08bdc91e26ba39f9ea4adc1bbe79a5 --- libavcodec/av1dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 6a9de07d16..bc4ef63e68 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -281,6 +281,8 @@ static void skip_mode_params(AV1DecContext *s) forward_idx = -1; backward_idx = -1; for (i = 0; i < AV1_REFS_PER_FRAME; i++) { +if (!s->ref[header->ref_frame_idx[i]].raw_frame_header) +return; ref_hint = s->ref[header->ref_frame_idx[i]].raw_frame_header->order_hint; dist = get_relative_dist(seq, ref_hint, header->order_hint); if (dist < 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavcodec: x86: Remove an explicit include of config.asm
ffmpeg | branch: master | Martin Storsjö | Tue Oct 1 23:59:41 2024 +0300| [5c4ede6b4ff6fa8818f0ca3f686aa54c1c2092b8] | committer: Martin Storsjö libavcodec: x86: Remove an explicit include of config.asm This file is never included explicitly anywhere else, it's only included implicitly by passing -Pconfig.asm on the command line. Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c4ede6b4ff6fa8818f0ca3f686aa54c1c2092b8 --- libavcodec/x86/celt_pvq_search.asm | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/x86/celt_pvq_search.asm b/libavcodec/x86/celt_pvq_search.asm index e9bff02650..3c6974d370 100644 --- a/libavcodec/x86/celt_pvq_search.asm +++ b/libavcodec/x86/celt_pvq_search.asm @@ -20,7 +20,6 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;** -%include "config.asm" %include "libavutil/x86/x86util.asm" %ifdef __NASM_VER__ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] configure: Enable -Wno-implicit-const-int-float-conversion if available
ffmpeg | branch: master | Martin Storsjö | Wed Oct 2 15:00:33 2024 +0300| [2705c0bd81e7fcfc67dbf05d7358e3c4ba935d18] | committer: Martin Storsjö configure: Enable -Wno-implicit-const-int-float-conversion if available This silences a lot of compile warnings (around 160 instances at least), when compiling with Clang. These warnings look like this: libavformat/http.c:176:133: warning: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion] 176 | { "end_offset", "try to limit the request to bytes preceding this offset", OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D }, | ~ ^ Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2705c0bd81e7fcfc67dbf05d7358e3c4ba935d18 --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 0247ea08d6..77a9395650 100755 --- a/configure +++ b/configure @@ -7460,6 +7460,7 @@ check_disable_warning -Wno-pointer-sign check_disable_warning -Wno-unused-const-variable check_disable_warning -Wno-bool-operation check_disable_warning -Wno-char-subscripts +check_disable_warning -Wno-implicit-const-int-float-conversion check_disable_warning_headers(){ warning_flag=-W${1#-Wno-} ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/buffersink: move the option sanity check to init
ffmpeg | branch: master | Anton Khirnov | Wed Sep 25 10:52:19 2024 +0200| [2aad37ffb5e898b92c018eeb4f62154a16c41e63] | committer: Anton Khirnov lavfi/buffersink: move the option sanity check to init Options are set before init, so that is the appropriate place to validate them. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2aad37ffb5e898b92c018eeb4f62154a16c41e63 --- libavfilter/buffersink.c | 60 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 0cfac2abd5..95cb605712 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -155,6 +155,41 @@ static av_cold int common_init(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; +#if FF_API_BUFFERSINK_OPTS + +#define CHECK_LIST_SIZE(field) \ +if (buf->field ## _size % sizeof(*buf->field)) { \ +av_log(ctx, AV_LOG_ERROR, "Invalid size for " #field ": %d, " \ + "should be multiple of %d\n", \ + buf->field ## _size, (int)sizeof(*buf->field)); \ +return AVERROR(EINVAL); \ +} + +if (ctx->input_pads[0].type == AVMEDIA_TYPE_VIDEO) { +if ((buf->pixel_fmts_size || buf->color_spaces_size || buf->color_ranges_size) && +(buf->nb_pixel_formats || buf->nb_colorspaces || buf->nb_colorranges)) { +av_log(ctx, AV_LOG_ERROR, "Cannot combine old and new format lists\n"); +return AVERROR(EINVAL); +} + +CHECK_LIST_SIZE(pixel_fmts) +CHECK_LIST_SIZE(color_spaces) +CHECK_LIST_SIZE(color_ranges) +} else { +if ((buf->sample_fmts_size || buf->channel_layouts_str || buf->sample_rates_size) && +(buf->nb_sample_formats || buf->nb_samplerates || buf->nb_channel_layouts)) { +av_log(ctx, AV_LOG_ERROR, "Cannot combine old and new format lists\n"); +return AVERROR(EINVAL); +} + +CHECK_LIST_SIZE(sample_fmts) +CHECK_LIST_SIZE(sample_rates) +} + +#undef CHECK_LIST_SIZE + +#endif + buf->warning_limit = 100; return 0; } @@ -291,14 +326,6 @@ int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out #if FF_API_BUFFERSINK_OPTS #define NB_ITEMS(list) (list ## _size / sizeof(*list)) - -#define CHECK_LIST_SIZE(field) \ -if (buf->field ## _size % sizeof(*buf->field)) { \ -av_log(ctx, AV_LOG_ERROR, "Invalid size for " #field ": %d, " \ - "should be multiple of %d\n", \ - buf->field ## _size, (int)sizeof(*buf->field)); \ -return AVERROR(EINVAL); \ -} #endif static int vsink_query_formats(AVFilterContext *ctx) @@ -307,12 +334,6 @@ static int vsink_query_formats(AVFilterContext *ctx) int ret; #if FF_API_BUFFERSINK_OPTS -if ((buf->pixel_fmts_size || buf->color_spaces_size || buf->color_ranges_size) && -(buf->nb_pixel_formats || buf->nb_colorspaces || buf->nb_colorranges)) { -av_log(ctx, AV_LOG_ERROR, "Cannot combine old and new format lists\n"); -return AVERROR(EINVAL); -} - if (buf->nb_pixel_formats || buf->nb_colorspaces || buf->nb_colorranges) { #endif if (buf->nb_pixel_formats) { @@ -333,9 +354,6 @@ static int vsink_query_formats(AVFilterContext *ctx) #if FF_API_BUFFERSINK_OPTS } else { unsigned i; -CHECK_LIST_SIZE(pixel_fmts) -CHECK_LIST_SIZE(color_spaces) -CHECK_LIST_SIZE(color_ranges) if (buf->pixel_fmts_size) { AVFilterFormats *formats = NULL; for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++) @@ -374,12 +392,6 @@ static int asink_query_formats(AVFilterContext *ctx) int ret; #if FF_API_BUFFERSINK_OPTS -if ((buf->sample_fmts_size || buf->channel_layouts_str || buf->sample_rates_size) && -(buf->nb_sample_formats || buf->nb_samplerates || buf->nb_channel_layouts)) { -av_log(ctx, AV_LOG_ERROR, "Cannot combine old and new format lists\n"); -return AVERROR(EINVAL); -} - if (buf->nb_sample_formats || buf->nb_samplerates || buf->nb_channel_layouts) { #endif if (buf->nb_sample_formats) { @@ -403,8 +415,6 @@ static int asink_query_formats(AVFilterContext *ctx) AVChannelLayout layout = { 0 }; AVFilterChannelLayouts *layouts = NULL; unsigned i; -CHECK_LIST_SIZE(sample_fmts) -CHECK_LIST_SIZE(sample_rates) if (buf->sample_fmts_size) { for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/buffersink: move channel layout parsing to init
ffmpeg | branch: master | Anton Khirnov | Wed Sep 25 11:09:58 2024 +0200| [b8bf2f4e1758a9f7f34160245b5f663d53159c2d] | committer: Anton Khirnov lavfi/buffersink: move channel layout parsing to init That is a more appropriate place for this, and will also be useful in future commits. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8bf2f4e1758a9f7f34160245b5f663d53159c2d --- libavfilter/buffersink.c | 75 +++- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 95cb605712..0eded68b55 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -154,6 +154,7 @@ int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx, static av_cold int common_init(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; +int ret = 0; #if FF_API_BUFFERSINK_OPTS @@ -184,6 +185,44 @@ static av_cold int common_init(AVFilterContext *ctx) CHECK_LIST_SIZE(sample_fmts) CHECK_LIST_SIZE(sample_rates) + +if (buf->channel_layouts_str) { +const char *cur = buf->channel_layouts_str; + +if (buf->all_channel_counts) +av_log(ctx, AV_LOG_WARNING, + "Conflicting all_channel_counts and list in options\n"); + +while (cur) { +void *tmp; +char *next = strchr(cur, '|'); +if (next) +*next++ = 0; + +// +2 for the new element and terminator +tmp = av_realloc_array(buf->channel_layouts, buf->nb_channel_layouts + 2, + sizeof(*buf->channel_layouts)); +if (!tmp) +return AVERROR(ENOMEM); + +memset(&buf->channel_layouts[buf->nb_channel_layouts], 0, + sizeof(*buf->channel_layouts)); +buf->nb_channel_layouts++; + +ret = av_channel_layout_from_string(&buf->channel_layouts[buf->nb_channel_layouts - 1], cur); +if (ret < 0) { +av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: %s.\n", cur); +return ret; +} +if (ret < 0) +return ret; + +cur = next; +} + +if (buf->nb_channel_layouts) +buf->channel_layouts[buf->nb_channel_layouts] = (AVChannelLayout){ 0 }; +} } #undef CHECK_LIST_SIZE @@ -412,8 +451,6 @@ static int asink_query_formats(AVFilterContext *ctx) #if FF_API_BUFFERSINK_OPTS } else { AVFilterFormats *formats = NULL; -AVChannelLayout layout = { 0 }; -AVFilterChannelLayouts *layouts = NULL; unsigned i; if (buf->sample_fmts_size) { @@ -424,37 +461,9 @@ static int asink_query_formats(AVFilterContext *ctx) return ret; } -if (buf->channel_layouts_str || buf->all_channel_counts) { -if (buf->channel_layouts_str) { -const char *cur = buf->channel_layouts_str; - -while (cur) { -char *next = strchr(cur, '|'); -if (next) -*next++ = 0; - -ret = av_channel_layout_from_string(&layout, cur); -if (ret < 0) { -av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: %s.\n", cur); -return ret; -} -ret = ff_add_channel_layout(&layouts, &layout); -av_channel_layout_uninit(&layout); -if (ret < 0) -return ret; - -cur = next; -} -} - -if (buf->all_channel_counts) { -if (layouts) -av_log(ctx, AV_LOG_WARNING, - "Conflicting all_channel_counts and list in options\n"); -else if (!(layouts = ff_all_channel_counts())) -return AVERROR(ENOMEM); -} -if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0) +if (buf->nb_channel_layouts) { +ret = ff_set_common_channel_layouts_from_list(ctx, buf->channel_layouts); +if (ret < 0) return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/buffersrc: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Wed Sep 25 10:38:59 2024 +0200| [670530a927214e7d7da39fc1115255489e991d10] | committer: Anton Khirnov lavfi/buffersrc: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=670530a927214e7d7da39fc1115255489e991d10 --- libavfilter/buffersrc.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 3d679cad53..bdf8b14451 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -439,9 +439,11 @@ static av_cold void uninit(AVFilterContext *ctx) av_channel_layout_uninit(&s->ch_layout); } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -BufferSourceContext *c = ctx->priv; +const BufferSourceContext *c = ctx->priv; AVFilterChannelLayouts *channel_layouts = NULL; AVFilterFormats *formats = NULL; AVFilterFormats *samplerates = NULL; @@ -455,12 +457,12 @@ static int query_formats(AVFilterContext *ctx) if (av_pix_fmt_desc_get(swfmt)->flags & AV_PIX_FMT_FLAG_HWACCEL) swfmt = ((AVHWFramesContext *) c->hw_frames_ctx->data)->sw_format; if ((ret = ff_add_format (&formats, c->pix_fmt)) < 0 || -(ret = ff_set_common_formats (ctx , formats )) < 0) +(ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, formats)) < 0) return ret; /* force specific colorspace/range downstream only for ordinary YUV */ if (ff_fmt_is_regular_yuv(swfmt)) { if ((ret = ff_add_format(&color_spaces, c->color_space)) < 0 || -(ret = ff_set_common_color_spaces(ctx, color_spaces)) < 0) +(ret = ff_set_common_color_spaces2(ctx, cfg_in, cfg_out, color_spaces)) < 0) return ret; if (ff_fmt_is_forced_full_range(swfmt)) { if ((ret = ff_add_format(&color_ranges, AVCOL_RANGE_JPEG)) < 0) @@ -474,21 +476,21 @@ static int query_formats(AVFilterContext *ctx) return ret; } } -if ((ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0) +if ((ret = ff_set_common_color_ranges2(ctx, cfg_in, cfg_out, color_ranges)) < 0) return ret; } break; } case AVMEDIA_TYPE_AUDIO: if ((ret = ff_add_format (&formats, c->sample_fmt )) < 0 || -(ret = ff_set_common_formats (ctx , formats )) < 0 || +(ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, formats)) < 0 || (ret = ff_add_format (&samplerates, c->sample_rate)) < 0 || -(ret = ff_set_common_samplerates (ctx , samplerates )) < 0) +(ret = ff_set_common_samplerates2(ctx, cfg_in, cfg_out, samplerates)) < 0) return ret; if ((ret = ff_add_channel_layout(&channel_layouts, &c->ch_layout)) < 0) return ret; -if ((ret = ff_set_common_channel_layouts(ctx, channel_layouts)) < 0) +if ((ret = ff_set_common_channel_layouts2(ctx, cfg_in, cfg_out, channel_layouts)) < 0) return ret; break; default: @@ -567,7 +569,7 @@ const AVFilter ff_vsrc_buffer = { .inputs= NULL, FILTER_OUTPUTS(avfilter_vsrc_buffer_outputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), .priv_class = &buffer_class, }; @@ -589,6 +591,6 @@ const AVFilter ff_asrc_abuffer = { .inputs= NULL, FILTER_OUTPUTS(avfilter_asrc_abuffer_outputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), .priv_class = &abuffer_class, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/buffersink: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Wed Sep 25 10:38:59 2024 +0200| [2fa142f7c023fc4d8bad950d53ff41c6772756df] | committer: Anton Khirnov lavfi/buffersink: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fa142f7c023fc4d8bad950d53ff41c6772756df --- libavfilter/buffersink.c | 40 ++-- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 0eded68b55..b0bcc26432 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -367,26 +367,28 @@ int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out #define NB_ITEMS(list) (list ## _size / sizeof(*list)) #endif -static int vsink_query_formats(AVFilterContext *ctx) +static int vsink_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -BufferSinkContext *buf = ctx->priv; +const BufferSinkContext *buf = ctx->priv; int ret; #if FF_API_BUFFERSINK_OPTS if (buf->nb_pixel_formats || buf->nb_colorspaces || buf->nb_colorranges) { #endif if (buf->nb_pixel_formats) { -ret = ff_set_common_formats_from_list(ctx, buf->pixel_formats); +ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, buf->pixel_formats); if (ret < 0) return ret; } if (buf->nb_colorspaces) { -ret = ff_set_common_color_spaces_from_list(ctx, buf->colorspaces); +ret = ff_set_common_color_spaces_from_list2(ctx, cfg_in, cfg_out, buf->colorspaces); if (ret < 0) return ret; } if (buf->nb_colorranges) { -ret = ff_set_common_color_ranges_from_list(ctx, buf->colorranges); +ret = ff_set_common_color_ranges_from_list2(ctx, cfg_in, cfg_out, buf->colorranges); if (ret < 0) return ret; } @@ -398,7 +400,7 @@ static int vsink_query_formats(AVFilterContext *ctx) for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++) if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0) return ret; -if ((ret = ff_set_common_formats(ctx, formats)) < 0) +if ((ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, formats)) < 0) return ret; } @@ -407,7 +409,7 @@ static int vsink_query_formats(AVFilterContext *ctx) for (i = 0; i < NB_ITEMS(buf->color_spaces); i++) if ((ret = ff_add_format(&formats, buf->color_spaces[i])) < 0) return ret; -if ((ret = ff_set_common_color_spaces(ctx, formats)) < 0) +if ((ret = ff_set_common_color_spaces2(ctx, cfg_in, cfg_out, formats)) < 0) return ret; } @@ -416,7 +418,7 @@ static int vsink_query_formats(AVFilterContext *ctx) for (i = 0; i < NB_ITEMS(buf->color_ranges); i++) if ((ret = ff_add_format(&formats, buf->color_ranges[i])) < 0) return ret; -if ((ret = ff_set_common_color_ranges(ctx, formats)) < 0) +if ((ret = ff_set_common_color_ranges2(ctx, cfg_in, cfg_out, formats)) < 0) return ret; } } @@ -425,26 +427,28 @@ static int vsink_query_formats(AVFilterContext *ctx) return 0; } -static int asink_query_formats(AVFilterContext *ctx) +static int asink_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -BufferSinkContext *buf = ctx->priv; +const BufferSinkContext *buf = ctx->priv; int ret; #if FF_API_BUFFERSINK_OPTS if (buf->nb_sample_formats || buf->nb_samplerates || buf->nb_channel_layouts) { #endif if (buf->nb_sample_formats) { -ret = ff_set_common_formats_from_list(ctx, buf->sample_formats); +ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, buf->sample_formats); if (ret < 0) return ret; } if (buf->nb_samplerates) { -ret = ff_set_common_samplerates_from_list(ctx, buf->samplerates); +ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, buf->samplerates); if (ret < 0) return ret; } if (buf->nb_channel_layouts) { -ret = ff_set_common_channel_layouts_from_list(ctx, buf->channel_layouts); +ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, buf->channel_layouts); if (ret < 0) return ret; } @@ -457,12 +461,12 @@ static int asink_query_formats(AVFilterContext *ctx) for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++) if ((ret = ff_add_format(&formats, buf->sample_fmts[i])) < 0) return ret; -if ((r
[FFmpeg-cvslog] lavfi/buffersrc: validate hw context presence in video_init()
ffmpeg | branch: master | Anton Khirnov | Wed Sep 25 11:24:52 2024 +0200| [a7fe27f9647e00041dcd079183bddabc998b6b31] | committer: Anton Khirnov lavfi/buffersrc: validate hw context presence in video_init() That is the more appropriate place for it than query_formats(). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7fe27f9647e00041dcd079183bddabc998b6b31 --- libavfilter/buffersrc.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index b5682006f0..3d679cad53 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -291,6 +291,13 @@ static av_cold int init_video(AVFilterContext *ctx) av_log(ctx, AV_LOG_ERROR, "Unspecified pixel format\n"); return AVERROR(EINVAL); } +if (av_pix_fmt_desc_get(c->pix_fmt)->flags & AV_PIX_FMT_FLAG_HWACCEL) { +if (!c->hw_frames_ctx) { +av_log(ctx, AV_LOG_ERROR, "Setting BufferSourceContext.pix_fmt " + "to a HW format requires hw_frames_ctx to be non-NULL!\n"); +return AVERROR(EINVAL); +} +} if (c->w <= 0 || c->h <= 0) { av_log(ctx, AV_LOG_ERROR, "Invalid size %dx%d\n", c->w, c->h); return AVERROR(EINVAL); @@ -445,14 +452,8 @@ static int query_formats(AVFilterContext *ctx) switch (ctx->outputs[0]->type) { case AVMEDIA_TYPE_VIDEO: { enum AVPixelFormat swfmt = c->pix_fmt; -if (av_pix_fmt_desc_get(swfmt)->flags & AV_PIX_FMT_FLAG_HWACCEL) { -if (!c->hw_frames_ctx) { -av_log(ctx, AV_LOG_ERROR, "Setting BufferSourceContext.pix_fmt " - "to a HW format requires hw_frames_ctx to be non-NULL!\n"); -return AVERROR(EINVAL); -} +if (av_pix_fmt_desc_get(swfmt)->flags & AV_PIX_FMT_FLAG_HWACCEL) swfmt = ((AVHWFramesContext *) c->hw_frames_ctx->data)->sw_format; -} if ((ret = ff_add_format (&formats, c->pix_fmt)) < 0 || (ret = ff_set_common_formats (ctx , formats )) < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/f_drawgraph: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [4e66d0c5d05701dbde7ef439cff733f1aab57fa8] | committer: Anton Khirnov lavfi/f_drawgraph: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e66d0c5d05701dbde7ef439cff733f1aab57fa8 --- libavfilter/f_drawgraph.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavfilter/f_drawgraph.c b/libavfilter/f_drawgraph.c index 7c6a83be7d..24288a1175 100644 --- a/libavfilter/f_drawgraph.c +++ b/libavfilter/f_drawgraph.c @@ -127,9 +127,10 @@ static av_cold int init(AVFilterContext *ctx) return 0; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -AVFilterLink *outlink = ctx->outputs[0]; static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE @@ -137,7 +138,7 @@ static int query_formats(AVFilterContext *ctx) int ret; AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); -if ((ret = ff_formats_ref(fmts_list, &outlink->incfg.formats)) < 0) +if ((ret = ff_formats_ref(fmts_list, &cfg_out[0]->formats)) < 0) return ret; return 0; @@ -482,7 +483,7 @@ const AVFilter ff_vf_drawgraph = { .uninit= uninit, FILTER_INPUTS(drawgraph_inputs), FILTER_OUTPUTS(drawgraph_outputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), }; #endif // CONFIG_DRAWGRAPH_FILTER @@ -506,6 +507,6 @@ const AVFilter ff_avf_adrawgraph = { .uninit= uninit, FILTER_INPUTS(adrawgraph_inputs), FILTER_OUTPUTS(drawgraph_outputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), }; #endif // CONFIG_ADRAWGRAPH_FILTER ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/f_graphmonitor: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [9e1184b122d308a721c4dc421e30e1f21c69314f] | committer: Anton Khirnov lavfi/f_graphmonitor: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e1184b122d308a721c4dc421e30e1f21c69314f --- libavfilter/f_graphmonitor.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavfilter/f_graphmonitor.c b/libavfilter/f_graphmonitor.c index 0ed1085610..453d1e82de 100644 --- a/libavfilter/f_graphmonitor.c +++ b/libavfilter/f_graphmonitor.c @@ -146,9 +146,10 @@ static av_cold int init(AVFilterContext *ctx) return 0; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -AVFilterLink *outlink = ctx->outputs[0]; static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE @@ -156,7 +157,7 @@ static int query_formats(AVFilterContext *ctx) int ret; AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); -if ((ret = ff_formats_ref(fmts_list, &outlink->incfg.formats)) < 0) +if ((ret = ff_formats_ref(fmts_list, &cfg_out[0]->formats)) < 0) return ret; return 0; @@ -587,7 +588,7 @@ const AVFilter ff_vf_graphmonitor = { .activate = activate, FILTER_INPUTS(ff_video_default_filterpad), FILTER_OUTPUTS(graphmonitor_outputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), .process_command = ff_filter_process_command, }; @@ -605,7 +606,7 @@ const AVFilter ff_avf_agraphmonitor = { .activate = activate, FILTER_INPUTS(ff_audio_default_filterpad), FILTER_OUTPUTS(graphmonitor_outputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), .process_command = ff_filter_process_command, }; #endif // CONFIG_AGRAPHMONITOR_FILTER ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/f_ebur128: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [60192367a8f363f7a8deb13495c37d6c74af8ac4] | committer: Anton Khirnov lavfi/f_ebur128: switch to query_func2() Also, drop redundant calls that also happen implicitly in generic code. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60192367a8f363f7a8deb13495c37d6c74af8ac4 --- libavfilter/f_ebur128.c | 30 ++ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index f71c230b45..8760c74f78 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -1005,13 +1005,13 @@ static int activate(AVFilterContext *ctx) return ret; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -EBUR128Context *ebur128 = ctx->priv; +const EBUR128Context *ebur128 = ctx->priv; AVFilterFormats *formats; -AVFilterChannelLayouts *layouts; -AVFilterLink *inlink = ctx->inputs[0]; -AVFilterLink *outlink = ctx->outputs[0]; +int out_idx = 0; int ret; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; @@ -1020,27 +1020,17 @@ static int query_formats(AVFilterContext *ctx) /* set optional output video format */ if (ebur128->do_video) { formats = ff_make_format_list(pix_fmts); -if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0) +if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0) return ret; -outlink = ctx->outputs[1]; +out_idx = 1; } /* set input and output audio formats * Note: ff_set_common_* functions are not used because they affect all the * links, and thus break the video format negotiation */ formats = ff_make_format_list(sample_fmts); -if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0 || -(ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0) -return ret; - -layouts = ff_all_channel_layouts(); -if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0 || -(ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts)) < 0) -return ret; - -formats = ff_all_samplerates(); -if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0 || -(ret = ff_formats_ref(formats, &outlink->incfg.samplerates)) < 0) +if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0 || +(ret = ff_formats_ref(formats, &cfg_out[out_idx]->formats)) < 0) return ret; return 0; @@ -1128,7 +1118,7 @@ const AVFilter ff_af_ebur128 = { .activate = activate, FILTER_INPUTS(ebur128_inputs), .outputs = NULL, -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), .priv_class= &ebur128_class, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/f_select: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [a6f579544aeaf28d4028ad64a23abf074f7e20ad] | committer: Anton Khirnov lavfi/f_select: switch to query_func2() Also, drop redundant calls that also happen implicitly in generic code. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6f579544aeaf28d4028ad64a23abf074f7e20ad --- libavfilter/f_select.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index ba0ae31f1b..744fef6906 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -515,13 +515,13 @@ const AVFilter ff_af_aselect = { #if CONFIG_SELECT_FILTER -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -SelectContext *select = ctx->priv; +const SelectContext *select = ctx->priv; -if (!select->do_scene_detect) { -return ff_default_query_formats(ctx); -} else { +if (select->do_scene_detect) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, @@ -530,8 +530,9 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P10, AV_PIX_FMT_NONE }; -return ff_set_common_formats_from_list(ctx, pix_fmts); +return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, pix_fmts); } +return 0; } DEFINE_OPTIONS(select, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM); @@ -564,7 +565,7 @@ const AVFilter ff_vf_select = { .priv_size = sizeof(SelectContext), .priv_class= &select_class, FILTER_INPUTS(avfilter_vf_select_inputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_METADATA_ONLY, }; #endif /* CONFIG_SELECT_FILTER */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/f_streamselect: drop useless query_formats() callback
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:15:18 2024 +0200| [f10986a5ec25df772e1af7ce1c9011a1a4ed2893] | committer: Anton Khirnov lavfi/f_streamselect: drop useless query_formats() callback It achieves the same effect as ff_default_query_formats(), which gets called implicitly. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f10986a5ec25df772e1af7ce1c9011a1a4ed2893 --- libavfilter/f_streamselect.c | 22 -- 1 file changed, 22 deletions(-) diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c index 4ff4e856ea..2afd22d4a3 100644 --- a/libavfilter/f_streamselect.c +++ b/libavfilter/f_streamselect.c @@ -296,31 +296,10 @@ static av_cold void uninit(AVFilterContext *ctx) ff_framesync_uninit(&s->fs); } -static int query_formats(AVFilterContext *ctx) -{ -AVFilterFormats *formats; -int ret, i; - -for (i = 0; i < ctx->nb_inputs; i++) { -formats = ff_all_formats(ctx->inputs[i]->type); -if ((ret = ff_set_common_formats(ctx, formats)) < 0) -return ret; - -if (ctx->inputs[i]->type == AVMEDIA_TYPE_AUDIO) { -if ((ret = ff_set_common_all_samplerates (ctx)) < 0 || -(ret = ff_set_common_all_channel_counts(ctx)) < 0) -return ret; -} -} - -return 0; -} - const AVFilter ff_vf_streamselect = { .name= "streamselect", .description = NULL_IF_CONFIG_SMALL("Select video streams"), .init= init, -FILTER_QUERY_FUNC(query_formats), .process_command = process_command, .uninit = uninit, .activate= activate, @@ -334,7 +313,6 @@ const AVFilter ff_af_astreamselect = { .description = NULL_IF_CONFIG_SMALL("Select audio streams"), .priv_class = &streamselect_class, .init= init, -FILTER_QUERY_FUNC(query_formats), .process_command = process_command, .uninit = uninit, .activate= activate, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/src_avsynctest: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [55c99fb9c4e3997b38450cb459714691d94bc7a3] | committer: Anton Khirnov lavfi/src_avsynctest: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55c99fb9c4e3997b38450cb459714691d94bc7a3 --- libavfilter/src_avsynctest.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libavfilter/src_avsynctest.c b/libavfilter/src_avsynctest.c index f78cdd1dec..c46281c72b 100644 --- a/libavfilter/src_avsynctest.c +++ b/libavfilter/src_avsynctest.c @@ -93,39 +93,39 @@ static const AVOption avsynctest_options[] = { AVFILTER_DEFINE_CLASS(avsynctest); -static av_cold int query_formats(AVFilterContext *ctx) +static av_cold int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -AVSyncTestContext *s = ctx->priv; -AVFilterChannelLayouts *chlayout = NULL; +const AVSyncTestContext *s = ctx->priv; int sample_rates[] = { s->sample_rate, -1 }; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE }; +static const AVChannelLayout layouts[] = { +AV_CHANNEL_LAYOUT_MONO, +{ .nb_channels = 0 }, +}; AVFilterFormats *formats; int ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); -if ((ret = ff_formats_ref(formats, &ctx->outputs[0]->incfg.formats)) < 0) +if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0) return ret; formats = ff_draw_supported_pixel_formats(0); if (!formats) return AVERROR(ENOMEM); -if ((ret = ff_formats_ref(formats, &ctx->outputs[1]->incfg.formats)) < 0) +if ((ret = ff_formats_ref(formats, &cfg_out[1]->formats)) < 0) return ret; -if ((ret = ff_add_channel_layout(&chlayout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO)) < 0) -return ret; -ret = ff_set_common_channel_layouts(ctx, chlayout); +ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); if (ret < 0) return ret; -formats = ff_make_format_list(sample_rates); -if (!formats) -return AVERROR(ENOMEM); -return ff_set_common_samplerates(ctx, formats); +return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates); } static av_cold int aconfig_props(AVFilterLink *outlink) @@ -404,6 +404,6 @@ const AVFilter ff_avsrc_avsynctest = { .inputs= NULL, .activate = activate, FILTER_OUTPUTS(avsynctest_outputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), .process_command = ff_filter_process_command, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/vaf_spectrumsynth: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [28bde4a1418b519f55999f35dc594d26bc13fefa] | committer: Anton Khirnov lavfi/vaf_spectrumsynth: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28bde4a1418b519f55999f35dc594d26bc13fefa --- libavfilter/vaf_spectrumsynth.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libavfilter/vaf_spectrumsynth.c b/libavfilter/vaf_spectrumsynth.c index a62151aa4f..c8d3525b7b 100644 --- a/libavfilter/vaf_spectrumsynth.c +++ b/libavfilter/vaf_spectrumsynth.c @@ -93,14 +93,18 @@ static const AVOption spectrumsynth_options[] = { AVFILTER_DEFINE_CLASS(spectrumsynth); -static int query_formats(AVFilterContext *ctx) +enum { +MAGNITUDE = 0, +PHASE = 1, +}; + +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -SpectrumSynthContext *s = ctx->priv; +const SpectrumSynthContext *s = ctx->priv; AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layout = NULL; -AVFilterLink *magnitude = ctx->inputs[0]; -AVFilterLink *phase = ctx->inputs[1]; -AVFilterLink *outlink = ctx->outputs[0]; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P, @@ -108,28 +112,28 @@ static int query_formats(AVFilterContext *ctx) int ret, sample_rates[] = { 48000, -1 }; formats = ff_make_format_list(sample_fmts); -if ((ret = ff_formats_ref (formats, &outlink->incfg.formats )) < 0 || +if ((ret = ff_formats_ref (formats, &cfg_out[0]->formats )) < 0 || (ret = ff_add_channel_layout (&layout, &FF_COUNT2LAYOUT(s->channels))) < 0 || -(ret = ff_channel_layouts_ref (layout , &outlink->incfg.channel_layouts)) < 0) +(ret = ff_channel_layouts_ref (layout , &cfg_out[0]->channel_layouts)) < 0) return ret; sample_rates[0] = s->sample_rate; formats = ff_make_format_list(sample_rates); if (!formats) return AVERROR(ENOMEM); -if ((ret = ff_formats_ref(formats, &outlink->incfg.samplerates)) < 0) +if ((ret = ff_formats_ref(formats, &cfg_out[0]->samplerates)) < 0) return ret; formats = ff_make_format_list(pix_fmts); if (!formats) return AVERROR(ENOMEM); -if ((ret = ff_formats_ref(formats, &magnitude->outcfg.formats)) < 0) +if ((ret = ff_formats_ref(formats, &cfg_in[MAGNITUDE]->formats)) < 0) return ret; formats = ff_make_format_list(pix_fmts); if (!formats) return AVERROR(ENOMEM); -if ((ret = ff_formats_ref(formats, &phase->outcfg.formats)) < 0) +if ((ret = ff_formats_ref(formats, &cfg_in[PHASE]->formats)) < 0) return ret; return 0; @@ -543,6 +547,6 @@ const AVFilter ff_vaf_spectrumsynth = { .priv_size = sizeof(SpectrumSynthContext), FILTER_INPUTS(spectrumsynth_inputs), FILTER_OUTPUTS(spectrumsynth_outputs), -FILTER_QUERY_FUNC(query_formats), +FILTER_QUERY_FUNC2(query_formats), .priv_class= &spectrumsynth_class, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/src_movie: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [014a4214a9b8690b6ed3d41d7f4cd65299317c61] | committer: Anton Khirnov lavfi/src_movie: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=014a4214a9b8690b6ed3d41d7f4cd65299317c61 --- libavfilter/src_movie.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index e7817c7ee7..65091b65f0 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -411,34 +411,36 @@ static av_cold void movie_uninit(AVFilterContext *ctx) avformat_close_input(&movie->format_ctx); } -static int movie_query_formats(AVFilterContext *ctx) +static int movie_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -MovieContext *movie = ctx->priv; +const MovieContext *movie = ctx->priv; int list[] = { 0, -1 }; AVChannelLayout list64[] = { { 0 }, { 0 } }; int i, ret; for (i = 0; i < ctx->nb_outputs; i++) { -MovieStream *st = &movie->st[i]; -AVCodecParameters *c = st->st->codecpar; -AVFilterLink *outlink = ctx->outputs[i]; +const MovieStream *st = &movie->st[i]; +const AVCodecParameters *c = st->st->codecpar; +AVFilterFormatsConfig *cfg = cfg_out[i]; switch (c->codec_type) { case AVMEDIA_TYPE_VIDEO: list[0] = c->format; -if ((ret = ff_formats_ref(ff_make_format_list(list), &outlink->incfg.formats)) < 0) +if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->formats)) < 0) return ret; break; case AVMEDIA_TYPE_AUDIO: list[0] = c->format; -if ((ret = ff_formats_ref(ff_make_format_list(list), &outlink->incfg.formats)) < 0) +if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->formats)) < 0) return ret; list[0] = c->sample_rate; -if ((ret = ff_formats_ref(ff_make_format_list(list), &outlink->incfg.samplerates)) < 0) +if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->samplerates)) < 0) return ret; list64[0] = c->ch_layout; if ((ret = ff_channel_layouts_ref(ff_make_channel_layout_list(list64), - &outlink->incfg.channel_layouts)) < 0) + &cfg->channel_layouts)) < 0) return ret; break; } @@ -681,7 +683,7 @@ const AVFilter ff_avsrc_movie = { .init = movie_common_init, .activate = activate, .uninit= movie_uninit, -FILTER_QUERY_FUNC(movie_query_formats), +FILTER_QUERY_FUNC2(movie_query_formats), .inputs= NULL, .outputs = NULL, @@ -701,7 +703,7 @@ const AVFilter ff_avsrc_amovie = { .init = movie_common_init, .activate = activate, .uninit= movie_uninit, -FILTER_QUERY_FUNC(movie_query_formats), +FILTER_QUERY_FUNC2(movie_query_formats), .inputs = NULL, .outputs= NULL, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/qrencode: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [534eef2acea153b25303f406c6de2efae067a5e7] | committer: Anton Khirnov lavfi/qrencode: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=534eef2acea153b25303f406c6de2efae067a5e7 --- libavfilter/qrencode.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libavfilter/qrencode.c b/libavfilter/qrencode.c index dae169b57f..d3f55013d3 100644 --- a/libavfilter/qrencode.c +++ b/libavfilter/qrencode.c @@ -671,7 +671,9 @@ static int request_frame(AVFilterLink *outlink) return ff_filter_frame(outlink, frame); } -static int qrencodesrc_query_formats(AVFilterContext *ctx) +static int qrencodesrc_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { enum AVPixelFormat pix_fmt; FFDrawContext draw; @@ -686,7 +688,7 @@ static int qrencodesrc_query_formats(AVFilterContext *ctx) (ret = ff_add_format(&fmts, pix_fmt)) < 0) return ret; -return ff_set_common_formats(ctx, fmts); +return ff_set_common_formats2(ctx, cfg_in, cfg_out, fmts); } static const AVFilterPad qrencodesrc_outputs[] = { @@ -707,7 +709,7 @@ const AVFilter ff_vsrc_qrencodesrc = { .uninit= uninit, .inputs= NULL, FILTER_OUTPUTS(qrencodesrc_outputs), -FILTER_QUERY_FUNC(qrencodesrc_query_formats), +FILTER_QUERY_FUNC2(qrencodesrc_query_formats), }; #endif // CONFIG_QRENCODESRC_FILTER @@ -772,9 +774,11 @@ static int qrencode_config_input(AVFilterLink *inlink) return 0; } -static int qrencode_query_formats(AVFilterContext *ctx) +static int qrencode_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); +return ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_draw_supported_pixel_formats(0)); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) @@ -818,7 +822,7 @@ const AVFilter ff_vf_qrencode = { .uninit= uninit, FILTER_INPUTS(avfilter_vf_qrencode_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), -FILTER_QUERY_FUNC(qrencode_query_formats), +FILTER_QUERY_FUNC2(qrencode_query_formats), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/vf_stack_{vaapi,qsv}: replace query_formats with a pixfmt list
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:40:51 2024 +0200| [3824ee2fafe94e2089a1d9da9c719707e4a2a19e] | committer: Anton Khirnov lavfi/vf_stack_{vaapi,qsv}: replace query_formats with a pixfmt list > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3824ee2fafe94e2089a1d9da9c719707e4a2a19e --- libavfilter/stack_internal.c | 2 +- libavfilter/vf_stack_qsv.c | 17 ++--- libavfilter/vf_stack_vaapi.c | 13 - 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/libavfilter/stack_internal.c b/libavfilter/stack_internal.c index b473fa982d..fcec119bac 100644 --- a/libavfilter/stack_internal.c +++ b/libavfilter/stack_internal.c @@ -350,7 +350,7 @@ static const AVFilterPad stack_outputs[] = { .init = api##_stack_init, \ .uninit = api##_stack_uninit, \ .activate = stack_activate, \ -FILTER_QUERY_FUNC(api##_stack_query_formats), \ +FILTER_PIXFMTS_ARRAY(api ## _stack_pix_fmts), \ FILTER_OUTPUTS(stack_outputs), \ .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, \ .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | filter_flags, \ diff --git a/libavfilter/vf_stack_qsv.c b/libavfilter/vf_stack_qsv.c index 9c4ca4abd2..82fb3c09a3 100644 --- a/libavfilter/vf_stack_qsv.c +++ b/libavfilter/vf_stack_qsv.c @@ -223,17 +223,12 @@ static av_cold void qsv_stack_uninit(AVFilterContext *ctx) av_freep(&sctx->qsv_param.ext_buf); } -static int qsv_stack_query_formats(AVFilterContext *ctx) -{ -static const enum AVPixelFormat pixel_formats[] = { -AV_PIX_FMT_NV12, -AV_PIX_FMT_P010, -AV_PIX_FMT_QSV, -AV_PIX_FMT_NONE, -}; - -return ff_set_common_formats_from_list(ctx, pixel_formats); -} +static const enum AVPixelFormat qsv_stack_pix_fmts[] = { +AV_PIX_FMT_NV12, +AV_PIX_FMT_P010, +AV_PIX_FMT_QSV, +AV_PIX_FMT_NONE, +}; #include "stack_internal.c" diff --git a/libavfilter/vf_stack_vaapi.c b/libavfilter/vf_stack_vaapi.c index 602a7825a3..9ab4d8ab5b 100644 --- a/libavfilter/vf_stack_vaapi.c +++ b/libavfilter/vf_stack_vaapi.c @@ -220,15 +220,10 @@ static av_cold void vaapi_stack_uninit(AVFilterContext *avctx) av_freep(&sctx->rects); } -static int vaapi_stack_query_formats(AVFilterContext *avctx) -{ -static const enum AVPixelFormat pixel_formats[] = { -AV_PIX_FMT_VAAPI, -AV_PIX_FMT_NONE, -}; - -return ff_set_common_formats_from_list(avctx, pixel_formats); -} +static const enum AVPixelFormat vaapi_stack_pix_fmts[] = { +AV_PIX_FMT_VAAPI, +AV_PIX_FMT_NONE, +}; #include "stack_internal.c" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/vsrc_testsrc: switch to query_func2()
ffmpeg | branch: master | Anton Khirnov | Tue Oct 1 12:02:29 2024 +0200| [aad4d5745dc974dcdca54eb409374c660309b5ea] | committer: Anton Khirnov lavfi/vsrc_testsrc: switch to query_func2() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aad4d5745dc974dcdca54eb409374c660309b5ea --- libavfilter/vsrc_testsrc.c | 47 -- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index f14e36a95b..b004d2d0e0 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -246,9 +246,11 @@ static av_cold int color_init(AVFilterContext *ctx) return init(ctx); } -static int color_query_formats(AVFilterContext *ctx) +static int color_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); +return ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_draw_supported_pixel_formats(0)); } static int color_config_props(AVFilterLink *inlink) @@ -303,7 +305,7 @@ const AVFilter ff_vsrc_color = { .activate= activate, .inputs = NULL, FILTER_OUTPUTS(color_outputs), -FILTER_QUERY_FUNC(color_query_formats), +FILTER_QUERY_FUNC2(color_query_formats), .process_command = color_process_command, }; @@ -927,9 +929,11 @@ static av_cold int test2_init(AVFilterContext *ctx) return init(ctx); } -static int test2_query_formats(AVFilterContext *ctx) +static int test2_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { -return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); +return ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_draw_supported_pixel_formats(0)); } static int test2_config_props(AVFilterLink *inlink) @@ -964,7 +968,7 @@ const AVFilter ff_vsrc_testsrc2 = { .activate = activate, .inputs= NULL, FILTER_OUTPUTS(avfilter_vsrc_testsrc2_outputs), -FILTER_QUERY_FUNC(test2_query_formats), +FILTER_QUERY_FUNC2(test2_query_formats), }; #endif /* CONFIG_TESTSRC2_FILTER */ @@ -1410,7 +1414,9 @@ static const enum AVPixelFormat smptebars_pix_fmts[] = { AV_PIX_FMT_NONE, }; -static int smptebars_query_formats(AVFilterContext *ctx) +static int smptebars_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { enum AVColorSpace csp; int ret; @@ -1421,11 +1427,13 @@ static int smptebars_query_formats(AVFilterContext *ctx) csp = AVCOL_SPC_BT470BG; } -if ((ret = ff_set_common_color_spaces(ctx, ff_make_formats_list_singleton(csp +if ((ret = ff_set_common_color_spaces2(ctx, cfg_in, cfg_out, + ff_make_formats_list_singleton(csp return ret; -if ((ret = ff_set_common_color_ranges(ctx, ff_make_formats_list_singleton(AVCOL_RANGE_MPEG +if ((ret = ff_set_common_color_ranges2(ctx, cfg_in, cfg_out, + ff_make_formats_list_singleton(AVCOL_RANGE_MPEG return ret; -return ff_set_common_formats_from_list(ctx, smptebars_pix_fmts); +return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, smptebars_pix_fmts); } AVFILTER_DEFINE_CLASS_EXT(palbars, "pal(75|100)bars", options); @@ -1468,7 +1476,7 @@ const AVFilter ff_vsrc_pal75bars = { .activate = activate, .inputs= NULL, FILTER_OUTPUTS(outputs), -FILTER_QUERY_FUNC(smptebars_query_formats), +FILTER_QUERY_FUNC2(smptebars_query_formats), }; #endif /* CONFIG_PAL75BARS_FILTER */ @@ -1509,7 +1517,7 @@ const AVFilter ff_vsrc_pal100bars = { .activate = activate, .inputs= NULL, FILTER_OUTPUTS(outputs), -FILTER_QUERY_FUNC(smptebars_query_formats), +FILTER_QUERY_FUNC2(smptebars_query_formats), }; #endif /* CONFIG_PAL100BARS_FILTER */ @@ -1574,7 +1582,7 @@ const AVFilter ff_vsrc_smptebars = { .activate = activate, .inputs= NULL, FILTER_OUTPUTS(outputs), -FILTER_QUERY_FUNC(smptebars_query_formats), +FILTER_QUERY_FUNC2(smptebars_query_formats), }; #endif /* CONFIG_SMPTEBARS_FILTER */ @@ -1675,7 +1683,7 @@ const AVFilter ff_vsrc_smptehdbars = { .activate = activate, .inputs= NULL, FILTER_OUTPUTS(outputs), -FILTER_QUERY_FUNC(smptebars_query_formats), +FILTER_QUERY_FUNC2(smptebars_query_formats), }; #endif /* CONFIG_SMPTEHDBARS_FILTER */ @@ -2193,12 +2201,15 @@ static const enum AVPixelFormat zoneplate_pix_fmts[] = { AV_PIX_FMT_NONE, }; -static int zoneplate_query_formats(AVFilterContex
[FFmpeg-cvslog] fftools: do not access out of bounds filtergraph
ffmpeg | branch: master | Marvin Scholz | Tue Oct 1 02:57:11 2024 +0200| [5beeb3a1f97d8f6d4076fe83aaf5e2e5871f945e] | committer: Marvin Scholz fftools: do not access out of bounds filtergraph The log message was logged for `filtergraphs[j]` which would cause a heap buffer overflow in certain circumstances. Correctly it should be logged for the current filtergraph, so just use `fg` here. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5beeb3a1f97d8f6d4076fe83aaf5e2e5871f945e --- fftools/ffmpeg_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 2ff7c4c4f4..ddcd18dd15 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1409,7 +1409,7 @@ int fg_finalise_bindings(void) for (int j = 0; j < fg->nb_outputs; j++) { OutputFilter *output = fg->outputs[j]; if (!output->bound) { -av_log(filtergraphs[j], AV_LOG_FATAL, +av_log(fg, AV_LOG_FATAL, "Filter %s has an unconnected output\n", output->name); return AVERROR(EINVAL); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools: log unconnected filter output label
ffmpeg | branch: master | Marvin Scholz | Tue Oct 1 03:20:04 2024 +0200| [f25c9cc213c7e3eb585d3339eb775b16921c4d98] | committer: Marvin Scholz fftools: log unconnected filter output label > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f25c9cc213c7e3eb585d3339eb775b16921c4d98 --- fftools/ffmpeg_filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index ddcd18dd15..b1ca710999 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1410,7 +1410,9 @@ int fg_finalise_bindings(void) OutputFilter *output = fg->outputs[j]; if (!output->bound) { av_log(fg, AV_LOG_FATAL, - "Filter %s has an unconnected output\n", output->name); + "Filter '%s' has output %d (%s) unconnected\n", + output->name, j, + output->linklabel ? (const char *)output->linklabel : "unlabeled"); return AVERROR(EINVAL); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] vulkan: merge FFVkSPIRVShader and FFVkPipeline into FFVkShader
ffmpeg | branch: master | Lynne | Sat Sep 28 13:13:41 2024 +0200| [0a37d5a3b1fbcb44d900ff6dad12022e02368d8a] | committer: Lynne vulkan: merge FFVkSPIRVShader and FFVkPipeline into FFVkShader Pipelines are just shaders. There's no reason to treat them differently. This also lets us implement shader objects and is an overall cleanup. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a37d5a3b1fbcb44d900ff6dad12022e02368d8a --- libavfilter/vf_avgblur_vulkan.c | 28 +- libavfilter/vf_blend_vulkan.c | 24 +- libavfilter/vf_bwdif_vulkan.c | 29 +- libavfilter/vf_chromaber_vulkan.c | 28 +- libavfilter/vf_flip_vulkan.c | 24 +- libavfilter/vf_gblur_vulkan.c | 54 ++-- libavfilter/vf_nlmeans_vulkan.c | 135 libavfilter/vf_overlay_vulkan.c | 28 +- libavfilter/vf_scale_vulkan.c | 28 +- libavfilter/vf_transpose_vulkan.c | 24 +- libavfilter/vf_xfade_vulkan.c | 28 +- libavfilter/vsrc_testsrc_vulkan.c | 30 +- libavfilter/vulkan_filter.c | 78 ++--- libavfilter/vulkan_filter.h | 6 +- libavfilter/vulkan_glslang.c | 4 +- libavfilter/vulkan_shaderc.c | 4 +- libavfilter/vulkan_spirv.h| 2 +- libavutil/vulkan.c| 626 +- libavutil/vulkan.h| 146 + 19 files changed, 702 insertions(+), 624 deletions(-) diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c index 439766968e..3972ea0cbb 100644 --- a/libavfilter/vf_avgblur_vulkan.c +++ b/libavfilter/vf_avgblur_vulkan.c @@ -33,8 +33,7 @@ typedef struct AvgBlurVulkanContext { FFVkExecPool e; FFVkQueueFamilyCtx qf; VkSampler sampler; -FFVulkanPipeline pl; -FFVkSPIRVShader shd; +FFVulkanShader shd; /* Push constants / options */ struct { @@ -68,7 +67,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) AvgBlurVulkanContext *s = ctx->priv; FFVulkanContext *vkctx = &s->vkctx; const int planes = av_pix_fmt_count_planes(s->vkctx.output_format); -FFVkSPIRVShader *shd; +FFVulkanShader *shd; FFVkSPIRVCompiler *spv; FFVulkanDescriptorSetBinding *desc; @@ -81,12 +80,13 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT); RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL)); RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR)); -RET(ff_vk_shader_init(&s->pl, &s->shd, "avgblur_compute", - VK_SHADER_STAGE_COMPUTE_BIT, 0)); +RET(ff_vk_shader_init(vkctx, &s->shd, "avgblur", + VK_SHADER_STAGE_COMPUTE_BIT, + NULL, 0, + 32, 1, 1, + 0)); shd = &s->shd; -ff_vk_shader_set_compute_sizes(shd, 32, 1, 1); - desc = (FFVulkanDescriptorSetBinding []) { { .name = "input_img", @@ -107,7 +107,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) }, }; -RET(ff_vk_pipeline_descriptor_set_add(vkctx, &s->pl, shd, desc, 2, 0, 0)); +RET(ff_vk_shader_add_descriptor_set(vkctx, shd, desc, 2, 0, 0)); GLSLC(0, layout(push_constant, std430) uniform pushConstants {); GLSLC(1,vec4 filter_norm; ); @@ -115,8 +115,8 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) GLSLC(0, }; ); GLSLC(0, ); -ff_vk_add_push_constant(&s->pl, 0, sizeof(s->opts), -VK_SHADER_STAGE_COMPUTE_BIT); +ff_vk_shader_add_push_const(&s->shd, 0, sizeof(s->opts), +VK_SHADER_STAGE_COMPUTE_BIT); GLSLD( blur_kernel ); GLSLC(0, void main() ); @@ -139,10 +139,9 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) RET(spv->compile_shader(spv, ctx, &s->shd, &spv_data, &spv_len, "main", &spv_opaque)); -RET(ff_vk_shader_create(vkctx, &s->shd, spv_data, spv_len, "main")); +RET(ff_vk_shader_link(vkctx, &s->shd, spv_data, spv_len, "main")); -RET(ff_vk_init_compute_pipeline(vkctx, &s->pl, &s->shd)); -RET(ff_vk_exec_pipeline_register(vkctx, &s->e, &s->pl)); +RET(ff_vk_shader_register_exec(vkctx, &s->e, &s->shd)); s->initialized = 1; s->opts.filter_len[0] = s->size_x - 1; @@ -180,7 +179,7 @@ static int avgblur_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) if (!s->initialized) RET(init_filter(ctx, in)); -RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, +RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd,
[FFmpeg-cvslog] vulkan: use shader objects if supported
ffmpeg | branch: master | Lynne | Sun Sep 29 07:03:16 2024 +0200| [877c5a969233866983ff0c4e7b32b83a00ce0973] | committer: Lynne vulkan: use shader objects if supported Shader objects finally allow completely independent shaders. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=877c5a969233866983ff0c4e7b32b83a00ce0973 --- libavutil/vulkan.c | 57 +++--- libavutil/vulkan.h | 5 ++--- 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 031493eb8b..7f9008618e 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -1598,6 +1598,47 @@ static int init_compute_pipeline(FFVulkanContext *s, FFVulkanShader *shd, return 0; } +static int create_shader_object(FFVulkanContext *s, FFVulkanShader *shd, +uint8_t *spirv, size_t spirv_len, +const char *entrypoint) +{ +VkResult ret; +FFVulkanFunctions *vk = &s->vkfn; +size_t shader_size = 0; + +VkShaderCreateInfoEXT shader_obj_create = { +.sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO_EXT, +.flags = shd->subgroup_info.requiredSubgroupSize ? + VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT : 0x0, +.stage = shd->stage, +.nextStage = 0, +.codeType = VK_SHADER_CODE_TYPE_SPIRV_EXT, +.pCode = spirv, +.codeSize = spirv_len, +.pName = entrypoint, +.pSetLayouts = shd->desc_layout, +.setLayoutCount = shd->nb_descriptor_sets, +.pushConstantRangeCount = shd->push_consts_num, +.pPushConstantRanges = shd->push_consts, +.pSpecializationInfo = NULL, +}; + +ret = vk->CreateShadersEXT(s->hwctx->act_dev, 1, &shader_obj_create, + s->hwctx->alloc, &shd->object); +if (ret != VK_SUCCESS) { +av_log(s, AV_LOG_ERROR, "Unable to create shader object: %s\n", + ff_vk_ret2str(ret)); +return AVERROR_EXTERNAL; +} + +if (vk->GetShaderBinaryDataEXT(s->hwctx->act_dev, shd->object, + &shader_size, NULL) == VK_SUCCESS) +av_log(s, AV_LOG_VERBOSE, "Shader %s size: %zu binary (%zu SPIR-V)\n", + shd->name, shader_size, spirv_len); + +return 0; +} + static int init_descriptors(FFVulkanContext *s, FFVulkanShader *shd) { VkResult ret; @@ -1687,7 +1728,11 @@ int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader *shd, shd->bound_buffer_indices[i] = i; } -{ +if (s->extensions & FF_VK_EXT_SHADER_OBJECT) { +err = create_shader_object(s, shd, spirv, spirv_len, entrypoint); +if (err < 0) +return err; +} else { VkShaderModule mod; err = create_shader_module(s, shd, &mod, spirv, spirv_len); if (err < 0) @@ -2178,8 +2223,12 @@ void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, VkDeviceSize offsets[1024]; FFVulkanShaderData *sd = get_shd_data(e, shd); -/* Bind pipeline */ -vk->CmdBindPipeline(e->buf, shd->bind_point, shd->pipeline); +if (s->extensions & FF_VK_EXT_SHADER_OBJECT) { +VkShaderStageFlagBits stages = shd->stage; +vk->CmdBindShadersEXT(e->buf, 1, &stages, &shd->object); +} else { +vk->CmdBindPipeline(e->buf, shd->bind_point, shd->pipeline); +} if (sd->nb_descriptor_sets) { if (s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER) { @@ -2213,6 +2262,8 @@ void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd) s->hwctx->alloc); #endif +if (shd->object) +vk->DestroyShaderEXT(s->hwctx->act_dev, shd->object, s->hwctx->alloc); if (shd->pipeline) vk->DestroyPipeline(s->hwctx->act_dev, shd->pipeline, s->hwctx->alloc); if (shd->pipeline_layout) diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h index 5391afa4e7..47684e600d 100644 --- a/libavutil/vulkan.h +++ b/libavutil/vulkan.h @@ -194,9 +194,8 @@ typedef struct FFVulkanShader { VkPipelineShaderStageRequiredSubgroupSizeCreateInfo subgroup_info; /* Base shader object */ -union { -VkPipeline pipeline; -}; +VkShaderEXT object; +VkPipeline pipeline; /* Pipeline layout */ VkPipelineLayout pipeline_layout; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] vulkan: always enable GL_EXT_scalar_block_layout
ffmpeg | branch: master | Lynne | Sun Sep 29 07:31:25 2024 +0200| [d80f9f55c8a73491e6c0aa6d822295c29bf74a06] | committer: Lynne vulkan: always enable GL_EXT_scalar_block_layout This makes std430 (which we use everywhere already) fully match C layout. Extension was made mandatory in 1.2. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d80f9f55c8a73491e6c0aa6d822295c29bf74a06 --- libavutil/hwcontext_vulkan.c | 1 + libavutil/vulkan.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index f6d6ff6cb1..d6500de677 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1501,6 +1501,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, p->device_features_1_1.uniformAndStorageBuffer16BitAccess = dev_features_1_1.uniformAndStorageBuffer16BitAccess; p->device_features_1_2.timelineSemaphore = 1; +p->device_features_1_2.scalarBlockLayout = dev_features_1_2.scalarBlockLayout; p->device_features_1_2.bufferDeviceAddress = dev_features_1_2.bufferDeviceAddress; p->device_features_1_2.hostQueryReset = dev_features_1_2.hostQueryReset; p->device_features_1_2.storagePushConstant8 = dev_features_1_2.storagePushConstant8; diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 1dc168e645..c6aa6cdd10 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -1478,6 +1478,7 @@ int ff_vk_shader_init(FFVulkanContext *s, FFVulkanShader *shd, const char *name, /* Common utilities */ GLSLC(0, #define IS_WITHIN(v1, v2) ((v1.x < v2.x) && (v1.y < v2.y)) ); GLSLC(0, ); +GLSLC(0, #extension GL_EXT_scalar_block_layout : require ); GLSLC(0, #extension GL_EXT_buffer_reference : require ); GLSLC(0, #extension GL_EXT_buffer_reference2 : require ); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] hwcontext_vulkan: move device feature struct setup to a new function
ffmpeg | branch: master | Lynne | Thu Oct 3 06:44:43 2024 +0200| [e3676d96cbafa4e859b364f0fb64651cd9f20270] | committer: Lynne hwcontext_vulkan: move device feature struct setup to a new function > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3676d96cbafa4e859b364f0fb64651cd9f20270 --- libavutil/hwcontext_vulkan.c | 335 --- libavutil/vulkan_functions.h | 1 + 2 files changed, 156 insertions(+), 180 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 02ee7f428c..870e988578 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -72,6 +72,28 @@ #define CHECK_CU(x) FF_CUDA_CHECK_DL(cuda_cu, cu, x) #endif +typedef struct VulkanDeviceFeatures { +VkPhysicalDeviceFeatures2 device; + +VkPhysicalDeviceVulkan11Features vulkan_1_1; +VkPhysicalDeviceVulkan12Features vulkan_1_2; +VkPhysicalDeviceVulkan13Features vulkan_1_3; +VkPhysicalDeviceTimelineSemaphoreFeatures timeline_semaphore; + +VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maintenance_1; + +VkPhysicalDeviceShaderObjectFeaturesEXT shader_object; +VkPhysicalDeviceCooperativeMatrixFeaturesKHR cooperative_matrix; +VkPhysicalDeviceDescriptorBufferFeaturesEXT descriptor_buffer; +VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float; + +VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow; + +#ifdef VK_KHR_shader_relaxed_extended_instruction +VkPhysicalDeviceShaderRelaxedExtendedInstructionFeaturesKHR relaxed_extended_instruction; +#endif +} VulkanDeviceFeatures; + typedef struct VulkanDevicePriv { /** * The public AVVulkanDeviceContext. See hwcontext_vulkan.h for it. @@ -90,19 +112,8 @@ typedef struct VulkanDevicePriv { VkPhysicalDeviceMemoryProperties mprops; VkPhysicalDeviceExternalMemoryHostPropertiesEXT hprops; -/* Features */ -VkPhysicalDeviceVulkan11Features device_features_1_1; -VkPhysicalDeviceVulkan12Features device_features_1_2; -VkPhysicalDeviceVulkan13Features device_features_1_3; -VkPhysicalDeviceDescriptorBufferFeaturesEXT desc_buf_features; -VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float_features; -VkPhysicalDeviceCooperativeMatrixFeaturesKHR coop_matrix_features; -VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow_features; -VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features; -VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features; -#ifdef VK_KHR_shader_relaxed_extended_instruction -VkPhysicalDeviceShaderRelaxedExtendedInstructionFeaturesKHR relaxed_extended_instr_features; -#endif +/* Enabled features */ +VulkanDeviceFeatures feats; /* Queues */ pthread_mutex_t **qf_mutex; @@ -164,6 +175,118 @@ typedef struct AVVkFrameInternal { #endif } AVVkFrameInternal; +/* Initialize all structs in VulkanDeviceFeatures */ +static void device_features_init(AVHWDeviceContext *ctx, VulkanDeviceFeatures *feats) +{ +VulkanDevicePriv *p = ctx->hwctx; + +#define OPT_CHAIN(STRUCT_P, EXT_FLAG, TYPE) \ +do { \ +if ((EXT_FLAG == FF_VK_EXT_NO_FLAG) || \ +(p->vkctx.extensions & EXT_FLAG)) { \ +(STRUCT_P)->sType = TYPE;\ +ff_vk_link_struct(&feats->device, STRUCT_P); \ +}\ +} while (0) + +feats->device = (VkPhysicalDeviceFeatures2) { +.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, +}; + +OPT_CHAIN(&feats->vulkan_1_1, FF_VK_EXT_NO_FLAG, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES); +OPT_CHAIN(&feats->vulkan_1_2, FF_VK_EXT_NO_FLAG, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES); +OPT_CHAIN(&feats->vulkan_1_3, FF_VK_EXT_NO_FLAG, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES); + +OPT_CHAIN(&feats->timeline_semaphore, FF_VK_EXT_PORTABILITY_SUBSET, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES); + +OPT_CHAIN(&feats->video_maintenance_1, FF_VK_EXT_VIDEO_MAINTENANCE_1, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR); + +OPT_CHAIN(&feats->shader_object, FF_VK_EXT_SHADER_OBJECT, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT); +OPT_CHAIN(&feats->cooperative_matrix, FF_VK_EXT_COOP_MATRIX, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR); +OPT_CHAIN(&feats->descriptor_buffer, FF_VK_EXT_DESCRIPTOR_BUFFER, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT); +OPT_CHAIN(&feats->atomic_float, FF_VK_EXT_ATOMIC_FLOAT, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT); + +#ifdef VK_KHR_shader_relaxed_extended_instruction +OPT_CHAIN(&feats->relaxed_ex
[FFmpeg-cvslog] vulkan: check if current buffer has finished execution before picking another
ffmpeg | branch: master | Lynne | Sun Sep 29 08:07:05 2024 +0200| [37d5cb84e8ab724e575c5819518f761ba6c7] | committer: Lynne vulkan: check if current buffer has finished execution before picking another This saves resources, as dependencies are freed/reclaimed with a lower latency, and provies a speedup. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37d5cb84e8ab724e575c5819518f761ba6c7 --- libavcodec/vulkan_decode.c | 4 ++-- libavcodec/vulkan_encode.c | 2 +- libavfilter/vf_nlmeans_vulkan.c | 2 +- libavfilter/vulkan_filter.c | 6 +++--- libavutil/hwcontext_vulkan.c| 6 +++--- libavutil/vulkan.c | 15 +++ libavutil/vulkan.h | 2 +- libavutil/vulkan_functions.h| 1 + 8 files changed, 23 insertions(+), 15 deletions(-) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index a8b906a9dd..7d7295e05e 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -293,7 +293,7 @@ void ff_vk_decode_flush(AVCodecContext *avctx) }; VkCommandBuffer cmd_buf; -FFVkExecContext *exec = ff_vk_exec_get(&dec->exec_pool); +FFVkExecContext *exec = ff_vk_exec_get(&ctx->s, &dec->exec_pool); int had_submission = exec->had_submission; ff_vk_exec_start(&ctx->s, exec); cmd_buf = exec->buf; @@ -345,7 +345,7 @@ int ff_vk_decode_frame(AVCodecContext *avctx, size_t data_size = FFALIGN(vp->slices_size, ctx->caps.minBitstreamBufferSizeAlignment); -FFVkExecContext *exec = ff_vk_exec_get(&dec->exec_pool); +FFVkExecContext *exec = ff_vk_exec_get(&ctx->s, &dec->exec_pool); /* The current decoding reference has to be bound as an inactive reference */ VkVideoReferenceSlotInfoKHR *cur_vk_ref; diff --git a/libavcodec/vulkan_encode.c b/libavcodec/vulkan_encode.c index d187b7cdd3..6d1743c7d7 100644 --- a/libavcodec/vulkan_encode.c +++ b/libavcodec/vulkan_encode.c @@ -339,7 +339,7 @@ static int vulkan_encode_issue(AVCodecContext *avctx, size_align); /* Start command buffer recording */ -exec = vp->exec = ff_vk_exec_get(&ctx->enc_pool); +exec = vp->exec = ff_vk_exec_get(&ctx->s, &ctx->enc_pool); ff_vk_exec_start(&ctx->s, exec); cmd_buf = exec->buf; diff --git a/libavfilter/vf_nlmeans_vulkan.c b/libavfilter/vf_nlmeans_vulkan.c index 05c752925e..b413194035 100644 --- a/libavfilter/vf_nlmeans_vulkan.c +++ b/libavfilter/vf_nlmeans_vulkan.c @@ -836,7 +836,7 @@ static int nlmeans_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) } /* Execution context */ -exec = ff_vk_exec_get(&s->e); +exec = ff_vk_exec_get(&s->vkctx, &s->e); ff_vk_exec_start(vkctx, exec); /* Dependencies */ diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c index 5cee4572e6..8d9b416d6a 100644 --- a/libavfilter/vulkan_filter.c +++ b/libavfilter/vulkan_filter.c @@ -249,7 +249,7 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e, int nb_img_bar = 0; /* Update descriptors and init the exec context */ -FFVkExecContext *exec = ff_vk_exec_get(e); +FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); ff_vk_exec_start(vkctx, exec); RET(ff_vk_exec_add_dep_frame(vkctx, exec, out_f, @@ -321,7 +321,7 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e, int nb_img_bar = 0; /* Update descriptors and init the exec context */ -FFVkExecContext *exec = ff_vk_exec_get(e); +FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); ff_vk_exec_start(vkctx, exec); RET(ff_vk_exec_add_dep_frame(vkctx, exec, in, @@ -409,7 +409,7 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, int nb_img_bar = 0; /* Update descriptors and init the exec context */ -FFVkExecContext *exec = ff_vk_exec_get(e); +FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); ff_vk_exec_start(vkctx, exec); /* Add deps and create temporary imageviews */ diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 6317ab7d0e..f6d6ff6cb1 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -2253,7 +2253,7 @@ static int prepare_frame(AVHWFramesContext *hwfc, FFVkExecPool *ectx, }; VkCommandBuffer cmd_buf; -FFVkExecContext *exec = ff_vk_exec_get(ectx); +FFVkExecContext *exec = ff_vk_exec_get(&p->vkctx, ectx); cmd_buf = exec->buf; ff_vk_exec_start(&p->vkctx, exec); @@ -3190,7 +3190,7 @@ static int vulkan_map_from_drm_frame_sync(AVHWFramesContext *hwfc, AVFrame *dst, } } -exec = ff_vk_exec_get(&fp->compute_exec); +exec = ff_vk_exec_get(&p->vkctx, &fp->compute_exec); cmd_buf = exec->buf; ff_vk_exec_start(&p->vkctx, exec); @@ -4098,7 +4098,7 @@ static int vulkan_transfer_frame(AVHWFramesContext *hwfc, } } -
[FFmpeg-cvslog] vulkan_functions: change extension type to a typedef uint64_t
ffmpeg | branch: master | Lynne | Thu Oct 3 07:06:29 2024 +0200| [0d5bfd0b21c42b7e2968cfb33a96096f928f35ff] | committer: Lynne vulkan_functions: change extension type to a typedef uint64_t We were getting a bit too close for comfort to the 32-bit limit on enums. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d5bfd0b21c42b7e2968cfb33a96096f928f35ff --- libavutil/vulkan_functions.h | 59 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h index 90e4d0004d..c565d62335 100644 --- a/libavutil/vulkan_functions.h +++ b/libavutil/vulkan_functions.h @@ -26,37 +26,42 @@ #include "hwcontext_vulkan.h" /* An enum of bitflags for every optional extension we need */ -typedef enum FFVulkanExtensions { -FF_VK_EXT_EXTERNAL_DMABUF_MEMORY = 1ULL << 0, /* VK_EXT_external_memory_dma_buf */ -FF_VK_EXT_DRM_MODIFIER_FLAGS = 1ULL << 1, /* VK_EXT_image_drm_format_modifier */ -FF_VK_EXT_EXTERNAL_FD_MEMORY = 1ULL << 2, /* VK_KHR_external_memory_fd */ -FF_VK_EXT_EXTERNAL_FD_SEM= 1ULL << 3, /* VK_KHR_external_semaphore_fd */ -FF_VK_EXT_EXTERNAL_HOST_MEMORY = 1ULL << 4, /* VK_EXT_external_memory_host */ -FF_VK_EXT_DEBUG_UTILS= 1ULL << 5, /* VK_EXT_debug_utils */ +typedef uint64_t FFVulkanExtensions; + +#define FF_VK_EXT_EXTERNAL_DMABUF_MEMORY (1ULL << 0) /* VK_EXT_external_memory_dma_buf */ +#define FF_VK_EXT_DRM_MODIFIER_FLAGS (1ULL << 1) /* VK_EXT_image_drm_format_modifier */ +#define FF_VK_EXT_EXTERNAL_FD_MEMORY (1ULL << 2) /* VK_KHR_external_memory_fd */ +#define FF_VK_EXT_EXTERNAL_FD_SEM(1ULL << 3) /* VK_KHR_external_semaphore_fd */ +#define FF_VK_EXT_EXTERNAL_HOST_MEMORY (1ULL << 4) /* VK_EXT_external_memory_host */ +#define FF_VK_EXT_DEBUG_UTILS(1ULL << 5) /* VK_EXT_debug_utils */ + #ifdef _WIN32 -FF_VK_EXT_EXTERNAL_WIN32_MEMORY = 1ULL << 6, /* VK_KHR_external_memory_win32 */ -FF_VK_EXT_EXTERNAL_WIN32_SEM = 1ULL << 7, /* VK_KHR_external_semaphore_win32 */ +#define FF_VK_EXT_EXTERNAL_WIN32_MEMORY (1ULL << 6) /* VK_KHR_external_memory_win32 */ +#define FF_VK_EXT_EXTERNAL_WIN32_SEM (1ULL << 7) /* VK_KHR_external_semaphore_win32 */ #endif -FF_VK_EXT_DESCRIPTOR_BUFFER = 1ULL << 8, /* VK_EXT_descriptor_buffer */ -FF_VK_EXT_DEVICE_DRM = 1ULL << 9, /* VK_EXT_physical_device_drm */ -FF_VK_EXT_VIDEO_QUEUE= 1ULL << 10, /* VK_KHR_video_queue */ -FF_VK_EXT_VIDEO_DECODE_QUEUE = 1ULL << 11, /* VK_KHR_video_decode_queue */ -FF_VK_EXT_VIDEO_DECODE_H264 = 1ULL << 12, /* VK_EXT_video_decode_h264 */ -FF_VK_EXT_VIDEO_DECODE_H265 = 1ULL << 13, /* VK_EXT_video_decode_h265 */ -FF_VK_EXT_VIDEO_DECODE_AV1 = 1ULL << 14, /* VK_KHR_video_decode_av1 */ -FF_VK_EXT_ATOMIC_FLOAT = 1ULL << 15, /* VK_EXT_shader_atomic_float */ -FF_VK_EXT_COOP_MATRIX= 1ULL << 16, /* VK_KHR_cooperative_matrix */ -FF_VK_EXT_OPTICAL_FLOW = 1ULL << 17, /* VK_NV_optical_flow */ -FF_VK_EXT_SHADER_OBJECT = 1ULL << 18, /* VK_EXT_shader_object */ -FF_VK_EXT_PUSH_DESCRIPTOR= 1ULL << 19, /* VK_KHR_push_descriptor */ -FF_VK_EXT_VIDEO_MAINTENANCE_1= 1ULL << 27, /* VK_KHR_video_maintenance1 */ -FF_VK_EXT_VIDEO_ENCODE_QUEUE = 1ULL << 28, /* VK_KHR_video_encode_queue */ -FF_VK_EXT_VIDEO_ENCODE_H264 = 1ULL << 29, /* VK_KHR_video_encode_h264 */ -FF_VK_EXT_VIDEO_ENCODE_H265 = 1ULL << 30, /* VK_KHR_video_encode_h265 */ +#define FF_VK_EXT_DESCRIPTOR_BUFFER (1ULL << 8) /* VK_EXT_descriptor_buffer */ +#define FF_VK_EXT_DEVICE_DRM (1ULL << 9) /* VK_EXT_physical_device_drm */ +#define FF_VK_EXT_ATOMIC_FLOAT (1ULL << 10) /* VK_EXT_shader_atomic_float */ +#define FF_VK_EXT_COOP_MATRIX(1ULL << 11) /* VK_KHR_cooperative_matrix */ +#define FF_VK_EXT_OPTICAL_FLOW (1ULL << 12) /* VK_NV_optical_flow */ +#define FF_VK_EXT_SHADER_OBJECT (1ULL << 13) /* VK_EXT_shader_object */ +#define FF_VK_EXT_PUSH_DESCRIPTOR(1ULL << 14) /* VK_KHR_push_descriptor */ + +/* Video extensions */ +#define FF_VK_EXT_VIDEO_QUEUE(1ULL << 36) /* VK_KHR_video_queue */ +#define FF_VK_EXT_VIDEO_MAINTENANCE_1(1ULL << 37) /* VK_KHR_video_maintenance1 */ + +#define FF_VK_EXT_VIDEO_DECODE_QUEUE (1ULL << 40) /* VK_KHR_video_decode_queue */ +#define FF_VK_EXT_VIDEO_DECODE_H264 (1ULL << 41) /* VK_KHR_video_decode_h264 */ +#define FF_VK_EXT_VIDEO_DECODE_H265 (1ULL << 42) /* VK_KHR_video_decode_h265 */ +#define FF_VK_EXT_VIDEO_DECODE_AV1 (1ULL << 43) /* VK_KHR_video_decode_av1 */ + +#define FF_VK_EXT_VIDEO_ENCODE_QUEUE (1ULL << 50) /* VK_KHR_video_encode_queue */ +#define FF_VK_EXT_VIDEO_ENCODE_H264 (1ULL << 51) /* VK_KHR_video_encode_h264 */ +#define FF_VK_EXT_VIDE
[FFmpeg-cvslog] hwcontext_vulkan: enable VK_KHR_shader_relaxed_extended_instruction
ffmpeg | branch: master | Lynne | Thu Oct 3 04:27:53 2024 +0200| [535e5eb7f3ef01841d76cfec9d9d00b5b34b6f76] | committer: Lynne hwcontext_vulkan: enable VK_KHR_shader_relaxed_extended_instruction > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=535e5eb7f3ef01841d76cfec9d9d00b5b34b6f76 --- libavutil/hwcontext_vulkan.c | 39 +++ libavutil/vulkan.c | 2 ++ libavutil/vulkan_functions.h | 1 + libavutil/vulkan_loader.h| 1 + 4 files changed, 43 insertions(+) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index d6500de677..02ee7f428c 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -100,6 +100,9 @@ typedef struct VulkanDevicePriv { VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow_features; VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features; VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features; +#ifdef VK_KHR_shader_relaxed_extended_instruction +VkPhysicalDeviceShaderRelaxedExtendedInstructionFeaturesKHR relaxed_extended_instr_features; +#endif /* Queues */ pthread_mutex_t **qf_mutex; @@ -622,6 +625,28 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, } } +#ifdef VK_KHR_shader_relaxed_extended_instruction +if (dev && debug_mode == FF_VULKAN_DEBUG_PRINTF) { +tstr = VK_KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME; +found = 0; +for (int j = 0; j < sup_ext_count; j++) { +if (!strcmp(tstr, sup_ext[j].extensionName)) { +found = 1; +break; +} +} +if (found) { +av_log(ctx, AV_LOG_VERBOSE, "Using %s extension %s\n", mod, tstr); +ADD_VAL_TO_LIST(extension_names, extensions_found, tstr); +} else { +av_log(ctx, AV_LOG_ERROR, "Debug printf enabled, but extension \"%s\" not found!\n", + tstr); +err = AVERROR(EINVAL); +goto fail; +} +#endif +} + if (user_exts_str) { char *save, *token = av_strtok(user_exts_str, "+", &save); while (token) { @@ -1419,9 +1444,19 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, VkPhysicalDeviceTimelineSemaphoreFeatures timeline_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES, }; +#ifdef VK_KHR_shader_relaxed_extended_instruction +VkPhysicalDeviceShaderRelaxedExtendedInstructionFeaturesKHR relaxed_extended_instr_features = { +.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_RELAXED_EXTENDED_INSTRUCTION_FEATURES_KHR, +.pNext = &timeline_features, +}; +#endif VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR, +#ifdef VK_KHR_shader_relaxed_extended_instruction +.pNext = &relaxed_extended_instr_features, +#else .pNext = &timeline_features, +#endif }; VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT, @@ -1535,6 +1570,10 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, p->shader_object_features.shaderObject = shader_object_features.shaderObject; +#ifdef VK_KHR_shader_relaxed_extended_instruction +p->relaxed_extended_instr_features.shaderRelaxedExtendedInstruction = relaxed_extended_instr_features.shaderRelaxedExtendedInstruction; +#endif + /* Find and enable extensions */ if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames, &dev_info.enabledExtensionCount, debug_mode))) { diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index c6aa6cdd10..ba1d18f4c6 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -1481,6 +1481,8 @@ int ff_vk_shader_init(FFVulkanContext *s, FFVulkanShader *shd, const char *name, GLSLC(0, #extension GL_EXT_scalar_block_layout : require ); GLSLC(0, #extension GL_EXT_buffer_reference : require ); GLSLC(0, #extension GL_EXT_buffer_reference2 : require ); +if (s->extensions & FF_VK_EXT_RELAXED_EXTENDED_INSTR) +GLSLC(0, #extension GL_EXT_debug_printf : require ); if (stage == VK_SHADER_STAGE_TASK_BIT_EXT || stage == VK_SHADER_STAGE_MESH_BIT_EXT) diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h index c565d62335..7a5385381b 100644 --- a/libavutil/vulkan_functions.h +++ b/libavutil/vulkan_functions.h @@ -47,6 +47,7 @@ typedef uint64_t FFVulkanExtensions; #define FF_VK_EXT_OPTICAL_FLOW (1ULL << 12) /* VK_NV_optical_flow */ #define FF_VK_EXT_SHADER_OBJECT (1ULL << 13) /* VK_EXT_shader_object */ #define FF_VK_EXT_PUSH_DES
[FFmpeg-cvslog] vulkan_shaderc: add more stages, target Vulkan 1.3 and only output debug if needed
ffmpeg | branch: master | Lynne | Wed Oct 2 11:56:51 2024 +0200| [2bb0b6dd2c16a1e02bed0d4cd419de7f8b2f26b6] | committer: Lynne vulkan_shaderc: add more stages, target Vulkan 1.3 and only output debug if needed > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2bb0b6dd2c16a1e02bed0d4cd419de7f8b2f26b6 --- libavfilter/vulkan_shaderc.c | 24 +++- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/libavfilter/vulkan_shaderc.c b/libavfilter/vulkan_shaderc.c index 56a2c0eef5..7144f04f21 100644 --- a/libavfilter/vulkan_shaderc.c +++ b/libavfilter/vulkan_shaderc.c @@ -41,6 +41,14 @@ static int shdc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, [VK_SHADER_STAGE_VERTEX_BIT] = shaderc_glsl_vertex_shader, [VK_SHADER_STAGE_FRAGMENT_BIT] = shaderc_glsl_fragment_shader, [VK_SHADER_STAGE_COMPUTE_BIT] = shaderc_glsl_compute_shader, +[VK_SHADER_STAGE_MESH_BIT_EXT] = shaderc_mesh_shader, +[VK_SHADER_STAGE_TASK_BIT_EXT] = shaderc_task_shader, +[VK_SHADER_STAGE_RAYGEN_BIT_KHR] = shaderc_raygen_shader, +[VK_SHADER_STAGE_ANY_HIT_BIT_KHR] = shaderc_anyhit_shader, +[VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR] = shaderc_closesthit_shader, +[VK_SHADER_STAGE_MISS_BIT_KHR] = shaderc_miss_shader, +[VK_SHADER_STAGE_INTERSECTION_BIT_KHR] = shaderc_intersection_shader, +[VK_SHADER_STAGE_CALLABLE_BIT_KHR] = shaderc_callable_shader, }; shaderc_compile_options_t opts = shaderc_compile_options_initialize(); @@ -49,11 +57,17 @@ static int shdc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, return AVERROR(ENOMEM); shaderc_compile_options_set_target_env(opts, shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_2); -shaderc_compile_options_set_target_spirv(opts, shaderc_spirv_version_1_5); -shaderc_compile_options_set_generate_debug_info(opts); -shaderc_compile_options_set_optimization_level(opts, - shaderc_optimization_level_performance); + shaderc_env_version_vulkan_1_3); +shaderc_compile_options_set_target_spirv(opts, shaderc_spirv_version_1_6); + +if (s->extensions & FF_VK_EXT_DEBUG_UTILS) { +shaderc_compile_options_set_generate_debug_info(opts); +shaderc_compile_options_set_optimization_level(opts, + shaderc_optimization_level_zero); +} else { +shaderc_compile_options_set_optimization_level(opts, + shaderc_optimization_level_performance); +} res = shaderc_compile_into_spv((shaderc_compiler_t)ctx->priv, shd->src.str, strlen(shd->src.str), ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] vulkan: add profiling debug setting
ffmpeg | branch: master | Lynne | Fri Oct 4 04:24:20 2024 +0200| [a304cbeb8d48d97acc48e526b24e2db9189fa848] | committer: Lynne vulkan: add profiling debug setting This simply keeps all shader optimizations, but allows debug data to be generated. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a304cbeb8d48d97acc48e526b24e2db9189fa848 --- libavfilter/vulkan_glslang.c | 4 ++-- libavfilter/vulkan_shaderc.c | 8 +--- libavutil/hwcontext_vulkan.c | 22 +- libavutil/vulkan.c | 3 ++- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/libavfilter/vulkan_glslang.c b/libavfilter/vulkan_glslang.c index 68c0fcbe53..9e1b8f4d8d 100644 --- a/libavfilter/vulkan_glslang.c +++ b/libavfilter/vulkan_glslang.c @@ -184,11 +184,11 @@ static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, #if ((GLSLANG_VERSION_MAJOR) >= 12) glslang_spv_options_t glslc_opts = { -.generate_debug_info = !!(s->extensions & FF_VK_EXT_DEBUG_UTILS), +.generate_debug_info = !!(s->extensions & (FF_VK_EXT_DEBUG_UTILS | FF_VK_EXT_RELAXED_EXTENDED_INSTR)), .emit_nonsemantic_shader_debug_info = !!(s->extensions & FF_VK_EXT_RELAXED_EXTENDED_INSTR), .emit_nonsemantic_shader_debug_source = !!(s->extensions & FF_VK_EXT_RELAXED_EXTENDED_INSTR), .disable_optimizer = !!(s->extensions & FF_VK_EXT_DEBUG_UTILS), -.strip_debug_info = !(s->extensions & FF_VK_EXT_DEBUG_UTILS), +.strip_debug_info = !(s->extensions & (FF_VK_EXT_DEBUG_UTILS | FF_VK_EXT_RELAXED_EXTENDED_INSTR)), .optimize_size = 0, .disassemble = 0, .validate = 1, diff --git a/libavfilter/vulkan_shaderc.c b/libavfilter/vulkan_shaderc.c index 7144f04f21..6e7475c49f 100644 --- a/libavfilter/vulkan_shaderc.c +++ b/libavfilter/vulkan_shaderc.c @@ -60,14 +60,16 @@ static int shdc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, shaderc_env_version_vulkan_1_3); shaderc_compile_options_set_target_spirv(opts, shaderc_spirv_version_1_6); -if (s->extensions & FF_VK_EXT_DEBUG_UTILS) { +/* If either extension is set, turn on debug info */ +if (s->extensions & (FF_VK_EXT_DEBUG_UTILS | FF_VK_EXT_RELAXED_EXTENDED_INSTR)) shaderc_compile_options_set_generate_debug_info(opts); + +if (s->extensions & FF_VK_EXT_DEBUG_UTILS) shaderc_compile_options_set_optimization_level(opts, shaderc_optimization_level_zero); -} else { +else shaderc_compile_options_set_optimization_level(opts, shaderc_optimization_level_performance); -} res = shaderc_compile_into_spv((shaderc_compiler_t)ctx->priv, shd->src.str, strlen(shd->src.str), diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 033077178c..af187d6840 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -642,6 +642,10 @@ enum FFVulkanDebugMode { FF_VULKAN_DEBUG_PRINTF = 2, /* Enables extra printouts */ FF_VULKAN_DEBUG_PRACTICES = 3, +/* Disables validation but keeps shader debug info and optimizations */ +FF_VULKAN_DEBUG_PROFILE = 4, + +FF_VULKAN_DEBUG_NB, }; static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, @@ -705,7 +709,10 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, tstr = optional_exts[i].name; found = 0; -if (dev && debug_mode && +if (dev && +((debug_mode == FF_VULKAN_DEBUG_VALIDATE) || + (debug_mode == FF_VULKAN_DEBUG_PRINTF) || + (debug_mode == FF_VULKAN_DEBUG_PRACTICES)) && !strcmp(tstr, VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME)) { continue; } @@ -748,7 +755,8 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, } #ifdef VK_KHR_shader_relaxed_extended_instruction -if (dev && debug_mode == FF_VULKAN_DEBUG_PRINTF) { +if (((debug_mode == FF_VULKAN_DEBUG_PRINTF) || + (debug_mode == FF_VULKAN_DEBUG_PROFILE)) && dev) { tstr = VK_KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME; found = 0; for (int j = 0; j < sup_ext_count; j++) { @@ -761,7 +769,7 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, av_log(ctx, AV_LOG_VERBOSE, "Using %s extension %s\n", mod, tstr); ADD_VAL_TO_LIST(extension_names, extensions_found, tstr); } else { -av_log(ctx, AV_LOG_ERROR, "Debug printf enabled, but extension \"%s\" not found!\n", +av_log(ctx, AV_LOG_ERROR, "Debug_printf/profile enabled, but extension \"%s\" not found!\n", tstr); err = AVERROR(EINVAL); goto fail;
[FFmpeg-cvslog] vulkan: parse instance list and add the DEBUG_UTILS extension
ffmpeg | branch: master | Lynne | Fri Oct 4 01:27:46 2024 +0200| [356d1cc8ff8e401cecf5300c5a6174cc19204988] | committer: Lynne vulkan: parse instance list and add the DEBUG_UTILS extension Required to let users know whether debugging is active. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=356d1cc8ff8e401cecf5300c5a6174cc19204988 --- libavfilter/vulkan_filter.c | 2 ++ libavutil/hwcontext_vulkan.c | 1 - libavutil/vulkan.c | 2 ++ libavutil/vulkan_loader.h| 4 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c index 8d9b416d6a..85665b4d42 100644 --- a/libavfilter/vulkan_filter.c +++ b/libavfilter/vulkan_filter.c @@ -151,6 +151,8 @@ skip: s->extensions = ff_vk_extensions_to_mask(vk_dev->enabled_dev_extensions, vk_dev->nb_enabled_dev_extensions); +s->extensions |= ff_vk_extensions_to_mask(vk_dev->enabled_inst_extensions, + vk_dev->nb_enabled_inst_extensions); err = ff_vk_load_functions(device_ctx, &s->vkfn, s->extensions, 1, 1); if (err < 0) { diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 870e988578..033077178c 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -739,7 +739,6 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, if (found) { av_log(ctx, AV_LOG_VERBOSE, "Using %s extension %s\n", mod, tstr); ADD_VAL_TO_LIST(extension_names, extensions_found, tstr); -p->vkctx.extensions |= FF_VK_EXT_DEBUG_UTILS; } else { av_log(ctx, AV_LOG_ERROR, "Debug extension \"%s\" not found!\n", tstr); diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index ba1d18f4c6..4ee28ad839 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -2347,6 +2347,8 @@ int ff_vk_init(FFVulkanContext *s, void *log_parent, s->extensions = ff_vk_extensions_to_mask(s->hwctx->enabled_dev_extensions, s->hwctx->nb_enabled_dev_extensions); +s->extensions |= ff_vk_extensions_to_mask(s->hwctx->enabled_inst_extensions, + s->hwctx->nb_enabled_inst_extensions); err = ff_vk_load_functions(s->device, &s->vkfn, s->extensions, 1, 1); if (err < 0) { diff --git a/libavutil/vulkan_loader.h b/libavutil/vulkan_loader.h index 3dc27c159e..12e9884b8c 100644 --- a/libavutil/vulkan_loader.h +++ b/libavutil/vulkan_loader.h @@ -40,6 +40,10 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions, const char *name; FFVulkanExtensions flag; } extension_map[] = { +/* Instance extensions */ +{ VK_EXT_DEBUG_UTILS_EXTENSION_NAME, FF_VK_EXT_DEBUG_UTILS}, + +/* Device extensions */ { VK_KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME, FF_VK_EXT_RELAXED_EXTENDED_INSTR }, { VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_DMABUF_MEMORY }, { VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME, FF_VK_EXT_DRM_MODIFIER_FLAGS }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] vulkan: don't enable GL_EXT_buffer_reference by default
ffmpeg | branch: master | Lynne | Thu Oct 3 07:37:00 2024 +0200| [832947be023bc828d05654cc1502e8c6bdcb466a] | committer: Lynne vulkan: don't enable GL_EXT_buffer_reference by default Only nlmeans_vulkan uses it. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=832947be023bc828d05654cc1502e8c6bdcb466a --- libavfilter/vf_nlmeans_vulkan.c | 6 -- libavutil/vulkan.c | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_nlmeans_vulkan.c b/libavfilter/vf_nlmeans_vulkan.c index 9ad12eb7b6..39460dc194 100644 --- a/libavfilter/vf_nlmeans_vulkan.c +++ b/libavfilter/vf_nlmeans_vulkan.c @@ -240,7 +240,8 @@ static av_cold int init_weights_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e RET(ff_vk_shader_init(vkctx, shd, "nlmeans_weights", VK_SHADER_STAGE_COMPUTE_BIT, - NULL, 0, + (const char *[]) { "GL_EXT_buffer_reference", + "GL_EXT_buffer_reference2" }, 2, wg_size, 1, 1, 0)); @@ -431,7 +432,8 @@ static av_cold int init_denoise_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e RET(ff_vk_shader_init(vkctx, shd, "nlmeans_denoise", VK_SHADER_STAGE_COMPUTE_BIT, - NULL, 0, + (const char *[]) { "GL_EXT_buffer_reference", + "GL_EXT_buffer_reference2" }, 2, 32, 32, 1, 0)); diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 4ee28ad839..fe69bf4698 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -1479,8 +1479,6 @@ int ff_vk_shader_init(FFVulkanContext *s, FFVulkanShader *shd, const char *name, GLSLC(0, #define IS_WITHIN(v1, v2) ((v1.x < v2.x) && (v1.y < v2.y)) ); GLSLC(0, ); GLSLC(0, #extension GL_EXT_scalar_block_layout : require ); -GLSLC(0, #extension GL_EXT_buffer_reference : require ); -GLSLC(0, #extension GL_EXT_buffer_reference2 : require ); if (s->extensions & FF_VK_EXT_RELAXED_EXTENDED_INSTR) GLSLC(0, #extension GL_EXT_debug_printf : require ); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] vulkan: move shader data execution state to execution pools
ffmpeg | branch: master | Lynne | Sun Sep 29 06:37:10 2024 +0200| [d233d9902fde00b82a6dcad04bf5001c0f8fcded] | committer: Lynne vulkan: move shader data execution state to execution pools This finally permits using fully compiled shaders across multiple execution contexts. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d233d9902fde00b82a6dcad04bf5001c0f8fcded --- libavutil/vulkan.c | 157 +++-- libavutil/vulkan.h | 81 --- 2 files changed, 153 insertions(+), 85 deletions(-) diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 77b86d0e6b..031493eb8b 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -262,6 +262,28 @@ void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool) av_free(e->sem_wait); } +/* Free shader-specific data */ +for (int i = 0; i < pool->nb_reg_shd; i++) { +FFVulkanShaderData *sd = &pool->reg_shd[i]; + +if (s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER) { +for (int j = 0; j < sd->nb_descriptor_sets; j++) { +FFVulkanDescriptorSetData *set_data = &sd->desc_set_buf[j]; +if (set_data->buf.mem) +ff_vk_unmap_buffer(s, &set_data->buf, 0); +ff_vk_free_buf(s, &set_data->buf); +} +} + +if (sd->desc_pool) +vk->DestroyDescriptorPool(s->hwctx->act_dev, sd->desc_pool, + s->hwctx->alloc); + +av_freep(&sd->desc_set_buf); +av_freep(&sd->desc_bind); +av_freep(&sd->desc_sets); +} + if (pool->cmd_bufs) vk->FreeCommandBuffers(s->hwctx->act_dev, pool->cmd_buf_pool, pool->pool_size, pool->cmd_bufs); @@ -1655,6 +1677,16 @@ int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader *shd, if (err < 0) return err; +if (s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER) { +shd->bound_buffer_indices = av_calloc(shd->nb_descriptor_sets, + sizeof(*shd->bound_buffer_indices)); +if (!shd->bound_buffer_indices) +return AVERROR(ENOMEM); + +for (int i = 0; i < shd->nb_descriptor_sets; i++) +shd->bound_buffer_indices[i] = i; +} + { VkShaderModule mod; err = create_shader_module(s, shd, &mod, spirv, spirv_len); @@ -1817,25 +1849,40 @@ int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd) { int err; +FFVulkanShaderData *sd; if (!shd->nb_descriptor_sets) return 0; +sd = av_realloc_array(pool->reg_shd, + sizeof(*pool->reg_shd), + pool->nb_reg_shd + 1); +if (!sd) +return AVERROR(ENOMEM); + +pool->reg_shd = sd; +sd = &sd[pool->nb_reg_shd++]; +memset(sd, 0, sizeof(*sd)); + +sd->shd = shd; +sd->nb_descriptor_sets = shd->nb_descriptor_sets; + if (s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER) { -shd->desc_bind = av_calloc(shd->nb_descriptor_sets, sizeof(*shd->desc_bind)); -if (!shd->desc_bind) +sd->desc_bind = av_malloc_array(sd->nb_descriptor_sets, sizeof(*sd->desc_bind)); +if (!sd->desc_bind) return AVERROR(ENOMEM); -shd->bound_buffer_indices = av_calloc(shd->nb_descriptor_sets, - sizeof(*shd->bound_buffer_indices)); -if (!shd->bound_buffer_indices) +sd->desc_set_buf = av_calloc(sd->nb_descriptor_sets, sizeof(*sd->desc_set_buf)); +if (!sd->desc_set_buf) return AVERROR(ENOMEM); -for (int i = 0; i < shd->nb_descriptor_sets; i++) { +for (int i = 0; i < sd->nb_descriptor_sets; i++) { FFVulkanDescriptorSet *set = &shd->desc_set[i]; +FFVulkanDescriptorSetData *sdb = &sd->desc_set_buf[i]; int nb = set->singular ? 1 : pool->pool_size; -err = ff_vk_create_buf(s, &set->buf, set->aligned_size*nb, +err = ff_vk_create_buf(s, &sdb->buf, + set->aligned_size*nb, NULL, NULL, set->usage, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | @@ -1843,17 +1890,15 @@ int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, if (err < 0) return err; -err = ff_vk_map_buffer(s, &set->buf, &set->desc_mem, 0); +err = ff_vk_map_buffer(s, &sdb->buf, &sdb->desc_mem, 0); if (err < 0) return err; -shd->desc_bind[i] = (VkDescriptorBufferBindingInfoEXT) { +sd->desc_bind[i] = (VkDescriptorBufferBindingInfoEXT) { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_B
[FFmpeg-cvslog] lavfi/*vulkan: forward FFVulkanContext to SPIR-V compilers
ffmpeg | branch: master | Lynne | Thu Oct 3 07:27:37 2024 +0200| [0bc4e03322c7564572ed4f939ba5d1145d28d113] | committer: Lynne lavfi/*vulkan: forward FFVulkanContext to SPIR-V compilers We need to know what extensions are supported. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0bc4e03322c7564572ed4f939ba5d1145d28d113 --- libavfilter/vf_avgblur_vulkan.c | 2 +- libavfilter/vf_blend_vulkan.c | 2 +- libavfilter/vf_bwdif_vulkan.c | 2 +- libavfilter/vf_chromaber_vulkan.c | 2 +- libavfilter/vf_flip_vulkan.c | 2 +- libavfilter/vf_gblur_vulkan.c | 2 +- libavfilter/vf_nlmeans_vulkan.c | 4 ++-- libavfilter/vf_overlay_vulkan.c | 2 +- libavfilter/vf_scale_vulkan.c | 2 +- libavfilter/vf_transpose_vulkan.c | 2 +- libavfilter/vf_xfade_vulkan.c | 2 +- libavfilter/vsrc_testsrc_vulkan.c | 2 +- libavfilter/vulkan_glslang.c | 20 ++-- libavfilter/vulkan_shaderc.c | 8 libavfilter/vulkan_spirv.h| 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c index 3972ea0cbb..9214ebcc0f 100644 --- a/libavfilter/vf_avgblur_vulkan.c +++ b/libavfilter/vf_avgblur_vulkan.c @@ -137,7 +137,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) } GLSLC(0, }); -RET(spv->compile_shader(spv, ctx, &s->shd, &spv_data, &spv_len, "main", +RET(spv->compile_shader(vkctx, spv, &s->shd, &spv_data, &spv_len, "main", &spv_opaque)); RET(ff_vk_shader_link(vkctx, &s->shd, spv_data, spv_len, "main")); diff --git a/libavfilter/vf_blend_vulkan.c b/libavfilter/vf_blend_vulkan.c index ccc025fe6b..406b087503 100644 --- a/libavfilter/vf_blend_vulkan.c +++ b/libavfilter/vf_blend_vulkan.c @@ -208,7 +208,7 @@ static av_cold int init_filter(AVFilterContext *avctx) } GLSLC(0, } ); -RET(spv->compile_shader(spv, avctx, shd, &spv_data, &spv_len, "main", +RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque)); RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main")); diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c index 3164eb3395..2ea9512fcb 100644 --- a/libavfilter/vf_bwdif_vulkan.c +++ b/libavfilter/vf_bwdif_vulkan.c @@ -244,7 +244,7 @@ static av_cold int init_filter(AVFilterContext *ctx) GLSLC(0, } ); -RET(spv->compile_shader(spv, ctx, &s->shd, &spv_data, &spv_len, "main", +RET(spv->compile_shader(vkctx, spv, &s->shd, &spv_data, &spv_len, "main", &spv_opaque)); RET(ff_vk_shader_link(vkctx, &s->shd, spv_data, spv_len, "main")); diff --git a/libavfilter/vf_chromaber_vulkan.c b/libavfilter/vf_chromaber_vulkan.c index 450715b36c..8a62e514fa 100644 --- a/libavfilter/vf_chromaber_vulkan.c +++ b/libavfilter/vf_chromaber_vulkan.c @@ -148,7 +148,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) } GLSLC(0, }); -RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main", +RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque)); RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main")); diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c index 2b89a9a6a3..3e0a7ebc85 100644 --- a/libavfilter/vf_flip_vulkan.c +++ b/libavfilter/vf_flip_vulkan.c @@ -121,7 +121,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType } GLSLC(0, } ); -RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main", +RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque)); RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main")); diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c index a56a6ece00..9632a084e4 100644 --- a/libavfilter/vf_gblur_vulkan.c +++ b/libavfilter/vf_gblur_vulkan.c @@ -169,7 +169,7 @@ static int init_gblur_pipeline(GBlurVulkanContext *s, } GLSLC(0, }); -RET(spv->compile_shader(spv, s, shd, &spv_data, &spv_len, "main", +RET(spv->compile_shader(&s->vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque)); RET(ff_vk_shader_link(&s->vkctx, shd, spv_data, spv_len, "main")); diff --git a/libavfilter/vf_nlmeans_vulkan.c b/libavfilter/vf_nlmeans_vulkan.c index b413194035..9ad12eb7b6 100644 --- a/libavfilter/vf_nlmeans_vulkan.c +++ b/liba
[FFmpeg-cvslog] vulkan_glslang: add more stages, target Vulkan 1.3 and output debug info
ffmpeg | branch: master | Lynne | Wed Oct 2 11:55:39 2024 +0200| [a2a983e1d03c6635ab8fb7762b4918fe36932c62] | committer: Lynne vulkan_glslang: add more stages, target Vulkan 1.3 and output debug info > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2a983e1d03c6635ab8fb7762b4918fe36932c62 --- libavfilter/vulkan_glslang.c | 39 --- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/libavfilter/vulkan_glslang.c b/libavfilter/vulkan_glslang.c index 7ac7d6b2c4..68c0fcbe53 100644 --- a/libavfilter/vulkan_glslang.c +++ b/libavfilter/vulkan_glslang.c @@ -149,21 +149,28 @@ static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, [VK_SHADER_STAGE_VERTEX_BIT] = GLSLANG_STAGE_VERTEX, [VK_SHADER_STAGE_FRAGMENT_BIT] = GLSLANG_STAGE_FRAGMENT, [VK_SHADER_STAGE_COMPUTE_BIT] = GLSLANG_STAGE_COMPUTE, +#if ((GLSLANG_VERSION_MAJOR) > 12) +[VK_SHADER_STAGE_TASK_BIT_EXT] = GLSLANG_STAGE_TASK, +[VK_SHADER_STAGE_MESH_BIT_EXT] = GLSLANG_STAGE_MESH, +[VK_SHADER_STAGE_RAYGEN_BIT_KHR] = GLSLANG_STAGE_RAYGEN, +[VK_SHADER_STAGE_INTERSECTION_BIT_KHR] = GLSLANG_STAGE_INTERSECT, +[VK_SHADER_STAGE_ANY_HIT_BIT_KHR] = GLSLANG_STAGE_ANYHIT, +[VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR] = GLSLANG_STAGE_CLOSESTHIT, +[VK_SHADER_STAGE_MISS_BIT_KHR] = GLSLANG_STAGE_MISS, +[VK_SHADER_STAGE_CALLABLE_BIT_KHR] = GLSLANG_STAGE_CALLABLE, +#endif }; const glslang_input_t glslc_input = { .language = GLSLANG_SOURCE_GLSL, .stage = glslc_stage[shd->stage], .client= GLSLANG_CLIENT_VULKAN, -/* GLSLANG_TARGET_VULKAN_1_2 before 11.6 resulted in targeting 1.0 */ -#if (((GLSLANG_VERSION_MAJOR) > 11) || ((GLSLANG_VERSION_MAJOR) == 11 && \ -(((GLSLANG_VERSION_MINOR) > 6) || ((GLSLANG_VERSION_MINOR) == 6 && \ - ((GLSLANG_VERSION_PATCH) > 0) +#if ((GLSLANG_VERSION_MAJOR) >= 12) +.client_version= GLSLANG_TARGET_VULKAN_1_3, +.target_language_version = GLSLANG_TARGET_SPV_1_6, +#else .client_version= GLSLANG_TARGET_VULKAN_1_2, .target_language_version = GLSLANG_TARGET_SPV_1_5, -#else -.client_version= GLSLANG_TARGET_VULKAN_1_1, -.target_language_version = GLSLANG_TARGET_SPV_1_3, #endif .target_language = GLSLANG_TARGET_SPV, .code = shd->src.str, @@ -175,6 +182,20 @@ static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, .resource = &glslc_resource_limits, }; +#if ((GLSLANG_VERSION_MAJOR) >= 12) +glslang_spv_options_t glslc_opts = { +.generate_debug_info = !!(s->extensions & FF_VK_EXT_DEBUG_UTILS), +.emit_nonsemantic_shader_debug_info = !!(s->extensions & FF_VK_EXT_RELAXED_EXTENDED_INSTR), +.emit_nonsemantic_shader_debug_source = !!(s->extensions & FF_VK_EXT_RELAXED_EXTENDED_INSTR), +.disable_optimizer = !!(s->extensions & FF_VK_EXT_DEBUG_UTILS), +.strip_debug_info = !(s->extensions & FF_VK_EXT_DEBUG_UTILS), +.optimize_size = 0, +.disassemble = 0, +.validate = 1, +.compile_only = 0, +}; +#endif + av_assert0(glslc_refcount); *opaque = NULL; @@ -218,7 +239,11 @@ static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, return AVERROR(EINVAL); } +#if ((GLSLANG_VERSION_MAJOR) >= 12) +glslang_program_SPIRV_generate_with_options(glslc_program, glslc_input.stage, &glslc_opts); +#else glslang_program_SPIRV_generate(glslc_program, glslc_input.stage); +#endif messages = glslang_program_SPIRV_get_messages(glslc_program); if (messages) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".