Re: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolboxenc: refactor dump encoder name
On Sat, Nov 25, 2023 at 12:06 PM Zhao Zhili wrote: > > From: Zhao Zhili > > --- > libavcodec/videotoolboxenc.c | 65 +--- > 1 file changed, 38 insertions(+), 27 deletions(-) > > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c > index b8a07e4e44..fbd33fd3f9 100644 > --- a/libavcodec/videotoolboxenc.c > +++ b/libavcodec/videotoolboxenc.c > @@ -280,6 +280,41 @@ typedef struct VTEncContext { > int max_ref_frames; > } VTEncContext; > > +static int vt_dump_encoder(AVCodecContext *avctx) > +{ > +VTEncContext *vtctx = avctx->priv_data; > +CFStringRef encoder_id = NULL; > +int status; > +CFIndex length, max_size; > +char *name; > + > +status = VTSessionCopyProperty(vtctx->session, > + > compat_keys.kVTCompressionPropertyKey_EncoderID, > + kCFAllocatorDefault, > + &encoder_id); > +// OK if not supported > +if (status != noErr) > +return 0; > + > +length = CFStringGetLength(encoder_id); > +max_size = CFStringGetMaximumSizeForEncoding(length, > kCFStringEncodingUTF8); > +name = av_malloc(max_size); > +if (!name) { > +CFRelease(encoder_id); > +return AVERROR(ENOMEM); > +} > + > +CFStringGetCString(encoder_id, > + name, > + max_size, > + kCFStringEncodingUTF8); > +av_log(avctx, AV_LOG_DEBUG, "Init the encoder: %s\n", name); > +av_freep(&name); > +CFRelease(encoder_id); > + > +return 0; > +} > + > static int vtenc_populate_extradata(AVCodecContext *avctx, > CMVideoCodecType codec_type, > CFStringRef profile_level, > @@ -1176,33 +1211,9 @@ static int vtenc_create_encoder(AVCodecContext > *avctx, > } > #endif > > -// Dump the init encoder > -{ > -CFStringRef encoderID = NULL; > -status = VTSessionCopyProperty(vtctx->session, > - > compat_keys.kVTCompressionPropertyKey_EncoderID, > - kCFAllocatorDefault, > - &encoderID); > -if (status == noErr) { > -CFIndex length = CFStringGetLength(encoderID); > -CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, > kCFStringEncodingUTF8); > -char *name = av_malloc(max_size); > -if (!name) { > -CFRelease(encoderID); > -return AVERROR(ENOMEM); > -} > - > -CFStringGetCString(encoderID, > - name, > - max_size, > - kCFStringEncodingUTF8); > -av_log(avctx, AV_LOG_DEBUG, "Init the encoder: %s\n", name); > - > -av_freep(&name); > -} > -if (encoderID != NULL) > -CFRelease(encoderID); > -} > +status = vt_dump_encoder(avctx); > +if (status < 0) > +return status; > > if (avctx->flags & AV_CODEC_FLAG_QSCALE && !vtenc_qscale_enabled()) { > av_log(avctx, AV_LOG_ERROR, "Error: -q:v qscale not available for > encoder. Use -b:v bitrate instead.\n"); > -- > 2.42.0 > Patchset looks good for if pass the build ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [ANNOUNCE] upcoming vote: extra members for GA v2
Reminder that the vote will close on Tuesday morning. We have 28/45 votes so far, and no reported bounces. If you have not voted yet please do so ASAP. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] tools/general_assembly: implement extra GA members
Set pushed. The general_assembly.pl script should now be usable as the authoritative source for GA members. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/ac3dsp: make len a size_t in float_to_fixed24
Quoting James Almer (2023-11-24 22:03:29) > On 11/24/2023 6:01 PM, Michael Niedermayer wrote: > > On Wed, Nov 22, 2023 at 04:49:13PM -0300, James Almer wrote: > >> Should simplify asm implementations, and prevent UB on at least win64. > >> > >> Signed-off-by: James Almer > >> --- > >> libavcodec/ac3dsp.c | 2 +- > >> libavcodec/ac3dsp.h | 2 +- > >> libavcodec/arm/ac3dsp_init_arm.c | 2 +- > >> libavcodec/mips/ac3dsp_mips.c| 2 +- > >> libavcodec/x86/ac3dsp_init.c | 4 ++-- > >> 5 files changed, 6 insertions(+), 6 deletions(-) > > > > In file included from src/libavcodec/mips/ac3dsp_mips.c:57:0: > > src/libavcodec/ac3dsp.h:56:62: error: unknown type name ‘size_t’; did you > > mean ‘__ssize_t’? > > void (*float_to_fixed24)(int32_t *dst, const float *src, size_t len); > >^~ > >__ssize_t > > src/ffbuild/common.mak:81: recipe for target > > 'libavcodec/mips/ac3dsp_mips.o' failed > > make: *** [libavcodec/mips/ac3dsp_mips.o] Error 1 > > make: *** Waiting for unfinished jobs > > mips FAIL > > Do you know where is size_t defined for this target? stddef.h? size_t should _always_ be defined in stddef.h, as per C99 7.17.2 -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option
Quoting Dmitrii Ovchinnikov (2023-11-24 09:45:14) > If there are no objections, I would like to merge it in 2-3 days The code looks significantly duplicated. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: use mfxImplDescription instead of mfxExtendedDeviceId on Linux
Quoting Xiang, Haihao (2023-11-24 08:38:52) > From: Haihao Xiang > > This fixed the issue mentioned in [1] > > [1] http://ffmpeg.org/pipermail/ffmpeg-user/2023-October/056983.html Commit messages should be meaningful on their own, without referring to external sources. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] doc/filters: restore libvmaf option pool entry
3d29724c00 removed the doc entry for the option pool while adding a parser function for it at the same time! The option remains available and undeprecated. --- doc/filters.texi | 4 1 file changed, 4 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index 5268b2003c..80ffbb2c65 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -16864,6 +16864,10 @@ Set the file path to be used to store log files. @item log_fmt Set the format of the log file (xml, json, csv, or sub). +@item pool +Set the pool method to be used for computing vmaf. +Options are @code{min}, @code{harmonic_mean} or @code{mean} (default). + @item n_threads Set number of threads to be used when initializing libvmaf. Default value: @code{0}, no threads. -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_d3d11va: Add option vendor_id
Quoting Xiang, Haihao (2023-11-24 06:43:46) > From: Artem Galin > > User may choose the hardware via option vendor_id when multiple hardware > are available. > > Signed-off-by: Artem Galin > Signed-off-by: Haihao Xiang > --- > libavutil/hwcontext_d3d11va.c | 67 ++- > 1 file changed, 66 insertions(+), 1 deletion(-) > > diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > index cc8c97d2b6..a6777b70a1 100644 > --- a/libavutil/hwcontext_d3d11va.c > +++ b/libavutil/hwcontext_d3d11va.c > @@ -552,6 +552,55 @@ static void d3d11va_device_uninit(AVHWDeviceContext > *hwdev) > } > } > > +static int d3d11va_device_find_adapter_by_vendor_id(AVHWDeviceContext *ctx, > uint32_t flags, const char *vendor_id) > +{ > +HRESULT hr; > +IDXGIAdapter *adapter = NULL; > +IDXGIFactory2 *factory; > +int adapter_id = 0; > +long int id = strtol(vendor_id, NULL, 0); > + > +hr = mCreateDXGIFactory(&IID_IDXGIFactory2, (void **)&factory); > +if (FAILED(hr)) { > +av_log(ctx, AV_LOG_ERROR, "CreateDXGIFactory returned error\n"); > +return -1; > +} > + > +while (IDXGIFactory2_EnumAdapters(factory, adapter_id++, &adapter) != > DXGI_ERROR_NOT_FOUND) { > +ID3D11Device* device = NULL; > +DXGI_ADAPTER_DESC adapter_desc; > + > +hr = mD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, > flags, NULL, 0, D3D11_SDK_VERSION, &device, NULL, NULL); > +if (FAILED(hr)) { > +av_log(ctx, AV_LOG_ERROR, "D3D11CreateDevice returned error\n"); This should not be AV_LOG_ERROR, since it does not result in failure. > + > +if (adapter) I'd expect adapter to be always non-NULL here. Same below, also for device.. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] lavu/hwcontext_qsv: Make sure hardware vendor is Intel for qsv on d3d11va
Quoting Xiang, Haihao (2023-11-24 06:43:48) > From: Haihao Xiang > > When multiple hardware are available, the default one might not be > Intel Hareware. We can use option vendor_id to choose the required > vendor. > > Tested-by: Artem Galin > Signed-off-by: Haihao Xiang > --- > libavutil/hwcontext_qsv.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c > index 1bfda9e69b..7a9cd0cc37 100644 > --- a/libavutil/hwcontext_qsv.c > +++ b/libavutil/hwcontext_qsv.c > @@ -2200,6 +2200,12 @@ static int qsv_device_create(AVHWDeviceContext *ctx, > const char *device, > #endif > #if CONFIG_D3D11VA > case AV_HWDEVICE_TYPE_D3D11VA: > +{ Useless braces. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_vaapi: ignore nonexistent device in default DRM device selection
Quoting Xiang, Haihao (2023-11-24 07:17:36) > From: Haihao Xiang > > It is possible that renderD128 doesn't exist but renderD129 is > available in a system (see [1]). This change can make sure the default > DRM device selection works even if renderD128 doesn't exist. > > [1] > https://github.com/intel/intel-device-plugins-for-kubernetes/blob/main/cmd/gpu_plugin/README.md#issues-with-media-workloads-on-multi-gpu-setups > > Signed-off-by: Haihao Xiang > --- > libavutil/hwcontext_vaapi.c | 14 -- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index 12bc95119a..6d542a9bc9 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -1733,8 +1733,18 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, > const char *device, > "/dev/dri/renderD%d", 128 + n); > priv->drm_fd = open(path, O_RDWR); > if (priv->drm_fd < 0) { > -av_log(ctx, AV_LOG_VERBOSE, "Cannot open " > - "DRM render node for device %d.\n", n); > +if (errno == ENOENT) { > +if (n != max_devices - 1) { > +av_log(ctx, AV_LOG_VERBOSE, > + "No render device %s, try next device for > " > + "DRM render node.\n", path); > +continue; > +} else > +av_log(ctx, AV_LOG_VERBOSE, "No avaialbe render > device " Typo in 'available'. Also, the else is unnecessary since the if() block ends with continue. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/jpegxl_parser: fix parsing sequences of extremely small files
Would be nice to have tests for these. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] checkasm: add test for dcmul_add
Will push soon except for objections ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/dcadec: adjust the `ch_layout` when downmix is active
On 11/26/2023 1:33 AM, Geoffrey McRae via ffmpeg-devel wrote: Applications making use of this codec with the `downmix` option are segfaulting unless the `ch_layout` is overridden after `avcodec_open2` as can be seen in projects like MythTV[1] This patch fixes this by overriding the ch_layout as done in other decoders such as AC3. 1: https://github.com/MythTV/mythtv/blob/af6f362a140cd59b9ed784a8c639fd456b5f6967/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp#L4607 Signed-off-by: Geoffrey McRae --- libavcodec/dcadec.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index 1fee49cf4d..cc23731b90 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -366,12 +366,19 @@ FF_ENABLE_DEPRECATION_WARNINGS if (s->downmix_layout.nb_channels) { if (!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO) || -!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX)) +!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX)) { s->request_channel_layout = DCA_SPEAKER_LAYOUT_STEREO; -else if (!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0)) +av_channel_layout_uninit(&avctx->ch_layout); +avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; +} else if (!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0)) { s->request_channel_layout = DCA_SPEAKER_LAYOUT_5POINT0; -else if (!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1)) +av_channel_layout_uninit(&avctx->ch_layout); +avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0; +} else if (!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1)) { s->request_channel_layout = DCA_SPEAKER_LAYOUT_5POINT1; +av_channel_layout_uninit(&avctx->ch_layout); +avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1; +} else av_log(avctx, AV_LOG_WARNING, "Invalid downmix layout\n"); } Applied, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/mlpdec: add missing correction to ch_layout when downmixing
On 11/26/2023 2:01 AM, Geoffrey McRae via ffmpeg-devel wrote: This fixes corrupted audio for applications relying on ch_layout when codec downmixing is active. Signed-off-by: Geoffrey McRae --- libavcodec/mlpdec.c | 17 + 1 file changed, 17 insertions(+) diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index f1524b95a6..18e0f47864 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -306,6 +306,23 @@ FF_DISABLE_DEPRECATION_WARNINGS } FF_ENABLE_DEPRECATION_WARNINGS #endif + +if (m->downmix_layout.nb_channels) { +if (!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO) || +!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX)) { +av_channel_layout_uninit(&avctx->ch_layout); +avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; +} else if (!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0)) { +av_channel_layout_uninit(&avctx->ch_layout); +avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0; +} else if (!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1)) { +av_channel_layout_uninit(&avctx->ch_layout); +avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1; +} +else + av_log(avctx, AV_LOG_WARNING, "Invalid downmix layout\n"); +} + ff_thread_once(&init_static_once, init_static); return 0; Applied, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/9] avcodec/get_bits: add get_leb()
On 11/25/23 20:28, James Almer wrote: Signed-off-by: James Almer --- libavcodec/bitstream.h | 2 ++ libavcodec/bitstream_template.h | 22 ++ libavcodec/get_bits.h | 23 +++ 3 files changed, 47 insertions(+) Out of curiosity, why do this (and the avio version) have to be global? What are they used for other than the iamf demuxer? Would it make sense to have a static inline read_leb function defined in iamf.c? - Leo Izen (Traneptora) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/9] avcodec/get_bits: add get_leb()
On 11/26/2023 10:40 AM, Leo Izen wrote: On 11/25/23 20:28, James Almer wrote: Signed-off-by: James Almer --- libavcodec/bitstream.h | 2 ++ libavcodec/bitstream_template.h | 22 ++ libavcodec/get_bits.h | 23 +++ 3 files changed, 47 insertions(+) Out of curiosity, why do this (and the avio version) have to be global? What are they used for other than the iamf demuxer? Would it make sense to have a static inline read_leb function defined in iamf.c? They can be used by the av1 modules too, and potentially other formats in the future using the OBU encapsulation. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/jpegxl_parser: fix parsing sequences of extremely small files
On 11/26/23 05:56, Anton Khirnov wrote: Would be nice to have tests for these. I have a sample at: https://buzo.us/l.jxl It would test both of these patches. I can send a fate test for these to the ML if the sample gets uploaded. I CC'd samples-requ...@ffmpeg.org as well. - Leo Izen (Traneptora) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter: add Affine Projection adaptive audio filter
Attached. From 6c355f79e9c21a11e5e1266da7936a4ac2dc07ac Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sun, 30 Apr 2023 17:06:00 +0200 Subject: [PATCH] avfilter: add Affine Projection adaptive audio filter Signed-off-by: Paul B Mahol --- doc/filters.texi | 43 libavfilter/Makefile | 1 + libavfilter/af_aap.c | 451 +++ libavfilter/allfilters.c | 1 + 4 files changed, 496 insertions(+) create mode 100644 libavfilter/af_aap.c diff --git a/doc/filters.texi b/doc/filters.texi index 5268b2003c..3c9d32aa76 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -418,6 +418,49 @@ build. Below is a description of the currently available audio filters. +@section aap +Apply Affine Projection algorithm to the first audio stream using the second audio stream. + +This adaptive filter is used to estimate unknown audio based on multiple input audio samples. +Affine projection algorithm can make trade-offs between computation complexity with convergence speed. + +A description of the accepted options follows. + +@table @option +@item order +Set the filter order. + +@item projection +Set the projection order. + +@item mu +Set the filter mu. + +@item delta +Set the coefficient to initialize internal covariance matrix. + +@item out_mode +Set the filter output samples. It accepts the following values: +@table @option +@item i +Pass the 1st input. + +@item d +Pass the 2nd input. + +@item o +Pass difference between desired, 2nd input and error signal estimate. + +@item n +Pass difference between input, 1st input and error signal estimate. + +@item e +Pass error signal estimated samples. + +Default value is @var{o}. +@end table +@end table + @section acompressor A compressor is mainly used to reduce the dynamic range of a signal. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 5e5068b564..0da62540f8 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -35,6 +35,7 @@ OBJS-$(CONFIG_DNN) += dnn_filter_common.o include $(SRC_PATH)/libavfilter/dnn/Makefile # audio filters +OBJS-$(CONFIG_AAP_FILTER)+= af_aap.o OBJS-$(CONFIG_ABENCH_FILTER) += f_bench.o OBJS-$(CONFIG_ACOMPRESSOR_FILTER)+= af_sidechaincompress.o OBJS-$(CONFIG_ACONTRAST_FILTER) += af_acontrast.o diff --git a/libavfilter/af_aap.c b/libavfilter/af_aap.c new file mode 100644 index 00..978a853137 --- /dev/null +++ b/libavfilter/af_aap.c @@ -0,0 +1,451 @@ +/* + * Copyright (c) 2023 Paul B Mahol + * + * 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/channel_layout.h" +#include "libavutil/common.h" +#include "libavutil/float_dsp.h" +#include "libavutil/opt.h" + +#include "audio.h" +#include "avfilter.h" +#include "formats.h" +#include "filters.h" +#include "internal.h" + +enum OutModes { +IN_MODE, +DESIRED_MODE, +OUT_MODE, +NOISE_MODE, +ERROR_MODE, +NB_OMODES +}; + +typedef struct AudioAPContext { +const AVClass *class; + +int order; +int projection; +float mu; +float delta; +int output_mode; + +int kernel_size; +AVFrame *offset; +AVFrame *delay; +AVFrame *coeffs; +AVFrame *e; +AVFrame *p; +AVFrame *x; +AVFrame *w; +AVFrame *dcoeffs; +AVFrame *tmp; +AVFrame *tmpm; +AVFrame *itmpm; + +float **tmpmp; +float **itmpmp; + +AVFrame *frame[2]; + +AVFloatDSPContext *fdsp; +} AudioAPContext; + +#define OFFSET(x) offsetof(AudioAPContext, x) +#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM +#define AT AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM + +static const AVOption aap_options[] = { +{ "order", "set the filter order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=16}, 1, INT16_MAX, A }, +{ "projection", "set the filter projection", OFFSET(projection), AV_OPT_TYPE_INT, {.i64=2},1, 256, A }, +{ "mu", "set the filter mu", OFFSET(mu), AV_OPT_TYPE_FLOAT, {.dbl=0.0001},0,1, AT }, +{ "delta", "set the filter delta", OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0.001},0, 1, AT }, +{ "out_mode", "set output mode",
Re: [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option
>> The code looks significantly duplicated. This is not moved to amfenc.c since the property has different names for different encoders, and many other properties (also common to different encoders, but with different names) are separated in this way. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] tools/general_assembly: implement extra GA members
On 2023-11-26 10:18 +0100, Anton Khirnov wrote: > Set pushed. > > The general_assembly.pl script should now be usable as the authoritative > source for GA members. The patches mostly LGTM. My Perl knowledge in general is really mostly from 20 years ago. So if there is any Perl-ish devil in the details I surely have overlooked it. Please pardon me if I missed any details on how the program works. The edge cases are always the tricky stuff... One thing about this patch and that program in general is a bit unfortunate: The use of PerlDate is_between. Here is the doc I found for it: $dt->is_between( $lower, $upper ) Checks whether $dt is strictly between two other DateTime objects. "Strictly" means that $dt must be greater than $lower and less than $upper. If it is equal to either object then this method returns false. AFAIU it affects the script in 2 places: 1. In subroutine get_date_range: Here the exact day matching date_ga_rule is treated like anything >= date_first_regular 2. In the loop adding the extra member. The member would not be added on both, the day they were elected nor the day 2 years after. Case 1 should be "strictly academical" and thus not really important because to my knowledge no vote was started on that day. For case 2 it will be not important on most days, but it would seem more common and intuitive to use either the closed interval or a half open interval. Where including the first and the last day or including the first and excluding the day seem most natural to me. Best regards, Alexander P.S. As date calculations always turn out nightmares if you look at them long enough, it would possible be a good idea to always use UTC and review how time zones are handled in git CLI. P.P.S. For quick reference follow copies for both places referenced above: Case 1: sub get_date_range { my ($now) = @_; # date on which the GA update rule was established, and the voter list # was extraordinarily updated; cf.: # * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-October/316054.html # Message-Id <169818211998.11195.16532637803201641...@lain.khirnov.net> # * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-November/316618.html # Message-Id <5efcab06-8510-4226-bf18-68820c7c6...@betaapp.fastmail.com> my $date_ga_rule = DateTime->new(year => 2023, month => 11, day => 06); # date when the regular update rule is first applied my $date_first_regular = DateTime->new(year => 2024); if ($now->is_between($date_ga_rule, $date_first_regular)) { return ($date_ga_rule->clone()->set_year($date_ga_rule->year - 3), $date_ga_rule); } if ($now < $date_ga_rule) { print STDERR "GA before $date_ga_rule is not well-defined, be very careful with the output\n"; } my $cur_year_jan = $now->clone()->truncate(to => "year"); my $cur_year_jul = $cur_year_jan->clone()->set_month(7); my $date_until= $now > $cur_year_jul ? $cur_year_jul : $cur_year_jan; my $date_since= $date_until->clone()->set_year($date_until->year - 3); return ($date_since, $date_until); } Case 2: foreach my $entry (@extra_members) { my $elected = $entry->[2]; if ($date->is_between($elected, $elected->clone()->set_year($elected->year + 2))) { $assembly{$entry->[0]} = $entry->[1]; } } ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec: add QOA decoder
ffmpeg | branch: master | Paul B Mahol https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog>> | Sat Sep 23 16:49:25 2023 +0200| [3609d2b78340c06920973dc46b85b517c789782f] | committer: Paul B Mahol avcodec: add QOA decoder >/http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3609d2b78340c06920973dc46b85b517c789782f /--- Changelog | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/codec_desc.c | 7 ++ libavcodec/codec_id.h | 1 + libavcodec/qoadec.c | 175 libavcodec/version.h| 2 +- 7 files changed, 187 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 7d79be1c3e..d945904bc0 100644 --- a/Changelog +++ b/Changelog @@ -5,6 +5,7 @@ version : - LEAD MCMP decoder - EVC decoding using external library libxevd - EVC encoding using external library libxeve +- QOA decoder version 6.1: - libaribcaption decoder diff --git a/libavcodec/Makefile b/libavcodec/Makefile index a5941d1284..748806e702 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -623,6 +623,7 @@ OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \ OBJS-$(CONFIG_QDM2_DECODER)+= qdm2.o OBJS-$(CONFIG_QDMC_DECODER)+= qdmc.o OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o +OBJS-$(CONFIG_QOA_DECODER) += qoadec.o OBJS-$(CONFIG_QOI_DECODER) += qoidec.o OBJS-$(CONFIG_QOI_ENCODER) += qoienc.o OBJS-$(CONFIG_QPEG_DECODER)+= qpeg.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 87595683f9..b0f004e15c 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -522,6 +522,7 @@ extern const FFCodec ff_paf_audio_decoder; extern const FFCodec ff_qcelp_decoder; extern const FFCodec ff_qdm2_decoder; extern const FFCodec ff_qdmc_decoder; +extern const FFCodec ff_qoa_decoder; extern const FFCodec ff_ra_144_encoder; extern const FFCodec ff_ra_144_decoder; extern const FFCodec ff_ra_288_decoder; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 432a9c9ea6..033344304c 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -3427,6 +3427,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("OSQ (Original Sound Quality)"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, +{ +.id= AV_CODEC_ID_QOA, +.type = AVMEDIA_TYPE_AUDIO, +.name = "qoa", +.long_name = NULL_IF_CONFIG_SMALL("QOA (Quite OK Audio)"), +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, +}, /* subtitle codecs */ { diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h index 84ce8e6aa9..d96e49430e 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -545,6 +545,7 @@ enum AVCodecID { AV_CODEC_ID_RKA, AV_CODEC_ID_AC4, AV_CODEC_ID_OSQ, +AV_CODEC_ID_QOA, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. diff --git a/libavcodec/qoadec.c b/libavcodec/qoadec.c new file mode 100644 index 00..9b2abae833 --- /dev/null +++ b/libavcodec/qoadec.c @@ -0,0 +1,175 @@ +/* + * QOA decoder + * + * 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 "avcodec.h" +#include "codec_internal.h" +#include "decode.h" +#include "get_bits.h" +#include "bytestream.h" +#include "mathops.h" + +#define QOA_SLICE_LEN 20 +#define QOA_LMS_LEN 4 + +typedef struct QOAChannel { +int history[QOA_LMS_LEN]; +int weights[QOA_LMS_LEN]; +} QOAChannel; + +typedef struct QOAContext { +QOAChannel *ch; +} QOAContext; + +static const int16_t qoa_dequant_tab[16][8] = { +{ 1,-1,3,-3,5,-5, 7, -7}, +{ 5,-5, 18, -18, 32, -32,49,-49}, +{ 16, -16, 53, -53, 95, -95, 147, -147}, +{ 34, -34, 113, -113, 203, -203, 315, -315}, +{ 63, -63, 210, -210, 378, -378, 588, -588}, +{ 104, -104, 345, -345, 621, -621, 966, -966}, +{ 158, -158, 528, -528, 950, -95
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/jpegxl_parser: fix parsing sequences of extremely small files
> Am 26.11.2023 um 14:47 schrieb Leo Izen : > On 11/26/23 05:56, Anton Khirnov wrote: >> Would be nice to have tests for these. > > I have a sample at: https://buzo.us/l.jxl > > It would test both of these patches. I can send a fate test for these to the > ML if the sample gets uploaded. I CC'd samples-requ...@ffmpeg.org as well. Can do this in a bit. What about the file you‘d sent to samples-request in August, is there still a test to be pushed about it as well? -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] checkasm: add test for dcmul_add
Le sunnuntaina 19. marraskuuta 2023, 0.28.10 EET flow gg a écrit : > From 2785ce57f68dbb2373c951b9432afa73796f7cc1 Mon Sep 17 00:00:00 2001 > From: sunyuechi > Date: Sat, 18 Nov 2023 10:58:17 +0800 > Subject: [PATCH] checkasm: test for dcmul_add git-am reports the patch corrupt. -- Rémi Denis-Courmont http://www.remlab.net/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 00/14] encoder AVCodecContext configuration side data
Differences to v3: 1. rebased on top of current master 2. moved the addition of multiple side data entries from a generic av_frame_side_data_set_extend to avcodec as per request from James. 4. adopted various things noted by reviews Comparison URL (mostly configure and wrappers, avutil/frame.c): https://github.com/jeeb/ffmpeg/compare/avcodec_cll_mdcv_side_data_v4..avcodec_cll_mdcv_side_data_v5 This patch set I've now been working for a while since I felt like it was weird we couldn't pass through information such as static HDR metadata to encoders from decoded input. This initial version adds the necessary framework, as well as adds static HDR metadata support for libsvtav1, libx264 as well as libx265 wrappers. An alternative to this would be to make encoders only properly initialize when they receive the first AVFrame, but that seems to be a bigger, nastier change than introducing an AVFrameSideDataSet in avctx as everything seems to presume that extradata etc are available after opening the encoder. Note: Any opinions on whether FFCodec or AVCodec should have handled_side_data list, so that if format specific generic logic is added, it could be checked whether the codec itself handles this side data? This could also be utilized to list handled side data from f.ex. `ffmpeg -h encoder=libsvtav1`. Jan Jan Ekström (14): avutil/frame: add AVFrameSideDataSet for passing sets of side data avutil/frame: split side data list wiping out to non-AVFrame function avutil/frame: add helper for uninitializing side data sets avutil/frame: split side_data_from_buf to base and AVFrame func avutil/frame: split side data removal out to non-AVFrame function avutil/frame: add helper for adding side data to set avutil/frame: add helper for adding existing side data to set avutil/frame: add helper for getting side data from set avcodec: add side data set to AVCodecContext avcodec: add helper for configuring AVCodecContext's side data set ffmpeg: pass first video AVFrame's side data to encoder avcodec/libsvtav1: add support for writing out CLL and MDCV avcodec/libx264: add support for writing out CLL and MDCV avcodec/libx265: add support for writing out CLL and MDCV configure | 2 + fftools/ffmpeg_enc.c| 13 +++ libavcodec/avcodec.c| 28 ++ libavcodec/avcodec.h| 27 + libavcodec/libsvtav1.c | 67 + libavcodec/libx264.c| 78 ++ libavcodec/libx265.c| 87 libavcodec/options.c| 1 + libavutil/Makefile | 1 + libavutil/frame.c | 173 ++-- libavutil/frame.h | 64 libavutil/tests/side_data_set.c | 97 ++ tests/fate/enc_external.mak | 15 +++ tests/fate/libavutil.mak| 4 + tests/ref/fate/libsvtav1-hdr10 | 14 +++ tests/ref/fate/libx264-hdr10| 15 +++ tests/ref/fate/libx265-hdr10| 16 +++ tests/ref/fate/side_data_set| 14 +++ 18 files changed, 686 insertions(+), 30 deletions(-) create mode 100644 libavutil/tests/side_data_set.c create mode 100644 tests/ref/fate/libsvtav1-hdr10 create mode 100644 tests/ref/fate/libx264-hdr10 create mode 100644 tests/ref/fate/libx265-hdr10 create mode 100644 tests/ref/fate/side_data_set -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 01/14] avutil/frame: add AVFrameSideDataSet for passing sets of side data
--- libavutil/frame.h | 8 1 file changed, 8 insertions(+) diff --git a/libavutil/frame.h b/libavutil/frame.h index c0c1b23db7..6155226c1d 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -251,6 +251,14 @@ typedef struct AVFrameSideData { AVBufferRef *buf; } AVFrameSideData; +/** + * Structure to hold a set of AVFrameSideData + */ +typedef struct AVFrameSideDataSet { +AVFrameSideData **sd; +intnb_sd; +} AVFrameSideDataSet; + /** * Structure describing a single Region Of Interest. * -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 02/14] avutil/frame: split side data list wiping out to non-AVFrame function
This will make it possible to to reuse logic in further commits. --- libavutil/frame.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index a3f07ca089..d94710687b 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -75,14 +75,19 @@ static void free_side_data(AVFrameSideData **ptr_sd) av_freep(ptr_sd); } -static void wipe_side_data(AVFrame *frame) +static void wipe_side_data(AVFrameSideData ***sd, int *nb_side_data) { -for (int i = 0; i < frame->nb_side_data; i++) { -free_side_data(&frame->side_data[i]); +for (int i = 0; i < *nb_side_data; i++) { +free_side_data(&((*sd)[i])); } -frame->nb_side_data = 0; +*nb_side_data = 0; + +av_freep(sd); +} -av_freep(&frame->side_data); +static void frame_side_data_wipe(AVFrame *frame) +{ +wipe_side_data(&frame->side_data, &frame->nb_side_data); } AVFrame *av_frame_alloc(void) @@ -337,7 +342,7 @@ FF_ENABLE_DEPRECATION_WARNINGS sd_dst = av_frame_new_side_data(dst, sd_src->type, sd_src->size); if (!sd_dst) { -wipe_side_data(dst); +frame_side_data_wipe(dst); return AVERROR(ENOMEM); } memcpy(sd_dst->data, sd_src->data, sd_src->size); @@ -346,7 +351,7 @@ FF_ENABLE_DEPRECATION_WARNINGS sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref); if (!sd_dst) { av_buffer_unref(&ref); -wipe_side_data(dst); +frame_side_data_wipe(dst); return AVERROR(ENOMEM); } } @@ -525,7 +530,7 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif -wipe_side_data(dst); +frame_side_data_wipe(dst); av_dict_free(&dst->metadata); ret = frame_copy_props(dst, src, 0); if (ret < 0) @@ -624,7 +629,7 @@ void av_frame_unref(AVFrame *frame) if (!frame) return; -wipe_side_data(frame); +frame_side_data_wipe(frame); for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++) av_buffer_unref(&frame->buf[i]); -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 03/14] avutil/frame: add helper for uninitializing side data sets
--- libavutil/frame.c | 5 + libavutil/frame.h | 8 2 files changed, 13 insertions(+) diff --git a/libavutil/frame.c b/libavutil/frame.c index d94710687b..941a0a8148 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -90,6 +90,11 @@ static void frame_side_data_wipe(AVFrame *frame) wipe_side_data(&frame->side_data, &frame->nb_side_data); } +void av_frame_side_data_set_uninit(AVFrameSideDataSet *set) +{ +wipe_side_data(&set->sd, &set->nb_sd); +} + AVFrame *av_frame_alloc(void) { AVFrame *frame = av_malloc(sizeof(*frame)); diff --git a/libavutil/frame.h b/libavutil/frame.h index 6155226c1d..4fe9ac9411 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -1057,6 +1057,14 @@ int av_frame_apply_cropping(AVFrame *frame, int flags); */ const char *av_frame_side_data_name(enum AVFrameSideDataType type); +/** + * Free all side data entries and their contents, then zeroes out the + * struct values. + * + * @param set the set which should be uninitialized + */ +void av_frame_side_data_set_uninit(AVFrameSideDataSet *set); + /** * @} */ -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 04/14] avutil/frame: split side_data_from_buf to base and AVFrame func
--- libavutil/frame.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index 941a0a8148..49da452fa5 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -787,23 +787,22 @@ FF_ENABLE_DEPRECATION_WARNINGS return NULL; } -AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame, - enum AVFrameSideDataType type, - AVBufferRef *buf) +static AVFrameSideData *add_side_data_to_set_from_buf(AVFrameSideDataSet *set, + enum AVFrameSideDataType type, + AVBufferRef *buf) { AVFrameSideData *ret, **tmp; if (!buf) return NULL; -if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1) +if (set->nb_sd > INT_MAX / sizeof(*set->sd) - 1) return NULL; -tmp = av_realloc(frame->side_data, - (frame->nb_side_data + 1) * sizeof(*frame->side_data)); +tmp = av_realloc(set->sd, (set->nb_sd + 1) * sizeof(*set->sd)); if (!tmp) return NULL; -frame->side_data = tmp; +set->sd = tmp; ret = av_mallocz(sizeof(*ret)); if (!ret) @@ -814,7 +813,23 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame, ret->size = buf->size; ret->type = type; -frame->side_data[frame->nb_side_data++] = ret; +set->sd[set->nb_sd++] = ret; + +return ret; +} + +AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame, + enum AVFrameSideDataType type, + AVBufferRef *buf) +{ +AVFrameSideDataSet set = { +.sd= frame->side_data, +.nb_sd = frame->nb_side_data, +}; +AVFrameSideData *ret = add_side_data_to_set_from_buf(&set, type, buf); + +frame->side_data= set.sd; +frame->nb_side_data = set.nb_sd; return ret; } -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 05/14] avutil/frame: split side data removal out to non-AVFrame function
This will make it possible to reuse logic in further commits. --- libavutil/frame.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index 49da452fa5..587e212d1a 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -95,6 +95,21 @@ void av_frame_side_data_set_uninit(AVFrameSideDataSet *set) wipe_side_data(&set->sd, &set->nb_sd); } +static void remove_side_data(AVFrameSideData ***sd, int *nb_side_data, + const enum AVFrameSideDataType type) +{ +for (int i = *nb_side_data - 1; i >= 0; i--) { +AVFrameSideData *entry = ((*sd)[i]); +if (entry->type != type) +continue; + +free_side_data(&entry); + +((*sd)[i]) = ((*sd)[*nb_side_data - 1]); +(*nb_side_data)--; +} +} + AVFrame *av_frame_alloc(void) { AVFrame *frame = av_malloc(sizeof(*frame)); @@ -943,14 +958,7 @@ FF_ENABLE_DEPRECATION_WARNINGS void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type) { -for (int i = frame->nb_side_data - 1; i >= 0; i--) { -AVFrameSideData *sd = frame->side_data[i]; -if (sd->type == type) { -free_side_data(&frame->side_data[i]); -frame->side_data[i] = frame->side_data[frame->nb_side_data - 1]; -frame->nb_side_data--; -} -} +remove_side_data(&frame->side_data, &frame->nb_side_data, type); } const char *av_frame_side_data_name(enum AVFrameSideDataType type) -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 06/14] avutil/frame: add helper for adding side data to set
Additionally, add an API test to check that the no-duplicates addition works after duplicates have been inserted. --- libavutil/Makefile | 1 + libavutil/frame.c | 18 ++ libavutil/frame.h | 20 +++ libavutil/tests/side_data_set.c | 97 + tests/fate/libavutil.mak| 4 ++ tests/ref/fate/side_data_set| 14 + 6 files changed, 154 insertions(+) create mode 100644 libavutil/tests/side_data_set.c create mode 100644 tests/ref/fate/side_data_set diff --git a/libavutil/Makefile b/libavutil/Makefile index 4711f8cde8..c000fa0c7e 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -266,6 +266,7 @@ TESTPROGS = adler32 \ ripemd \ sha \ sha512 \ +side_data_set \ softfloat \ tree\ twofish \ diff --git a/libavutil/frame.c b/libavutil/frame.c index 587e212d1a..9ac3db430f 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -861,6 +861,24 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, return ret; } +AVFrameSideData *av_frame_side_data_set_new_entry(AVFrameSideDataSet *set, + enum AVFrameSideDataType type, + size_t size, + unsigned int flags) +{ +AVBufferRef *buf = av_buffer_alloc(size); +AVFrameSideData *ret = NULL; + +if (flags & AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES) +remove_side_data(&set->sd, &set->nb_sd, type); + +ret = add_side_data_to_set_from_buf(set, type, buf); +if (!ret) +av_buffer_unref(&buf); + +return ret; +} + AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type) { diff --git a/libavutil/frame.h b/libavutil/frame.h index 4fe9ac9411..093a76e30d 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -1065,6 +1065,26 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type); */ void av_frame_side_data_set_uninit(AVFrameSideDataSet *set); +#define AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES (1 << 0) + +/** + * Add a new side data entry to a set. + * + * @param set a set to which the side data should be added + * @param type type of the added side data + * @param size size of the side data + * @param flags Some combination of AV_FRAME_SIDE_DATA_SET_FLAG_* flags, or 0. + * + * @return newly added side data on success, NULL on error. In case of + * AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES being set, entries + * of matching AVFrameSideDataType will be removed before the + * addition is attempted. + */ +AVFrameSideData *av_frame_side_data_set_new_entry(AVFrameSideDataSet *set, + enum AVFrameSideDataType type, + size_t size, + unsigned int flags); + /** * @} */ diff --git a/libavutil/tests/side_data_set.c b/libavutil/tests/side_data_set.c new file mode 100644 index 00..820b3aac44 --- /dev/null +++ b/libavutil/tests/side_data_set.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2023 Jan Ekström + * + * 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 +#include "libavutil/frame.c" +#include "libavutil/mastering_display_metadata.h" + +static void print_clls(const AVFrameSideDataSet set) +{ +for (int i = 0; i < set.nb_sd; i++) { +AVFrameSideData *sd = set.sd[i]; + +printf("sd %d, %s", + i, av_frame_side_data_name(sd->type)); + +if (sd->type != AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) { +putchar('\n'); +continue; +} + +printf(": M
[FFmpeg-devel] [PATCH v5 07/14] avutil/frame: add helper for adding existing side data to set
--- libavutil/frame.c | 50 +++ libavutil/frame.h | 16 +++ 2 files changed, 66 insertions(+) diff --git a/libavutil/frame.c b/libavutil/frame.c index 9ac3db430f..e42d9cb758 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -110,6 +110,24 @@ static void remove_side_data(AVFrameSideData ***sd, int *nb_side_data, } } +static void remove_side_data_by_entry(AVFrameSideData ***sd, + int *nb_side_data, + const AVFrameSideData *target) +{ +for (int i = *nb_side_data - 1; i >= 0; i--) { +AVFrameSideData *entry = ((*sd)[i]); +if (entry != target) +continue; + +free_side_data(&entry); + +((*sd)[i]) = ((*sd)[*nb_side_data - 1]); +(*nb_side_data)--; + +return; +} +} + AVFrame *av_frame_alloc(void) { AVFrame *frame = av_malloc(sizeof(*frame)); @@ -879,6 +897,38 @@ AVFrameSideData *av_frame_side_data_set_new_entry(AVFrameSideDataSet *set, return ret; } +int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst, + const AVFrameSideData *src, + unsigned int flags) +{ +if (!dst || !src) +return AVERROR(EINVAL); + +{ +AVBufferRef *buf= av_buffer_ref(src->buf); +AVFrameSideData *sd_dst = NULL; + +if (flags & AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES) +remove_side_data(&dst->sd, &dst->nb_sd, src->type); + +sd_dst = add_side_data_to_set_from_buf(dst, src->type, buf); +if (!sd_dst) { +av_buffer_unref(&buf); +return AVERROR(ENOMEM); +} + +{ +int ret = av_dict_copy(&sd_dst->metadata, src->metadata, 0); +if (ret < 0) { +remove_side_data_by_entry(&dst->sd, &dst->nb_sd, sd_dst); +return ret; +} +} + +return 0; +} +} + AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type) { diff --git a/libavutil/frame.h b/libavutil/frame.h index 093a76e30d..9295c868ef 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -1085,6 +1085,22 @@ AVFrameSideData *av_frame_side_data_set_new_entry(AVFrameSideDataSet *set, size_t size, unsigned int flags); +/** + * Add a new side data entry to a set based on existing side data. + * + * @param dst a set to which the side data should be added + * @param src side data which should be added to the set + * @param flags Some combination of AV_FRAME_SIDE_DATA_SET_FLAG_* flags, or 0. + * + * @return negative error code on failure, >=0 on success. In case of + * AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES being set, entries + * of matching AVFrameSideDataType will be removed before the + * addition is attempted. + */ +int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst, + const AVFrameSideData *src, + unsigned int flags); + /** * @} */ -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 08/14] avutil/frame: add helper for getting side data from set
--- libavutil/frame.c | 22 +- libavutil/frame.h | 12 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index e42d9cb758..e4004daa4b 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -929,16 +929,28 @@ int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst, } } -AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, -enum AVFrameSideDataType type) +AVFrameSideData *av_frame_side_data_set_get_entry(const AVFrameSideDataSet set, + enum AVFrameSideDataType type) { -for (int i = 0; i < frame->nb_side_data; i++) { -if (frame->side_data[i]->type == type) -return frame->side_data[i]; +for (int i = 0; i < set.nb_sd; i++) { +if (set.sd[i]->type == type) +return set.sd[i]; } return NULL; } +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, +enum AVFrameSideDataType type) +{ +return av_frame_side_data_set_get_entry( +(const AVFrameSideDataSet){ +.sd= frame->side_data, +.nb_sd = frame->nb_side_data +}, +type +); +} + static int frame_copy_video(AVFrame *dst, const AVFrame *src) { int planes; diff --git a/libavutil/frame.h b/libavutil/frame.h index 9295c868ef..e8517bf6ad 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -1101,6 +1101,18 @@ int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst, const AVFrameSideData *src, unsigned int flags); +/** + * Get a side data entry of a specific type from a set. + * + * @param set the set from which side data should be queried from + * @param type type of side data to be queried + * + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this set. + */ +AVFrameSideData *av_frame_side_data_set_get_entry(const AVFrameSideDataSet set, + enum AVFrameSideDataType type); + /** * @} */ -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 09/14] avcodec: add side data set to AVCodecContext
This allows configuring an encoder by using AVFrameSideData. --- libavcodec/avcodec.h | 7 +++ libavcodec/options.c | 1 + 2 files changed, 8 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7fb44e28f4..0c1a8ade49 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2116,6 +2116,13 @@ typedef struct AVCodecContext { * an error. */ int64_t frame_num; + +/** + * Set containing static side data, such as HDR10 CLL / MDCV structures. + * - encoding: set by user + * - decoding: unused + */ +AVFrameSideDataSet frame_sd_set; } AVCodecContext; /** diff --git a/libavcodec/options.c b/libavcodec/options.c index a9b35ee1c3..e42a29e834 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -180,6 +180,7 @@ void avcodec_free_context(AVCodecContext **pavctx) av_freep(&avctx->inter_matrix); av_freep(&avctx->rc_override); av_channel_layout_uninit(&avctx->ch_layout); +av_frame_side_data_set_uninit(&avctx->frame_sd_set); av_freep(pavctx); } -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 10/14] avcodec: add helper for configuring AVCodecContext's side data set
This allows API clients that wish to configure multiple entries at a time to do so without writing the looping code themselves. --- libavcodec/avcodec.c | 28 libavcodec/avcodec.h | 20 2 files changed, 48 insertions(+) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 2dda310e91..9b56af8114 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -718,3 +718,31 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr return ff_decode_receive_frame(avctx, frame); return ff_encode_receive_frame(avctx, frame); } + +int avcodec_configure_side_data(AVCodecContext *avctx, +const AVFrameSideDataSet *set, +unsigned int flags) +{ +if (!avctx) +return AVERROR(EINVAL); + +if (!set) { +av_frame_side_data_set_uninit(&avctx->frame_sd_set); +return 0; +} + +if (set->nb_sd > 0 && set->nb_sd == avctx->frame_sd_set.nb_sd && +set->sd == avctx->frame_sd_set.sd) +return AVERROR(EINVAL); + +for (int i = 0; i < set->nb_sd; i++) { +int ret = av_frame_side_data_set_entry_from_sd( +&avctx->frame_sd_set, set->sd[i], flags); +if (ret < 0) { +av_frame_side_data_set_uninit(&avctx->frame_sd_set); +return ret; +} +} + +return 0; +} diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 0c1a8ade49..40261594f1 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3154,6 +3154,26 @@ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); */ int avcodec_is_open(AVCodecContext *s); +/** + * Add multiple side data entries to an AVCodecContext set in one go, for + * example from an AVFrame. + * + * In case the function fails to add a side data entry, it will clear the + * whole side data set. + * + * @param avctx context to which the side data should be added + * @param set a set from which the side data should be added from. + *if null, clears out the side data for this context. + * @param flags Some combination of AV_FRAME_SIDE_DATA_SET_FLAG_* flags, or 0. + * + * @return negative error code on failure, >=0 on success. + * + * @see av_frame_side_data_set_new_entry regarding the flags. + */ +int avcodec_configure_side_data(AVCodecContext *avctx, +const AVFrameSideDataSet *set, +unsigned int flags); + /** * @} */ -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 11/14] ffmpeg: pass first video AVFrame's side data to encoder
This enables further configuration of output based on the results of input decoding and filtering in a similar manner as the color information. --- fftools/ffmpeg_enc.c | 13 + 1 file changed, 13 insertions(+) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index fa4539664f..8ec9cb7cd5 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -239,6 +239,19 @@ int enc_open(OutputStream *ost, const AVFrame *frame) enc_ctx->colorspace = frame->colorspace; enc_ctx->chroma_sample_location = frame->chroma_location; +ret = avcodec_configure_side_data( +enc_ctx, +&(const AVFrameSideDataSet){ +.sd= frame->side_data, +.nb_sd = frame->nb_side_data +}, +AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES); +if (ret < 0) { +av_log(NULL, AV_LOG_ERROR, "failed to configure video encoder: %s!\n", + av_err2str(ret)); +return ret; +} + if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) || (frame->flags & AV_FRAME_FLAG_INTERLACED) #if FFMPEG_OPT_TOP -- 2.43.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5 12/14] avcodec/libsvtav1: add support for writing out CLL and MDCV
These two were added in 28e23d7f348c78d49a726c7469f9d4e38edec341 and 3558c1f2e97455e0b89edef31b9a72ab7fa30550 for version 0.9.0 of SVT-AV1, which is also our minimum requirement right now. In other words, no additional version limiting conditions seem to be required. Additionally, add a FATE test which verifies that pass-through of the MDCV/CLL side data is working during encoding. --- libavcodec/libsvtav1.c | 67 ++ tests/fate/enc_external.mak| 5 +++ tests/ref/fate/libsvtav1-hdr10 | 14 +++ 3 files changed, 86 insertions(+) create mode 100644 tests/ref/fate/libsvtav1-hdr10 diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 862192945b..ee75570c00 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -27,6 +27,8 @@ #include "libavutil/common.h" #include "libavutil/frame.h" #include "libavutil/imgutils.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/mastering_display_metadata.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavutil/avassert.h" @@ -146,6 +148,69 @@ static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc) } +static void handle_mdcv(struct EbSvtAv1MasteringDisplayInfo *dst, +const AVMasteringDisplayMetadata *mdcv) +{ +if (mdcv->has_primaries) { +const struct EbSvtAv1ChromaPoints *const points[] = { +&dst->r, +&dst->g, +&dst->b, +}; + +for (int i = 0; i < 3; i++) { +const struct EbSvtAv1ChromaPoints *dst = points[i]; +const AVRational *src = mdcv->display_primaries[i]; + +AV_WB16(&dst->x, +av_rescale_q(1, src[0], (AVRational){ 1, (1 << 16) })); +AV_WB16(&dst->y, +av_rescale_q(1, src[1], (AVRational){ 1, (1 << 16) })); +} + +AV_WB16(&dst->white_point.x, +av_rescale_q(1, mdcv->white_point[0], + (AVRational){ 1, (1 << 16) })); +AV_WB16(&dst->white_point.y, +av_rescale_q(1, mdcv->white_point[1], + (AVRational){ 1, (1 << 16) })); +} + +if (mdcv->has_luminance) { +AV_WB32(&dst->max_luma, +av_rescale_q(1, mdcv->max_luminance, + (AVRational){ 1, (1 << 8) })); +AV_WB32(&dst->min_luma, +av_rescale_q(1, mdcv->min_luminance, + (AVRational){ 1, (1 << 14) })); +} +} + +static void handle_side_data(AVCodecContext *avctx, + EbSvtAv1EncConfiguration *param) +{ +const AVFrameSideDataSet set = avctx->frame_sd_set; +const AVFrameSideData *cll_sd = +av_frame_side_data_set_get_entry( +set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); +const AVFrameSideData *mdcv_sd = +av_frame_side_data_set_get_entry( +set, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); + +if (cll_sd) { +const AVContentLightMetadata *cll = +(AVContentLightMetadata *)cll_sd->data; + +AV_WB16(¶m->content_light_level.max_cll, cll->MaxCLL); +AV_WB16(¶m->content_light_level.max_fall, cll->MaxFALL); +} + +if (mdcv_sd) { +handle_mdcv(¶m->mastering_display, +(AVMasteringDisplayMetadata *)mdcv_sd->data); +} +} + static int config_enc_params(EbSvtAv1EncConfiguration *param, AVCodecContext *avctx) { @@ -280,6 +345,8 @@ FF_ENABLE_DEPRECATION_WARNINGS /* 2 = IDR, closed GOP, 1 = CRA, open GOP */ param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 1; +handle_side_data(avctx, param); + #if SVT_AV1_CHECK_VERSION(0, 9, 1) while ((en = av_dict_get(svt_enc->svtav1_opts, "", en, AV_DICT_IGNORE_SUFFIX))) { EbErrorType ret = svt_av1_enc_parse_parameter(param, en->key, en->value); diff --git a/tests/fate/enc_external.mak b/tests/fate/enc_external.mak index 7eabebcc51..d787941c16 100644 --- a/tests/fate/enc_external.mak +++ b/tests/fate/enc_external.mak @@ -2,5 +2,10 @@ FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX264 H264, MOV, H264_DEMUXER) += fate-libx26 fate-libx264-simple: CMD = enc_external $(TARGET_SAMPLES)/h264-conformance/BA1_Sony_D.jsv \ mp4 "-c:v libx264" "-show_entries frame=width,height,pix_fmt,pts,pkt_dts -of flat" +# test for SVT-AV1 MDCV and CLL passthrough during encoding +FATE_ENC_EXTERNAL-$(call ENCDEC, LIBSVTAV1 HEVC, MOV, HEVC_DEMUXER LIBDAV1D_DECODER) += fate-libsvtav1-hdr10 +fate-libsvtav1-hdr10: CMD = enc_external $(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc \ +mp4 "-c:v libsvtav1" "-show_frames -show_entries frame=side_data_list -of flat" + FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_ENC_EXTERNAL-yes) fate-enc-external: $(FATE_ENC_EXTERNAL-yes) diff --git a/tests/ref/fate/libsvtav1-hdr10 b/tests/ref/fate/libsvtav1-hdr10 new file mode 100644 index 00.
[FFmpeg-devel] [PATCH v5 13/14] avcodec/libx264: add support for writing out CLL and MDCV
Both of these two structures were first available with X264_BUILD 163, so make relevant functionality conditional on the version being at least such. Keep handle_side_data available in all cases as this way X264_init does not require additional version based conditions within it. Finally, add a FATE test which verifies that pass-through of the MDCV/CLL side data is working during encoding. --- configure| 2 + libavcodec/libx264.c | 78 tests/fate/enc_external.mak | 5 +++ tests/ref/fate/libx264-hdr10 | 15 +++ 4 files changed, 100 insertions(+) create mode 100644 tests/ref/fate/libx264-hdr10 diff --git a/configure b/configure index 838e627084..1b51fa7767 100755 --- a/configure +++ b/configure @@ -2514,6 +2514,7 @@ CONFIG_EXTRA=" jpegtables lgplv3 libx262 +libx264_hdr10 llauddsp llviddsp llvidencdsp @@ -6873,6 +6874,7 @@ enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x require_cpp_condition libx264 x264.h "X264_BUILD >= 122" && { [ "$toolchain" != "msvc" ] || require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; } && + check_cpp_condition libx264_hdr10 x264.h "X264_BUILD >= 163" && check_cpp_condition libx262 x264.h "X264_MPEG2" enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get && require_cpp_condition libx265 x265.h "X265_BUILD >= 89" diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 182e20f622..9177c5d1c8 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -25,6 +25,7 @@ #include "libavutil/eval.h" #include "libavutil/internal.h" #include "libavutil/opt.h" +#include "libavutil/mastering_display_metadata.h" #include "libavutil/mem.h" #include "libavutil/pixdesc.h" #include "libavutil/stereo3d.h" @@ -871,6 +872,81 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt) return AVERROR(EINVAL);\ } +#if CONFIG_LIBX264_HDR10 +static void handle_mdcv(x264_param_t *params, +const AVMasteringDisplayMetadata *mdcv) +{ +if (!mdcv->has_primaries && !mdcv->has_luminance) +return; + +params->mastering_display.b_mastering_display = 1; + +if (mdcv->has_primaries) { +int *const points[][2] = { +{ +¶ms->mastering_display.i_red_x, +¶ms->mastering_display.i_red_y +}, +{ +¶ms->mastering_display.i_green_x, +¶ms->mastering_display.i_green_y +}, +{ +¶ms->mastering_display.i_blue_x, +¶ms->mastering_display.i_blue_y +}, +}; + +for (int i = 0; i < 3; i++) { +const AVRational *src = mdcv->display_primaries[i]; +int *dst[2] = { points[i][0], points[i][1] }; + +*dst[0] = av_rescale_q(1, src[0], (AVRational){ 1, 5 }); +*dst[1] = av_rescale_q(1, src[1], (AVRational){ 1, 5 }); +} + +params->mastering_display.i_white_x = +av_rescale_q(1, mdcv->white_point[0], (AVRational){ 1, 5 }); +params->mastering_display.i_white_y = +av_rescale_q(1, mdcv->white_point[1], (AVRational){ 1, 5 }); +} + +if (mdcv->has_luminance) { +params->mastering_display.i_display_max = +av_rescale_q(1, mdcv->max_luminance, (AVRational){ 1, 1 }); +params->mastering_display.i_display_min = +av_rescale_q(1, mdcv->min_luminance, (AVRational){ 1, 1 }); +} +} +#endif // CONFIG_LIBX264_HDR10 + +static void handle_side_data(AVCodecContext *avctx, x264_param_t *params) +{ +#if CONFIG_LIBX264_HDR10 +const AVFrameSideDataSet set = avctx->frame_sd_set; +const AVFrameSideData *cll_sd = +av_frame_side_data_set_get_entry( +set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); +const AVFrameSideData *mdcv_sd = +av_frame_side_data_set_get_entry( +set, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); + +if (cll_sd) { +const AVContentLightMetadata *cll = +(AVContentLightMetadata *)cll_sd->data; + +params->content_light_level.i_max_cll = cll->MaxCLL; +params->content_light_level.i_max_fall = cll->MaxFALL; + +params->content_light_level.b_cll = 1; +} + +if (mdcv_sd) { +handle_mdcv(params, (AVMasteringDisplayMetadata *)mdcv_sd->data); +} +#endif // CONFIG_LIBX264_HDR10 +} + static av_cold int X264_init(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; @@ -1171,6 +1247,8 @@ FF_ENABLE_DEPRECATION_WARNINGS if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) x4->params.vui.i_chroma_loc = avctx->chroma_sample_location - 1; +handle_side_data(av
[FFmpeg-devel] [PATCH v5 14/14] avcodec/libx265: add support for writing out CLL and MDCV
The newer of these two are the separate integers for content light level, introduced in 3952bf3e98c76c31594529a3fe34e056d3e3e2ea , with X265_BUILD 75. As we already require X265_BUILD of at least 89, no further conditions are required. --- libavcodec/libx265.c | 87 tests/fate/enc_external.mak | 5 +++ tests/ref/fate/libx265-hdr10 | 16 +++ 3 files changed, 108 insertions(+) create mode 100644 tests/ref/fate/libx265-hdr10 diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 447e6da25f..96e50a6223 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -28,9 +28,11 @@ #include #include "libavutil/avassert.h" +#include "libavutil/bprint.h" #include "libavutil/buffer.h" #include "libavutil/internal.h" #include "libavutil/common.h" +#include "libavutil/mastering_display_metadata.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avcodec.h" @@ -179,6 +181,84 @@ static av_cold int libx265_param_parse_int(AVCodecContext *avctx, return 0; } +static int handle_mdcv(const AVClass **avcl, const x265_api *api, + x265_param *params, + const AVMasteringDisplayMetadata *mdcv) +{ +int ret = AVERROR_BUG; +AVBPrint buf; +av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); + +// G(%hu,%hu)B(%hu,%hu)R(%hu,%hu)WP(%hu,%hu)L(%u,%u) +av_bprintf( +&buf, +"G(%"PRId64",%"PRId64")B(%"PRId64",%"PRId64")R(%"PRId64",%"PRId64")" +"WP(%"PRId64",%"PRId64")L(%"PRId64",%"PRId64")", +av_rescale_q(1, mdcv->display_primaries[1][0], (AVRational){ 1, 5 }), +av_rescale_q(1, mdcv->display_primaries[1][1], (AVRational){ 1, 5 }), +av_rescale_q(1, mdcv->display_primaries[2][0], (AVRational){ 1, 5 }), +av_rescale_q(1, mdcv->display_primaries[2][1], (AVRational){ 1, 5 }), +av_rescale_q(1, mdcv->display_primaries[0][0], (AVRational){ 1, 5 }), +av_rescale_q(1, mdcv->display_primaries[0][1], (AVRational){ 1, 5 }), +av_rescale_q(1, mdcv->white_point[0], (AVRational){ 1, 5 }), +av_rescale_q(1, mdcv->white_point[1], (AVRational){ 1, 5 }), +av_rescale_q(1, mdcv->max_luminance, (AVRational){ 1, 1 }), +av_rescale_q(1, mdcv->min_luminance, (AVRational){ 1, 1 })); + +if (!av_bprint_is_complete(&buf)) { +av_log(avcl, AV_LOG_ERROR, + "MDCV string too long for its available space!\n"); +ret = AVERROR(ENOMEM); +goto end; +} + +if (api->param_parse(params, "master-display", buf.str) == +X265_PARAM_BAD_VALUE) { +av_log(avcl, AV_LOG_ERROR, + "Invalid value \"%s\" for param \"master-display\".\n", + buf.str); +ret = AVERROR(EINVAL); +goto end; +} + +ret = 0; + +end: +av_bprint_finalize(&buf, NULL); + +return ret; +} + +static int handle_side_data(AVCodecContext *avctx, const x265_api *api, +x265_param *params) +{ +const AVFrameSideDataSet set = avctx->frame_sd_set; +const AVFrameSideData *cll_sd = +av_frame_side_data_set_get_entry( +set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); +const AVFrameSideData *mdcv_sd = +av_frame_side_data_set_get_entry( +set, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); + +if (cll_sd) { +const AVContentLightMetadata *cll = +(AVContentLightMetadata *)cll_sd->data; + +params->maxCLL = cll->MaxCLL; +params->maxFALL = cll->MaxFALL; +} + +if (mdcv_sd) { +int ret = handle_mdcv( +&avctx->av_class, api, params, +(AVMasteringDisplayMetadata *)mdcv_sd->data); +if (ret < 0) +return ret; +} + +return 0; +} + static av_cold int libx265_encode_init(AVCodecContext *avctx) { libx265Context *ctx = avctx->priv_data; @@ -339,6 +419,13 @@ FF_ENABLE_DEPRECATION_WARNINGS return AVERROR_BUG; } +ret = handle_side_data(avctx, ctx->api, ctx->params); +if (ret < 0) { +av_log(avctx, AV_LOG_ERROR, "Failed handling side data! (%s)\n", + av_err2str(ret)); +return ret; +} + if (ctx->crf >= 0) { char crf[6]; diff --git a/tests/fate/enc_external.mak b/tests/fate/enc_external.mak index 4095a4b51a..30021efbcd 100644 --- a/tests/fate/enc_external.mak +++ b/tests/fate/enc_external.mak @@ -12,5 +12,10 @@ FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX264 HEVC, MOV, LIBX264_HDR10 HEVC_DEMUXER H fate-libx264-hdr10: CMD = enc_external $(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc \ mp4 "-c:v libx264" "-show_frames -show_entries frame=side_data_list -of flat" +# test for x265 MDCV and CLL passthrough during encoding +FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX265 HEVC, MOV, HEVC_DEMUXER) += fate-libx265-hdr10 +fate-libx265-hdr10: CMD = enc_external $(TARGET_SAMPLES)/hevc/hdr10_plus_h26
Re: [FFmpeg-devel] [PATCH] checkasm: add test for dcmul_add
This is a bit confusing for me.. I tried pulling the latest code, and then used `git am checkasm-test-for-dcmul_add.patch` without any patch corruption. Rémi Denis-Courmont 于2023年11月27日周一 03:36写道: > Le sunnuntaina 19. marraskuuta 2023, 0.28.10 EET flow gg a écrit : > > From 2785ce57f68dbb2373c951b9432afa73796f7cc1 Mon Sep 17 00:00:00 2001 > > From: sunyuechi > > Date: Sat, 18 Nov 2023 10:58:17 +0800 > > Subject: [PATCH] checkasm: test for dcmul_add > > git-am reports the patch corrupt. > > -- > Rémi Denis-Courmont > http://www.remlab.net/ > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/jpegxl_parser: fix parsing sequences of extremely small files
On 11/26/23 13:07, Thilo Borgmann wrote: Am 26.11.2023 um 14:47 schrieb Leo Izen : On 11/26/23 05:56, Anton Khirnov wrote: Would be nice to have tests for these. I have a sample at: https://buzo.us/l.jxl It would test both of these patches. I can send a fate test for these to the ML if the sample gets uploaded. I CC'd samples-requ...@ffmpeg.org as well. Can do this in a bit. What about the file you‘d sent to samples-request in August, is there still a test to be pushed about it as well? -Thilo There is not, that sample from August was already uploaded and the fate test utilizing it has been merged. - Leo Izen (Traneptora) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1] lavc/vaapi_encode_av1: Add qp option explicitly to set base q index
From: Fei Wang Keep same way with librav1e/libsvtav1/qsv_av1.. to make it more acceptable instead of using global option "-global_quality". Fix #10615 Signed-off-by: Fei Wang --- doc/encoders.texi | 1 + libavcodec/vaapi_encode_av1.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 27a9acf076..2cffc32daf 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -4079,6 +4079,7 @@ Each encoder also has its own specific options: @table @option @item av1_vaapi +@option{qp} sets the value of @emph{base_q_index}. @option{profile} sets the value of @emph{seq_profile}. @option{tier} sets the value of @emph{seq_tier}. @option{level} sets the value of @emph{seq_level_idx}. diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c index 5a9ff0f798..2e327fec5a 100644 --- a/libavcodec/vaapi_encode_av1.c +++ b/libavcodec/vaapi_encode_av1.c @@ -79,6 +79,7 @@ typedef struct VAAPIEncodeAV1Context { int cdef_param_size; /** user options */ +int qp; int profile; int level; int tier; @@ -786,6 +787,9 @@ static av_cold int vaapi_encode_av1_init(AVCodecContext *avctx) return AVERROR(EINVAL); } +if (priv->qp > 0) +ctx->explicit_qp = priv->qp; + ret = ff_vaapi_encode_init(avctx); if (ret < 0) return ret; @@ -864,6 +868,8 @@ static av_cold int vaapi_encode_av1_close(AVCodecContext *avctx) static const AVOption vaapi_encode_av1_options[] = { VAAPI_ENCODE_COMMON_OPTIONS, VAAPI_ENCODE_RC_OPTIONS, +{ "qp", "Base q index (for P-frames; scaled by qfactor/qoffset for I/B)", + OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 255, FLAGS }, { "profile", "Set profile (seq_profile)", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, FLAGS, "profile" }, -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_d3d11va: Add option vendor_id
On So, 2023-11-26 at 11:49 +0100, Anton Khirnov wrote: > Quoting Xiang, Haihao (2023-11-24 06:43:46) > > From: Artem Galin > > > > User may choose the hardware via option vendor_id when multiple hardware > > are available. > > > > Signed-off-by: Artem Galin > > Signed-off-by: Haihao Xiang > > --- > > libavutil/hwcontext_d3d11va.c | 67 ++- > > 1 file changed, 66 insertions(+), 1 deletion(-) > > > > diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > > index cc8c97d2b6..a6777b70a1 100644 > > --- a/libavutil/hwcontext_d3d11va.c > > +++ b/libavutil/hwcontext_d3d11va.c > > @@ -552,6 +552,55 @@ static void d3d11va_device_uninit(AVHWDeviceContext > > *hwdev) > > } > > } > > > > +static int d3d11va_device_find_adapter_by_vendor_id(AVHWDeviceContext *ctx, > > uint32_t flags, const char *vendor_id) > > +{ > > + HRESULT hr; > > + IDXGIAdapter *adapter = NULL; > > + IDXGIFactory2 *factory; > > + int adapter_id = 0; > > + long int id = strtol(vendor_id, NULL, 0); > > + > > + hr = mCreateDXGIFactory(&IID_IDXGIFactory2, (void **)&factory); > > + if (FAILED(hr)) { > > + av_log(ctx, AV_LOG_ERROR, "CreateDXGIFactory returned error\n"); > > + return -1; > > + } > > + > > + while (IDXGIFactory2_EnumAdapters(factory, adapter_id++, &adapter) != > > DXGI_ERROR_NOT_FOUND) { > > + ID3D11Device* device = NULL; > > + DXGI_ADAPTER_DESC adapter_desc; > > + > > + hr = mD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, > > flags, NULL, 0, D3D11_SDK_VERSION, &device, NULL, NULL); > > + if (FAILED(hr)) { > > + av_log(ctx, AV_LOG_ERROR, "D3D11CreateDevice returned > > error\n"); > > This should not be AV_LOG_ERROR, since it does not result in failure. > > > + > > + if (adapter) > > I'd expect adapter to be always non-NULL here. Same below, also for > device.. Thanks for the comments, I'll update the patch BRs Haihao > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] swscale: don't assign range converters for float
> > From: Niklas Haas > > > > This logic was incongruent with logic used elsewhere, where floating > > point formats are explicitly exempted from range conversion. Fixes an > > issue where floating point formats were not going through special > > unscaled converters even when it was otherwise possible. > > --- > > libswscale/swscale.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/libswscale/swscale.c b/libswscale/swscale.c > > index 46ba68fe6a..a66db22767 100644 > > --- a/libswscale/swscale.c > > +++ b/libswscale/swscale.c > > @@ -534,7 +534,8 @@ av_cold void ff_sws_init_range_convert(SwsContext > > *c) > > { > > c->lumConvertRange = NULL; > > c->chrConvertRange = NULL; > > -if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) { > > +if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) && > > +!isFloat(c->srcFormat) && !isFloat(c->dstFormat)) { > > if (c->dstBpc <= 14) { > > if (c->srcRange) { > > c->lumConvertRange = lumRangeFromJpeg_c; > > -- > > 2.42.0 > > > > This patchset works for me. Thanks for your quick fixing. Ping. When can this patchset be merged? Thanks Wenbin > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] lavu/hwcontext_qsv: Make sure hardware vendor is Intel for qsv on d3d11va
On So, 2023-11-26 at 11:51 +0100, Anton Khirnov wrote: > Quoting Xiang, Haihao (2023-11-24 06:43:48) > > From: Haihao Xiang > > > > When multiple hardware are available, the default one might not be > > Intel Hareware. We can use option vendor_id to choose the required > > vendor. > > > > Tested-by: Artem Galin > > Signed-off-by: Haihao Xiang > > --- > > libavutil/hwcontext_qsv.c | 6 ++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c > > index 1bfda9e69b..7a9cd0cc37 100644 > > --- a/libavutil/hwcontext_qsv.c > > +++ b/libavutil/hwcontext_qsv.c > > @@ -2200,6 +2200,12 @@ static int qsv_device_create(AVHWDeviceContext *ctx, > > const char *device, > > #endif > > #if CONFIG_D3D11VA > > case AV_HWDEVICE_TYPE_D3D11VA: > > + { > > Useless braces. Yes, they are useless. Adding braces here is to keep the code style consistent in this file. Thanks Haihao > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] tools/general_assembly: implement extra GA members
> On Nov 26, 2023, at 23:08, Alexander Strasser wrote: > > On 2023-11-26 10:18 +0100, Anton Khirnov wrote: >> Set pushed. >> >> The general_assembly.pl script should now be usable as the authoritative >> source for GA members. > > The patches mostly LGTM. > > My Perl knowledge in general is really mostly from 20 years ago. > So if there is any Perl-ish devil in the details I surely have > overlooked it. > > Please pardon me if I missed any details on how the program works. > The edge cases are always the tricky stuff... > > One thing about this patch and that program in general is a bit > unfortunate: The use of PerlDate is_between. > > Here is the doc I found for it: > >$dt->is_between( $lower, $upper ) >Checks whether $dt is strictly between two other DateTime objects. > >"Strictly" means that $dt must be greater than $lower and less than > $upper. If it is equal to either object then this method returns false. > > > AFAIU it affects the script in 2 places: > > 1. In subroutine get_date_range: > Here the exact day matching date_ga_rule is treated like > anything >= date_first_regular > > 2. In the loop adding the extra member. The member would not be added > on both, the day they were elected nor the day 2 years after. > > Case 1 should be "strictly academical" and thus not really important > because to my knowledge no vote was started on that day. > > For case 2 it will be not important on most days, but it would seem > more common and intuitive to use either the closed interval or a > half open interval. Where including the first and the last day or > including the first and excluding the day seem most natural to me. > > > Best regards, > Alexander > > > P.S. > As date calculations always turn out nightmares if you look at them > long enough, it would possible be a good idea to always use UTC and > review how time zones are handled in git CLI. > > P.P.S. > For quick reference follow copies for both places referenced above: > > Case 1: >sub get_date_range { >my ($now) = @_; > ># date on which the GA update rule was established, and the voter list ># was extraordinarily updated; cf.: ># * > http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-October/316054.html ># Message-Id > <169818211998.11195.16532637803201641...@lain.khirnov.net> ># * > http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-November/316618.html ># Message-Id > <5efcab06-8510-4226-bf18-68820c7c6...@betaapp.fastmail.com> >my $date_ga_rule = DateTime->new(year => 2023, month => 11, day > => 06); ># date when the regular update rule is first applied >my $date_first_regular = DateTime->new(year => 2024); > >if ($now->is_between($date_ga_rule, $date_first_regular)) { >return ($date_ga_rule->clone()->set_year($date_ga_rule->year - 3), > $date_ga_rule); >} > >if ($now < $date_ga_rule) { >print STDERR "GA before $date_ga_rule is not well-defined, be > very careful with the output\n"; >} > >my $cur_year_jan = $now->clone()->truncate(to => "year"); >my $cur_year_jul = $cur_year_jan->clone()->set_month(7); >my $date_until= $now > $cur_year_jul ? $cur_year_jul : > $cur_year_jan; >my $date_since= $date_until->clone()->set_year($date_until->year - > 3); > >return ($date_since, $date_until); >} > > > Case 2: >foreach my $entry (@extra_members) { >my $elected = $entry->[2]; >if ($date->is_between($elected, > $elected->clone()->set_year($elected->year + 2))) { >$assembly{$entry->[0]} = $entry->[1]; >} >} I can only say wow as I know zero about perl. Is it the same reason to write it in perl as automake so it can be run everywhere? > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_vaapi: ignore nonexistent device in default DRM device selection
On So, 2023-11-26 at 11:55 +0100, Anton Khirnov wrote: > Quoting Xiang, Haihao (2023-11-24 07:17:36) > > From: Haihao Xiang > > > > It is possible that renderD128 doesn't exist but renderD129 is > > available in a system (see [1]). This change can make sure the default > > DRM device selection works even if renderD128 doesn't exist. > > > > [1] > > https://github.com/intel/intel-device-plugins-for-kubernetes/blob/main/cmd/gpu_plugin/README.md#issues-with-media-workloads-on-multi-gpu-setups > > > > Signed-off-by: Haihao Xiang > > --- > > libavutil/hwcontext_vaapi.c | 14 -- > > 1 file changed, 12 insertions(+), 2 deletions(-) > > > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > > index 12bc95119a..6d542a9bc9 100644 > > --- a/libavutil/hwcontext_vaapi.c > > +++ b/libavutil/hwcontext_vaapi.c > > @@ -1733,8 +1733,18 @@ static int vaapi_device_create(AVHWDeviceContext > > *ctx, const char *device, > > "/dev/dri/renderD%d", 128 + n); > > priv->drm_fd = open(path, O_RDWR); > > if (priv->drm_fd < 0) { > > - av_log(ctx, AV_LOG_VERBOSE, "Cannot open " > > - "DRM render node for device %d.\n", n); > > + if (errno == ENOENT) { > > + if (n != max_devices - 1) { > > + av_log(ctx, AV_LOG_VERBOSE, > > + "No render device %s, try next device > > for " > > + "DRM render node.\n", path); > > + continue; > > + } else > > + av_log(ctx, AV_LOG_VERBOSE, "No avaialbe render > > device " > > Typo in 'available'. Thanks for catching this typo > > Also, the else is unnecessary since the if() block ends with continue. > I wanted to print a message if all devices don't exist. I'll remove it in the new version if you think such info is unnecessary. BRs Haihao ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] lavu/hwcontext_qsv: use mfxImplDescription instead of mfxExtendedDeviceId on Linux
From: Haihao Xiang mfxExtendedDeviceId mightn't be supported in certain configurations of oneVPL on Linux, so we can't ensure a property filter for mfxExtendedDeviceId.DeviceID or mfxExtendedDeviceId.VendorID works as expected. This fixed the issue mentioned in [1] [1] http://ffmpeg.org/pipermail/ffmpeg-user/2023-October/056983.html Signed-off-by: Haihao Xiang --- libavutil/hwcontext_qsv.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 1bfda9e69b..7f4a0fda0f 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -821,7 +821,7 @@ static int qsv_va_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) impl_value.Type = MFX_VARIANT_TYPE_U16; impl_value.Data.U16 = (attr.value & 0x); sts = MFXSetConfigFilterProperty(cfg, - (const mfxU8 *)"mfxExtendedDeviceId.DeviceID", impl_value); + (const mfxU8 *)"mfxImplDescription.mfxDeviceDescription.DeviceID", impl_value); if (sts != MFX_ERR_NONE) { av_log(ctx, AV_LOG_ERROR, "Error adding a MFX configuration" "DeviceID property: %d.\n", sts); @@ -893,10 +893,10 @@ static int qsv_new_mfx_loader(void *ctx, goto fail; } -impl_value.Type = MFX_VARIANT_TYPE_U16; -impl_value.Data.U16 = 0x8086; // Intel device only +impl_value.Type = MFX_VARIANT_TYPE_U32; +impl_value.Data.U32 = 0x8086; // Intel device only sts = MFXSetConfigFilterProperty(cfg, - (const mfxU8 *)"mfxExtendedDeviceId.VendorID", impl_value); + (const mfxU8 *)"mfxImplDescription.VendorID", impl_value); if (sts != MFX_ERR_NONE) { av_log(ctx, AV_LOG_ERROR, "Error adding a MFX configuration" "VendorID property: %d.\n", sts); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: use mfxImplDescription instead of mfxExtendedDeviceId on Linux
On So, 2023-11-26 at 11:35 +0100, Anton Khirnov wrote: > Quoting Xiang, Haihao (2023-11-24 08:38:52) > > From: Haihao Xiang > > > > This fixed the issue mentioned in [1] > > > > [1] http://ffmpeg.org/pipermail/ffmpeg-user/2023-October/056983.html > > Commit messages should be meaningful on their own, without referring to > external sources. > Updated in v2 https://ffmpeg.org/pipermail/ffmpeg-devel/2023-November/317439.html Thanks Haihao ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] lavc/qsvdec: return 0 if more data is required
From: Haihao Xiang The type of qsv decoders is FF_CODEC_CB_TYPE_DECODE which must not return AVERROR(EAGAIN). commit 42b20c9 added an assertion to check the returned value. Signed-off-by: Haihao Xiang --- libavcodec/qsvdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index da700f25e9..b501964089 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -1076,6 +1076,9 @@ static int qsv_decode_frame(AVCodecContext *avctx, AVFrame *frame, ret = qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->buffer_pkt); if (ret < 0){ +if (ret == AVERROR(EAGAIN)) +ret = 0; + /* Drop buffer_pkt when failed to decode the packet. Otherwise, the decoder will keep decoding the failure packet. */ av_packet_unref(&s->buffer_pkt); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] lavc/qsvdec: reduce info message when more data is required
From: Haihao Xiang demote the info to AV_LOG_VERBOSE Signed-off-by: Haihao Xiang --- libavcodec/qsvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index b501964089..559f63698a 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -917,7 +917,7 @@ static int qsv_process_data(AVCodecContext *avctx, QSVContext *q, ret = qsv_decode_header(avctx, q, pkt, pix_fmt, ¶m); if (ret < 0) { if (ret == AVERROR(EAGAIN)) -av_log(avctx, AV_LOG_INFO, "More data is required to decode header\n"); +av_log(avctx, AV_LOG_VERBOSE, "More data is required to decode header\n"); else av_log(avctx, AV_LOG_ERROR, "Error decoding header\n"); goto reinit_fail; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".