Re: [FFmpeg-devel] [PATCH] avcodec/mfenc: add support for AV1 MF encoders
Thanks for pointing this out, Martin. Please find the updated patch below: >From 83e8cfa99bcb13965421fb32c1feb4c792649c22 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Fri, 4 Oct 2024 23:04:04 +0530 Subject: [PATCH] avcodec/mfenc: add support for AV1 MF encoders X-Unsent: 1 To: ffmpeg-devel@ffmpeg.org Signed-off-by: Dash Santosh --- configure | 1 + libavcodec/allcodecs.c | 1 + libavcodec/mf_utils.c | 2 ++ libavcodec/mf_utils.h | 1 + libavcodec/mfenc.c | 1 + 5 files changed, 6 insertions(+) diff --git a/configure b/configure index 0247ea08d6..63bc53cc27 100755 --- a/configure +++ b/configure @@ -3347,6 +3347,7 @@ av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS" av1_mediacodec_decoder_deps="mediacodec" av1_mediacodec_encoder_deps="mediacodec" av1_mediacodec_encoder_select="extract_extradata_bsf" +av1_mf_encoder_deps="mediafoundation" av1_nvenc_encoder_deps="nvenc NV_ENC_PIC_PARAMS_AV1" av1_nvenc_encoder_select="atsc_a53" av1_qsv_decoder_select="qsvdec" diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index aa0fc47647..f5317616b7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -838,6 +838,7 @@ extern const FFCodec ff_av1_nvenc_encoder; extern const FFCodec ff_av1_qsv_decoder; extern const FFCodec ff_av1_qsv_encoder; extern const FFCodec ff_av1_amf_encoder; +extern const FFCodec ff_av1_mf_encoder; extern const FFCodec ff_av1_vaapi_encoder; extern const FFCodec ff_libopenh264_encoder; extern const FFCodec ff_libopenh264_decoder; diff --git a/libavcodec/mf_utils.c b/libavcodec/mf_utils.c index 48e3a63efc..ff44130ca9 100644 --- a/libavcodec/mf_utils.c +++ b/libavcodec/mf_utils.c @@ -240,6 +240,7 @@ static struct GUID_Entry guid_names[] = { GUID_ENTRY(MFMediaType_Video), GUID_ENTRY(MFAudioFormat_PCM), GUID_ENTRY(MFAudioFormat_Float), +GUID_ENTRY(ff_MFVideoFormat_AV1), GUID_ENTRY(MFVideoFormat_H264), GUID_ENTRY(MFVideoFormat_H264_ES), GUID_ENTRY(ff_MFVideoFormat_HEVC), @@ -507,6 +508,7 @@ void ff_media_type_dump(void *log, IMFMediaType *type) const CLSID *ff_codec_to_mf_subtype(enum AVCodecID codec) { switch (codec) { +case AV_CODEC_ID_AV1: return &ff_MFVideoFormat_AV1; case AV_CODEC_ID_H264: return &MFVideoFormat_H264; case AV_CODEC_ID_HEVC: return &ff_MFVideoFormat_HEVC; case AV_CODEC_ID_AC3: return &MFAudioFormat_Dolby_AC3; diff --git a/libavcodec/mf_utils.h b/libavcodec/mf_utils.h index 387c005f38..a59b36d015 100644 --- a/libavcodec/mf_utils.h +++ b/libavcodec/mf_utils.h @@ -113,6 +113,7 @@ DEFINE_GUID(ff_MF_SA_MINIMUM_OUTPUT_SAMPLE_COUNT_PROGRESSIVE, 0xf5523a5, 0x1cb2, DEFINE_MEDIATYPE_GUID(ff_MFVideoFormat_HEVC, 0x43564548); // FCC('HEVC') DEFINE_MEDIATYPE_GUID(ff_MFVideoFormat_HEVC_ES, 0x53564548); // FCC('HEVS') +DEFINE_MEDIATYPE_GUID(ff_MFVideoFormat_AV1, 0x31305641); // FCC('AV01') // This enum is missing from mingw-w64's codecapi.h by v7.0.0. diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c index b8f8a25f43..c062d87f11 100644 --- a/libavcodec/mfenc.c +++ b/libavcodec/mfenc.c @@ -1315,3 +1315,4 @@ static const FFCodecDefault defaults[] = { MF_ENCODER(VIDEO, h264,H264, venc_opts, VFMTS, VCAPS, defaults); MF_ENCODER(VIDEO, hevc,HEVC, venc_opts, VFMTS, VCAPS, defaults); +MF_ENCODER(VIDEO, av1, AV1, venc_opts, VFMTS, VCAPS, defaults); -- 2.43.0.windows.1 On Fri, Oct 4, 2024 at 11:20 PM Martin Storsjö wrote: > On Fri, 4 Oct 2024, Dash Santosh wrote: > > > From 77c708805c52302861650cf770f6c32a33590e90 Mon Sep 17 00:00:00 2001 > > From: Min Chen > > Date: Fri, 4 Oct 2024 23:04:04 +0530 > > Subject: [PATCH] avcodec/mfenc: add support for AV1 MF encoders > > X-Unsent: 1 > > To: ffmpeg-devel@ffmpeg.org > > > > Signed-off-by: Dash Santosh > > --- > > configure | 1 + > > libavcodec/allcodecs.c | 1 + > > libavcodec/mf_utils.c | 2 ++ > > libavcodec/mfenc.c | 1 + > > 4 files changed, 5 insertions(+) > > > > diff --git a/configure b/configure > > index 0247ea08d6..63bc53cc27 100755 > > --- a/configure > > +++ b/configure > > @@ -3347,6 +3347,7 @@ av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS" > > av1_mediacodec_decoder_deps="mediacodec" > > av1_mediacodec_encoder_deps="mediacodec" > > av1_mediacodec_encoder_select="extract_extradata_bsf" > > +av1_mf_encoder_deps="mediafoundation" > > av1_nvenc_encoder_deps="nvenc NV_ENC_PIC_PARAMS_AV1" > > av1_nvenc_encoder_select="atsc_a53" > > av1_qsv_decoder_select="qsvdec" > > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > > index aa0fc47647..f5317616b7 100644 > > --- a/libavcodec/allcodecs.c > > +++ b/libavcodec/allcodecs.c > > @@ -838,6 +838,7 @@ extern const FFCodec ff_av1_nvenc_encoder; > > extern const FFCodec ff_av1_qsv_decoder; > > extern const FFCodec ff_av1_qsv_encoder; > > extern const FFCodec ff_av1_amf_encoder; > > +extern const FFCodec ff_av1_mf_encoder; > > extern const FFCodec ff_av1_vaapi_encoder; > > ex
Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails
Ping. On Mon, Sep 30, 2024, at 13:44, Thomas Guillem via ffmpeg-devel wrote: > cf. https://trac.ffmpeg.org/ticket/11013 > > > On Mon, Sep 30, 2024, at 10:27, Thomas Guillem via ffmpeg-devel wrote: >> Fixes the following assert: >> >> [7f1df83d17e0] vaapi generic error: >> avcodec_get_hw_frames_parameters failed: -22 >> Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && >> !dst->internal->hwaccel_priv_data) failed at >> libavcodec/pthread_frame.c:349 >> >> Reproduced from VLC with VAAPI, when fallbacking from hw to sw. >> --- >> libavcodec/decode.c | 7 +++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/libavcodec/decode.c b/libavcodec/decode.c >> index c331bb8596..e90a6630e1 100644 >> --- a/libavcodec/decode.c >> +++ b/libavcodec/decode.c >> @@ -19,6 +19,7 @@ >> */ >> >> #include >> +#include >> #include >> >> #include "config.h" >> @@ -1173,6 +1174,7 @@ int >> avcodec_get_hw_frames_parameters(AVCodecContext *avctx, >> const AVCodecHWConfigInternal *hw_config; >> const FFHWAccel *hwa; >> int i, ret; >> +bool clean_priv_data = false; >> >> for (i = 0;; i++) { >> hw_config = ffcodec(avctx->codec)->hw_configs[i]; >> @@ -1197,6 +1199,7 @@ int >> avcodec_get_hw_frames_parameters(AVCodecContext *avctx, >> av_buffer_unref(&frames_ref); >> return AVERROR(ENOMEM); >> } >> +clean_priv_data = true; >> } >> >> ret = hwa->frame_params(avctx, frames_ref); >> @@ -1217,6 +1220,10 @@ int >> avcodec_get_hw_frames_parameters(AVCodecContext *avctx, >> >> *out_frames_ref = frames_ref; >> } else { >> +if (clean_priv_data) { >> +av_freep(avctx->internal->hwaccel_priv_data); >> +avctx->internal->hwaccel_priv_data = NULL; >> +} >> av_buffer_unref(&frames_ref); >> } >> return ret; >> -- >> 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 mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] scale_cuda frame crop support
On 10.09.2024 20:10, Koushik Dutta wrote: The crop filter has no effect on scale_cuda: -vf crop=100:100,scale_cuda=300x300 Hardware frames (AV_PIX_FMT_FLAG_HWACCEL) are expected to use the crop_* properties, as seen in the implementation vf_crop.c. The current workaround is to hwdownload the full frame and perform the crop on CPU. --- libavfilter/vf_scale_cuda.c | 15 ++- libavfilter/vf_scale_cuda.cu | 22 ++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c index 54a340949d..eb8beee771 100644 --- a/libavfilter/vf_scale_cuda.c +++ b/libavfilter/vf_scale_cuda.c @@ -407,7 +407,7 @@ fail: } static int call_resize_kernel(AVFilterContext *ctx, CUfunction func, - CUtexObject src_tex[4], int src_width, int src_height, + CUtexObject src_tex[4], int src_left, int src_top, int src_width, int src_height, AVFrame *out_frame, int dst_width, int dst_height, int dst_pitch) { CUDAScaleContext *s = ctx->priv; @@ -422,7 +422,7 @@ static int call_resize_kernel(AVFilterContext *ctx, CUfunction func, &src_tex[0], &src_tex[1], &src_tex[2], &src_tex[3], &dst_devptr[0], &dst_devptr[1], &dst_devptr[2], &dst_devptr[3], &dst_width, &dst_height, &dst_pitch, -&src_width, &src_height, &s->param +&src_left, &src_top, &src_width, &src_height, &s->param }; return CHECK_CU(cu->cuLaunchKernel(func, @@ -440,6 +440,9 @@ static int scalecuda_resize(AVFilterContext *ctx, CUtexObject tex[4] = { 0, 0, 0, 0 }; +int crop_width = (in->width - in->crop_right) - in->crop_left; +int crop_height = (in->height - in->crop_bottom) - in->crop_top; + ret = CHECK_CU(cu->cuCtxPushCurrent(cuda_ctx)); if (ret < 0) return ret; @@ -477,7 +480,7 @@ static int scalecuda_resize(AVFilterContext *ctx, // scale primary plane(s). Usually Y (and A), or single plane of RGB frames. ret = call_resize_kernel(ctx, s->cu_func, - tex, in->width, in->height, + tex, in->crop_left, in->crop_top, crop_width, crop_height, out, out->width, out->height, out->linesize[0]); if (ret < 0) goto exit; @@ -485,8 +488,10 @@ static int scalecuda_resize(AVFilterContext *ctx, if (s->out_planes > 1) { // scale UV plane. Scale function sets both U and V plane, or singular interleaved plane. ret = call_resize_kernel(ctx, s->cu_func_uv, tex, - AV_CEIL_RSHIFT(in->width, s->in_desc->log2_chroma_w), - AV_CEIL_RSHIFT(in->height, s->in_desc->log2_chroma_h), + AV_CEIL_RSHIFT(in->crop_left, s->in_desc->log2_chroma_w), + AV_CEIL_RSHIFT(in->crop_top, s->in_desc->log2_chroma_h), + AV_CEIL_RSHIFT(crop_width, s->in_desc->log2_chroma_w), + AV_CEIL_RSHIFT(crop_height, s->in_desc->log2_chroma_h), out, AV_CEIL_RSHIFT(out->width, s->out_desc->log2_chroma_w), AV_CEIL_RSHIFT(out->height, s->out_desc->log2_chroma_h), diff --git a/libavfilter/vf_scale_cuda.cu b/libavfilter/vf_scale_cuda.cu index de06ba9433..271b55cd5d 100644 --- a/libavfilter/vf_scale_cuda.cu +++ b/libavfilter/vf_scale_cuda.cu @@ -26,6 +26,7 @@ template using subsample_function_t = T (*)(cudaTextureObject_t tex, int xo, int yo, int dst_width, int dst_height, + int src_left, int src_top, int src_width, int src_height, int bit_depth, float param); @@ -64,11 +65,12 @@ static inline __device__ ushort conv_16to10(ushort in) subsample_function_t subsample_func_uv> \ __device__ static inline void N(cudaTextureObject_t src_tex[4], T *dst[4], int xo, int yo, \ int dst_width, int dst_height, int dst_pitch, \ -int src_width, int src_height, float param) +int src_left, int src_top, int src_width, int src_height, float param) #define SUB_F(m, plane) \ subsample_func_##m(src_tex[plane], xo, yo, \ dst_width, dst_height, \ + src_left, src_top, \ src_width, src_height, \ in_bit_depth, param) @@ -1063,13 +1065,14 @@ template __device__ static inline T Subsample_Nearest(cudaTextureObject_t tex, int xo, int yo,
Re: [FFmpeg-devel] [PATCH 05/12] swscale/internal: fix and expose xyz12Torgb48 and rgb48Toxyz12
On Sat, Oct 5, 2024 at 9:25 PM Niklas Haas wrote: > From: Niklas Haas > > In the process of refactoring the signature to be more generically useful, > this fixes an 11-year-old bug where the functions (incorrectly) did nothing > when the stride was negative, since the stride was being used as the loop > bounds for x. > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/swscale.c| 98 +++-- > libswscale/swscale_internal.h | 6 ++ > tests/ref/fate/filter-pixfmts-vflip | 4 +- > 3 files changed, 60 insertions(+), 48 deletions(-) > > diff --git a/libswscale/swscale.c b/libswscale/swscale.c > index 8b6a3a84b4..b9ec976be0 100644 > --- a/libswscale/swscale.c > +++ b/libswscale/swscale.c > @@ -636,29 +636,31 @@ static int check_image_pointers(const uint8_t * const > data[4], enum AVPixelForma > return 1; > } > > -static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst, > - const uint16_t *src, int stride, int h) > +void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride, > + const uint8_t *src, int src_stride, int w, int h) > { > -int xp,yp; > const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat); > > -for (yp=0; yp -for (xp=0; xp+2 +for (int yp = 0; yp < h; yp++) { I'm all for moving variable declarations into the for-loop initializer, and also for improving readability by giving the code more spaces to breathe, but could these changes be done in separate cleanup commits? [...] ___ 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 05/12] swscale/internal: fix and expose xyz12Torgb48 and rgb48Toxyz12
On Sun, 06 Oct 2024 17:26:25 +0200 Ramiro Polla wrote: > On Sat, Oct 5, 2024 at 9:25 PM Niklas Haas wrote: > > From: Niklas Haas > > > > In the process of refactoring the signature to be more generically useful, > > this fixes an 11-year-old bug where the functions (incorrectly) did nothing > > when the stride was negative, since the stride was being used as the loop > > bounds for x. > > > > Sponsored-by: Sovereign Tech Fund > > Signed-off-by: Niklas Haas > > --- > > libswscale/swscale.c| 98 +++-- > > libswscale/swscale_internal.h | 6 ++ > > tests/ref/fate/filter-pixfmts-vflip | 4 +- > > 3 files changed, 60 insertions(+), 48 deletions(-) > > > > diff --git a/libswscale/swscale.c b/libswscale/swscale.c > > index 8b6a3a84b4..b9ec976be0 100644 > > --- a/libswscale/swscale.c > > +++ b/libswscale/swscale.c > > @@ -636,29 +636,31 @@ static int check_image_pointers(const uint8_t * const > > data[4], enum AVPixelForma > > return 1; > > } > > > > -static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst, > > - const uint16_t *src, int stride, int h) > > +void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride, > > + const uint8_t *src, int src_stride, int w, int h) > > { > > -int xp,yp; > > const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat); > > > > -for (yp=0; yp > -for (xp=0; xp+2 > +for (int yp = 0; yp < h; yp++) { > > I'm all for moving variable declarations into the for-loop > initializer, and also for improving readability by giving the code > more spaces to breathe, but could these changes be done in separate > cleanup commits? I can even split it into three commits if you prefer - one to make the width and stride explicit in the signature, and one to rename it to ff_* and expose it publicly. > > [...] > ___ > 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".
[FFmpeg-devel] [PATCH] configure: add spirv_compiler to avcodec_suggest
893f3fde4cdeb made libavcodec link to libshaderc/libglslang, though no codecs depend on it at this immediate moment. This was merged largely as a coordination effort to synchronize three different developers' repositories to allow them to send patches without overlapping functionality in between. This line can be removed once the first component to depend on spirv_compiler lands, but leaving it in is fine too. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 9b7236e69b..46c7481ef4 100755 --- a/configure +++ b/configure @@ -4039,7 +4039,7 @@ cws2fws_extralibs="zlib_extralibs" # libraries, in any order avcodec_deps="avutil" -avcodec_suggest="libm stdatomic liblcevc_dec" +avcodec_suggest="libm stdatomic liblcevc_dec spirv_compiler" avdevice_deps="avformat avcodec avutil" avdevice_suggest="libm stdatomic" avfilter_deps="avutil" -- 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".
Re: [FFmpeg-devel] [PATCH 06/12] swscale/internal: expose low level swscale() internally
On Sat, Oct 5, 2024 at 10:14 PM Niklas Haas wrote: > > From: Niklas Haas > > And give it const parameters while we're at it, because this function does > not mutate its parameters. Not entirely correct since it still modifies srcStride. After fixing this it should then be possible to remove the copy we do in scale_internal(). Thank you for working on these cleanups. Ramiro ___ 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][WIP] avisynth: support variable fps
Draft #1. For testing reasons, the patch turns on vfr mode by default so it can be tested more quickly. The seeking issues described below are problematic enough that this behavior would be reversed when actually committed, unless it can be satisfactorily resolved before then. Currently has only been tested with GCC 13 (Ubuntu) and 14 (mingw-w64). What works: * Use _DurationNum and _DurationDen frame properties (if present) to set the pkt->[pts|dts|duration]. * If the properties are not present, fall back to the legacy CFR mode, as well as allow users to switch back by choice with the existing -avisynth_flags option ('-avisynth_flags -vfr'). * Transcoding to other formats (ex. ffv1 in mkv) retains the adjusted packet durations correctly. What doesn't work: * As reported by ffprobe, the original mkv I was using as a test file has an offset between the pts and dts, as if the first couple of frames get skipped. While the logic *does* perform a similar enough skew to make the audio sync correct, the original mkv lists the dtses as N/A. * Even though the ptses match that of the original mkv file, transcoding into another mkv reports back 'starting new cluster due to timestamp' warnings, and the ffmpeg-created mkv file has some strange audio seek behavior. Remuxing with mkvmerge fixes it, so I'm not sure if this is really something to worry about with the avisynth demuxer or not. * Seeking is broken. The original file can seek without issues, and instantaneously. Files transcoded from the script act far more like, if not identically, to the original file. Seeking *forward* in the script sometimes works, but is slow, and seeking backward is completely non-functional. The size of the seeks are also seemingly not predictable; a minute or two in one area, or 15 minutes the next. Errata: * There are currently entries added to the AviSynthContext struct to calculate the frame's framerate (avs->curr_fps[num|den]). This was used in some experiments, but didn't lead to any fixes in the short term. I don't know if maybe there is a utility to this in some form that would actually be useful, which is why it's still here in the draft. * It occurs to me that comparing the seek behavior with mkv (or any other container capable of variable frame durations) is potentially like comparing apples and oranges because those containers have additional structures (e.g. an index) that handles some of the load of making sure seeking can be done accurately by their corresponding demuxers. This would mean that such an index would need to be present for the script to actually get functional seeking in vfr mode: whether by it being in the frame properties or - at worst - exposed by the AviSynth+ core itself through an api function or entirely new structure, in which case vfr-mode seeking would have to be shelved until those things appear. * Clearly, if some of the things (all the scaledur/curr_* math) could be achieved with pre-existing functions, that would be better than having to handle those calculations the way I did. That's why this is a draft. --- libavformat/avisynth.c | 95 -- 1 file changed, 82 insertions(+), 13 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index cb2be10925..958e880407 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -53,6 +53,7 @@ #endif #include +#include typedef struct AviSynthLibrary { void *library; @@ -96,6 +97,7 @@ typedef enum AviSynthFlags { AVISYNTH_FRAMEPROP_MATRIX = (1 << 4), AVISYNTH_FRAMEPROP_CHROMA_LOCATION = (1 << 5), AVISYNTH_FRAMEPROP_SAR = (1 << 6), +AVISYNTH_FRAMEPROP_VFR = (1 << 7), } AviSynthFlags; typedef struct AviSynthContext { @@ -115,6 +117,15 @@ typedef struct AviSynthContext { int error; uint32_t flags; +bool is_vfr; +int scaled_durnum; +int scaled_durden; + +int curr_duration; +int total_duration; +int curr_fpsnum; +int curr_fpsden; + struct AviSynthLibrary avs_library; } AviSynthContext; @@ -230,13 +241,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->width = avs->vi->width; st->codecpar->height = avs->vi->height; -st->avg_frame_rate= (AVRational) { avs->vi->fps_numerator, - avs->vi->fps_denominator }; -st->start_time= 0; -st->duration = avs->vi->num_frames; -st->nb_frames = avs->vi->num_frames; -avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); - switch (avs->vi->pixel_type) { /* 10~16-bit YUV pix_fmts (AviSynth+) */ @@ -721,6 +725,21 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->sample_aspect_ratio = (AVRational){ sar_num, sar_den }; } +/* Variable frame rate */ +
Re: [FFmpeg-devel] [PATCH 03/12] swscale/internal: rename NB_SWS_DITHER for consistency
On Sat, Oct 05, 2024 at 09:23:54PM +0200, Niklas Haas wrote: > From: Niklas Haas > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/options.c | 2 +- > libswscale/swscale_internal.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Some people wanted to paint the bikeshed green, some blue and some pink. People argued and fought, when they finally agreed, only rust was left. 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 04/12] swscale/internal: swap SWS_DITHER_NONE and SWS_DITHER_AUTO
On Sat, Oct 05, 2024 at 09:23:55PM +0200, Niklas Haas wrote: > From: Niklas Haas > > This is done for consistency with the other public enums which will be > added in the upcoming swscale API refactor. I went through the code and > checked > carefully that the value of `dither` is never implicitly compared against > zero, so this change should not break anything. > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/swscale_internal.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) this breaks: ./ffmpeg -i lena.pnm -vf scale=iw:ih:flags=0x02:sws_dither=0,format=bgr4_byte -bitexact whatever.bmp thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already. 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 08/12] swscale/internal: turn cascaded_tmp into an array
On Sat, Oct 05, 2024 at 09:23:59PM +0200, Niklas Haas wrote: > From: Niklas Haas > > Slightly more convenient to access from the new wrapping code. > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/swscale.c | 20 ++-- > libswscale/swscale_internal.h | 6 ++ > libswscale/utils.c| 16 > 3 files changed, 20 insertions(+), 22 deletions(-) yes, indeed of course LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator 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 07/12] swscale/internal: expose ff_update_palette() internally
On Sat, Oct 05, 2024 at 09:23:58PM +0200, Niklas Haas wrote: > From: Niklas Haas > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/swscale.c | 4 ++-- > libswscale/swscale_internal.h | 2 ++ > 2 files changed, 4 insertions(+), 2 deletions(-) sure, ok thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin 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 09/12] swscale/internal: constify SwsFunc
On Sat, Oct 05, 2024 at 09:24:00PM +0200, Niklas Haas wrote: > From: Niklas Haas > > I want to move away from having random leaf processing functions mutate > plane pointers, and while we're at it, we might as well make the strides > and tables const as well. > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/aarch64/swscale_unscaled.c | 34 ++-- > libswscale/alphablend.c | 6 +- > libswscale/arm/swscale_unscaled.c | 26 +-- > libswscale/bayer_template.c | 4 +- > libswscale/loongarch/yuv2rgb_lasx.c | 12 +- > libswscale/loongarch/yuv2rgb_lsx.c| 12 +- > libswscale/ppc/yuv2rgb_altivec.c | 12 +- > libswscale/rgb2rgb.c | 2 +- > libswscale/rgb2rgb.h | 4 +- > libswscale/rgb2rgb_template.c | 2 +- > libswscale/swscale_internal.h | 12 +- > libswscale/swscale_unscaled.c | 242 +- > libswscale/x86/yuv2rgb.c | 54 +++--- > libswscale/yuv2rgb.c | 6 +- > 14 files changed, 220 insertions(+), 208 deletions(-) should be ok thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued 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 10/12] swscale/internal: forward typedef SwsContext
On Sat, Oct 05, 2024 at 09:24:01PM +0200, Niklas Haas wrote: > From: Niklas Haas > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/swscale_internal.h | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If one takes all money from those who grow wealth and gives it to those who do not grow wealth, 10 years later, almost the same people who where wealthy will be wealthy again, the same people who where poor will be poor again. 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 11/12] swscale/internal: add typedefs for input reading functions
On Sat, Oct 05, 2024 at 09:24:02PM +0200, Niklas Haas wrote: > From: Niklas Haas > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/swscale_internal.h | 47 +++ > 1 file changed, 31 insertions(+), 16 deletions(-) > > diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h > index 0e9d37b5b0..e87b073d57 100644 > --- a/libswscale/swscale_internal.h > +++ b/libswscale/swscale_internal.h > @@ -292,6 +292,31 @@ typedef void (*yuv2anyX_fn)(struct SwsContext *c, const > int16_t *lumFilter, > const int16_t **alpSrc, uint8_t **dest, > int dstW, int y); > > +/** > + * Unscaled conversion of luma/alpha plane to YV12 for horizontal scaler. > + */ > +typedef void (*planar1_YV12_fn)(uint8_t *dst, const uint8_t *src, const > uint8_t *src2, > +const uint8_t *src3, int width, uint32_t > *pal, > +void *opaque); > + > +/** > + * Unscaled conversion of chroma plane to YV12 for horizontal scaler. > + */ > +typedef void (*planar2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t > *src, > +const uint8_t *src2, const uint8_t *src3, > +int width, uint32_t *pal, void *opaque); > + iam not 100% sure the names are perfect but the patch is ok, we can rename them later, if someone has a better name (i dont have one ATM) thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle 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] fate/ffmpeg: add samples dependency to fate-ffmpeg-spec-disposition
From: Emily --- In the NixOS FFmpeg package, we run `make check` without downloading the entire FATE suite. The FFmpeg 7.1 update broke this, seemingly because of an undeclared FATE sample dependency. This package is my best‐guess attempt at fixing that based on the other commits and files that I read. I didn’t see any existing commit or patch for this, so I’m sending it upstream in case it is of any use. It should be backported to the 7.1 branch if applied; let me know if there’s anything special I need to do for that. I’m not particularly familiar with FFmpeg’s build system or `git send-email`, so apologies if I messed anything up here. tests/fate/ffmpeg.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak index 869376dd18..d9348ee837 100644 --- a/tests/fate/ffmpeg.mak +++ b/tests/fate/ffmpeg.mak @@ -266,4 +266,4 @@ FATE_FFMPEG-$(call ENCDEC2, MPEG2VIDEO, FFV1, NUT, HSTACK_FILTER PIPE_PROTOCOL F # test matching by stream disposition fate-ffmpeg-spec-disposition: CMD = framecrc -i $(TARGET_SAMPLES)/mpegts/pmtchange.ts -map '0:disp:visual_impaired+descriptions:1' -c copy -FATE_FFMPEG-$(call FRAMECRC, MPEGTS,,) += fate-ffmpeg-spec-disposition +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MPEGTS,,) += fate-ffmpeg-spec-disposition -- 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".
Re: [FFmpeg-devel] [PATCH 02/12] tests/swscale: fix minor typos
On Sat, Oct 05, 2024 at 09:23:53PM +0200, Niklas Haas wrote: > From: Niklas Haas > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/tests/swscale.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c > index cf8d04de89..8e57c0a7cf 100644 > --- a/libswscale/tests/swscale.c > +++ b/libswscale/tests/swscale.c > @@ -445,14 +445,14 @@ int main(int argc, char **argv) > " -ref \n" > " Uses file as reference to compae tests againsts. > Tests that have become worse will contain the string worse or WORSE\n" > " -p \n" > -" The percentage of tests or comparissions to > perform. Doing all tests will take long and generate over a hundread MB text > output\n" > +" The percentage of tests or comparisons to > perform. Doing all tests will take long and generate over a hundred MB text > output\n" > " It is often convenient to perform a random > subset\n" > " -dst \n" > " Only test the specified destination pixel > format\n" > " -src \n" > " Only test the specified source pixel format\n" > " -cpuflags \n" > -" Uses the specified cpuflags in teh tests\n" > +" Uses the specified cpuflags in the tests\n" > ); why do people hate my typos so much ;( LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle 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 12/12] swscale/input: parametrize ff_sws_init_input_funcs() pointers
On Sat, Oct 05, 2024 at 09:24:03PM +0200, Niklas Haas wrote: > From: Niklas Haas > > Following the precedent set by ff_sws_init_output_funcs(). > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas > --- > libswscale/input.c| 388 +- > libswscale/swscale.c | 3 +- > libswscale/swscale_internal.h | 8 +- > 3 files changed, 206 insertions(+), 193 deletions(-) ok thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Some people wanted to paint the bikeshed green, some blue and some pink. People argued and fought, when they finally agreed, only rust was left. 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] avcodec/mediacodecenc: Fix access of uninitialized value
On Thu, Oct 3, 2024 at 7:31 PM Zhao Zhili wrote: > > From: Zhao Zhili > > When crop is skipped, av_strlcatf will access `str` which isn't > initialized properly. > --- > libavcodec/mediacodecenc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c > index 6ca3968a24..e76ea81236 100644 > --- a/libavcodec/mediacodecenc.c > +++ b/libavcodec/mediacodecenc.c > @@ -134,7 +134,7 @@ static int extract_extradata_support(AVCodecContext > *avctx) > static int mediacodec_init_bsf(AVCodecContext *avctx) > { > MediaCodecEncContext *s = avctx->priv_data; > -char str[128]; > +char str[128] = {0}; > int ret; > int crop_right = s->width - avctx->width; > int crop_bottom = s->height - avctx->height; > -- > 2.46.0 LGTM. ___ 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] configure: add spirv_compiler to avcodec_suggest
893f3fde4cdeb made libavcodec link to libshaderc/libglslang, though no codecs depend on it at this immediate moment. This was merged largely as a coordination effort to synchronize three different developers' repositories to allow them to send patches without overlapping functionality in between. This line can be removed once the first component to depend on spirv_compiler lands, but leaving it in is fine too. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 9b7236e69b..46c7481ef4 100755 --- a/configure +++ b/configure @@ -4039,7 +4039,7 @@ cws2fws_extralibs="zlib_extralibs" # libraries, in any order avcodec_deps="avutil" -avcodec_suggest="libm stdatomic liblcevc_dec" +avcodec_suggest="libm stdatomic liblcevc_dec spirv_compiler" avdevice_deps="avformat avcodec avutil" avdevice_suggest="libm stdatomic" avfilter_deps="avutil" -- 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".
Re: [FFmpeg-devel] [PATCH v2] aacenc_pred: prevent UB in ff_aac_adjust_common_pred()
On Sat, 5 Oct 2024, Sean McGovern wrote: Hi On Sat, Oct 5, 2024, 19:15 Lynne via ffmpeg-devel wrote: On 05/10/2024 20:58, Sean McGovern wrote: --- libavcodec/aacenc_pred.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/aacenc_pred.c b/libavcodec/aacenc_pred.c index a486c44d42..a6dfaa25fb 100644 --- a/libavcodec/aacenc_pred.c +++ b/libavcodec/aacenc_pred.c @@ -153,9 +153,7 @@ void ff_aac_adjust_common_pred(AACEncContext *s, ChannelElement *cpe) int start, w, w2, g, i, count = 0; SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; -const int pmax0 = FFMIN(sce0->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); -const int pmax1 = FFMIN(sce1->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); -const int pmax = FFMIN(pmax0, pmax1); +const int pmax = FFMIN(sce1->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); if (!cpe->common_window || sce0->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE || @@ -164,7 +162,7 @@ void ff_aac_adjust_common_pred(AACEncContext *s, ChannelElement *cpe) for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) { start = 0; -for (g = 0; g < sce0->ics.num_swb; g++) { +for (g = 0; g < pmax; g++) { int sfb = w*16+g; int sum = sce0->ics.prediction_used[sfb] + sce1->ics.prediction_used[sfb]; float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f; I'm not sure I see the UB here? It corrects the issue noted by both the x86_64 and PPC64 UBsan FATE nodes. That issue will be impossible to find for people looking at this code, once such runs no longer are visible on FATE. Always summarize the issue and how you go about fixing it, in the commit message. // 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".