Re: [FFmpeg-devel] [PATCH] avformat/mov: add AVFMT_SHOW_IDS flag
The RFC was posted 10 days ago. Plan to push tomorrow. On 2021-08-20 05:12 pm, Gyan Doshi wrote: The MOV muxer can store streamids as track ids but they aren't visible when probing the result via lavf/dump or ffprobe due to lack of this flag in the demuxer. --- libavformat/mov.c | 2 +- tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 2 +- tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 2 +- tests/ref/fate/mov-zombie | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 46bc7b5aa3..c556390525 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8216,5 +8216,5 @@ const AVInputFormat ff_mov_demuxer = { .read_packet= mov_read_packet, .read_close = mov_read_close, .read_seek = mov_read_seek, -.flags = AVFMT_NO_BYTE_SEEK | AVFMT_SEEK_TO_PTS, +.flags = AVFMT_NO_BYTE_SEEK | AVFMT_SEEK_TO_PTS | AVFMT_SHOW_IDS, }; diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov index 4ef569df89..8d21c396fc 100644 --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov @@ -36,7 +36,7 @@ color_primaries=unknown chroma_location=unspecified field_order=unknown refs=1 -id=N/A +id=0x1 r_frame_rate=25/1 avg_frame_rate=25/1 time_base=1/12800 diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov index 70e7cdc943..6f1f7c543f 100644 --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov @@ -36,7 +36,7 @@ color_primaries=unknown chroma_location=unspecified field_order=unknown refs=1 -id=N/A +id=0x1 r_frame_rate=25/1 avg_frame_rate=25/1 time_base=1/12800 diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie index 6e6d43d563..b6656de744 100644 --- a/tests/ref/fate/mov-zombie +++ b/tests/ref/fate/mov-zombie @@ -194,5 +194,5 @@ frame|media_type=video|stream_index=0|key_frame=0|pts=188623|pts_time=2.095811|p packet|codec_type=video|stream_index=0|pts=197632|pts_time=2.195911|dts=191625|dts_time=2.129167|duration=3003|duration_time=0.033367|size=580|pos=101820|flags=__ frame|media_type=video|stream_index=0|key_frame=0|pts=191626|pts_time=2.129178|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=191626|best_effort_timestamp_time=2.129178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=99180|pkt_size=1666|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=63|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleftside_data|side_data_type=H.26[45] User Data Unregistered SEI message -stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|refs=2|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=3/1001|avg_frame_rate=6372000/212521|time_base=1/9|start_pts=0|start_time=0.00|duration_ts=2125200|duration=23.61|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:cap ti ons=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:creation_time=2008-05-12T20:59:27.00Z|tag:language=eng|tag:handler_name=Apple Video Media Handler|tag:vendor_id=appl|tag:encoder=H.264 +stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|refs=2|is_avc=true|nal_length_size=4|id=0x1|r_frame_rate=3/1001|avg_frame_rate=6372000/212521|time_base=1/9|start_pts=0|start_time=0.00|duration_ts=2125200|duration=23.61|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition
Re: [FFmpeg-devel] [PATCH 2/6] libavfilter: Unify Execution Modes in DNN Filters
> -Original Message- > From: ffmpeg-devel On Behalf Of > Shubhanshu Saxena > Sent: 2021年8月20日 22:21 > To: ffmpeg-devel@ffmpeg.org > Cc: Shubhanshu Saxena > Subject: [FFmpeg-devel] [PATCH 2/6] libavfilter: Unify Execution Modes in > DNN Filters > > This commit unifies the async and sync mode from the DNN filters' > perspective. As of this commit, the Native backend only supports > synchronous execution mode. > > Now the user can switch between async and sync mode by using the 'async' > option in the backend_configs. The values can be 1 for async and 0 for sync > mode of execution. > > This commit affects the following filters: > 1. vf_dnn_classify > 2. vf_dnn_detect > 3. vf_dnn_processing > 4. vf_sr > 5. vf_derain > > Signed-off-by: Shubhanshu Saxena > --- > libavfilter/dnn/dnn_backend_common.c | 2 +- > libavfilter/dnn/dnn_backend_common.h | 5 +- > libavfilter/dnn/dnn_backend_native.c | 59 +++- > libavfilter/dnn/dnn_backend_native.h | 6 ++ > libavfilter/dnn/dnn_backend_openvino.c | 94 ++ > libavfilter/dnn/dnn_backend_openvino.h | 3 +- > libavfilter/dnn/dnn_backend_tf.c | 35 ++ > libavfilter/dnn/dnn_backend_tf.h | 3 +- > libavfilter/dnn/dnn_interface.c| 8 +-- > libavfilter/dnn_filter_common.c| 23 +-- > libavfilter/dnn_filter_common.h| 3 +- > libavfilter/dnn_interface.h| 4 +- > libavfilter/vf_derain.c| 7 ++ > libavfilter/vf_dnn_classify.c | 4 +- > libavfilter/vf_dnn_detect.c| 8 +-- > libavfilter/vf_dnn_processing.c| 8 +-- > libavfilter/vf_sr.c| 8 +++ > 17 files changed, 140 insertions(+), 140 deletions(-) > https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=4638 caught a warning: CC libavfilter/vf_dnn_detect.o src/libavfilter/vf_dnn_detect.c:499:12: warning: ‘dnn_detect_activate’ defined but not used [-Wunused-function] static int dnn_detect_activate(AVFilterContext *filter_ctx) ^~~ CC libavfilter/vf_dnn_processing.o src/libavfilter/vf_dnn_processing.c:413:12: warning: ‘activate’ defined but not used [-Wunused-function] static int activate(AVFilterContext *filter_ctx) ^~~~ I know it is fixed by the next patch, and the reason to separate these patches is for better change tracking. So, we can add 'av_unused' for these unused functions in this patch. ___ 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/libaomenc: use ctx->usage to get default cfg
On Wed, Aug 18, 2021 at 5:00 PM James Zern wrote: > > On Fri, Aug 13, 2021 at 7:11 PM James Zern wrote: > > > > this prevents some mismatches in config values for realtime and all > > intra modes, avoiding failures like: > > > > [libaom-av1 @ ...] Failed to initialize encoder: Invalid parameter > > [libaom-av1 @ ...] Additional information: g_lag_in_frames out of > > range [..0] > > --- > > libavcodec/libaomenc.c | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > I bumped the patch version locally. > I'll submit this next week if there aren't any comments. > > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c > > index 9c0317f3b2..800fda0591 100644 > > --- a/libavcodec/libaomenc.c > > +++ b/libavcodec/libaomenc.c > > @@ -599,7 +599,7 @@ static av_cold int aom_init(AVCodecContext *avctx, > > av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str()); > > av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config()); > > > > -if ((res = aom_codec_enc_config_default(iface, &enccfg, 0)) != > > AOM_CODEC_OK) { > > +if ((res = aom_codec_enc_config_default(iface, &enccfg, ctx->usage)) > > != AOM_CODEC_OK) { > > av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n", > > aom_codec_err_to_string(res)); > > return AVERROR(EINVAL); > > @@ -623,8 +623,6 @@ static av_cold int aom_init(AVCodecContext *avctx, > > enccfg.g_threads = > > FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), > > 64); > > > > -enccfg.g_usage= ctx->usage; > > - > > if (ctx->lag_in_frames >= 0) > > enccfg.g_lag_in_frames = ctx->lag_in_frames; > > > > -- > > 2.33.0.rc1.237.g0d66db33f3-goog > > ___ 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 9/9] libavfilter/vf_deinterlace_qsv: enabling d3d11va support, added mfxhdlpair
From: Artem Galin Adding DX11 relevant device type checks and adjusting callback with proper MediaSDK pair type support. Signed-off-by: Artem Galin --- libavfilter/vf_deinterlace_qsv.c | 32 +++- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index ea0a9f4345..18b9a17760 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -42,6 +42,8 @@ #include "internal.h" #include "video.h" +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + enum { QSVDEINT_MORE_OUTPUT = 1, QSVDEINT_MORE_INPUT, @@ -144,16 +146,16 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { -*hdl = mid; +mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; +mfxHDLPair *pair_src = (mfxHDLPair*)mid; + +pair_dst->first = pair_src->first; + +if (pair_src->second != (mfxMemId)MFX_INFINITE) +pair_dst->second = pair_src->second; return MFX_ERR_NONE; } -static const mfxHandleType handle_types[] = { -MFX_HANDLE_VA_DISPLAY, -MFX_HANDLE_D3D9_DEVICE_MANAGER, -MFX_HANDLE_D3D11_DEVICE, -}; - static int init_out_session(AVFilterContext *ctx) { @@ -181,14 +183,18 @@ static int init_out_session(AVFilterContext *ctx) return AVERROR_UNKNOWN; } -for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { -err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], &handle); -if (err == MFX_ERR_NONE) { -handle_type = handle_types[i]; -break; -} +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_VA_DISPLAY; +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D11_DEVICE; +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +} else { +av_log(ctx, AV_LOG_ERROR, "Error unsupported handle type\n"); +return AVERROR_UNKNOWN; } +err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle); if (err < 0) return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle"); else if (err > 0) { -- 2.29.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 8/9] libavfilter/vf_scale_qsv: add MFX_MEMTYPE_FROM_VPPOUT flag to frame_type
From: Artem Galin In case of DX11 device type, Media SDK is sensitive to these flags. Signed-off-by: Artem Galin --- libavfilter/vf_scale_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index fe8ed37418..2ab04457a9 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -202,7 +202,7 @@ static int init_out_pool(AVFilterContext *ctx, out_frames_ctx->sw_format = out_format; out_frames_ctx->initial_pool_size = 4; -out_frames_hwctx->frame_type = in_frames_hwctx->frame_type; +out_frames_hwctx->frame_type = in_frames_hwctx->frame_type | MFX_MEMTYPE_FROM_VPPOUT; ret = ff_filter_init_hw_frames(ctx, outlink, 32); if (ret < 0) -- 2.29.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 7/9] libavfilter/vf_scale_qsv: enabling d3d11va support, added mfxhdlpair
From: Artem Galin Adding DX11 relevant device type checks and adjusting callback with proper MediaSDK pair type support. Signed-off-by: Artem Galin --- libavfilter/vf_scale_qsv.c | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 2c9f8e153b..fe8ed37418 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -70,6 +70,7 @@ enum var_name { }; #define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19) +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) typedef struct QSVScaleContext { const AVClass *class; @@ -259,16 +260,16 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { -*hdl = mid; +mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; +mfxHDLPair *pair_src = (mfxHDLPair*)mid; + +pair_dst->first = pair_src->first; + +if (pair_src->second != (mfxMemId)MFX_INFINITE) +pair_dst->second = pair_src->second; return MFX_ERR_NONE; } -static const mfxHandleType handle_types[] = { -MFX_HANDLE_VA_DISPLAY, -MFX_HANDLE_D3D9_DEVICE_MANAGER, -MFX_HANDLE_D3D11_DEVICE, -}; - static int init_out_session(AVFilterContext *ctx) { @@ -300,14 +301,18 @@ static int init_out_session(AVFilterContext *ctx) return AVERROR_UNKNOWN; } -for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { -err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], &handle); -if (err == MFX_ERR_NONE) { -handle_type = handle_types[i]; -break; -} +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_VA_DISPLAY; +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D11_DEVICE; +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +} else { +av_log(ctx, AV_LOG_ERROR, "Error unsupported handle type\n"); +return AVERROR_UNKNOWN; } +err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle); if (err < 0) return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle"); else if (err > 0) { -- 2.29.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 6/9] libavfilter/qsvvpp: add MFX_MEMTYPE_FROM_VPPOUT flag to output frames
From: Artem Galin In case of DX11 device type, Media SDK is sensitive to these flags. Signed-off-by: Artem Galin --- libavfilter/qsvvpp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 66b8673d4e..135d4c4e36 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -527,7 +527,7 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) s->out_mem_mode = IS_OPAQUE_MEMORY(s->in_mem_mode) ? MFX_MEMTYPE_OPAQUE_FRAME : - MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; + MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT; out_frames_ctx = (AVHWFramesContext *)out_frames_ref->data; out_frames_hwctx = out_frames_ctx->hwctx; -- 2.29.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/9] libavfilter/qsvvpp: enabling d3d11va support, added mfxhdlpair
From: Artem Galin Adding DX11 relevant device type checks and adjusting callback with proper MediaSDK pair type support. Signed-off-by: Artem Galin --- libavfilter/qsvvpp.c | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index c7ef8a915f..66b8673d4e 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -36,12 +36,7 @@ MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET)) #define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME) #define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY) - -static const mfxHandleType handle_types[] = { -MFX_HANDLE_VA_DISPLAY, -MFX_HANDLE_D3D9_DEVICE_MANAGER, -MFX_HANDLE_D3D11_DEVICE, -}; +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) static const AVRational default_tb = { 1, 9 }; @@ -202,7 +197,13 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { -*hdl = mid; +mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; +mfxHDLPair *pair_src = (mfxHDLPair*)mid; + +pair_dst->first = pair_src->first; + +if (pair_src->second != (mfxMemId)MFX_INFINITE) +pair_dst->second = pair_src->second; return MFX_ERR_NONE; } @@ -572,14 +573,18 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) return AVERROR_UNKNOWN; } -for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { -ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], &handle); -if (ret == MFX_ERR_NONE) { -handle_type = handle_types[i]; -break; -} +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_VA_DISPLAY; +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D11_DEVICE; +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +} else { +av_log(avctx, AV_LOG_ERROR, "Error unsupported handle type\n"); +return AVERROR_UNKNOWN; } +ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle); if (ret < 0) return ff_qsvvpp_print_error(avctx, ret, "Error getting the session handle"); else if (ret > 0) { -- 2.29.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/9] libavutil/hwcontext_d3d11va: adding more texture information to the D3D11 hwcontext API
From: Artem Galin Microsoft VideoProcessor requires texture with D3DUSAGE_RENDERTARGET flag as output. There is no way to allocate array of textures with D3D11_BIND_RENDER_TARGET flag and .ArraySize > 2 by ID3D11Device_CreateTexture2D due to the Microsoft limitation. Adding AVD3D11FrameDescriptors array to store array of single textures instead of texture with multiple slices resolves this. Signed-off-by: Artem Galin --- libavutil/hwcontext_d3d11va.c | 24 ++- libavutil/hwcontext_d3d11va.h | 9 + libavutil/hwcontext_qsv.c | 37 +++ 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 27274ee3fa..272a19da47 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -72,6 +72,7 @@ static av_cold void load_functions(void) } typedef struct D3D11VAFramesContext { +int nb_surfaces; int nb_surfaces_used; DXGI_FORMAT format; @@ -112,6 +113,8 @@ static void d3d11va_frames_uninit(AVHWFramesContext *ctx) if (s->staging_texture) ID3D11Texture2D_Release(s->staging_texture); s->staging_texture = NULL; + +av_freep(&frames_hwctx->texture_infos); } static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx, @@ -152,15 +155,21 @@ static void free_texture(void *opaque, uint8_t *data) av_free(data); } -static AVBufferRef *wrap_texture_buf(ID3D11Texture2D *tex, int index) +static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *tex, int index) { AVBufferRef *buf; -AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc)); +AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc)); +D3D11VAFramesContext *s = ctx->internal->priv; +AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx; if (!desc) { ID3D11Texture2D_Release(tex); return NULL; } +frames_hwctx->texture_infos[s->nb_surfaces_used].texture = tex; +frames_hwctx->texture_infos[s->nb_surfaces_used].index = index; +s->nb_surfaces_used++; + desc->texture = tex; desc->index = index; @@ -199,7 +208,7 @@ static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx) return NULL; } -return wrap_texture_buf(tex, 0); +return wrap_texture_buf(ctx, tex, 0); } static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size) @@ -220,7 +229,7 @@ static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size) } ID3D11Texture2D_AddRef(hwctx->texture); -return wrap_texture_buf(hwctx->texture, s->nb_surfaces_used++); +return wrap_texture_buf(ctx, hwctx->texture, s->nb_surfaces_used); } static int d3d11va_frames_init(AVHWFramesContext *ctx) @@ -267,7 +276,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) av_log(ctx, AV_LOG_ERROR, "User-provided texture has mismatching parameters\n"); return AVERROR(EINVAL); } -} else if (texDesc.ArraySize > 0) { +} else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && texDesc.ArraySize > 0) { hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, NULL, &hwctx->texture); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Could not create the texture (%lx)\n", (long)hr); @@ -275,6 +284,11 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) } } +hwctx->texture_infos = av_mallocz_array(ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); +if (!hwctx->texture_infos) +return AVERROR(ENOMEM); +s->nb_surfaces = ctx->initial_pool_size; + ctx->internal->pool_internal = av_buffer_pool_init2(sizeof(AVD3D11FrameDescriptor), ctx, d3d11va_pool_alloc, NULL); if (!ctx->internal->pool_internal) diff --git a/libavutil/hwcontext_d3d11va.h b/libavutil/hwcontext_d3d11va.h index 9f91e9b1b6..77d2d72f1b 100644 --- a/libavutil/hwcontext_d3d11va.h +++ b/libavutil/hwcontext_d3d11va.h @@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext { * This field is ignored/invalid if a user-allocated texture is provided. */ UINT MiscFlags; + +/** + * In case if texture structure member above is not NULL contains the same texture + * pointer for all elements and different indexes into the array texture. + * In case if texture structure member above is NULL, all elements contains + * pointers to separate non-array textures and 0 indexes. + * This field is ignored/invalid if a user-allocated texture is provided. +*/ +AVD3D11FrameDescriptor *texture_infos; } AVD3D11VAFramesContext; #endif /* AVUTIL_HWCONTEXT_D3D11VA_H */ diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 77b540fef9..d431e71eab 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -120,6 +120,23 @@ static uint32_t qsv_fou
[FFmpeg-devel] [PATCH 3/9] libavutil/hwcontext_qsv: add usage child_device_type argument to explicitly select d3d11va/DX11 device type
From: Artem Galin UPD: Rebase of last patch set over current master and use DX9 as default device type. Makes selection of dxva2/DX9 device type by default as before with explicit d3d11va/DX11 usage to cover more HW configurations. Added warning message to expect changing default device type in the future. Fixes TGL / AV1 decode as requires DX11 with explicit DX11 type selection. Add headless/multi adapter support and fixes: https://trac.ffmpeg.org/ticket/7511 https://trac.ffmpeg.org/ticket/6827 http://ffmpeg.org/pipermail/ffmpeg-trac/2017-November/041901.html https://trac.ffmpeg.org/ticket/7933 https://github.com/InitialForce/FFmpeg/commit/338fbcd5bba1de0e1b3e3bad8985eee2fdfbeca1 https://github.com/jellyfin/jellyfin/issues/2626#issuecomment-602153952 Any other fixes are welcome including OpenCL interop patch since I don't have proper setup to validate this use case Decoding, encoding, transcoding have been validated. child_device_type option is responsible for d3d11va/dxva2 device selection Usage examples: DirectX 11: -init_hw_device qsv:hw,child_device_type=d3d11va -init_hw_device qsv:hw,child_device_type=d3d11va,child_device=0 OR -init_hw_device d3d11va=dx -init_hw_device qsv@dx DirectX 9 is still supported but requires explicit selection: -init_hw_device qsv:hw,child_device_type=dxva2 OR -init_hw_device dxva2=dx -init_hw_device qsv@dx Signed-off-by: Artem Galin --- doc/ffmpeg.texi | 20 - libavutil/hwcontext_qsv.c | 62 +++ 2 files changed, 68 insertions(+), 14 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index c896aede3b..62d9703b7a 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1104,6 +1104,9 @@ device type: @item dxva2 @var{device} is the number of the Direct3D 9 display adapter. +@item d3d11va +@var{device} is the number of the Direct3D 11 display adapter. + @item vaapi @var{device} is either an X11 display name or a DRM render node. If not specified, it will attempt to open the default X11 display (@emph{$DISPLAY}) @@ -1127,9 +1130,21 @@ If not specified, it will attempt to open the default X11 display (@emph{$DISPLA @end table If not specified, @samp{auto_any} is used. (Note that it may be easier to achieve the desired result for QSV by creating the -platform-appropriate subdevice (@samp{dxva2} or @samp{vaapi}) and then deriving a +platform-appropriate subdevice (@samp{dxva2} or @samp{d3d11va} or @samp{vaapi}) and then deriving a QSV device from that.) +Alternatively, @samp{child_device_type} helps to choose platform-appropriate subdevice type. +On Windows @samp{d3d11va} is used as default subdevice type. + +Examples: +@table @emph +@item -init_hw_device qsv:hw,child_device_type=d3d11va +Choose the GPU subdevice with type @samp{d3d11va} and create QSV device with @samp{MFX_IMPL_HARDWARE}. + +@item -init_hw_device qsv:hw,child_device_type=dxva2 +Choose the GPU subdevice with type @samp{dxva2} and create QSV device with @samp{MFX_IMPL_HARDWARE}. +@end table + @item opencl @var{device} selects the platform and device as @emph{platform_index.device_index}. @@ -1232,6 +1247,9 @@ Use VDPAU (Video Decode and Presentation API for Unix) hardware acceleration. @item dxva2 Use DXVA2 (DirectX Video Acceleration) hardware acceleration. +@item d3d11va +Use D3D11VA (DirectX Video Acceleration) hardware acceleration. + @item vaapi Use VAAPI (Video Acceleration API) hardware acceleration. diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 0ca805e277..77b540fef9 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -1443,25 +1443,61 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, ctx->user_opaque = priv; ctx->free= qsv_device_free; -e = av_dict_get(opts, "child_device", NULL, 0); - -child_device_opts = NULL; -if (CONFIG_VAAPI) { +e = av_dict_get(opts, "child_device_type", NULL, 0); +if (e) { +child_device_type = av_hwdevice_find_type_by_name(e ? e->value : NULL); +if (child_device_type == AV_HWDEVICE_TYPE_NONE) { +av_log(ctx, AV_LOG_ERROR, "Unknown child device type " + "\"%s\".\n", e ? e->value : NULL); +return AVERROR(EINVAL); +} +} else if (CONFIG_VAAPI) { child_device_type = AV_HWDEVICE_TYPE_VAAPI; -// libmfx does not actually implement VAAPI properly, rather it -// depends on the specific behaviour of a matching iHD driver when -// used on recent Intel hardware. Set options to the VAAPI device -// creation so that we should pick a usable setup by default if -// possible, even when multiple devices and drivers are available. -av_dict_set(&child_device_opts, "kernel_driver", "i915", 0); -av_dict_set(&child_device_opts, "driver","iHD", 0); -} else if (CONFIG_DXVA2) +} else if (
[FFmpeg-devel] [PATCH 2/9] libavutil/hwcontext_qsv: supporting d3d11va device type
From: Artem Galin This enables usage of non-powered/headless GPU, better HDR support. Pool of resources is allocated as one texture with array of slices. Signed-off-by: Artem Galin --- libavutil/hwcontext_qsv.c | 326 +++--- 1 file changed, 265 insertions(+), 61 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 08a6e0ee1c..0ca805e277 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -27,9 +27,13 @@ #include #endif +#define COBJMACROS #if CONFIG_VAAPI #include "hwcontext_vaapi.h" #endif +#if CONFIG_D3D11VA +#include "hwcontext_d3d11va.h" +#endif #if CONFIG_DXVA2 #include "hwcontext_dxva2.h" #endif @@ -48,6 +52,8 @@ (MFX_VERSION_MAJOR > (MAJOR) || \ MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)) +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + typedef struct QSVDevicePriv { AVBufferRef *child_device_ctx; } QSVDevicePriv; @@ -74,6 +80,7 @@ typedef struct QSVFramesContext { AVBufferRef *child_frames_ref; mfxFrameSurface1 *surfaces_internal; +mfxHDLPair *handle_pairs_internal; int nb_surfaces_used; // used in the frame allocator for non-opaque surfaces @@ -85,20 +92,6 @@ typedef struct QSVFramesContext { mfxExtBuffer *ext_buffers[1]; } QSVFramesContext; -static const struct { -mfxHandleType handle_type; -enum AVHWDeviceType device_type; -enum AVPixelFormat pix_fmt; -} supported_handle_types[] = { -#if CONFIG_VAAPI -{ MFX_HANDLE_VA_DISPLAY, AV_HWDEVICE_TYPE_VAAPI, AV_PIX_FMT_VAAPI }, -#endif -#if CONFIG_DXVA2 -{ MFX_HANDLE_D3D9_DEVICE_MANAGER, AV_HWDEVICE_TYPE_DXVA2, AV_PIX_FMT_DXVA2_VLD }, -#endif -{ 0 }, -}; - static const struct { enum AVPixelFormat pix_fmt; uint32_t fourcc; @@ -131,24 +124,11 @@ static int qsv_device_init(AVHWDeviceContext *ctx) { AVQSVDeviceContext *hwctx = ctx->hwctx; QSVDeviceContext *s = ctx->internal->priv; - +int hw_handle_supported = 0; +mfxHandleType handle_type; +enum AVHWDeviceType device_type; +enum AVPixelFormat pix_fmt; mfxStatus err; -int i; - -for (i = 0; supported_handle_types[i].handle_type; i++) { -err = MFXVideoCORE_GetHandle(hwctx->session, supported_handle_types[i].handle_type, - &s->handle); -if (err == MFX_ERR_NONE) { -s->handle_type = supported_handle_types[i].handle_type; -s->child_device_type = supported_handle_types[i].device_type; -s->child_pix_fmt = supported_handle_types[i].pix_fmt; -break; -} -} -if (!s->handle) { -av_log(ctx, AV_LOG_VERBOSE, "No supported hw handle could be retrieved " - "from the session\n"); -} err = MFXQueryIMPL(hwctx->session, &s->impl); if (err == MFX_ERR_NONE) @@ -158,6 +138,41 @@ static int qsv_device_init(AVHWDeviceContext *ctx) return AVERROR_UNKNOWN; } +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_VAAPI +handle_type = MFX_HANDLE_VA_DISPLAY; +device_type = AV_HWDEVICE_TYPE_VAAPI; +pix_fmt = AV_PIX_FMT_VAAPI; +hw_handle_supported = 1; +#endif +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_D3D11VA +handle_type = MFX_HANDLE_D3D11_DEVICE; +device_type = AV_HWDEVICE_TYPE_D3D11VA; +pix_fmt = AV_PIX_FMT_D3D11; +hw_handle_supported = 1; +#endif +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_DXVA2 +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +device_type = AV_HWDEVICE_TYPE_DXVA2; +pix_fmt = AV_PIX_FMT_DXVA2_VLD; +hw_handle_supported = 1; +#endif +} + +if (hw_handle_supported) { +err = MFXVideoCORE_GetHandle(hwctx->session, handle_type, &s->handle); +if (err == MFX_ERR_NONE) { +s->handle_type = handle_type; +s->child_device_type = device_type; +s->child_pix_fmt = pix_fmt; +} +} +if (!s->handle) { +av_log(ctx, AV_LOG_VERBOSE, "No supported hw handle could be retrieved " + "from the session\n"); +} return 0; } @@ -187,6 +202,7 @@ static void qsv_frames_uninit(AVHWFramesContext *ctx) av_freep(&s->mem_ids); av_freep(&s->surface_ptrs); av_freep(&s->surfaces_internal); +av_freep(&s->handle_pairs_internal); av_buffer_unref(&s->child_frames_ref); } @@ -202,6 +218,8 @@ static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size) if (s->nb_surfaces_used < hwctx->nb_surfaces) { s->nb_surfaces_used++; +av_buffer_create((uint8_t*)(s->handle_pairs_internal + s->nb_surfaces_used - 1), +sizeof(*s->handle_pairs_internal), qsv_pool_release_dummy, NULL, 0); return av_buffer_create(
[FFmpeg-devel] [PATCH 1/9] libavcodec/qsv: enabling d3d11va support, added mfxhdlpair
From: Artem Galin Adding DX11 relevant device type checks and adjusting callbacks with proper MediaSDK pair type support. Extending structure for proper MediaSDK pair type support. Signed-off-by: Artem Galin --- libavcodec/qsv.c | 53 ++- libavcodec/qsv_internal.h | 2 +- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index c53e2e3b07..139c4971de 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -36,6 +36,8 @@ #include "avcodec.h" #include "qsv_internal.h" +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + #if QSV_VERSION_ATLEAST(1, 12) #include "mfx/mfxvp8.h" #endif @@ -230,7 +232,9 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame) int i; for (i = 0; i < ctx->nb_mids; i++) { QSVMid *mid = &ctx->mids[i]; -if (mid->handle == frame->surface.Data.MemId) +mfxHDLPair *pair = (mfxHDLPair*)frame->surface.Data.MemId; +if ((mid->handle_pair->first == pair->first) && +(mid->handle_pair->second == pair->second)) return i; } return AVERROR_BUG; @@ -370,7 +374,11 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs) int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, const char *load_plugins, int gpu_copy) { +#if CONFIG_D3D11VA +mfxIMPL impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11; +#else mfxIMPL impl = MFX_IMPL_AUTO_ANY; +#endif mfxVersionver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; mfxInitParam init_par = { MFX_IMPL_AUTO_ANY }; @@ -459,7 +467,7 @@ static AVBufferRef *qsv_create_mids(AVBufferRef *hw_frames_ref) for (i = 0; i < nb_surfaces; i++) { QSVMid *mid = &mids[i]; -mid->handle= frames_hwctx->surfaces[i].Data.MemId; +mid->handle_pair = (mfxHDLPair*)frames_hwctx->surfaces[i].Data.MemId; mid->hw_frames_ref = hw_frames_ref1; } @@ -636,7 +644,7 @@ static mfxStatus qsv_frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) goto fail; qsv_mid->surf.Info = hw_frames_hwctx->surfaces[0].Info; -qsv_mid->surf.Data.MemId = qsv_mid->handle; +qsv_mid->surf.Data.MemId = qsv_mid->handle_pair; /* map the data to the system memory */ ret = av_hwframe_map(qsv_mid->locked_frame, qsv_mid->hw_frame, @@ -669,7 +677,13 @@ static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { QSVMid *qsv_mid = (QSVMid*)mid; -*hdl = qsv_mid->handle; +mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; +mfxHDLPair *pair_src = (mfxHDLPair*)qsv_mid->handle_pair; + +pair_dst->first = pair_src->first; + +if (pair_src->second != (mfxMemId)MFX_INFINITE) +pair_dst->second = pair_src->second; return MFX_ERR_NONE; } @@ -677,24 +691,19 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, AVBufferRef *device_ref, const char *load_plugins, int gpu_copy) { -static const mfxHandleType handle_types[] = { -MFX_HANDLE_VA_DISPLAY, -MFX_HANDLE_D3D9_DEVICE_MANAGER, -MFX_HANDLE_D3D11_DEVICE, -}; AVHWDeviceContext*device_ctx = (AVHWDeviceContext*)device_ref->data; AVQSVDeviceContext *device_hwctx = device_ctx->hwctx; mfxSessionparent_session = device_hwctx->session; mfxInitParaminit_par = { MFX_IMPL_AUTO_ANY }; mfxHDLhandle = NULL; +int hw_handle_supported = 0; mfxSessionsession; mfxVersionver; mfxIMPL impl; mfxHandleType handle_type; mfxStatus err; - -int i, ret; +int ret; err = MFXQueryIMPL(parent_session, &impl); if (err == MFX_ERR_NONE) @@ -703,13 +712,23 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, return ff_qsv_print_error(avctx, err, "Error querying the session attributes"); -for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { -err = MFXVideoCORE_GetHandle(parent_session, handle_types[i], &handle); -if (err == MFX_ERR_NONE) { -handle_type = handle_types[i]; -break; +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_VA_DISPLAY; +hw_handle_supported = 1; +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D11_DEVICE; +hw_handle_supported = 1; +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +hw_handle_supported = 1; +} + +if (hw_handle_supported) { +err = MFXVideoCORE_GetHandle(parent_session, handle_type,
Re: [FFmpeg-devel] [PATCH v3 2/2] lavc/aarch64: h264, add chroma loop filters for 10bit
On Fri, 20 Aug 2021, Mikhail Nitenko wrote: Benchmarks: A53 A72 h264_h_loop_filter_chroma422_10bpp_c: 282.7 114.2 h264_h_loop_filter_chroma422_10bpp_neon: 109.578.5 h264_h_loop_filter_chroma_10bpp_c: 165.081.5 h264_h_loop_filter_chroma_10bpp_neon: 120.076.7 h264_h_loop_filter_chroma_intra422_10bpp_c:323.7 124.2 h264_h_loop_filter_chroma_intra422_10bpp_neon: 155.0 102.7 h264_h_loop_filter_chroma_intra_10bpp_c: 121.049.5 h264_h_loop_filter_chroma_intra_10bpp_neon: 79.753.7 h264_h_loop_filter_chroma_mbaff422_10bpp_c:188.575.0 h264_h_loop_filter_chroma_mbaff422_10bpp_neon: 120.075.5 h264_h_loop_filter_chroma_mbaff_intra422_10bpp_c: 116.746.0 h264_h_loop_filter_chroma_mbaff_intra422_10bpp_neon:79.753.7 h264_h_loop_filter_chroma_mbaff_intra_10bpp_c: 63.027.2 h264_h_loop_filter_chroma_mbaff_intra_10bpp_neon: 48.534.0 h264_v_loop_filter_chroma_10bpp_c: 258.7 135.5 h264_v_loop_filter_chroma_10bpp_neon: 71.251.0 h264_v_loop_filter_chroma_intra_10bpp_c: 158.070.7 h264_v_loop_filter_chroma_intra_10bpp_neon: 48.731.5 Signed-off-by: Mikhail Nitenko --- +uabdv30.8h, v2.8h, v0.8h // abs(q1 - q0) +cmhiv26.8h, v22.8h, v26.8h // < alpha +cmhiv28.8h, v23.8h, v28.8h // < beta +cmhiv30.8h, v23.8h, v30.8h // < beta + +and v26.16b, v26.16b, v28.16b The columns above don't line up with the columns below +mov v4.16b, v0.16b +sub v4.8h, v4.8h, v16.8h +and v26.16b, v26.16b, v30.16b Inconsistent alignment +shl v4.8h, v4.8h, #2 +mov x8, v26.d[0] +mov x9, v26.d[1] +sli v24.8H, v24.8H, #8 +uxtlv24.8H, v24.8B Inconsistent style with capital letters for the vector structure +add v4.8h, v4.8h, v18.8h +addsx8, x8, x9 +shl v24.8h, v24.8h, #2 + +b.eq9f + +moviv31.8h, #3 // (tc0 - 1) << (BIT_DEPTH - 8)) + 1 +uqsub v24.8h, v24.8h, v31.8h +sub v4.8h , v4.8h, v2.8h Stray space before the comma But content wise I guess the patch is fine, so I'll fix those nits and push it. // 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 v3] lavc/aarch64: add pred functions for 10-bit
On Fri, 20 Aug 2021, Mikhail Nitenko wrote: Benchmarks:A53 A72 pred8x8_dc_10_c: 64.249.5 pred8x8_dc_10_neon:62.053.7 pred8x8_dc_128_10_c: 26.014.0 pred8x8_dc_128_10_neon:30.717.5 pred8x8_horizontal_10_c: 60.027.7 pred8x8_horizontal_10_neon:38.034.0 pred8x8_left_dc_10_c: 42.527.5 pred8x8_left_dc_10_neon: 51.041.2 pred8x8_mad_cow_dc_0l0_10_c: 55.737.2 pred8x8_mad_cow_dc_0l0_10_neon:50.235.2 pred8x8_mad_cow_dc_0lt_10_c: 89.267.0 pred8x8_mad_cow_dc_0lt_10_neon:52.246.7 pred8x8_mad_cow_dc_l0t_10_c: 74.751.0 pred8x8_mad_cow_dc_l0t_10_neon:50.545.2 pred8x8_mad_cow_dc_l00_10_c: 58.038.0 pred8x8_mad_cow_dc_l00_10_neon:42.537.5 pred8x8_plane_10_c: 354.0 288.7 pred8x8_plane_10_neon:141.0 101.2 pred8x8_top_dc_10_c: 44.530.5 pred8x8_top_dc_10_neon:40.031.0 pred8x8_vertical_10_c: 27.514.5 pred8x8_vertical_10_neon: 21.017.5 pred16x16_plane_10_c:1242.0 1070.5 pred16x16_plane_10_neon: 324.0 196.7 Signed-off-by: Mikhail Nitenko --- Looks ok, will push in a moment. // 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 2/2] avfilter/dnn_processing: Add TensorRT backend
On 2021/7/25 21:04, James Almer wrote: External email: Use caution opening links or attachments On 7/25/2021 8:58 AM, Xiaowei Wang wrote: The backend can be called as: -vf dnn_processing=dnn_backend=tensorrt:model="model":input=:output= As TensorRT provides C++ API rather than C, the TensorRT implementation is separated into a wrapper. The wrapper is placed inhttps://github.com/DutchPiPi/nv-tensorrt-wrapper Please build & install the wrapper before compiling ffmpeg. Please seehttps://github.com/DutchPiPi/FFmpeg-trt-backend-test for how to configure ffmpeg and generate a TensorRT engine for tests. Signed-off-by: Xiaowei Wang --- libavfilter/dnn/Makefile | 2 +- libavfilter/dnn/dnn_backend_tensorrt.c | 97 +++- libavfilter/dnn/dnn_backend_tensorrt.h | 40 +- libavfilter/dnn/dnn_io_proc_trt.cu | 55 -- libavfilter/dnn/trt_class_wrapper.cpp | 731 - libavfilter/dnn/trt_class_wrapper.h | 49 -- 6 files changed, 109 insertions(+), 865 deletions(-) delete mode 100644 libavfilter/dnn/dnn_io_proc_trt.cu delete mode 100644 libavfilter/dnn/trt_class_wrapper.cpp delete mode 100644 libavfilter/dnn/trt_class_wrapper.h diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile index f9ea7ca386..4661d3b2cb 100644 --- a/libavfilter/dnn/Makefile +++ b/libavfilter/dnn/Makefile @@ -16,6 +16,6 @@ OBJS-$(CONFIG_DNN) += dnn/dnn_backend_native_layer_mat DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o DNN-OBJS-$(CONFIG_LIBOPENVINO) += dnn/dnn_backend_openvino.o -DNN-OBJS-$(CONFIG_LIBTENSORRT) += dnn/dnn_backend_tensorrt.o dnn/trt_class_wrapper.o dnn/dnn_io_proc_trt.ptx.o +DNN-OBJS-$(CONFIG_LIBTENSORRT) += dnn/dnn_backend_tensorrt.o OBJS-$(CONFIG_DNN) += $(DNN-OBJS-yes) diff --git a/libavfilter/dnn/dnn_backend_tensorrt.c b/libavfilter/dnn/dnn_backend_tensorrt.c index b45b770a77..e50ebc6c99 100644 --- a/libavfilter/dnn/dnn_backend_tensorrt.c +++ b/libavfilter/dnn/dnn_backend_tensorrt.c @@ -25,45 +25,119 @@ * DNN TensorRT backend implementation. */ -#include "trt_class_wrapper.h" #include "dnn_backend_tensorrt.h" -#include "libavutil/mem.h" #include "libavformat/avio.h" +#include "libavutil/mem.h" #include "libavutil/avassert.h" #include "libavutil/opt.h" #include "libavutil/avstring.h" +#include "libavutil/buffer.h" +#include "libavutil/pixfmt.h" +#include "libavutil/pixdesc.h" + #include "dnn_io_proc.h" #include "../internal.h" -#include "libavutil/buffer.h" +#include "trt_class_wrapper.h" + +#include +#include +#include #include #define OFFSET(x) offsetof(TRTContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM static const AVOption dnn_tensorrt_options[] = { - { "device", "index of the GPU to run model", OFFSET(options.device), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, + { "device", "index of the GPU to run model", OFFSET(options.device), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, + { "plugin", "path to the plugin so", OFFSET(options.plugin_so), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, FLAGS }, { NULL } }; AVFILTER_DEFINE_CLASS(dnn_tensorrt); -DNNModel *ff_dnn_load_model_trt(const char *model_filename,DNNFunctionType func_type, +static TRTWrapper *wrapper = NULL; + +static int load_trt_backend_lib(TRTWrapper *w, const char *so_path, int mode) +{ + w->so_handle = dlopen("libnvtensorrt.so", mode); No, dlopen() is not allowed for this kind of thing. Linking must be added at build time. You for that matter apparently add support for build time linking in patch 1, then attempt to remove it in this one, leaving cruft in the configure script. Why? Not getting responses so re-sending. As TensorRT only provides C++ APIs, the implementation of the backend inevitably contains cpp code, like patch 1. After patch 1 is finished, I heard that it would be better to avoid submitting cpp code so I put the cpp code inside a C wrapper (libnvtensorrt.so). I found that ffmpeg uses dlopen() to call CUDA and codec sdk, and I thought that dlopen() might be a preferable way so I used dlopen() as well. If dlopen() is not allowed, I can keep the cpp code in the wrapper but link it at build time. I will also update the configure scrip and change the dependency to libnvtensorrt rather than libnvinfer. (libnvinfer is part of TensorRT and libnvtensorrt is the C wrapper of my cpp code.) + if (!w->so_handle) + { + return AVERROR(EIO); + } + + w->load_model_func = (tloadModelTrt*)dlsym(w->so_handle, "load_model_trt"); + w->execute_model_func = (texecuteModelTrt*)dlsym(w->so_handle, "execute_model_trt"); + w->free_model_func = (tfreeModelTrt*)dlsym(w->so_handle, "free_model_trt"); + if (!w->load_model_func || !w->execute_model_func || !w->free_model_func) + { + return AVERROR(EIO); +
Re: [FFmpeg-devel] [PATCH] libavformat/riffenc: handle gray8 format for uncompressed avi
On Thu, Aug 19, 2021 at 12:07:33PM +0800, rui.jiang wrote: > add palette data in avi header when the input data is raw gray8 pixel data > and the output data is 8bit uncompressed avi video > > Signed-off-by: rui.jiang <229135...@qq.com> > --- > libavformat/riffenc.c | 9 + > 1 file changed, 9 insertions(+) breaks rawvideo in ffv1 ./ffmpeg -f rawvideo -framerate 2 -s 192x144 -pix_fmt gray -i video.raw -vcodec ffv1 -y test.avi && ./ffmpeg -i test.avi -f null - ... [ffv1 @ 0x5636115c9f40] Invalid version in global header Stream mapping: Stream #0:0 -> #0:0 (ffv1 (native) -> wrapped_avframe (native)) Error while opening decoder for input stream #0:0 : Invalid data found when processing input [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch 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 v1 0/2] libavformat/protocols.c: avio_enum_protocols(): Cleanup
Nicolas George (12021-08-20): > Please do not hijack threads. See the mailing-list FAQ. Please disregard this, I made a mistake. Sorry for wasting everybody's time. -- Nicolas George 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 v1 0/2] libavformat/protocols.c: avio_enum_protocols(): Cleanup
Michael Witten (12021-08-20): > This series improves the following function: > > libavformat/protocols.c: avio_enum_protocols() > > There are only 2 commits: > > [1] Quash warning about const-correctness > [2] Refactoring Please do not hijack threads. See the mailing-list FAQ. -- Nicolas George 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 v1 2/2] libavformat/protocols.c: avio_enum_protocols(): Refactor
Date: Wed, 11 Aug 2021 19:00:00 - This commit is the result of squashing a series of very tiny transformations; it refactors 'avio_enum_protocols()' into 2 functions: * avio_enum_protocols_for_input() * avio_enum_protocols_for_output() Those functions are in turn mostly implemented by this macro: * AVIO_ENUM_PROTOCOLS() The goals of this refactoring were the following: * To make the code more immediately understandable. * To reduce the potential for redundant computation. --- libavformat/avio.h | 2 +- libavformat/protocols.c | 38 +++--- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 0b35409787..3b92cf742a 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -786,7 +786,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); * * @return A static string containing the name of current protocol or NULL */ -const char *avio_enum_protocols(void **opaque, int output); +const char *avio_enum_protocols(void **const opaque, const int output); /** * Get AVClass by names of available protocols. diff --git a/libavformat/protocols.c b/libavformat/protocols.c index e0b3405ab8..4cb8ae0b63 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -91,19 +91,35 @@ const AVClass *ff_urlcontext_child_class_iterate(void **iter) return ret; } -const char *avio_enum_protocols(void **opaque, int output) +#define AVIO_ENUM_PROTOCOLS(METHOD) \ +typedef const URLProtocol *const *Iterator; \ +for (Iterator p = *opaque ? (Iterator)(*opaque) + 1 : url_protocols; *p; ++p) { \ +if ((*p)->METHOD) { \ +*opaque = (void *)p; \ +return (*p)->name; \ +} \ +} \ +*opaque = NULL; \ +return NULL; + +static inline +const char *avio_enum_protocols_for_output(void **const opaque) { -const URLProtocol *const *p = *opaque; +AVIO_ENUM_PROTOCOLS(url_write); +} -p = p ? p + 1 : url_protocols; -*opaque = (void *)p; -if (!*p) { -*opaque = NULL; -return NULL; -} -if ((output && (*p)->url_write) || (!output && (*p)->url_read)) -return (*p)->name; -return avio_enum_protocols(opaque, output); +static inline +const char *avio_enum_protocols_for_input(void **const opaque) +{ +AVIO_ENUM_PROTOCOLS(url_read); +} + +const char *avio_enum_protocols(void **const opaque, const int output) +{ +if (output) +return avio_enum_protocols_for_output(opaque); +else +return avio_enum_protocols_for_input(opaque); } const AVClass *avio_protocol_get_class(const char *name) -- 2.22.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 v1 1/2] libavformat/protocols.c: avio_enum_protocols(): Quash warning about const-correctness
Date: Wed, 11 Aug 2021 10:15:01 - This quashes a compile-time warning. * 'url_protocols' is an array of const pointers. * The explicit conversion to '(void *)' is okay, because the destination is an "opaque" blob of private data. --- libavformat/protocols.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 7f08f151b6..e0b3405ab8 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -93,10 +93,10 @@ const AVClass *ff_urlcontext_child_class_iterate(void **iter) const char *avio_enum_protocols(void **opaque, int output) { -const URLProtocol **p = *opaque; +const URLProtocol *const *p = *opaque; p = p ? p + 1 : url_protocols; -*opaque = p; +*opaque = (void *)p; if (!*p) { *opaque = NULL; return NULL; -- 2.22.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 v1 0/2] libavformat/protocols.c: avio_enum_protocols(): Cleanup
This series improves the following function: libavformat/protocols.c: avio_enum_protocols() There are only 2 commits: [1] Quash warning about const-correctness [2] Refactoring This series is a revision of a previous series; for this revision: * The patch [3] ("Add functions to the API") was removed. * The tiny refactoring patches were squashed together as patch [2]. * "for(" was replaced with "for (". Here are the overall changes: libavformat/avio.h | 2 +- libavformat/protocols.c | 38 +++--- 2 files changed, 28 insertions(+), 12 deletions(-) Sincerely, Michael Witten ___ 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] webp: fix transforms after a palette with pixel packing.
On Thu, Aug 19, 2021 at 12:56 AM Maryla wrote: > > When a color indexing transform with 16 or fewer colors is used, > WebP uses "pixel packing", i.e. storing several pixels in one byte, > which virtually reduces the width of the image (see WebPContext's > reduced_width field). This reduced_width should always be used when > reading and applying subsequent transforms. > > Fixes: 9368 Is there anything in https://chromium.googlesource.com/webm/libwebp-test-data that covers this or can you add the file from the ticket to fate? ___ 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_guided: support enhanced guided filter
From: Xuewei Meng Enhanced guided filter and fast enhanced guided filter are supported. The enhanced guided filter can better preserve edges for denoising tasks. And the box filter operation is optimized. Signed-off-by: Xuewei Meng --- doc/filters.texi| 6 +- libavfilter/vf_guided.c | 349 +++- 2 files changed, 318 insertions(+), 37 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index f8d99b7..31c7bae 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -13093,13 +13093,13 @@ Set regularization parameter (with square). Allowed range is 0 to 1. Default is 0.01. @item mode -Set filter mode. Can be @code{basic} or @code{fast}. +Set filter mode. Can be @code{basic}, @code{fast basic}, @code{enhanced} or @code{fast enhanced}. Default is @code{basic}. @item sub -Set subsampling ratio for @code{fast} mode. +Set subsampling ratio for @code{fast} or @code{fast enhanced} mode. Range is 2 to 64. Default is 4. -No subsampling occurs in @code{basic} mode. +No subsampling occurs in @code{basic} and @code{enhanced} mode. @item guidance Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}. diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c index 4003b95..5d5253b 100644 --- a/libavfilter/vf_guided.c +++ b/libavfilter/vf_guided.c @@ -30,7 +30,9 @@ enum FilterModes { BASIC, -FAST, +FAST_BASIC, +ENHANCED, +FAST_ENHANCED, NB_MODES, }; @@ -40,6 +42,18 @@ enum GuidanceModes { NB_GUIDANCE_MODES, }; +enum SideWindowModes { +LEFT, +RIGHT, +UP, +DOWN, +NW, // North west +NE, // North east +SW, // South west +SE, // South east +NB_SIDEWINDOWMODES +}; + typedef struct GuidedContext { const AVClass *class; FFFrameSync fs; @@ -60,22 +74,26 @@ typedef struct GuidedContext { int planeheight[4]; int (*box_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); +int (*box_side_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); } GuidedContext; #define OFFSET(x) offsetof(GuidedContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM static const AVOption guided_options[] = { -{ "radius", "set the box radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64 = 3}, 1, 20, FLAGS }, -{ "eps", "set the regularization parameter (with square)", OFFSET(eps), AV_OPT_TYPE_FLOAT, {.dbl = 0.01 }, 0.0, 1, FLAGS }, -{ "mode", "set filtering mode (0: basic mode; 1: fast mode)", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = BASIC}, BASIC, NB_MODES - 1, FLAGS, "mode" }, -{ "basic","basic guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = BASIC}, 0, 0, FLAGS, "mode" }, -{ "fast", "fast guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = FAST }, 0, 0, FLAGS, "mode" }, -{ "sub", "subsampling ratio for fast mode", OFFSET(sub), AV_OPT_TYPE_INT, {.i64 = 4}, 2, 64, FLAGS }, -{ "guidance", "set guidance mode (0: off mode; 1: on mode)", OFFSET(guidance), AV_OPT_TYPE_INT, {.i64 = OFF }, OFF, NB_GUIDANCE_MODES - 1, FLAGS, "guidance" }, -{ "off", "only one input is enabled",0, AV_OPT_TYPE_CONST, {.i64 = OFF }, 0, 0, FLAGS, "guidance" }, -{ "on", "two inputs are required", 0, AV_OPT_TYPE_CONST, {.i64 = ON }, 0, 0, FLAGS, "guidance" }, -{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 0xF, FLAGS }, +{ "radius","set the box radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64 = 3 }, 1, 20, FLAGS }, +{ "eps", "set the regularization parameter (with square)", OFFSET(eps), AV_OPT_TYPE_FLOAT, {.dbl = 0.01 }, 0.0, 1, FLAGS }, +{ "mode", "set filtering mode (0: basic mode; 1: fast basic mode; 3: enhanced mode; 4: fast enhanced mode)", + OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = BASIC }, BASIC, NB_MODES - 1, FLAGS, "mode" }, +{ "basic", "basic guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = BASIC }, 0, 0, FLAGS, "mode" }, +{ "basic fast","fast basic guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = FAST_BASI
Re: [FFmpeg-devel] [PATCH] doc/general_contents: Fix dead links
August 20, 2021 8:05 AM, "Gyan Doshi" wrote: > On 2021-08-16 09:52 pm, Mapul Bhola wrote: > >> The x265 configuration and installation guide has moved to Bitbucket so the >> updated link reflects >> that one. >> >> As the openCV site currently only has docs for opencv3 and the filter in >> libavfilter is an opencv2 >> one an archived link to the old cv2 documentation is included. >> --- >> doc/filters.texi | 2 +- >> doc/general_contents.texi | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/doc/filters.texi b/doc/filters.texi >> index eaf23e3736..2f2722383e 100644 >> --- a/doc/filters.texi >> +++ b/doc/filters.texi >> @@ -15484,7 +15484,7 @@ values are assumed. >>> Refer to the official libopencv documentation for more precise >> information: >> -@url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html} >> +@url{http://ghostarchive.org/archive/Wssn7} > > Isn't this one better: > > http://www.opencv.org.cn/opencvdoc/2.3.2/html/modules/imgproc/doc/filtering.html Yes, I didn't see that for some reason on the original site. Will resubmit patch with the link you had. > >>> Several libopencv filters are supported; see the following subsections. >>> diff --git a/doc/general_contents.texi b/doc/general_contents.texi >> index 354899ad17..8664639f6b 100644 >> --- a/doc/general_contents.texi >> +++ b/doc/general_contents.texi >> @@ -304,7 +304,7 @@ details), you must upgrade FFmpeg's license to GPL in >> order to use it. >>> FFmpeg can make use of the x265 library for HEVC encoding. >>> -Go to @url{http://x265.org/developers.html} and follow the instructions >> +Go to @url{https://bitbucket.org/multicoreware/x265_git/wiki/Home} and >> follow the instructions >> for installing the library. Then pass @code{--enable-libx265} to configure >> to enable it. > > I think this one is better: > > https://bitbucket.org/multicoreware/x265_git/src/master/build/README.txt Agreed, will use this as well. > > 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". ___ 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] tools/dvd2concat: use option keyword
subfile,,start,X,end,Y,,: is ugly and will be gone some day. Signed-off-by: Nicolas George --- tools/dvd2concat | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/dvd2concat b/tools/dvd2concat index 0280838a6b..ef04a87d05 100755 --- a/tools/dvd2concat +++ b/tools/dvd2concat @@ -117,10 +117,12 @@ for my $cell (@{$track->{cell}}) { my $file = @files == 1 ? $files[0] : "concat:" . join("|", @files); my $start = $off << 11; my $end = ($off + $size) << 11; - $file = "subfile,,start,${start},end,${end},,:$file"; my $dur = int(1000 * $cell->{length}); - $concat .= sprintf "\nfile '%s'\nduration %02d:%02d:%02d.%03d\n", $file, + $concat .= "\nfile 'subfile:$file'\n"; + $concat .= "option start $start\n"; + $concat .= "option end $end\n"; + $concat .= sprintf "duration %02d:%02d:%02d.%03d\n", int($dur / 360), int($dur / 6) % 60, int($dur / 1000) % 60, $dur % 1000; } -- 2.32.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 3/4] tools/dvd2concat: document that -protocol_whitelist is needed
Signed-off-by: Nicolas George --- tools/dvd2concat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/dvd2concat b/tools/dvd2concat index 8effee86b9..0280838a6b 100755 --- a/tools/dvd2concat +++ b/tools/dvd2concat @@ -37,7 +37,8 @@ normally contains a directory named B. It must not be encrypted with CSS. I is the output file. It can be used as an input to ffmpeg. -It will require the B<-safe 0> option. +It will require the B<-safe 0> and +B<-protocol_whitelist file,subfile,concat> options. =cut -- 2.32.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 2/4] lavf/concatdec: support per-file options
Signed-off-by: Nicolas George --- doc/demuxers.texi | 4 libavformat/concatdec.c | 35 ++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 5f18e4551b..eb3351833a 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -151,6 +151,10 @@ Metadata of the packets of the file. The specified metadata will be set for each file packet. You can specify this directive multiple times to add multiple metadata entries. +@item @code{option @var{key} @var{value}} +Option to access, open and probe the file. +Can be present multiple times. + @item @code{stream} Introduce a stream in the virtual file. All subsequent stream-related directives apply to the last introduced diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index ed6b9d8044..30db456b0e 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -52,6 +52,7 @@ typedef struct { int64_t inpoint; int64_t outpoint; AVDictionary *metadata; +AVDictionary *options; int nb_streams; } ConcatFile; @@ -330,6 +331,7 @@ static int open_file(AVFormatContext *avf, unsigned fileno) { ConcatContext *cat = avf->priv_data; ConcatFile *file = &cat->files[fileno]; +AVDictionary *options = NULL; int ret; if (cat->avf) @@ -345,12 +347,22 @@ static int open_file(AVFormatContext *avf, unsigned fileno) if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0) return ret; -if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 || +ret = av_dict_copy(&options, file->options, 0); +if (ret < 0) +return ret; + +if ((ret = avformat_open_input(&cat->avf, file->url, NULL, &options)) < 0 || (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) { av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url); +av_dict_free(&options); avformat_close_input(&cat->avf); return ret; } +if (options) { +av_log(avf, AV_LOG_WARNING, "Unused options for '%s'.\n", file->url); +/* TODO log unused options once we have a proper string API */ +av_dict_free(&options); +} cat->cur_file = file; file->start_time = !fileno ? 0 : cat->files[fileno - 1].start_time + @@ -387,6 +399,7 @@ static int concat_read_close(AVFormatContext *avf) } av_freep(&cat->files[i].streams); av_dict_free(&cat->files[i].metadata); +av_dict_free(&cat->files[i].options); } if (cat->avf) avformat_close_input(&cat->avf); @@ -458,6 +471,26 @@ static int concat_read_header(AVFormatContext *avf) FAIL(AVERROR_INVALIDDATA); } av_freep(&metadata); +} else if (!strcmp(keyword, "option")) { +char *key, *val; +if (cat->safe) { +av_log(avf, AV_LOG_ERROR, "Options not permitted in safe mode.\n"); +FAIL(AVERROR(EPERM)); +} +if (!file) { +av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", + line, keyword); +FAIL(AVERROR_INVALIDDATA); +} +if (!(key = av_get_token((const char **)&cursor, SPACE_CHARS)) || +!(val = av_get_token((const char **)&cursor, SPACE_CHARS))) { +av_freep(&key); +FAIL(AVERROR(ENOMEM)); +} +ret = av_dict_set(&file->options, key, val, + AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); +if (ret < 0) +FAIL(ret); } else if (!strcmp(keyword, "stream")) { if (!avformat_new_stream(avf, NULL)) FAIL(AVERROR(ENOMEM)); -- 2.32.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/4] libavformat/concatdec: remove support for unsafe=-1
It only makes sense as the default value, but it is not the default since 689211d5727231c3fe92762d224dbadebdbf4e30. Signed-off-by: Nicolas George --- doc/demuxers.texi | 9 +++-- libavformat/concatdec.c | 6 ++ 2 files changed, 5 insertions(+), 10 deletions(-) Second patch updated with Andrea's comments. Final patch removing the in-protocol option syntax withdrawn for now. Other patches unchanged. Will push soon. diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 5b8cf1bfea..5f18e4551b 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -96,8 +96,7 @@ backslash or single quotes. All subsequent file-related directives apply to that file. @item @code{ffconcat version 1.0} -Identify the script type and version. It also sets the @option{safe} option -to 1 if it was -1. +Identify the script type and version. To make FFmpeg recognize the format automatically, this directive must appear exactly as is (no extra space or byte-order-mark) on the very first @@ -177,7 +176,8 @@ This demuxer accepts the following option: @table @option @item safe -If set to 1, reject unsafe file paths. A file path is considered safe if it +If set to 1, reject unsafe file paths and directives. +A file path is considered safe if it does not contain a protocol specification and is relative and all components only contain characters from the portable character set (letters, digits, period, underscore and hyphen) and have no period at the beginning of a @@ -187,9 +187,6 @@ If set to 0, any file name is accepted. The default is 1. --1 is equivalent to 1 if the format was automatically -probed and 0 otherwise. - @item auto_convert If set to 1, try to perform automatic conversions on packet data to make the streams concatenable. diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 934e9c02fc..ed6b9d8044 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -118,7 +118,7 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile, size_t url_len; int ret; -if (cat->safe > 0 && !safe_filename(filename)) { +if (cat->safe && !safe_filename(filename)) { av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename); FAIL(AVERROR(EPERM)); } @@ -476,8 +476,6 @@ static int concat_read_header(AVFormatContext *avf) av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line); FAIL(AVERROR_INVALIDDATA); } -if (cat->safe < 0) -cat->safe = 1; } else { av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n", line, keyword); @@ -757,7 +755,7 @@ static int concat_seek(AVFormatContext *avf, int stream, static const AVOption options[] = { { "safe", "enable safe mode", - OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, DEC }, + OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC }, { "auto_convert", "automatically convert bitstream format", OFFSET(auto_convert), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC }, { "segment_time_metadata", "output file segment start time and duration as packet metadata", -- 2.32.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] dox/examples/encode_video: add explanations in comments.
Jan Ekström (12021-08-20): > Looks good to me with the dox->doc fixup you've already done in the > commit message. Thanks, pushed. Regards, -- Nicolas George 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] lavfi: merge AVFilterChannelLayouts into AVFilterFormats.
Andreas Rheinhardt (12021-08-20): > I do not really agree that such simple macros are hard to maintain. But > I am also not concerned about the increased memory usage (or the fact > that 32bit machines probably won't like it). And I like that it allows > to remove several duplicate functions. > If you think that it brings you closer to your other goals, then go > ahead (but Michael or Anton or Paul might want to voice their opinions, > too). Thanks for the comment. I will leave some more time. > That line should just be removed without replacement. Ok. > Have you checked whether there are any macros of this type for the > current formats, where the type is switched from int to uint64_t with > this patch? They should be ok given that the list in AVFilterFormats > uses a length field and not a sentinel, so that all entries are >= 0, > but it would not be nice to use a wrong type here. Good catch. There were two. Between sample rates and formats, so the int intermediate variable was enough, but better plan for the future. > This function does no longer exist; the declaration should be removed, too. Ok. Patch updated, but I do not think it worth sending it again. Regards, -- Nicolas George 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 6/6] doc/filters.texi: Include dnn_processing in docs of sr and derain filter
Signed-off-by: Shubhanshu Saxena --- doc/filters.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index fac19ac413..03a355a982 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -9974,7 +9974,7 @@ Note that different backends use different file formats. TensorFlow and native backend can load files for only its format. @end table -It can also be finished with @ref{dnn_processing} filter. +To get full functionality (such as async execution), please use the @ref{dnn_processing} filter. @section deshake @@ -19263,7 +19263,7 @@ Default value is @code{2}. Scale factor is necessary for SRCNN model, because it input upscaled using bicubic upscaling with proper scale factor. @end table -This feature can also be finished with @ref{dnn_processing} filter. +To get full functionality (such as async execution), please use the @ref{dnn_processing} filter. @section ssim -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/6] lavfi/dnn: Rename InferenceItem to LastLevelTaskItem
This patch renames the InferenceItem to LastLevelTaskItem in the three backends to avoid confusion among the meanings of these structs. The following are the renames done in this patch: 1. extract_inference_from_task -> extract_lltask_from_task 2. InferenceItem -> LastLevelTaskItem 3. inference_queue -> lltask_queue 4. inference -> lltask 5. inference_count -> lltask_count Signed-off-by: Shubhanshu Saxena --- libavfilter/dnn/dnn_backend_common.h | 4 +- libavfilter/dnn/dnn_backend_native.c | 58 ++--- libavfilter/dnn/dnn_backend_native.h | 2 +- libavfilter/dnn/dnn_backend_openvino.c | 110 - libavfilter/dnn/dnn_backend_tf.c | 76 - 5 files changed, 125 insertions(+), 125 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_common.h b/libavfilter/dnn/dnn_backend_common.h index 78e62a94a2..6b6a5e21ae 100644 --- a/libavfilter/dnn/dnn_backend_common.h +++ b/libavfilter/dnn/dnn_backend_common.h @@ -47,10 +47,10 @@ typedef struct TaskItem { } TaskItem; // one task might have multiple inferences -typedef struct InferenceItem { +typedef struct LastLevelTaskItem { TaskItem *task; uint32_t bbox_index; -} InferenceItem; +} LastLevelTaskItem; /** * Common Async Execution Mechanism for the DNN Backends. diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index 2d34b88f8a..13436c0484 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -46,25 +46,25 @@ static const AVClass dnn_native_class = { .category = AV_CLASS_CATEGORY_FILTER, }; -static DNNReturnType execute_model_native(Queue *inference_queue); +static DNNReturnType execute_model_native(Queue *lltask_queue); -static DNNReturnType extract_inference_from_task(TaskItem *task, Queue *inference_queue) +static DNNReturnType extract_lltask_from_task(TaskItem *task, Queue *lltask_queue) { NativeModel *native_model = task->model; NativeContext *ctx = &native_model->ctx; -InferenceItem *inference = av_malloc(sizeof(*inference)); +LastLevelTaskItem *lltask = av_malloc(sizeof(*lltask)); -if (!inference) { -av_log(ctx, AV_LOG_ERROR, "Unable to allocate space for InferenceItem\n"); +if (!lltask) { +av_log(ctx, AV_LOG_ERROR, "Unable to allocate space for LastLevelTaskItem\n"); return DNN_ERROR; } task->inference_todo = 1; task->inference_done = 0; -inference->task = task; +lltask->task = task; -if (ff_queue_push_back(inference_queue, inference) < 0) { -av_log(ctx, AV_LOG_ERROR, "Failed to push back inference_queue.\n"); -av_freep(&inference); +if (ff_queue_push_back(lltask_queue, lltask) < 0) { +av_log(ctx, AV_LOG_ERROR, "Failed to push back lltask_queue.\n"); +av_freep(&lltask); return DNN_ERROR; } return DNN_SUCCESS; @@ -116,13 +116,13 @@ static DNNReturnType get_output_native(void *model, const char *input_name, int goto err; } -if (extract_inference_from_task(&task, native_model->inference_queue) != DNN_SUCCESS) { -av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n"); +if (extract_lltask_from_task(&task, native_model->lltask_queue) != DNN_SUCCESS) { +av_log(ctx, AV_LOG_ERROR, "unable to extract last level task from task.\n"); ret = DNN_ERROR; goto err; } -ret = execute_model_native(native_model->inference_queue); +ret = execute_model_native(native_model->lltask_queue); *output_width = task.out_frame->width; *output_height = task.out_frame->height; @@ -223,8 +223,8 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f goto fail; } -native_model->inference_queue = ff_queue_create(); -if (!native_model->inference_queue) { +native_model->lltask_queue = ff_queue_create(); +if (!native_model->lltask_queue) { goto fail; } @@ -297,24 +297,24 @@ fail: return NULL; } -static DNNReturnType execute_model_native(Queue *inference_queue) +static DNNReturnType execute_model_native(Queue *lltask_queue) { NativeModel *native_model = NULL; NativeContext *ctx = NULL; int32_t layer; DNNData input, output; DnnOperand *oprd = NULL; -InferenceItem *inference = NULL; +LastLevelTaskItem *lltask = NULL; TaskItem *task = NULL; DNNReturnType ret = 0; -inference = ff_queue_pop_front(inference_queue); -if (!inference) { -av_log(NULL, AV_LOG_ERROR, "Failed to get inference item\n"); +lltask = ff_queue_pop_front(lltask_queue); +if (!lltask) { +av_log(NULL, AV_LOG_ERROR, "Failed to get LastLevelTaskItem\n"); ret = DNN_ERROR; goto err; } -task = inference->task; +task = lltask->task; native_model = task->model; ctx = &native_model->ctx; @@ -428,7 +428,7 @@ static DNNReturnType e
[FFmpeg-devel] [PATCH 4/6] libavfilter: Remove Async Flag from DNN Filter Side
Remove async flag from filter's perspective after the unification of async and sync modes in the DNN backend. Signed-off-by: Shubhanshu Saxena --- doc/filters.texi | 14 -- libavfilter/dnn/dnn_backend_tf.c | 7 +++ libavfilter/dnn_filter_common.c | 7 --- libavfilter/dnn_filter_common.h | 2 +- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 480cab706c..fac19ac413 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10275,11 +10275,8 @@ and the second line is the name of label id 1, etc. The label id is considered as name if the label file is not provided. @item backend_configs -Set the configs to be passed into backend - -@item async -use DNN async execution if set (default: set), -roll back to sync execution if the backend does not support async. +Set the configs to be passed into backend. To use async execution, set async (default: set). +Roll back to sync execution if the backend does not support async. @end table @@ -10331,15 +10328,12 @@ Set the input name of the dnn network. Set the output name of the dnn network. @item backend_configs -Set the configs to be passed into backend +Set the configs to be passed into backend. To use async execution, set async (default: set). +Roll back to sync execution if the backend does not support async. For tensorflow backend, you can set its configs with @option{sess_config} options, please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system. -@item async -use DNN async execution if set (default: set), -roll back to sync execution if the backend does not support async. - @end table @subsection Examples diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index 4a0b561f29..906934d8c0 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -884,6 +884,13 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, DNNFunctionType func_ ctx->options.nireq = av_cpu_count() / 2 + 1; } +#if !HAVE_PTHREAD_CANCEL +if (ctx->options.async) { +ctx->options.async = 0; +av_log(filter_ctx, AV_LOG_WARNING, "pthread is not supported, roll back to sync.\n"); +} +#endif + tf_model->request_queue = ff_safe_queue_create(); if (!tf_model->request_queue) { goto err; diff --git a/libavfilter/dnn_filter_common.c b/libavfilter/dnn_filter_common.c index 455eaa37f4..3045ce0131 100644 --- a/libavfilter/dnn_filter_common.c +++ b/libavfilter/dnn_filter_common.c @@ -84,13 +84,6 @@ int ff_dnn_init(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *fil return AVERROR(EINVAL); } -#if !HAVE_PTHREAD_CANCEL -if (ctx->async) { -ctx->async = 0; -av_log(filter_ctx, AV_LOG_WARNING, "pthread is not supported, roll back to sync.\n"); -} -#endif - return 0; } diff --git a/libavfilter/dnn_filter_common.h b/libavfilter/dnn_filter_common.h index 4d92c1dc36..635ae631c1 100644 --- a/libavfilter/dnn_filter_common.h +++ b/libavfilter/dnn_filter_common.h @@ -46,7 +46,7 @@ typedef struct DnnContext { { "output", "output name of the model", OFFSET(model_outputnames_string), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },\ { "backend_configs","backend configs", OFFSET(backend_options), AV_OPT_TYPE_STRING,{ .str = NULL }, 0, 0, FLAGS },\ { "options", "backend configs (deprecated, use backend_configs)", OFFSET(backend_options), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS | AV_OPT_FLAG_DEPRECATED},\ -{ "async", "use DNN async inference",OFFSET(async), AV_OPT_TYPE_BOOL, { .i64 = 1}, 0, 1, FLAGS}, +{ "async", "use DNN async inference (ignored, use backend_configs='async=1')",OFFSET(async),AV_OPT_TYPE_BOOL, { .i64 = 1}, 0, 1, FLAGS}, int ff_dnn_init(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *filter_ctx); -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/6] libavfilter: Remove synchronous functions from DNN filters
This commit removes the unused sync mode specific code from the DNN filters since the sync and async mode are now unified from the filters' perspective. Signed-off-by: Shubhanshu Saxena --- libavfilter/vf_dnn_detect.c | 71 +--- libavfilter/vf_dnn_processing.c | 84 + 2 files changed, 4 insertions(+), 151 deletions(-) diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c index 2666abfcdc..809d70b930 100644 --- a/libavfilter/vf_dnn_detect.c +++ b/libavfilter/vf_dnn_detect.c @@ -353,63 +353,6 @@ static int dnn_detect_query_formats(AVFilterContext *context) return ff_set_common_formats_from_list(context, pix_fmts); } -static int dnn_detect_filter_frame(AVFilterLink *inlink, AVFrame *in) -{ -AVFilterContext *context = inlink->dst; -AVFilterLink *outlink = context->outputs[0]; -DnnDetectContext *ctx = context->priv; -DNNReturnType dnn_result; - -dnn_result = ff_dnn_execute_model(&ctx->dnnctx, in, in); -if (dnn_result != DNN_SUCCESS){ -av_log(ctx, AV_LOG_ERROR, "failed to execute model\n"); -av_frame_free(&in); -return AVERROR(EIO); -} - -return ff_filter_frame(outlink, in); -} - -static int dnn_detect_activate_sync(AVFilterContext *filter_ctx) -{ -AVFilterLink *inlink = filter_ctx->inputs[0]; -AVFilterLink *outlink = filter_ctx->outputs[0]; -AVFrame *in = NULL; -int64_t pts; -int ret, status; -int got_frame = 0; - -FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); - -do { -// drain all input frames -ret = ff_inlink_consume_frame(inlink, &in); -if (ret < 0) -return ret; -if (ret > 0) { -ret = dnn_detect_filter_frame(inlink, in); -if (ret < 0) -return ret; -got_frame = 1; -} -} while (ret > 0); - -// if frame got, schedule to next filter -if (got_frame) -return 0; - -if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { -if (status == AVERROR_EOF) { -ff_outlink_set_status(outlink, status, pts); -return ret; -} -} - -FF_FILTER_FORWARD_WANTED(outlink, inlink); - -return FFERROR_NOT_READY; -} - static int dnn_detect_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *out_pts) { DnnDetectContext *ctx = outlink->src->priv; @@ -439,7 +382,7 @@ static int dnn_detect_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *o return 0; } -static int dnn_detect_activate_async(AVFilterContext *filter_ctx) +static int dnn_detect_activate(AVFilterContext *filter_ctx) { AVFilterLink *inlink = filter_ctx->inputs[0]; AVFilterLink *outlink = filter_ctx->outputs[0]; @@ -496,16 +439,6 @@ static int dnn_detect_activate_async(AVFilterContext *filter_ctx) return 0; } -static int dnn_detect_activate(AVFilterContext *filter_ctx) -{ -DnnDetectContext *ctx = filter_ctx->priv; - -if (ctx->dnnctx.async) -return dnn_detect_activate_async(filter_ctx); -else -return dnn_detect_activate_sync(filter_ctx); -} - static av_cold void dnn_detect_uninit(AVFilterContext *context) { DnnDetectContext *ctx = context->priv; @@ -537,5 +470,5 @@ const AVFilter ff_vf_dnn_detect = { FILTER_INPUTS(dnn_detect_inputs), FILTER_OUTPUTS(dnn_detect_outputs), .priv_class= &dnn_detect_class, -.activate = dnn_detect_activate_async, +.activate = dnn_detect_activate, }; diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c index 410cc887dc..55634efde5 100644 --- a/libavfilter/vf_dnn_processing.c +++ b/libavfilter/vf_dnn_processing.c @@ -244,76 +244,6 @@ static int copy_uv_planes(DnnProcessingContext *ctx, AVFrame *out, const AVFrame return 0; } -static int filter_frame(AVFilterLink *inlink, AVFrame *in) -{ -AVFilterContext *context = inlink->dst; -AVFilterLink *outlink = context->outputs[0]; -DnnProcessingContext *ctx = context->priv; -DNNReturnType dnn_result; -AVFrame *out; - -out = ff_get_video_buffer(outlink, outlink->w, outlink->h); -if (!out) { -av_frame_free(&in); -return AVERROR(ENOMEM); -} -av_frame_copy_props(out, in); - -dnn_result = ff_dnn_execute_model(&ctx->dnnctx, in, out); -if (dnn_result != DNN_SUCCESS){ -av_log(ctx, AV_LOG_ERROR, "failed to execute model\n"); -av_frame_free(&in); -av_frame_free(&out); -return AVERROR(EIO); -} - -if (isPlanarYUV(in->format)) -copy_uv_planes(ctx, out, in); - -av_frame_free(&in); -return ff_filter_frame(outlink, out); -} - -static int activate_sync(AVFilterContext *filter_ctx) -{ -AVFilterLink *inlink = filter_ctx->inputs[0]; -AVFilterLink *outlink = filter_ctx->outputs[0]; -AVFrame *in = NULL; -int64_t pts; -int ret, status; -int got_frame = 0; - -FF_FILTER_FORWARD_STATUS_BACK(ou
[FFmpeg-devel] [PATCH 2/6] libavfilter: Unify Execution Modes in DNN Filters
This commit unifies the async and sync mode from the DNN filters' perspective. As of this commit, the Native backend only supports synchronous execution mode. Now the user can switch between async and sync mode by using the 'async' option in the backend_configs. The values can be 1 for async and 0 for sync mode of execution. This commit affects the following filters: 1. vf_dnn_classify 2. vf_dnn_detect 3. vf_dnn_processing 4. vf_sr 5. vf_derain Signed-off-by: Shubhanshu Saxena --- libavfilter/dnn/dnn_backend_common.c | 2 +- libavfilter/dnn/dnn_backend_common.h | 5 +- libavfilter/dnn/dnn_backend_native.c | 59 +++- libavfilter/dnn/dnn_backend_native.h | 6 ++ libavfilter/dnn/dnn_backend_openvino.c | 94 ++ libavfilter/dnn/dnn_backend_openvino.h | 3 +- libavfilter/dnn/dnn_backend_tf.c | 35 ++ libavfilter/dnn/dnn_backend_tf.h | 3 +- libavfilter/dnn/dnn_interface.c| 8 +-- libavfilter/dnn_filter_common.c| 23 +-- libavfilter/dnn_filter_common.h| 3 +- libavfilter/dnn_interface.h| 4 +- libavfilter/vf_derain.c| 7 ++ libavfilter/vf_dnn_classify.c | 4 +- libavfilter/vf_dnn_detect.c| 8 +-- libavfilter/vf_dnn_processing.c| 8 +-- libavfilter/vf_sr.c| 8 +++ 17 files changed, 140 insertions(+), 140 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_common.c b/libavfilter/dnn/dnn_backend_common.c index 426683b73d..d2bc016fef 100644 --- a/libavfilter/dnn/dnn_backend_common.c +++ b/libavfilter/dnn/dnn_backend_common.c @@ -138,7 +138,7 @@ DNNReturnType ff_dnn_start_inference_async(void *ctx, DNNAsyncExecModule *async_ return DNN_SUCCESS; } -DNNAsyncStatusType ff_dnn_get_async_result_common(Queue *task_queue, AVFrame **in, AVFrame **out) +DNNAsyncStatusType ff_dnn_get_result_common(Queue *task_queue, AVFrame **in, AVFrame **out) { TaskItem *task = ff_queue_peek_front(task_queue); diff --git a/libavfilter/dnn/dnn_backend_common.h b/libavfilter/dnn/dnn_backend_common.h index 604c1d3bd7..78e62a94a2 100644 --- a/libavfilter/dnn/dnn_backend_common.h +++ b/libavfilter/dnn/dnn_backend_common.h @@ -29,7 +29,8 @@ #include "libavutil/thread.h" #define DNN_BACKEND_COMMON_OPTIONS \ -{ "nireq", "number of request", OFFSET(options.nireq), AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS }, +{ "nireq", "number of request", OFFSET(options.nireq), AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS }, \ +{ "async", "use DNN async inference", OFFSET(options.async), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS }, // one task for one function call from dnn interface typedef struct TaskItem { @@ -135,7 +136,7 @@ DNNReturnType ff_dnn_start_inference_async(void *ctx, DNNAsyncExecModule *async_ * @retval DAST_NOT_READY if inference not completed yet. * @retval DAST_SUCCESS if result successfully extracted */ -DNNAsyncStatusType ff_dnn_get_async_result_common(Queue *task_queue, AVFrame **in, AVFrame **out); +DNNAsyncStatusType ff_dnn_get_result_common(Queue *task_queue, AVFrame **in, AVFrame **out); /** * Allocate input and output frames and fill the Task diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index 3b2a3aa55d..2d34b88f8a 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -34,6 +34,7 @@ #define FLAGS AV_OPT_FLAG_FILTERING_PARAM static const AVOption dnn_native_options[] = { { "conv2d_threads", "threads num for conv2d layer", OFFSET(options.conv2d_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS }, +{ "async", "use DNN async inference", OFFSET(options.async), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { NULL }, }; @@ -189,6 +190,11 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f goto fail; native_model->model = model; +if (native_model->ctx.options.async) { +av_log(&native_model->ctx, AV_LOG_WARNING, "Async not supported. Rolling back to sync\n"); +native_model->ctx.options.async = 0; +} + #if !HAVE_PTHREAD_CANCEL if (native_model->ctx.options.conv2d_threads > 1){ av_log(&native_model->ctx, AV_LOG_WARNING, "'conv2d_threads' option was set but it is not supported " @@ -212,6 +218,11 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f goto fail; } +native_model->task_queue = ff_queue_create(); +if (!native_model->task_queue) { +goto fail; +} + native_model->inference_queue = ff_queue_create(); if (!native_model->inference_queue) { goto fail; @@ -425,17 +436,30 @@ DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, DNNExe
[FFmpeg-devel] [PATCH 1/6] lavfi/dnn: Task-based Inference in Native Backend
This commit rearranges the code in Native Backend to use the TaskItem for inference. Signed-off-by: Shubhanshu Saxena --- libavfilter/dnn/dnn_backend_native.c | 176 ++- libavfilter/dnn/dnn_backend_native.h | 2 + 2 files changed, 121 insertions(+), 57 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index a6be27f1fd..3b2a3aa55d 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -45,9 +45,29 @@ static const AVClass dnn_native_class = { .category = AV_CLASS_CATEGORY_FILTER, }; -static DNNReturnType execute_model_native(const DNNModel *model, const char *input_name, AVFrame *in_frame, - const char **output_names, uint32_t nb_output, AVFrame *out_frame, - int do_ioproc); +static DNNReturnType execute_model_native(Queue *inference_queue); + +static DNNReturnType extract_inference_from_task(TaskItem *task, Queue *inference_queue) +{ +NativeModel *native_model = task->model; +NativeContext *ctx = &native_model->ctx; +InferenceItem *inference = av_malloc(sizeof(*inference)); + +if (!inference) { +av_log(ctx, AV_LOG_ERROR, "Unable to allocate space for InferenceItem\n"); +return DNN_ERROR; +} +task->inference_todo = 1; +task->inference_done = 0; +inference->task = task; + +if (ff_queue_push_back(inference_queue, inference) < 0) { +av_log(ctx, AV_LOG_ERROR, "Failed to push back inference_queue.\n"); +av_freep(&inference); +return DNN_ERROR; +} +return DNN_SUCCESS; +} static DNNReturnType get_input_native(void *model, DNNData *input, const char *input_name) { @@ -78,34 +98,36 @@ static DNNReturnType get_input_native(void *model, DNNData *input, const char *i static DNNReturnType get_output_native(void *model, const char *input_name, int input_width, int input_height, const char *output_name, int *output_width, int *output_height) { -DNNReturnType ret; +DNNReturnType ret = 0; NativeModel *native_model = model; NativeContext *ctx = &native_model->ctx; -AVFrame *in_frame = av_frame_alloc(); -AVFrame *out_frame = NULL; - -if (!in_frame) { -av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for input frame\n"); -return DNN_ERROR; +TaskItem task; +DNNExecBaseParams exec_params = { +.input_name = input_name, +.output_names = &output_name, +.nb_output = 1, +.in_frame = NULL, +.out_frame = NULL, +}; + +if (ff_dnn_fill_gettingoutput_task(&task, &exec_params, native_model, input_height, input_width, ctx) != DNN_SUCCESS) { +ret = DNN_ERROR; +goto err; } -out_frame = av_frame_alloc(); - -if (!out_frame) { -av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for output frame\n"); -av_frame_free(&in_frame); -return DNN_ERROR; +if (extract_inference_from_task(&task, native_model->inference_queue) != DNN_SUCCESS) { +av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n"); +ret = DNN_ERROR; +goto err; } -in_frame->width = input_width; -in_frame->height = input_height; - -ret = execute_model_native(native_model->model, input_name, in_frame, &output_name, 1, out_frame, 0); -*output_width = out_frame->width; -*output_height = out_frame->height; +ret = execute_model_native(native_model->inference_queue); +*output_width = task.out_frame->width; +*output_height = task.out_frame->height; -av_frame_free(&out_frame); -av_frame_free(&in_frame); +err: +av_frame_free(&task.out_frame); +av_frame_free(&task.in_frame); return ret; } @@ -190,6 +212,11 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f goto fail; } +native_model->inference_queue = ff_queue_create(); +if (!native_model->inference_queue) { +goto fail; +} + for (layer = 0; layer < native_model->layers_num; ++layer){ layer_type = (int32_t)avio_rl32(model_file_context); dnn_size += 4; @@ -259,50 +286,66 @@ fail: return NULL; } -static DNNReturnType execute_model_native(const DNNModel *model, const char *input_name, AVFrame *in_frame, - const char **output_names, uint32_t nb_output, AVFrame *out_frame, - int do_ioproc) +static DNNReturnType execute_model_native(Queue *inference_queue) { -NativeModel *native_model = model->model; -NativeContext *ctx = &native_model->ctx; +NativeModel *native_model = NULL; +NativeContext *ctx = NULL; int32_t layer; DNNData input, output; DnnOperand *oprd = NULL; +InferenceItem *inference = NULL; +
[FFmpeg-devel] [PATCH] fftools/cmdutils: Fix warning for initialization makes integer from pointer without a cast
From: Limin Wang Signed-off-by: Limin Wang --- fftools/cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 2dd035a..ae34118 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -853,7 +853,7 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg) int count; static const AVOption opts[] = { -{"count", NULL, 0, AV_OPT_TYPE_INT, { .i64 = -1}, -1, INT_MAX, NULL}, +{"count", NULL, 0, AV_OPT_TYPE_INT, { .i64 = -1}, -1, INT_MAX}, {NULL}, }; static const AVClass class = { -- 1.8.3.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] dox/examples/encode_video: add explanations in comments.
On Mon, Aug 16, 2021 at 4:07 PM Nicolas George wrote: > > Signed-off-by: Nicolas George > --- Looks good to me with the dox->doc fixup you've already done in the commit message. Generally I've become accustomed to trying to push people to look at the transcode* examples since I've seen people try to do things manually which our APIs would do for them when they see these minimal examples and try to extend them. Best regards, Jan ___ 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] lavfi: merge AVFilterChannelLayouts into AVFilterFormats.
Nicolas George: > Make AVFilterFormats.formats uint64_t. > They are short-lived lists and usually quite short too. > > Signed-off-by: Nicolas George > --- > > > I think the simplification in formats.c is well worth the cost in > memory: most of the lines removed are hard-to-maintain macro code. I do not really agree that such simple macros are hard to maintain. But I am also not concerned about the increased memory usage (or the fact that 32bit machines probably won't like it). And I like that it allows to remove several duplicate functions. If you think that it brings you closer to your other goals, then go ahead (but Michael or Anton or Paul might want to voice their opinions, too). > > Furthermore, it will make easier to attach a score to the formats to > replace the logic in swap_*() and pick_formats() without adding yet more > macro code. > > This patch has the risk of causing many conflicts, I would like to avoir > keeping it in the air too long. Please comment without taking too much > time. > > > libavfilter/aeval.c| 6 +- > libavfilter/af_afir.c | 10 +- > libavfilter/af_aformat.c | 4 +- > libavfilter/af_agate.c | 10 +- > libavfilter/af_amerge.c| 12 +-- > libavfilter/af_anequalizer.c | 6 +- > libavfilter/af_apulsator.c | 2 +- > libavfilter/af_aresample.c | 6 +- > libavfilter/af_asr.c | 2 +- > libavfilter/af_bs2b.c | 2 +- > libavfilter/af_channelmap.c| 10 +- > libavfilter/af_channelsplit.c | 8 +- > libavfilter/af_crossfeed.c | 2 +- > libavfilter/af_earwax.c| 2 +- > libavfilter/af_extrastereo.c | 2 +- > libavfilter/af_haas.c | 2 +- > libavfilter/af_hdcd.c | 2 +- > libavfilter/af_headphone.c | 14 +-- > libavfilter/af_join.c | 6 +- > libavfilter/af_ladspa.c| 8 +- > libavfilter/af_lv2.c | 8 +- > libavfilter/af_pan.c | 6 +- > libavfilter/af_replaygain.c| 2 +- > libavfilter/af_sidechaincompress.c | 10 +- > libavfilter/af_silencedetect.c | 2 +- > libavfilter/af_sofalizer.c | 6 +- > libavfilter/af_stereotools.c | 2 +- > libavfilter/af_stereowiden.c | 2 +- > libavfilter/af_surround.c | 6 +- > libavfilter/asrc_flite.c | 2 +- > libavfilter/avf_abitscope.c| 4 +- > libavfilter/avf_ahistogram.c | 4 +- > libavfilter/avf_aphasemeter.c | 6 +- > libavfilter/avf_avectorscope.c | 4 +- > libavfilter/avf_concat.c | 6 +- > libavfilter/avf_showcqt.c | 4 +- > libavfilter/avf_showfreqs.c| 4 +- > libavfilter/avf_showspatial.c | 4 +- > libavfilter/avf_showspectrum.c | 4 +- > libavfilter/avf_showvolume.c | 4 +- > libavfilter/avf_showwaves.c| 4 +- > libavfilter/avfilter.c | 8 +- > libavfilter/avfilter.h | 4 +- > libavfilter/avfiltergraph.c| 44 - > libavfilter/buffersink.c | 2 +- > libavfilter/buffersrc.c| 2 +- > libavfilter/f_ebur128.c| 6 +- > libavfilter/formats.c | 152 - > libavfilter/formats.h | 56 +++ > libavfilter/src_movie.c| 2 +- > libavfilter/tests/filtfmts.c | 6 +- > libavfilter/vaf_spectrumsynth.c| 4 +- > 52 files changed, 221 insertions(+), 275 deletions(-) > > diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h > index 5a225ffc44..19d26d6561 100644 > --- a/libavfilter/avfilter.h > +++ b/libavfilter/avfilter.h > @@ -68,7 +68,7 @@ typedef struct AVFilterContext AVFilterContext; > typedef struct AVFilterLinkAVFilterLink; > typedef struct AVFilterPad AVFilterPad; > typedef struct AVFilterFormats AVFilterFormats; > -typedef struct AVFilterChannelLayouts AVFilterChannelLayouts; > +typedef struct AVFilterFormats AVFilterChannelLayouts; That line should just be removed without replacement. > > /** > * Get the number of elements in a NULL-terminated array of AVFilterPads > (e.g. > @@ -437,7 +437,7 @@ typedef struct AVFilterFormatsConfig { > /** > * Lists of supported channel layouts, only for audio. > */ > -AVFilterChannelLayouts *channel_layouts; > +AVFilterFormats *channel_layouts; > > } AVFilterFormatsConfig; > > diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c > index 8c6d43a0c7..2b8bac2a4c 100644 > --- a/libavfilter/avfiltergraph.c > +++ b/libavfilter/avfiltergraph.c > @@ -969,8 +969,8 @@ static void > swap_channel_layouts_on_filter(AVFilterContext *filter) > } > } > av_assert0(best_idx >= 0); > -FFSWAP(uint64_t, outlink->incfg.channel_layouts->channel_layouts[0], > - outlink->incfg.channel_layouts->channel_layouts[best_idx]
Re: [FFmpeg-devel] Third opinion? (was: lavf/avio: remove support for proto, , opt, val, , syntax.)
Nicolas George: > Andreas Rheinhardt (12021-08-14): >> I do not really get that: The option passing syntax is restricted to the >> subfile protocol, so I don't know why we allow it for the file protocol >> in dashdec and hls. Unless I am missing something, this could (and >> should) be removed at once. > > It must be leftover code from when it was supported for all protocols. > Not requiring this kind of convoluted tests in new code is also a > motivation for just removing the last trace of this feature. > >> I use it to concatenate parts of files: When a DVR of mine has to split >> files due to the 4GB FAT-32 boundary, it does not do so cleanly; for >> some reason the first 96256B of the second file are duplicated, i.e. >> they coincide with bytes 96256-192511. For the third file, about a MB >> starting from offset 96256 is duplicated. > > Makes sense. > > I think we should decide that protocols like concat and subfile, > protocols where part(s) of the pseudo-URI are themselves pseudo-URI with > other protocols (let us call them metaprotocols) should always involve a > solution to pass options to the sub-protocols. > > Possibly, let us make this a common helper API. > Yes. If you have a better system for this than the current one, then I am all ears. > concat:file01.bin|[start=96256]subfile:file02.bin > > > Anyway, I think I can push the series except for the last patch now. > Any objection? > Not from me. - Andreas ___ 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/general_contents: Fix dead links
On 2021-08-16 09:52 pm, Mapul Bhola wrote: The x265 configuration and installation guide has moved to Bitbucket so the updated link reflects that one. As the openCV site currently only has docs for opencv3 and the filter in libavfilter is an opencv2 one an archived link to the old cv2 documentation is included. --- doc/filters.texi | 2 +- doc/general_contents.texi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index eaf23e3736..2f2722383e 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -15484,7 +15484,7 @@ values are assumed. Refer to the official libopencv documentation for more precise information: -@url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html} +@url{http://ghostarchive.org/archive/Wssn7} Isn't this one better: http://www.opencv.org.cn/opencvdoc/2.3.2/html/modules/imgproc/doc/filtering.html Several libopencv filters are supported; see the following subsections. diff --git a/doc/general_contents.texi b/doc/general_contents.texi index 354899ad17..8664639f6b 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -304,7 +304,7 @@ details), you must upgrade FFmpeg's license to GPL in order to use it. FFmpeg can make use of the x265 library for HEVC encoding. -Go to @url{http://x265.org/developers.html} and follow the instructions +Go to @url{https://bitbucket.org/multicoreware/x265_git/wiki/Home} and follow the instructions for installing the library. Then pass @code{--enable-libx265} to configure to enable it. I think this one is better: https://bitbucket.org/multicoreware/x265_git/src/master/build/README.txt 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".
[FFmpeg-devel] [PATCH] avformat/mov: add AVFMT_SHOW_IDS flag
The MOV muxer can store streamids as track ids but they aren't visible when probing the result via lavf/dump or ffprobe due to lack of this flag in the demuxer. --- libavformat/mov.c | 2 +- tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 2 +- tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 2 +- tests/ref/fate/mov-zombie | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 46bc7b5aa3..c556390525 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8216,5 +8216,5 @@ const AVInputFormat ff_mov_demuxer = { .read_packet= mov_read_packet, .read_close = mov_read_close, .read_seek = mov_read_seek, -.flags = AVFMT_NO_BYTE_SEEK | AVFMT_SEEK_TO_PTS, +.flags = AVFMT_NO_BYTE_SEEK | AVFMT_SEEK_TO_PTS | AVFMT_SHOW_IDS, }; diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov index 4ef569df89..8d21c396fc 100644 --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov @@ -36,7 +36,7 @@ color_primaries=unknown chroma_location=unspecified field_order=unknown refs=1 -id=N/A +id=0x1 r_frame_rate=25/1 avg_frame_rate=25/1 time_base=1/12800 diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov index 70e7cdc943..6f1f7c543f 100644 --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov @@ -36,7 +36,7 @@ color_primaries=unknown chroma_location=unspecified field_order=unknown refs=1 -id=N/A +id=0x1 r_frame_rate=25/1 avg_frame_rate=25/1 time_base=1/12800 diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie index 6e6d43d563..b6656de744 100644 --- a/tests/ref/fate/mov-zombie +++ b/tests/ref/fate/mov-zombie @@ -194,5 +194,5 @@ frame|media_type=video|stream_index=0|key_frame=0|pts=188623|pts_time=2.095811|p packet|codec_type=video|stream_index=0|pts=197632|pts_time=2.195911|dts=191625|dts_time=2.129167|duration=3003|duration_time=0.033367|size=580|pos=101820|flags=__ frame|media_type=video|stream_index=0|key_frame=0|pts=191626|pts_time=2.129178|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=191626|best_effort_timestamp_time=2.129178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=99180|pkt_size=1666|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=63|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleftside_data|side_data_type=H.26[45] User Data Unregistered SEI message -stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|refs=2|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=3/1001|avg_frame_rate=6372000/212521|time_base=1/9|start_pts=0|start_time=0.00|duration_ts=2125200|duration=23.61|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:capti ons=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:creation_time=2008-05-12T20:59:27.00Z|tag:language=eng|tag:handler_name=Apple Video Media Handler|tag:vendor_id=appl|tag:encoder=H.264 +stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|refs=2|is_avc=true|nal_length_size=4|id=0x1|r_frame_rate=3/1001|avg_frame_rate=6372000/212521|time_base=1/9|start_pts=0|start_time=0.00|duration_ts=2125200|duration=23.61|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0
Re: [FFmpeg-devel] [PATCH 3/3] lavfi/formats: document the negotiation process
Nicolas George (12021-08-19): > + *FIXME: the similarity logic (the ref argument to > + *pick_format()) added in FFmpeg duplicates and > + *overrides the swapping logic added in libav. Better > + *merge them into a score system. For sample formats, here are the scoring matrices used by each logic: Sample formats matrix for pick_formats(), small is best: in\o u8 s16 s32 flt dbl u8ps16ps32pfltp dblp s64s64p u8 0 10 30 30 70 1 11 31 31 71 70 71 s16 100 0 20 20 60 101 1 21 21 61 60 61 s32 300 200 0 2 40 301 201 1 3 41 40 41 flt 300 200 20 0 40 301 201 21 1 41 40 41 dbl 700 600 400 400 0 701 601 401 401 1 0 1 u8p1 11 31 31 71 0 10 30 30 70 71 70 s16p 101 1 21 21 61 100 0 20 20 60 61 60 s32p 301 201 1 3 41 300 200 0 2 40 41 40 fltp 301 201 21 1 41 300 200 20 0 40 41 40 dblp 701 601 401 401 1 700 600 400 400 0 1 0 s64 700 600 400 400 0 701 601 401 401 1 0 1 s64p 701 601 401 401 1 700 600 400 400 0 1 0 Sample formats matrix for swap_sample_fmts() with INT_MAX/2=10, large is best: in\o u8 s16 s32 flt dbl u8ps16ps32pfltp dblp s64s64p u8 inf 9 7 7 3 inf 9 7 7 3 3 3 s16 -1 inf 8 8 4 -1 inf 8 8 4 4 4 s32 -3 -2 inf 10 inf -3 -2 inf 10 inf inf inf flt -3 -2 10 inf inf -3 -2 10 inf inf inf inf dbl -7 -6 -4 -4 inf -7 -6 -4 -4 inf 10 10 u8p inf 9 7 7 3 inf 9 7 7 3 3 3 s16p -1 inf 8 8 4 -1 inf 8 8 4 4 4 s32p -3 -2 inf 10 inf -3 -2 inf 10 inf inf inf fltp -3 -2 10 inf inf -3 -2 10 inf inf inf inf dblp -7 -6 -4 -4 inf -7 -6 -4 -4 inf 10 10 s64 -7 -6 -4 -4 10 -7 -6 -4 -4 10 inf inf s64p -7 -6 -4 -4 10 -7 -6 -4 -4 10 inf inf In the second case, inf is a special case that breaks the loop looking for the best format. That means that for s16, it can pick s16p if it is present before s16p. The logic in pick_formats() explicitly favors the same planarity. Apart from that, the logic seem to yield the same kind of results. For a system where scores will be combined between several possible conversions, I think I will not just add the scores but use a bucket system, where the bucket "precision loss" at weight 1 is always worse than any amount in the bucket "precision waste". For reference, this is the code I used: static void print_score_matrices(void) { int i, j; printf("\nSample formats matrix for pick_formats(), small is best:\n"); printf("in\\o"); for (j = 0; j < AV_SAMPLE_FMT_NB; j++) printf(" %6s", av_get_sample_fmt_name(j)); printf("\n"); for (i = 0; i < AV_SAMPLE_FMT_NB; i++) { printf("%-4s", av_get_sample_fmt_name(i)); for (j = 0; j < AV_SAMPLE_FMT_NB; j++) printf(" %6d", get_fmt_score(j, i)); printf("\n"); } printf("\nSample formats matrix for swap_sample_fmts() with INT_MAX/2=10, large is best:\n"); printf("in\\o"); for (j = 0; j < AV_SAMPLE_FMT_NB; j++) printf(" %6s", av_get_sample_fmt_name(j)); printf("\n"); for (i = 0; i < AV_SAMPLE_FMT_NB; i++) { printf("%-4s", av_get_sample_fmt_name(i)); for (j = 0; j < AV_SAMPLE_FMT_NB; j++) { int bps= av_get_bytes_per_sample(i); int out_bps= av_get_bytes_per_sample(j); int score; if (av_get_packed_sample_fmt(j) == i || av_get_planar_sample_fmt(j) == i) { printf(" %6s", "inf"); } else if (bps == 4 && out_bps == 8) { printf("
[FFmpeg-devel] [PATCH] avfilter/signature: fix integer rounding cast precedence
Co-authored-by: Oscar Signed-off-by: Jai Luthra --- libavfilter/signature_lookup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c index 977f898049..86dd0c6675 100644 --- a/libavfilter/signature_lookup.c +++ b/libavfilter/signature_lookup.c @@ -244,9 +244,9 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont if (pairs[i].b[j] != pairs[k].b[l]) { /* linear regression */ m = (pairs[k].b_pos[l]-pairs[i].b_pos[j]) / (k-i); /* good value between 0.0 - 2.0 */ -framerate = (int) m*30 + 0.5; /* round up to 0 - 60 */ +framerate = (int) (m*30 + 0.5); /* round up to 0 - 60 */ if (framerate>0 && framerate <= MAX_FRAMERATE) { -offset = pairs[i].b_pos[j] - ((int) m*i + 0.5); /* only second part has to be rounded up */ +offset = pairs[i].b_pos[j] - ((int) (m*i + 0.5)); /* only second part has to be rounded up */ if (offset > -HOUGH_MAX_OFFSET && offset < HOUGH_MAX_OFFSET) { if (pairs[i].dist < pairs[k].dist) { if (pairs[i].dist < hspace[framerate-1][offset+HOUGH_MAX_OFFSET].dist) { -- 2.32.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] Third opinion? (was: lavf/avio: remove support for proto, , opt, val, , syntax.)
Andreas Rheinhardt (12021-08-14): > I do not really get that: The option passing syntax is restricted to the > subfile protocol, so I don't know why we allow it for the file protocol > in dashdec and hls. Unless I am missing something, this could (and > should) be removed at once. It must be leftover code from when it was supported for all protocols. Not requiring this kind of convoluted tests in new code is also a motivation for just removing the last trace of this feature. > I use it to concatenate parts of files: When a DVR of mine has to split > files due to the 4GB FAT-32 boundary, it does not do so cleanly; for > some reason the first 96256B of the second file are duplicated, i.e. > they coincide with bytes 96256-192511. For the third file, about a MB > starting from offset 96256 is duplicated. Makes sense. I think we should decide that protocols like concat and subfile, protocols where part(s) of the pseudo-URI are themselves pseudo-URI with other protocols (let us call them metaprotocols) should always involve a solution to pass options to the sub-protocols. Possibly, let us make this a common helper API. concat:file01.bin|[start=96256]subfile:file02.bin Anyway, I think I can push the series except for the last patch now. Any objection? Regards, -- Nicolas George 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] dox/examples/encode_video: add explanations in comments.
Nicolas George (12021-08-16): > Signed-off-by: Nicolas George > --- > doc/examples/encode_video.c | 24 +--- > 1 file changed, 21 insertions(+), 3 deletions(-) I fixed dox → doc in the subject. Will push soon unless somebody comments. Regards, -- Nicolas George 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/10] avfilter/formats: Don't set samplerate or channel count on video links
Andreas Rheinhardt (12021-08-15): > This currently happens by accident in a few filters that use > ff_set_common_(samplerates|channel_layouts) like afir (if the response > option is set) or agraphmonitor (due to the default code in > avfiltergraph.c). So change those functions to make sure it does no > longer happen. I think it would be better to fix these filters to not rely on ff_set_common_ functions. ff_set_common_formats is especially a problem since it cannot check the media type as is. How many are problematic? Or we should replace ff_set_common_formats() with explicit ff_set_common_pix_fmts() and ff_set_common_sample_fmts(). sed -i s/ff_set_common_formats/ff_set_common_pix_fmts/ libavfilter/vf_*.c sed -i s/ff_set_common_formats/ff_set_common_sample_fmts/ libavfilter/af_*.c would probably do most of the job correctly and a few asserts would catch the potential mistakes. > > Signed-off-by: Andreas Rheinhardt > --- > 1. Contrary to ff_default_query_formats() the default code in > avfiltergraph.c still uses ff_all_channel_layouts, not > ff_all_channel_counts. I believe that this doesn't make sense > and intend to change it after having inspected all filters for > compatibility with the change. After it is changed, > ff_default_query_formats() can be used directly. It was a choice I made when we had frequent merges from the fork, where unknown channel layouts were not supported. If you or somebody else can make all filters support channel counts or be explicit about not supporting them, then it is all the better. Supporting unknown layouts is still something that needs testing. AFAIR, we mostly do not have FATE tests for it because early parts of the code insist on guessing a layout. > 2. These defaults can be used to e.g. remove lots of > ff_set_common_all_samplerates() and calls. I will also look into this. > 3. I don't like the way it is decided whether the audio components > get initialized in ff_default_query_formats() and in the default code > in avfiltergraph.c: In many cases this will lead to an unnecessary > allocation (if the query_formats function has already set everything) > and furthermore I don't think one should only look at the first input > or (lacking that) the first output. Using internal per-filter flags > seems more reasonable for this. The rationale is that if a filter is more complex than inputs and outputs related and with the same format, then it must implement a query_formats() callback and set the lists. Only the very simple filters where the logic as implemented works can dispense with a complete query_formats() callback. I think it is a good principle. A system of flags would require a similar amount of code, but be more complex and harder to maintain. We could do with a little more consistency checks, though. > 4. Just a quick question: If several links are set to individual > lists that each contain exactly one element that coincides for all of > these lists, then one could just as well use a shared list for all these > links!? After all, in both cases the format negotiation will lead to the > same result: The given format will be choosen for all these links. > (E.g. vf_yadif_cuda.c can be simplified if the answer turns out to be > yes (as I expect).) I think you are right. Do you remember which other filters have this issue? It is entirely possible the authors did not understand the negotiation process in all its details. > > libavfilter/formats.c | 16 ++-- > libavfilter/formats.h | 6 +++--- > 2 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/libavfilter/formats.c b/libavfilter/formats.c > index cc73c5abcb..9ceb32255b 100644 > --- a/libavfilter/formats.c > +++ b/libavfilter/formats.c > @@ -622,14 +622,16 @@ void ff_formats_changeref(AVFilterFormats **oldref, > AVFilterFormats **newref) > FORMATS_CHANGEREF(oldref, newref); > } > > -#define SET_COMMON_FORMATS(ctx, fmts, ref_fn, unref_fn) \ > +#define SET_COMMON_FORMATS(ctx, fmts, _type, ref_fn, unref_fn) \ I think mtype or media_type would be better than _type: identifiers starting with an underscore are supposed to be allowed, but they might cause issues with obscure implementations. More importantly, I find it catches the eye and distract from what is going on. > int i; \ > \ > if (!fmts) \ > return AVERROR(ENOMEM); \ > \ > for (i = 0; i < ctx->nb_inputs; i++) { \ > -if (ctx->inputs[i] && !ctx->inputs[i]->outcfg.fmts) { \ > +AVFilterLink *const link = ctx->inputs[i]; \ > +if (link && !link->outcfg.fmts && \ > +(_type == AVMEDIA_
Re: [FFmpeg-devel] [PATCH 05/10] avfilter/avfilter: Deprecate avfilter_pad_count()
Andreas Rheinhardt (12021-08-15): > It is unnecessary as the number of static inputs and outputs can now > be directly read via AVFilter.nb_(in|out)puts. > > Signed-off-by: Andreas Rheinhardt > --- > libavfilter/avfilter.h | 5 + > libavfilter/version.h | 3 +++ > 2 files changed, 8 insertions(+) LGTM. Regards, -- Nicolas George 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/10] avfilter/avfiltergraph: Remove dead checks
Andreas Rheinhardt (12021-08-15): > These checks emit warnings in case the channel layouts lists are > inconsistent; yet since 69f5f6ea375950b4845b241ee27054bfc8f00343 > a function that is called earlier errors out if they are inconsistent. > > Signed-off-by: Andreas Rheinhardt > --- > This relies on no audio parts being set for video links, but this is > indeed so since the last commit. > > libavfilter/avfiltergraph.c | 22 +- > 1 file changed, 1 insertion(+), 21 deletions(-) Looks ok. Regards, -- Nicolas George 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/10] avfilter/formats: Avoid redundant counter
Andreas Rheinhardt (12021-08-15): > The ff_set_common_(formats|channel_layouts|samplerates) have to free > their list in case it doesn't have an owner; therefore they tracked > whether they attached it to an owner. But the list's refcount already > contains such a counter, so we don't have to keep track of whether we > have attached the list to an owner. > > Signed-off-by: Andreas Rheinhardt > --- > libavfilter/formats.c | 7 ++- > 1 file changed, 2 insertions(+), 5 deletions(-) Should be ok. Regards, -- Nicolas George 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/10] fftools/cmdutils: Switch to avfilter_filter_pad_count()
Andreas Rheinhardt (12021-08-15): > Signed-off-by: Andreas Rheinhardt > --- > fftools/cmdutils.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) LGTM but I do not maintain this. Regards, -- Nicolas George 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 02/10] avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilter
Nicolas George: > Andreas Rheinhardt (12021-08-15): >> #define OFFSET(x) offsetof(CoreImageContext, x) >> @@ -663,8 +660,8 @@ const AVFilter ff_vf_coreimage = { >> .uninit= uninit, >> .priv_size = sizeof(CoreImageContext), >> .priv_class= &coreimage_class, >> -.inputs= vf_coreimage_inputs, >> -.outputs = vf_coreimage_outputs, >> +FF_FILTER_INPUTS(vf_coreimage_inputs), >> +FF_FILTER_OUTPUTS(vf_coreimage_outputs), >> .query_formats = query_formats, >> }; >> >> @@ -685,6 +682,6 @@ const AVFilter ff_vsrc_coreimagesrc = { >> .priv_size = sizeof(CoreImageContext), >> .priv_class= &coreimagesrc_class, >> .inputs= NULL, >> -.outputs = vsrc_coreimagesrc_outputs, >> +FF_FILTER_OUTPUTS(vsrc_coreimagesrc_outputs), > > In this file, you are using FF_FILTER_INPUTS and FF_FILTER_OUTPUTS > instead of just FILTER like everywhere else. > > I suppose you missed it because it depends on a proprietary operating > system. I do not mind if you break it, but I suppose other would ;-) > > LGTM apart from that. > > Regards, > Good catch! This file is indeed special: The first version of this patchset forgot to update it (because I used a sed that involved *.c and this is the only filter not covered by it). I later found this out (by checking the few filters that I don't check automatically manually) and then added the line manually. And botched it. - Andreas ___ 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 01/10] fftools/cmdutils: Use avfilter_pad_count() for AVFilter's number of pads
Andreas Rheinhardt (12021-08-15): > Besides being nicer code this also has the advantage of not making > assumptions about the internal implementation: While it is documented > that the AVFilter.inputs and AVFilter.outputs arrays are terminated > by a zeroed sentinel, one is not allowed to infer that one can just > check avfilter_pad_get_name(padarray, i) to see whether one has reached > the sentinel: > It could be that the pointer to the string is contained > in a different structure than AVFilterPad that needs to be accessed > first: return pad->struct->string. > It could be that for small strings an internal buffer in > AVFilterPad is used (to avoid a relocation) whereas for longer strings > an external string is used; this is useful to avoid relocations: > return pad->string_ptr ? pad->string_ptr : pad->interal_string > Or it could be that the name has a default value: > return pad->name ? pad->name : "default" > (This actually made sense for us because the name of most of our > AVFilterPads is just "default"; doing so would save lots of relocations.) > > The only thing one is allowed to infer from the existence of the > sentinel is that one is allowed to use avfilter_pad_count() to get > the number of pads. Therefore it is used. > > Signed-off-by: Andreas Rheinhardt > --- > Unchanged since last time. > > fftools/cmdutils.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) It means this bit of code will be inefficient for a few commits that will be pushed at the same time. I am ok with it. I do not maintain this, but LGTM. > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index 6d0bcd6085..96d38803df 100644 > --- a/fftools/cmdutils.c > +++ b/fftools/cmdutils.c > @@ -1707,12 +1707,14 @@ int show_filters(void *optctx, const char *opt, const > char *arg) > while ((filter = av_filter_iterate(&opaque))) { > descr_cur = descr; > for (i = 0; i < 2; i++) { > +unsigned nb_pads; > if (i) { > *(descr_cur++) = '-'; > *(descr_cur++) = '>'; > } > pad = i ? filter->outputs : filter->inputs; > -for (j = 0; pad && avfilter_pad_get_name(pad, j); j++) { > +nb_pads = avfilter_pad_count(pad); > +for (j = 0; j < nb_pads; j++) { > if (descr_cur >= descr + sizeof(descr) - 4) > break; > *(descr_cur++) = > get_media_type_char(avfilter_pad_get_type(pad, j)); Regards, -- Nicolas George 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] lavfi: merge AVFilterChannelLayouts into AVFilterFormats.
Make AVFilterFormats.formats uint64_t. They are short-lived lists and usually quite short too. Signed-off-by: Nicolas George --- I think the simplification in formats.c is well worth the cost in memory: most of the lines removed are hard-to-maintain macro code. Furthermore, it will make easier to attach a score to the formats to replace the logic in swap_*() and pick_formats() without adding yet more macro code. This patch has the risk of causing many conflicts, I would like to avoir keeping it in the air too long. Please comment without taking too much time. libavfilter/aeval.c| 6 +- libavfilter/af_afir.c | 10 +- libavfilter/af_aformat.c | 4 +- libavfilter/af_agate.c | 10 +- libavfilter/af_amerge.c| 12 +-- libavfilter/af_anequalizer.c | 6 +- libavfilter/af_apulsator.c | 2 +- libavfilter/af_aresample.c | 6 +- libavfilter/af_asr.c | 2 +- libavfilter/af_bs2b.c | 2 +- libavfilter/af_channelmap.c| 10 +- libavfilter/af_channelsplit.c | 8 +- libavfilter/af_crossfeed.c | 2 +- libavfilter/af_earwax.c| 2 +- libavfilter/af_extrastereo.c | 2 +- libavfilter/af_haas.c | 2 +- libavfilter/af_hdcd.c | 2 +- libavfilter/af_headphone.c | 14 +-- libavfilter/af_join.c | 6 +- libavfilter/af_ladspa.c| 8 +- libavfilter/af_lv2.c | 8 +- libavfilter/af_pan.c | 6 +- libavfilter/af_replaygain.c| 2 +- libavfilter/af_sidechaincompress.c | 10 +- libavfilter/af_silencedetect.c | 2 +- libavfilter/af_sofalizer.c | 6 +- libavfilter/af_stereotools.c | 2 +- libavfilter/af_stereowiden.c | 2 +- libavfilter/af_surround.c | 6 +- libavfilter/asrc_flite.c | 2 +- libavfilter/avf_abitscope.c| 4 +- libavfilter/avf_ahistogram.c | 4 +- libavfilter/avf_aphasemeter.c | 6 +- libavfilter/avf_avectorscope.c | 4 +- libavfilter/avf_concat.c | 6 +- libavfilter/avf_showcqt.c | 4 +- libavfilter/avf_showfreqs.c| 4 +- libavfilter/avf_showspatial.c | 4 +- libavfilter/avf_showspectrum.c | 4 +- libavfilter/avf_showvolume.c | 4 +- libavfilter/avf_showwaves.c| 4 +- libavfilter/avfilter.c | 8 +- libavfilter/avfilter.h | 4 +- libavfilter/avfiltergraph.c| 44 - libavfilter/buffersink.c | 2 +- libavfilter/buffersrc.c| 2 +- libavfilter/f_ebur128.c| 6 +- libavfilter/formats.c | 152 - libavfilter/formats.h | 56 +++ libavfilter/src_movie.c| 2 +- libavfilter/tests/filtfmts.c | 6 +- libavfilter/vaf_spectrumsynth.c| 4 +- 52 files changed, 221 insertions(+), 275 deletions(-) diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c index 7c891c5ad0..9e2abfff60 100644 --- a/libavfilter/aeval.c +++ b/libavfilter/aeval.c @@ -338,7 +338,7 @@ AVFILTER_DEFINE_CLASS(aeval); static int aeval_query_formats(AVFilterContext *ctx) { -AVFilterChannelLayouts *layouts; +AVFilterFormats *layouts; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; EvalContext *eval = ctx->priv; @@ -349,7 +349,7 @@ static int aeval_query_formats(AVFilterContext *ctx) // inlink supports any channel layout layouts = ff_all_channel_counts(); -if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0) +if ((ret = ff_formats_ref(layouts, &inlink->outcfg.channel_layouts)) < 0) return ret; if (eval->same_chlayout) { @@ -362,7 +362,7 @@ static int aeval_query_formats(AVFilterContext *ctx) eval->out_channel_layout ? eval->out_channel_layout : FF_COUNT2LAYOUT(eval->nb_channels))) < 0) return ret; -if ((ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts)) < 0) +if ((ret = ff_formats_ref(layouts, &outlink->incfg.channel_layouts)) < 0) return ret; } diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index d3868a7f2e..3086f91f47 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -737,19 +737,19 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; } else { -AVFilterChannelLayouts *mono = NULL; -AVFilterChannelLayouts *layouts = ff_all_channel_counts(); +AVFilterFormats *mono = NULL; +AVFilterFormats *layouts = ff_all_channel_counts(); -if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0) +if ((ret = ff_formats_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0)
Re: [FFmpeg-devel] [PATCH 03/10] avfilter/avfilter: Add avfilter_filter_pad_count()
Andreas Rheinhardt (12021-08-15): > It is intended as replacement for avfilter_pad_count(). In contrast to > the latter, it avoids a loop. > > Signed-off-by: Andreas Rheinhardt > --- > Missing APIchanges entry and version bump. > > libavfilter/avfilter.c | 5 + > libavfilter/avfilter.h | 5 + > 2 files changed, 10 insertions(+) LGTM. Regards, -- Nicolas George 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 02/10] avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilter
Andreas Rheinhardt (12021-08-15): > #define OFFSET(x) offsetof(CoreImageContext, x) > @@ -663,8 +660,8 @@ const AVFilter ff_vf_coreimage = { > .uninit= uninit, > .priv_size = sizeof(CoreImageContext), > .priv_class= &coreimage_class, > -.inputs= vf_coreimage_inputs, > -.outputs = vf_coreimage_outputs, > +FF_FILTER_INPUTS(vf_coreimage_inputs), > +FF_FILTER_OUTPUTS(vf_coreimage_outputs), > .query_formats = query_formats, > }; > > @@ -685,6 +682,6 @@ const AVFilter ff_vsrc_coreimagesrc = { > .priv_size = sizeof(CoreImageContext), > .priv_class= &coreimagesrc_class, > .inputs= NULL, > -.outputs = vsrc_coreimagesrc_outputs, > +FF_FILTER_OUTPUTS(vsrc_coreimagesrc_outputs), In this file, you are using FF_FILTER_INPUTS and FF_FILTER_OUTPUTS instead of just FILTER like everywhere else. I suppose you missed it because it depends on a proprietary operating system. I do not mind if you break it, but I suppose other would ;-) LGTM apart from that. Regards, -- Nicolas George 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 25/25] avformat/matroskaenc: Redo handling of FlagDefault
Nicolas George: > Andreas Rheinhardt (12020-01-21): >> Without a new option, one could not distinguish the case where the user >> explicitly wants no dispositions at all and the case where one remuxes from >> a source container that does not have the concept of default streams. >> Furthermore, having an option allows to distinguish the infer and >> "infer_no_subs" cases (the latter makes (some) players not show the >> subtitles unless one explicitly enables them which is what (some) users >> (including myself and apparently the guy behind #8416) want; I am actually >> unsure whether infer_no_subs would make a better default value). > > Hi. I am replying to this old discussion because I just lost a little > time on an encode: I had "-disposition:2 -default" in my command line, > and the track was still marked default, I was missing "-default_mode > passthrough". > > Silently ignoring or overriding user-given options is really not a good > idea. How can we enhance that? > > The obvious solution would be to make passthrough the default. That > would make matroskaenc similar to other muxers. But I suppose you had a > good reason to make infer the default? > At the time of said patch, the definition of the default flag was: "Set if that track (audio, video or subs) **SHOULD** be active if no language found matches the user preference." This implies that if no language found matches the user preference, then all default tracks should be played simultaneously, so that it makes very little sense to mark more than one track of a given type as default (there were also notes to the spec which contradicted the main definition and said that in this case the *first* default track should be used). For this reason mkvmerge disallowed setting multiple default tracks of the same type. And given that mkvmerge is the de-facto reference implementation, this meant that simply passing the disposition through would have created files of dubious validity. So I imitated what mkvmerge was doing. The whole situation changed now; the meaning of the default flag has been revised in a way that leaves no doubt that it is perfectly valid to set the default flag for as many tracks as one wishes. Therefore I have sent a patchset implementing this: https://ffmpeg.org/pipermail/ffmpeg-devel/2021-August/284066.html > We could try to find an heuristic to detect if the disposition was set, > and print a warning if infer is used and it gets overridden. I do not > like that much, because warnings are not a satisfactory solution. > > We can try to find a real solution to detect if the disposition is set > or not reliably, and use it (and then deprecate -default_mode). For > example: > > /** > * Set by demuxers when they know the disposition is reliable. > * Used by muxers to detect if they use the disposition or guess it. > */ > #define AV_DISPOSITION_SET 0x1000 > I pondered doing such a thing then and now; I didn't do it last year because a system as you propose would not have solved the main "problem" (as I considered it at the time) of creating files where multiple tracks of the same type are marked as default. I didn't do it now, because the default course of action should always be just to preserve what the user indicated. But if there are complaints, then I will probably implement something like this. (mkvmerge's strategy is btw: If the user set it explicitly on the commandline, use this; else if the input file provides a default flag, use this; else treat it as default track.) - Andreas PS: Sorry for taking so long to answer. ___ 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] lavfi/formats: cosmetic: move negotiation stuff at the end
Nicolas George (12021-08-19): > Since these three patches are cosmetic and internal documentation, I > will push soon, probably as soon as I have something new to post on top > of them. Series pushed. > Anton and Michael: you are the authors of the redundant similarity > logics in swap and pick_formats() (see the FIXME comments in the third > patche), I would appreciate if you had a look at it. > > Michael, in particular, if you have test cases covering this logic that > are not part of FATE, please share them, or even better make them part > of FATE if possible. Ping? I am about to start working on making this a score-based system. Regards, -- Nicolas George 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] Implementing FATE tests
Paul Buxton (12021-08-20): > Hi, > I am a little unclear how/where to implement a test for my new filter. I > see the makefile for the video filters, but it mostly looks to be command > lines. Should I be adding some reference input/output data somewhere? Look at any commit titled "add fate tests" that is about a filter, and see what it does. For example: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/06aab9790db1f7cd57bdcba6008c5e7f4030c7c4 Regards, -- Nicolas George 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] Implementing FATE tests
Hi, I am a little unclear how/where to implement a test for my new filter. I see the makefile for the video filters, but it mostly looks to be command lines. Should I be adding some reference input/output data somewhere? If anyone is interested in the results of the underwater correction filter. Video before filter https://www.youtube.com/watch?v=VadEZTwvz2E After https://www.youtube.com/watch?v=8WnhldmqH9k ___ 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/4] avformat/matroskadec: Include webm_dash_manifest demuxer only if enabled
Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index fdfcc86aeb..01104dbda7 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -3885,6 +3885,7 @@ static int matroska_read_close(AVFormatContext *s) return 0; } +#if CONFIG_WEBM_DASH_MANIFEST_DEMUXER typedef struct { int64_t start_time_ns; int64_t end_time_ns; @@ -4292,6 +4293,18 @@ static const AVClass webm_dash_class = { .version= LIBAVUTIL_VERSION_INT, }; +const AVInputFormat ff_webm_dash_manifest_demuxer = { +.name = "webm_dash_manifest", +.long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"), +.priv_class = &webm_dash_class, +.priv_data_size = sizeof(MatroskaDemuxContext), +.flags_internal = FF_FMT_INIT_CLEANUP, +.read_header= webm_dash_manifest_read_header, +.read_packet= webm_dash_manifest_read_packet, +.read_close = matroska_read_close, +}; +#endif + const AVInputFormat ff_matroska_demuxer = { .name = "matroska,webm", .long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"), @@ -4305,14 +4318,3 @@ const AVInputFormat ff_matroska_demuxer = { .read_seek = matroska_read_seek, .mime_type = "audio/webm,audio/x-matroska,video/webm,video/x-matroska" }; - -const AVInputFormat ff_webm_dash_manifest_demuxer = { -.name = "webm_dash_manifest", -.long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"), -.priv_data_size = sizeof(MatroskaDemuxContext), -.flags_internal = FF_FMT_INIT_CLEANUP, -.read_header= webm_dash_manifest_read_header, -.read_packet= webm_dash_manifest_read_packet, -.read_close = matroska_read_close, -.priv_class = &webm_dash_class, -}; -- 2.30.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/4] avformat/matroskaenc: Only compile functions when needed
Fixes unused function warnings in case e.g. the WebM muxer is disabled. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 52 +++ 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index ad8a4698b8..b1735f3838 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2632,33 +2632,6 @@ after_cues: return ret2; } -static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance) -{ -int i; -for (i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++) -if (ff_mkv_codec_tags[i].id == codec_id) -return 1; - -if (std_compliance < FF_COMPLIANCE_NORMAL) { -enum AVMediaType type = avcodec_get_type(codec_id); -// mkv theoretically supports any video/audio through VFW/ACM -if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO) -return 1; -} - -return 0; -} - -static int webm_query_codec(enum AVCodecID codec_id, int std_compliance) -{ -int i; -for (i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++) -if (ff_webm_codec_tags[i].id == codec_id) -return 1; - -return 0; -} - static uint64_t mkv_get_uid(const mkv_track *tracks, int i, AVLFG *c) { while (1) { @@ -2833,6 +2806,22 @@ static const AVClass matroska_webm_class = { }; #if CONFIG_MATROSKA_MUXER +static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance) +{ +for (int i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++) +if (ff_mkv_codec_tags[i].id == codec_id) +return 1; + +if (std_compliance < FF_COMPLIANCE_NORMAL) { +enum AVMediaType type = avcodec_get_type(codec_id); +// mkv theoretically supports any video/audio through VFW/ACM +if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO) +return 1; +} + +return 0; +} + const AVOutputFormat ff_matroska_muxer = { .name = "matroska", .long_name = NULL_IF_CONFIG_SMALL("Matroska"), @@ -2862,6 +2851,15 @@ const AVOutputFormat ff_matroska_muxer = { #endif #if CONFIG_WEBM_MUXER +static int webm_query_codec(enum AVCodecID codec_id, int std_compliance) +{ +for (int i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++) +if (ff_webm_codec_tags[i].id == codec_id) +return 1; + +return 0; +} + const AVOutputFormat ff_webm_muxer = { .name = "webm", .long_name = NULL_IF_CONFIG_SMALL("WebM"), -- 2.30.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/4] avformat/matroskaenc: Pass dispositions through unchanged by default
Up until now, the Matroska muxer did not use the dispositions it is given as-is; instead it by default overrode the disposition of the first track of a kind (audio, video, subtitles) if no track of this kind has the default disposition set. And up until recently, it also enforced by default that no more than one track of each kind be marked as default. The rationale for the former is that there are lots of containers which lack the concept of default streams, so that it is not uncommon for no stream to be marked as default at all; the rationale for the latter was that up until recently, it was dubious whether the Matroska specification allowed more than one default stream for track type (e.g. mkvmerge disallowed it). It was this point which led to the implementation of the above mentioned behaviour inspired by mkvmerge. Yet the Matroska specifications have changed and now explicitly allow to set more than one track of each type as default, so that the main reason of not using the dispositions as-is was rendered moot. Therefore this commit changes the default to pass the disposition through. The matroska-mpegts-remux FATE-test has been updated to still use the old "infer" mode so that it is still covered by FATE; the matroska-zero-length-block test has also been updated to cover the infer_no_subs mode. The references for lots of other FATE tests needed to be updated because of a newly added FlagDefault element with value zero (whereas a FlagDefault with value 1 needn't be coded at all, as it coincided with the default value of said element). Signed-off-by: Andreas Rheinhardt --- doc/muxers.texi | 2 +- libavformat/matroskaenc.c | 2 +- tests/fate/matroska.mak | 4 +- tests/fate/wavpack.mak| 4 +- tests/ref/fate/aac-autobsf-adtstoasc | 4 +- tests/ref/fate/binsub-mksenc | 2 +- tests/ref/fate/matroska-h264-remux| 4 +- .../fate/matroska-mastering-display-metadata | 4 +- tests/ref/fate/webm-dash-chapters | 4 +- tests/ref/lavf-fate/av1.mkv | 4 +- tests/ref/lavf/mka| 4 +- tests/ref/lavf/mkv| 4 +- tests/ref/lavf/mkv_attachment | 4 +- tests/ref/seek/lavf-mkv | 44 +-- 14 files changed, 45 insertions(+), 45 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 0f8efabab9..05719c173c 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1564,7 +1564,7 @@ have no effect if it is not. @item default_mode This option controls how the FlagDefault of the output tracks will be set. It influences which tracks players should play by default. The default mode -is @samp{infer}. +is @samp{passthrough}. @table @samp @item infer Every track with disposition default will have the FlagDefault set. diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index e2d9159e2c..ad8a4698b8 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2818,7 +2818,7 @@ static const AVOption options[] = { { "allow_raw_vfw", "allow RAW VFW mode", OFFSET(allow_raw_vfw), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "flipped_raw_rgb", "Raw RGB bitmaps in VFW mode are stored bottom-up", OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "write_crc32", "write a CRC32 element inside every Level 1 element", OFFSET(write_crc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS }, -{ "default_mode", "Controls how a track's FlagDefault is inferred", OFFSET(default_mode), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MODE_INFER }, DEFAULT_MODE_INFER, DEFAULT_MODE_PASSTHROUGH, FLAGS, "default_mode" }, +{ "default_mode", "Controls how a track's FlagDefault is inferred", OFFSET(default_mode), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MODE_PASSTHROUGH }, DEFAULT_MODE_INFER, DEFAULT_MODE_PASSTHROUGH, FLAGS, "default_mode" }, { "infer", "For each track type, mark each track of disposition default as default; if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER }, 0, 0, FLAGS, "default_mode" }, { "infer_no_subs", "For each track type, mark each track of disposition default as default; for audio and video: if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER_NO_SUBS }, 0, 0, FLAGS, "default_mode" }, { "passthrough", "Use the disposition flag as-is", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_PASSTHROUGH }, 0, 0, FLAGS, "default_mode" }, diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak index 625b2a4571..e117a0f6a6 100644 --- a/tests/fate/matroska.mak +++ b/tests/fate/matroska.mak @@ -65,7 +65,7 @@ fate-webm-dash-chapters: CMD = transcode ogg $(TARGET_SAMPLES)/vorbis/vorbis_cha # It furthermore tests correct propagation of the description tag. FATE_MATROSKA_FFMPEG
[FFmpeg-devel] [PATCH 1/4] avformat/matroskaenc: Allow to set multiple streams as default
The Matroska specifications have evolved and now allow to mark multiple tracks of the same kind as default (whether this was legal or not before was dubious; e.g. mkvmerge disallowed it). Yet when the Matroska muxer is set to infer default dispositions if absent, it also enforced the now outdated restriction. So update this. Signed-off-by: Andreas Rheinhardt --- doc/muxers.texi | 12 ++-- libavformat/matroskaenc.c | 16 ++-- tests/ref/fate/matroska-flac-extradata-update | 4 ++-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 0972bbfd5c..0f8efabab9 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1567,12 +1567,12 @@ It influences which tracks players should play by default. The default mode is @samp{infer}. @table @samp @item infer -In this mode, for each type of track (audio, video or subtitle), if there is -a track with disposition default of this type, then the first such track -(i.e. the one with the lowest index) will be marked as default; if no such -track exists, the first track of this type will be marked as default instead -(if existing). This ensures that the default flag is set in a sensible way even -if the input originated from containers that lack the concept of default tracks. +Every track with disposition default will have the FlagDefault set. +Additionally, for each type of track (audio, video or subtitle), if no track +with disposition default of this type exists, then the first track of this type +will be marked as default (if existing). This ensures that the default flag +is set in a sensible way even if the input originated from containers that +lack the concept of default tracks. @item infer_no_subs This mode is the same as infer except that if no subtitle track with disposition default exists, no subtitle track will be marked as default. diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 899a3388cd..e2d9159e2c 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1395,7 +1395,8 @@ static int mkv_write_tracks(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; AVIOContext *pb = s->pb; -int i, ret, video_default_idx, audio_default_idx, subtitle_default_idx; +int video_default_idx = -1, audio_default_idx = -1, subtitle_default_idx = -1; +int i, ret; if (mkv->nb_attachments == s->nb_streams) return 0; @@ -1405,11 +1406,7 @@ static int mkv_write_tracks(AVFormatContext *s) return ret; if (mkv->default_mode != DEFAULT_MODE_PASSTHROUGH) { -int video_idx, audio_idx, subtitle_idx; - -video_idx= video_default_idx= -audio_idx= audio_default_idx= -subtitle_idx = subtitle_default_idx = -1; +int video_idx = -1, audio_idx = -1, subtitle_idx = -1; for (i = s->nb_streams - 1; i >= 0; i--) { AVStream *st = s->streams[i]; @@ -1435,8 +1432,7 @@ static int mkv_write_tracks(AVFormatContext *s) } for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; -int is_default = mkv->default_mode == DEFAULT_MODE_PASSTHROUGH ? - st->disposition & AV_DISPOSITION_DEFAULT : +int is_default = st->disposition & AV_DISPOSITION_DEFAULT || i == video_default_idx || i == audio_default_idx || i == subtitle_default_idx; ret = mkv_write_track(s, mkv, st, &mkv->tracks[i], @@ -2823,8 +2819,8 @@ static const AVOption options[] = { { "flipped_raw_rgb", "Raw RGB bitmaps in VFW mode are stored bottom-up", OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "write_crc32", "write a CRC32 element inside every Level 1 element", OFFSET(write_crc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS }, { "default_mode", "Controls how a track's FlagDefault is inferred", OFFSET(default_mode), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MODE_INFER }, DEFAULT_MODE_INFER, DEFAULT_MODE_PASSTHROUGH, FLAGS, "default_mode" }, -{ "infer", "For each track type, mark the first track of disposition default as default; if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER }, 0, 0, FLAGS, "default_mode" }, -{ "infer_no_subs", "For each track type, mark the first track of disposition default as default; for audio and video: if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER_NO_SUBS }, 0, 0, FLAGS, "default_mode" }, +{ "infer", "For each track type, mark each track of disposition default as default; if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER }, 0, 0, FLAGS, "default_mode" }, +{ "infer_no_subs", "For each track type, mark each track of disposition default as default; for audio and video: i
Re: [FFmpeg-devel] [PATCH 01/10] fftools/cmdutils: Use avfilter_pad_count() for AVFilter's number of pads
Andreas Rheinhardt: > Besides being nicer code this also has the advantage of not making > assumptions about the internal implementation: While it is documented > that the AVFilter.inputs and AVFilter.outputs arrays are terminated > by a zeroed sentinel, one is not allowed to infer that one can just > check avfilter_pad_get_name(padarray, i) to see whether one has reached > the sentinel: > It could be that the pointer to the string is contained > in a different structure than AVFilterPad that needs to be accessed > first: return pad->struct->string. > It could be that for small strings an internal buffer in > AVFilterPad is used (to avoid a relocation) whereas for longer strings > an external string is used; this is useful to avoid relocations: > return pad->string_ptr ? pad->string_ptr : pad->interal_string > Or it could be that the name has a default value: > return pad->name ? pad->name : "default" > (This actually made sense for us because the name of most of our > AVFilterPads is just "default"; doing so would save lots of relocations.) > > The only thing one is allowed to infer from the existence of the > sentinel is that one is allowed to use avfilter_pad_count() to get > the number of pads. Therefore it is used. > > Signed-off-by: Andreas Rheinhardt > --- > Unchanged since last time. > > fftools/cmdutils.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index 6d0bcd6085..96d38803df 100644 > --- a/fftools/cmdutils.c > +++ b/fftools/cmdutils.c > @@ -1707,12 +1707,14 @@ int show_filters(void *optctx, const char *opt, const > char *arg) > while ((filter = av_filter_iterate(&opaque))) { > descr_cur = descr; > for (i = 0; i < 2; i++) { > +unsigned nb_pads; > if (i) { > *(descr_cur++) = '-'; > *(descr_cur++) = '>'; > } > pad = i ? filter->outputs : filter->inputs; > -for (j = 0; pad && avfilter_pad_get_name(pad, j); j++) { > +nb_pads = avfilter_pad_count(pad); > +for (j = 0; j < nb_pads; j++) { > if (descr_cur >= descr + sizeof(descr) - 4) > break; > *(descr_cur++) = > get_media_type_char(avfilter_pad_get_type(pad, j)); > Ping for this set. - Andreas ___ 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] lavfi/formats: document the negotiation process.
Michael Koch (12021-08-20): > I know almost nothing about this stuff, but it doesn't sound right that the > frist > two steps use the same function. Isn't step 2 merge_formats()? Unfortunately not. I wanted to separate them, but it is not quite possible because of the weird partial negotiation system that I regret introducing for amerge and is now used by about two and a half filters. This is one of the things that needs overhauling. Regards, -- Nicolas George 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] avfilter/avfiltergraph: Don't use AVClass * for logcontext
Andreas Rheinhardt (12021-08-20): > Forgotten in 57fa314090ab006808911fd790053b534749aa53. > > Signed-off-by: Andreas Rheinhardt > --- > libavfilter/avfiltergraph.c | 13 ++--- > 1 file changed, 6 insertions(+), 7 deletions(-) Ok of course, thanks. Regards, -- Nicolas George 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".