[FFmpeg-devel] [PATCH 1/2] avformat/mxf: start to add mxf_inspect_mode and skip RIP if needed sponsored by nxtedition
--- libavformat/mxfdec.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index a5863445ab5..df958819300 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -321,6 +321,7 @@ typedef struct MXFContext { int nb_index_tables; MXFIndexTable *index_tables; int eia608_extract; +int mxf_inspect_mode; } MXFContext; /* NOTE: klv_offset is not set (-1) for local keys */ @@ -3713,7 +3714,9 @@ static int mxf_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; mxf->run_in = run_in; -mxf_read_random_index_pack(s); +if (mxf->mxf_inspect_mode == 0) { +mxf_read_random_index_pack(s); +} while (!avio_feof(s->pb)) { const MXFMetadataReadTableEntry *metadata; @@ -4261,6 +4264,15 @@ static const AVOption options[] = { { "eia608_extract", "extract eia 608 captions from s436m track", offsetof(MXFContext, eia608_extract), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, +{ "mxf_inspect_mode", "the way to inspect MXF file", + offsetof(MXFContext, mxf_inspect_mode), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, + AV_OPT_FLAG_DECODING_PARAM, .unit = "mxf_inspect_mode" }, +{ "rip", "Parse RIP, then every body partition", + 0, AV_OPT_TYPE_CONST, {.i64 = 0}, INT_MIN, INT_MAX, + AV_OPT_FLAG_DECODING_PARAM, .unit = "mxf_inspect_mode" }, +{ "header", "Parse Header, first partition and next partitions if needed", + 0, AV_OPT_TYPE_CONST, {.i64 = 1}, INT_MIN, INT_MAX, + AV_OPT_FLAG_DECODING_PARAM, .unit = "mxf_inspect_mode" }, { NULL }, }; -- 2.39.3 (Apple Git-146) ___ 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] avformat/mxf: stop parsing if index table is coherent
sponsored by nxtedition --- libavformat/mxfdec.c | 56 1 file changed, 56 insertions(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index df958819300..83f9e5fc9e0 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2063,6 +2063,52 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta return 0; } +static int mxf_validate_coherent_index_tables(MXFContext *mxf, int *is_coherent) { + int i, j, ret, nb_sorted_segments = 0; + MXFIndexTable *index_tables; + int nb_index_tables = 0; + int coherent_index_tables = 1; + MXFIndexTableSegment **sorted_segments = NULL; + + ret = mxf_get_sorted_table_segments(mxf, &nb_sorted_segments, &sorted_segments); + + index_tables = av_calloc(nb_index_tables, sizeof(MXFIndexTable)); + if (!index_tables) { + av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n"); + av_free(sorted_segments); + return AVERROR(ENOMEM); + } + + /* distribute sorted segments to index tables */ + for (i = j = 0; i < nb_sorted_segments; i++) { + if (i != 0 && sorted_segments[i-1]->index_sid != sorted_segments[i]->index_sid) { + /* next IndexSID */ + j++; + } + + index_tables[j].nb_segments++; + } + + for (i = j = 0; j < nb_index_tables; i += index_tables[j++].nb_segments) { + if (sorted_segments[i]->index_start_position) { + av_log(mxf->fc, AV_LOG_WARNING, "IndexSID %i starts at EditUnit %"PRId64" - seeking may not work as expected\n", + sorted_segments[i]->index_sid, sorted_segments[i]->index_start_position); + coherent_index_tables = 0; + } + } + + av_free(sorted_segments); + + if (ret == 0 && coherent_index_tables) { +*is_coherent = 1; + } else { +*is_coherent = 0; + } + + return 0; +} + + /** * Sorts and collects index table segments into index tables. * Also computes PTSes if possible. @@ -3752,6 +3798,16 @@ static int mxf_read_header(AVFormatContext *s) if (!essence_offset) essence_offset = klv.offset; +if (mxf->mxf_inspect_mode == 1) { +int ret_local, coherent_index_tables; +ret_local = mxf_validate_coherent_index_tables(mxf, &coherent_index_tables); + +// Break only if index table is coherent +if (ret_local == 0 && coherent_index_tables == 1) { + break; +} +} + /* seek to footer, previous partition or stop */ if (mxf_parse_handle_essence(mxf) <= 0) break; -- 2.39.3 (Apple Git-146) ___ 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] [FEATURE] Cut a video (-ss) with timings non-aligned on keyframes, with minimal re-encoding
> > Do you think it would be worth developing a command-line option so that > > exact cutting with minimal re-encoding would be easier? > > How do you plan to figure out the options needed to be passed to each > and every encoder, so that it'll produce compatible output to enable the > necessary concatenation of old and new encoded data? > > That's by far the biggest roadblock I see with this. I see. You're right, then this technique is probably a dead-end... More generally, which is the recommanded way to cut a video with a specific starting point and specific length, with minimal re-encoding? Millions of hours of CPU-time are probably wasted to reencode already-perfectly-encoded content, just for cutting ;) Are there already promising dev attempts in the direction of a feature able to cut with minimal re-encoding? ___ 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] vulkan: remove AVClass * from the context, use a logging pointer
Lynne via ffmpeg-devel: > The issue is that VulkanContext mostly always used the AVClass * > from its structure, which we don't set in decode. > --- > libavcodec/vulkan_decode.c| 2 ++ > libavfilter/vf_avgblur_vulkan.c | 2 ++ > libavfilter/vf_blend_vulkan.c | 2 ++ > libavfilter/vf_bwdif_vulkan.c | 4 +-- > libavfilter/vf_chromaber_vulkan.c | 2 ++ > libavfilter/vf_flip_vulkan.c | 2 ++ > libavfilter/vf_gblur_vulkan.c | 2 ++ > libavfilter/vf_libplacebo.c | 2 ++ > libavfilter/vf_nlmeans_vulkan.c | 2 ++ > libavfilter/vf_overlay_vulkan.c | 2 ++ > libavfilter/vf_scale_vulkan.c | 2 ++ > libavfilter/vf_transpose_vulkan.c | 2 ++ > libavfilter/vf_xfade_vulkan.c | 2 ++ > libavfilter/vsrc_testsrc_vulkan.c | 2 ++ > libavfilter/vulkan_filter.c | 33 ++ > libavfilter/vulkan_filter.h | 4 +++ > libavutil/vulkan.c| 46 +++ > libavutil/vulkan.h| 2 +- > 18 files changed, 83 insertions(+), 32 deletions(-) > > diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c > index b89bfa17f2..67e0584814 100644 > --- a/libavcodec/vulkan_decode.c > +++ b/libavcodec/vulkan_decode.c > @@ -1165,6 +1165,8 @@ int ff_vk_decode_init(AVCodecContext *avctx) > s = &ctx->s; > vk = &ctx->s.vkfn; > > +s->log = avctx; > + > s->frames_ref = av_buffer_ref(avctx->hw_frames_ctx); > s->frames = (AVHWFramesContext *)s->frames_ref->data; > s->hwfc = s->frames->hwctx; > diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c > index 6bc1b616a6..e38307fbdf 100644 > --- a/libavfilter/vf_avgblur_vulkan.c > +++ b/libavfilter/vf_avgblur_vulkan.c > @@ -26,6 +26,8 @@ > #include "video.h" > > typedef struct AvgBlurVulkanContext { > +const AVClass *class; > + > FFVulkanContext vkctx; > > int initialized; > diff --git a/libavfilter/vf_blend_vulkan.c b/libavfilter/vf_blend_vulkan.c > index 417be766b8..aa05126cc5 100644 > --- a/libavfilter/vf_blend_vulkan.c > +++ b/libavfilter/vf_blend_vulkan.c > @@ -41,6 +41,8 @@ typedef struct FilterParamsVulkan { > } FilterParamsVulkan; > > typedef struct BlendVulkanContext { > +const AVClass *class; > + > FFVulkanContext vkctx; > FFFrameSync fs; > > diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c > index 57711fb672..b024acb50e 100644 > --- a/libavfilter/vf_bwdif_vulkan.c > +++ b/libavfilter/vf_bwdif_vulkan.c > @@ -323,6 +323,7 @@ static int bwdif_vulkan_config_input(AVFilterLink *inlink) > return 0; > > /* Save the ref, without reffing it */ > +vkctx->log = s; 1. The comment is for the line below and not for this. 2. Why do you want to use the private context as logcontext? We normally always log to the AVFilterContext. > vkctx->input_frames_ref = inlink->hw_frames_ctx; > > /* Defaults */ > @@ -349,9 +350,6 @@ static int bwdif_vulkan_config_output(AVFilterLink > *outlink) > if (err < 0) > return err; > > -/* For logging */ > -vkctx->class = y->class; > - > outlink->hw_frames_ctx = av_buffer_ref(vkctx->frames_ref); > if (!outlink->hw_frames_ctx) > return AVERROR(ENOMEM); > diff --git a/libavfilter/vf_chromaber_vulkan.c > b/libavfilter/vf_chromaber_vulkan.c > index 0b96a7400f..3b50776e07 100644 > --- a/libavfilter/vf_chromaber_vulkan.c > +++ b/libavfilter/vf_chromaber_vulkan.c > @@ -26,6 +26,8 @@ > #include "video.h" > > typedef struct ChromaticAberrationVulkanContext { > +const AVClass *class; > + > FFVulkanContext vkctx; > > int initialized; > diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c > index ecd2567ebc..966cfbfcb5 100644 > --- a/libavfilter/vf_flip_vulkan.c > +++ b/libavfilter/vf_flip_vulkan.c > @@ -33,6 +33,8 @@ enum FlipType { > }; > > typedef struct FlipVulkanContext { > +const AVClass *class; > + > FFVulkanContext vkctx; > > int initialized; > diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c > index 09be6015c3..93d0bb82fe 100644 > --- a/libavfilter/vf_gblur_vulkan.c > +++ b/libavfilter/vf_gblur_vulkan.c > @@ -31,6 +31,8 @@ > #define GBLUR_MAX_KERNEL_SIZE 127 > > typedef struct GBlurVulkanContext { > +const AVClass *class; > + > FFVulkanContext vkctx; > > int initialized; > diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c > index be9000aa8e..40887e7b03 100644 > --- a/libavfilter/vf_libplacebo.c > +++ b/libavfilter/vf_libplacebo.c > @@ -151,6 +151,8 @@ typedef struct LibplaceboInput { > } LibplaceboInput; > > typedef struct LibplaceboContext { > +const AVClass *class; > + > /* lavfi vulkan*/ > FFVulkanContext vkctx; > > diff --git a/libavfilter/vf_nlmeans_vulkan.c b/libavfilter/vf_nlmeans_vulkan.c > index be9305854b..d6abf3fbc4 100644 > --- a/libavfilter/vf_nlmeans_vulkan.c > +++ b/libavf
Re: [FFmpeg-devel] [FEATURE] Cut a video (-ss) with timings non-aligned on keyframes, with minimal re-encoding
> On Aug 14, 2024, at 18:05, b...@gget.it wrote: > > >>> Do you think it would be worth developing a command-line option so that >>> exact cutting with minimal re-encoding would be easier? >> >> How do you plan to figure out the options needed to be passed to each >> and every encoder, so that it'll produce compatible output to enable the >> necessary concatenation of old and new encoded data? >> >> That's by far the biggest roadblock I see with this. > > I see. You're right, then this technique is probably a dead-end... > > More generally, which is the recommanded way to cut a video with a specific > starting point and specific length, with minimal re-encoding? > Millions of hours of CPU-time are probably wasted to reencode > already-perfectly-encoded content, just for cutting ;) Only do remux without transcoding, and let mp4 muxer use editlist to strip the timeline from IDR to the requested start time. The preroll at the beginning can be slow when playback, but seeking also has the same preroll Other choice is use multiple groups of SPS/PPS in mp4 sample description. We have that support in mp4 demuxer, but not in muxer. It’s standard in specification but not widely supported. So if we add support to muxer and it works with our own demuxer, it’s not surprise to experience a lot of compatibility issues with other software. > > Are there already promising dev attempts in the direction of a feature able > to cut with minimal re-encoding? > ___ > 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] avcodec/h264_mp4toannexb: Prepend SPS/PPS to buffering period SEI
Quoting Josh Allmann (2024-08-13 18:57:59) > On Wed, 7 Aug 2024 at 09:13, Josh Allmann wrote: > > > > On Thu, 1 Aug 2024 at 14:37, Josh Allmann wrote: > > > > > > Encoders may emit a buffering period SEI without a corresponding > > > SPS/PPS if the SPS/PPS is carried out-of-band, eg with avcc. > > > > > > During Annex B conversion, this may result in the SPS/PPS being > > > inserted *after* the buffering period SEI but before the IDR NAL. > > > > > > Since the buffering period SEI references the SPS, the SPS/PPS > > > needs to come first. > > > --- > > > libavcodec/bsf/h264_mp4toannexb.c | 15 +++ > > > tests/ref/fate/h264-bsf-mp4toannexb| 2 +- > > > tests/ref/fate/h264_mp4toannexb_ticket2991 | 18 +- > > > tests/ref/fate/segment-mp4-to-ts | 12 ++-- > > > 4 files changed, 31 insertions(+), 16 deletions(-) > > > > > > > Ping for (re-)review on this patch which addresses comments from [1] > > > > Explanation for the FATE changes here [2] - it turns out that several > > of the FATE samples exhibit the same behavior that this patch fixes, > > so it is a net improvement > > > > [1] https://ffmpeg.org//pipermail/ffmpeg-devel/2024-August/331958.html > > [2] https://ffmpeg.org//pipermail/ffmpeg-devel/2024-July/330912.html > > > > Gentle ping for re-review. pushed -- 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] fftools/ffmpeg: remove useless error check
Quoting Marvin Scholz (2024-08-13 20:06:42) > When ret is checked here, it was never assigned anything, making this > check useless, as highlighted by Coverity. > > It seems to be a copy paste mistake given that opt_match_per_stream_str > does not return an error code that could be checked and the previous > value assigned to ret is already checked above. So just remove this > check. > > Fixes: CID1616292 > --- > fftools/ffmpeg_mux_init.c | 2 -- > 1 file changed, 2 deletions(-) LGTM Thanks, -- 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 1/2] Add dirac vulkan hwaccel usage to diracdec.c
This patch adds a vc2 hwaccel to ffmpeg. Tested on ffmpeg vc encoder and vc2-conformance software. Here is a set of commands to verify correctness # Encode vid as vc2 ffmpeg -i -vcodec vc2 input.vc2 # Decode with hwaccel ffmpeg -init_hw_device "vulkan=vk:0" -hwaccel vulkan -i input.vc2 output.mkv # Decode without hwaccel ffmpeg -i input.vc2 output.mkv Signed-off-by: Petro Mozil --- libavcodec/diracdec.c | 336 +++--- libavcodec/diracdec.h | 267 + 2 files changed, 355 insertions(+), 248 deletions(-) create mode 100644 libavcodec/diracdec.h diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 76209aebba..542824f6e1 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -26,228 +26,11 @@ * @author Marco Gerards , David Conrad, Jordi Ortiz */ -#include "libavutil/mem.h" -#include "libavutil/mem_internal.h" -#include "libavutil/pixdesc.h" -#include "libavutil/thread.h" -#include "avcodec.h" -#include "get_bits.h" -#include "codec_internal.h" -#include "decode.h" -#include "golomb.h" -#include "dirac_arith.h" -#include "dirac_vlc.h" -#include "mpegvideoencdsp.h" -#include "dirac_dwt.h" -#include "dirac.h" -#include "diractab.h" -#include "diracdsp.h" -#include "videodsp.h" - -#define EDGE_WIDTH 16 - -/** - * The spec limits this to 3 for frame coding, but in practice can be as high as 6 - */ -#define MAX_REFERENCE_FRAMES 8 -#define MAX_DELAY 5 /* limit for main profile for frame coding (TODO: field coding) */ -#define MAX_FRAMES (MAX_REFERENCE_FRAMES + MAX_DELAY + 1) -#define MAX_QUANT 255/* max quant for VC-2 */ -#define MAX_BLOCKSIZE 32/* maximum xblen/yblen we support */ - -/** - * DiracBlock->ref flags, if set then the block does MC from the given ref - */ -#define DIRAC_REF_MASK_REF1 1 -#define DIRAC_REF_MASK_REF2 2 -#define DIRAC_REF_MASK_GLOBAL 4 - -/** - * Value of Picture.reference when Picture is not a reference picture, but - * is held for delayed output. - */ -#define DELAYED_PIC_REF 4 - -#define CALC_PADDING(size, depth) \ -(((size + (1 << depth) - 1) >> depth) << depth) - -#define DIVRNDUP(a, b) (((a) + (b) - 1) / (b)) - -typedef struct { -AVFrame *avframe; -int interpolated[3];/* 1 if hpel[] is valid */ -uint8_t *hpel[3][4]; -uint8_t *hpel_base[3][4]; -int reference; -unsigned picture_number; -} DiracFrame; - -typedef struct { -union { -int16_t mv[2][2]; -int16_t dc[3]; -} u; /* anonymous unions aren't in C99 :( */ -uint8_t ref; -} DiracBlock; - -typedef struct SubBand { -int level; -int orientation; -int stride; /* in bytes */ -int width; -int height; -int pshift; -int quant; -uint8_t *ibuf; -struct SubBand *parent; - -/* for low delay */ -unsigned length; -const uint8_t *coeff_data; -} SubBand; - -typedef struct Plane { -DWTPlane idwt; - -int width; -int height; -ptrdiff_t stride; - -/* block length */ -uint8_t xblen; -uint8_t yblen; -/* block separation (block n+1 starts after this many pixels in block n) */ -uint8_t xbsep; -uint8_t ybsep; -/* amount of overspill on each edge (half of the overlap between blocks) */ -uint8_t xoffset; -uint8_t yoffset; - -SubBand band[MAX_DWT_LEVELS][4]; -} Plane; - -/* Used by Low Delay and High Quality profiles */ -typedef struct DiracSlice { -GetBitContext gb; -int slice_x; -int slice_y; -int bytes; -} DiracSlice; - -typedef struct DiracContext { -AVCodecContext *avctx; -MpegvideoEncDSPContext mpvencdsp; -VideoDSPContext vdsp; -DiracDSPContext diracdsp; -DiracVersionInfo version; -GetBitContext gb; -AVDiracSeqHeader seq; -int seen_sequence_header; -int64_t frame_number; /* number of the next frame to display */ -Plane plane[3]; -int chroma_x_shift; -int chroma_y_shift; - -int bit_depth; /* bit depth */ -int pshift; /* pixel shift = bit_depth > 8 */ - -int zero_res; /* zero residue flag */ -int is_arith; /* whether coeffs use arith or golomb coding */ -int core_syntax;/* use core syntax only */ -int low_delay; /* use the low delay syntax */ -int hq_picture; /* high quality picture, enables low_delay */ -int ld_picture; /* use low delay picture, turns on low_delay */ -int dc_prediction; /* has dc prediction */ -int globalmc_flag; /* use global motion compensation*/ -int num_refs; /* number of reference pictures */ - -/* wavelet decoding */ -unsigned wavelet_depth; /* depth of the IDWT */ -unsigned
Re: [FFmpeg-devel] [PATCH v2 5/5] swscale/aarch64/yuv2rgb: add neon yuv42{0, 2}p -> gbrp unscaled colorspace converters
On Tue, 6 Aug 2024, Ramiro Polla wrote: checkasm --bench on a Raspberry Pi 5 Model B Rev 1.0: yuv420p_gbrp_128_c: 1243.0 yuv420p_gbrp_128_neon: 453.5 yuv420p_gbrp_1920_c: 18165.5 yuv420p_gbrp_1920_neon: 6700.0 yuv422p_gbrp_128_c: 1463.5 yuv422p_gbrp_128_neon: 471.5 yuv422p_gbrp_1920_c: 21343.7 yuv422p_gbrp_1920_neon: 6743.5 --- libswscale/aarch64/swscale_unscaled.c | 58 + libswscale/aarch64/yuv2rgb_neon.S | 73 ++- 2 files changed, 118 insertions(+), 13 deletions(-) This looks reasonable to me, thanks! // Martin ___ 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 4/4] swscale/aarch64: add nv24/nv42 to yuv420p unscaled converter
On Fri, 9 Aug 2024, Ramiro Polla wrote: checkasm --bench for Raspberry Pi 5 Model B Rev 1.0: nv24_yuv420p_128_c: 423.0 nv24_yuv420p_128_neon: 115.7 nv24_yuv420p_1920_c: 5939.5 nv24_yuv420p_1920_neon: 1339.7 nv42_yuv420p_128_c: 423.2 nv42_yuv420p_128_neon: 115.7 nv42_yuv420p_1920_c: 5907.5 nv42_yuv420p_1920_neon: 1342.5 --- libswscale/aarch64/Makefile| 1 + libswscale/aarch64/swscale_unscaled.c | 30 + libswscale/aarch64/swscale_unscaled_neon.S | 75 ++ 3 files changed, 106 insertions(+) create mode 100644 libswscale/aarch64/swscale_unscaled_neon.S diff --git a/libswscale/aarch64/swscale_unscaled_neon.S b/libswscale/aarch64/swscale_unscaled_neon.S new file mode 100644 index 00..a206fda41f --- /dev/null +++ b/libswscale/aarch64/swscale_unscaled_neon.S @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024 Ramiro Polla + * + * 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/aarch64/asm.S" + +function ff_nv24_to_yuv420p_chroma_neon, export=1 +// x0 uint8_t *dst1 +// x1 int dstStride1 +// x2 uint8_t *dst2 +// x3 int dstStride2 +// x4 const uint8_t *src +// x5 int srcStride +// w6 int w +// w7 int h + +uxtwx1, w1 +uxtwx3, w3 +uxtwx5, w5 You can often avoid the explicit uxtw instructions, if you can fold an uxtw attribute into the cases where the register is used. (If it's used often, it may be slightly more performant to do it upfront like this though, but often it can be omitted entirely.) And whenever you do an operation with a wN register as destination, the upper half of the register gets explicitly cleared, so these also may be avoided that way. + +add x9, x4, x5 // x9 = src + srcStride +lsl w5, w5, #1 // srcStride *= 2 + +1: +mov w10, w6 // w10 = w +mov x11, x4 // x11 = src1 (line 1) +mov x12, x9 // x12 = src2 (line 2) +mov x13, x0 // x13 = dst1 (dstU) +mov x14, x2 // x14 = dst2 (dstV) + +2: +ld2 { v0.16b, v1.16b }, [x11], #32 // v0 = U1, v1 = V1 +ld2 { v2.16b, v3.16b }, [x12], #32 // v2 = U2, v3 = V2 + +uaddlp v0.8h, v0.16b // pairwise add U1 into v0 +uaddlp v1.8h, v1.16b // pairwise add V1 into v1 +uadalp v0.8h, v2.16b // pairwise add U2, accumulate into v0 +uadalp v1.8h, v3.16b // pairwise add V2, accumulate into v1 + +shrnv0.8b, v0.8h, #2// divide by 4 +shrnv1.8b, v1.8h, #2// divide by 4 + +st1 { v0.8b }, [x13], #8// store U into dst1 +st1 { v1.8b }, [x14], #8// store V into dst2 + +subsw10, w10, #8 +b.gt2b + +// next row +add x4, x4, x5 // src1 += srcStride * 2 +add x9, x9, x5 // src2 += srcStride * 2 +add x0, x0, x1 // dst1 += dstStride1 +add x2, x2, x3 // dst2 += dstStride2 It's often possible to avoid the extra step of moving the pointers back into the the x11/x12/x13/x14 registers, if you subtract the width from the stride at the start of the function. Then you don't need two separate registers for each pointer, and shortens dependency chain when moving on to the next line. If the width can be any uneven value, but we in practice write in increments of 8 pixels, you may need to align the width up to 8 before using it to decrement the stride that way though. // Martin ___ 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] [RFC] 7.1 Release
Hi all Are there any upcoming LTS releases that want to/could include FFmpeg 7.1 ? If so please reply here and list the date before which we would have to finish the 7.1 release so it can be included with no problems Otherwise, are there any preferrances of the general/approximate release date? thx -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "Nothing to hide" only works if the folks in power share the values of you and everyone you know entirely and always will -- Tom Scott signature.asc Description: PGP signature ___ 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/common: use fabs(f) for FFABS/FFNABS
Quoting Rémi Denis-Courmont (2024-07-26 18:32:19) > The absolute value of a floating point value is easier to calculate than > that of an integer: it is obtained by either clearing the sign or xoring it > with itself. Accordingly, Arm, LoongArch, RISC-V have dedicated instructions > to manipulate float sign bits. x86-64 has ANDPS. > > As per C11 appendix F, FFABS() is not quite the same as fabs() however, > due to differing NaN handling. GCC is able to optimise the current FFABS > definition to match fabs() anyway with just -fno-signed-zeros. But Clang is > evidently not doing so and inserts a comparison with 0 and a conditional > select or branch. Now that we have C11, this is easy to fix properly. > (Another option is to manually audit which of the ~880 FFABS/FFNABS use > sites involve floating point values.) > > Note that this still preserves the old definitions for C++ and pre-C11 > compilers since the 2 macros are public (even though they start with FF). > --- > libavutil/common.h | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/libavutil/common.h b/libavutil/common.h > index 3b830daf30..48761885fb 100644 > --- a/libavutil/common.h > +++ b/libavutil/common.h > @@ -71,7 +71,14 @@ > * as with *abs() > * @see FFNABS() > */ > +#if !defined (__cplusplus) && __STDC_VERSION__ >= 201112L Is __STDC_VERSION__ defined for C++? -- 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] fftools/ffmpeg: show video stats in progress output without filters
Quoting Jan Garcia via ffmpeg-devel (2024-08-02 10:25:58) > Since ffmpeg 6.1 video stats are accidentally hidden from streamcopy progress > output. > This patch re-enables video stats (like frames=) in the progress output. > --- > fftools/ffmpeg.c | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) Thanks, pushed. -- 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] avcodec/filter_units: Fix extradata and packets can have different bitstream format
From: Zhao Zhili Filter init can change extradata from avcc/hvcc to annexb format. With different passthrough logic, packets can still in avcc/hvcc format. Use same passthrough logic for init and filter. Signed-off-by: Zhao Zhili --- libavcodec/bsf/filter_units.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/bsf/filter_units.c b/libavcodec/bsf/filter_units.c index 029c86048b..336331733f 100644 --- a/libavcodec/bsf/filter_units.c +++ b/libavcodec/bsf/filter_units.c @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include "libavutil/mem.h" @@ -44,6 +45,7 @@ typedef struct FilterUnitsContext { } mode; CodedBitstreamUnitType *type_list; int nb_types; +bool passthrough; } FilterUnitsContext; @@ -111,7 +113,7 @@ static int filter_units_filter(AVBSFContext *bsf, AVPacket *pkt) if (err < 0) return err; -if (ctx->mode == NOOP && ctx->discard <= AVDISCARD_DEFAULT) +if (ctx->passthrough) return 0; err = ff_cbs_read_packet(ctx->cbc, frag, pkt); @@ -181,6 +183,7 @@ static int filter_units_init(AVBSFContext *bsf) return err; } } else if (ctx->discard == AVDISCARD_NONE) { +ctx->passthrough = true; return 0; } -- 2.42.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] avfilter/vf_unsharp: Merge header into .c
From: Zhao Zhili It was shared with opencl implementation. --- libavfilter/unsharp.h| 62 libavfilter/vf_unsharp.c | 34 +- 2 files changed, 33 insertions(+), 63 deletions(-) delete mode 100644 libavfilter/unsharp.h diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h deleted file mode 100644 index 0da6f05036..00 --- a/libavfilter/unsharp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2013 Wei Gao - * Copyright (C) 2013 Lenny Wang - * - * 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 - */ - -#ifndef AVFILTER_UNSHARP_H -#define AVFILTER_UNSHARP_H - -#include "config.h" -#include "avfilter.h" - -#define MIN_MATRIX_SIZE 3 -#define MAX_MATRIX_SIZE 63 - - -typedef struct UnsharpFilterParam { -int msize_x; ///< matrix width -int msize_y; ///< matrix height -int amount; ///< effect amount -int steps_x; ///< horizontal step count -int steps_y; ///< vertical step count -int scalebits; ///< bits to shift pixel -int32_t halfscale; ///< amount to add to pixel -uint32_t *sr;///< finite state machine storage within a row -uint32_t **sc; ///< finite state machine storage across rows -} UnsharpFilterParam; - -typedef struct UnsharpContext { -const AVClass *class; -int lmsize_x, lmsize_y, cmsize_x, cmsize_y; -int amsize_x, amsize_y; -float lamount, camount; -float aamount; -UnsharpFilterParam luma; ///< luma parameters (width, height, amount) -UnsharpFilterParam chroma; ///< chroma parameters (width, height, amount) -UnsharpFilterParam alpha; ///< alpha parameters (width, height, amount) -int hsub, vsub; -int nb_planes; -int bitdepth; -int bps; -int nb_threads; -int (* apply_unsharp)(AVFilterContext *ctx, AVFrame *in, AVFrame *out); -int (* unsharp_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); -} UnsharpContext; - -#endif /* AVFILTER_UNSHARP_H */ diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 2705ac5270..01b5dae796 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -44,7 +44,39 @@ #include "libavutil/mem.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" -#include "unsharp.h" + +#define MIN_MATRIX_SIZE 3 +#define MAX_MATRIX_SIZE 63 + +typedef struct UnsharpFilterParam { +int msize_x; ///< matrix width +int msize_y; ///< matrix height +int amount; ///< effect amount +int steps_x; ///< horizontal step count +int steps_y; ///< vertical step count +int scalebits; ///< bits to shift pixel +int32_t halfscale; ///< amount to add to pixel +uint32_t *sr;///< finite state machine storage within a row +uint32_t **sc; ///< finite state machine storage across rows +} UnsharpFilterParam; + +typedef struct UnsharpContext { +const AVClass *class; +int lmsize_x, lmsize_y, cmsize_x, cmsize_y; +int amsize_x, amsize_y; +float lamount, camount; +float aamount; +UnsharpFilterParam luma; ///< luma parameters (width, height, amount) +UnsharpFilterParam chroma; ///< chroma parameters (width, height, amount) +UnsharpFilterParam alpha; ///< alpha parameters (width, height, amount) +int hsub, vsub; +int nb_planes; +int bitdepth; +int bps; +int nb_threads; +int (* apply_unsharp)(AVFilterContext *ctx, AVFrame *in, AVFrame *out); +int (* unsharp_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); +} UnsharpContext; typedef struct TheadData { UnsharpFilterParam *fp; -- 2.42.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".
Re: [FFmpeg-devel] [PATCH] tools/target_dec_fuzzer: Check that FFv1 doesnt leave uninitialized memory in its buffers
On Mon, Aug 12, 2024 at 03:29:51PM +0200, Michael Niedermayer wrote: > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Michael Niedermayer > --- > tools/target_dec_fuzzer.c | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus signature.asc Description: PGP signature ___ 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/4] vulkan_decode: use the correct queue family for decoding ops
In 680d969a305c0927480573a1b455024088b51aeb, the new API was used to find a queue family for dispatch, but the found queue family was not used for decoding, just for dispatching. --- libavcodec/vulkan_decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index b89bfa17f2..c7a32cc439 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -1198,7 +1198,7 @@ int ff_vk_decode_init(AVCodecContext *avctx) nb_q = 1; session_create.flags = 0x0; -session_create.queueFamilyIndex = s->hwctx->queue_family_decode_index; +session_create.queueFamilyIndex = ctx->qf.queue_family; session_create.maxCodedExtent = ctx->caps.maxCodedExtent; session_create.maxDpbSlots = ctx->caps.maxDpbSlots; session_create.maxActiveReferencePictures = ctx->caps.maxActiveReferencePictures; -- 2.45.2.753.g447d99e1c3b ___ 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/4] hwcontext_vulkan: fix user layers, add support for different debug modes
The validation layer option only supported GPU-assisted validation. This is mutually exclusive with shader debug printfs, so we need to differentiate between the two. This also fixes issues with user-given layers, and leaks in case of errors. --- libavutil/hwcontext_vulkan.c | 215 +++ 1 file changed, 143 insertions(+), 72 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 55dd657ddd..506629141e 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -498,8 +498,19 @@ static VkBool32 VKAPI_CALL vk_dbg_callback(VkDebugUtilsMessageSeverityFlagBitsEX av_free((void *)props); \ } +enum FFVulkanDebugMode { +FF_VULKAN_DEBUG_NONE = 0, +/* Standard GPU-assisted validation */ +FF_VULKAN_DEBUG_VALIDATE = 1, +/* Passes printfs in shaders to the debug callback */ +FF_VULKAN_DEBUG_PRINTF = 2, +/* Enables extra printouts */ +FF_VULKAN_DEBUG_PRACTICES = 3, +}; + static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, -const char * const **dst, uint32_t *num, int debug) +const char * const **dst, uint32_t *num, +enum FFVulkanDebugMode debug_mode) { const char *tstr; const char **extension_names = NULL; @@ -571,7 +582,10 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, ADD_VAL_TO_LIST(extension_names, extensions_found, tstr); } -if (debug && !dev) { +if (!dev && +((debug_mode == FF_VULKAN_DEBUG_VALIDATE) || + (debug_mode == FF_VULKAN_DEBUG_PRINTF) || + (debug_mode == FF_VULKAN_DEBUG_PRACTICES))) { tstr = VK_EXT_DEBUG_UTILS_EXTENSION_NAME; found = 0; for (int j = 0; j < sup_ext_count; j++) { @@ -627,20 +641,21 @@ fail: return err; } -static int check_validation_layers(AVHWDeviceContext *ctx, AVDictionary *opts, - const char * const **dst, uint32_t *num, - int *debug_mode) +static int check_layers(AVHWDeviceContext *ctx, AVDictionary *opts, +const char * const **dst, uint32_t *num, +enum FFVulkanDebugMode *debug_mode) { -static const char default_layer[] = { "VK_LAYER_KHRONOS_validation" }; - -int found = 0, err = 0; +int err = 0; VulkanDevicePriv *priv = ctx->hwctx; FFVulkanFunctions *vk = &priv->vkctx.vkfn; +static const char layer_standard_validation[] = { "VK_LAYER_KHRONOS_validation" }; +int layer_standard_validation_found = 0; + uint32_t sup_layer_count; VkLayerProperties *sup_layers; -AVDictionaryEntry *user_layers; +AVDictionaryEntry *user_layers = av_dict_get(opts, "validation_layers", NULL, 0); char *user_layers_str = NULL; char *save, *token; @@ -648,99 +663,134 @@ static int check_validation_layers(AVHWDeviceContext *ctx, AVDictionary *opts, uint32_t enabled_layers_count = 0; AVDictionaryEntry *debug_opt = av_dict_get(opts, "debug", NULL, 0); -int debug = debug_opt && strtol(debug_opt->value, NULL, 10); +enum FFVulkanDebugMode mode; -/* If `debug=0`, enable no layers at all. */ -if (debug_opt && !debug) -return 0; +*debug_mode = mode = FF_VULKAN_DEBUG_NONE; +/* Get a list of all layers */ vk->EnumerateInstanceLayerProperties(&sup_layer_count, NULL); sup_layers = av_malloc_array(sup_layer_count, sizeof(VkLayerProperties)); if (!sup_layers) return AVERROR(ENOMEM); vk->EnumerateInstanceLayerProperties(&sup_layer_count, sup_layers); -av_log(ctx, AV_LOG_VERBOSE, "Supported validation layers:\n"); +av_log(ctx, AV_LOG_VERBOSE, "Supported layers:\n"); for (int i = 0; i < sup_layer_count; i++) av_log(ctx, AV_LOG_VERBOSE, "\t%s\n", sup_layers[i].layerName); -/* If `debug=1` is specified, enable the standard validation layer extension */ -if (debug) { -*debug_mode = debug; +/* If no user layers or debug layers are given, return */ +if (!debug_opt && !user_layers) +goto end; + +/* Check for any properly supported validation layer */ +if (debug_opt) { +if (!strcmp(debug_opt->value, "printf")) { +mode = FF_VULKAN_DEBUG_PRINTF; +} else if (!strcmp(debug_opt->value, "validate")) { +mode = FF_VULKAN_DEBUG_VALIDATE; +} else if (!strcmp(debug_opt->value, "practices")) { +mode = FF_VULKAN_DEBUG_PRACTICES; +} else { +int idx = strtol(debug_opt->value, NULL, 10); +if (idx < 0 || idx > FF_VULKAN_DEBUG_PRACTICES) { +av_log(ctx, AV_LOG_ERROR, "Invalid debugging mode \"%s\"\n", + debug_opt->value); +err = AVERROR(EINVAL); +goto end;
[FFmpeg-devel] [PATCH 3/4] hwcontext_vulkan: don't enable deprecated VK_KHR_sampler_ycbcr_conversion extension
It was added to Vulkan 1.1 a long time ago. Validation layer will warn if this is enabled. --- libavutil/hwcontext_vulkan.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 506629141e..2c958b86bb 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -416,7 +416,6 @@ static const VulkanOptExtension optional_device_exts[] = { /* Misc or required by other extensions */ { VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME, FF_VK_EXT_NO_FLAG}, { VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME, FF_VK_EXT_NO_FLAG}, -{ VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, FF_VK_EXT_NO_FLAG}, { VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME, FF_VK_EXT_DESCRIPTOR_BUFFER, }, { VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME, FF_VK_EXT_DEVICE_DRM }, { VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME, FF_VK_EXT_ATOMIC_FLOAT }, -- 2.45.2.753.g447d99e1c3b ___ 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 4/4] hwcontext_vulkan: setup extensions before features
The issue is that enabling features requires that the device extension is supported. The extensions bitfield was set later, so it was always 0, leading to no features being added. --- libavutil/hwcontext_vulkan.c | 73 +++- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 2c958b86bb..18148353c2 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1440,35 +1440,6 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, }; -hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; -hwctx->device_features.pNext = &p->device_features_1_1; -p->device_features_1_1.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; -p->device_features_1_1.pNext = &p->device_features_1_2; -p->device_features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; -p->device_features_1_2.pNext = &p->device_features_1_3; -p->device_features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; -p->device_features_1_3.pNext = NULL; - -#define OPT_CHAIN(EXT_FLAG, STRUCT_P, TYPE)\ -do { \ -if (p->vkctx.extensions & EXT_FLAG) { \ -(STRUCT_P)->sType = TYPE; \ -ff_vk_link_struct(hwctx->device_features.pNext, STRUCT_P); \ -} \ -} while (0) - -OPT_CHAIN(FF_VK_EXT_DESCRIPTOR_BUFFER, &p->desc_buf_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT); -OPT_CHAIN(FF_VK_EXT_ATOMIC_FLOAT, &p->atomic_float_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT); -OPT_CHAIN(FF_VK_EXT_COOP_MATRIX, &p->coop_matrix_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR); -OPT_CHAIN(FF_VK_EXT_SHADER_OBJECT, &p->shader_object_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT); -OPT_CHAIN(FF_VK_EXT_OPTICAL_FLOW, &p->optical_flow_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV); -#undef OPT_CHAIN - ctx->free = vulkan_device_free; /* Create an instance if not given one */ @@ -1537,12 +1508,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, p->shader_object_features.shaderObject = shader_object_features.shaderObject; -dev_info.pNext = &hwctx->device_features; - -/* Setup queue family */ -if ((err = setup_queue_families(ctx, &dev_info))) -goto end; - +/* Find and enable extensions */ if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames, &dev_info.enabledExtensionCount, 0))) { for (int i = 0; i < dev_info.queueCreateInfoCount; i++) @@ -1551,6 +1517,43 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, goto end; } +/* Setup enabled device features */ +hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; +hwctx->device_features.pNext = &p->device_features_1_1; +p->device_features_1_1.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; +p->device_features_1_1.pNext = &p->device_features_1_2; +p->device_features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; +p->device_features_1_2.pNext = &p->device_features_1_3; +p->device_features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; +p->device_features_1_3.pNext = NULL; + +#define OPT_CHAIN(EXT_FLAG, STRUCT_P, TYPE)\ +do { \ +if (p->vkctx.extensions & EXT_FLAG) { \ +(STRUCT_P)->sType = TYPE; \ +ff_vk_link_struct(hwctx->device_features.pNext, STRUCT_P); \ +} \ +} while (0) + +OPT_CHAIN(FF_VK_EXT_DESCRIPTOR_BUFFER, &p->desc_buf_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT); +OPT_CHAIN(FF_VK_EXT_ATOMIC_FLOAT, &p->atomic_float_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT); +OPT_CHAIN(FF_VK_EXT_COOP_MATRIX, &p->coop_matrix_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR); +OPT_CHAIN(FF_VK_EXT_SHADER_OBJECT, &p->shader_object_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT); +OPT_CHAIN(FF_VK_EXT_OPTICAL_FLOW, &p->optical_flow_features, +
[FFmpeg-devel] [PATCH 1/3] avformat/iamf_parse: clear padding
Fixes: use of uninitialized value Fixes: 70929/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5931276639469568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/iamf_parse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c index 296e49157b0..f2b6d4fa518 100644 --- a/libavformat/iamf_parse.c +++ b/libavformat/iamf_parse.c @@ -1076,6 +1076,7 @@ int ff_iamfdec_read_descriptors(IAMFContext *c, AVIOContext *pb, size = avio_read(pb, header, FFMIN(MAX_IAMF_OBU_HEADER_SIZE, max_size)); if (size < 0) return size; +memset(header + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); len = ff_iamf_parse_obu_header(header, size, &obu_size, &start_pos, &type, NULL, NULL); if (len < 0 || obu_size > max_size) { -- 2.45.2 ___ 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/3] avformat/mxfdec: Check that key was read sucessfull
Fixes: use of uninitialized value Fixes: 70932/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4870202133643264 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mxfdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index af0c8a31007..4d5cb28d6dd 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1533,7 +1533,8 @@ static int mxf_read_indirect_value(void *arg, AVIOContext *pb, int size) if (size <= 17) return 0; -avio_read(pb, key, 17); +if (avio_read(pb, key, 17) != 17) +return AVERROR_INVALIDDATA; /* TODO: handle other types of of indirect values */ if (memcmp(key, mxf_indirect_value_utf16le, 17) == 0) { return mxf_read_utf16le_string(pb, size - 17, &tagged_value->value); -- 2.45.2 ___ 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 3/3] avcodec/hapdec: Clear tex buffer
The code following makes no attempt to initialize all of the buffer Fixes: use of uninitialized value Fixes: 70980/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5329909059223552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hapdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c index 918eff78761..70bf592f2aa 100644 --- a/libavcodec/hapdec.c +++ b/libavcodec/hapdec.c @@ -310,6 +310,7 @@ static int hap_decode(AVCodecContext *avctx, AVFrame *frame, ret = av_reallocp(&ctx->tex_buf, ctx->tex_size); if (ret < 0) return ret; +memset(ctx->tex_buf, 0, ctx->tex_size); avctx->execute2(avctx, decompress_chunks_thread, NULL, ctx->chunk_results, ctx->chunk_count); -- 2.45.2 ___ 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] [RFC] 7.1 Release
On 14/08/2024 14:41, Michael Niedermayer wrote: Hi all Are there any upcoming LTS releases that want to/could include FFmpeg 7.1 ? If so please reply here and list the date before which we would have to finish the 7.1 release so it can be included with no problems Otherwise, are there any preferrances of the general/approximate release date? thx ___ 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". I'd like to have Vulkan encoding support merged before 7.1 is branched. Working on the patches ATM, merging them one by one. The first week of September seems like a nice target for a release, which would mean we'd need to branch at the end of this month. OpenPGP_0xA2FEA5F03F034464.asc Description: OpenPGP public key OpenPGP_signature.asc Description: OpenPGP digital signature ___ 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/6] avformat/segafilm: Set keyframe
On Wed, Aug 07, 2024 at 12:18:48AM +0200, Michael Niedermayer wrote: > Fixes: use of uninitialized value > Fixes: > 70871/clusterfuzz-testcase-minimized-ffmpeg_dem_SEGAFILM_fuzzer-5883617752973312 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/segafilm.c | 1 + > 1 file changed, 1 insertion(+) will apply patches 1-3 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Take away the freedom of one citizen and you will be jailed, take away the freedom of all citizens and you will be congratulated by your peers in Parliament. signature.asc Description: PGP signature ___ 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] avformat/iamf_parse: clear padding
On 8/14/2024 11:34 AM, Michael Niedermayer wrote: Fixes: use of uninitialized value Fixes: 70929/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5931276639469568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/iamf_parse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c index 296e49157b0..f2b6d4fa518 100644 --- a/libavformat/iamf_parse.c +++ b/libavformat/iamf_parse.c @@ -1076,6 +1076,7 @@ int ff_iamfdec_read_descriptors(IAMFContext *c, AVIOContext *pb, size = avio_read(pb, header, FFMIN(MAX_IAMF_OBU_HEADER_SIZE, max_size)); if (size < 0) return size; +memset(header + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); len = ff_iamf_parse_obu_header(header, size, &obu_size, &start_pos, &type, NULL, NULL); if (len < 0 || obu_size > max_size) { I assume get_bits() reads into the padding? Should be ok. ___ 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/4] bsf/media100_to_mjpegb: Clear output buffer padding
On Sun, Aug 04, 2024 at 04:23:12PM +0200, Michael Niedermayer wrote: > Fixes: use-of-uninitialized-value > Fixes: > 70855/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MEDIA100_fuzzer-5537446610141184 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/bsf/media100_to_mjpegb.c | 1 + > 1 file changed, 1 insertion(+) will apply the remaining 2 patches of this set [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Any man who breaks a law that conscience tells him is unjust and willingly accepts the penalty by staying in jail in order to arouse the conscience of the community on the injustice of the law is at that moment expressing the very highest respect for law. - Martin Luther King Jr signature.asc Description: PGP signature ___ 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/8] avcodec/apac: Clean padding space
On Sun, Aug 04, 2024 at 10:53:02PM +0200, Michael Niedermayer wrote: > Fixes: use-of-uninitialized-value > Fixes: > 70842/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-5758325067677696 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/apac.c | 1 + > 1 file changed, 1 insertion(+) will apply the remeining 6 patches of this set [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart than the original author, trying to rewrite it will not make it better. signature.asc Description: PGP signature ___ 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/mailing-list-faq: remove dead link
https://ffmpeg-archive.org/ is no longer "Nabble" --- doc/mailing-list-faq.texi | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/mailing-list-faq.texi b/doc/mailing-list-faq.texi index b20281..e10d92a5fc 100644 --- a/doc/mailing-list-faq.texi +++ b/doc/mailing-list-faq.texi @@ -157,9 +157,6 @@ Perform a site search using your favorite search engine. Example: You can ask for help in the official @t{#ffmpeg} IRC channel on Libera Chat. -Some users prefer the third-party @url{http://www.ffmpeg-archive.org/, Nabble} -interface which presents the mailing lists in a typical forum layout. - There are also numerous third-party help sites such as @url{https://superuser.com/tags/ffmpeg, Super User} and @url{https://www.reddit.com/r/ffmpeg/, r/ffmpeg on reddit}. -- 2.39.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".
Re: [FFmpeg-devel] [PATCH] avcodec/amf_enc: new encoder features support
Can anyone take a look at this patch please? ___ 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] doc/mailing-list-faq: remove dead link
On Wed, Aug 14, 2024 at 11:07:16AM -0500, vipyne wrote: > https://ffmpeg-archive.org/ is no longer "Nabble" > --- > doc/mailing-list-faq.texi | 3 --- > 1 file changed, 3 deletions(-) applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. signature.asc Description: PGP signature ___ 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] Check codec_whitelist before reinitializing AVCtx.priv_data.
Bump for this one. Thanks! - dale On Wed, Jul 31, 2024 at 4:18 PM Dale Curtis wrote: > On Wed, Jul 31, 2024 at 2:29 PM Dale Curtis > wrote: > >> On Wed, Jul 31, 2024 at 2:10 PM Dale Curtis >> wrote: >> >>> On Wed, Jul 31, 2024 at 4:32 AM Anton Khirnov wrote: >>> Quoting Dale Curtis (2024-07-31 01:14:13) > I realized there are a couple more allocations that can be skipped here > when a codec is not on the allow list. Here's the updated patch. > > - dale > > On Mon, Jul 29, 2024 at 10:19 AM Dale Curtis >>> > > wrote: > > > This ensures that if a codec isn't on codec_whitelist, its VUI > > information can still be populated during find_stream_info() > > via parsers. > > > > Signed-off-by: Dale Curtis > > --- > > libavcodec/avcodec.c | 12 ++-- > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > > > From f87042d77d13c4c45f4b800146dc16347c1007d4 Mon Sep 17 00:00:00 2001 > From: Dale Curtis > Date: Tue, 30 Jul 2024 23:12:21 + > Subject: [PATCH] Check codec_whitelist before reinitializing AVCtx.priv_data. > > This ensures that if a codec isn't on codec_whitelist, its VUI > information can still be populated during find_stream_info() > via parsers. Can you elaborate on this? >>> >>> The current code reinitializes the private data structures then checks >>> the whitelist. If the private data section had already been filled out, it >>> ends up being overwritten causing find_stream_info to drop side channel >>> data. >>> >>> > > Signed-off-by: Dale Curtis > --- > libavcodec/avcodec.c | 11 +-- > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c > index 214dca4566..1f9b3eb360 100644 > --- a/libavcodec/avcodec.c > +++ b/libavcodec/avcodec.c > @@ -174,6 +174,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code > if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) > return AVERROR(EINVAL); > > +if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) { > +av_log(avctx, AV_LOG_ERROR, "Codec (%s) not on whitelist \'%s\'\n", codec->name, avctx->codec_whitelist); > +return AVERROR(EINVAL); > +} I think this will break the case where the whitelist is provided in the options dictionary, as it's not applied yet at this point. >>> >>> I just copied the existing code a few lines up, so it seems ancillary to >>> this patch, but I can fix it in this one too if you want. >>> >> >> Nevermind, I see what you're saying -- yes this does break that case. >> Thanks for catching. I'll send a fix shortly. >> > > Fixed. Thanks. > > >> >> >>> >>> -- 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 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] Don't reallocate a AVCodecContext when closing a non-open codec.
Bump for this one. Thanks! - dale On Fri, Aug 2, 2024 at 9:54 AM Dale Curtis wrote: > This results in an unnecessary ~800k allocation with H.264. A > nearby callsite uses avcodec_is_open() to avoid this, so do the > same when exiting avformat_find_stream_info(). > > Signed-off-by: Dale Curtis > --- > libavformat/demux.c | 9 ++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > ___ 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] Fix nullptr dereference with invalid encryption metadata.
Bump for this one. Thanks! - dale On Fri, Aug 2, 2024 at 3:08 PM Dale Curtis wrote: > Found by fuzzer. > > Bug: https://crbug.com/356720789 > Signed-off-by: Dale Curtis > --- > libavformat/mov.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > ___ 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] VDD 2024
Hello FFmpeg Folks, I'm writing to you to announce the next VDD conference, to speak about open source multimedia, in Korea, Seoul, the first weekend of November, of this year. The conference is free, and VideoLAN covers the costs for active members of our communities. The usual folks from VideoLAN, FFmpeg, VLC x264, dav1d, Xodi, libplacebo, mpv and related projects will be here. In case you are interested in coming this November, the link to register is here: https://framaforms.org/vdd-2024-1723106137 Talks are very welcomed! Best regards, -- Jean-Baptiste Kempf - President +33 672 704 734 https://jbkempf.com/ ___ 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] avformat/iamf_parse: ignore Audio Elements with an unsupported type
Better fix for the NULL pointer dereference from d7f83fc2f423. Signed-off-by: James Almer --- libavformat/iamf_parse.c | 9 ++--- libavformat/iamfdec.c| 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c index 296e49157b..e431f9a364 100644 --- a/libavformat/iamf_parse.c +++ b/libavformat/iamf_parse.c @@ -751,8 +751,8 @@ static int audio_element_obu(void *s, IAMFContext *c, AVIOContext *pb, int len) if (ret < 0) goto fail; } else { -unsigned audio_element_config_size = ffio_read_leb(pbc); -avio_skip(pbc, audio_element_config_size); +ret = AVERROR(EAGAIN); +goto fail; } c->audio_elements[c->nb_audio_elements++] = audio_element; @@ -764,8 +764,11 @@ static int audio_element_obu(void *s, IAMFContext *c, AVIOContext *pb, int len) ret = 0; fail: av_free(buf); -if (ret < 0) +if (ret < 0) { ff_iamf_free_audio_element(&audio_element); +if (ret == AVERROR(EAGAIN)) +ret = 0; +} return ret; } diff --git a/libavformat/iamfdec.c b/libavformat/iamfdec.c index 2e6608b868..55b9d0f89d 100644 --- a/libavformat/iamfdec.c +++ b/libavformat/iamfdec.c @@ -107,7 +107,8 @@ static int iamf_read_header(AVFormatContext *s) if (ret < 0) return ret; -if (!i && !j && audio_element->nb_layers && audio_element->layers[0].substream_count == 1) +av_assert0(audio_element->layers); +if (!i && !j && audio_element->layers[0].substream_count == 1) st->disposition |= AV_DISPOSITION_DEFAULT; else st->disposition |= AV_DISPOSITION_DEPENDENT; -- 2.46.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 1/2] lavc/mpegvideoencdsp: R-V V try_8x8basis
T-Head C908: try_8x8basis_c: 922.5 try_8x8basis_rvv_i32: 135.3 SpacemiT X60: try_8x8basis_c: 926.1 try_8x8basis_rvv_i32: 103.1 --- libavcodec/riscv/mpegvideoencdsp_init.c | 15 --- libavcodec/riscv/mpegvideoencdsp_rvv.S | 35 + 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/libavcodec/riscv/mpegvideoencdsp_init.c b/libavcodec/riscv/mpegvideoencdsp_init.c index eb5c8a5aed..4c156c1cf2 100644 --- a/libavcodec/riscv/mpegvideoencdsp_init.c +++ b/libavcodec/riscv/mpegvideoencdsp_init.c @@ -23,6 +23,8 @@ #include "libavutil/cpu.h" #include "libavcodec/mpegvideoencdsp.h" +int ff_try_8x8basis_rvv(const int16_t rem[64], const int16_t weight[64], +const int16_t basis[16], int scale); int ff_pix_sum_rvv(const uint8_t *pix, int line_size); int ff_pix_norm1_rvv(const uint8_t *pix, int line_size); @@ -32,10 +34,15 @@ av_cold void ff_mpegvideoencdsp_init_riscv(MpegvideoEncDSPContext *c, #if HAVE_RVV int flags = av_get_cpu_flags(); -if (flags & AV_CPU_FLAG_RVV_I64) { -if ((flags & AV_CPU_FLAG_RVB) && ff_rv_vlen_least(128)) -c->pix_sum = ff_pix_sum_rvv; -c->pix_norm1 = ff_pix_norm1_rvv; +if (flags & AV_CPU_FLAG_RVV_I32) { +if (flags & AV_CPU_FLAG_RVB) +c->try_8x8basis = ff_try_8x8basis_rvv; + +if (flags & AV_CPU_FLAG_RVV_I64) { +if ((flags & AV_CPU_FLAG_RVB) && ff_rv_vlen_least(128)) +c->pix_sum = ff_pix_sum_rvv; +c->pix_norm1 = ff_pix_norm1_rvv; +} } #endif } diff --git a/libavcodec/riscv/mpegvideoencdsp_rvv.S b/libavcodec/riscv/mpegvideoencdsp_rvv.S index 2f25b00eb2..9408de47c8 100644 --- a/libavcodec/riscv/mpegvideoencdsp_rvv.S +++ b/libavcodec/riscv/mpegvideoencdsp_rvv.S @@ -20,6 +20,41 @@ #include "libavutil/riscv/asm.S" +.equBASIS_SHIFT, 16 +.equRECON_SHIFT, 6 + +func ff_try_8x8basis_rvv, zve32x, b +li t1, 64 +csrwi vxrm, 0 +vsetvli t0, t1, e32, m8, ta, ma +vmv.v.x v24, zero +vmv.s.x v1, zero +1: +vsetvli zero, zero, e16, m4, ta, ma +vle16.v v4, (a2) +sub t1, t1, t0 +vwmul.vxv16, v4, a3 +sh1add a2, t0, a2 +vle16.v v8, (a0) +sh1add a0, t0, a0 +vnclip.wi v4, v16, BASIS_SHIFT - RECON_SHIFT +vle16.v v12, (a1) +sh1add a1, t0, a1 +vadd.vv v4, v8, v4 +vsra.vi v4, v4, RECON_SHIFT +vwmul.vvv16, v12, v4 +vsetvli zero, zero, e32, m8, ta, ma +vmul.vv v16, v16, v16 +vsra.vi v16, v16, 4 +vadd.vv v24, v24, v16 +bnezt1, 1b + +vredsum.vs v1, v24, v1 +vmv.x.s a0, v1 +sraia0, a0, 2 +ret +endfunc + func ff_pix_sum_rvv, zve64x, b lpad0 vsetivlit0, 16, e16, m1, ta, ma -- 2.45.2 ___ 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/mpegvideoencdsp: R-V V add_8x8basis
T-Head C908: add_8x8basis_c: 440.6 add_8x8basis_rvv_i32: 70.3 SpacemiT X60: add_8x8basis_c: 436.3 add_8x8basis_rvv_i32: 40.5 --- libavcodec/riscv/mpegvideoencdsp_init.c | 5 - libavcodec/riscv/mpegvideoencdsp_rvv.S | 19 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/mpegvideoencdsp_init.c b/libavcodec/riscv/mpegvideoencdsp_init.c index 4c156c1cf2..1ac808af16 100644 --- a/libavcodec/riscv/mpegvideoencdsp_init.c +++ b/libavcodec/riscv/mpegvideoencdsp_init.c @@ -25,6 +25,7 @@ int ff_try_8x8basis_rvv(const int16_t rem[64], const int16_t weight[64], const int16_t basis[16], int scale); +void ff_add_8x8basis_rvv(int16_t rem[64], const int16_t basis[16], int scale); int ff_pix_sum_rvv(const uint8_t *pix, int line_size); int ff_pix_norm1_rvv(const uint8_t *pix, int line_size); @@ -35,8 +36,10 @@ av_cold void ff_mpegvideoencdsp_init_riscv(MpegvideoEncDSPContext *c, int flags = av_get_cpu_flags(); if (flags & AV_CPU_FLAG_RVV_I32) { -if (flags & AV_CPU_FLAG_RVB) +if (flags & AV_CPU_FLAG_RVB) { c->try_8x8basis = ff_try_8x8basis_rvv; +c->add_8x8basis = ff_add_8x8basis_rvv; +} if (flags & AV_CPU_FLAG_RVV_I64) { if ((flags & AV_CPU_FLAG_RVB) && ff_rv_vlen_least(128)) diff --git a/libavcodec/riscv/mpegvideoencdsp_rvv.S b/libavcodec/riscv/mpegvideoencdsp_rvv.S index 9408de47c8..7c50526934 100644 --- a/libavcodec/riscv/mpegvideoencdsp_rvv.S +++ b/libavcodec/riscv/mpegvideoencdsp_rvv.S @@ -55,6 +55,25 @@ func ff_try_8x8basis_rvv, zve32x, b ret endfunc +func ff_add_8x8basis_rvv, zve32x, b +li t1, 64 +csrwi vxrm, 0 +1: +vsetvli t0, t1, e16, m4, ta, ma +vle16.v v4, (a1) +sub t1, t1, t0 +vwmul.vxv16, v4, a2 +sh1add a1, t0, a1 +vle16.v v8, (a0) +vnclip.wi v4, v16, BASIS_SHIFT - RECON_SHIFT +vadd.vv v4, v8, v4 +vse16.v v4, (a0) +sh1add a0, t0, a0 +bnezt1, 1b + +ret +endfunc + func ff_pix_sum_rvv, zve64x, b lpad0 vsetivlit0, 16, e16, m1, ta, ma -- 2.45.2 ___ 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] hwcontext_vulkan: enable VK_KHR_video_maintenance1
We require it for encoding. --- libavutil/hwcontext_vulkan.c | 12 +++- libavutil/vulkan_functions.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 3e562716d8..a82355e8bf 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -94,6 +94,7 @@ typedef struct VulkanDevicePriv { VkPhysicalDeviceCooperativeMatrixFeaturesKHR coop_matrix_features; VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow_features; VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features; +VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features; /* Queues */ pthread_mutex_t **qf_mutex; @@ -422,6 +423,7 @@ static const VulkanOptExtension optional_device_exts[] = { { VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME, FF_VK_EXT_COOP_MATRIX}, { VK_NV_OPTICAL_FLOW_EXTENSION_NAME, FF_VK_EXT_OPTICAL_FLOW }, { VK_EXT_SHADER_OBJECT_EXTENSION_NAME, FF_VK_EXT_SHADER_OBJECT }, +{ VK_KHR_VIDEO_MAINTENANCE_1_EXTENSION_NAME, FF_VK_EXT_VIDEO_MAINTENANCE_1}, /* Imports/exports */ { VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_MEMORY }, @@ -1399,9 +1401,13 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, VkPhysicalDeviceTimelineSemaphoreFeatures timeline_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES, }; +VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features = { +.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR, +.pNext = &timeline_features, +}; VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT, -.pNext = &timeline_features, +.pNext = &video_maint_1_features, }; VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV, @@ -1496,6 +1502,8 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, p->device_features_1_3.shaderZeroInitializeWorkgroupMemory = dev_features_1_3.shaderZeroInitializeWorkgroupMemory; p->device_features_1_3.dynamicRendering = dev_features_1_3.dynamicRendering; +p->video_maint_1_features.videoMaintenance1 = video_maint_1_features.videoMaintenance1; + p->desc_buf_features.descriptorBuffer = desc_buf_features.descriptorBuffer; p->desc_buf_features.descriptorBufferPushDescriptors = desc_buf_features.descriptorBufferPushDescriptors; @@ -1545,6 +1553,8 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT); OPT_CHAIN(FF_VK_EXT_OPTICAL_FLOW, &p->optical_flow_features, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV); +OPT_CHAIN(FF_VK_EXT_VIDEO_MAINTENANCE_1, &p->video_maint_1_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR); #undef OPT_CHAIN /* Add the enabled features into the pnext chain of device creation */ diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h index 5fbde96cfe..d4697ec34c 100644 --- a/libavutil/vulkan_functions.h +++ b/libavutil/vulkan_functions.h @@ -49,6 +49,7 @@ typedef enum FFVulkanExtensions { FF_VK_EXT_OPTICAL_FLOW = 1ULL << 17, /* VK_NV_optical_flow */ FF_VK_EXT_SHADER_OBJECT = 1ULL << 18, /* VK_EXT_shader_object */ +FF_VK_EXT_VIDEO_MAINTENANCE_1= 1ULL << 27, /* VK_KHR_video_maintenance1 */ FF_VK_EXT_VIDEO_ENCODE_QUEUE = 1ULL << 28, /* VK_KHR_video_encode_queue */ FF_VK_EXT_VIDEO_ENCODE_H264 = 1ULL << 29, /* VK_KHR_video_encode_h264 */ FF_VK_EXT_VIDEO_ENCODE_H265 = 1ULL << 30, /* VK_KHR_video_encode_h265 */ -- 2.45.2.753.g447d99e1c3b ___ 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] hwcontext_vulkan: enable encoding of images if video_maintenance1 is enabled
Vulkan encoding was designed in a very... consolidated way. You had to know the exact codec and profile that the image was going to eventually be encoded as at... image creation time. Unfortunately, as good as our code is, glimpsing into the exact future isn't what its capable of. video_maintenance1 removed that requirement, which only then made encoding images practically possible. --- libavcodec/vulkan_decode.c | 10 ++ libavfilter/vulkan_filter.c | 23 --- libavutil/hwcontext_vulkan.c | 13 + 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index c7a32cc439..e73d4f93c2 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -934,6 +934,10 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; + +if (ctx->s.extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE | + FF_VK_EXT_VIDEO_MAINTENANCE_1)) +fmt_info.imageUsage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR; } /* Get the format of the images necessary */ @@ -1023,6 +1027,7 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) AVVulkanFramesContext *hwfc = frames_ctx->hwctx; FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data; FFVulkanDecodeProfileData *prof; +FFVulkanDecodeShared *ctx; frames_ctx->sw_format = AV_PIX_FMT_NONE; @@ -1059,6 +1064,11 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) if (!dec->dedicated_dpb) hwfc->usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR; +ctx = dec->shared_ctx; +if (ctx->s.extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE | + FF_VK_EXT_VIDEO_MAINTENANCE_1)) +hwfc->usage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR; + return err; } diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c index cef42eeb4d..fd70d90b1a 100644 --- a/libavfilter/vulkan_filter.c +++ b/libavfilter/vulkan_filter.c @@ -36,6 +36,7 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, FFVulkanContext *s, if (frames_ref) { int no_storage = 0; FFVulkanFunctions *vk; +VkImageUsageFlagBits usage_req; const VkFormat *sub = av_vkfmt_from_pixfmt(sw_format); frames_ctx = (AVHWFramesContext *)frames_ref->data; @@ -56,13 +57,20 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, FFVulkanContext *s, if (vk_frames->tiling != VK_IMAGE_TILING_OPTIMAL) goto skip; +s->extensions = ff_vk_extensions_to_mask(vk_dev->enabled_dev_extensions, + vk_dev->nb_enabled_dev_extensions); + /* Usage mismatch */ -if ((vk_frames->usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT)) != -(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT)) +usage_req = VK_IMAGE_USAGE_SAMPLED_BIT | +VK_IMAGE_USAGE_STORAGE_BIT; +if (s->extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE | + FF_VK_EXT_VIDEO_MAINTENANCE_1)) +usage_req |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR; + +if ((vk_frames->usage & usage_req) != usage_req) goto skip; -s->extensions = ff_vk_extensions_to_mask(vk_dev->enabled_dev_extensions, - vk_dev->nb_enabled_dev_extensions); +/* More advanced format checks */ err = ff_vk_load_functions(device_ctx, &s->vkfn, s->extensions, 1, 1); if (err < 0) return err; @@ -112,13 +120,6 @@ skip: frames_ctx->width = width; frames_ctx->height= height; -vk_frames = frames_ctx->hwctx; -vk_frames->tiling = VK_IMAGE_TILING_OPTIMAL; -vk_frames->usage = VK_IMAGE_USAGE_SAMPLED_BIT | -VK_IMAGE_USAGE_STORAGE_BIT | -VK_IMAGE_USAGE_TRANSFER_SRC_BIT | -VK_IMAGE_USAGE_TRANSFER_DST_BIT; - err = av_hwframe_ctx_init(frames_ref); if (err < 0) { av_buffer_unref(&frames_ref); diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index a82355e8bf..3ccefa9525 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -2630,6 +2630,11 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc) VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); + +/* Enables en
Re: [FFmpeg-devel] [PATCH 5/6] tools/target_dec_fuzzer: Use av_buffer_allocz() to avoid missing slices to have unpredictable content
On Mon, Aug 12, 2024 at 09:02:00PM +0200, Michael Niedermayer wrote: > On Sat, Aug 10, 2024 at 12:34:16PM -0300, James Almer wrote: > > On 8/9/2024 5:09 PM, Michael Niedermayer wrote: > > > Hi > > > > > > On Fri, Aug 09, 2024 at 03:56:42AM +0200, Kacper Michajlow wrote: > > > > On Fri, 9 Aug 2024 at 00:06, Michael Niedermayer > > > > wrote: > > > > > > > > > > On Thu, Aug 08, 2024 at 02:13:12PM -0300, James Almer wrote: > > > [...] > > > > > If decoders are fed with uninitialized buffers thats a > > > > > security issue because there are thousands if not ten thousands of > > > > > pathes if you consider the number of decoders and the number > > > > > of ways they can hit errors > > > > > > > > Clearing those buffers in fuzzers does not alleviate this security > > > > issue, as they may still be uninitialized in production code. > > > > > > The decoders in production clear the buffers. The fuzzer does not > > > so the issues it shows dont exist in production > > > > > > look yourself in get_buffer.c > > > > > > pool->pools[i] = av_buffer_pool_init(size[i] + 16 + > > > STRIDE_ALIGN - 1, > > > > > > CONFIG_MEMORY_POISONING ? > > > NULL : > > > > > > av_buffer_allocz); > > > its av_buffer_allocz > > > > I disagree. That's from avcodec_default_get_buffer2(). What about DR1 > > decoders where the caller is using their own avctx.get_buffer2() callback? > > Nothing in the documentation says that the buffers must be zeroed. > > > > I wrote the function you just changed with the intention of finding issues a > > library user could trigger, which included allocating buffers exactly as big > > as needed (with no extra padding) and not zeroing it, using lavu helpers > > like the get_buffer2() documentation states. > > > > This change here makes half of that moot, and is hiding potential bugs in > > the form of use of uninitialized memory in our decoders. > > we have several sanitizers, msan is just one of them > outside msan, using uninitialized buffers is only having one effect and that > is it makes things less reproducable > > using uninitialized buffers is a security issue. Its a secuirty issue > because many of our decoders pass uninitialized data through on errors. > An attacker uploads a file with error and gets a encoded file back, that > encoded file now contains what was in the memory of these uninitialized > buffers > An attacker is not supposed to be able to read your memory like that > > we have 481 DR1 decoders. For the use for uninitialized buffers to be safe > you need to have every error path on every of these decoders to clean every > bit of > the buffer that was not initialized. > This is not how you design secure software > Design that needs "every" multiplied by "every" to do a specific thing is bad > security > > noone volunteered to make all the decoders handle uninitialized buffers > Simply making these issues appear in ossfuzz doesnt fix them > > IMHO > If someone wants to work on uninitialized buffer support and fixes, perfectly > fine with me. What i do not agree to is the attempt to force the already very > busy people to work on and fix these issues when a simply "memset()" avoids > the whole issue > > Again, on one hand one memset() on the other 481 DR1 decoders that clear the > right > bits of the buffer on EVERY error path. > > Thats like strlcpy() vs strcpy() with no bugs on any use. We know which of > this > is a bad idea. Why is it here something we argue about ? > because DR1 doesnt document that the buffer contents can leak through (which > really is what it should say not "you must clear it") > Its good enough if the user app ensures the buffer contains no sensitive data > > and no matter how hard we try to fix all decoders so they never leak something > thorugh. we should still say the custom buffers should not contain sensitive > data, so iam not sure but i dont think we disagree here or do we ? > > thx Also if someone wants to look at decoders passing uninitialized data thorugh here are a few 70836 #0 0x567ec5e29ae1 in ff_add_png_paeth_prediction /src/ffmpeg/libavcodec/pngdec.c:236:22 #1 0x567ec5e2a96f in ff_png_filter_row /src/ffmpeg/libavcodec/pngdec.c:330:17 #2 0x567ec5de85ca in handle_row /src/ffmpeg/libavcodec/lscrdec.c:71:5 #3 0x567ec5de85ca in decode_idat /src/ffmpeg/libavcodec/lscrdec.c:97:17 #4 0x567ec5de85ca in decode_frame_lscr /src/ffmpeg/libavcodec/lscrdec.c:193:19 #5 0x567ec5dca27b in decode_simple_internal /src/ffmpeg/libavcodec/decode.c:429:20 #6 0x567ec5dca27b in decode_simple_receive_frame /src/ffmpeg/libavcodec/decode.c:600:15 #7 0x567ec5dca27b in decode_receive_frame_internal /src/ffmpeg/libavcodec/decode.c:631:15 #8 0x567ec5dc97e3 in avcodec_send_packet /src/ffmpeg/libavcodec/decode.c:721:15 #9 0x567e
[FFmpeg-devel] [PATCH 1/5] MAINTAINERS: Add a maintaince level field
Text was stolen from the linux kernel This is thus identical to the kernel just a different more compact format. I am very happy also to switch the file entirely to the format of the linux kernel maintainer list if people prefer Signed-off-by: Michael Niedermayer --- MAINTAINERS | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6ce8bc86393..a27116e9d15 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6,7 +6,12 @@ FFmpeg code. Please try to keep entries where you are the maintainer up to date! -Names in () mean that the maintainer currently has no time to maintain the code. +maintaince level: +[X] Old code. Something tagged obsolete generally means it has been replaced by a better system and you should be using that. +[0] No current maintainer [but maybe you could take the role as you write your new code]. +[1] It has a maintainer but they don't have time to do much other than throw the odd patch in. +[2] Someone actually looks after it. + A (CC ) after the name means that the maintainer prefers to be CC-ed on patches and related discussions. -- 2.45.2 ___ 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/5] MAINTAINERS: some random updating
Adding level to some of my entries Adding level to some random entries of other people who i have seen actively maintaining their code removing some people who have not been active where others where active For most we will need to contact people and ask if they are still available as maintainers (but for cases where patches are ignored for many months even with pings sent to the maintainer entries should be set to unmaintained) Signed-off-by: Michael Niedermayer --- MAINTAINERS | 60 ++--- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index a27116e9d15..94d9b04d249 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23,10 +23,10 @@ ffmpeg: ffmpeg.c Michael Niedermayer, Anton Khirnov ffplay: - ffplay.c Marton Balint + ffplay.c [2] Marton Balint ffprobe: - ffprobe.c Stefano Sabatini + ffprobe.c [2] Stefano Sabatini Commandline utility code: cmdutils.c, cmdutils.hMichael Niedermayer @@ -53,11 +53,11 @@ Communication website Deby Barbara Lepage fate.ffmpeg.org Timothy Gu Trac bug trackerAlexander Strasser, Michael Niedermayer, Carl Eugen Hoyos -Patchwork Andriy Gelman +Patchwork [2] Andriy Gelman mailing lists Baptiste Coudurier Twitter Reynaldo H. Verdejo Pinochet Launchpad Timothy Gu -ffmpeg-security Andreas Cadhalpun, Carl Eugen Hoyos, Clément Bœsch, Michael Niedermayer, Reimar Doeffinger, rcombs, wm4 +ffmpeg-security [2] Michael Niedermayer, Reimar Doeffinger libavutil @@ -74,22 +74,22 @@ Other: bswap.h des Reimar Doeffinger dynarray.hNicolas George - eval.c, eval.hMichael Niedermayer + eval.c, eval.h[2] Michael Niedermayer float_dsp Loren Merritt hash Reimar Doeffinger hwcontext_cuda* Timo Rothenpieler - hwcontext_vulkan* Lynne + hwcontext_vulkan* [2] Lynne intfloat* Michael Niedermayer integer.c, integer.h Michael Niedermayer lzo Reimar Doeffinger - mathematics.c, mathematics.h Michael Niedermayer - mem.c, mem.h Michael Niedermayer + mathematics.c, mathematics.h [2] Michael Niedermayer + mem.c, mem.h [2] Michael Niedermayer opencl.c, opencl.hWei Gao opt.c, opt.h Michael Niedermayer - rational.c, rational.hMichael Niedermayer + rational.c, rational.h[2] Michael Niedermayer rc4 Reimar Doeffinger ripemd.c, ripemd.hJames Almer - tx* Lynne + tx* [2] Lynne libavcodec @@ -114,17 +114,17 @@ Generic Parts: rangecoder.c, rangecoder.h Michael Niedermayer lzw.* Michael Niedermayer floating point AAN DCT: -faandct.c, faandct.hMichael Niedermayer +faandct.c, faandct.h[2] Michael Niedermayer Golomb coding: -golomb.c, golomb.h Michael Niedermayer +golomb.c, golomb.h [2] Michael Niedermayer motion estimation: motion* Michael Niedermayer rate control: -ratecontrol.c Michael Niedermayer +ratecontrol.c [2] Michael Niedermayer simple IDCT: -simple_idct.c, simple_idct.hMichael Niedermayer +simple_idct.c, simple_idct.h[2] Michael Niedermayer postprocessing: -libpostproc/* Michael Niedermayer +libpostproc/* [2] Michael Niedermayer table generation: tableprint.c, tableprint.h Reimar Doeffinger fixed point FFT: @@ -132,7 +132,7 @@ Generic Parts: Text SubtitlesClément Bœsch Codecs: - 4xm.c Michael Niedermayer + 4xm.c [2] Michael Niedermayer 8bps.cRoberto Togni 8svx.cJaikrishnan Menon aacenc*, aaccoder.c Rostislav Pehlivanov @@ -168,7 +168,7 @@ Codecs: dvbsubdec.c Anshul Maheshwari eacmv*, eaidct*, eat* Peter Ross exif.c, exif.hThilo Borgm
[FFmpeg-devel] [PATCH 3/5] avcodec/wmavoice: Do not use uninitialized pitch[0]
Fixes: use of uninitialized value Fixes: 70850/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-4806127362048000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/wmavoice.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 3db73773b77..39868e02b3c 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -1506,6 +1506,8 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx, /* Parse frame type ("frame header"), see frame_descs */ int bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc, 6, 3)], block_nsamples; +pitch[0] = INT_MAX; + if (bd_idx < 0) { av_log(ctx, AV_LOG_ERROR, "Invalid frame type VLC code, skipping\n"); @@ -1623,6 +1625,9 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx, double i_lsps[MAX_LSPS]; float lpcs[MAX_LSPS]; +if(frame_descs[bd_idx].fcb_type >= FCB_TYPE_AW_PULSES && pitch[0] == INT_MAX) +return AVERROR_INVALIDDATA; + for (n = 0; n < s->lsps; n++) // LSF -> LSP i_lsps[n] = cos(0.5 * (prev_lsps[n] + lsps[n])); ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1); -- 2.45.2 ___ 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 4/5] avformat/mvdec: Check if name was fully read
Fixes: use of uninitialized value Fixes: 70901/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-6341913949569024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mvdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c index 0718f0483a7..c045d2c7c8e 100644 --- a/libavformat/mvdec.c +++ b/libavformat/mvdec.c @@ -256,7 +256,8 @@ static int read_table(AVFormatContext *avctx, AVStream *st, if (avio_feof(pb)) return AVERROR_EOF; -avio_read(pb, name, 16); +if (avio_read(pb, name, 16) != 16) +return AVERROR_INVALIDDATA; name[sizeof(name) - 1] = 0; size = avio_rb32(pb); if (size < 0) { -- 2.45.2 ___ 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 5/5] avcodec/msmpeg4dec: init dc_pred_dir
Its not really used but its passed as a argument and then not used Fixes: 70965/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSMPEG4V1_fuzzer-5583223747313664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/msmpeg4dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index 31b17c2839e..12bef4f5066 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -628,7 +628,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block, int n, int coded, const uint8_t *scan_table) { int level, i, last, run, run_diff; -int av_uninit(dc_pred_dir); +int dc_pred_dir = -1; //unused but its passed around, so it needs to be initialized const RLTable *rl; const RL_VLC_ELEM *rl_vlc; int qmul, qadd; -- 2.45.2 ___ 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] MAINTAINERS: add CC preference for myself
--- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6ce8bc8639..1f758f401c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -469,7 +469,7 @@ Protocols: libzmq.c Andriy Gelman mms*.cRonald S. Bultje udp.c Luca Abeni - icecast.c Marvin Scholz + icecast.c Marvin Scholz (CC ) libswresample base-commit: 7ad937f0c8cb9f120c50f3e792a699076923768e -- 2.39.3 (Apple Git-146) ___ 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] [h264] Use small padding with the checked bitstream reader.
MAX_MBPAIR_SIZE was added in 23f5cff92cdcfa55a735c458fcb5f95c0e0f3b1f to prevent CABAC/CAVLC overread issues. It adds 256kb of padding to RBSP allocations. AFAICT it seems unnecessary with the checked bitstream reader. Dropping this padding is a substantial memory improvement for constrained devices. 782865bf3094e36cbb4bd9cfacda252307e6589d removed the small padding when AV_CODEC_FLAG2_FAST was set, but I don't have access to that fuzzer test case to check this patch. Does anyone have this for testing? This didn't trigger any fuzzer warnings in Chrome with our existing corpus, but please yell if I've done something silly. Signed-off-by: Dale Curtis no_padding.patch Description: Binary data ___ 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 9/9] avformat/mov: Use int64_t in intermediate for corrected_dts
On Mon, 3 Jun 2024 at 04:16, Michael Niedermayer wrote: > > Fixes: CID1500312 Unintentional integer overflow > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Michael Niedermayer > --- > libavformat/mov.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index d15b7b70c50..93643304212 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -3386,7 +3386,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > sc->stts_data[i].duration = 1; > corrected_dts += (delta_magnitude < 0 ? (int64_t)delta_magnitude > : 1) * sample_count; > } else { > -corrected_dts += sample_duration * sample_count; > +corrected_dts += sample_duration * (int64_t)sample_count; > } > > current_dts += sc->stts_data[i].duration * (int64_t)sample_count; > -- > 2.45.1 This is not enough to guard the overflow, the addition can still overflow. mov.c:3500:27: runtime error: signed integer overflow: 3206437752653027430 + 8549083172438480532 cannot be represented in type 'int64_t' (aka 'long') - Kacper ___ 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] lavc/qsvdec: Add vvc_mp4toannexb bsf for QSV VVC decoder
From: Fei Wang Fix error: $ ffmpeg -hwaccel qsv -i input.mp4 -f null - .. [vvc_qsv @ 026890D966C0] Error decoding stream header: unknown error (-1) [vvc_qsv @ 026890D966C0] Error decoding header Signed-off-by: Fei Wang --- configure | 2 +- libavcodec/qsvdec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 37178d7d81..ad82bc2d1f 100755 --- a/configure +++ b/configure @@ -3427,7 +3427,7 @@ vp9_vaapi_encoder_select="vaapi_encode" vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9" vp9_qsv_encoder_select="qsvenc" vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m" -vvc_qsv_decoder_select="qsvdec" +vvc_qsv_decoder_select="vvc_mp4toannexb_bsf qsvdec" # parsers aac_parser_select="adts_header mpeg4audio" diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 9ad3439991..039ba62484 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -1303,5 +1303,5 @@ DEFINE_QSV_DECODER(av1, AV1, NULL) #endif #if CONFIG_VVC_QSV_DECODER -DEFINE_QSV_DECODER(vvc, VVC, NULL) +DEFINE_QSV_DECODER(vvc, VVC, "vvc_mp4toannexb") #endif -- 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] lavc/qsvdec: Add vvc_mp4toannexb bsf for QSV VVC decoder
On Wed, 2024-08-14 at 06:41 +, Xiang, Haihao wrote: > On Di, 2024-08-13 at 16:01 +0800, > fei.w.wang-at-intel@ffmpeg.org wrote: > > From: Fei Wang > > > > Fix error: > > $ ffmpeg -hwaccel qsv -i input.mp4 -f null - > > .. > > [vvc_qsv @ 026890D966C0] Error decoding stream header: unknown > > error (-1) > > [vvc_qsv @ 026890D966C0] Error decoding header > > > > Signed-off-by: Fei Wang > > --- > > libavcodec/qsvdec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c > > index 9ad3439991..039ba62484 100644 > > --- a/libavcodec/qsvdec.c > > +++ b/libavcodec/qsvdec.c > > @@ -1303,5 +1303,5 @@ DEFINE_QSV_DECODER(av1, AV1, NULL) > > #endif > > > > #if CONFIG_VVC_QSV_DECODER > > -DEFINE_QSV_DECODER(vvc, VVC, NULL) > > +DEFINE_QSV_DECODER(vvc, VVC, "vvc_mp4toannexb") > > #endif > > Please update vvc_qsv_decoder_select in configure too. Fixed in V2. Thanks. -- Fei > > 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] MAINTAINERS: add CC preference for myself
On Thu, Aug 15, 2024 at 12:41:44AM +0200, Marvin Scholz wrote: > --- > MAINTAINERS | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 6ce8bc8639..1f758f401c 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -469,7 +469,7 @@ Protocols: >libzmq.c Andriy Gelman >mms*.cRonald S. Bultje >udp.c Luca Abeni > - icecast.c Marvin Scholz > + icecast.c Marvin Scholz (CC > ) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Any man who breaks a law that conscience tells him is unjust and willingly accepts the penalty by staying in jail in order to arouse the conscience of the community on the injustice of the law is at that moment expressing the very highest respect for law. - Martin Luther King Jr signature.asc Description: PGP signature ___ 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/5] MAINTAINERS: some random updating
On 2024-08-15 04:07 am, Michael Niedermayer wrote: Adding level to some of my entries Adding level to some random entries of other people who i have seen actively maintaining their code removing some people who have not been active where others where active For most we will need to contact people and ask if they are still available as maintainers (but for cases where patches are ignored for many months even with pings sent to the maintainer entries should be set to unmaintained) Signed-off-by: Michael Niedermayer --- MAINTAINERS | 60 ++--- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index a27116e9d15..94d9b04d249 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23,10 +23,10 @@ ffmpeg: ffmpeg.c Michael Niedermayer, Anton Khirnov ffplay: - ffplay.c Marton Balint + ffplay.c [2] Marton Balint ffprobe: - ffprobe.c Stefano Sabatini + ffprobe.c [2] Stefano Sabatini Commandline utility code: cmdutils.c, cmdutils.hMichael Niedermayer @@ -53,11 +53,11 @@ Communication website Deby Barbara Lepage fate.ffmpeg.org Timothy Gu Trac bug trackerAlexander Strasser, Michael Niedermayer, Carl Eugen Hoyos -Patchwork Andriy Gelman +Patchwork [2] Andriy Gelman mailing lists Baptiste Coudurier Twitter Reynaldo H. Verdejo Pinochet Launchpad Timothy Gu -ffmpeg-security Andreas Cadhalpun, Carl Eugen Hoyos, Clément Bœsch, Michael Niedermayer, Reimar Doeffinger, rcombs, wm4 +ffmpeg-security [2] Michael Niedermayer, Reimar Doeffinger Does the status apply to just you or all listed? The notation is ambiguous. Regards, Gyan ___ 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".