[FFmpeg-cvslog] fate: allow https for git URLs
ffmpeg | branch: master | Timo Rothenpieler | Wed Apr 24 22:00:39 2024 +0200| [59767636c77fa9014587c3084bbc210f65a5cd2a] | committer: Timo Rothenpieler fate: allow https for git URLs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59767636c77fa9014587c3084bbc210f65a5cd2a --- tests/fate.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fate.sh b/tests/fate.sh index c5ee18de80..4081e865ae 100755 --- a/tests/fate.sh +++ b/tests/fate.sh @@ -30,14 +30,14 @@ lock(){ checkout(){ case "$repo" in file:*|/*) src="${repo#file:}" ;; -git:*) git clone --quiet --branch "$branch" "$repo" "$src" ;; +git:*|https:*) git clone --quiet --branch "$branch" "$repo" "$src" ;; esac } update()( cd ${src} || return case "$repo" in -git:*) git fetch --quiet --force && git reset --quiet --hard "origin/$branch" ;; +git:*|https:*) git fetch --quiet --force && git reset --quiet --hard "origin/$branch" ;; esac ) ___ 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] doc: use HOSTEXESUF when calling print_options
ffmpeg | branch: master | Timo Rothenpieler | Tue Apr 23 23:57:05 2024 +0200| [61f27e5f71f8a972410daf241a9de067d9915ce1] | committer: Timo Rothenpieler doc: use HOSTEXESUF when calling print_options This is neccesary on WSL, and has no averse effects in normal environments. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61f27e5f71f8a972410daf241a9de067d9915ce1 --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 67586e4b74..98d29f1c66 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -60,7 +60,7 @@ GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi) $(GENTEXI): TAG = GENTEXI $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF) - $(M)doc/print_options $* > $@ + $(M)doc/print_options$(HOSTEXESUF) $* > $@ doc/%.html: TAG = HTML doc/%-all.html: TAG = HTML ___ 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/nvenc: support SDK 12.2 bit depth API
ffmpeg | branch: release/6.1 | Timo Rothenpieler | Sun Mar 31 18:39:49 2024 +0200| [38346298973e3869d895e0ad3ca3b19dc598c5c8] | committer: Timo Rothenpieler avcodec/nvenc: support SDK 12.2 bit depth API > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38346298973e3869d895e0ad3ca3b19dc598c5c8 --- libavcodec/nvenc.c | 15 +++ libavcodec/nvenc.h | 5 + 2 files changed, 20 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 66a95f54d1..c1ab4e7265 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1255,6 +1255,11 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) h264->level = ctx->level; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +h264->inputBitDepth = h264->outputBitDepth = +IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#endif + if (ctx->coder >= 0) h264->entropyCodingMode = ctx->coder; @@ -1370,7 +1375,12 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +hevc->inputBitDepth = hevc->outputBitDepth = +IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#else hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; +#endif hevc->level = ctx->level; @@ -1455,8 +1465,13 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx) av1->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +av1->inputBitDepth = IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +av1->outputBitDepth = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#else av1->inputPixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; av1->pixelBitDepthMinus8 = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? 2 : 0; +#endif if (ctx->b_ref_mode >= 0) av1->useBFramesAsRef = ctx->b_ref_mode; diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index e5b0eb8305..ecc827de97 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -83,6 +83,11 @@ typedef void ID3D11Device; #define NVENC_NO_DEPRECATED_RC #endif +// SDK 12.2 compile time feature checks +#if NVENCAPI_CHECK_VERSION(12, 2) +#define NVENC_HAVE_NEW_BIT_DEPTH_API +#endif + typedef struct NvencSurface { NV_ENC_INPUT_PTR input_surface; ___ 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/nvenc: stop using long deprecated format specifiers
ffmpeg | branch: release/6.1 | Timo Rothenpieler | Sun Mar 31 18:25:15 2024 +0200| [3481f8d99fc44f5516957e774b7f2da74c33beb8] | committer: Timo Rothenpieler avcodec/nvenc: stop using long deprecated format specifiers > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3481f8d99fc44f5516957e774b7f2da74c33beb8 --- libavcodec/nvenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 626f10d20a..66a95f54d1 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1689,15 +1689,15 @@ static NV_ENC_BUFFER_FORMAT nvenc_map_buffer_format(enum AVPixelFormat pix_fmt) { switch (pix_fmt) { case AV_PIX_FMT_YUV420P: -return NV_ENC_BUFFER_FORMAT_YV12_PL; +return NV_ENC_BUFFER_FORMAT_YV12; case AV_PIX_FMT_NV12: -return NV_ENC_BUFFER_FORMAT_NV12_PL; +return NV_ENC_BUFFER_FORMAT_NV12; case AV_PIX_FMT_P010: case AV_PIX_FMT_P016: return NV_ENC_BUFFER_FORMAT_YUV420_10BIT; case AV_PIX_FMT_GBRP: case AV_PIX_FMT_YUV444P: -return NV_ENC_BUFFER_FORMAT_YUV444_PL; +return NV_ENC_BUFFER_FORMAT_YUV444; case AV_PIX_FMT_GBRP16: case AV_PIX_FMT_YUV444P16: return NV_ENC_BUFFER_FORMAT_YUV444_10BIT; ___ 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/nvenc: support SDK 12.2 bit depth API
ffmpeg | branch: release/7.0 | Timo Rothenpieler | Sun Mar 31 18:39:49 2024 +0200| [4c5a809388f41ed6d67f6869958be47e3003fec6] | committer: Timo Rothenpieler avcodec/nvenc: support SDK 12.2 bit depth API > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c5a809388f41ed6d67f6869958be47e3003fec6 --- libavcodec/nvenc.c | 15 +++ libavcodec/nvenc.h | 5 + 2 files changed, 20 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 0cb3b87c67..8327496937 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1255,6 +1255,11 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) h264->level = ctx->level; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +h264->inputBitDepth = h264->outputBitDepth = +IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#endif + if (ctx->coder >= 0) h264->entropyCodingMode = ctx->coder; @@ -1370,7 +1375,12 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +hevc->inputBitDepth = hevc->outputBitDepth = +IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#else hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; +#endif hevc->level = ctx->level; @@ -1455,8 +1465,13 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx) av1->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +av1->inputBitDepth = IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +av1->outputBitDepth = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#else av1->inputPixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; av1->pixelBitDepthMinus8 = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? 2 : 0; +#endif if (ctx->b_ref_mode >= 0) av1->useBFramesAsRef = ctx->b_ref_mode; diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 48cdfc58aa..d99d8a0d76 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -83,6 +83,11 @@ typedef void ID3D11Device; #define NVENC_NO_DEPRECATED_RC #endif +// SDK 12.2 compile time feature checks +#if NVENCAPI_CHECK_VERSION(12, 2) +#define NVENC_HAVE_NEW_BIT_DEPTH_API +#endif + typedef struct NvencSurface { NV_ENC_INPUT_PTR input_surface; ___ 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/nvenc: stop using long deprecated format specifiers
ffmpeg | branch: release/7.0 | Timo Rothenpieler | Sun Mar 31 18:25:15 2024 +0200| [5ff5a431c758e8b25e3bee2a0242d9b30422edf1] | committer: Timo Rothenpieler avcodec/nvenc: stop using long deprecated format specifiers > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ff5a431c758e8b25e3bee2a0242d9b30422edf1 --- libavcodec/nvenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index fd73af2a32..0cb3b87c67 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1689,15 +1689,15 @@ static NV_ENC_BUFFER_FORMAT nvenc_map_buffer_format(enum AVPixelFormat pix_fmt) { switch (pix_fmt) { case AV_PIX_FMT_YUV420P: -return NV_ENC_BUFFER_FORMAT_YV12_PL; +return NV_ENC_BUFFER_FORMAT_YV12; case AV_PIX_FMT_NV12: -return NV_ENC_BUFFER_FORMAT_NV12_PL; +return NV_ENC_BUFFER_FORMAT_NV12; case AV_PIX_FMT_P010: case AV_PIX_FMT_P016: return NV_ENC_BUFFER_FORMAT_YUV420_10BIT; case AV_PIX_FMT_GBRP: case AV_PIX_FMT_YUV444P: -return NV_ENC_BUFFER_FORMAT_YUV444_PL; +return NV_ENC_BUFFER_FORMAT_YUV444; case AV_PIX_FMT_GBRP16: case AV_PIX_FMT_YUV444P16: return NV_ENC_BUFFER_FORMAT_YUV444_10BIT; ___ 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/nvenc: provide nvenc with monotonic frame index
ffmpeg | branch: master | Timo Rothenpieler | Mon Apr 1 00:43:23 2024 +0200| [271a0a55bcc5b5dac471aedbb5cd446cb645547c] | committer: Timo Rothenpieler avcodec/nvenc: provide nvenc with monotonic frame index > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=271a0a55bcc5b5dac471aedbb5cd446cb645547c --- libavcodec/nvenc.c | 1 + libavcodec/nvenc.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 05cb148504..b6c5ed3e6b 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -2784,6 +2784,7 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame) pic_params.encodePicFlags = 0; } +pic_params.frameIdx = ctx->frame_idx_counter++; pic_params.inputTimeStamp = frame->pts; if (ctx->extra_sei) { diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 45860de722..85ecaf1b5f 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -226,6 +226,8 @@ typedef struct NvencContext void *nvencoder; +uint32_t frame_idx_counter; + int preset; int profile; int level; ___ 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/nvenc: update minimum driver version list
ffmpeg | branch: master | Timo Rothenpieler | Sun Mar 31 21:43:01 2024 +0200| [c06e9e289f1e26b779ea46e435ed0ad243a2cd0d] | committer: Timo Rothenpieler avcodec/nvenc: update minimum driver version list > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c06e9e289f1e26b779ea46e435ed0ad243a2cd0d --- libavcodec/nvenc.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index d121442957..05cb148504 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -242,8 +242,20 @@ static void nvenc_map_preset(NvencContext *ctx) static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level) { -#if NVENCAPI_CHECK_VERSION(12, 1) +#if NVENCAPI_CHECK_VERSION(12, 3) const char *minver = "(unknown)"; +#elif NVENCAPI_CHECK_VERSION(12, 2) +# if defined(_WIN32) || defined(__CYGWIN__) +const char *minver = "551.76"; +# else +const char *minver = "550.54.14"; +# endif +#elif NVENCAPI_CHECK_VERSION(12, 1) +# if defined(_WIN32) || defined(__CYGWIN__) +const char *minver = "531.61"; +# else +const char *minver = "530.41.03"; +# endif #elif NVENCAPI_CHECK_VERSION(12, 0) # if defined(_WIN32) || defined(__CYGWIN__) const char *minver = "522.25"; ___ 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/nvenc: add support for unidirectional b-frames
ffmpeg | branch: master | Timo Rothenpieler | Sun Mar 31 21:26:15 2024 +0200| [21b4708969415b9ec6d212fb35c12e4d1c28d066] | committer: Timo Rothenpieler avcodec/nvenc: add support for unidirectional b-frames > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21b4708969415b9ec6d212fb35c12e4d1c28d066 --- libavcodec/nvenc.c | 12 libavcodec/nvenc.h | 2 ++ libavcodec/nvenc_hevc.c | 3 +++ libavcodec/version.h| 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 7f938a519f..d121442957 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -613,6 +613,14 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) } #endif +#ifdef NVENC_HAVE_UNIDIR_B +ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_UNIDIRECTIONAL_B); +if(ctx->unidir_b && ret <= 0) { +av_log(avctx, AV_LOG_WARNING, "Unidirectional B-Frames not supported by the device\n"); +return AVERROR(ENOSYS); +} +#endif + ctx->support_dyn_bitrate = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE); return 0; @@ -1658,6 +1666,10 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS } +#ifdef NVENC_HAVE_UNIDIR_B +ctx->init_encode_params.enableUniDirectionalB = ctx->unidir_b; +#endif + ctx->init_encode_params.enableEncodeAsync = 0; ctx->init_encode_params.enablePTD = 1; diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 3e207b1877..45860de722 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -89,6 +89,7 @@ typedef void ID3D11Device; #define NVENC_HAVE_TEMPORAL_FILTER #define NVENC_HAVE_LOOKAHEAD_LEVEL #define NVENC_HAVE_UHQ_TUNING +#define NVENC_HAVE_UNIDIR_B #endif typedef struct NvencSurface @@ -276,6 +277,7 @@ typedef struct NvencContext int rgb_mode; int tf_level; int lookahead_level; +int unidir_b; } NvencContext; int ff_nvenc_encode_init(AVCodecContext *avctx); diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c index e0d16e82c7..bd8b6153f3 100644 --- a/libavcodec/nvenc_hevc.c +++ b/libavcodec/nvenc_hevc.c @@ -213,6 +213,9 @@ static const AVOption options[] = { { "1","", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_1 }, 0, 0, VE, .unit = "lookahead_level" }, { "2","", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_2 }, 0, 0, VE, .unit = "lookahead_level" }, { "3","", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_3 }, 0, 0, VE, .unit = "lookahead_level" }, +#endif +#ifdef NVENC_HAVE_UNIDIR_B +{ "unidir_b", "Enable use of unidirectional B-Frames.", OFFSET(unidir_b), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, #endif { NULL } }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 06631ffa8c..7aa95fc3f1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 4 +#define LIBAVCODEC_VERSION_MINOR 5 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ ___ 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/nvenc: add support for uhq tune
ffmpeg | branch: master | Timo Rothenpieler | Sun Mar 31 21:17:11 2024 +0200| [a27096611835f1e46b0c842ad4fffe42b36bad41] | committer: Timo Rothenpieler avcodec/nvenc: add support for uhq tune > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a27096611835f1e46b0c842ad4fffe42b36bad41 --- libavcodec/nvenc.h | 1 + libavcodec/nvenc_hevc.c | 5 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 30f9800d21..3e207b1877 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -88,6 +88,7 @@ typedef void ID3D11Device; #define NVENC_HAVE_NEW_BIT_DEPTH_API #define NVENC_HAVE_TEMPORAL_FILTER #define NVENC_HAVE_LOOKAHEAD_LEVEL +#define NVENC_HAVE_UHQ_TUNING #endif typedef struct NvencSurface diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c index 7509a93516..e0d16e82c7 100644 --- a/libavcodec/nvenc_hevc.c +++ b/libavcodec/nvenc_hevc.c @@ -51,8 +51,11 @@ static const AVOption options[] = { { "p5", "slow (good quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P5 }, 0, 0, VE, .unit = "preset" }, { "p6", "slower (better quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P6 }, 0, 0, VE, .unit = "preset" }, { "p7", "slowest (best quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P7 }, 0, 0, VE, .unit = "preset" }, -{ "tune","Set the encoding tuning info", OFFSET(tuning_info), AV_OPT_TYPE_INT, { .i64 = NV_ENC_TUNING_INFO_HIGH_QUALITY }, NV_ENC_TUNING_INFO_HIGH_QUALITY, NV_ENC_TUNING_INFO_LOSSLESS, VE, .unit = "tune" }, +{ "tune","Set the encoding tuning info", OFFSET(tuning_info), AV_OPT_TYPE_INT, { .i64 = NV_ENC_TUNING_INFO_HIGH_QUALITY }, NV_ENC_TUNING_INFO_HIGH_QUALITY, NV_ENC_TUNING_INFO_COUNT - 1, VE, .unit = "tune" }, { "hq", "High quality",0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_HIGH_QUALITY }, 0, 0, VE, .unit = "tune" }, +#ifdef NVENC_HAVE_UHQ_TUNING +{ "uhq", "Ultra high quality", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_HIGH_QUALITY }, 0, 0, VE, .unit = "tune" }, +#endif { "ll", "Low latency", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOW_LATENCY }, 0, 0, VE, .unit = "tune" }, { "ull", "Ultra low latency", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY }, 0, 0, VE, .unit = "tune" }, { "lossless","Lossless",0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOSSLESS }, 0, 0, VE, .unit = "tune" }, ___ 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/nvenc: add support for lookahead_level
ffmpeg | branch: master | Timo Rothenpieler | Sun Mar 31 20:52:27 2024 +0200| [77d23bcb1b91b7b38808c3532945def5aaed5cd9] | committer: Timo Rothenpieler avcodec/nvenc: add support for lookahead_level > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77d23bcb1b91b7b38808c3532945def5aaed5cd9 --- libavcodec/nvenc.c | 37 +++-- libavcodec/nvenc.h | 2 ++ libavcodec/nvenc_av1.c | 9 + libavcodec/nvenc_h264.c | 9 + libavcodec/nvenc_hevc.c | 9 + 5 files changed, 64 insertions(+), 2 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 5afd7bf218..7f938a519f 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -602,6 +602,17 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) } #endif +#ifdef NVENC_HAVE_LOOKAHEAD_LEVEL +ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOOKAHEAD_LEVEL); +if(ctx->rc_lookahead > 0 && ctx->lookahead_level > 0 && + ctx->lookahead_level != NV_ENC_LOOKAHEAD_LEVEL_AUTOSELECT && + ctx->lookahead_level > ret) +{ +av_log(avctx, AV_LOG_WARNING, "Lookahead level not supported. Maximum level: %d\n", ret); +return AVERROR(ENOSYS); +} +#endif + ctx->support_dyn_bitrate = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE); return 0; @@ -995,7 +1006,7 @@ static av_cold int nvenc_recalc_surfaces(AVCodecContext *avctx) return 0; } -static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) +static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; @@ -1124,6 +1135,24 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) if (ctx->encode_config.rcParams.lookaheadDepth < ctx->rc_lookahead) av_log(avctx, AV_LOG_WARNING, "Clipping lookahead depth to %d (from %d) due to lack of surfaces/delay", ctx->encode_config.rcParams.lookaheadDepth, ctx->rc_lookahead); + +#ifdef NVENC_HAVE_LOOKAHEAD_LEVEL +if (ctx->lookahead_level >= 0) { +switch (ctx->lookahead_level) { +case NV_ENC_LOOKAHEAD_LEVEL_0: +case NV_ENC_LOOKAHEAD_LEVEL_1: +case NV_ENC_LOOKAHEAD_LEVEL_2: +case NV_ENC_LOOKAHEAD_LEVEL_3: +case NV_ENC_LOOKAHEAD_LEVEL_AUTOSELECT: +break; +default: +av_log(avctx, AV_LOG_ERROR, "Invalid lookahead level.\n"); +return AVERROR(EINVAL); +} + +ctx->encode_config.rcParams.lookaheadLevel = ctx->lookahead_level; +} +#endif } } @@ -1151,6 +1180,8 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0; ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; } + +return 0; } static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) @@ -1675,7 +1706,9 @@ FF_ENABLE_DEPRECATION_WARNINGS nvenc_recalc_surfaces(avctx); -nvenc_setup_rate_control(avctx); +res = nvenc_setup_rate_control(avctx); +if (res < 0) +return res; if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { ctx->encode_config.frameFieldMode = NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD; diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index c320c2514f..30f9800d21 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -87,6 +87,7 @@ typedef void ID3D11Device; #if NVENCAPI_CHECK_VERSION(12, 2) #define NVENC_HAVE_NEW_BIT_DEPTH_API #define NVENC_HAVE_TEMPORAL_FILTER +#define NVENC_HAVE_LOOKAHEAD_LEVEL #endif typedef struct NvencSurface @@ -273,6 +274,7 @@ typedef struct NvencContext int max_slice_size; int rgb_mode; int tf_level; +int lookahead_level; } NvencContext; int ff_nvenc_encode_init(AVCodecContext *avctx); diff --git a/libavcodec/nvenc_av1.c b/libavcodec/nvenc_av1.c index c46cee9fac..d37ee07bff 100644 --- a/libavcodec/nvenc_av1.c +++ b/libavcodec/nvenc_av1.c @@ -149,6 +149,15 @@ static const AVOption options[] = { OFFSET(extra_sei), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, { "a53cc","Use A53 Closed Captions (if available)", OFFSET(a53_cc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, { "s12m_tc", "Use timecode (if available)",OFFSET(s12m_tc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, +#ifdef NVENC_HAVE_LOOKAHEAD_LEVEL +{ "lookahead_level", "Specifies the lookahead level. Higher level may improve quality at the expense of performa
[FFmpeg-cvslog] avcodec/nvenc: add support for HEVC temporal filtering
ffmpeg | branch: master | Timo Rothenpieler | Sun Mar 31 20:10:45 2024 +0200| [64e3fc906971e18ec9e2810826ac9bb285ea08bb] | committer: Timo Rothenpieler avcodec/nvenc: add support for HEVC temporal filtering > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=64e3fc906971e18ec9e2810826ac9bb285ea08bb --- libavcodec/nvenc.c | 27 +++ libavcodec/nvenc.h | 2 ++ libavcodec/nvenc_hevc.c | 6 ++ 3 files changed, 35 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 8327496937..5afd7bf218 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -594,6 +594,14 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) return AVERROR(ENOSYS); } +#ifdef NVENC_HAVE_TEMPORAL_FILTER +ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_TEMPORAL_FILTER); +if(ctx->tf_level > 0 && ret <= 0) { +av_log(avctx, AV_LOG_WARNING, "Temporal filtering not supported by the device\n"); +return AVERROR(ENOSYS); +} +#endif + ctx->support_dyn_bitrate = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE); return 0; @@ -1396,6 +1404,25 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) hevc->numRefL1 = avctx->refs; #endif +#ifdef NVENC_HAVE_TEMPORAL_FILTER +if (ctx->tf_level >= 0) { +hevc->tfLevel = ctx->tf_level; + +switch (ctx->tf_level) +{ +case NV_ENC_TEMPORAL_FILTER_LEVEL_0: +case NV_ENC_TEMPORAL_FILTER_LEVEL_4: +break; +default: +av_log(avctx, AV_LOG_ERROR, "Invalid temporal filtering level.\n"); +return AVERROR(EINVAL); +} + +if (ctx->encode_config.frameIntervalP < 5) +av_log(avctx, AV_LOG_WARNING, "Temporal filtering needs at least 4 B-Frames (-bf 4).\n"); +} +#endif + return 0; } diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index d99d8a0d76..c320c2514f 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -86,6 +86,7 @@ typedef void ID3D11Device; // SDK 12.2 compile time feature checks #if NVENCAPI_CHECK_VERSION(12, 2) #define NVENC_HAVE_NEW_BIT_DEPTH_API +#define NVENC_HAVE_TEMPORAL_FILTER #endif typedef struct NvencSurface @@ -271,6 +272,7 @@ typedef struct NvencContext int highbitdepth; int max_slice_size; int rgb_mode; +int tf_level; } NvencContext; int ff_nvenc_encode_init(AVCodecContext *avctx); diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c index 65fcb4efb8..8559aa6cfb 100644 --- a/libavcodec/nvenc_hevc.c +++ b/libavcodec/nvenc_hevc.c @@ -196,6 +196,12 @@ static const AVOption options[] = { OFFSET(max_slice_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices", OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, +#ifdef NVENC_HAVE_TEMPORAL_FILTER +{ "tf_level", "Specifies the strength of the temporal filtering", +OFFSET(tf_level), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, .unit = "tf_level" }, +{ "0","", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TEMPORAL_FILTER_LEVEL_0 }, 0, 0, VE, .unit = "tf_level" }, +{ "4","", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TEMPORAL_FILTER_LEVEL_4 }, 0, 0, VE, .unit = "tf_level" }, +#endif { 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] avcodec/nvenc: support SDK 12.2 bit depth API
ffmpeg | branch: master | Timo Rothenpieler | Sun Mar 31 18:39:49 2024 +0200| [06c2a2c425f22e7dba5cad909737a631cc676e3f] | committer: Timo Rothenpieler avcodec/nvenc: support SDK 12.2 bit depth API > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06c2a2c425f22e7dba5cad909737a631cc676e3f --- libavcodec/nvenc.c | 15 +++ libavcodec/nvenc.h | 5 + 2 files changed, 20 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 0cb3b87c67..8327496937 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1255,6 +1255,11 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) h264->level = ctx->level; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +h264->inputBitDepth = h264->outputBitDepth = +IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#endif + if (ctx->coder >= 0) h264->entropyCodingMode = ctx->coder; @@ -1370,7 +1375,12 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +hevc->inputBitDepth = hevc->outputBitDepth = +IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#else hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; +#endif hevc->level = ctx->level; @@ -1455,8 +1465,13 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx) av1->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; +#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API +av1->inputBitDepth = IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +av1->outputBitDepth = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; +#else av1->inputPixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; av1->pixelBitDepthMinus8 = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? 2 : 0; +#endif if (ctx->b_ref_mode >= 0) av1->useBFramesAsRef = ctx->b_ref_mode; diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 48cdfc58aa..d99d8a0d76 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -83,6 +83,11 @@ typedef void ID3D11Device; #define NVENC_NO_DEPRECATED_RC #endif +// SDK 12.2 compile time feature checks +#if NVENCAPI_CHECK_VERSION(12, 2) +#define NVENC_HAVE_NEW_BIT_DEPTH_API +#endif + typedef struct NvencSurface { NV_ENC_INPUT_PTR input_surface; ___ 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/nvenc: stop using long deprecated format specifiers
ffmpeg | branch: master | Timo Rothenpieler | Sun Mar 31 18:25:15 2024 +0200| [43b417d516b0fabbec1f02120d948f636b8a018e] | committer: Timo Rothenpieler avcodec/nvenc: stop using long deprecated format specifiers > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43b417d516b0fabbec1f02120d948f636b8a018e --- libavcodec/nvenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index fd73af2a32..0cb3b87c67 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1689,15 +1689,15 @@ static NV_ENC_BUFFER_FORMAT nvenc_map_buffer_format(enum AVPixelFormat pix_fmt) { switch (pix_fmt) { case AV_PIX_FMT_YUV420P: -return NV_ENC_BUFFER_FORMAT_YV12_PL; +return NV_ENC_BUFFER_FORMAT_YV12; case AV_PIX_FMT_NV12: -return NV_ENC_BUFFER_FORMAT_NV12_PL; +return NV_ENC_BUFFER_FORMAT_NV12; case AV_PIX_FMT_P010: case AV_PIX_FMT_P016: return NV_ENC_BUFFER_FORMAT_YUV420_10BIT; case AV_PIX_FMT_GBRP: case AV_PIX_FMT_YUV444P: -return NV_ENC_BUFFER_FORMAT_YUV444_PL; +return NV_ENC_BUFFER_FORMAT_YUV444; case AV_PIX_FMT_GBRP16: case AV_PIX_FMT_YUV444P16: return NV_ENC_BUFFER_FORMAT_YUV444_10BIT; ___ 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/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/4.0 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [d1275f8a77fa9800b7fb5497ca2f99978cb29fc6] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1275f8a77fa9800b7fb5497ca2f99978cb29fc6 --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index ab3cb88b27..ec562eba9c 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -496,6 +496,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/4.1 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [835453fbd8a91cb1ebdb750efcf2a33bdb4801b7] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=835453fbd8a91cb1ebdb750efcf2a33bdb4801b7 --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 0426c9b319..d0e3cd3df6 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -539,6 +539,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/4.2 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [197f7eacf67484fd77b9697ffb611a0a97a5733d] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=197f7eacf67484fd77b9697ffb611a0a97a5733d --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index b60da24301..88061d353c 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -550,6 +550,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/4.3 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [fa9a0e7f3e83beecbf031bebd51f1b3ac0f568af] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa9a0e7f3e83beecbf031bebd51f1b3ac0f568af --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 6168a7e3f1..6d7e712580 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -624,6 +624,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/4.4 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [5d07afd48253b7dece9d481c0f3cdd186187c0d2] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d07afd48253b7dece9d481c0f3cdd186187c0d2 --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 1c24bae8c1..caf9715707 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -667,6 +667,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/5.0 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [201d0e6fc17aeb58bb4d4c0fd8d9420293d865fb] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=201d0e6fc17aeb58bb4d4c0fd8d9420293d865fb --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 4a085e1a63..f37dc16fd6 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -667,6 +667,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/5.1 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [82abc7af817ea118aaadb6adf911f78cdff75c46] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82abc7af817ea118aaadb6adf911f78cdff75c46 --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index d54b8669a9..76904b801a 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -668,6 +668,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/6.0 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [a39e922fb770180c079f5fef7d23ea9a27832334] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a39e922fb770180c079f5fef7d23ea9a27832334 --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index b57adae98e..cd3a1cfb31 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -677,6 +677,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/6.1 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [f4a6db1222eaec502eb5c09d9b57321903aaeaff] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f4a6db1222eaec502eb5c09d9b57321903aaeaff --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index b2481e7fe8..09c91e0dab 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -665,6 +665,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: release/7.0 | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [515949a15a94b9c8e505d7334faceed435f9e107] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=515949a15a94b9c8e505d7334faceed435f9e107 --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 553c9bdf18..1741ee7e47 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -664,6 +664,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
ffmpeg | branch: master | Timo Rothenpieler | Sat Mar 30 00:12:03 2024 +0100| [e99c273feca16439fa4750f52693d94136d95ea7] | committer: Timo Rothenpieler avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e99c273feca16439fa4750f52693d94136d95ea7 --- libavcodec/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 553c9bdf18..1741ee7e47 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -664,6 +664,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx) NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; +ctx->bitstream_len = 0; +ctx->nb_slices = 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] avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available
ffmpeg | branch: release/6.1 | Timo Rothenpieler | Wed Mar 13 20:03:42 2024 +0100| [98436c51becde56a961f3faad3037a17d64f310c] | committer: Timo Rothenpieler avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available A lot of modern stuff straight up fails on the old 1.0 factory, which is masked by the fact that it's only used when an explicit adapter is specified. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=98436c51becde56a961f3faad3037a17d64f310c --- libavutil/hwcontext_d3d11va.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index cc8c97d2b6..26cebbb650 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -62,7 +62,9 @@ static av_cold void load_functions(void) return; mD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE) GetProcAddress(d3dlib, "D3D11CreateDevice"); -mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory"); +mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory1"); +if (!mCreateDXGIFactory) +mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory"); #else // In UWP (which lacks LoadLibrary), CreateDXGIFactory isn't available, // only CreateDXGIFactory1 ___ 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] avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available
ffmpeg | branch: release/6.0 | Timo Rothenpieler | Wed Mar 13 20:03:42 2024 +0100| [cd49ee45ba4d081d870747873e591162dcf93ad7] | committer: Timo Rothenpieler avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available A lot of modern stuff straight up fails on the old 1.0 factory, which is masked by the fact that it's only used when an explicit adapter is specified. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd49ee45ba4d081d870747873e591162dcf93ad7 --- libavutil/hwcontext_d3d11va.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 363ec6a47d..06c6357942 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -62,7 +62,9 @@ static av_cold void load_functions(void) return; mD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE) GetProcAddress(d3dlib, "D3D11CreateDevice"); -mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory"); +mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory1"); +if (!mCreateDXGIFactory) +mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory"); #else // In UWP (which lacks LoadLibrary), CreateDXGIFactory isn't available, // only CreateDXGIFactory1 ___ 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] avutil/hwcontext_d3d11va: add logging to dxgi debug interfaces
ffmpeg | branch: master | Timo Rothenpieler | Wed Mar 13 23:25:59 2024 +0100| [030f4925b8bef8c9964dabec9e93266e3425b34d] | committer: Timo Rothenpieler avutil/hwcontext_d3d11va: add logging to dxgi debug interfaces > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=030f4925b8bef8c9964dabec9e93266e3425b34d --- libavutil/hwcontext_d3d11va.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 1b96c38d25..e30c8fc238 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -685,9 +685,17 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, if (pf_DXGIGetDebugInterface) { IDXGIDebug *dxgi_debug = NULL; hr = pf_DXGIGetDebugInterface(_IDXGIDebug, (void**)_debug); -if (SUCCEEDED(hr) && dxgi_debug) +if (SUCCEEDED(hr) && dxgi_debug) { IDXGIDebug_ReportLiveObjects(dxgi_debug, DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL); +av_log(ctx, AV_LOG_INFO, "Enabled dxgi debugging.\n"); +} else { +av_log(ctx, AV_LOG_WARNING, "Failed enabling dxgi debugging.\n"); +} +} else { +av_log(ctx, AV_LOG_WARNING, "Failed getting dxgi debug interface.\n"); } +} else { +av_log(ctx, AV_LOG_WARNING, "Failed loading dxgi debug library.\n"); } } #endif ___ 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] avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available
ffmpeg | branch: master | Timo Rothenpieler | Wed Mar 13 20:03:42 2024 +0100| [6e78d92399f4c4942c21238c805f7eed10132b79] | committer: Timo Rothenpieler avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available A lot of modern stuff straight up fails on the old 1.0 factory, which is masked by the fact that it's only used when an explicit adapter is specified. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e78d92399f4c4942c21238c805f7eed10132b79 --- libavutil/hwcontext_d3d11va.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index a45e53595d..1b96c38d25 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -62,7 +62,9 @@ static av_cold void load_functions(void) return; mD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE) GetProcAddress(d3dlib, "D3D11CreateDevice"); -mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory"); +mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory1"); +if (!mCreateDXGIFactory) +mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory"); #else // In UWP (which lacks LoadLibrary), CreateDXGIFactory isn't available, // only CreateDXGIFactory1 ___ 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] avutil/hwcontext_d3d11va: remove check for d3d11 debug layer dll
ffmpeg | branch: master | Timo Rothenpieler | Thu Mar 14 17:49:11 2024 +0100| [ae5453503d1e63ef2cf6e6658e1d0b12470a39c7] | committer: Timo Rothenpieler avutil/hwcontext_d3d11va: remove check for d3d11 debug layer dll At least on latest Win 11 and Visual Studio 2022, that DLL does not exist anymore and can't be installed via any of the usual means. However, debugging works just fine regardless, so this check makes debugging impossible. D3D11CreateDevice will fail anyway if debugging is not supported, so let's rely on that instead. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ae5453503d1e63ef2cf6e6658e1d0b12470a39c7 --- libavutil/hwcontext_d3d11va.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 24b3546e7b..a45e53595d 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -612,14 +612,10 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, int ret; int adapter = -1; -// (On UWP we can't check this.) -#if !HAVE_UWP -if (!LoadLibrary("d3d11_1sdklayers.dll")) -is_debug = 0; -#endif - -if (is_debug) +if (is_debug) { creationFlags |= D3D11_CREATE_DEVICE_DEBUG; +av_log(ctx, AV_LOG_INFO, "Enabling d3d11 debugging.\n"); +} if ((ret = ff_thread_once(_loaded, load_functions)) != 0) return AVERROR_UNKNOWN; ___ 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] avfilter/vsrc_ddagrab: clear all flags of buffer texture
ffmpeg | branch: master | Timo Rothenpieler | Fri Mar 15 23:45:33 2024 +0100| [b47abd5737eed9304fc808bc7a1043c55b21263f] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: clear all flags of buffer texture One some system, one some displays, for unknown reasons, these contain rather bad flags that cause all kinds of weird behaviour. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b47abd5737eed9304fc808bc7a1043c55b21263f --- libavfilter/vsrc_ddagrab.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 070b1eda37..018f46ed94 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -746,6 +746,9 @@ static int next_frame_internal(AVFilterContext *avctx, ID3D11Texture2D **desktop D3D11_TEXTURE2D_DESC desc; ID3D11Texture2D_GetDesc(*desktop_texture, ); desc.Usage = D3D11_USAGE_DEFAULT; +desc.BindFlags = 0; +desc.CPUAccessFlags = 0; +desc.MiscFlags = 0; hr = ID3D11Device_CreateTexture2D(dda->device_hwctx->device, , NULL, >buffer_texture); if (FAILED(hr)) { ___ 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] avutil/mem: limit alignment to maximum simd align
ffmpeg | branch: master | Timo Rothenpieler | Sun Dec 3 21:01:50 2023 +0100| [7945d30e91b96d2f4f5b612048169087d214d41e] | committer: Timo Rothenpieler avutil/mem: limit alignment to maximum simd align FFmpeg has instances of DECLARE_ALIGNED(32, ...) in a lot of structs, which then end up heap-allocated. By declaring any variable in a struct, or tree of structs, to be 32 byte aligned, it allows the compiler to safely assume the entire struct itself is also 32 byte aligned. This might make the compiler emit code which straight up crashes or misbehaves in other ways, and at least in one instances is now documented to actually do (see ticket 10549 on trac). The issue there is that an unrelated variable in SingleChannelElement is declared to have an alignment of 32 bytes. So if the compiler does a copy in decode_cpe() with avx instructions, but ffmpeg is built with --disable-avx, this results in a crash, since the memory is only 16 byte aligned. Mind you, even if the compiler does not emit avx instructions, the code is still invalid and could misbehave. It just happens not to. Declaring any variable in a struct with a 32 byte alignment promises 32 byte alignment of the whole struct to the compiler. This patch limits the maximum alignment to the maximum possible simd alignment according to configure. While not perfect, it at the very least gets rid of a lot of UB, by matching up the maximum DECLARE_ALIGNED value with the alignment of heap allocations done by lavu. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7945d30e91b96d2f4f5b612048169087d214d41e --- libavutil/mem.c | 2 +- libavutil/mem_internal.h | 33 - 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/libavutil/mem.c b/libavutil/mem.c index 36b8940a0c..62163b4cb3 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -62,7 +62,7 @@ void free(void *ptr); #endif /* MALLOC_PREFIX */ -#define ALIGN (HAVE_AVX512 ? 64 : (HAVE_AVX ? 32 : 16)) +#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : (HAVE_SIMD_ALIGN_32 ? 32 : 16)) /* NOTE: if you want to override these functions with your own * implementations (not recommended) you have to link libav* as diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h index 2448c606f1..b1d89a0605 100644 --- a/libavutil/mem_internal.h +++ b/libavutil/mem_internal.h @@ -76,27 +76,50 @@ */ #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) -#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v +#define DECLARE_ALIGNED_T(n,t,v)t __attribute__ ((aligned (n))) v #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v #define DECLARE_ASM_CONST(n,t,v)const t __attribute__ ((aligned (n))) v #elif defined(__DJGPP__) -#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16 v +#define DECLARE_ALIGNED_T(n,t,v)t __attribute__ ((aligned (FFMIN(n, 16 v #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16 v #define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (FFMIN(n, 16 v #elif defined(__GNUC__) || defined(__clang__) -#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v +#define DECLARE_ALIGNED_T(n,t,v)t __attribute__ ((aligned (n))) v #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v #define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (n))) v #elif defined(_MSC_VER) -#define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v +#define DECLARE_ALIGNED_T(n,t,v)__declspec(align(n)) t v #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v #define DECLARE_ASM_CONST(n,t,v)__declspec(align(n)) static const t v #else -#define DECLARE_ALIGNED(n,t,v) t v +#define DECLARE_ALIGNED_T(n,t,v)t v #define DECLARE_ASM_ALIGNED(n,t,v) t v #define DECLARE_ASM_CONST(n,t,v)static const t v #endif +#if HAVE_SIMD_ALIGN_64 +#define ALIGN_64 64 +#define ALIGN_32 32 +#elif HAVE_SIMD_ALIGN_32 +#define ALIGN_64 32 +#define ALIGN_32 32 +#else +#define ALIGN_64 16 +#define ALIGN_32 16 +#endif + +#define DECLARE_ALIGNED(n,t,v) DECLARE_ALIGNED_V(n,t,v) + +// Macro needs to be double-wrapped in order to expand +// possible other macros being passed for n. +#define DECLARE_ALIGNED_V(n,t,v) DECLARE_ALIGNED_##n(t,v) + +#define DECLARE_ALIGNED_4(t,v) DECLARE_ALIGNED_T( 4, t, v) +#define DECLARE_ALIGNED_8(t,v) DECLARE_ALIGNED_T( 8, t, v) +#define DECLARE_ALIGNED_16(t,v) DECLARE_ALIGNED_T( 16, t, v) +#define DECLARE_ALIGNED_32(t,v) DECLARE_ALIGNED_T(ALIGN_32, t, v) +#define DECLARE_ALIGNED_64(t,v) DECLARE_ALIGNED_T(ALIGN_64, t, v) + // Some broken preprocessors need a second expansion // to be forced to tokenize __VA_ARGS__ #
[FFmpeg-cvslog] Revert "avutil/mem: limit alignment to maximum simd align"
ffmpeg | branch: master | Timo Rothenpieler | Fri Feb 9 20:20:03 2024 +0100| [4618b5ebb95dbef95877ea49c175b1c573ca6b36] | committer: Timo Rothenpieler Revert "avutil/mem: limit alignment to maximum simd align" Patch was not intended to be part of the set it got pushed with. This reverts commit 6154137b186734961726ae538ab5cbe287bab163. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4618b5ebb95dbef95877ea49c175b1c573ca6b36 --- libavutil/mem.c | 8 +--- libavutil/mem_internal.h | 14 ++ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/libavutil/mem.c b/libavutil/mem.c index b5bcaab164..36b8940a0c 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -62,13 +62,7 @@ void free(void *ptr); #endif /* MALLOC_PREFIX */ -#if defined(_MSC_VER) -/* MSVC does not support conditionally limiting alignment. - Set minimum value here to maximum used throughout the codebase. */ -#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : 32) -#else -#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : (HAVE_SIMD_ALIGN_32 ? 32 : 16)) -#endif +#define ALIGN (HAVE_AVX512 ? 64 : (HAVE_AVX ? 32 : 16)) /* NOTE: if you want to override these functions with your own * implementations (not recommended) you have to link libav* as diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h index e2911b5610..2448c606f1 100644 --- a/libavutil/mem_internal.h +++ b/libavutil/mem_internal.h @@ -75,20 +75,18 @@ * @param v Name of the variable */ -#define MAX_ALIGNMENT (HAVE_SIMD_ALIGN_64 ? 64 : (HAVE_SIMD_ALIGN_32 ? 32 : 16)) - #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) -#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v -#define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v -#define DECLARE_ASM_CONST(n,t,v)const t __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v +#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v +#define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v +#define DECLARE_ASM_CONST(n,t,v)const t __attribute__ ((aligned (n))) v #elif defined(__DJGPP__) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16 v #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16 v #define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (FFMIN(n, 16 v #elif defined(__GNUC__) || defined(__clang__) -#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v -#define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v -#define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v +#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v +#define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v +#define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (n))) v #elif defined(_MSC_VER) #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v ___ 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] avutil/mem: limit alignment to maximum simd align
ffmpeg | branch: master | Timo Rothenpieler | Sun Dec 3 21:01:50 2023 +0100| [6154137b186734961726ae538ab5cbe287bab163] | committer: Timo Rothenpieler avutil/mem: limit alignment to maximum simd align FFmpeg has instances of DECLARE_ALIGNED(32, ...) in a lot of structs, which then end up heap-allocated. By declaring any variable in a struct, or tree of structs, to be 32 byte aligned, it allows the compiler to safely assume the entire struct itself is also 32 byte aligned. This might make the compiler emit code which straight up crashes or misbehaves in other ways, and at least in one instances is now documented to actually do (see ticket 10549 on trac). The issue there is that an unrelated variable in SingleChannelElement is declared to have an alignment of 32 bytes. So if the compiler does a copy in decode_cpe() with avx instructions, but ffmpeg is built with --disable-avx, this results in a crash, since the memory is only 16 byte aligned. Mind you, even if the compiler does not emit avx instructions, the code is still invalid and could misbehave. It just happens not to. Declaring any variable in a struct with a 32 byte alignment promises 32 byte alignment of the whole struct to the compiler. This patch limits the maximum alignment to the maximum possible simd alignment according to configure. While not perfect, it at the very least gets rid of a lot of UB, by matching up the maximum DECLARE_ALIGNED value with the alignment of heap allocations done by lavu. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6154137b186734961726ae538ab5cbe287bab163 --- libavutil/mem.c | 8 +++- libavutil/mem_internal.h | 14 -- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/libavutil/mem.c b/libavutil/mem.c index 36b8940a0c..b5bcaab164 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -62,7 +62,13 @@ void free(void *ptr); #endif /* MALLOC_PREFIX */ -#define ALIGN (HAVE_AVX512 ? 64 : (HAVE_AVX ? 32 : 16)) +#if defined(_MSC_VER) +/* MSVC does not support conditionally limiting alignment. + Set minimum value here to maximum used throughout the codebase. */ +#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : 32) +#else +#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : (HAVE_SIMD_ALIGN_32 ? 32 : 16)) +#endif /* NOTE: if you want to override these functions with your own * implementations (not recommended) you have to link libav* as diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h index 2448c606f1..e2911b5610 100644 --- a/libavutil/mem_internal.h +++ b/libavutil/mem_internal.h @@ -75,18 +75,20 @@ * @param v Name of the variable */ +#define MAX_ALIGNMENT (HAVE_SIMD_ALIGN_64 ? 64 : (HAVE_SIMD_ALIGN_32 ? 32 : 16)) + #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) -#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v -#define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v -#define DECLARE_ASM_CONST(n,t,v)const t __attribute__ ((aligned (n))) v +#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v +#define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v +#define DECLARE_ASM_CONST(n,t,v)const t __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v #elif defined(__DJGPP__) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16 v #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16 v #define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (FFMIN(n, 16 v #elif defined(__GNUC__) || defined(__clang__) -#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v -#define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v -#define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (n))) v +#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v +#define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v +#define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (FFMIN(n, MAX_ALIGNMENT v #elif defined(_MSC_VER) #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v ___ 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] avfilter/ddagrab: only use acquired texture on valid updates
ffmpeg | branch: master | Timo Rothenpieler | Fri Feb 9 19:42:53 2024 +0100| [21c6d12449a2230a959da79f224b7443fe89d6d3] | committer: Timo Rothenpieler avfilter/ddagrab: only use acquired texture on valid updates > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21c6d12449a2230a959da79f224b7443fe89d6d3 --- libavfilter/vsrc_ddagrab.c | 48 ++ 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 51e928d785..b62b8a7991 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -82,6 +82,7 @@ typedef struct DdagrabContext { int raw_height; ID3D11Texture2D *probed_texture; +ID3D11Texture2D *buffer_texture; ID3D11VertexShader *vertex_shader; ID3D11InputLayout *input_layout; @@ -154,6 +155,7 @@ static av_cold void ddagrab_uninit(AVFilterContext *avctx) release_resource(>const_buffer); release_resource(>probed_texture); +release_resource(>buffer_texture); release_resource(>dxgi_outdupl); release_resource(>mouse_resource_view); @@ -707,9 +709,29 @@ static int next_frame_internal(AVFilterContext *avctx, ID3D11Texture2D **desktop goto error; } -if (need_frame && (!frame_info.LastPresentTime.QuadPart || !frame_info.AccumulatedFrames)) { -ret = AVERROR(EAGAIN); -goto error; +if (!frame_info.LastPresentTime.QuadPart || !frame_info.AccumulatedFrames) { +if (need_frame) { +ret = AVERROR(EAGAIN); +goto error; +} + +// Unforunately, we can't rely on the desktop_resource's format in this case. +// The API might even return it in with a format that was not in the initial +// list of supported formats, and it can change/flicker randomly. +// To work around this, return an internal copy of the last valid texture we got. +release_resource(_resource); + +// The initial probing should make this impossible. +if (!dda->buffer_texture) { +av_log(avctx, AV_LOG_ERROR, "No buffer texture while operating!\n"); +ret = AVERROR_BUG; +goto error; +} + +av_log(avctx, AV_LOG_TRACE, "Returning internal buffer for a frame!\n"); +ID3D11Texture2D_AddRef(dda->buffer_texture); +*desktop_texture = dda->buffer_texture; +return 0; } hr = IDXGIResource_QueryInterface(desktop_resource, _ID3D11Texture2D, (void**)desktop_texture); @@ -720,6 +742,24 @@ static int next_frame_internal(AVFilterContext *avctx, ID3D11Texture2D **desktop goto error; } +if (!dda->buffer_texture) { +D3D11_TEXTURE2D_DESC desc; +ID3D11Texture2D_GetDesc(*desktop_texture, ); +desc.Usage = D3D11_USAGE_DEFAULT; + +hr = ID3D11Device_CreateTexture2D(dda->device_hwctx->device, , NULL, >buffer_texture); +if (FAILED(hr)) { +release_resource(desktop_texture); +av_log(avctx, AV_LOG_ERROR, "Failed creating internal buffer texture.\n"); +ret = AVERROR(ENOMEM); +goto error; +} +} + +ID3D11DeviceContext_CopyResource(dda->device_hwctx->device_context, + (ID3D11Resource*)dda->buffer_texture, + (ID3D11Resource*)*desktop_texture); + return 0; error: @@ -1108,7 +1148,7 @@ static int ddagrab_request_frame(AVFilterLink *outlink) if (desc.Format != dda->raw_format || (int)desc.Width != dda->raw_width || (int)desc.Height != dda->raw_height) { -av_log(avctx, AV_LOG_ERROR, "Output parameters changed!"); +av_log(avctx, AV_LOG_ERROR, "Output parameters changed!\n"); ret = AVERROR_OUTPUT_CHANGED; goto fail; } ___ 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/nvdec_hevc: fail to initialize on unsupported profiles
ffmpeg | branch: release/6.0 | Timo Rothenpieler | Tue Oct 10 17:34:47 2023 +0200| [c5039e158d20e85d4d8a2dee3160533d627b839a] | committer: Timo Rothenpieler avcodec/nvdec_hevc: fail to initialize on unsupported profiles > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c5039e158d20e85d4d8a2dee3160533d627b839a --- libavcodec/nvdec_hevc.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c index cd549d2ef6..1ab1c39d75 100644 --- a/libavcodec/nvdec_hevc.c +++ b/libavcodec/nvdec_hevc.c @@ -305,6 +305,15 @@ static int nvdec_hevc_frame_params(AVCodecContext *avctx, static int nvdec_hevc_decode_init(AVCodecContext *avctx) { NVDECContext *ctx = avctx->internal->hwaccel_priv_data; ctx->supports_444 = 1; + +if (avctx->profile != FF_PROFILE_HEVC_MAIN && +avctx->profile != FF_PROFILE_HEVC_MAIN_10 && +avctx->profile != FF_PROFILE_HEVC_MAIN_STILL_PICTURE && +avctx->profile != FF_PROFILE_HEVC_REXT) { +av_log(avctx, AV_LOG_ERROR, "Unsupported HEVC profile: %d\n", avctx->profile); +return AVERROR(ENOTSUP); +} + return ff_nvdec_decode_init(avctx); } ___ 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/nvdec_hevc: fail to initialize on unsupported profiles
ffmpeg | branch: master | Timo Rothenpieler | Tue Oct 10 17:34:47 2023 +0200| [68f9dfa5cc2e876207ca38affbbdaa0d6714d654] | committer: Timo Rothenpieler avcodec/nvdec_hevc: fail to initialize on unsupported profiles > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=68f9dfa5cc2e876207ca38affbbdaa0d6714d654 --- libavcodec/nvdec_hevc.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c index 91fb9f5384..b83d5edcf9 100644 --- a/libavcodec/nvdec_hevc.c +++ b/libavcodec/nvdec_hevc.c @@ -306,6 +306,15 @@ static int nvdec_hevc_frame_params(AVCodecContext *avctx, static int nvdec_hevc_decode_init(AVCodecContext *avctx) { NVDECContext *ctx = avctx->internal->hwaccel_priv_data; ctx->supports_444 = 1; + +if (avctx->profile != AV_PROFILE_HEVC_MAIN && +avctx->profile != AV_PROFILE_HEVC_MAIN_10 && +avctx->profile != AV_PROFILE_HEVC_MAIN_STILL_PICTURE && +avctx->profile != AV_PROFILE_HEVC_REXT) { +av_log(avctx, AV_LOG_ERROR, "Unsupported HEVC profile: %d\n", avctx->profile); +return AVERROR(ENOTSUP); +} + return ff_nvdec_decode_init(avctx); } ___ 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] avfilter/ddagrab: actually use provided texture pointer
ffmpeg | branch: master | Timo Rothenpieler | Sun Oct 8 15:47:38 2023 +0200| [0e7ae95cc289e5b5264ff2921f361eca3702aab1] | committer: Timo Rothenpieler avfilter/ddagrab: actually use provided texture pointer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e7ae95cc289e5b5264ff2921f361eca3702aab1 --- libavfilter/vsrc_ddagrab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 2d9d71a7ba..936936eb7f 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -470,7 +470,7 @@ static int create_d3d11_pointer_tex(AVFilterContext *avctx, } hr = ID3D11Device_CreateShaderResourceView(dda->device_hwctx->device, -(ID3D11Resource*)dda->mouse_texture, +(ID3D11Resource*)*out_tex, _desc, res_view); if (FAILED(hr)) { ___ 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] avfilter/ddagrab: create secondary xor mouse texture
ffmpeg | branch: master | Timo Rothenpieler | Sun Oct 8 17:41:34 2023 +0200| [8b6ee74d50708e593c258726c5c29fddbf2765ab] | committer: Timo Rothenpieler avfilter/ddagrab: create secondary xor mouse texture > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b6ee74d50708e593c258726c5c29fddbf2765ab --- libavfilter/vsrc_ddagrab.c | 137 - 1 file changed, 112 insertions(+), 25 deletions(-) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 936936eb7f..9c59faf53e 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -68,7 +68,9 @@ typedef struct DdagrabContext { int mouse_x, mouse_y; ID3D11Texture2D *mouse_texture; -ID3D11ShaderResourceView* mouse_resource_view ; +ID3D11ShaderResourceView* mouse_resource_view; +ID3D11Texture2D *mouse_xor_texture; +ID3D11ShaderResourceView* mouse_xor_resource_view; AVRational time_base; int64_t time_frame; @@ -87,6 +89,7 @@ typedef struct DdagrabContext { ID3D11Buffer *const_buffer; ID3D11SamplerState *sampler_state; ID3D11BlendState *blend_state; +ID3D11BlendState *blend_state_xor; intoutput_idx; intdraw_mouse; @@ -140,6 +143,7 @@ static av_cold void ddagrab_uninit(AVFilterContext *avctx) DdagrabContext *dda = avctx->priv; release_resource(>blend_state); +release_resource(>blend_state_xor); release_resource(>sampler_state); release_resource(>pixel_shader); release_resource(>input_layout); @@ -151,6 +155,8 @@ static av_cold void ddagrab_uninit(AVFilterContext *avctx) release_resource(>dxgi_outdupl); release_resource(>mouse_resource_view); release_resource(>mouse_texture); +release_resource(>mouse_xor_resource_view); +release_resource(>mouse_xor_texture); av_frame_free(>last_frame); av_buffer_unref(>frames_ref); @@ -412,6 +418,16 @@ static av_cold int init_render_resources(AVFilterContext *avctx) return AVERROR_EXTERNAL; } +blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_INV_DEST_COLOR; +blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_COLOR; +hr = ID3D11Device_CreateBlendState(dev, +_desc, +>blend_state_xor); +if (FAILED(hr)) { +av_log(avctx, AV_LOG_ERROR, "CreateBlendState (xor) failed: %lx\n", hr); +return AVERROR_EXTERNAL; +} + return 0; } @@ -482,50 +498,102 @@ static int create_d3d11_pointer_tex(AVFilterContext *avctx, return 0; } -static uint8_t *convert_mono_buffer(uint8_t *input, int *_width, int *_height, int *_pitch) +static int convert_mono_buffer(uint8_t *input, uint8_t **rgba_out, uint8_t **xor_out, int *_width, int *_height, int *_pitch) { int width = *_width, height = *_height, pitch = *_pitch; int real_height = height / 2; +int size = real_height * pitch; + uint8_t *output = av_malloc(real_height * width * 4); +uint8_t *output_xor = av_malloc(real_height * width * 4); + int y, x; -if (!output) -return NULL; +if (!output || !output_xor) { +av_free(output); +av_free(output_xor); +return AVERROR(ENOMEM); +} -// This simulates drawing the cursor on a full black surface -// i.e. ignore the AND mask, turn XOR mask into all 4 color channels for (y = 0; y < real_height; y++) { for (x = 0; x < width; x++) { -int v = input[(real_height + y) * pitch + (x / 8)]; -v = (v >> (7 - (x % 8))) & 1; -memset([4 * ((y*width) + x)], v ? 0xFF : 0, 4); +int in_pos = (y * pitch) + (x / 8); +int out_pos = 4 * ((y * width) + x); +int and_val = (input[in_pos] >> (7 - (x % 8))) & 1; +int xor_val = (input[in_pos + size] >> (7 - (x % 8))) & 1; + +if (!and_val && !xor_val) { +// solid black +memset([out_pos], 0, 4); +output[out_pos + 3] = 0xFF; + +// transparent +memset(_xor[out_pos], 0, 4); +} else if (and_val && !xor_val) { +// transparent +memset([out_pos], 0, 4); + +// transparent +memset(_xor[out_pos], 0, 4); +} else if (!and_val && xor_val) { +// solid white +memset([out_pos], 0xFF, 4); + +// transparent +memset(_xor[out_pos], 0, 4); +} else if (and_val && xor_val) { +// transparent +memset([out_pos], 0, 4); + +// solid white -> invert color +memset(_xor[out_pos], 0xFF, 4); +} } } *_pitch = width * 4; *_height = real_height; +*rgba_out = output; +*xor_out = output_xor;
[FFmpeg-cvslog] configure: fix --custom-allocator
ffmpeg | branch: master | Timo Rothenpieler | Wed Aug 23 23:44:47 2023 +0200| [3914abf76e3d1e65c41f7483ba76bc61f5057670] | committer: Timo Rothenpieler configure: fix --custom-allocator The custom-allocator logic has been completely defunct since a while, since nothing depends on those targets, they never get used. This updates jemalloc to pkg-config, adds the fallback option for potential arbitrary allocators, and finally actually adds the libraries to LDFLAGS. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3914abf76e3d1e65c41f7483ba76bc61f5057670 --- configure | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 8a1a1b8584..bc0c0bd4e4 100755 --- a/configure +++ b/configure @@ -6358,16 +6358,26 @@ if enabled float16; then fi case "$custom_allocator" in +"") +;; jemalloc) -# jemalloc by default does not use a prefix -require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc +test -n "$malloc_prefix" || +malloc_prefix=$($pkg_config --variable=jemalloc_prefix $pkg_config_flags jemalloc 2>/dev/null) +require_pkg_config custom_allocator jemalloc jemalloc/jemalloc.h ${malloc_prefix}malloc ;; tcmalloc) -require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc +require_pkg_config custom_allocator libtcmalloc gperftools/tcmalloc.h tc_malloc malloc_prefix=tc_ ;; +*) +require_pkg_config custom_allocator "$custom_allocator" stdlib.h malloc +;; esac +if test -n "$custom_allocator"; then +add_extralibs "$custom_allocator_extralibs" +fi + check_func_headers malloc.h _aligned_malloc && enable aligned_malloc check_func ${malloc_prefix}memalign&& enable memalign check_func ${malloc_prefix}posix_memalign && enable posix_memalign ___ 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/nvenc: add option to control subsampling of packed rgb input
ffmpeg | branch: master | Timo Rothenpieler | Tue Oct 3 17:31:11 2023 +0200| [e006680d8ef0c7cdcbc18a4c6d83d5dac48bea75] | committer: Timo Rothenpieler avcodec/nvenc: add option to control subsampling of packed rgb input > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e006680d8ef0c7cdcbc18a4c6d83d5dac48bea75 --- libavcodec/nvenc.c | 15 ++- libavcodec/nvenc.h | 7 +++ libavcodec/nvenc_av1.c | 5 + libavcodec/nvenc_h264.c | 5 + libavcodec/nvenc_hevc.c | 5 + libavcodec/version.h| 2 +- 6 files changed, 37 insertions(+), 2 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 02486c2043..626f10d20a 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -92,10 +92,18 @@ const AVCodecHWConfigInternal *const ff_nvenc_hw_configs[] = { pix_fmt == AV_PIX_FMT_X2BGR10 || \ pix_fmt == AV_PIX_FMT_GBRP16) +#define IS_RGB(pix_fmt)(pix_fmt == AV_PIX_FMT_0RGB32 || \ +pix_fmt == AV_PIX_FMT_RGB32 || \ +pix_fmt == AV_PIX_FMT_0BGR32 || \ +pix_fmt == AV_PIX_FMT_BGR32 || \ +pix_fmt == AV_PIX_FMT_X2RGB10 || \ +pix_fmt == AV_PIX_FMT_X2BGR10) + #define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P || \ pix_fmt == AV_PIX_FMT_YUV444P16 || \ pix_fmt == AV_PIX_FMT_GBRP || \ -pix_fmt == AV_PIX_FMT_GBRP16) +pix_fmt == AV_PIX_FMT_GBRP16|| \ +(ctx->rgb_mode == NVENC_RGB_MODE_444 && IS_RGB(pix_fmt))) #define IS_GBRP(pix_fmt) (pix_fmt == AV_PIX_FMT_GBRP || \ pix_fmt == AV_PIX_FMT_GBRP16) @@ -1951,6 +1959,11 @@ av_cold int ff_nvenc_encode_init(AVCodecContext *avctx) ctx->data_pix_fmt = avctx->pix_fmt; } +if (ctx->rgb_mode == NVENC_RGB_MODE_DISABLED && IS_RGB(ctx->data_pix_fmt)) { +av_log(avctx, AV_LOG_ERROR, "Packed RGB input, but RGB support is disabled.\n"); +return AVERROR(EINVAL); +} + ctx->frame = av_frame_alloc(); if (!ctx->frame) return AVERROR(ENOMEM); diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index cf0e8e5946..e5b0eb8305 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -168,6 +168,12 @@ enum { ANY_DEVICE, }; +enum { +NVENC_RGB_MODE_DISABLED, +NVENC_RGB_MODE_420, +NVENC_RGB_MODE_444, +}; + typedef struct NvencContext { AVClass *avclass; @@ -263,6 +269,7 @@ typedef struct NvencContext int timing_info; int highbitdepth; int max_slice_size; +int rgb_mode; } NvencContext; int ff_nvenc_encode_init(AVCodecContext *avctx); diff --git a/libavcodec/nvenc_av1.c b/libavcodec/nvenc_av1.c index 43643f7bf1..9f36796c4b 100644 --- a/libavcodec/nvenc_av1.c +++ b/libavcodec/nvenc_av1.c @@ -96,6 +96,11 @@ static const AVOption options[] = { OFFSET(device), AV_OPT_TYPE_INT, { .i64 = ANY_DEVICE }, -2, INT_MAX, VE, "gpu" }, { "any", "Pick the first device available",0, AV_OPT_TYPE_CONST, { .i64 = ANY_DEVICE },0, 0, VE, "gpu" }, { "list", "List the available devices", 0, AV_OPT_TYPE_CONST, { .i64 = LIST_DEVICES }, 0, 0, VE, "gpu" }, +{ "rgb_mode", "Configure how nvenc handles packed RGB input.", +OFFSET(rgb_mode), AV_OPT_TYPE_INT, { .i64 = NVENC_RGB_MODE_420 }, 0, INT_MAX, VE, "rgb_mode" }, +{ "yuv420", "Convert to yuv420", 0, AV_OPT_TYPE_CONST, { .i64 = NVENC_RGB_MODE_420 }, 0, 0, VE, "rgb_mode" }, +{ "yuv444", "Convert to yuv444", 0, AV_OPT_TYPE_CONST, { .i64 = NVENC_RGB_MODE_444 }, 0, 0, VE, "rgb_mode" }, +{ "disabled", "Disables support, throws an error.", 0, AV_OPT_TYPE_CONST, { .i64 = NVENC_RGB_MODE_DISABLED }, 0, 0, VE, "rgb_mode" }, { "delay","Delay frame output by the given amount of frames", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 0, INT_MAX, VE }, { "rc-lookahead", "Number of frames to look ahead for rate-control", diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c index 4440e49b25..85a13634a3 100644 --- a/libavcodec/nvenc_h264.c +++ b/libavcodec/nvenc_
[FFmpeg-cvslog] avformat/hls: reset the playlist init segment on seek
ffmpeg | branch: master | Timo Rothenpieler | Tue Aug 15 22:50:23 2023 +0200| [f225f8d7464569c7b917015c26ad30a37a5fbbe2] | committer: Timo Rothenpieler avformat/hls: reset the playlist init segment on seek The mp4 demuxer gets very upset when it gets flushed and not re-fed this data. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f225f8d7464569c7b917015c26ad30a37a5fbbe2 --- libavformat/hls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index 2a2fe28a54..c625e30291 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -2506,6 +2506,9 @@ static int hls_read_seek(AVFormatContext *s, int stream_index, /* Flush the packet queue of the subdemuxer. */ ff_read_frame_flush(pls->ctx); +/* Reset the init segment so it's re-fetched and served appropiately */ +pls->cur_init_section = NULL; + pls->seek_timestamp = seek_timestamp; pls->seek_flags = 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] avcodec/nvenc: avoid failing b_ref_mode check when unset
ffmpeg | branch: release/6.0 | Timo Rothenpieler | Fri Mar 10 13:09:10 2023 +0100| [916bdc0f197de7ea24d30f3f3c284e4332dd3720] | committer: Timo Rothenpieler avcodec/nvenc: avoid failing b_ref_mode check when unset > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=916bdc0f197de7ea24d30f3f3c284e4332dd3720 --- libavcodec/nvenc.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index a8b7a4c0a0..9acf3e8697 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -459,7 +459,7 @@ static int nvenc_check_cap(AVCodecContext *avctx, NV_ENC_CAPS cap) static int nvenc_check_capabilities(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; -int ret; +int tmp, ret; ret = nvenc_check_codec_support(avctx); if (ret < 0) { @@ -540,16 +540,18 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) } #ifdef NVENC_HAVE_BFRAME_REF_MODE +tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : NV_ENC_BFRAME_REF_MODE_DISABLED; ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE); -if (ctx->b_ref_mode == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1 && ret != 3) { +if (tmp == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1 && ret != 3) { av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not supported\n"); return AVERROR(ENOSYS); -} else if (ctx->b_ref_mode != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) { +} else if (tmp != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) { av_log(avctx, AV_LOG_WARNING, "B frames as references are not supported\n"); return AVERROR(ENOSYS); } #else -if (ctx->b_ref_mode != 0) { +tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 0; +if (tmp > 0) { av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1 at build time\n"); return AVERROR(ENOSYS); } ___ 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/nvenc: avoid failing b_ref_mode check when unset
ffmpeg | branch: master | Timo Rothenpieler | Fri Mar 10 13:09:10 2023 +0100| [7a8560cb22dd9f5c54df71af3fef26db9a2a28b0] | committer: Timo Rothenpieler avcodec/nvenc: avoid failing b_ref_mode check when unset > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a8560cb22dd9f5c54df71af3fef26db9a2a28b0 --- libavcodec/nvenc.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index a8b7a4c0a0..9acf3e8697 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -459,7 +459,7 @@ static int nvenc_check_cap(AVCodecContext *avctx, NV_ENC_CAPS cap) static int nvenc_check_capabilities(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; -int ret; +int tmp, ret; ret = nvenc_check_codec_support(avctx); if (ret < 0) { @@ -540,16 +540,18 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) } #ifdef NVENC_HAVE_BFRAME_REF_MODE +tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : NV_ENC_BFRAME_REF_MODE_DISABLED; ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE); -if (ctx->b_ref_mode == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1 && ret != 3) { +if (tmp == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1 && ret != 3) { av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not supported\n"); return AVERROR(ENOSYS); -} else if (ctx->b_ref_mode != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) { +} else if (tmp != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) { av_log(avctx, AV_LOG_WARNING, "B frames as references are not supported\n"); return AVERROR(ENOSYS); } #else -if (ctx->b_ref_mode != 0) { +tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 0; +if (tmp > 0) { av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1 at build time\n"); return AVERROR(ENOSYS); } ___ 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/nvdec: make explicit copy of frames unless user requested otherwise
ffmpeg | branch: master | Timo Rothenpieler | Mon Dec 5 22:34:00 2022 +0100| [7e8b5393895f6a21df501b047e5f987f456b9701] | committer: Timo Rothenpieler avcodec/nvdec: make explicit copy of frames unless user requested otherwise > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e8b5393895f6a21df501b047e5f987f456b9701 --- libavcodec/nvdec.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index fbaedf0b6b..a477449d14 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -51,6 +51,8 @@ typedef struct NVDECDecoder { CudaFunctions *cudl; CuvidFunctions *cvdl; + +int unsafe_output; } NVDECDecoder; typedef struct NVDECFramePool { @@ -344,6 +346,8 @@ int ff_nvdec_decode_init(AVCodecContext *avctx) int cuvid_codec_type, cuvid_chroma_format, chroma_444; int ret = 0; +int unsafe_output = !!(avctx->hwaccel_flags & AV_HWACCEL_FLAG_UNSAFE_OUTPUT); + sw_desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); if (!sw_desc) return AVERROR_BUG; @@ -402,7 +406,7 @@ int ff_nvdec_decode_init(AVCodecContext *avctx) params.CodecType = cuvid_codec_type; params.ChromaFormat= cuvid_chroma_format; params.ulNumDecodeSurfaces = frames_ctx->initial_pool_size; -params.ulNumOutputSurfaces = frames_ctx->initial_pool_size; +params.ulNumOutputSurfaces = unsafe_output ? frames_ctx->initial_pool_size : 1; ret = nvdec_decoder_create(>decoder_ref, frames_ctx->device_ref, , avctx); if (ret < 0) { @@ -417,6 +421,7 @@ int ff_nvdec_decode_init(AVCodecContext *avctx) } decoder = (NVDECDecoder*)ctx->decoder_ref->data; +decoder->unsafe_output = unsafe_output; decoder->real_hw_frames_ref = real_hw_frames_ref; real_hw_frames_ref = NULL; @@ -554,7 +559,11 @@ copy_fail: finish: CHECK_CU(decoder->cudl->cuCtxPopCurrent()); -return ret; + +if (ret < 0 || decoder->unsafe_output) +return ret; + +return av_frame_make_writable(frame); } int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame *frame) ___ 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] lavc: add new unsafe_output hwaccel_flag
ffmpeg | branch: master | Timo Rothenpieler | Mon Dec 5 22:32:46 2022 +0100| [7a8d78f7e358e5544395ba6084b83dfe18b4a84e] | committer: Timo Rothenpieler lavc: add new unsafe_output hwaccel_flag > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a8d78f7e358e5544395ba6084b83dfe18b4a84e --- doc/APIchanges | 3 +++ libavcodec/avcodec.h | 16 libavcodec/options_table.h | 1 + libavcodec/version.h | 4 ++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index ab7ce15fae..328028f293 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-12-xx - xx - lavc 59.55.100 - avcodec.h + Add AV_HWACCEL_FLAG_UNSAFE_OUTPUT. + 2022-11-xx - xx - lavu 57.43.100 - tx.h Add AV_TX_FLOAT_DCT, AV_TX_DOUBLE_DCT and AV_TX_INT32_DCT. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3edd8e2636..0ac581d660 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2253,6 +2253,22 @@ typedef struct AVHWAccel { */ #define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2) +/** + * Some hardware decoders (namely nvdec) can either output direct decoder + * surfaces, or make an on-device copy and return said copy. + * There is a hard limit on how many decoder surfaces there can be, and it + * cannot be accurately guessed ahead of time. + * For some processing chains, this can be okay, but others will run into the + * limit and in turn produce very confusing errors that require fine tuning of + * more or less obscure options by the user, or in extreme cases cannot be + * resolved at all without inserting an avfilter that forces a copy. + * + * Thus, the hwaccel will by default make a copy for safety and resilience. + * If a users really wants to minimize the amount of copies, they can set this + * flag and ensure their processing chain does not exhaust the surface pool. + */ +#define AV_HWACCEL_FLAG_UNSAFE_OUTPUT (1 << 3) + /** * @} */ diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index cd02f5096f..7924ca6144 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -399,6 +399,7 @@ static const AVOption avcodec_options[] = { {"ignore_level", "ignore level even if the codec level used is unknown or higher than the maximum supported level reported by the hardware driver", 0, AV_OPT_TYPE_CONST, { .i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, INT_MIN, INT_MAX, V | D, "hwaccel_flags" }, {"allow_high_depth", "allow to output YUV pixel formats with a different chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, +{"unsafe_output", "allow potentially unsafe hwaccel frame output that might require special care to process successfully", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_UNSAFE_OUTPUT }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, {"extra_hw_frames", "Number of extra hardware frames to allocate for the user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, V|D }, {"discard_damaged_percentage", "Percentage of damaged samples to discard a frame", OFFSET(discard_damaged_percentage), AV_OPT_TYPE_INT, {.i64 = 95 }, 0, 100, V|D }, {NULL}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 9e66920593..9f42f09f4e 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,8 +29,8 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 54 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MINOR 55 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ ___ 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/nvenc: fix vbv buffer size in cq mode
ffmpeg | branch: release/4.2 | Timo Rothenpieler | Thu Dec 8 12:31:00 2022 +0100| [a1b534bf8320ddbd416a9a1c9feaf29448dd1fc9] | committer: Timo Rothenpieler avcodec/nvenc: fix vbv buffer size in cq mode The CQ calculation gets thrown off and behaves very nonsensical if it isn't set to 0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1b534bf8320ddbd416a9a1c9feaf29448dd1fc9 --- libavcodec/nvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 0b0b5d79bb..ff018fef5f 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -920,8 +920,9 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality); -//CQ mode shall discard avg bitrate & honor max bitrate; +// CQ mode shall discard avg bitrate/vbv buffer size and honor only max bitrate ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate = 0; +ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0; ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; } } ___ 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/nvenc: fix vbv buffer size in cq mode
ffmpeg | branch: release/4.3 | Timo Rothenpieler | Thu Dec 8 12:31:00 2022 +0100| [540b9826b3859e35a2df330a5912311843708e7c] | committer: Timo Rothenpieler avcodec/nvenc: fix vbv buffer size in cq mode The CQ calculation gets thrown off and behaves very nonsensical if it isn't set to 0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=540b9826b3859e35a2df330a5912311843708e7c --- libavcodec/nvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 03fdd70029..bea4b5538c 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -956,8 +956,9 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality); -//CQ mode shall discard avg bitrate & honor max bitrate; +// CQ mode shall discard avg bitrate/vbv buffer size and honor only max bitrate ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate = 0; +ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0; ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; } } ___ 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/nvenc: fix vbv buffer size in cq mode
ffmpeg | branch: release/4.4 | Timo Rothenpieler | Thu Dec 8 12:31:00 2022 +0100| [b48951bd29fbec166428efb5a0e27f51ff98fd84] | committer: Timo Rothenpieler avcodec/nvenc: fix vbv buffer size in cq mode The CQ calculation gets thrown off and behaves very nonsensical if it isn't set to 0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b48951bd29fbec166428efb5a0e27f51ff98fd84 --- libavcodec/nvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 906915b5ca..0ce61041ef 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1025,8 +1025,9 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality); -//CQ mode shall discard avg bitrate & honor max bitrate; +// CQ mode shall discard avg bitrate/vbv buffer size and honor only max bitrate ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate = 0; +ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0; ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; } } ___ 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/nvenc: fix vbv buffer size in cq mode
ffmpeg | branch: release/5.0 | Timo Rothenpieler | Thu Dec 8 12:31:00 2022 +0100| [df2e08e4526a0c87d33cdc1fbddcc878857bf8af] | committer: Timo Rothenpieler avcodec/nvenc: fix vbv buffer size in cq mode The CQ calculation gets thrown off and behaves very nonsensical if it isn't set to 0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df2e08e4526a0c87d33cdc1fbddcc878857bf8af --- libavcodec/nvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 850c46022b..9386aadae2 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1078,8 +1078,9 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality); -//CQ mode shall discard avg bitrate & honor max bitrate; +// CQ mode shall discard avg bitrate/vbv buffer size and honor only max bitrate ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate = 0; +ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0; ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; } } ___ 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/nvenc: fix vbv buffer size in cq mode
ffmpeg | branch: release/5.1 | Timo Rothenpieler | Thu Dec 8 12:31:00 2022 +0100| [807afa59cca8f6019c4be4043de87a52ee11741c] | committer: Timo Rothenpieler avcodec/nvenc: fix vbv buffer size in cq mode The CQ calculation gets thrown off and behaves very nonsensical if it isn't set to 0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=807afa59cca8f6019c4be4043de87a52ee11741c --- libavcodec/nvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index e19378736f..4450df774c 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1083,8 +1083,9 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality); -//CQ mode shall discard avg bitrate & honor max bitrate; +// CQ mode shall discard avg bitrate/vbv buffer size and honor only max bitrate ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate = 0; +ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0; ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; } } ___ 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/nvenc: fix vbv buffer size in cq mode
ffmpeg | branch: master | Timo Rothenpieler | Thu Dec 8 12:31:00 2022 +0100| [9ca139b2aa1e25b87072d8321402fa200edb894d] | committer: Timo Rothenpieler avcodec/nvenc: fix vbv buffer size in cq mode The CQ calculation gets thrown off and behaves very nonsensical if it isn't set to 0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ca139b2aa1e25b87072d8321402fa200edb894d --- libavcodec/nvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 8a776e5737..f6df7cb6ac 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1114,8 +1114,9 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality); -//CQ mode shall discard avg bitrate & honor max bitrate; +// CQ mode shall discard avg bitrate/vbv buffer size and honor only max bitrate ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate = 0; +ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0; ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; } } ___ 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/nvenc: notify users about rc_lookahead clipping
ffmpeg | branch: master | Timo Rothenpieler | Mon Dec 5 21:18:42 2022 +0100| [45216e33e295f27b52bb0e829284f682ba48b7c8] | committer: Timo Rothenpieler avcodec/nvenc: notify users about rc_lookahead clipping > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45216e33e295f27b52bb0e829284f682ba48b7c8 --- libavcodec/nvenc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 30c10f394a..8a776e5737 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1089,6 +1089,9 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) ctx->encode_config.rcParams.lookaheadDepth, ctx->encode_config.rcParams.disableIadapt ? "disabled" : "enabled", ctx->encode_config.rcParams.disableBadapt ? "disabled" : "enabled"); +if (ctx->encode_config.rcParams.lookaheadDepth < ctx->rc_lookahead) +av_log(avctx, AV_LOG_WARNING, "Clipping lookahead depth to %d (from %d) due to lack of surfaces/delay", +ctx->encode_config.rcParams.lookaheadDepth, ctx->rc_lookahead); } } ___ 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/nvenc: explicitly disable lookahead if lacking sufficient surfaces
ffmpeg | branch: master | Timo Rothenpieler | Mon Dec 5 21:10:36 2022 +0100| [ac0f42d8939351747fcb6938d4bdebc970b8ee0e] | committer: Timo Rothenpieler avcodec/nvenc: explicitly disable lookahead if lacking sufficient surfaces It could already be enabled by the preset, so it needs explicitly disabled in this case. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac0f42d8939351747fcb6938d4bdebc970b8ee0e --- libavcodec/nvenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 9726c565d3..30c10f394a 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1076,6 +1076,7 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) ctx->encode_config.frameIntervalP - 4; if (lkd_bound < 0) { +ctx->encode_config.rcParams.enableLookahead = 0; av_log(avctx, AV_LOG_WARNING, "Lookahead not enabled. Increase buffer delay (-delay).\n"); } else { ___ 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] avfilter/vf_libplacebo: ensure filter hwdevice is a vulkan one
ffmpeg | branch: master | Timo Rothenpieler | Sun Dec 4 15:22:13 2022 +0100| [ee650398ec29861a1fe5c8d1a905cc340e82378d] | committer: Timo Rothenpieler avfilter/vf_libplacebo: ensure filter hwdevice is a vulkan one Before this, the filter blindly casts to AVVulkanDeviceContext and passes invalid values to libplacebo if it's not. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee650398ec29861a1fe5c8d1a905cc340e82378d --- libavfilter/vf_libplacebo.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 3678b60b7d..d3c62d12a4 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -252,6 +252,7 @@ static int init_vulkan(AVFilterContext *avctx) { int err = 0; LibplaceboContext *s = avctx->priv; +const AVHWDeviceContext *avhwctx; const AVVulkanDeviceContext *hwctx; uint8_t *buf = NULL; size_t buf_len; @@ -261,7 +262,15 @@ static int init_vulkan(AVFilterContext *avctx) return AVERROR(EINVAL); } -hwctx = ((AVHWDeviceContext*) avctx->hw_device_ctx->data)->hwctx; +avhwctx = avctx->hw_device_ctx->data; + +if (avhwctx->type != AV_HWDEVICE_TYPE_VULKAN) { +av_log(s, AV_LOG_ERROR, "Expected vulkan hwdevice for vf_libplacebo, got %s.\n", +av_hwdevice_get_type_name(avhwctx->type)); +return AVERROR(EINVAL); +} + +hwctx = avhwctx->hwctx; /* Import libavfilter vulkan context into libplacebo */ s->vulkan = pl_vulkan_import(s->log, pl_vulkan_import_params( ___ 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/nvenc: use provided constant for max extradata size
ffmpeg | branch: master | Timo Rothenpieler | Tue Nov 15 01:32:56 2022 +0100| [eb1e359a14e04367239a784506e1ae414512a104] | committer: Timo Rothenpieler avcodec/nvenc: use provided constant for max extradata size > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb1e359a14e04367239a784506e1ae414512a104 --- libavcodec/nvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index b803e72cca..9726c565d3 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1783,7 +1783,8 @@ static av_cold int nvenc_setup_extradata(AVCodecContext *avctx) NVENCSTATUS nv_status; uint32_t outSize = 0; -char tmpHeader[256]; +char tmpHeader[NV_MAX_SEQ_HDR_LEN]; + NV_ENC_SEQUENCE_PARAM_PAYLOAD payload = { 0 }; payload.version = NV_ENC_SEQUENCE_PARAM_PAYLOAD_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] avcodec/nvenc: add forgotten X2RGB10 formats to 10-bit-list
ffmpeg | branch: master | Timo Rothenpieler | Mon Nov 14 23:10:20 2022 +0100| [c7a60124e37d4838d9b113d3a91249f4f1913cfb] | committer: Timo Rothenpieler avcodec/nvenc: add forgotten X2RGB10 formats to 10-bit-list > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7a60124e37d4838d9b113d3a91249f4f1913cfb --- libavcodec/nvenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 7df11e5866..b803e72cca 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -82,6 +82,8 @@ const AVCodecHWConfigInternal *const ff_nvenc_hw_configs[] = { #define IS_10BIT(pix_fmt) (pix_fmt == AV_PIX_FMT_P010 || \ pix_fmt == AV_PIX_FMT_P016 || \ pix_fmt == AV_PIX_FMT_YUV444P16 || \ +pix_fmt == AV_PIX_FMT_X2RGB10 || \ +pix_fmt == AV_PIX_FMT_X2BGR10 || \ pix_fmt == AV_PIX_FMT_GBRP16) #define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P || \ ___ 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/nvenc: remove unsupported AV1 High Profile
ffmpeg | branch: master | Timo Rothenpieler | Thu Nov 10 15:26:43 2022 +0100| [939273d3b493fa4f0f1f6520d717c4b5442ef5ba] | committer: Timo Rothenpieler avcodec/nvenc: remove unsupported AV1 High Profile > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=939273d3b493fa4f0f1f6520d717c4b5442ef5ba --- configure | 2 +- libavcodec/nvenc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 0f3042b8a7..a1cbb82334 100755 --- a/configure +++ b/configure @@ -6456,7 +6456,7 @@ fi if ! disabled ffnvcodec; then ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" -check_pkg_config ffnvcodec "ffnvcodec >= 12.0.11.0" "$ffnv_hdr_list" "" || \ +check_pkg_config ffnvcodec "ffnvcodec >= 12.0.16.0" "$ffnv_hdr_list" "" || \ check_pkg_config ffnvcodec "ffnvcodec >= 11.1.5.2 ffnvcodec < 12.0" "$ffnv_hdr_list" "" || \ check_pkg_config ffnvcodec "ffnvcodec >= 11.0.10.2 ffnvcodec < 11.1" "$ffnv_hdr_list" "" || \ check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.14 ffnvcodec < 8.2" "$ffnv_hdr_list" "" diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index b9edc0e26d..7df11e5866 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1375,8 +1375,8 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx) } if (IS_YUV444(ctx->data_pix_fmt)) { -cc->profileGUID = NV_ENC_AV1_PROFILE_HIGH_GUID; -avctx->profile = FF_PROFILE_AV1_HIGH; +av_log(avctx, AV_LOG_ERROR, "AV1 High Profile not supported, required for 4:4:4 encoding\n"); +return AVERROR(ENOTSUP); } else { cc->profileGUID = NV_ENC_AV1_PROFILE_MAIN_GUID; avctx->profile = FF_PROFILE_AV1_MAIN; ___ 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/nvenc: fix AV1 darWidth/Height calculation
ffmpeg | branch: master | Timo Rothenpieler | Thu Nov 10 13:05:59 2022 +0100| [e7fbdda64e2797c81a11c05b996dbb120c98b8c9] | committer: Timo Rothenpieler avcodec/nvenc: fix AV1 darWidth/Height calculation nvenc uses the darWidth/Height fields for the AV1 render_width/height instead, so a different calculation is needed. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7fbdda64e2797c81a11c05b996dbb120c98b8c9 --- libavcodec/nvenc.c | 20 1 file changed, 20 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 2583ec2912..b9edc0e26d 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -34,6 +34,7 @@ #include "libavutil/imgutils.h" #include "libavutil/mem.h" #include "libavutil/pixdesc.h" +#include "libavutil/mathematics.h" #include "atsc_a53.h" #include "encode.h" #include "internal.h" @@ -1454,6 +1455,25 @@ static void compute_dar(AVCodecContext *avctx, int *dw, int *dh) { sw = avctx->width; sh = avctx->height; +#if CONFIG_AV1_NVENC_ENCODER +if (avctx->codec->id == AV_CODEC_ID_AV1) { +/* For AV1 we actually need to calculate the render width/height, not the dar */ +if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0 +&& avctx->sample_aspect_ratio.num != avctx->sample_aspect_ratio.den) +{ +if (avctx->sample_aspect_ratio.num > avctx->sample_aspect_ratio.den) { +sw = av_rescale(sw, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den); +} else { +sh = av_rescale(sh, avctx->sample_aspect_ratio.den, avctx->sample_aspect_ratio.num); +} +} + +*dw = sw; +*dh = sh; +return; +} +#endif + if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) { sw *= avctx->sample_aspect_ratio.num; sh *= avctx->sample_aspect_ratio.den; ___ 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] Changelog: add forgotten nvenc av1 entry
ffmpeg | branch: master | Timo Rothenpieler | Mon Nov 7 20:16:42 2022 +0100| [1800a0da0964d209fdef19ad85f318411523e2c2] | committer: Timo Rothenpieler Changelog: add forgotten nvenc av1 entry > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1800a0da0964d209fdef19ad85f318411523e2c2 --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index b40118093a..166aa8b5e7 100644 --- a/Changelog +++ b/Changelog @@ -19,6 +19,7 @@ version : - DTS to PTS reorder bsf - ViewQuest VQC decoder - backgroundkey filter +- nvenc AV1 encoding support version 5.1: ___ 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/nvenc: don't queue and offset dts for AV1
ffmpeg | branch: master | Timo Rothenpieler | Sat Nov 5 21:20:06 2022 +0100| [aa3d98227e88f316f56aa73a5c6356e3949e9808] | committer: Timo Rothenpieler avcodec/nvenc: don't queue and offset dts for AV1 dts != pts is actually a spec violation for AV1, given it has no reordering in the classical sense. We don't really need the whole timestamp queue in this case and can just pass through the timestamp as is for both dts and pts. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa3d98227e88f316f56aa73a5c6356e3949e9808 --- libavcodec/nvenc.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 0d1d68d70d..2583ec2912 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -2170,9 +2170,13 @@ static int nvenc_set_timestamp(AVCodecContext *avctx, NvencContext *ctx = avctx->priv_data; pkt->pts = params->outputTimeStamp; -pkt->dts = timestamp_queue_dequeue(ctx->timestamp_list); -pkt->dts -= FFMAX(ctx->encode_config.frameIntervalP - 1, 0) * FFMAX(avctx->ticks_per_frame, 1); +if (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER) { +pkt->dts = timestamp_queue_dequeue(ctx->timestamp_list); +pkt->dts -= FFMAX(ctx->encode_config.frameIntervalP - 1, 0) * FFMAX(avctx->ticks_per_frame, 1); +} else { +pkt->dts = pkt->pts; +} return 0; } @@ -2582,7 +2586,9 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame) if (frame && frame->buf[0]) { av_fifo_write(ctx->output_surface_queue, _surf, 1); -timestamp_queue_enqueue(ctx->timestamp_list, frame->pts); + +if (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER) +timestamp_queue_enqueue(ctx->timestamp_list, frame->pts); } /* all the pending buffers are now ready for output */ ___ 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/nvenc: add AV1 encoding support
ffmpeg | branch: master | Timo Rothenpieler | Sat Nov 5 21:17:37 2022 +0100| [5c288a44ad16087c3d3a7563490cb634790e751f] | committer: Timo Rothenpieler avcodec/nvenc: add AV1 encoding support The encoder seems to be trading blows with hevc_nvenc. In terms of quality at low bitrate cbr settings, it seems to outperform it even. It produces fewer artifacts and the ones it does produce are less jarring to my perception. At higher bitrates I had a hard time finding differences between the two encoders in terms of subjective visual quality. Using the 'slow' preset, av1_nvenc outperformed hevc_nvenc in terms of encoding speed by 75% to 100% while performing above tests. Needless to say, it always massively outperformed h264_nvenc in terms of quality for a given bitrate, while also being slightly faster. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c288a44ad16087c3d3a7563490cb634790e751f --- configure | 14 ++-- libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/nvenc.c | 134 --- libavcodec/nvenc.h | 4 ++ libavcodec/nvenc_av1.c | 189 + libavcodec/version.h | 4 +- 7 files changed, 333 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 2bcdf18a57..c793daf333 100755 --- a/configure +++ b/configure @@ -3184,6 +3184,8 @@ nvenc_deps_any="libdl LoadLibrary" aac_mf_encoder_deps="mediafoundation" ac3_mf_encoder_deps="mediafoundation" av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS" +av1_nvenc_encoder_deps="nvenc NV_ENC_PIC_PARAMS_AV1" +av1_nvenc_encoder_select="atsc_a53" h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m" h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m" h264_amf_encoder_deps="amf" @@ -6466,10 +6468,10 @@ fi if ! disabled ffnvcodec; then ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" -check_pkg_config ffnvcodec "ffnvcodec >= 9.1.23.1" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 9.0.18.3 ffnvcodec < 9.1" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 8.2.15.10 ffnvcodec < 8.3" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.11 ffnvcodec < 8.2" "$ffnv_hdr_list" "" +check_pkg_config ffnvcodec "ffnvcodec >= 12.0.11.0" "$ffnv_hdr_list" "" || \ + check_pkg_config ffnvcodec "ffnvcodec >= 11.1.5.2 ffnvcodec < 12.0" "$ffnv_hdr_list" "" || \ + check_pkg_config ffnvcodec "ffnvcodec >= 11.0.10.2 ffnvcodec < 11.1" "$ffnv_hdr_list" "" || \ + check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.14 ffnvcodec < 8.2" "$ffnv_hdr_list" "" fi if enabled_all libglslang libshaderc; then @@ -7050,6 +7052,10 @@ void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; int main(void) { return 0; } EOF +if enabled nvenc; then +check_type "ffnvcodec/nvEncodeAPI.h" "NV_ENC_PIC_PARAMS_AV1" +fi + if enabled_any nvdec cuvid; then check_type "ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h" "CUVIDAV1PICPARAMS" fi diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 72d2f92901..32318fd7ed 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -244,6 +244,7 @@ OBJS-$(CONFIG_AURA_DECODER)+= cyuv.o OBJS-$(CONFIG_AURA2_DECODER) += aura.o OBJS-$(CONFIG_AV1_DECODER) += av1dec.o OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o +OBJS-$(CONFIG_AV1_NVENC_ENCODER) += nvenc_av1.o nvenc.o OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o OBJS-$(CONFIG_AVRN_DECODER)+= avrndec.o OBJS-$(CONFIG_AVRP_DECODER)+= r210dec.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 4f1d66cb0c..f5ec3bc6e1 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -827,6 +827,7 @@ extern const FFCodec ff_libaom_av1_decoder; /* hwaccel hooks only, so prefer external decoders */ extern const FFCodec ff_av1_decoder; extern const FFCodec ff_av1_cuvid_decoder; +extern const FFCodec ff_av1_nvenc_encoder; extern const FFCodec ff_av1_qsv_decoder; extern const FFCodec ff_av1_qsv_encoder; extern const FFCodec ff_libopenh264_encoder; diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 73c05fcd37..8228c66f64 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1,5 +1,5 @@ /* - * H.264/HEVC hardware encoding using nvidia nvenc + * H.264/HEVC/AV1 hardware encoding using nvidia nvenc * Copyrigh
[FFmpeg-cvslog] avcodec/nvenc: set correct "sei" payload type for AV1
ffmpeg | branch: master | Timo Rothenpieler | Sat Nov 5 21:18:36 2022 +0100| [6362b8cd19c72f5b7b58709729afac2a965c3e37] | committer: Timo Rothenpieler avcodec/nvenc: set correct "sei" payload type for AV1 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6362b8cd19c72f5b7b58709729afac2a965c3e37 --- libavcodec/nvenc.c | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 8228c66f64..0d1d68d70d 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -24,6 +24,9 @@ #include "nvenc.h" #include "hevc_sei.h" +#if CONFIG_AV1_NVENC_ENCODER +#include "av1.h" +#endif #include "libavutil/hwcontext_cuda.h" #include "libavutil/hwcontext.h" @@ -2306,8 +2309,15 @@ static int prepare_sei_data_array(AVCodecContext *avctx, const AVFrame *frame) } else { ctx->sei_data = tmp; ctx->sei_data[sei_count].payloadSize = (uint32_t)a53_size; -ctx->sei_data[sei_count].payloadType = 4; ctx->sei_data[sei_count].payload = (uint8_t*)a53_data; + +#if CONFIG_AV1_NVENC_ENCODER +if (avctx->codec->id == AV_CODEC_ID_AV1) +ctx->sei_data[sei_count].payloadType = AV1_METADATA_TYPE_ITUT_T35; +else +#endif +ctx->sei_data[sei_count].payloadType = SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35; + sei_count++; } } @@ -2332,8 +2342,15 @@ static int prepare_sei_data_array(AVCodecContext *avctx, const AVFrame *frame) } else { ctx->sei_data = tmp; ctx->sei_data[sei_count].payloadSize = (uint32_t)tc_size; -ctx->sei_data[sei_count].payloadType = SEI_TYPE_TIME_CODE; ctx->sei_data[sei_count].payload = (uint8_t*)tc_data; + +#if CONFIG_AV1_NVENC_ENCODER +if (avctx->codec->id == AV_CODEC_ID_AV1) +ctx->sei_data[sei_count].payloadType = AV1_METADATA_TYPE_TIMECODE; +else +#endif +ctx->sei_data[sei_count].payloadType = SEI_TYPE_TIME_CODE; + sei_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/nvenc: only set b_ref_mode when explicitly requested
ffmpeg | branch: master | Timo Rothenpieler | Wed Nov 2 19:02:56 2022 +0100| [28680e2f41b93b75863720e42397441dfcc29f94] | committer: Timo Rothenpieler avcodec/nvenc: only set b_ref_mode when explicitly requested > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28680e2f41b93b75863720e42397441dfcc29f94 --- libavcodec/nvenc.c | 6 -- libavcodec/nvenc_h264.c | 4 ++-- libavcodec/nvenc_hevc.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 3c6fce391d..73c05fcd37 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1199,7 +1199,8 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) h264->entropyCodingMode = ctx->coder; #ifdef NVENC_HAVE_BFRAME_REF_MODE -h264->useBFramesAsRef = ctx->b_ref_mode; +if (ctx->b_ref_mode >= 0) +h264->useBFramesAsRef = ctx->b_ref_mode; #endif #ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES @@ -1314,7 +1315,8 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) hevc->tier = ctx->tier; #ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE -hevc->useBFramesAsRef = ctx->b_ref_mode; +if (ctx->b_ref_mode >= 0) +hevc->useBFramesAsRef = ctx->b_ref_mode; #endif #ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c index a178827291..a69358b03b 100644 --- a/libavcodec/nvenc_h264.c +++ b/libavcodec/nvenc_h264.c @@ -161,12 +161,12 @@ static const AVOption options[] = { { "ac", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CABAC }, 0, 0, VE, "coder" }, { "vlc", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC }, 0, 0, VE, "coder" }, #ifdef NVENC_HAVE_BFRAME_REF_MODE -{ "b_ref_mode", "Use B frames as references", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, NV_ENC_BFRAME_REF_MODE_DISABLED, NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, "b_ref_mode" }, +{ "b_ref_mode", "Use B frames as references", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, "b_ref_mode" }, { "disabled", "B frames will not be used for reference", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, 0, 0, VE, "b_ref_mode" }, { "each", "Each B frame will be used for reference", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_EACH }, 0, 0, VE, "b_ref_mode" }, { "middle", "Only (number of B frames)/2 will be used for reference", 0,AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_MIDDLE }, 0, 0, VE, "b_ref_mode" }, #else -{ "b_ref_mode", "(not supported)", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE, "b_ref_mode" }, +{ "b_ref_mode", "(not supported)", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, "b_ref_mode" }, { "disabled", "", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, VE, "b_ref_mode" }, { "each", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, "b_ref_mode" }, { "middle", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, VE, "b_ref_mode" }, diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c index ae4d73e497..5ad423444a 100644 --- a/libavcodec/nvenc_hevc.c +++ b/libavcodec/nvenc_hevc.c @@ -141,12 +141,12 @@ static const AVOption options[] = { { "weighted_pred","Set 1 to enable weighted prediction", OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, #ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE -{ "b_ref_mode", "Use B frames as references", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, NV_ENC_BFRAME_REF_MODE_DISABLED, NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, "b_ref_mode" }, +{ "b_ref_mode", "Use B frames as references", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, "b_ref_mode" }, { "disabled", "B frames wi
[FFmpeg-cvslog] configure: add pkg-config check for chromaprint
ffmpeg | branch: master | Timo Rothenpieler | Wed Nov 2 14:10:05 2022 +0100| [0957d62fb006746dddf78c875aeb3b8b17ad3803] | committer: Timo Rothenpieler configure: add pkg-config check for chromaprint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0957d62fb006746dddf78c875aeb3b8b17ad3803 --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 30f0ce4e26..2bcdf18a57 100755 --- a/configure +++ b/configure @@ -6559,7 +6559,8 @@ enabled avisynth && { require_headers "avisynth/avisynth_c.h avisynth/a { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || die "ERROR: AviSynth+ header version must be >= 3.7.1"; } } enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } -enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint +enabled chromaprint && { check_pkg_config chromaprint libchromaprint "chromaprint.h" chromaprint_get_version || + require chromaprint chromaprint.h chromaprint_get_version -lchromaprint; } enabled decklink && { require_headers DeckLinkAPI.h && { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a0b" || die "ERROR: Decklink API version must be >= 10.11"; } } enabled frei0r&& require_headers "frei0r.h" ___ 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/nvenc: remove unused slice offset querying
ffmpeg | branch: master | Timo Rothenpieler | Tue Nov 1 15:35:54 2022 +0100| [12733c0cbd49077d3aac48007f674f14d1e15ccd] | committer: Timo Rothenpieler avcodec/nvenc: remove unused slice offset querying > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12733c0cbd49077d3aac48007f674f14d1e15ccd --- libavcodec/nvenc.c | 26 -- 1 file changed, 26 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 11bd21f365..3c6fce391d 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -2060,38 +2060,16 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur NvencDynLoadFunctions *dl_fn = >nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = _fn->nvenc_funcs; -uint32_t slice_mode_data; -uint32_t *slice_offsets = NULL; NV_ENC_LOCK_BITSTREAM lock_params = { 0 }; NVENCSTATUS nv_status; int res = 0; enum AVPictureType pict_type; -switch (avctx->codec->id) { -case AV_CODEC_ID_H264: - slice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData; - break; -case AV_CODEC_ID_H265: - slice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData; - break; -default: - av_log(avctx, AV_LOG_ERROR, "Unknown codec name\n"); - res = AVERROR(EINVAL); - goto error; -} -slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets)); - -if (!slice_offsets) { -res = AVERROR(ENOMEM); -goto error; -} - lock_params.version = NV_ENC_LOCK_BITSTREAM_VER; lock_params.doNotWait = 0; lock_params.outputBitstream = tmpoutsurf->output_surface; -lock_params.sliceOffsets = slice_offsets; nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, _params); if (nv_status != NV_ENC_SUCCESS) { @@ -2162,16 +2140,12 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur if (res < 0) goto error2; -av_free(slice_offsets); - return 0; error: timestamp_queue_dequeue(ctx->timestamp_list); error2: -av_free(slice_offsets); - return res; } ___ 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: add pkg-config check for OpenAL
ffmpeg | branch: master | Timo Rothenpieler | Sat Oct 29 18:55:44 2022 +0200| [d77241923780b8fcf117efc5d35d3ac9787b927e] | committer: Timo Rothenpieler configure: add pkg-config check for OpenAL > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d77241923780b8fcf117efc5d35d3ac9787b927e --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 70c9e41dcc..30f0ce4e26 100755 --- a/configure +++ b/configure @@ -6757,7 +6757,8 @@ enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_co check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } || die "ERROR: mmal not found" && check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; } -enabled openal&& { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do +enabled openal&& { check_pkg_config openal "openal >= 1.1" "AL/al.h" alGetError || + { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } || die "ERROR: openal not found"; } && { test_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" || ___ 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] avfilter/vf_extractplanes: add missing break; statement
ffmpeg | branch: master | Timo Rothenpieler | Tue Sep 27 19:35:37 2022 +0200| [59cb0bd23d61f6ea3bfd86558346e2720aba7f06] | committer: Timo Rothenpieler avfilter/vf_extractplanes: add missing break; statement > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59cb0bd23d61f6ea3bfd86558346e2720aba7f06 --- libavfilter/vf_extractplanes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c index 3c794eaa28..08737d6415 100644 --- a/libavfilter/vf_extractplanes.c +++ b/libavfilter/vf_extractplanes.c @@ -284,6 +284,7 @@ static void extract_from_packed(uint8_t *dst, int dst_linesize, dst[x * 2] = src[x * step + comp * 2]; dst[x * 2 + 1] = src[x * step + comp * 2 + 1]; } +break; case 4: for (x = 0; x < width; x++) { dst[x * 4] = src[x * step + comp * 4]; ___ 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] avfilter/vf_colorspace_cuda: mark fall-through
ffmpeg | branch: master | Timo Rothenpieler | Thu Sep 15 19:35:30 2022 +0200| [c9bd6ee5cb33c6462d6e74b9e39c159e1143ff65] | committer: Timo Rothenpieler avfilter/vf_colorspace_cuda: mark fall-through > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9bd6ee5cb33c6462d6e74b9e39c159e1143ff65 --- libavfilter/vf_colorspace_cuda.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_colorspace_cuda.c b/libavfilter/vf_colorspace_cuda.c index 131c4ad72b..07d4edd0d8 100644 --- a/libavfilter/vf_colorspace_cuda.c +++ b/libavfilter/vf_colorspace_cuda.c @@ -281,6 +281,7 @@ static int conv_cuda_convert(AVFilterContext* ctx, AVFrame* out, AVFrame* in) break; case AV_PIX_FMT_YUV420P: width = comp_id ? in->width / 2 : in->width; +/* fall-through */ case AV_PIX_FMT_NV12: height = comp_id ? in->height / 2 : in->height; break; ___ 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] avfilter/vf_bilateral_cuda: refactor use of pow to simple multiplication
ffmpeg | branch: master | Timo Rothenpieler | Sat Sep 3 20:02:03 2022 +0200| [6512dd6cb528a261369284f2634c0856fdaffaf9] | committer: Timo Rothenpieler avfilter/vf_bilateral_cuda: refactor use of pow to simple multiplication > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6512dd6cb528a261369284f2634c0856fdaffaf9 --- libavfilter/vf_bilateral_cuda.cu | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_bilateral_cuda.cu b/libavfilter/vf_bilateral_cuda.cu index bbcfc81db5..7d6cc14c0a 100644 --- a/libavfilter/vf_bilateral_cuda.cu +++ b/libavfilter/vf_bilateral_cuda.cu @@ -33,11 +33,10 @@ extern "C" */ __device__ static inline float norm_squared(float4 first_yuv, float4 second_yuv) { -float ans = 0; -ans += __powf(first_yuv.x - second_yuv.x, 2); -ans += __powf(first_yuv.y - second_yuv.y, 2); -ans += __powf(first_yuv.z - second_yuv.z, 2); -return ans; +float x = first_yuv.x - second_yuv.x; +float y = first_yuv.y - second_yuv.y; +float z = first_yuv.z - second_yuv.z; +return (x*x) + (y*y) + (z*z); } /** @@ -52,7 +51,7 @@ __device__ static inline float calculate_w(int x, int y, int r, int c, float sigma_space, float sigma_color) { float first_term, second_term; -first_term = (__powf(x - r, 2) + __powf(y - c, 2)) / (2 * sigma_space * sigma_space); +first_term = (((x - r) * (x - r)) + ((y - c) * (y - c))) / (2 * sigma_space * sigma_space); second_term = norm_squared(pixel_value, neighbor_value) / (2 * sigma_color * sigma_color); return __expf(-first_term - second_term); } ___ 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] compat/cuda: switch from powf to __powf intrinsic
ffmpeg | branch: master | Timo Rothenpieler | Sat Sep 3 19:49:53 2022 +0200| [416923346a6d31563801784963d2893a8d1da1c8] | committer: Timo Rothenpieler compat/cuda: switch from powf to __powf intrinsic The powf builtin causes crashes on older clang, so manually implement the (faster) intrinsic. The code it spawns is identical to that of nvcc. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=416923346a6d31563801784963d2893a8d1da1c8 --- compat/cuda/cuda_runtime.h | 2 +- libavfilter/vf_bilateral_cuda.cu | 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compat/cuda/cuda_runtime.h b/compat/cuda/cuda_runtime.h index 082e4a8ba3..699c4b6c75 100644 --- a/compat/cuda/cuda_runtime.h +++ b/compat/cuda/cuda_runtime.h @@ -182,11 +182,11 @@ static inline __device__ float fabsf(float a) { return __builtin_fabsf(a); } static inline __device__ float fabs(float a) { return __builtin_fabsf(a); } static inline __device__ double fabs(double a) { return __builtin_fabs(a); } static inline __device__ float sqrtf(float a) { return __builtin_sqrtf(a); } -static inline __device__ float powf(float a, float y) { return __builtin_powf(a,y); } static inline __device__ float __saturatef(float a) { return __nvvm_saturate_f(a); } static inline __device__ float __sinf(float a) { return __nvvm_sin_approx_f(a); } static inline __device__ float __cosf(float a) { return __nvvm_cos_approx_f(a); } static inline __device__ float __expf(float a) { return __nvvm_ex2_approx_f(a * (float)__builtin_log2(__builtin_exp(1))); } +static inline __device__ float __powf(float a, float b) { return __nvvm_ex2_approx_f(__nvvm_lg2_approx_f(a) * b); } #endif /* COMPAT_CUDA_CUDA_RUNTIME_H */ diff --git a/libavfilter/vf_bilateral_cuda.cu b/libavfilter/vf_bilateral_cuda.cu index 8aba3a079f..bbcfc81db5 100644 --- a/libavfilter/vf_bilateral_cuda.cu +++ b/libavfilter/vf_bilateral_cuda.cu @@ -34,9 +34,9 @@ extern "C" __device__ static inline float norm_squared(float4 first_yuv, float4 second_yuv) { float ans = 0; -ans += powf(first_yuv.x - second_yuv.x, 2); -ans += powf(first_yuv.y - second_yuv.y, 2); -ans += powf(first_yuv.z - second_yuv.z, 2); +ans += __powf(first_yuv.x - second_yuv.x, 2); +ans += __powf(first_yuv.y - second_yuv.y, 2); +ans += __powf(first_yuv.z - second_yuv.z, 2); return ans; } @@ -52,7 +52,7 @@ __device__ static inline float calculate_w(int x, int y, int r, int c, float sigma_space, float sigma_color) { float first_term, second_term; -first_term = (powf(x - r, 2) + powf(y - c, 2)) / (2 * sigma_space * sigma_space); +first_term = (__powf(x - r, 2) + __powf(y - c, 2)) / (2 * sigma_space * sigma_space); second_term = norm_squared(pixel_value, neighbor_value) / (2 * sigma_color * sigma_color); return __expf(-first_term - second_term); } ___ 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] swscale/input: add rgbaf16 input support
ffmpeg | branch: master | Timo Rothenpieler | Mon Aug 8 14:02:31 2022 +0200| [aca569aad26f33fe68eb36c5c689b2dc4de77084] | committer: Timo Rothenpieler swscale/input: add rgbaf16 input support This is by no means perfect, since at least ddagrab will return scRGB data with values outside of 0.0f to 1.0f for HDR values. Its primary purpose is to be able to work with the format at all. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aca569aad26f33fe68eb36c5c689b2dc4de77084 --- libswscale/Makefile | 1 + libswscale/half2float.c | 19 ++ libswscale/input.c| 130 ++ libswscale/slice.c| 9 ++- libswscale/swscale_internal.h | 10 libswscale/utils.c| 2 + libswscale/version.h | 2 +- 7 files changed, 171 insertions(+), 2 deletions(-) diff --git a/libswscale/Makefile b/libswscale/Makefile index 4c950e6c43..757997b401 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -9,6 +9,7 @@ OBJS = alphablend.o \ hscale.o \ hscale_fast_bilinear.o \ gamma.o \ + half2float.o \ input.o \ options.o\ output.o \ diff --git a/libswscale/half2float.c b/libswscale/half2float.c new file mode 100644 index 00..1b023f96a5 --- /dev/null +++ b/libswscale/half2float.c @@ -0,0 +1,19 @@ +/* + * 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 "libavutil/half2float.c" diff --git a/libswscale/input.c b/libswscale/input.c index 36ef1e43ac..1077d01e91 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -1124,6 +1124,112 @@ static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, rgbf32_planar_funcs_endian(le, 0) rgbf32_planar_funcs_endian(be, 1) +#define rdpx(src) av_int2float(half2float(is_be ? AV_RB16() : AV_RL16(), h2f_tbl)) + +static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be, + const uint16_t *src, int width, + int32_t *rgb2yuv, Half2FloatTables *h2f_tbl) +{ +int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX]; +int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX]; +int i; +for (i = 0; i < width; i++) { +int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) + + lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1; +int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) + + lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1; +int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) + + lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1; + +dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT; +dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT; +} +} + +static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be, +const uint16_t *src, int width, +int32_t *rgb2yuv, Half2FloatTables *h2f_tbl) +{ +int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX]; +int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX]; +int i; +for (i = 0; i < width; i++) { +int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f)); +int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f)); +int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f)); + +dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT; +dstV[i
[FFmpeg-cvslog] swscale: add opaque parameter to input functions
ffmpeg | branch: master | Timo Rothenpieler | Wed Aug 10 15:12:24 2022 +0200| [f2de911818fbd7e73343803626b697fd0c968121] | committer: Timo Rothenpieler swscale: add opaque parameter to input functions > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2de911818fbd7e73343803626b697fd0c968121 --- libswscale/hscale.c | 12 ++-- libswscale/input.c| 149 +++--- libswscale/swscale_internal.h | 17 +++-- libswscale/x86/swscale.c | 13 ++-- 4 files changed, 106 insertions(+), 85 deletions(-) diff --git a/libswscale/hscale.c b/libswscale/hscale.c index eca0635338..6789ce7540 100644 --- a/libswscale/hscale.c +++ b/libswscale/hscale.c @@ -105,18 +105,18 @@ static int lum_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int uint8_t * dst = desc->dst->plane[0].line[i]; if (c->lumToYV12) { -c->lumToYV12(dst, src[0], src[1], src[2], srcW, pal); +c->lumToYV12(dst, src[0], src[1], src[2], srcW, pal, c->input_opaque); } else if (c->readLumPlanar) { -c->readLumPlanar(dst, src, srcW, c->input_rgb2yuv_table); +c->readLumPlanar(dst, src, srcW, c->input_rgb2yuv_table, c->input_opaque); } if (desc->alpha) { dst = desc->dst->plane[3].line[i]; if (c->alpToYV12) { -c->alpToYV12(dst, src[3], src[1], src[2], srcW, pal); +c->alpToYV12(dst, src[3], src[1], src[2], srcW, pal, c->input_opaque); } else if (c->readAlpPlanar) { -c->readAlpPlanar(dst, src, srcW, NULL); +c->readAlpPlanar(dst, src, srcW, NULL, c->input_opaque); } } } @@ -224,9 +224,9 @@ static int chr_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int uint8_t * dst1 = desc->dst->plane[1].line[i]; uint8_t * dst2 = desc->dst->plane[2].line[i]; if (c->chrToYV12) { -c->chrToYV12(dst1, dst2, src[0], src[1], src[2], srcW, pal); +c->chrToYV12(dst1, dst2, src[0], src[1], src[2], srcW, pal, c->input_opaque); } else if (c->readChrPlanar) { -c->readChrPlanar(dst1, dst2, src, srcW, c->input_rgb2yuv_table); +c->readChrPlanar(dst1, dst2, src, srcW, c->input_rgb2yuv_table, c->input_opaque); } } return sliceH; diff --git a/libswscale/input.c b/libswscale/input.c index 68abc4d62c..36ef1e43ac 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -88,7 +88,7 @@ rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV, #define rgb64funcs(pattern, BE_LE, origin) \ static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\ -int width, uint32_t *rgb2yuv) \ +int width, uint32_t *rgb2yuv, void *opq) \ { \ const uint16_t *src = (const uint16_t *) _src; \ uint16_t *dst = (uint16_t *) _dst; \ @@ -97,7 +97,7 @@ static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, \ static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \ const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \ -int width, uint32_t *rgb2yuv) \ +int width, uint32_t *rgb2yuv, void *opq) \ { \ const uint16_t *src1 = (const uint16_t *) _src1, \ *src2 = (const uint16_t *) _src2; \ @@ -107,7 +107,7 @@ static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \ \ static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \ const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \ -int width, uint32_t *rgb2yuv) \ +int width, uint32_t *rgb2yuv, void *opq) \ { \ const uint16_t *src1 = (const uint16_t *) _src1, \ *src2 = (const uint16_t *) _src2; \ @@ -192,7 +192,8 @@ static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \ const uint8_t *_src,\ const uint8_t *unused0, const uint8_t *unused1,\ int width, \ -uint32_t *rgb2yuv) \ +uint32_t *rgb2yuv, \ +void *opq) \ { \ const uint16_t *src = (const uint16_t *)_src;
[FFmpeg-cvslog] avutil/half2float: use native _Float16 if available
ffmpeg | branch: master | Timo Rothenpieler | Wed Aug 10 02:23:26 2022 +0200| [ef2c2a22207d7ec046bb0711fcae18f539828188] | committer: Timo Rothenpieler avutil/half2float: use native _Float16 if available _Float16 support was available on arm/aarch64 for a while, and with gcc 12 was enabled on x86 as long as SSE2 is supported. If the target arch supports f16c, gcc emits fairly efficient assembly, taking advantage of it. This is the case on x86-64-v3 or higher. Same goes on arm, which has native float16 support. On x86, without f16c, it emulates it in software using sse2 instructions. This has shown to perform rather poorly: _Float16 full SSE2 emulation: frame=50074 fps=848 q=-0.0 size=N/A time=00:33:22.96 bitrate=N/A speed=33.9x _Float16 f16c accelerated (Zen2, --cpu=znver2): frame=50636 fps=1965 q=-0.0 Lsize=N/A time=00:33:45.40 bitrate=N/A speed=78.6x classic half2float full software implementation: frame=49926 fps=1605 q=-0.0 Lsize=N/A time=00:33:17.00 bitrate=N/A speed=64.2x Hence an additional check was introduced, that only enables use of _Float16 on x86 if f16c is being utilized. On aarch64, a similar uplift in performance is seen: RPi4 half2float full software implementation: frame= 6088 fps=126 q=-0.0 Lsize=N/A time=00:04:03.48 bitrate=N/A speed=5.06x RPi4 _Float16: frame= 6103 fps=158 q=-0.0 Lsize=N/A time=00:04:04.08 bitrate=N/A speed=6.32x Since arm/aarch64 always natively support 16 bit floats, it can always be considered fast there. I'm not aware of any additional platforms that currently support _Float16. And if there are, they should be considered non-fast until proven fast. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ef2c2a22207d7ec046bb0711fcae18f539828188 --- configure | 12 libavutil/float2half.c | 2 ++ libavutil/float2half.h | 16 libavutil/half2float.c | 4 libavutil/half2float.h | 16 5 files changed, 50 insertions(+) diff --git a/configure b/configure index fe94941a03..ea50c94002 100755 --- a/configure +++ b/configure @@ -2145,6 +2145,7 @@ ARCH_FEATURES=" fast_64bit fast_clz fast_cmov +fast_float16 local_aligned simd_align_16 simd_align_32 @@ -5127,6 +5128,8 @@ elif enabled arm; then ;; esac +test_cflags -mfp16-format=ieee && add_cflags -mfp16-format=ieee + elif enabled avr32; then case $cpu in @@ -6231,6 +6234,15 @@ check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)" check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)" +check_builtin float16 "" "_Float16 f16var" +if enabled float16; then +if enabled x86; then +test_cpp_condition stddef.h "defined(__F16C__)" && enable fast_float16 +elif enabled arm || enabled aarch64; then +enable fast_float16 +fi +fi + case "$custom_allocator" in jemalloc) # jemalloc by default does not use a prefix diff --git a/libavutil/float2half.c b/libavutil/float2half.c index c79a3abfa1..1a283956e7 100644 --- a/libavutil/float2half.c +++ b/libavutil/float2half.c @@ -20,6 +20,7 @@ void ff_init_float2half_tables(Float2HalfTables *t) { +#if !HAVE_FAST_FLOAT16 for (int i = 0; i < 256; i++) { int e = i - 127; @@ -50,4 +51,5 @@ void ff_init_float2half_tables(Float2HalfTables *t) t->shifttable[i|0x100] = 13; } } +#endif } diff --git a/libavutil/float2half.h b/libavutil/float2half.h index 20fdc2a36b..e619046911 100644 --- a/libavutil/float2half.h +++ b/libavutil/float2half.h @@ -20,21 +20,37 @@ #define AVUTIL_FLOAT2HALF_H #include +#include "intfloat.h" + +#include "config.h" typedef struct Float2HalfTables { +#if HAVE_FAST_FLOAT16 +uint8_t dummy; +#else uint16_t basetable[512]; uint8_t shifttable[512]; +#endif } Float2HalfTables; void ff_init_float2half_tables(Float2HalfTables *t); static inline uint16_t float2half(uint32_t f, const Float2HalfTables *t) { +#if HAVE_FAST_FLOAT16 +union { +_Float16 f; +uint16_t i; +} u; +u.f = av_int2float(f); +return u.i; +#else uint16_t h; h = t->basetable[(f >> 23) & 0x1ff] + ((f & 0x007f) >> t->shifttable[(f >> 23) & 0x1ff]); return h; +#endif } #endif /* AVUTIL_FLOAT2HALF_H */ diff --git a/libavutil/half2float.c b/libavutil/half2float.c index 1967126f76..4de2180a19 100644 --- a/libavutil/half2float.c +++ b/libavutil/half2float.c @@ -18,6 +18,7 @@ #include "libavutil/half2float.h" +#if !HAVE_FAST_FLOAT16 static uint32_t convertmantissa(uint32_t i) { int32_t m = i << 13; // Zero pad mantissa bits @@ -33,9 +34,11 @@ static uint32_t convertmantissa(uin
[FFmpeg-cvslog] avutil/half2float: move non-inline init code out of header
ffmpeg | branch: master | Timo Rothenpieler | Wed Aug 10 01:53:10 2022 +0200| [6dc79f1d04eb88ec97360c45be4cadc66b7e5780] | committer: Timo Rothenpieler avutil/half2float: move non-inline init code out of header > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6dc79f1d04eb88ec97360c45be4cadc66b7e5780 --- libavcodec/Makefile | 8 +++ libavcodec/exr.c| 2 +- libavcodec/exrenc.c | 2 +- libavcodec/float2half.c | 19 +++ libavcodec/half2float.c | 19 +++ libavcodec/pnmdec.c | 2 +- libavcodec/pnmenc.c | 2 +- libavutil/float2half.c | 53 + libavutil/float2half.h | 36 ++-- libavutil/half2float.c | 63 + libavutil/half2float.h | 46 ++-- 11 files changed, 166 insertions(+), 86 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 029f1bad3d..cb80f73d99 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -337,8 +337,8 @@ OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER)+= 8svx.o OBJS-$(CONFIG_ESCAPE124_DECODER) += escape124.o OBJS-$(CONFIG_ESCAPE130_DECODER) += escape130.o OBJS-$(CONFIG_EVRC_DECODER)+= evrcdec.o acelp_vectors.o lsp.o -OBJS-$(CONFIG_EXR_DECODER) += exr.o exrdsp.o -OBJS-$(CONFIG_EXR_ENCODER) += exrenc.o +OBJS-$(CONFIG_EXR_DECODER) += exr.o exrdsp.o half2float.o +OBJS-$(CONFIG_EXR_ENCODER) += exrenc.o float2half.o OBJS-$(CONFIG_FASTAUDIO_DECODER) += fastaudio.o OBJS-$(CONFIG_FFV1_DECODER)+= ffv1dec.o ffv1.o OBJS-$(CONFIG_FFV1_ENCODER)+= ffv1enc.o ffv1.o @@ -570,8 +570,8 @@ OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o -OBJS-$(CONFIG_PHM_DECODER) += pnmdec.o pnm.o -OBJS-$(CONFIG_PHM_ENCODER) += pnmenc.o +OBJS-$(CONFIG_PHM_DECODER) += pnmdec.o pnm.o half2float.o +OBJS-$(CONFIG_PHM_ENCODER) += pnmenc.o float2half.o OBJS-$(CONFIG_PHOTOCD_DECODER) += photocd.o OBJS-$(CONFIG_PICTOR_DECODER) += pictordec.o cga_data.o OBJS-$(CONFIG_PIXLET_DECODER) += pixlet.o diff --git a/libavcodec/exr.c b/libavcodec/exr.c index b0e2e85024..859dd6fedd 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -2208,7 +2208,7 @@ static av_cold int decode_init(AVCodecContext *avctx) float one_gamma = 1.0f / s->gamma; avpriv_trc_function trc_func = NULL; -init_half2float_tables(>h2f_tables); +ff_init_half2float_tables(>h2f_tables); s->avctx = avctx; diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c index 356bd11543..3dad107d62 100644 --- a/libavcodec/exrenc.c +++ b/libavcodec/exrenc.c @@ -94,7 +94,7 @@ static av_cold int encode_init(AVCodecContext *avctx) { EXRContext *s = avctx->priv_data; -init_float2half_tables(>f2h_tables); +ff_init_float2half_tables(>f2h_tables); switch (avctx->pix_fmt) { case AV_PIX_FMT_GBRPF32: diff --git a/libavcodec/float2half.c b/libavcodec/float2half.c new file mode 100644 index 00..90a6f63fac --- /dev/null +++ b/libavcodec/float2half.c @@ -0,0 +1,19 @@ +/* + * 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 "libavutil/float2half.c" diff --git a/libavcodec/half2float.c b/libavcodec/half2float.c new file mode 100644 index 00..1b023f96a5 --- /dev/null +++ b/libavcodec/half2float.c @@ -0,0 +1,19 @@ +/* + * 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 h
[FFmpeg-cvslog] avutil/half2float: adjust conversion of NaN
ffmpeg | branch: master | Timo Rothenpieler | Tue Aug 9 22:16:50 2022 +0200| [cb8ad005bb73b1adf0d36eeb794c4c375fd3ee12] | committer: Timo Rothenpieler avutil/half2float: adjust conversion of NaN IEEE-754 differentiates two different kind of NaNs. Quiet and Signaling ones. They are differentiated by the MSB of the mantissa. For whatever reason, actual hardware conversion of half to single always sets the signaling bit to 1 if the mantissa is != 0, and to 0 if it's 0. So our code has to follow suite or fate-testing hardware float16 will be impossible. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb8ad005bb73b1adf0d36eeb794c4c375fd3ee12 --- libavcodec/exr.c| 2 +- libavcodec/pnm.h| 2 +- libavutil/half2float.h | 5 + tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 5c6ca9adbf..47f4786491 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -191,7 +191,7 @@ typedef struct EXRContext { float gamma; union av_intfloat32 gamma_table[65536]; -uint32_t mantissatable[2048]; +uint32_t mantissatable[3072]; uint32_t exponenttable[64]; uint16_t offsettable[64]; } EXRContext; diff --git a/libavcodec/pnm.h b/libavcodec/pnm.h index 5bf2eaa4d9..7e5445f529 100644 --- a/libavcodec/pnm.h +++ b/libavcodec/pnm.h @@ -34,7 +34,7 @@ typedef struct PNMContext { int half; float scale; -uint32_t mantissatable[2048]; +uint32_t mantissatable[3072]; uint32_t exponenttable[64]; uint16_t offsettable[64]; } PNMContext; diff --git a/libavutil/half2float.h b/libavutil/half2float.h index 1f6deade07..5af4690cfe 100644 --- a/libavutil/half2float.h +++ b/libavutil/half2float.h @@ -45,6 +45,9 @@ static void half2float_table(uint32_t *mantissatable, uint32_t *exponenttable, mantissatable[i] = convertmantissa(i); for (int i = 1024; i < 2048; i++) mantissatable[i] = 0x3800UL + ((i - 1024) << 13UL); +for (int i = 2048; i < 3072; i++) +mantissatable[i] = mantissatable[i - 1024] | 0x40UL; +mantissatable[2048] = mantissatable[1024]; exponenttable[0] = 0; for (int i = 1; i < 31; i++) @@ -58,7 +61,9 @@ static void half2float_table(uint32_t *mantissatable, uint32_t *exponenttable, offsettable[0] = 0; for (int i = 1; i < 64; i++) offsettable[i] = 1024; +offsettable[31] = 2048; offsettable[32] = 0; +offsettable[63] = 2048; } static uint32_t half2float(uint16_t h, const uint32_t *mantissatable, const uint32_t *exponenttable, diff --git a/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x b/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x index b6201116fe..e45a40b498 100644 --- a/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x +++ b/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 256x256 #sar 0: 1/1 -0, 0, 0,1, 786432, 0x1445e411 +0, 0, 0,1, 786432, 0xce9be2be ___ 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] avutil/half2float: move tables to header-internal structs
ffmpeg | branch: master | Timo Rothenpieler | Wed Aug 10 01:00:56 2022 +0200| [f3fb528cd5bfecec6835a3951c75903a194ae1ad] | committer: Timo Rothenpieler avutil/half2float: move tables to header-internal structs Having to put the knowledge of the size of those arrays into a multitude of places is rather smelly. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3fb528cd5bfecec6835a3951c75903a194ae1ad --- libavcodec/exr.c | 27 +- libavcodec/exrenc.c| 11 +-- libavcodec/pnm.h | 5 ++--- libavcodec/pnmdec.c| 42 + libavcodec/pnmenc.c| 13 ++--- libavutil/float2half.h | 51 +++--- libavutil/half2float.h | 46 - 7 files changed, 84 insertions(+), 111 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 47f4786491..b0e2e85024 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -191,9 +191,7 @@ typedef struct EXRContext { float gamma; union av_intfloat32 gamma_table[65536]; -uint32_t mantissatable[3072]; -uint32_t exponenttable[64]; -uint16_t offsettable[64]; +Half2FloatTables h2f_tables; } EXRContext; static int zip_uncompress(const EXRContext *s, const uint8_t *src, int compressed_size, @@ -899,10 +897,7 @@ static int ac_uncompress(const EXRContext *s, GetByteContext *gb, float *block) n += val & 0xff; } else { ret = n; -block[ff_zigzag_direct[n]] = av_int2float(half2float(val, - s->mantissatable, - s->exponenttable, - s->offsettable)); +block[ff_zigzag_direct[n]] = av_int2float(half2float(val, >h2f_tables)); n++; } } @@ -1120,8 +1115,7 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse uint16_t *dc = (uint16_t *)td->dc_data; union av_intfloat32 dc_val; -dc_val.i = half2float(dc[idx], s->mantissatable, - s->exponenttable, s->offsettable); +dc_val.i = half2float(dc[idx], >h2f_tables); block[0] = dc_val.f; ac_uncompress(s, , block); @@ -1171,7 +1165,7 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse for (int x = 0; x < td->xsize; x++) { uint16_t ha = ai0[x] | (ai1[x] << 8); -ao[x] = half2float(ha, s->mantissatable, s->exponenttable, s->offsettable); +ao[x] = half2float(ha, >h2f_tables); } } @@ -1427,10 +1421,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata, } } else { for (x = 0; x < xsize; x++) { -ptr_x[0].i = half2float(bytestream_get_le16(), -s->mantissatable, -s->exponenttable, -s->offsettable); +ptr_x[0].i = half2float(bytestream_get_le16(), >h2f_tables); ptr_x++; } } @@ -2217,7 +2208,7 @@ static av_cold int decode_init(AVCodecContext *avctx) float one_gamma = 1.0f / s->gamma; avpriv_trc_function trc_func = NULL; -half2float_table(s->mantissatable, s->exponenttable, s->offsettable); +init_half2float_tables(>h2f_tables); s->avctx = avctx; @@ -2230,18 +2221,18 @@ static av_cold int decode_init(AVCodecContext *avctx) trc_func = avpriv_get_trc_function_from_trc(s->apply_trc_type); if (trc_func) { for (i = 0; i < 65536; ++i) { -t.i = half2float(i, s->mantissatable, s->exponenttable, s->offsettable); +t.i = half2float(i, >h2f_tables); t.f = trc_func(t.f); s->gamma_table[i] = t; } } else { if (one_gamma > 0.f && one_gamma < 1.0001f) { for (i = 0; i < 65536; ++i) { -s->gamma_table[i].i = half2float(i, s->mantissatable, s->exponenttable, s->offsettable); +s->gamma_table[i].i = half2float(i, >h2f_tables); } } else { for (i = 0; i < 65536; ++i) { -t.i = half2float(i, s->mantissatable, s->exponenttable, s->offsettable); +t.i = half2float(i, >h2f_tables); /* If negative value we reuse half value */ if (t.f <= 0.0f) {
[FFmpeg-cvslog] avutil: move half-precision float helper to avutil
ffmpeg | branch: master | Timo Rothenpieler | Wed Aug 10 00:42:41 2022 +0200| [b42925264a910e6807e9e7134feaa44ae47bf911] | committer: Timo Rothenpieler avutil: move half-precision float helper to avutil > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b42925264a910e6807e9e7134feaa44ae47bf911 --- libavcodec/exr.c | 2 +- libavcodec/exrenc.c| 2 +- libavcodec/pnmdec.c| 3 ++- libavcodec/pnmenc.c| 2 +- {libavcodec => libavutil}/float2half.h | 6 +++--- {libavcodec => libavutil}/half2float.h | 6 +++--- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 3a6b9c3014..5c6ca9adbf 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -41,6 +41,7 @@ #include "libavutil/avstring.h" #include "libavutil/opt.h" #include "libavutil/color_utils.h" +#include "libavutil/half2float.h" #include "avcodec.h" #include "bytestream.h" @@ -53,7 +54,6 @@ #include "exrdsp.h" #include "get_bits.h" #include "internal.h" -#include "half2float.h" #include "mathops.h" #include "thread.h" diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c index 8cf7827bb6..56c084d483 100644 --- a/libavcodec/exrenc.c +++ b/libavcodec/exrenc.c @@ -31,11 +31,11 @@ #include "libavutil/intreadwrite.h" #include "libavutil/imgutils.h" #include "libavutil/pixdesc.h" +#include "libavutil/float2half.h" #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" #include "encode.h" -#include "float2half.h" enum ExrCompr { EXR_RAW, diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c index 130407df25..9383dc8e60 100644 --- a/libavcodec/pnmdec.c +++ b/libavcodec/pnmdec.c @@ -21,12 +21,13 @@ #include "config_components.h" +#include "libavutil/half2float.h" + #include "avcodec.h" #include "codec_internal.h" #include "internal.h" #include "put_bits.h" #include "pnm.h" -#include "half2float.h" static void samplecpy(uint8_t *dst, const uint8_t *src, int n, int maxval) { diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c index b16c93c88f..7ce534d06e 100644 --- a/libavcodec/pnmenc.c +++ b/libavcodec/pnmenc.c @@ -24,10 +24,10 @@ #include "libavutil/intreadwrite.h" #include "libavutil/imgutils.h" #include "libavutil/pixdesc.h" +#include "libavutil/float2half.h" #include "avcodec.h" #include "codec_internal.h" #include "encode.h" -#include "float2half.h" typedef struct PHMEncContext { uint16_t basetable[512]; diff --git a/libavcodec/float2half.h b/libavutil/float2half.h similarity index 96% rename from libavcodec/float2half.h rename to libavutil/float2half.h index e05125088c..d6aaab8278 100644 --- a/libavcodec/float2half.h +++ b/libavutil/float2half.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_FLOAT2HALF_H -#define AVCODEC_FLOAT2HALF_H +#ifndef AVUTIL_FLOAT2HALF_H +#define AVUTIL_FLOAT2HALF_H #include @@ -64,4 +64,4 @@ static uint16_t float2half(uint32_t f, uint16_t *basetable, uint8_t *shifttable) return h; } -#endif /* AVCODEC_FLOAT2HALF_H */ +#endif /* AVUTIL_FLOAT2HALF_H */ diff --git a/libavcodec/half2float.h b/libavutil/half2float.h similarity index 96% rename from libavcodec/half2float.h rename to libavutil/half2float.h index 7df6747e50..1f6deade07 100644 --- a/libavcodec/half2float.h +++ b/libavutil/half2float.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_HALF2FLOAT_H -#define AVCODEC_HALF2FLOAT_H +#ifndef AVUTIL_HALF2FLOAT_H +#define AVUTIL_HALF2FLOAT_H #include @@ -71,4 +71,4 @@ static uint32_t half2float(uint16_t h, const uint32_t *mantissatable, const uint return f; } -#endif /* AVCODEC_HALF2FLOAT_H */ +#endif /* AVUTIL_HALF2FLOAT_H */ ___ 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] doc/APIchanges: add missing rgbaf16 pixfmt entry
ffmpeg | branch: master | Timo Rothenpieler | Tue Aug 16 12:31:03 2022 +0200| [317f5252c09d6deee7025907eea2dfe44935c891] | committer: Timo Rothenpieler doc/APIchanges: add missing rgbaf16 pixfmt entry > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=317f5252c09d6deee7025907eea2dfe44935c891 --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index a196bc40d4..b3ba07ee7c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-08-07 - e95b08a7dd - lavu 57.33.101 - pixfmt.h + Add AV_PIX_FMT_RGBAF16{BE,LE} pixel formats. + 2022-08-xx - xx - lavu 57.33.100 - hwcontext_qsv.h Add loader field to AVQSVDeviceContext ___ 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] avfilter/vsrc_ddagrab: add options for more control over output format fallback
ffmpeg | branch: master | Timo Rothenpieler | Sun Aug 7 23:14:09 2022 +0200| [c469c3c3b18fbacd6ee0165573034d2a0408b83f] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: add options for more control over output format fallback > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c469c3c3b18fbacd6ee0165573034d2a0408b83f --- libavfilter/version.h | 2 +- libavfilter/vsrc_ddagrab.c | 12 +--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libavfilter/version.h b/libavfilter/version.h index fa67606495..f3c1964cac 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFILTER_VERSION_MINOR 46 -#define LIBAVFILTER_VERSION_MICRO 102 +#define LIBAVFILTER_VERSION_MICRO 103 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 252505b96d..00c72187ea 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -98,6 +98,8 @@ typedef struct DdagrabContext { intoffset_x; intoffset_y; intout_fmt; +intallow_fallback; +intforce_fmt; } DdagrabContext; #define OFFSET(x) offsetof(DdagrabContext, x) @@ -117,6 +119,10 @@ static const AVOption ddagrab_options[] = { { "x2bgr10","only output 10 Bit X2BGR10",0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" }, { "16bit", "only output default 16 Bit format", 0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R16G16B16A16_FLOAT },0, INT_MAX, FLAGS, "output_fmt" }, { "rgbaf16","only output 16 Bit RGBAF16",0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R16G16B16A16_FLOAT },0, INT_MAX, FLAGS, "output_fmt" }, +{ "allow_fallback", "don't error on fallback to default 8 Bit format", + OFFSET(allow_fallback), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, FLAGS }, +{ "force_fmt", "exclude BGRA from format list (experimental, discouraged by Microsoft)", + OFFSET(force_fmt), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, FLAGS }, { NULL } }; @@ -226,7 +232,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) } else if (dda->out_fmt) { formats[0] = dda->out_fmt; formats[1] = DXGI_FORMAT_B8G8R8A8_UNORM; -nb_formats = 2; +nb_formats = dda->force_fmt ? 1 : 2; } IDXGIOutput_Release(dxgi_output); @@ -262,7 +268,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) #else { #endif -if (dda->out_fmt && dda->out_fmt != DXGI_FORMAT_B8G8R8A8_UNORM) { +if (dda->out_fmt && dda->out_fmt != DXGI_FORMAT_B8G8R8A8_UNORM && (!dda->allow_fallback || dda->force_fmt)) { av_log(avctx, AV_LOG_ERROR, "Only 8 bit output supported with legacy API\n"); return AVERROR(ENOTSUP); } @@ -733,7 +739,7 @@ static int ddagrab_config_props(AVFilterLink *outlink) if (ret < 0) return ret; -if (dda->out_fmt && dda->raw_format != dda->out_fmt) { +if (dda->out_fmt && dda->raw_format != dda->out_fmt && (!dda->allow_fallback || dda->force_fmt)) { av_log(avctx, AV_LOG_ERROR, "Requested output format unavailable.\n"); return AVERROR(ENOTSUP); } ___ 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] avfilter/vsrc_ddagrab: add rgbaf16 output support
ffmpeg | branch: master | Timo Rothenpieler | Sun Aug 7 21:50:12 2022 +0200| [6a574e39016325ec601da49d3f51c14135874da6] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: add rgbaf16 output support > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a574e39016325ec601da49d3f51c14135874da6 --- libavfilter/version.h | 2 +- libavfilter/vsrc_ddagrab.c | 13 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libavfilter/version.h b/libavfilter/version.h index 19a009c110..fa67606495 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFILTER_VERSION_MINOR 46 -#define LIBAVFILTER_VERSION_MICRO 101 +#define LIBAVFILTER_VERSION_MICRO 102 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index ce36716281..252505b96d 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -115,6 +115,8 @@ static const AVOption ddagrab_options[] = { { "bgra", "only output 8 Bit BGRA",0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },0, INT_MAX, FLAGS, "output_fmt" }, { "10bit", "only output default 10 Bit format", 0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" }, { "x2bgr10","only output 10 Bit X2BGR10",0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" }, +{ "16bit", "only output default 16 Bit format", 0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R16G16B16A16_FLOAT },0, INT_MAX, FLAGS, "output_fmt" }, +{ "rgbaf16","only output 16 Bit RGBAF16",0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R16G16B16A16_FLOAT },0, INT_MAX, FLAGS, "output_fmt" }, { NULL } }; @@ -212,6 +214,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) if (set_thread_dpi && SUCCEEDED(hr)) { DPI_AWARENESS_CONTEXT prev_dpi_ctx; DXGI_FORMAT formats[] = { +DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM }; @@ -665,6 +668,10 @@ static av_cold int init_hwframes_ctx(AVFilterContext *avctx) av_log(avctx, AV_LOG_VERBOSE, "Probed 10 bit RGB frame format\n"); dda->frames_ctx->sw_format = AV_PIX_FMT_X2BGR10; break; +case DXGI_FORMAT_R16G16B16A16_FLOAT: +av_log(avctx, AV_LOG_VERBOSE, "Probed 16 bit float RGB frame format\n"); +dda->frames_ctx->sw_format = AV_PIX_FMT_RGBAF16; +break; default: av_log(avctx, AV_LOG_ERROR, "Unexpected texture output format!\n"); return AVERROR_BUG; @@ -990,6 +997,12 @@ static int ddagrab_request_frame(AVFilterLink *outlink) frame->color_primaries = AVCOL_PRI_BT709; frame->color_trc = AVCOL_TRC_IEC61966_2_1; frame->colorspace = AVCOL_SPC_RGB; +} else if(desc.Format == DXGI_FORMAT_R16G16B16A16_FLOAT) { +// According to MSDN, all floating point formats contain sRGB image data with linear 1.0 gamma. +frame->color_range = AVCOL_RANGE_JPEG; +frame->color_primaries = AVCOL_PRI_BT709; +frame->color_trc = AVCOL_TRC_LINEAR; +frame->colorspace = AVCOL_SPC_RGB; } else { ret = AVERROR_BUG; goto fail; ___ 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] avutil/hwcontext_d3d11va: add support for rgbaf16 pixel format
ffmpeg | branch: master | Timo Rothenpieler | Sun Aug 7 22:16:28 2022 +0200| [dd94a03468634580d3cc3146c7a85dbcf02d1ef8] | committer: Timo Rothenpieler avutil/hwcontext_d3d11va: add support for rgbaf16 pixel format > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd94a03468634580d3cc3146c7a85dbcf02d1ef8 --- libavutil/hwcontext_d3d11va.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 27c0c80413..363ec6a47d 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -88,6 +88,7 @@ static const struct { { DXGI_FORMAT_P010, AV_PIX_FMT_P010 }, { DXGI_FORMAT_B8G8R8A8_UNORM,AV_PIX_FMT_BGRA }, { DXGI_FORMAT_R10G10B10A2_UNORM, AV_PIX_FMT_X2BGR10 }, +{ DXGI_FORMAT_R16G16B16A16_FLOAT, AV_PIX_FMT_RGBAF16 }, // Special opaque formats. The pix_fmt is merely a place holder, as the // opaque format cannot be accessed directly. { DXGI_FORMAT_420_OPAQUE, AV_PIX_FMT_YUV420P }, ___ 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] lavu/pixfmt: add packed RGBA float16 format
ffmpeg | branch: master | Timo Rothenpieler | Sun Aug 7 21:03:59 2022 +0200| [e95b08a7dd85dc24daf3d77b730ad04ae24faaed] | committer: Timo Rothenpieler lavu/pixfmt: add packed RGBA float16 format This is the default format of the Windows compositor and what DXGI Desktop Duplication will give you for any kind of HDR output. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e95b08a7dd85dc24daf3d77b730ad04ae24faaed --- libavutil/pixdesc.c | 28 libavutil/pixfmt.h | 5 + libavutil/version.h | 2 +- tests/ref/fate/imgutils | 2 ++ tests/ref/fate/sws-pixdesc-query | 13 + 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index e078fd5320..f7558ff8b9 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2504,6 +2504,34 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_ALPHA, }, +[AV_PIX_FMT_RGBAF16BE] = { +.name = "rgbaf16be", +.nb_components = 4, +.log2_chroma_w = 0, +.log2_chroma_h = 0, +.comp = { +{ 0, 8, 0, 0, 16 }, /* R */ +{ 0, 8, 2, 0, 16 }, /* G */ +{ 0, 8, 4, 0, 16 }, /* B */ +{ 0, 8, 6, 0, 16 }, /* A */ +}, +.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | + AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_FLOAT, +}, +[AV_PIX_FMT_RGBAF16LE] = { +.name = "rgbaf16le", +.nb_components = 4, +.log2_chroma_w = 0, +.log2_chroma_h = 0, +.comp = { +{ 0, 8, 0, 0, 16 }, /* R */ +{ 0, 8, 2, 0, 16 }, /* G */ +{ 0, 8, 4, 0, 16 }, /* B */ +{ 0, 8, 6, 0, 16 }, /* A */ +}, +.flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA | + AV_PIX_FMT_FLAG_FLOAT, +}, }; static const char * const color_range_names[] = { diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 9d1fdaf82d..86c9bdefeb 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -369,6 +369,9 @@ enum AVPixelFormat { AV_PIX_FMT_VUYA,///< packed VUYA 4:4:4, 32bpp, VUYAVUYA... +AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian +AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; @@ -466,6 +469,8 @@ enum AVPixelFormat { #define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE) #define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) +#define AV_PIX_FMT_RGBAF16AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE) + /** * Chromaticity coordinates of the source primaries. * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. diff --git a/libavutil/version.h b/libavutil/version.h index f0a8b5c098..05661922b3 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -80,7 +80,7 @@ #define LIBAVUTIL_VERSION_MAJOR 57 #define LIBAVUTIL_VERSION_MINOR 33 -#define LIBAVUTIL_VERSION_MICRO 100 +#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index 4ec66febb8..01c9877de5 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -247,3 +247,5 @@ p216le planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 6144 p416be planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 p416le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 vuyaplanes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +rgbaf16be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +rgbaf16le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index bd0f1fcb82..f79d99e513 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -21,6 +21,8 @@ is16BPS: rgb48le rgba64be rgba64le + rgbaf16be + rgbaf16le ya16be ya16le yuv420p16be @@ -157,6 +159,7 @@ isBE: rgb555be
[FFmpeg-cvslog] compat: add msvc windres wrapper
ffmpeg | branch: master | Timo Rothenpieler | Sun Aug 7 16:31:51 2022 +0200| [9ca3b8b7cddcd44802cfb8377210a5ccf93184b6] | committer: Timo Rothenpieler compat: add msvc windres wrapper This is by no means a complete wrapper. It's only designed to fit the usecase ffmpegs build system has. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ca3b8b7cddcd44802cfb8377210a5ccf93184b6 --- compat/windows/mswindres | 32 configure| 2 ++ 2 files changed, 34 insertions(+) diff --git a/compat/windows/mswindres b/compat/windows/mswindres new file mode 100755 index 00..450525a33e --- /dev/null +++ b/compat/windows/mswindres @@ -0,0 +1,32 @@ +#!/bin/sh + +if [ "$1" = "--version" ]; then +rc.exe /? +exit $? +fi + +if [ $# -lt 2 ]; then +echo "Usage: mswindres [-I/include/path ...] [-DSOME_DEFINE ...] [-o output.o] input.rc [output.o]" >&2 +exit 0 +fi + +EXTRA_OPTS="/nologo" + +while [ $# -gt 2 ]; do +case $1 in +-D*) EXTRA_OPTS="$EXTRA_OPTS /d$(echo $1 | sed -e "s/^..//" -e "s/ / /g")" ;; +-I*) EXTRA_OPTS="$EXTRA_OPTS /i$(echo $1 | sed -e "s/^..//" -e "s/ / /g")" ;; +-o) OPT_OUT="$2"; shift ;; +esac +shift +done + +IN="$1" +if [ -z "$OPT_OUT" ]; then +OUT="$2" +else +OUT="$OPT_OUT" +fi + +eval set -- $EXTRA_OPTS +rc.exe "$@" /fo "$OUT" "$IN" diff --git a/configure b/configure index d5656daf7f..fe94941a03 100755 --- a/configure +++ b/configure @@ -4371,6 +4371,7 @@ case "$toolchain" in die "Unsupported MSVC version (2013 or newer required)" fi ld_default="$source_path/compat/windows/mslink" +windres_default="$source_path/compat/windows/mswindres" nm_default="dumpbin.exe -symbols" ar_default="lib.exe" case "${arch:-$arch_default}" in @@ -5621,6 +5622,7 @@ case $target_os in # Cannot build both shared and static libs with MSVC or icl. disable static fi +! enabled small && test_cmd $windres --version && enable gnu_windres enabled x86_32 && check_ldflags -LARGEADDRESSAWARE shlibdir_default="$bindir_default" SLIBPREF="" ___ 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: always enable gnu_windres if available
ffmpeg | branch: master | Timo Rothenpieler | Sun Aug 7 15:26:06 2022 +0200| [b77fff47d0d60434a48b6877ed72a71ebf53858a] | committer: Timo Rothenpieler configure: always enable gnu_windres if available Use the appropiate Makefile variable to ensure the resource file is only built into shared libraries instead. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b77fff47d0d60434a48b6877ed72a71ebf53858a --- configure | 4 ++-- libavcodec/Makefile| 2 +- libavdevice/Makefile | 2 +- libavfilter/Makefile | 2 +- libavformat/Makefile | 2 +- libavutil/Makefile | 2 +- libpostproc/Makefile | 2 +- libswresample/Makefile | 2 +- libswscale/Makefile| 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 090ccf21a7..d5656daf7f 100755 --- a/configure +++ b/configure @@ -5571,7 +5571,7 @@ case $target_os in # Cannot build both shared and static libs when using dllimport. disable static fi -enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres +! enabled small && test_cmd $windres --version && enable gnu_windres enabled x86_32 && check_ldflags -Wl,--large-address-aware shlibdir_default="$bindir_default" SLIBPREF="" @@ -5650,7 +5650,7 @@ case $target_os in SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a' enabled x86_64 && objformat="win64" || objformat="win32" enable dos_paths -enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres +! enabled small && test_cmd $windres --version && enable gnu_windres add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 ;; *-dos|freedos|opendos) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 83901bb52b..029f1bad3d 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1218,7 +1218,7 @@ OBJS-$(HAVE_THREADS) += pthread.o pthread_slice.o pthread_fram OBJS-$(CONFIG_FRAME_THREAD_ENCODER)+= frame_thread_encoder.o # Windows resource file -SLIBOBJS-$(HAVE_GNU_WINDRES) += avcodecres.o +SHLIBOBJS-$(HAVE_GNU_WINDRES) += avcodecres.o SKIPHEADERS+= %_tablegen.h \ %_tables.h\ diff --git a/libavdevice/Makefile b/libavdevice/Makefile index bbe2f69dcc..8a62822b69 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -59,7 +59,7 @@ OBJS-$(CONFIG_LIBDC1394_INDEV) += libdc1394.o SHLIBOBJS-$(CONFIG_DECKLINK_INDEV) += reverse.o # Windows resource file -SLIBOBJS-$(HAVE_GNU_WINDRES) += avdeviceres.o +SHLIBOBJS-$(HAVE_GNU_WINDRES)+= avdeviceres.o SKIPHEADERS += decklink_common.h SKIPHEADERS-$(CONFIG_DECKLINK) += decklink_enc.h decklink_dec.h \ diff --git a/libavfilter/Makefile b/libavfilter/Makefile index c026f8f809..3187f99a50 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -605,7 +605,7 @@ OBJS-$(CONFIG_MOVIE_FILTER) += src_movie.o SHLIBOBJS+= log2_tab.o # Windows resource file -SLIBOBJS-$(HAVE_GNU_WINDRES) += avfilterres.o +SHLIBOBJS-$(HAVE_GNU_WINDRES)+= avfilterres.o SKIPHEADERS-$(CONFIG_LCMS2) += fflcms2.h SKIPHEADERS-$(CONFIG_LIBVIDSTAB) += vidstabutils.h diff --git a/libavformat/Makefile b/libavformat/Makefile index e420384355..f67a99f839 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -714,7 +714,7 @@ SHLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o OBJS-$(CONFIG_IEC61883_INDEV)+= dv.o # Windows resource file -SLIBOBJS-$(HAVE_GNU_WINDRES) += avformatres.o +SHLIBOBJS-$(HAVE_GNU_WINDRES)+= avformatres.o SKIPHEADERS-$(CONFIG_IMF_DEMUXER)+= imf.h SKIPHEADERS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpdh.h diff --git a/libavutil/Makefile b/libavutil/Makefile index 9435a0bfb0..3d9c07aea8 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -201,7 +201,7 @@ OBJS-$(!CONFIG_VULKAN) += hwcontext_stub.o OBJS += $(COMPAT_OBJS:%=../compat/%) # Windows resource file -SLIBOBJS-$(HAVE_GNU_WINDRES)+= avutilres.o +SHLIBOBJS-$(HAVE_GNU_WINDRES) += avutilres.o SKIPHEADERS+= objc.h SKIPHEADERS-$(HAVE_CUDA_H) += hwcontext_cuda.h diff --git a/libpostproc/Makefile b/libpostproc/Makefile index d3f3b27f35..77c2b6b016 100644 --- a/libpostproc/Makefile +++ b/libpostproc/Makefile @@ -10,4 +10,4 @@ OBJS = postprocess.o \ version.o \ # Windows resourc
[FFmpeg-cvslog] fftools: add DPI awareness manifest
ffmpeg | branch: master | Timo Rothenpieler | Sun Aug 7 15:28:24 2022 +0200| [f85e0673c3a82acd2b267e934c6db3c9da154d86] | committer: Timo Rothenpieler fftools: add DPI awareness manifest Some filters, like gdigrab, rely on this to be set to see and report proper dimensions. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f85e0673c3a82acd2b267e934c6db3c9da154d86 --- fftools/Makefile | 3 +++ fftools/fftools.manifest | 9 + fftools/fftoolsres.rc| 2 ++ 3 files changed, 14 insertions(+) diff --git a/fftools/Makefile b/fftools/Makefile index 5907f5c57e..ff70b1170d 100644 --- a/fftools/Makefile +++ b/fftools/Makefile @@ -21,6 +21,9 @@ OBJS-ffmpeg += \ define DOFFTOOL OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes) +ifdef HAVE_GNU_WINDRES +OBJS-$(1) += fftools/fftoolsres.o +endif $(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1)) $$(OBJS-$(1)): | fftools $$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1)) diff --git a/fftools/fftools.manifest b/fftools/fftools.manifest new file mode 100644 index 00..f2708ecb13 --- /dev/null +++ b/fftools/fftools.manifest @@ -0,0 +1,9 @@ + + + + + http://schemas.microsoft.com/SMI/2005/WindowsSettings;>true + http://schemas.microsoft.com/SMI/2016/WindowsSettings;>PerMonitorV2 + + + diff --git a/fftools/fftoolsres.rc b/fftools/fftoolsres.rc new file mode 100644 index 00..0b8b7c86cb --- /dev/null +++ b/fftools/fftoolsres.rc @@ -0,0 +1,2 @@ +#include +1 RT_MANIFEST fftools.manifest ___ 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/nvenc: hardcode color characteristics for internal RGB2YUV conversion
ffmpeg | branch: master | Timo Rothenpieler | Sat Aug 6 20:58:48 2022 +0200| [b71069879010426ef8d7dce614086f8fb90eb0f3] | committer: Timo Rothenpieler avcodec/nvenc: hardcode color characteristics for internal RGB2YUV conversion nvenc does not appear to use these values as inputs for its built in RGB to YUV conversion, but instead sets them on the output as-is. Testing indicates the input is expected to be sRGB, with the output ending up as limited range bt.470. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b71069879010426ef8d7dce614086f8fb90eb0f3 --- libavcodec/nvenc.c | 38 -- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index e19378736f..11bd21f365 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1096,11 +1096,20 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) NV_ENC_CONFIG_H264 *h264 = >encodeCodecConfig.h264Config; NV_ENC_CONFIG_H264_VUI_PARAMETERS *vui = >h264VUIParameters; -vui->colourMatrix = IS_GBRP(ctx->data_pix_fmt) ? AVCOL_SPC_RGB : avctx->colorspace; -vui->colourPrimaries = avctx->color_primaries; -vui->transferCharacteristics = avctx->color_trc; -vui->videoFullRangeFlag = (avctx->color_range == AVCOL_RANGE_JPEG -|| ctx->data_pix_fmt == AV_PIX_FMT_YUVJ420P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ422P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ444P); +const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(ctx->data_pix_fmt); + +if ((pixdesc->flags & AV_PIX_FMT_FLAG_RGB) && !IS_GBRP(ctx->data_pix_fmt)) { +vui->colourMatrix = AVCOL_SPC_BT470BG; +vui->colourPrimaries = avctx->color_primaries; +vui->transferCharacteristics = avctx->color_trc; +vui->videoFullRangeFlag = 0; +} else { +vui->colourMatrix = IS_GBRP(ctx->data_pix_fmt) ? AVCOL_SPC_RGB : avctx->colorspace; +vui->colourPrimaries = avctx->color_primaries; +vui->transferCharacteristics = avctx->color_trc; +vui->videoFullRangeFlag = (avctx->color_range == AVCOL_RANGE_JPEG +|| ctx->data_pix_fmt == AV_PIX_FMT_YUVJ420P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ422P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ444P); +} vui->colourDescriptionPresentFlag = (vui->colourMatrix != 2 || vui->colourPrimaries != 2 || vui->transferCharacteristics != 2); @@ -1208,11 +1217,20 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) NV_ENC_CONFIG_HEVC *hevc = >encodeCodecConfig.hevcConfig; NV_ENC_CONFIG_HEVC_VUI_PARAMETERS *vui = >hevcVUIParameters; -vui->colourMatrix = IS_GBRP(ctx->data_pix_fmt) ? AVCOL_SPC_RGB : avctx->colorspace; -vui->colourPrimaries = avctx->color_primaries; -vui->transferCharacteristics = avctx->color_trc; -vui->videoFullRangeFlag = (avctx->color_range == AVCOL_RANGE_JPEG -|| ctx->data_pix_fmt == AV_PIX_FMT_YUVJ420P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ422P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ444P); +const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(ctx->data_pix_fmt); + +if ((pixdesc->flags & AV_PIX_FMT_FLAG_RGB) && !IS_GBRP(ctx->data_pix_fmt)) { +vui->colourMatrix = AVCOL_SPC_BT470BG; +vui->colourPrimaries = avctx->color_primaries; +vui->transferCharacteristics = avctx->color_trc; +vui->videoFullRangeFlag = 0; +} else { +vui->colourMatrix = IS_GBRP(ctx->data_pix_fmt) ? AVCOL_SPC_RGB : avctx->colorspace; +vui->colourPrimaries = avctx->color_primaries; +vui->transferCharacteristics = avctx->color_trc; +vui->videoFullRangeFlag = (avctx->color_range == AVCOL_RANGE_JPEG +|| ctx->data_pix_fmt == AV_PIX_FMT_YUVJ420P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ422P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ444P); +} vui->colourDescriptionPresentFlag = (vui->colourMatrix != 2 || vui->colourPrimaries != 2 || vui->transferCharacteristics != 2); ___ 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] avfilter/vsrc_ddagrab: set sRGB color information on output frames
ffmpeg | branch: master | Timo Rothenpieler | Sat Aug 6 20:06:50 2022 +0200| [611f8435341bf928e8b129a16657be5792571780] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: set sRGB color information on output frames According to MSDN, all integer pixel formats contains sRGB compliant pixel data, so set the color information on our output frames accordingly. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=611f8435341bf928e8b129a16657be5792571780 --- libavfilter/vsrc_ddagrab.c | 12 1 file changed, 12 insertions(+) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 5300d46fc1..ce36716281 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -983,6 +983,18 @@ static int ddagrab_request_frame(AVFilterLink *outlink) frame->sample_aspect_ratio = (AVRational){1, 1}; +if (desc.Format == DXGI_FORMAT_B8G8R8A8_UNORM || +desc.Format == DXGI_FORMAT_R10G10B10A2_UNORM) { +// According to MSDN, all integer formats contain sRGB image data +frame->color_range = AVCOL_RANGE_JPEG; +frame->color_primaries = AVCOL_PRI_BT709; +frame->color_trc = AVCOL_TRC_IEC61966_2_1; +frame->colorspace = AVCOL_SPC_RGB; +} else { +ret = AVERROR_BUG; +goto fail; +} + av_frame_unref(dda->last_frame); ret = av_frame_ref(dda->last_frame, frame); if (ret < 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] avfilter/vsrc_ddagrab: make output format user configurable
ffmpeg | branch: master | Timo Rothenpieler | Sat Aug 6 14:54:58 2022 +0200| [38595ebe3b1303d85ab83f2fd0d0899af55abb00] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: make output format user configurable > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38595ebe3b1303d85ab83f2fd0d0899af55abb00 --- doc/filters.texi | 16 libavfilter/vsrc_ddagrab.c | 29 - 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 4a5412c91d..dd7ee1394a 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -26531,6 +26531,22 @@ Horizontal offset of the captured video. @item offset_y Vertical offset of the captured video. +@item output_fmt +Desired filter output format. +Defaults to 8 Bit BGRA. + +It accepts the following values: +@table @samp +@item auto +Passes all supported output formats to DDA and returns what DDA decides to use. +@item 8bit +@item bgra +8 Bit formats always work, and DDA will convert to them if neccesary. +@item 10bit +@item x2bgr10 +Filter initialization will fail if 10 bit format is requested but unavailable. +@end table + @end table @subsection Examples diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 2f33a40f6f..5300d46fc1 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -97,6 +97,7 @@ typedef struct DdagrabContext { intheight; intoffset_x; intoffset_y; +intout_fmt; } DdagrabContext; #define OFFSET(x) offsetof(DdagrabContext, x) @@ -108,6 +109,12 @@ static const AVOption ddagrab_options[] = { { "video_size", "set video frame size",OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, FLAGS }, { "offset_x", "capture area x offset", OFFSET(offset_x), AV_OPT_TYPE_INT,{ .i64 = 0}, INT_MIN, INT_MAX, FLAGS }, { "offset_y", "capture area y offset", OFFSET(offset_y), AV_OPT_TYPE_INT,{ .i64 = 0}, INT_MIN, INT_MAX, FLAGS }, +{ "output_fmt", "desired output format", OFFSET(out_fmt), AV_OPT_TYPE_INT,{ .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },0, INT_MAX, FLAGS, "output_fmt" }, +{ "auto", "let dda pick its preferred format", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, INT_MAX, FLAGS, "output_fmt" }, +{ "8bit", "only output default 8 Bit format", 0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },0, INT_MAX, FLAGS, "output_fmt" }, +{ "bgra", "only output 8 Bit BGRA",0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },0, INT_MAX, FLAGS, "output_fmt" }, +{ "10bit", "only output default 10 Bit format", 0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" }, +{ "x2bgr10","only output 10 Bit X2BGR10",0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" }, { NULL } }; @@ -208,6 +215,16 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM }; +int nb_formats = FF_ARRAY_ELEMS(formats); + +if(dda->out_fmt == DXGI_FORMAT_B8G8R8A8_UNORM) { +formats[0] = DXGI_FORMAT_B8G8R8A8_UNORM; +nb_formats = 1; +} else if (dda->out_fmt) { +formats[0] = dda->out_fmt; +formats[1] = DXGI_FORMAT_B8G8R8A8_UNORM; +nb_formats = 2; +} IDXGIOutput_Release(dxgi_output); dxgi_output = NULL; @@ -219,7 +236,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) hr = IDXGIOutput5_DuplicateOutput1(dxgi_output5, (IUnknown*)dda->device_hwctx->device, 0, -FF_ARRAY_ELEMS(formats), +nb_formats, formats, >dxgi_outdupl); IDXGIOutput5_Release(dxgi_output5); @@ -242,6 +259,11 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) #else { #endif +if (dda->out_fmt && dda->out_fmt != DXGI_FORMAT_B8G8R8A8_UNORM) { +av_log(avctx, AV_LOG_ERROR, "Only 8 bit output supported with legacy API\n"); +return AVERROR(ENOTSUP); +} + hr = IDXGIOutput_QueryInterface(dxgi_output, _IDXGIOutput1, (void**)_output1); IDXGIOutput_Release(dxgi_output); dxgi_output = NULL; @@ -704,6 +726,11 @@ static int ddagrab_config_props(AVFilterLink *outlink) if (ret < 0)
[FFmpeg-cvslog] avfilter/vsrc_ddagrab: move most of init to config_props
ffmpeg | branch: master | Timo Rothenpieler | Fri Aug 5 14:27:53 2022 +0200| [cbb53bfbd803f6407f6e19211b2cf47dc9711408] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: move most of init to config_props Most notably, the input hw_device_ctx is not set at init time, so using it was impossible. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cbb53bfbd803f6407f6e19211b2cf47dc9711408 --- libavfilter/vsrc_ddagrab.c | 80 +- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 0543e889ad..2f33a40f6f 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -389,56 +389,15 @@ static av_cold int init_render_resources(AVFilterContext *avctx) static av_cold int ddagrab_init(AVFilterContext *avctx) { DdagrabContext *dda = avctx->priv; -int ret = 0; - -if (avctx->hw_device_ctx) { -dda->device_ctx = (AVHWDeviceContext*)avctx->hw_device_ctx->data; - -if (dda->device_ctx->type != AV_HWDEVICE_TYPE_D3D11VA) { -av_log(avctx, AV_LOG_ERROR, "Non-D3D11VA input hw_device_ctx\n"); -return AVERROR(EINVAL); -} - -dda->device_ref = av_buffer_ref(avctx->hw_device_ctx); -if (!dda->device_ref) -return AVERROR(ENOMEM); - -av_log(avctx, AV_LOG_VERBOSE, "Using provided hw_device_ctx\n"); -} else { -ret = av_hwdevice_ctx_create(>device_ref, AV_HWDEVICE_TYPE_D3D11VA, NULL, NULL, 0); -if (ret < 0) { -av_log(avctx, AV_LOG_ERROR, "Failed to create D3D11VA device.\n"); -return ret; -} - -dda->device_ctx = (AVHWDeviceContext*)dda->device_ref->data; - -av_log(avctx, AV_LOG_VERBOSE, "Created internal hw_device_ctx\n"); -} - -dda->device_hwctx = (AVD3D11VADeviceContext*)dda->device_ctx->hwctx; - -ret = init_dxgi_dda(avctx); -if (ret < 0) -goto fail; - -dda->time_base = av_inv_q(dda->framerate); -dda->time_frame = av_gettime_relative() / av_q2d(dda->time_base); -dda->time_timeout = av_rescale_q(1, dda->time_base, (AVRational) { 1, 1000 }) / 2; dda->last_frame = av_frame_alloc(); -if (!dda->last_frame) { -ret = AVERROR(ENOMEM); -goto fail; -} +if (!dda->last_frame) +return AVERROR(ENOMEM); dda->mouse_x = -1; dda->mouse_y = -1; return 0; -fail: -ddagrab_uninit(avctx); -return ret; } static int create_d3d11_pointer_tex(AVFilterContext *avctx, @@ -710,6 +669,37 @@ static int ddagrab_config_props(AVFilterLink *outlink) DdagrabContext *dda = avctx->priv; int ret; +if (avctx->hw_device_ctx) { +dda->device_ctx = (AVHWDeviceContext*)avctx->hw_device_ctx->data; + +if (dda->device_ctx->type != AV_HWDEVICE_TYPE_D3D11VA) { +av_log(avctx, AV_LOG_ERROR, "Non-D3D11VA input hw_device_ctx\n"); +return AVERROR(EINVAL); +} + +dda->device_ref = av_buffer_ref(avctx->hw_device_ctx); +if (!dda->device_ref) +return AVERROR(ENOMEM); + +av_log(avctx, AV_LOG_VERBOSE, "Using provided hw_device_ctx\n"); +} else { +ret = av_hwdevice_ctx_create(>device_ref, AV_HWDEVICE_TYPE_D3D11VA, NULL, NULL, 0); +if (ret < 0) { +av_log(avctx, AV_LOG_ERROR, "Failed to create D3D11VA device.\n"); +return ret; +} + +dda->device_ctx = (AVHWDeviceContext*)dda->device_ref->data; + +av_log(avctx, AV_LOG_VERBOSE, "Created internal hw_device_ctx\n"); +} + +dda->device_hwctx = (AVD3D11VADeviceContext*)dda->device_ctx->hwctx; + +ret = init_dxgi_dda(avctx); +if (ret < 0) +return ret; + ret = probe_output_format(avctx); if (ret < 0) return ret; @@ -717,6 +707,10 @@ static int ddagrab_config_props(AVFilterLink *outlink) dda->width -= FFMAX(dda->width - dda->raw_width + dda->offset_x, 0); dda->height -= FFMAX(dda->height - dda->raw_height + dda->offset_y, 0); +dda->time_base = av_inv_q(dda->framerate); +dda->time_frame = av_gettime_relative() / av_q2d(dda->time_base); +dda->time_timeout = av_rescale_q(1, dda->time_base, (AVRational) { 1, 1000 }) / 2; + if (dda->draw_mouse) { ret = init_render_resources(avctx); if (ret < 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] avfilter/vsrc_ddagrab: fix mouse cursor render init
ffmpeg | branch: master | Timo Rothenpieler | Fri Aug 5 14:02:44 2022 +0200| [fbf87a46ab97cf487141002d660bf4ed9379e334] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: fix mouse cursor render init > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fbf87a46ab97cf487141002d660bf4ed9379e334 --- libavfilter/vsrc_ddagrab.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 98daec1d04..0543e889ad 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -435,12 +435,6 @@ static av_cold int ddagrab_init(AVFilterContext *avctx) dda->mouse_x = -1; dda->mouse_y = -1; -if (dda->draw_mouse) { -ret = init_render_resources(avctx); -if (ret < 0) -goto fail; -} - return 0; fail: ddagrab_uninit(avctx); @@ -723,6 +717,12 @@ static int ddagrab_config_props(AVFilterLink *outlink) dda->width -= FFMAX(dda->width - dda->raw_width + dda->offset_x, 0); dda->height -= FFMAX(dda->height - dda->raw_height + dda->offset_y, 0); +if (dda->draw_mouse) { +ret = init_render_resources(avctx); +if (ret < 0) +return ret; +} + ret = init_hwframes_ctx(avctx); 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] avfilter/vsrc_ddagrab: check for existence of DPI_AWARENESS_CONTEXT
ffmpeg | branch: master | Timo Rothenpieler | Tue Jul 19 13:44:58 2022 +0200| [926f355aff8fdf0a077d948e961f79d2c5daf58e] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: check for existence of DPI_AWARENESS_CONTEXT Apparently some (broken?) Windows SDK versions define IDXGIOutput5 but not DPI_AWARENESS_CONTEXT. So we need to explicitly check for its existence. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=926f355aff8fdf0a077d948e961f79d2c5daf58e --- configure | 2 ++ libavfilter/vsrc_ddagrab.c | 8 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 91444cdc53..4888792015 100755 --- a/configure +++ b/configure @@ -2352,6 +2352,7 @@ TOOLCHAIN_FEATURES=" " TYPES_LIST=" +DPI_AWARENESS_CONTEXT IDXGIOutput5 kCMVideoCodecType_HEVC kCMVideoCodecType_HEVCWithAlpha @@ -6398,6 +6399,7 @@ check_type "windows.h dxgi1_2.h" "IDXGIOutput1" check_type "windows.h dxgi1_5.h" "IDXGIOutput5" check_type "windows.h d3d11.h" "ID3D11VideoDecoder" check_type "windows.h d3d11.h" "ID3D11VideoContext" +check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602 check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 5668eda051..98daec1d04 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -18,9 +18,9 @@ #include "config.h" -#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0A00 #undef _WIN32_WINNT -#define _WIN32_WINNT 0x0602 +#define _WIN32_WINNT 0x0A00 #endif #define WIN32_LEAN_AND_MEAN @@ -151,7 +151,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) IDXGIAdapter *dxgi_adapter = NULL; IDXGIOutput *dxgi_output = NULL; IDXGIOutput1 *dxgi_output1 = NULL; -#if HAVE_IDXGIOUTPUT5 +#if HAVE_IDXGIOUTPUT5 && HAVE_DPI_AWARENESS_CONTEXT IDXGIOutput5 *dxgi_output5 = NULL; typedef DPI_AWARENESS_CONTEXT (*set_thread_dpi_t)(DPI_AWARENESS_CONTEXT); @@ -190,7 +190,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) return AVERROR_EXTERNAL; } -#if HAVE_IDXGIOUTPUT5 +#if HAVE_IDXGIOUTPUT5 && HAVE_DPI_AWARENESS_CONTEXT user32_module = dlopen("user32.dll", 0); if (!user32_module) { av_log(avctx, AV_LOG_ERROR, "Failed loading user32.dll\n"); ___ 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] avfilter/vsrc_ddagrab: dynamically load SetThreadDpiAwarenessContext
ffmpeg | branch: master | Timo Rothenpieler | Tue Jul 19 00:51:18 2022 +0200| [61c151a09892d7f70c51c18110a1edf8796d7568] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: dynamically load SetThreadDpiAwarenessContext It's a Windows 10 only function, and its presence alone prevents the binary from loading on older Windows versions. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61c151a09892d7f70c51c18110a1edf8796d7568 --- configure | 2 -- libavfilter/vsrc_ddagrab.c | 41 + 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 18d9b61a99..91444cdc53 100755 --- a/configure +++ b/configure @@ -2309,7 +2309,6 @@ SYSTEM_FUNCS=" SetDllDirectory setmode setrlimit -SetThreadDpiAwarenessContext Sleep strerror_r sysconf @@ -6401,7 +6400,6 @@ check_type "windows.h d3d11.h" "ID3D11VideoDecoder" check_type "windows.h d3d11.h" "ID3D11VideoContext" check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602 check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat -check_func_headers windows.h SetThreadDpiAwarenessContext -D_WIN32_WINNT=0x0A00 check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" check_type "vdpau/vdpau.h" "VdpPictureInfoVP9" diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 4a90ad7a02..5668eda051 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -18,9 +18,9 @@ #include "config.h" -#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0A00 +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 #undef _WIN32_WINNT -#define _WIN32_WINNT 0x0A00 +#define _WIN32_WINNT 0x0602 #endif #define WIN32_LEAN_AND_MEAN @@ -41,6 +41,7 @@ #include "libavutil/avassert.h" #include "libavutil/hwcontext.h" #include "libavutil/hwcontext_d3d11va.h" +#include "compat/w32dlfcn.h" #include "avfilter.h" #include "internal.h" #include "formats.h" @@ -150,8 +151,12 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) IDXGIAdapter *dxgi_adapter = NULL; IDXGIOutput *dxgi_output = NULL; IDXGIOutput1 *dxgi_output1 = NULL; -#if HAVE_IDXGIOUTPUT5 && HAVE_SETTHREADDPIAWARENESSCONTEXT +#if HAVE_IDXGIOUTPUT5 IDXGIOutput5 *dxgi_output5 = NULL; + +typedef DPI_AWARENESS_CONTEXT (*set_thread_dpi_t)(DPI_AWARENESS_CONTEXT); +set_thread_dpi_t set_thread_dpi; +HMODULE user32_module; #endif int w, h; HRESULT hr; @@ -185,9 +190,19 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) return AVERROR_EXTERNAL; } -#if HAVE_IDXGIOUTPUT5 && HAVE_SETTHREADDPIAWARENESSCONTEXT -hr = IDXGIOutput_QueryInterface(dxgi_output, _IDXGIOutput5, (void**)_output5); -if (SUCCEEDED(hr)) { +#if HAVE_IDXGIOUTPUT5 +user32_module = dlopen("user32.dll", 0); +if (!user32_module) { +av_log(avctx, AV_LOG_ERROR, "Failed loading user32.dll\n"); +return AVERROR_EXTERNAL; +} + +set_thread_dpi = (set_thread_dpi_t)dlsym(user32_module, "SetThreadDpiAwarenessContext"); + +if (set_thread_dpi) +hr = IDXGIOutput_QueryInterface(dxgi_output, _IDXGIOutput5, (void**)_output5); + +if (set_thread_dpi && SUCCEEDED(hr)) { DPI_AWARENESS_CONTEXT prev_dpi_ctx; DXGI_FORMAT formats[] = { DXGI_FORMAT_R10G10B10A2_UNORM, @@ -197,7 +212,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) IDXGIOutput_Release(dxgi_output); dxgi_output = NULL; -prev_dpi_ctx = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); +prev_dpi_ctx = set_thread_dpi(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); if (!prev_dpi_ctx) av_log(avctx, AV_LOG_WARNING, "Failed enabling DPI awareness for DDA\n"); @@ -211,8 +226,18 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) dxgi_output5 = NULL; if (prev_dpi_ctx) -SetThreadDpiAwarenessContext(prev_dpi_ctx); +set_thread_dpi(prev_dpi_ctx); + +dlclose(user32_module); +user32_module = NULL; +set_thread_dpi = NULL; + +av_log(avctx, AV_LOG_DEBUG, "Using IDXGIOutput5 interface\n"); } else { +dlclose(user32_module); +user32_module = NULL; +set_thread_dpi = NULL; + av_log(avctx, AV_LOG_DEBUG, "Falling back to IDXGIOutput1\n"); #else { ___ 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] Changelog: move ddagrab addition to correct version
ffmpeg | branch: master | Timo Rothenpieler | Mon Jul 18 13:52:48 2022 +0200| [90810bb37cf7076074acf5a9c5a24feaaaf87bc9] | committer: Timo Rothenpieler Changelog: move ddagrab addition to correct version > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90810bb37cf7076074acf5a9c5a24feaaaf87bc9 --- Changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 0ceb878bee..f9cd44f184 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest. version : - Radiance HDR image support +- ddagrab (Desktop Duplication) video capture filter version 5.1: @@ -29,7 +30,6 @@ version 5.1: - PHM image format support - remap_opencl filter - added chromakey_cuda filter -- ddagrab (Desktop Duplication) video capture filter version 5.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] avfilter/vsrc_ddagrab: fix checkheaders error
ffmpeg | branch: master | Timo Rothenpieler | Mon Jul 18 13:08:39 2022 +0200| [cb22d5ea3c30194ac35cd16639dbb572ca30f8d3] | committer: Timo Rothenpieler avfilter/vsrc_ddagrab: fix checkheaders error > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb22d5ea3c30194ac35cd16639dbb572ca30f8d3 --- libavfilter/vsrc_ddagrab_shaders.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/vsrc_ddagrab_shaders.h b/libavfilter/vsrc_ddagrab_shaders.h index 0305f8de1c..894cba88b4 100644 --- a/libavfilter/vsrc_ddagrab_shaders.h +++ b/libavfilter/vsrc_ddagrab_shaders.h @@ -19,6 +19,8 @@ #ifndef AVFILTER_VSRC_DDAGRAB_SHADERS_H #define AVFILTER_VSRC_DDAGRAB_SHADERS_H +#include + #if 0 cbuffer PARAMS : register ( b0 ) ___ 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] avutil/hwcontext_d3d11va: fix texture_infos writes on non-fixed-size pools
ffmpeg | branch: release/5.0 | Timo Rothenpieler | Wed Jul 6 01:32:27 2022 +0200| [54e0971edbd6cf783f6209d762514633f6d9d413] | committer: Timo Rothenpieler avutil/hwcontext_d3d11va: fix texture_infos writes on non-fixed-size pools > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54e0971edbd6cf783f6209d762514633f6d9d413 --- libavutil/hwcontext_d3d11va.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 8ab96bad25..b55deb0d88 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -166,6 +166,17 @@ static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *te return NULL; } +if (s->nb_surfaces <= s->nb_surfaces_used) { +frames_hwctx->texture_infos = av_realloc_f(frames_hwctx->texture_infos, + s->nb_surfaces_used + 1, + sizeof(*frames_hwctx->texture_infos)); +if (!frames_hwctx->texture_infos) { +ID3D11Texture2D_Release(tex); +return NULL; +} +s->nb_surfaces = s->nb_surfaces_used + 1; +} + frames_hwctx->texture_infos[s->nb_surfaces_used].texture = tex; frames_hwctx->texture_infos[s->nb_surfaces_used].index = index; s->nb_surfaces_used++; @@ -284,7 +295,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) } } -hwctx->texture_infos = av_calloc(ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); +hwctx->texture_infos = av_realloc_f(NULL, ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); if (!hwctx->texture_infos) return AVERROR(ENOMEM); s->nb_surfaces = ctx->initial_pool_size; ___ 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] avutil/hwcontext_d3d11va: fix texture_infos writes on non-fixed-size pools
ffmpeg | branch: release/5.1 | Timo Rothenpieler | Wed Jul 6 01:32:27 2022 +0200| [d6a1e5980bbf5993882453e0d833d0afbeeeac4a] | committer: Timo Rothenpieler avutil/hwcontext_d3d11va: fix texture_infos writes on non-fixed-size pools > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d6a1e5980bbf5993882453e0d833d0afbeeeac4a --- libavutil/hwcontext_d3d11va.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 904d14bbc8..1bc8b6c82c 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -166,6 +166,17 @@ static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *te return NULL; } +if (s->nb_surfaces <= s->nb_surfaces_used) { +frames_hwctx->texture_infos = av_realloc_f(frames_hwctx->texture_infos, + s->nb_surfaces_used + 1, + sizeof(*frames_hwctx->texture_infos)); +if (!frames_hwctx->texture_infos) { +ID3D11Texture2D_Release(tex); +return NULL; +} +s->nb_surfaces = s->nb_surfaces_used + 1; +} + frames_hwctx->texture_infos[s->nb_surfaces_used].texture = tex; frames_hwctx->texture_infos[s->nb_surfaces_used].index = index; s->nb_surfaces_used++; @@ -284,7 +295,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) } } -hwctx->texture_infos = av_calloc(ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); +hwctx->texture_infos = av_realloc_f(NULL, ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); if (!hwctx->texture_infos) return AVERROR(ENOMEM); s->nb_surfaces = ctx->initial_pool_size; ___ 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] avdevice/lavfi: pass forward video framerate
ffmpeg | branch: master | Timo Rothenpieler | Wed Jul 6 23:45:24 2022 +0200| [2f0d45571b5290f2cc7269cc74bfb5af139eff3e] | committer: Timo Rothenpieler avdevice/lavfi: pass forward video framerate > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f0d45571b5290f2cc7269cc74bfb5af139eff3e --- libavdevice/lavfi.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 1b282a70cb..246f7dff3b 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -287,6 +287,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) for (i = 0; i < lavfi->nb_sinks; i++) { AVFilterContext *sink = lavfi->sinks[lavfi->stream_sink_map[i]]; AVRational time_base = av_buffersink_get_time_base(sink); +AVRational frame_rate = av_buffersink_get_frame_rate(sink); AVStream *st = avctx->streams[i]; AVCodecParameters *const par = st->codecpar; avpriv_set_pts_info(st, 64, time_base.num, time_base.den); @@ -299,6 +300,10 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) avctx->probesize = FFMAX(avctx->probesize, sizeof(AVFrame) * 30); st ->sample_aspect_ratio = par->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(sink); +if (frame_rate.num > 0 && frame_rate.den > 0) { +st->avg_frame_rate = frame_rate; +st->r_frame_rate = frame_rate; +} } else if (par->codec_type == AVMEDIA_TYPE_AUDIO) { par->sample_rate = av_buffersink_get_sample_rate(sink); ret = av_buffersink_get_ch_layout(sink, >ch_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] avdevice/lavfi: output wrapped AVFrames
ffmpeg | branch: master | Timo Rothenpieler | Wed Jun 29 21:24:28 2022 +0200| [6ca43a9675d651d7ea47c7ba2fafb1bf831c4d0b] | committer: Timo Rothenpieler avdevice/lavfi: output wrapped AVFrames This avoids an extra copy of potentially quite big video frames. Instead of copying the entire frames data into a rawvideo packet it packs the frame into a wrapped avframe packet and passes it through as-is. Unfortunately, wrapped avframes are set up to be video frames, so the audio frames continue to be copied. Additionally, this enabled passing through video frames that previously were impossible to process, like hardware frames or other special formats that couldn't be packed into a rawvideo packet. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ca43a9675d651d7ea47c7ba2fafb1bf831c4d0b --- libavdevice/lavfi.c | 89 --- libavdevice/version.h | 2 +- tests/ref/fate/filter-metadata-cropdetect | 3 +- 3 files changed, 38 insertions(+), 56 deletions(-) diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index db5d0b94de..1b282a70cb 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -54,32 +54,10 @@ typedef struct { int *sink_eof; int *stream_sink_map; int *sink_stream_subcc_map; -AVFrame *decoded_frame; int nb_sinks; AVPacket subcc_packet; } LavfiContext; -static int *create_all_formats(int n) -{ -int i, j, *fmts, count = 0; - -for (i = 0; i < n; i++) { -const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i); -if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) -count++; -} - -if (!(fmts = av_malloc_array(count + 1, sizeof(*fmts -return NULL; -for (j = 0, i = 0; i < n; i++) { -const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i); -if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) -fmts[j++] = i; -} -fmts[j] = AV_PIX_FMT_NONE; -return fmts; -} - av_cold static int lavfi_read_close(AVFormatContext *avctx) { LavfiContext *lavfi = avctx->priv_data; @@ -90,7 +68,6 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx) av_freep(>sink_stream_subcc_map); av_freep(>sinks); avfilter_graph_free(>graph); -av_frame_free(>decoded_frame); return 0; } @@ -125,15 +102,11 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) LavfiContext *lavfi = avctx->priv_data; AVFilterInOut *input_links = NULL, *output_links = NULL, *inout; const AVFilter *buffersink, *abuffersink; -int *pix_fmts = create_all_formats(AV_PIX_FMT_NB); enum AVMediaType type; int ret = 0, i, n; #define FAIL(ERR) { ret = ERR; goto end; } -if (!pix_fmts) -FAIL(AVERROR(ENOMEM)); - buffersink = avfilter_get_by_name("buffersink"); abuffersink = avfilter_get_by_name("abuffersink"); @@ -264,8 +237,6 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) ret = avfilter_graph_create_filter(, buffersink, inout->name, NULL, NULL, lavfi->graph); -if (ret >= 0) -ret = av_opt_set_int_list(sink, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN); if (ret < 0) goto end; } else if (type == AVMEDIA_TYPE_AUDIO) { @@ -321,15 +292,12 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) avpriv_set_pts_info(st, 64, time_base.num, time_base.den); par->codec_type = av_buffersink_get_type(sink); if (par->codec_type == AVMEDIA_TYPE_VIDEO) { -int64_t probesize; -par->codec_id = AV_CODEC_ID_RAWVIDEO; +par->codec_id = AV_CODEC_ID_WRAPPED_AVFRAME; par->format = av_buffersink_get_format(sink); par->width = av_buffersink_get_w(sink); par->height = av_buffersink_get_h(sink); -probesize = par->width * par->height * 30 * - av_get_padded_bits_per_pixel(av_pix_fmt_desc_get(par->format)); -avctx->probesize = FFMAX(avctx->probesize, probesize); -st ->sample_aspect_ratio = +avctx->probesize = FFMAX(avctx->probesize, sizeof(AVFrame) * 30); +st ->sample_aspect_ratio = par->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(sink); } else if (par->codec_type == AVMEDIA_TYPE_AUDIO) { par->sample_rate = av_buffersink_get_sample_rate(sink); @@ -348,11 +316,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) if ((ret = create_subcc_streams(avctx)) < 0) goto end; -if (!(lavfi->decoded_frame = av_frame_alloc())) -FAIL(AVERROR
[FFmpeg-cvslog] avfilter: add vsrc_ddagrab
ffmpeg | branch: master | Timo Rothenpieler | Fri Jul 8 18:02:40 2022 +0200| [f611255480b7cb61af745131251a1fd72f4dd086] | committer: Timo Rothenpieler avfilter: add vsrc_ddagrab > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f611255480b7cb61af745131251a1fd72f4dd086 --- Changelog | 1 + configure | 7 + doc/filters.texi | 68 +++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h | 2 +- libavfilter/vsrc_ddagrab.c | 982 + libavfilter/vsrc_ddagrab_shaders.h | 120 + 8 files changed, 1181 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index e5f7e153be..0ceb878bee 100644 --- a/Changelog +++ b/Changelog @@ -29,6 +29,7 @@ version 5.1: - PHM image format support - remap_opencl filter - added chromakey_cuda filter +- ddagrab (Desktop Duplication) video capture filter version 5.0: diff --git a/configure b/configure index 9d6457d81b..18d9b61a99 100755 --- a/configure +++ b/configure @@ -2309,6 +2309,7 @@ SYSTEM_FUNCS=" SetDllDirectory setmode setrlimit +SetThreadDpiAwarenessContext Sleep strerror_r sysconf @@ -2352,6 +2353,7 @@ TOOLCHAIN_FEATURES=" " TYPES_LIST=" +IDXGIOutput5 kCMVideoCodecType_HEVC kCMVideoCodecType_HEVCWithAlpha kCMVideoCodecType_VP9 @@ -3156,6 +3158,8 @@ overlay_cuda_filter_deps="ffnvcodec" overlay_cuda_filter_deps_any="cuda_nvcc cuda_llvm" sharpen_npp_filter_deps="ffnvcodec libnpp" +ddagrab_filter_deps="d3d11va IDXGIOutput1" + amf_deps_any="libdl LoadLibrary" nvenc_deps="ffnvcodec" nvenc_deps_any="libdl LoadLibrary" @@ -6391,10 +6395,13 @@ check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss check_type "windows.h dxva.h" "DXVA_PicParams_AV1" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0 check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0 check_type "windows.h dxva.h" "DXVA_PicParams_VP9" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0 +check_type "windows.h dxgi1_2.h" "IDXGIOutput1" +check_type "windows.h dxgi1_5.h" "IDXGIOutput5" check_type "windows.h d3d11.h" "ID3D11VideoDecoder" check_type "windows.h d3d11.h" "ID3D11VideoContext" check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602 check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat +check_func_headers windows.h SetThreadDpiAwarenessContext -D_WIN32_WINNT=0x0A00 check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" check_type "vdpau/vdpau.h" "VdpPictureInfoVP9" diff --git a/doc/filters.texi b/doc/filters.texi index 40f21fb34c..a3604da40d 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -26435,6 +26435,74 @@ need for a nullsrc video source. @end itemize +@section ddagrab + +Captures the Windows Desktop via Desktop Duplication API. + +The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding +or processing. So an explicit @ref{hwdownload} is needed for any kind of +software processing. + +It accepts the following options: + +@table @option +@item output_idx +DXGI Output Index to capture. + +Usually corresponds to the index Windows has given the screen minus one, +so it's starting at 0. + +Defaults to output 0. + +@item draw_mouse +Whether to draw the mouse cursor. + +Defaults to true. + +Only affects hardware cursors. If a game or application renders its own cursor, +it'll always be captured. + +@item framerate +Framerate at which the desktop will be captured. + +Defaults to 30 FPS. + +@item video_size +Specify the size of the captured video. + +Defaults to the full size of the screen. + +Cropped from the bottom/right if smaller than screen size. + +@item offset_x +Horizontal offset of the captured video. + +@item offset_y +Vertical offset of the captured video. + +@end table + +@subsection Examples + +Capture primary screen and encode using nvenc: +@example +ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4 +@end example + +You can also skip the lavfi device and directly use the filter. +Also demonstrates downloading the frame and encoding with libx264. +Explicit output format specification is required in this case: +@example +ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4 +@end example + +If you want to capture only a subsection of the desktop, this can be achieved +by specifying a smaller size and its offsets into the screen: +@example +ddagrab=vide