[FFmpeg-devel] [PATCH v2 2/2] avformat/hlsenc: deprecate hls_ts_options option

2021-11-17 Thread Steven Liu
Because the hls_ts_options will be misunderstand by user,
and then user can use hls_segment_options instead of hls_ts_options.

Signed-off-by: Steven Liu 
---
 doc/muxers.texi   | 1 +
 libavformat/hlsenc.c  | 4 +++-
 libavformat/version.h | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 287ea569fd..1ea98a69a3 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -799,6 +799,7 @@ were recently referenced in the playlist. Default value is 
1, meaning segments o
 Set output format options using a :-separated list of key=value
 parameters. Values containing @code{:} special characters must be
 escaped.
+@code{hls_ts_options} is deprecated, use hls_segment_options instead of it..
 
 @item hls_start_number_source
 Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to 
the specified source.
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index fb261acc93..1be5bdf451 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -3101,7 +3101,9 @@ static const AVOption options[] = {
 {"hls_init_time", "set segment length at init list", 
OFFSET(init_time), AV_OPT_TYPE_DURATION, {.i64 = 0},   0, INT64_MAX, E},
 {"hls_list_size", "set maximum number of playlist entries",  
OFFSET(max_nb_segments),AV_OPT_TYPE_INT,{.i64 = 5}, 0, INT_MAX, E},
 {"hls_delete_threshold", "set number of unreferenced segments to keep 
before deleting",  OFFSET(hls_delete_threshold),AV_OPT_TYPE_INT,{.i64 = 
1}, 1, INT_MAX, E},
-{"hls_ts_options","set hls mpegts list of options for the container format 
used for hls", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,  
  E},
+#if FF_HLS_TS_OPTIONS
+{"hls_ts_options","set hls mpegts list of options for the container format 
used for hls (deprecated, use hls_segment_options instead of it.)", 
OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E | 
AV_OPT_FLAG_DEPRECATED},
+#endif
 {"hls_vtt_options","set hls vtt list of options for the container format 
used for hls", OFFSET(vtt_format_options_str), AV_OPT_TYPE_STRING, {.str = 
NULL},  0, 0,E},
 {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT 
(0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, 
INT_MIN, INT_MAX, E},
 {"hls_base_url",  "url to prepend to each playlist entry",   
OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
diff --git a/libavformat/version.h b/libavformat/version.h
index ae2b873197..9c41a300e9 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -58,6 +58,7 @@
 #define FF_API_LAVF_PRIV_OPT(LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_AVIOCONTEXT_WRITTEN  (LIBAVFORMAT_VERSION_MAJOR < 60)
+#define FF_HLS_TS_OPTIONS   (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_AVSTREAM_CLASS   (LIBAVFORMAT_VERSION_MAJOR > 59)
 
 
-- 
2.25.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 v2 1/2] avformat/hlsenc: add hls_segment_options correct the segment options name

2021-11-17 Thread Steven Liu
From: Steven Liu 

Because the hls_ts_options will be misunderstand by user that only can
be used in mpegts segments option. So add this option for segments.

Signed-off-by: Steven Liu 
Signed-off-by: Steven Liu 
---
 doc/muxers.texi  | 4 
 libavformat/hlsenc.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 7eee8c1be6..287ea569fd 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -919,6 +919,10 @@ This example will create a directory hierarchy 2016/02/15 
(if any of them do not
 produce the playlist, @file{out.m3u8}, and segment files:
 @file{2016/02/15/file-20160215-1455569023.ts}, 
@file{2016/02/15/file-20160215-1455569024.ts}, etc.
 
+@item hls_segment_options @var{options_list}
+Set output format options using a :-separated list of key=value
+parameters. Values containing @code{:} special characters must be
+escaped.
 
 @item hls_key_info_file @var{key_info_file}
 Use the information in @var{key_info_file} for segment encryption. The first
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index cfd0c036d1..fb261acc93 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -3106,6 +3106,7 @@ static const AVOption options[] = {
 {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT 
(0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, 
INT_MIN, INT_MAX, E},
 {"hls_base_url",  "url to prepend to each playlist entry",   
OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
 {"hls_segment_filename", "filename template for segment files", 
OFFSET(segment_filename),   AV_OPT_TYPE_STRING, {.str = NULL},0,
   0, E},
+{"hls_segment_options","set segments files format options of hls", 
OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E},
 {"hls_segment_size", "maximum size per segment file, (in bytes)",  
OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},   0,   
INT_MAX,   E},
 {"hls_key_info_file","file with key URI and key file path", 
OFFSET(key_info_file),  AV_OPT_TYPE_STRING, {.str = NULL},0,
   0, E},
 {"hls_enc","enable AES128 encryption support", OFFSET(encrypt),  
AV_OPT_TYPE_BOOL, {.i64 = 0},0,   1, E},
-- 
2.25.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 2/2] avformat/hlsenc: deprecate hls_ts_options option

2021-11-17 Thread Steven Liu


> 2021年11月18日 下午12:57,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> From: Steven Liu 
>> 
>> Because the hls_ts_options will be misunderstand by user,
>> and then user can use hls_segment_options instead of hls_ts_options.
>> 
>> Signed-off-by: Steven Liu 
>> ---
>> doc/muxers.texi   | 2 ++
>> libavformat/hlsenc.c  | 6 --
>> libavformat/version.h | 4 
>> 3 files changed, 10 insertions(+), 2 deletions(-)
>> 
>> diff --git a/doc/muxers.texi b/doc/muxers.texi
>> index 287ea569fd..a8e763a859 100644
>> --- a/doc/muxers.texi
>> +++ b/doc/muxers.texi
>> @@ -799,6 +799,7 @@ were recently referenced in the playlist. Default value 
>> is 1, meaning segments o
>> Set output format options using a :-separated list of key=value
>> parameters. Values containing @code{:} special characters must be
>> escaped.
>> +@code{hls_ts_options} is deprecated.
>> 
>> @item hls_start_number_source
>> Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according 
>> to the specified source.
>> @@ -923,6 +924,7 @@ produce the playlist, @file{out.m3u8}, and segment files:
>> Set output format options using a :-separated list of key=value
>> parameters. Values containing @code{:} special characters must be
>> escaped.
>> +@code{hls_segment_options} instead of hls_ts_options.
>> 
>> @item hls_key_info_file @var{key_info_file}
>> Use the information in @var{key_info_file} for segment encryption. The first
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index db0a4675fd..3a085d81bc 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -3102,12 +3102,14 @@ static const AVOption options[] = {
>> {"hls_init_time", "set segment length at init list", 
>> OFFSET(init_time), AV_OPT_TYPE_DURATION, {.i64 = 0},   0, INT64_MAX, 
>> E},
>> {"hls_list_size", "set maximum number of playlist entries",  
>> OFFSET(max_nb_segments),AV_OPT_TYPE_INT,{.i64 = 5}, 0, INT_MAX, 
>> E},
>> {"hls_delete_threshold", "set number of unreferenced segments to keep 
>> before deleting",  OFFSET(hls_delete_threshold),AV_OPT_TYPE_INT,
>> {.i64 = 1}, 1, INT_MAX, E},
>> -{"hls_ts_options","set hls mpegts list of options for the container 
>> format used for hls", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = 
>> NULL},  0, 0,E},
>> +#if FF_HLS_TS_OPTIONS
>> +{"hls_ts_options","set hls mpegts list of options for the container 
>> format used for hls(will be deprecated)", OFFSET(format_options), 
>> AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E},
> 
> Missing AV_OPT_FLAG_DEPRECATED. Furthermore, you should modify the
> description to guide the users to the new name. Furthermore, this option
> will not be deprecated; instead it is deprecated with this patch.
Hi Andreas,

Do you mean only this should be ok?

+#if FF_HLS_TS_OPTIONS
+{"hls_ts_options","set hls mpegts list of options for the container format 
used for hls (move to hls_segment_options)", OFFSET(format_options), 
AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E | AV_OPT_FLAG_DEPRECATED},
+#endif

> 
>> +#endif
>> {"hls_vtt_options","set hls vtt list of options for the container format 
>> used for hls", OFFSET(vtt_format_options_str), AV_OPT_TYPE_STRING, {.str = 
>> NULL},  0, 0,E},
>> {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST 
>> NOT (0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = 
>> -1}, INT_MIN, INT_MAX, E},
>> {"hls_base_url",  "url to prepend to each playlist entry",   
>> OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
>> {"hls_segment_filename", "filename template for segment files", 
>> OFFSET(segment_filename),   AV_OPT_TYPE_STRING, {.str = NULL},0, 
>>   0, E},
>> -{"hls_segment_options","set segments files format options of hls", 
>> OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E},
>> +{"hls_segment_options","set segments files format options of hls 
>> (instead of hls_ts_options)", OFFSET(format_options), AV_OPT_TYPE_DICT, 
>> {.str = NULL},  0, 0,E},
> 
> Don't change this. Adding an explanation to hls_ts_options that it is
> deprecated in favour of hls_segment_options is enough. (Furthermore,
> "(instead of hls_ts_options)" would need to be removed when
> FF_HLS_TS_OPTIONS is removed, so you would need to wrap this in #if
> FF_HLS_TS_OPTIONS if you did this...)

Ok, this option will not modify.
> 
>> {"hls_segment_size", "maximum size per segment file, (in bytes)",  
>> OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},   0,
>>INT_MAX,   E},
>> {"hls_key_info_file","file with key URI and key file path", 
>> OFFSET(key_info_file),  AV_OPT_TYPE_STRING, {.str = NULL},0, 
>>   0, E},
>> {"hls_enc","enable AES128 encryption support", OFFSET(encrypt),  
>> AV_OPT_TYPE_BOOL, {.i64 = 0},0,   1, E},
>> diff --git a/libavformat/version.h 

Re: [FFmpeg-devel] [PATCH v2 1/2] avfilter: add a hflip_vulkan filter

2021-11-17 Thread Wu, Jianhua
> Andreas Rheinhardt: 
> Wu, Jianhua:
> > Andreas Rheinhardt wrote:
> >> Wu Jianhua:
> >>> The following command is on how to apply hflip_vulkan filter:
> >>>
> >>> ffmpeg -init_hw_device vulkan -i input.264 -vf
> >>>
> >>
> hwupload=extra_hw_frames=16,hflip_vulkan,hwdownload,format=yuv420p
> >>> output.264
> >>>
> >>> Signed-off-by: Wu Jianhua 
> >>> ---
> >>>  configure |   1 +
> >>>  libavfilter/Makefile  |   1 +
> >>>  libavfilter/allfilters.c  |   1 +
> >>>  libavfilter/vf_hflip_vulkan.c | 276
> >>> ++
> >>>  4 files changed, 279 insertions(+)
> >>>  create mode 100644 libavfilter/vf_hflip_vulkan.c
> >>>
> >>
> >>> +
> >>> +static const AVOption hflip_vulkan_options[] = {
> >>> +{ NULL },
> >>> +};
> >>> +
> >>> +AVFILTER_DEFINE_CLASS(hflip_vulkan);
> >>> +
> >>
> >> What is the point of this class with its empty options?
> >
> > The AVFILTER_DEFINE_CLASS needs the hflip_vulkan_options and the
> > reason why it's NULL is that the most other filters do it like that.
> >
> 
> And why do you add an AVClass at all?
> (The reason that there are some filters with AVClass and empty options is a
> bug in avfilter_init_str() which errors out when given options for a filter
> without AVClass, although it is perfectly fine to set options on a filter 
> without
> AVClass, namely generic AVFilter options (this is important for e.g. framesync
> filters, but not for this filter here).)
> 

Simply I think it is a convention. Yeah. It's not needed at all. I'll remove it 
and update later.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 05/10] avfilter/overlay_vulkan: use FF_ARRAY_ELEMS instead of magic number

2021-11-17 Thread Wu, Jianhua



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Lynne
> Sent: Thursday, November 18, 2021 1:48 PM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 05/10] avfilter/overlay_vulkan: use
> FF_ARRAY_ELEMS instead of magic number
> 
> Nov 18, 2021, 05:24 by jianhua...@intel.com:
> 
> > Signed-off-by: Wu Jianhua 
> > ---
> >  libavfilter/vf_overlay_vulkan.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_overlay_vulkan.c
> > b/libavfilter/vf_overlay_vulkan.c index b902ad83f5..29eb11c89d 100644
> > --- a/libavfilter/vf_overlay_vulkan.c
> > +++ b/libavfilter/vf_overlay_vulkan.c
> > @@ -145,7 +145,7 @@ static av_cold int init_filter(AVFilterContext
> > *ctx)
> >
> >  ff_vk_set_compute_shader_sizes(ctx, shd, CGROUPS);
> >
> > -RET(ff_vk_add_descriptor_set(ctx, s->pl, shd,  desc_i, 3, 0)); /* 
> > set 0
> */
> > +RET(ff_vk_add_descriptor_set(ctx, s->pl, shd,  desc_i,
> > + FF_ARRAY_ELEMS(desc_i), 0)); /* set 0 */
> >  RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, _b, 1, 0)); /* set
> > 1 */
> >
> >  GLSLD(   overlay_noalpha  );
> >
> 
> Thanks for all the patches, but it's getting difficult for me to maintain my
> Vulkan hwaccel branch with all changes. Would you mind waiting a bit for me
> to push the patch I just submitted and then rebasing all the patches you
> submitted?
> 
> 

It's okay. Take your time.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 05/10] avfilter/overlay_vulkan: use FF_ARRAY_ELEMS instead of magic number

2021-11-17 Thread Lynne
Nov 18, 2021, 05:24 by jianhua...@intel.com:

> Signed-off-by: Wu Jianhua 
> ---
>  libavfilter/vf_overlay_vulkan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c
> index b902ad83f5..29eb11c89d 100644
> --- a/libavfilter/vf_overlay_vulkan.c
> +++ b/libavfilter/vf_overlay_vulkan.c
> @@ -145,7 +145,7 @@ static av_cold int init_filter(AVFilterContext *ctx)
>  
>  ff_vk_set_compute_shader_sizes(ctx, shd, CGROUPS);
>  
> -RET(ff_vk_add_descriptor_set(ctx, s->pl, shd,  desc_i, 3, 0)); /* 
> set 0 */
> +RET(ff_vk_add_descriptor_set(ctx, s->pl, shd,  desc_i, 
> FF_ARRAY_ELEMS(desc_i), 0)); /* set 0 */
>  RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, _b, 1, 0)); /* set 1 */
>  
>  GLSLD(   overlay_noalpha  );
>

Thanks for all the patches, but it's getting difficult for me to maintain
my Vulkan hwaccel branch with all changes. Would you mind waiting
a bit for me to push the patch I just submitted and then rebasing all the
patches you submitted?

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/10] avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time

2021-11-17 Thread Wu, Jianhua
Andreas Rheinhardt:
> Sent: Thursday, November 18, 2021 1:24 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH 06/10] avfilter/avgblur_vulkan: call
> av_vkfmt_from_pixfmt only one time
> 
> Wu, Jianhua:
> > Andreas Rheinhardt wrote:
> >>
> >> Wu Jianhua:
> >>> There is a loop in av_vkfmt_from_pixfmt. And, even though some
> >>> compilers will optimize it when the optimization option is on, to
> >>> consider more situations, just call the function only one time here.
> >>>
> >>> Signed-off-by: Wu Jianhua 
> >>> ---
> >>
> >> What compilers optimize this? And how? After all, this function is
> >> not marked as const.
> >
> > When there is some same operations in the codes the compiler will help
> > the developer to reuse the same result when the optimization is on,
> > like -O3 options in GCC. However the -O# was not used, the function
> > would be called again and again. And I check the assembly codes, it
> > did. If someone compiled with the optimizations, this commit didn't
> > changed anything in assembly codes. But it did help when there is no
> optimizations compiling.
> >
> 
> That is very surprising: Without a pure/const attribute the compiler is not
> allowed to optimize multiple calls to the same functions into one; and even
> with said attribute it is only allowed to do so if it can prove that the 
> argument
> (and in case of pure also the whole state of the
> program) didn't change. I don't see how the compiler could know this, so
> regardless of whether you add the attribute it would be a compiler bug if the
> compiler actually optimized the code in that way.
> 

It seemed that it's just the compiler know how we call the functions because we
expose the implementation codes. If we repeatedly call a function from an opaque
binary API, the multiple calling would not be optimized at all.

> > I am more prefer this way to just call the function only one time
> > literally. I am not sure if anybody like this so I put it on the back
> > of the patch set. And I check this function and it did return a const
> > VkFormat * that supposed to mean we should not change the content.
> >
> I also prefer to not emit unnecessary calls; it's just that the commit message
> is surprising/unbelievable.
> 

Yeah. Bad description perhaps. The commit title is enough, I'm supposed to 
remove the description.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 1/2] avfilter: add a hflip_vulkan filter

2021-11-17 Thread Andreas Rheinhardt
Wu, Jianhua:
> Andreas Rheinhardt wrote:
>> Wu Jianhua:
>>> The following command is on how to apply hflip_vulkan filter:
>>>
>>> ffmpeg -init_hw_device vulkan -i input.264 -vf
>>>
>> hwupload=extra_hw_frames=16,hflip_vulkan,hwdownload,format=yuv420p
>>> output.264
>>>
>>> Signed-off-by: Wu Jianhua 
>>> ---
>>>  configure |   1 +
>>>  libavfilter/Makefile  |   1 +
>>>  libavfilter/allfilters.c  |   1 +
>>>  libavfilter/vf_hflip_vulkan.c | 276
>>> ++
>>>  4 files changed, 279 insertions(+)
>>>  create mode 100644 libavfilter/vf_hflip_vulkan.c
>>>
>>
>>> +
>>> +static const AVOption hflip_vulkan_options[] = {
>>> +{ NULL },
>>> +};
>>> +
>>> +AVFILTER_DEFINE_CLASS(hflip_vulkan);
>>> +
>>
>> What is the point of this class with its empty options?
> 
> The AVFILTER_DEFINE_CLASS needs the hflip_vulkan_options and the reason why 
> it's NULL
> is that the most other filters do it like that.
> 

And why do you add an AVClass at all?
(The reason that there are some filters with AVClass and empty options
is a bug in avfilter_init_str() which errors out when given options for
a filter without AVClass, although it is perfectly fine to set options
on a filter without AVClass, namely generic AVFilter options (this is
important for e.g. framesync filters, but not for this filter here).)

>>
>>> +static const AVFilterPad hflip_vulkan_inputs[] = {
>>> +{
>>> +.name = "default",
>>> +.type = AVMEDIA_TYPE_VIDEO,
>>> +.filter_frame = _vulkan_filter_frame,
>>> +.config_props = _vk_filter_config_input,
>>> +}
>>> +};
>>> +
>>> +static const AVFilterPad hflip_vulkan_outputs[] = {
>>> +{
>>> +.name = "default",
>>> +.type = AVMEDIA_TYPE_VIDEO,
>>> +.config_props = _vk_filter_config_output,
>>> +}
>>> +};
>>> +
>>> +const AVFilter ff_vf_hflip_vulkan = {
>>> +.name   = "hflip_vulkan",
>>> +.description= NULL_IF_CONFIG_SMALL("Horizontally flip the input
>> video in Vulkan"),
>>> +.priv_size  = sizeof(HFlipVulkanContext),
>>> +.init   = _vk_filter_init,
>>> +.uninit = _vulkan_uninit,
>>> +FILTER_INPUTS(hflip_vulkan_inputs),
>>> +FILTER_OUTPUTS(hflip_vulkan_outputs),
>>> +FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VULKAN),
>>> +.priv_class = _vulkan_class,
>>> +.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, };
>>>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/10] avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time

2021-11-17 Thread Andreas Rheinhardt
Wu, Jianhua:
> Andreas Rheinhardt wrote:
>>
>> Wu Jianhua:
>>> There is a loop in av_vkfmt_from_pixfmt. And, even though some
>>> compilers will optimize it when the optimization option is on, to
>>> consider more situations, just call the function only one time here.
>>>
>>> Signed-off-by: Wu Jianhua 
>>> ---
>>
>> What compilers optimize this? And how? After all, this function is not marked
>> as const.
> 
> When there is some same operations in the codes the compiler will help the
> developer to reuse the same result when the optimization is on, like -O3 
> options
> in GCC. However the -O# was not used, the function would be called again and
> again. And I check the assembly codes, it did. If someone compiled with the
> optimizations, this commit didn't changed anything in assembly codes. But it
> did help when there is no optimizations compiling.
> 

That is very surprising: Without a pure/const attribute the compiler is
not allowed to optimize multiple calls to the same functions into one;
and even with said attribute it is only allowed to do so if it can prove
that the argument (and in case of pure also the whole state of the
program) didn't change. I don't see how the compiler could know this, so
regardless of whether you add the attribute it would be a compiler bug
if the compiler actually optimized the code in that way.

> I am more prefer this way to just call the function only one time literally. 
> I am
> not sure if anybody like this so I put it on the back of the patch set. And I 
> check
> this function and it did return a const VkFormat * that supposed to
> mean we should not change the content.
> 
I also prefer to not emit unnecessary calls; it's just that the commit
message is surprising/unbelievable.

- 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 v2 1/2] avfilter: add a hflip_vulkan filter

2021-11-17 Thread Wu, Jianhua
Andreas Rheinhardt wrote:
> Wu Jianhua:
> > The following command is on how to apply hflip_vulkan filter:
> >
> > ffmpeg -init_hw_device vulkan -i input.264 -vf
> >
> hwupload=extra_hw_frames=16,hflip_vulkan,hwdownload,format=yuv420p
> > output.264
> >
> > Signed-off-by: Wu Jianhua 
> > ---
> >  configure |   1 +
> >  libavfilter/Makefile  |   1 +
> >  libavfilter/allfilters.c  |   1 +
> >  libavfilter/vf_hflip_vulkan.c | 276
> > ++
> >  4 files changed, 279 insertions(+)
> >  create mode 100644 libavfilter/vf_hflip_vulkan.c
> >
> 
> > +
> > +static const AVOption hflip_vulkan_options[] = {
> > +{ NULL },
> > +};
> > +
> > +AVFILTER_DEFINE_CLASS(hflip_vulkan);
> > +
> 
> What is the point of this class with its empty options?

The AVFILTER_DEFINE_CLASS needs the hflip_vulkan_options and the reason why 
it's NULL
is that the most other filters do it like that.

> 
> > +static const AVFilterPad hflip_vulkan_inputs[] = {
> > +{
> > +.name = "default",
> > +.type = AVMEDIA_TYPE_VIDEO,
> > +.filter_frame = _vulkan_filter_frame,
> > +.config_props = _vk_filter_config_input,
> > +}
> > +};
> > +
> > +static const AVFilterPad hflip_vulkan_outputs[] = {
> > +{
> > +.name = "default",
> > +.type = AVMEDIA_TYPE_VIDEO,
> > +.config_props = _vk_filter_config_output,
> > +}
> > +};
> > +
> > +const AVFilter ff_vf_hflip_vulkan = {
> > +.name   = "hflip_vulkan",
> > +.description= NULL_IF_CONFIG_SMALL("Horizontally flip the input
> video in Vulkan"),
> > +.priv_size  = sizeof(HFlipVulkanContext),
> > +.init   = _vk_filter_init,
> > +.uninit = _vulkan_uninit,
> > +FILTER_INPUTS(hflip_vulkan_inputs),
> > +FILTER_OUTPUTS(hflip_vulkan_outputs),
> > +FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VULKAN),
> > +.priv_class = _vulkan_class,
> > +.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, };
> >
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org
> with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/10] avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time

2021-11-17 Thread Wu, Jianhua
Andreas Rheinhardt wrote:
> 
> Wu Jianhua:
> > There is a loop in av_vkfmt_from_pixfmt. And, even though some
> > compilers will optimize it when the optimization option is on, to
> > consider more situations, just call the function only one time here.
> >
> > Signed-off-by: Wu Jianhua 
> > ---
> 
> What compilers optimize this? And how? After all, this function is not marked
> as const.

When there is some same operations in the codes the compiler will help the
developer to reuse the same result when the optimization is on, like -O3 options
in GCC. However the -O# was not used, the function would be called again and
again. And I check the assembly codes, it did. If someone compiled with the
optimizations, this commit didn't changed anything in assembly codes. But it
did help when there is no optimizations compiling.

I am more prefer this way to just call the function only one time literally. I 
am
not sure if anybody like this so I put it on the back of the patch set. And I 
check
this function and it did return a const VkFormat * that supposed to
mean we should not change the content.

Thanks,
Jianhua

> 
> >  libavfilter/vf_avgblur_vulkan.c | 10 +++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavfilter/vf_avgblur_vulkan.c
> > b/libavfilter/vf_avgblur_vulkan.c index 243e932f35..080a8b1b63 100644
> > --- a/libavfilter/vf_avgblur_vulkan.c
> > +++ b/libavfilter/vf_avgblur_vulkan.c
> > @@ -210,6 +210,10 @@ static int process_frames(AVFilterContext *avctx,
> AVFrame *out_f, AVFrame *tmp_f
> >  AVVkFrame *in = (AVVkFrame *)in_f->data[0];
> >  AVVkFrame *tmp = (AVVkFrame *)tmp_f->data[0];
> >  AVVkFrame *out = (AVVkFrame *)out_f->data[0];
> > +
> > +const VkFormat *input_formats = av_vkfmt_from_pixfmt(s-
> >vkctx.input_format);
> > +const VkFormat *output_formats =
> > + av_vkfmt_from_pixfmt(s->vkctx.output_format);
> > +
> >  int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
> >
> >  /* Update descriptors and init the exec context */ @@ -219,17
> > +223,17 @@ static int process_frames(AVFilterContext *avctx, AVFrame
> *out_f, AVFrame *tmp_f
> >  for (int i = 0; i < planes; i++) {
> >  RET(ff_vk_create_imageview(avctx, s->exec, 
> >input_images[i].imageView,
> > in->img[i],
> > -   
> > av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
> > +   input_formats[i],
> > ff_comp_identity_map));
> >
> >  RET(ff_vk_create_imageview(avctx, s->exec, 
> >tmp_images[i].imageView,
> > tmp->img[i],
> > -   
> > av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
> > +   output_formats[i],
> > ff_comp_identity_map));
> >
> >  RET(ff_vk_create_imageview(avctx, s->exec, 
> >output_images[i].imageView,
> > out->img[i],
> > -   
> > av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
> > +   output_formats[i],
> > ff_comp_identity_map));
> >
> >  s->input_images[i].imageLayout =
> > VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
> >
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org
> with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: deprecate hls_ts_options option

2021-11-17 Thread Andreas Rheinhardt
Steven Liu:
> From: Steven Liu 
> 
> Because the hls_ts_options will be misunderstand by user,
> and then user can use hls_segment_options instead of hls_ts_options.
> 
> Signed-off-by: Steven Liu 
> ---
>  doc/muxers.texi   | 2 ++
>  libavformat/hlsenc.c  | 6 --
>  libavformat/version.h | 4 
>  3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 287ea569fd..a8e763a859 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -799,6 +799,7 @@ were recently referenced in the playlist. Default value 
> is 1, meaning segments o
>  Set output format options using a :-separated list of key=value
>  parameters. Values containing @code{:} special characters must be
>  escaped.
> +@code{hls_ts_options} is deprecated.
>  
>  @item hls_start_number_source
>  Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according 
> to the specified source.
> @@ -923,6 +924,7 @@ produce the playlist, @file{out.m3u8}, and segment files:
>  Set output format options using a :-separated list of key=value
>  parameters. Values containing @code{:} special characters must be
>  escaped.
> +@code{hls_segment_options} instead of hls_ts_options.
>  
>  @item hls_key_info_file @var{key_info_file}
>  Use the information in @var{key_info_file} for segment encryption. The first
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index db0a4675fd..3a085d81bc 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -3102,12 +3102,14 @@ static const AVOption options[] = {
>  {"hls_init_time", "set segment length at init list", 
> OFFSET(init_time), AV_OPT_TYPE_DURATION, {.i64 = 0},   0, INT64_MAX, 
> E},
>  {"hls_list_size", "set maximum number of playlist entries",  
> OFFSET(max_nb_segments),AV_OPT_TYPE_INT,{.i64 = 5}, 0, INT_MAX, 
> E},
>  {"hls_delete_threshold", "set number of unreferenced segments to keep 
> before deleting",  OFFSET(hls_delete_threshold),AV_OPT_TYPE_INT,{.i64 
> = 1}, 1, INT_MAX, E},
> -{"hls_ts_options","set hls mpegts list of options for the container 
> format used for hls", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = 
> NULL},  0, 0,E},
> +#if FF_HLS_TS_OPTIONS
> +{"hls_ts_options","set hls mpegts list of options for the container 
> format used for hls(will be deprecated)", OFFSET(format_options), 
> AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E},

Missing AV_OPT_FLAG_DEPRECATED. Furthermore, you should modify the
description to guide the users to the new name. Furthermore, this option
will not be deprecated; instead it is deprecated with this patch.

> +#endif
>  {"hls_vtt_options","set hls vtt list of options for the container format 
> used for hls", OFFSET(vtt_format_options_str), AV_OPT_TYPE_STRING, {.str = 
> NULL},  0, 0,E},
>  {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST 
> NOT (0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = 
> -1}, INT_MIN, INT_MAX, E},
>  {"hls_base_url",  "url to prepend to each playlist entry",   
> OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
>  {"hls_segment_filename", "filename template for segment files", 
> OFFSET(segment_filename),   AV_OPT_TYPE_STRING, {.str = NULL},0,  
>  0, E},
> -{"hls_segment_options","set segments files format options of hls", 
> OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E},
> +{"hls_segment_options","set segments files format options of hls 
> (instead of hls_ts_options)", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str 
> = NULL},  0, 0,E},

Don't change this. Adding an explanation to hls_ts_options that it is
deprecated in favour of hls_segment_options is enough. (Furthermore,
"(instead of hls_ts_options)" would need to be removed when
FF_HLS_TS_OPTIONS is removed, so you would need to wrap this in #if
FF_HLS_TS_OPTIONS if you did this...)

>  {"hls_segment_size", "maximum size per segment file, (in bytes)",  
> OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},   0, 
>   INT_MAX,   E},
>  {"hls_key_info_file","file with key URI and key file path", 
> OFFSET(key_info_file),  AV_OPT_TYPE_STRING, {.str = NULL},0,  
>  0, E},
>  {"hls_enc","enable AES128 encryption support", OFFSET(encrypt),  
> AV_OPT_TYPE_BOOL, {.i64 = 0},0,   1, E},
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 81ed517609..5da9291009 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -64,6 +64,10 @@
>  #ifndef FF_API_AVIOCONTEXT_WRITTEN
>  #define FF_API_AVIOCONTEXT_WRITTEN  (LIBAVFORMAT_VERSION_MAJOR < 60)
>  #endif
> +#ifndef FF_HLS_TS_OPTIONS
> +#define FF_HLS_TS_OPTIONS   (LIBAVFORMAT_VERSION_MAJOR < 60)
> +#endif

This seems to be based upon an old version of this file.

> +
>  
>  
>  #ifndef 

Re: [FFmpeg-devel] [PATCH v2 1/2] avfilter: add a hflip_vulkan filter

2021-11-17 Thread Andreas Rheinhardt
Wu Jianhua:
> The following command is on how to apply hflip_vulkan filter:
> 
> ffmpeg -init_hw_device vulkan -i input.264 -vf 
> hwupload=extra_hw_frames=16,hflip_vulkan,hwdownload,format=yuv420p output.264
> 
> Signed-off-by: Wu Jianhua 
> ---
>  configure |   1 +
>  libavfilter/Makefile  |   1 +
>  libavfilter/allfilters.c  |   1 +
>  libavfilter/vf_hflip_vulkan.c | 276 ++
>  4 files changed, 279 insertions(+)
>  create mode 100644 libavfilter/vf_hflip_vulkan.c
> 

> +
> +static const AVOption hflip_vulkan_options[] = {
> +{ NULL },
> +};
> +
> +AVFILTER_DEFINE_CLASS(hflip_vulkan);
> +

What is the point of this class with its empty options?

> +static const AVFilterPad hflip_vulkan_inputs[] = {
> +{
> +.name = "default",
> +.type = AVMEDIA_TYPE_VIDEO,
> +.filter_frame = _vulkan_filter_frame,
> +.config_props = _vk_filter_config_input,
> +}
> +};
> +
> +static const AVFilterPad hflip_vulkan_outputs[] = {
> +{
> +.name = "default",
> +.type = AVMEDIA_TYPE_VIDEO,
> +.config_props = _vk_filter_config_output,
> +}
> +};
> +
> +const AVFilter ff_vf_hflip_vulkan = {
> +.name   = "hflip_vulkan",
> +.description= NULL_IF_CONFIG_SMALL("Horizontally flip the input 
> video in Vulkan"),
> +.priv_size  = sizeof(HFlipVulkanContext),
> +.init   = _vk_filter_init,
> +.uninit = _vulkan_uninit,
> +FILTER_INPUTS(hflip_vulkan_inputs),
> +FILTER_OUTPUTS(hflip_vulkan_outputs),
> +FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VULKAN),
> +.priv_class = _vulkan_class,
> +.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
> +};
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/10] avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time

2021-11-17 Thread Andreas Rheinhardt
Wu Jianhua:
> There is a loop in av_vkfmt_from_pixfmt. And, even though some
> compilers will optimize it when the optimization option is on, to
> consider more situations, just call the function only one time here.
> 
> Signed-off-by: Wu Jianhua 
> ---

What compilers optimize this? And how? After all, this function is not
marked as const.

>  libavfilter/vf_avgblur_vulkan.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
> index 243e932f35..080a8b1b63 100644
> --- a/libavfilter/vf_avgblur_vulkan.c
> +++ b/libavfilter/vf_avgblur_vulkan.c
> @@ -210,6 +210,10 @@ static int process_frames(AVFilterContext *avctx, 
> AVFrame *out_f, AVFrame *tmp_f
>  AVVkFrame *in = (AVVkFrame *)in_f->data[0];
>  AVVkFrame *tmp = (AVVkFrame *)tmp_f->data[0];
>  AVVkFrame *out = (AVVkFrame *)out_f->data[0];
> +
> +const VkFormat *input_formats = 
> av_vkfmt_from_pixfmt(s->vkctx.input_format);
> +const VkFormat *output_formats = 
> av_vkfmt_from_pixfmt(s->vkctx.output_format);
> +
>  int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
>  
>  /* Update descriptors and init the exec context */
> @@ -219,17 +223,17 @@ static int process_frames(AVFilterContext *avctx, 
> AVFrame *out_f, AVFrame *tmp_f
>  for (int i = 0; i < planes; i++) {
>  RET(ff_vk_create_imageview(avctx, s->exec, 
> >input_images[i].imageView,
> in->img[i],
> -   
> av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
> +   input_formats[i],
> ff_comp_identity_map));
>  
>  RET(ff_vk_create_imageview(avctx, s->exec, 
> >tmp_images[i].imageView,
> tmp->img[i],
> -   
> av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
> +   output_formats[i],
> ff_comp_identity_map));
>  
>  RET(ff_vk_create_imageview(avctx, s->exec, 
> >output_images[i].imageView,
> out->img[i],
> -   
> av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
> +   output_formats[i],
> ff_comp_identity_map));
>  
>  s->input_images[i].imageLayout = 
> VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
> 

___
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/vf_gblur_vulkan: Fix use of uninitialized value

2021-11-17 Thread Andreas Rheinhardt
lance.lmw...@gmail.com:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_gblur_vulkan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c
> index d4f391b..16c8bbb 100644
> --- a/libavfilter/vf_gblur_vulkan.c
> +++ b/libavfilter/vf_gblur_vulkan.c
> @@ -124,7 +124,7 @@ static av_cold void 
> init_gaussian_params(GBlurVulkanContext *s)
>  
>  static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
>  {
> -int err;
> +int err = 0;
>  char *kernel_def;
>  uint8_t *kernel_mapped;
>  FFSPIRVShader *shd;
> 

I don't see an uninitialized value at all: It is directly initialized in
some error paths and if not, it is initialized in the RET() macro. And
in any case it would be better to zero ret directly above the "fail:"
because then this function always returns zero on success even if the
last function called could return values > 0.

- 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".


[FFmpeg-devel] [PATCH 10/10] avfilter/overlay_vulkan: call av_vkfmt_from_pixfmt only one time

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_overlay_vulkan.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c
index 29eb11c89d..03197ae712 100644
--- a/libavfilter/vf_overlay_vulkan.c
+++ b/libavfilter/vf_overlay_vulkan.c
@@ -240,9 +240,13 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f,
 AVVkFrame *main= (AVVkFrame *)main_f->data[0];
 AVVkFrame *overlay = (AVVkFrame *)overlay_f->data[0];
 
-AVHWFramesContext *main_fc = 
(AVHWFramesContext*)main_f->hw_frames_ctx->data;
+AVHWFramesContext *main_fc= 
(AVHWFramesContext*)main_f->hw_frames_ctx->data;
 AVHWFramesContext *overlay_fc = 
(AVHWFramesContext*)overlay_f->hw_frames_ctx->data;
 
+const VkFormat *output_formats = 
av_vkfmt_from_pixfmt(s->vkctx.output_format);
+const VkFormat *main_sw_formats= 
av_vkfmt_from_pixfmt(main_fc->sw_format);
+const VkFormat *overlay_sw_formats = 
av_vkfmt_from_pixfmt(overlay_fc->sw_format);
+
 /* Update descriptors and init the exec context */
 ff_vk_start_exec_recording(avctx, s->exec);
 cmd_buf = ff_vk_get_exec_buf(avctx, s->exec);
@@ -250,17 +254,17 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f,
 for (int i = 0; i < planes; i++) {
 RET(ff_vk_create_imageview(avctx, s->exec, 
>main_images[i].imageView,
main->img[i],
-   av_vkfmt_from_pixfmt(main_fc->sw_format)[i],
+   main_sw_formats[i],
ff_comp_identity_map));
 
 RET(ff_vk_create_imageview(avctx, s->exec, 
>overlay_images[i].imageView,
overlay->img[i],
-   
av_vkfmt_from_pixfmt(overlay_fc->sw_format)[i],
+   overlay_sw_formats[i],
ff_comp_identity_map));
 
 RET(ff_vk_create_imageview(avctx, s->exec, 
>output_images[i].imageView,
out->img[i],
-   
av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
+   output_formats[i],
ff_comp_identity_map));
 
 s->main_images[i].imageLayout= 
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
-- 
2.17.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 06/10] avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time

2021-11-17 Thread Wu Jianhua
There is a loop in av_vkfmt_from_pixfmt. And, even though some
compilers will optimize it when the optimization option is on, to
consider more situations, just call the function only one time here.

Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_avgblur_vulkan.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
index 243e932f35..080a8b1b63 100644
--- a/libavfilter/vf_avgblur_vulkan.c
+++ b/libavfilter/vf_avgblur_vulkan.c
@@ -210,6 +210,10 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f, AVFrame *tmp_f
 AVVkFrame *in = (AVVkFrame *)in_f->data[0];
 AVVkFrame *tmp = (AVVkFrame *)tmp_f->data[0];
 AVVkFrame *out = (AVVkFrame *)out_f->data[0];
+
+const VkFormat *input_formats = 
av_vkfmt_from_pixfmt(s->vkctx.input_format);
+const VkFormat *output_formats = 
av_vkfmt_from_pixfmt(s->vkctx.output_format);
+
 int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
 
 /* Update descriptors and init the exec context */
@@ -219,17 +223,17 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f, AVFrame *tmp_f
 for (int i = 0; i < planes; i++) {
 RET(ff_vk_create_imageview(avctx, s->exec, 
>input_images[i].imageView,
in->img[i],
-   
av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
+   input_formats[i],
ff_comp_identity_map));
 
 RET(ff_vk_create_imageview(avctx, s->exec, >tmp_images[i].imageView,
tmp->img[i],
-   
av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
+   output_formats[i],
ff_comp_identity_map));
 
 RET(ff_vk_create_imageview(avctx, s->exec, 
>output_images[i].imageView,
out->img[i],
-   
av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
+   output_formats[i],
ff_comp_identity_map));
 
 s->input_images[i].imageLayout = 
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
-- 
2.17.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 09/10] avfilter/scale_vulkan: call av_vkfmt_from_pixfmt only one time

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_scale_vulkan.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index 413c2cb294..77c970473e 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -302,6 +302,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f, AVFrame *in_f)
 VkImageMemoryBarrier barriers[AV_NUM_DATA_POINTERS*2];
 int barrier_count = 0;
 const int planes = av_pix_fmt_count_planes(s->vkctx.input_format);
+const VkFormat *input_formats = 
av_vkfmt_from_pixfmt(s->vkctx.input_format);
+const VkFormat *output_formats = 
av_vkfmt_from_pixfmt(s->vkctx.output_format);
 
 /* Update descriptors and init the exec context */
 ff_vk_start_exec_recording(avctx, s->exec);
@@ -310,12 +312,12 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f, AVFrame *in_f)
 for (int i = 0; i < planes; i++) {
 RET(ff_vk_create_imageview(avctx, s->exec, 
>input_images[i].imageView,
in->img[i],
-   
av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
+   input_formats[i],
ff_comp_identity_map));
 
 RET(ff_vk_create_imageview(avctx, s->exec, 
>output_images[i].imageView,
out->img[i],
-   
av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
+   output_formats[i],
ff_comp_identity_map));
 
 s->input_images[i].imageLayout  = 
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
-- 
2.17.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 08/10] avfilter/scale_vulkan: call av_pix_fmt_count_planes only one time

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_scale_vulkan.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index 7d7120df79..413c2cb294 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -301,32 +301,30 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f, AVFrame *in_f)
 AVVkFrame *out = (AVVkFrame *)out_f->data[0];
 VkImageMemoryBarrier barriers[AV_NUM_DATA_POINTERS*2];
 int barrier_count = 0;
+const int planes = av_pix_fmt_count_planes(s->vkctx.input_format);
 
 /* Update descriptors and init the exec context */
 ff_vk_start_exec_recording(avctx, s->exec);
 cmd_buf = ff_vk_get_exec_buf(avctx, s->exec);
 
-for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.input_format); i++) {
+for (int i = 0; i < planes; i++) {
 RET(ff_vk_create_imageview(avctx, s->exec, 
>input_images[i].imageView,
in->img[i],

av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
ff_comp_identity_map));
 
-s->input_images[i].imageLayout  = 
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
-}
-
-for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.output_format); i++) {
 RET(ff_vk_create_imageview(avctx, s->exec, 
>output_images[i].imageView,
out->img[i],

av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
ff_comp_identity_map));
 
+s->input_images[i].imageLayout  = 
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
 s->output_images[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
 }
 
 ff_vk_update_descriptor_set(avctx, s->pl, 0);
 
-for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.input_format); i++) {
+for (int i = 0; i < planes; i++) {
 VkImageMemoryBarrier bar = {
 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
 .srcAccessMask = 0,
-- 
2.17.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 05/10] avfilter/overlay_vulkan: use FF_ARRAY_ELEMS instead of magic number

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_overlay_vulkan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c
index b902ad83f5..29eb11c89d 100644
--- a/libavfilter/vf_overlay_vulkan.c
+++ b/libavfilter/vf_overlay_vulkan.c
@@ -145,7 +145,7 @@ static av_cold int init_filter(AVFilterContext *ctx)
 
 ff_vk_set_compute_shader_sizes(ctx, shd, CGROUPS);
 
-RET(ff_vk_add_descriptor_set(ctx, s->pl, shd,  desc_i, 3, 0)); /* set 
0 */
+RET(ff_vk_add_descriptor_set(ctx, s->pl, shd,  desc_i, 
FF_ARRAY_ELEMS(desc_i), 0)); /* set 0 */
 RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, _b, 1, 0)); /* set 
1 */
 
 GLSLD(   overlay_noalpha  
);
-- 
2.17.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 07/10] avfilter/chromaber_vulkan: call av_vkfmt_from_pixfmt only one time

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_chromaber_vulkan.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_chromaber_vulkan.c 
b/libavfilter/vf_chromaber_vulkan.c
index b817dd12f7..c4f84d792e 100644
--- a/libavfilter/vf_chromaber_vulkan.c
+++ b/libavfilter/vf_chromaber_vulkan.c
@@ -178,6 +178,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f, AVFrame *in_f)
 AVVkFrame *in = (AVVkFrame *)in_f->data[0];
 AVVkFrame *out = (AVVkFrame *)out_f->data[0];
 int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
+const VkFormat *input_formats = 
av_vkfmt_from_pixfmt(s->vkctx.input_format);
+const VkFormat *ouput_formats = 
av_vkfmt_from_pixfmt(s->vkctx.output_format);
 
 /* Update descriptors and init the exec context */
 ff_vk_start_exec_recording(avctx, s->exec);
@@ -186,12 +188,12 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out_f, AVFrame *in_f)
 for (int i = 0; i < planes; i++) {
 RET(ff_vk_create_imageview(avctx, s->exec, 
>input_images[i].imageView,
in->img[i],
-   
av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
+   input_formats[i],
ff_comp_identity_map));
 
 RET(ff_vk_create_imageview(avctx, s->exec, 
>output_images[i].imageView,
out->img[i],
-   
av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
+   ouput_formats[i],
ff_comp_identity_map));
 
 s->input_images[i].imageLayout  = 
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
-- 
2.17.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 04/10] avfilter/scale_vulkan: use FF_ARRAY_ELEMS instead of magic number

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_scale_vulkan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index 3a2251f8df..7d7120df79 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -178,7 +178,7 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
 
 ff_vk_set_compute_shader_sizes(ctx, shd, CGROUPS);
 
-RET(ff_vk_add_descriptor_set(ctx, s->pl, shd,  desc_i, 2, 0)); /* set 
0 */
+RET(ff_vk_add_descriptor_set(ctx, s->pl, shd,  desc_i, 
FF_ARRAY_ELEMS(desc_i), 0)); /* set 0 */
 RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, _b, 1, 0)); /* set 
1 */
 
 GLSLD(   scale_bilinear
  );
-- 
2.17.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 03/10] avfilter/chromaber_vulkan: use FF_ARRAY_ELEMS instead of magic number

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_chromaber_vulkan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_chromaber_vulkan.c 
b/libavfilter/vf_chromaber_vulkan.c
index 83ab72f716..b817dd12f7 100644
--- a/libavfilter/vf_chromaber_vulkan.c
+++ b/libavfilter/vf_chromaber_vulkan.c
@@ -125,7 +125,7 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
 ff_vk_add_push_constant(ctx, s->pl, 0, sizeof(s->opts),
 VK_SHADER_STAGE_COMPUTE_BIT);
 
-RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, desc_i, 2, 0)); /* set 0 
*/
+RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, desc_i, 
FF_ARRAY_ELEMS(desc_i), 0)); /* set 0 */
 
 GLSLD(   distort_chroma_kernel
);
 GLSLC(0, void main()  
);
-- 
2.17.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 02/10] avfilter/avgblur_vulkan: use FF_ARRAY_ELEMS instead of magic number

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_avgblur_vulkan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
index 253290663b..243e932f35 100644
--- a/libavfilter/vf_avgblur_vulkan.c
+++ b/libavfilter/vf_avgblur_vulkan.c
@@ -115,7 +115,7 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
 
 ff_vk_set_compute_shader_sizes(ctx, shd, (int [3]){ CGS, 1, 1 });
 
-RET(ff_vk_add_descriptor_set(ctx, s->pl_hor, shd, desc_i, 2, 0));
+RET(ff_vk_add_descriptor_set(ctx, s->pl_hor, shd, desc_i, 
FF_ARRAY_ELEMS(desc_i), 0));
 
 GLSLF(0, #define FILTER_RADIUS (%i) ,s->size_x - 
1);
 GLSLC(0, #define INC(x) (ivec2(x, 0)) 
);
@@ -160,7 +160,7 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
 
 ff_vk_set_compute_shader_sizes(ctx, shd, (int [3]){ 1, CGS, 1 });
 
-RET(ff_vk_add_descriptor_set(ctx, s->pl_ver, shd, desc_i, 2, 0));
+RET(ff_vk_add_descriptor_set(ctx, s->pl_ver, shd, desc_i, 
FF_ARRAY_ELEMS(desc_i), 0));
 
 GLSLF(0, #define FILTER_RADIUS (%i) ,s->size_y - 
1);
 GLSLC(0, #define INC(x) (ivec2(0, x)) 
);
-- 
2.17.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 01/10] avfilter/avgblur_vulkan: check if shader is created with success

2021-11-17 Thread Wu Jianhua
Signed-off-by: Wu Jianhua 
---
 libavfilter/vf_avgblur_vulkan.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
index 4795e482a9..253290663b 100644
--- a/libavfilter/vf_avgblur_vulkan.c
+++ b/libavfilter/vf_avgblur_vulkan.c
@@ -110,6 +110,8 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
 
 shd = ff_vk_init_shader(ctx, s->pl_hor, "avgblur_compute_hor",
 VK_SHADER_STAGE_COMPUTE_BIT);
+if (!shd)
+return AVERROR(ENOMEM);
 
 ff_vk_set_compute_shader_sizes(ctx, shd, (int [3]){ CGS, 1, 1 });
 
@@ -153,6 +155,8 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
 
 shd = ff_vk_init_shader(ctx, s->pl_ver, "avgblur_compute_ver",
 VK_SHADER_STAGE_COMPUTE_BIT);
+if (!shd)
+return AVERROR(ENOMEM);
 
 ff_vk_set_compute_shader_sizes(ctx, shd, (int [3]){ 1, CGS, 1 });
 
-- 
2.17.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 v2 2/2] avfilter: add a vflip_vulkan filter

2021-11-17 Thread Wu Jianhua
The following command is on how to apply vflip_vulkan filter:

ffmpeg -init_hw_device vulkan -i input.264 -vf 
hwupload=extra_hw_frames=16,vflip_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua 
---
 configure |   1 +
 libavfilter/Makefile  |   3 +-
 libavfilter/allfilters.c  |   1 +
 .../{vf_hflip_vulkan.c => vf_flip_vulkan.c}   | 106 +-
 4 files changed, 84 insertions(+), 27 deletions(-)
 rename libavfilter/{vf_hflip_vulkan.c => vf_flip_vulkan.c} (77%)

diff --git a/configure b/configure
index f1551063d0..7c7b3d73ac 100755
--- a/configure
+++ b/configure
@@ -3695,6 +3695,7 @@ transpose_vaapi_filter_deps="vaapi 
VAProcPipelineCaps_rotation_flags"
 unsharp_opencl_filter_deps="opencl"
 uspp_filter_deps="gpl avcodec"
 vaguedenoiser_filter_deps="gpl"
+vflip_vulkan_filter_deps="vulkan libglslang"
 vidstabdetect_filter_deps="libvidstab"
 vidstabtransform_filter_deps="libvidstab"
 libvmaf_filter_deps="libvmaf pthreads"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 31d922f75c..e2bfd08f7d 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -298,7 +298,7 @@ OBJS-$(CONFIG_GREYEDGE_FILTER)   += 
vf_colorconstancy.o
 OBJS-$(CONFIG_GUIDED_FILTER) += vf_guided.o
 OBJS-$(CONFIG_HALDCLUT_FILTER)   += vf_lut3d.o framesync.o
 OBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
-OBJS-$(CONFIG_HFLIP_VULKAN_FILTER)   += vf_hflip_vulkan.o vulkan.o
+OBJS-$(CONFIG_HFLIP_VULKAN_FILTER)   += vf_flip_vulkan.o vulkan.o
 OBJS-$(CONFIG_HISTEQ_FILTER) += vf_histeq.o
 OBJS-$(CONFIG_HISTOGRAM_FILTER)  += vf_histogram.o
 OBJS-$(CONFIG_HQDN3D_FILTER) += vf_hqdn3d.o
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_VAGUEDENOISER_FILTER)  += 
vf_vaguedenoiser.o
 OBJS-$(CONFIG_VARBLUR_FILTER)+= vf_varblur.o framesync.o
 OBJS-$(CONFIG_VECTORSCOPE_FILTER)+= vf_vectorscope.o
 OBJS-$(CONFIG_VFLIP_FILTER)  += vf_vflip.o
+OBJS-$(CONFIG_VFLIP_VULKAN_FILTER)   += vf_flip_vulkan.o vulkan.o
 OBJS-$(CONFIG_VFRDET_FILTER) += vf_vfrdet.o
 OBJS-$(CONFIG_VIBRANCE_FILTER)   += vf_vibrance.o
 OBJS-$(CONFIG_VIDSTABDETECT_FILTER)  += vidstabutils.o 
vf_vidstabdetect.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 82c50cba49..4bf17ef292 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -470,6 +470,7 @@ extern const AVFilter ff_vf_vaguedenoiser;
 extern const AVFilter ff_vf_varblur;
 extern const AVFilter ff_vf_vectorscope;
 extern const AVFilter ff_vf_vflip;
+extern const AVFilter ff_vf_vflip_vulkan;
 extern const AVFilter ff_vf_vfrdet;
 extern const AVFilter ff_vf_vibrance;
 extern const AVFilter ff_vf_vidstabdetect;
diff --git a/libavfilter/vf_hflip_vulkan.c b/libavfilter/vf_flip_vulkan.c
similarity index 77%
rename from libavfilter/vf_hflip_vulkan.c
rename to libavfilter/vf_flip_vulkan.c
index 9d164199fe..42cb4ef877 100644
--- a/libavfilter/vf_hflip_vulkan.c
+++ b/libavfilter/vf_flip_vulkan.c
@@ -24,7 +24,12 @@
 
 #define CGS 32
 
-typedef struct HFlipVulkanContext {
+enum FlipType {
+FLIP_VERTICAL,
+FLIP_HORIZONTAL
+};
+
+typedef struct FlipVulkanContext {
 FFVulkanContext vkctx;
 FFVkQueueFamilyCtx qf;
 FFVkExecContext *exec;
@@ -34,13 +39,13 @@ typedef struct HFlipVulkanContext {
 VkDescriptorImageInfo output_images[3];
 
 int initialized;
-} HFlipVulkanContext;
+} FlipVulkanContext;
 
-static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
+static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum 
FlipType type)
 {
 int err = 0;
 FFSPIRVShader *shd;
-HFlipVulkanContext *s = ctx->priv;
+FlipVulkanContext *s = ctx->priv;
 const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
 
 FFVulkanDescriptorSetBinding image_descs[] = {
@@ -75,26 +80,37 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
 if (!s->pl)
 return AVERROR(ENOMEM);
 
-shd = ff_vk_init_shader(ctx, s->pl, "hflip_compute", 
image_descs[0].stages);
+shd = ff_vk_init_shader(ctx, s->pl, "flip_compute", 
image_descs[0].stages);
 if (!shd)
 return AVERROR(ENOMEM);
 
 ff_vk_set_compute_shader_sizes(ctx, shd, (int [3]){ CGS, 1, 1 });
 RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, image_descs, 
FF_ARRAY_ELEMS(image_descs), 0));
 
-GLSLC(0, void main()   
);
-GLSLC(0, { 
);
-GLSLC(1, ivec2 size;   
);
-GLSLC(1, const ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
);
+GLSLC(0, void main()   

[FFmpeg-devel] [PATCH v2 1/2] avfilter: add a hflip_vulkan filter

2021-11-17 Thread Wu Jianhua
The following command is on how to apply hflip_vulkan filter:

ffmpeg -init_hw_device vulkan -i input.264 -vf 
hwupload=extra_hw_frames=16,hflip_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua 
---
 configure |   1 +
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_hflip_vulkan.c | 276 ++
 4 files changed, 279 insertions(+)
 create mode 100644 libavfilter/vf_hflip_vulkan.c

diff --git a/configure b/configure
index 1b47f6512d..f1551063d0 100755
--- a/configure
+++ b/configure
@@ -3614,6 +3614,7 @@ frei0r_filter_deps="frei0r"
 frei0r_src_filter_deps="frei0r"
 fspp_filter_deps="gpl"
 gblur_vulkan_filter_deps="vulkan libglslang"
+hflip_vulkan_filter_deps="vulkan libglslang"
 histeq_filter_deps="gpl"
 hqdn3d_filter_deps="gpl"
 interlace_filter_deps="gpl"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 07b4a639ec..31d922f75c 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -298,6 +298,7 @@ OBJS-$(CONFIG_GREYEDGE_FILTER)   += 
vf_colorconstancy.o
 OBJS-$(CONFIG_GUIDED_FILTER) += vf_guided.o
 OBJS-$(CONFIG_HALDCLUT_FILTER)   += vf_lut3d.o framesync.o
 OBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
+OBJS-$(CONFIG_HFLIP_VULKAN_FILTER)   += vf_hflip_vulkan.o vulkan.o
 OBJS-$(CONFIG_HISTEQ_FILTER) += vf_histeq.o
 OBJS-$(CONFIG_HISTOGRAM_FILTER)  += vf_histogram.o
 OBJS-$(CONFIG_HQDN3D_FILTER) += vf_hqdn3d.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 29da7ef0d2..82c50cba49 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -283,6 +283,7 @@ extern const AVFilter ff_vf_greyedge;
 extern const AVFilter ff_vf_guided;
 extern const AVFilter ff_vf_haldclut;
 extern const AVFilter ff_vf_hflip;
+extern const AVFilter ff_vf_hflip_vulkan;
 extern const AVFilter ff_vf_histeq;
 extern const AVFilter ff_vf_histogram;
 extern const AVFilter ff_vf_hqdn3d;
diff --git a/libavfilter/vf_hflip_vulkan.c b/libavfilter/vf_hflip_vulkan.c
new file mode 100644
index 00..9d164199fe
--- /dev/null
+++ b/libavfilter/vf_hflip_vulkan.c
@@ -0,0 +1,276 @@
+/*
+ * copyright (c) 2021 Wu Jianhua 
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/random_seed.h"
+#include "libavutil/opt.h"
+#include "vulkan.h"
+#include "internal.h"
+
+#define CGS 32
+
+typedef struct HFlipVulkanContext {
+FFVulkanContext vkctx;
+FFVkQueueFamilyCtx qf;
+FFVkExecContext *exec;
+FFVulkanPipeline *pl;
+
+VkDescriptorImageInfo input_images[3];
+VkDescriptorImageInfo output_images[3];
+
+int initialized;
+} HFlipVulkanContext;
+
+static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
+{
+int err = 0;
+FFSPIRVShader *shd;
+HFlipVulkanContext *s = ctx->priv;
+const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
+
+FFVulkanDescriptorSetBinding image_descs[] = {
+{
+.name   = "input_image",
+.type   = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
+.dimensions = 2,
+.elems  = planes,
+.stages = VK_SHADER_STAGE_COMPUTE_BIT,
+.updater= s->input_images,
+},
+{
+.name   = "output_image",
+.type   = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
+.mem_layout = ff_vk_shader_rep_fmt(s->vkctx.output_format),
+.mem_quali  = "writeonly",
+.dimensions = 2,
+.elems  = planes,
+.stages = VK_SHADER_STAGE_COMPUTE_BIT,
+.updater= s->output_images,
+},
+};
+
+image_descs[0].sampler = ff_vk_init_sampler(ctx, 1, VK_FILTER_LINEAR);
+if (!image_descs[0].sampler)
+return AVERROR_EXTERNAL;
+
+ff_vk_qf_init(ctx, >qf, VK_QUEUE_COMPUTE_BIT, 0);
+
+{
+s->pl = ff_vk_create_pipeline(ctx, >qf);
+if (!s->pl)
+return AVERROR(ENOMEM);
+
+shd = ff_vk_init_shader(ctx, s->pl, "hflip_compute", 
image_descs[0].stages);
+if (!shd)
+return AVERROR(ENOMEM);
+
+ff_vk_set_compute_shader_sizes(ctx, 

[FFmpeg-devel] [PATCH 4/4] avcodec: vaapi_decode, do not set initial_pool_size if driver supports frame pool resizing

2021-11-17 Thread Xu Guangxin
Two benifites of this commit:
1. Save memory. If we play an 8k hevc, previous code we allocate 50M * 20(1 + 
16 + 3) = 1G memory. 4 may enough for most of playback usecases. 16 is a waste.
2. Allow downstream cache more frames. A downstream lookahead encoder will 
cache some frames. 20 may not enough for it.

This commit will fix the following command
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i 100frames.264  -vf 
reverse -an -f null -
---
 libavcodec/vaapi_decode.c | 34 ++
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 665af370ed..177949c36d 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -572,22 +572,24 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 if (err < 0)
 goto fail;
 
-frames->initial_pool_size = 1;
-// Add per-codec number of surfaces used for storing reference frames.
-switch (avctx->codec_id) {
-case AV_CODEC_ID_H264:
-case AV_CODEC_ID_HEVC:
-case AV_CODEC_ID_AV1:
-frames->initial_pool_size += 16;
-break;
-case AV_CODEC_ID_VP9:
-frames->initial_pool_size += 8;
-break;
-case AV_CODEC_ID_VP8:
-frames->initial_pool_size += 3;
-break;
-default:
-frames->initial_pool_size += 2;
+if (hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_FRAME_POOL_RESIZING) {
+frames->initial_pool_size = 1;
+// Add per-codec number of surfaces used for storing reference 
frames.
+switch (avctx->codec_id) {
+case AV_CODEC_ID_H264:
+case AV_CODEC_ID_HEVC:
+case AV_CODEC_ID_AV1:
+frames->initial_pool_size += 16;
+break;
+case AV_CODEC_ID_VP9:
+frames->initial_pool_size += 8;
+break;
+case AV_CODEC_ID_VP8:
+frames->initial_pool_size += 3;
+break;
+default:
+frames->initial_pool_size += 2;
+}
 }
 }
 
-- 
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/4] avutil: hwcontext_vaapi, mark i965, VDPAU and ubit driver as AV_VAAPI_DRIVER_QUIRK_FRAME_POOL_RESIZING

2021-11-17 Thread Xu Guangxin
Legacy drivers can't support decode output frame pool resize.
---
 libavutil/hwcontext_vaapi.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 14a2df38c6..c13c395da2 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -331,23 +331,26 @@ static const struct {
 const char *match_string;
 unsigned int quirks;
 } vaapi_driver_quirks_table[] = {
-#if !VA_CHECK_VERSION(1, 0, 0)
-// The i965 driver did not conform before version 2.0.
+// The i965 driver did not conform RENDER_PARAM_BUFFERS before version 2.0.
 {
 "Intel i965 (Quick Sync)",
 "i965",
-AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS,
-},
+#if !VA_CHECK_VERSION(1, 0, 0)
+AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS | 
AV_VAAPI_DRIVER_QUIRK_FRAME_POOL_RESIZING,
+#else
+AV_VAAPI_DRIVER_QUIRK_FRAME_POOL_RESIZING,
 #endif
+},
+
 {
 "Intel iHD",
 "ubit",
-AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE,
+AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE | 
AV_VAAPI_DRIVER_QUIRK_FRAME_POOL_RESIZING,
 },
 {
 "VDPAU wrapper",
 "Splitted-Desktop Systems VDPAU backend for VA-API",
-AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES,
+AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES | 
AV_VAAPI_DRIVER_QUIRK_FRAME_POOL_RESIZING,
 },
 };
 
-- 
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 2/4] avutil: hwcontext_vaapi, add AV_VAAPI_DRIVER_QUIRK_FRAME_POOL_RESIZING

2021-11-17 Thread Xu Guangxin
---
 libavutil/hwcontext_vaapi.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/hwcontext_vaapi.h b/libavutil/hwcontext_vaapi.h
index 0b2e071cb3..e4c7707861 100644
--- a/libavutil/hwcontext_vaapi.h
+++ b/libavutil/hwcontext_vaapi.h
@@ -58,6 +58,12 @@ enum {
  * and the results of the vaQuerySurfaceAttributes() call will be faked.
  */
 AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3),
+
+/**
+ * The driver does not support dynamically frame pool resizing.
+ * We need to provide all va surfaces at vaCreateContext
+ */
+AV_VAAPI_DRIVER_QUIRK_FRAME_POOL_RESIZING = (1 << 4),
 };
 
 /**
-- 
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 1/4] avutils: hwcontext_vaapi, print error if allocated surfaces > pool size

2021-11-17 Thread Xu Guangxin
---
 libavutil/hwcontext_vaapi.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 83e542876d..14a2df38c6 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -475,8 +475,11 @@ static AVBufferRef *vaapi_pool_alloc(void *opaque, size_t 
size)
 AVBufferRef *ref;
 
 if (hwfc->initial_pool_size > 0 &&
-avfc->nb_surfaces >= hwfc->initial_pool_size)
+avfc->nb_surfaces >= hwfc->initial_pool_size) {
+av_log(hwfc, AV_LOG_ERROR, "allocated surfaces count(%d) > 
pool_size(%d)\n",
+   avfc->nb_surfaces,  hwfc->initial_pool_size);
 return NULL;
+}
 
 vas = vaCreateSurfaces(hwctx->display, ctx->rt_format,
hwfc->width, hwfc->height,
-- 
2.25.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/2] lafi/vf_edgedetect: Move some functions to lavu/imgutils

2021-11-17 Thread Andreas Rheinhardt
Thilo Borgmann:
> Hi,
> 
> shared code with vf_blurriness.c in patch 2/2.
> RFC: is there a better place to put these?
> 

If you only need this in libavfilter, then why do you put it into
libavutil, thereby making it public and adding all sorts of ABI
complications?

- 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] */version.h: define FF_API macros unconditionally

2021-11-17 Thread Andreas Rheinhardt
Anton Khirnov:
> Quoting Hendrik Leppkes (2021-11-12 14:59:41)
>> On Fri, Nov 12, 2021 at 2:35 PM Anton Khirnov  wrote:
>>>
>>> There is no reason to wrap them in #ifndef guards, they should only be
>>> defined here and nowhere else. The define guards just add the
>>> possibility to accidentally use the same FF_API name in different
>>> libraries.
>>
>> Wasn't the idea here that I can just define one to true on
>> commandline/configure to test its removal?
>> Not sure if anyone really does that anymore, but at least back in the
>> day that was a thing ... sometimes used.
> 
> I have never heard of anyone doing that - I always just modify the value
> directly when I want to test things.
> 

I did this during my preparations for the bump.

> And I did discover duplicate values during the recent bump, so it's not
> a theoretical issue.
> 

Yeah, I stumbled upon that, too.

- 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 2/2] avfilter: add a vflip_vulkan filter

2021-11-17 Thread Wu, Jianhua
Lynne wrote:
> Nov 17, 2021, 08:51 by jianhua...@intel.com:
> 
> > The following command is on how to apply vflip_vulkan filter:
> >
> > ffmpeg -init_hw_device vulkan -i input.264 -vf
> >
> hwupload=extra_hw_frames=16,vflip_vulkan,hwdownload,format=yuv420p
> > output.264
> >
> > Signed-off-by: Wu Jianhua 
> > ---
> >  configure |   1 +
> >  libavfilter/Makefile  |   1 +
> >  libavfilter/allfilters.c  |   1 +
> >  libavfilter/vf_vflip_vulkan.c | 277
> > ++
> >  4 files changed, 280 insertions(+)
> >  create mode 100644 libavfilter/vf_vflip_vulkan.c
> >
> 
> The only difference between this and hflp_vulkan.c is a one-line change in a
> shader. Could you merge the filters together?
> Just add a flag to the init function and filter frame function, and add 
> separate
> hflip and vflip filter frame functions which call the wrapped filter frame
> function with a different argument.
> As for the name, I think vf_flip_vulkan.c would do.
> 

Yes, I do. I'll update later.

Thanks,
Jianhua

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] lavfi: add a libplacebo filter

2021-11-17 Thread Dennis Mungai
On Mon, 15 Nov 2021 at 22:26, Timo Rothenpieler 
wrote:

> On 15.11.2021 19:21, Dennis Mungai wrote:
> >>
> > Hello.
> >
> > Were you able to build FFmpeg with this filter enabled?
> > So far, building this package does not generate any pkgconfig file in the
> > configured prefix, and FFmpeg's ./configure cannot detect it.
> > I filed the issue on libplacebo's project page, with more details:
> > https://github.com/haasn/libplacebo/issues/110
>
> Yes, I had no issues with that.
> Had to slightly patch the .pc file for static linking for my needs, but
> other than that, it just works:
>
>
> https://github.com/BtbN/FFmpeg-Builds/blob/master/scripts.d/50-vulkan/60-libplacebo.sh
> ___
>
>
I was also able to get a build with  libplacebo up and running, thanks.

What I now run into is a segfault everytime libplacebo is invoked.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] avformat/http: Add short_seek_size option

2021-11-17 Thread Derek Buitenhuis
On 11/16/2021 2:57 PM, James Almer wrote:
> Micro.
> 
> LGTM otherwise if tested.

Double tested and micro bumped.

Pushed.

- Derek
___
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 0/3] Dolby Vision RPU Side Data

2021-11-17 Thread Derek Buitenhuis
On 11/14/2021 2:04 PM, Derek Buitenhuis wrote:
> I'll give this a few more days and then apply if there are no
> other comments.

Pushed.

- Derek
___
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 8/9] ffmpeg: drop a useless assignment

2021-11-17 Thread Michael Niedermayer
On Tue, Nov 16, 2021 at 11:26:26PM +0100, Michael Niedermayer wrote:
> On Tue, Nov 16, 2021 at 08:11:41PM +0100, Anton Khirnov wrote:
> > Quoting Michael Niedermayer (2021-11-16 14:46:43)
> > > On Mon, Nov 15, 2021 at 04:23:59PM +0100, Anton Khirnov wrote:
> > > > bits_per_raw_sample is already set in new_video_stream(), so this code
> > > > has no effect.
> > > > ---
> > > >  fftools/ffmpeg.c | 7 ---
> > > >  fftools/ffmpeg.h | 1 -
> > > >  fftools/ffmpeg_opt.c | 2 +-
> > > >  3 files changed, 1 insertion(+), 9 deletions(-)
> > > 
> > > maybe i messed up or missing something but this breaks fate for me
> > 
> > Cannot reproduce here, FATE passes for me.
> > Any ideas what could be the cause?
> 
> id have to re-look but i think it only failed after a 
> make distclean
> if it doesnt reproduce with make distclean then ill take a deeper
> look (tomorrow or so)

ive just taken another quick look and simplified this down to whats causing it
heres a better testcase

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 7f9f98222f2..dc86c9859a2 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3453,9 +3453,10 @@ static int init_output_stream_encode(OutputStream *ost, 
AVFrame *frame)
 enc_ctx->width   != dec_ctx->width  ||
 enc_ctx->height  != dec_ctx->height ||
 enc_ctx->pix_fmt != dec_ctx->pix_fmt) {
-enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;
+// enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;
 }
 
 // Field order: autodetection
 if (frame) {
 if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | 
AV_CODEC_FLAG_INTERLACED_ME) &&

with this:

ffmpeg  -y  -f image2 -c:v pgmyuv -i /tests/vsynth1/%02d.pgm -pix_fmt rgb48le 
/tmp/%02d.rgb48le.dpx
 
 
Video encoding failed
Conversion failed!

(thats with the other patches in this set before this one applied) but no
other patches applied


 
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] libRIST: Correctly initialize logging_settings

2021-11-17 Thread Gijs Peskens
Correct solution as suggested by Martin Balint on ffmpeg-devel
---
 libavformat/librist.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/librist.c b/libavformat/librist.c
index 6eae90cc2f..378b635ea7 100644
--- a/libavformat/librist.c
+++ b/libavformat/librist.c
@@ -130,6 +130,7 @@ static int librist_open(URLContext *h, const char *uri, int 
flags)
 if ((flags & AVIO_FLAG_READ_WRITE) == AVIO_FLAG_READ_WRITE)
 return AVERROR(EINVAL);
 
+s->logging_settings = (struct 
rist_logging_settings)LOGGING_SETTINGS_INITIALIZER;
 ret = rist_logging_set(_settings, s->log_level, log_cb, h, NULL, 
NULL);
 if (ret < 0)
 return risterr2ret(ret);
-- 
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/2] libRIST: allow setting fifo size and fail on overflow.

2021-11-17 Thread Gijs Peskens
Introduce fifo_size and overrun_nonfatal params to configure fifo buffer
behavior.
Fifo size is used to left shift 2, since libRIST only accepts powers of 2.

Use newly introduced RIST_DATA_FLAGS_OVERFLOW flag to check for overrun
and error out in that case.
---
 libavformat/librist.c | 36 
 1 file changed, 36 insertions(+)

diff --git a/libavformat/librist.c b/libavformat/librist.c
index 378b635ea7..6f68868f3c 100644
--- a/libavformat/librist.c
+++ b/libavformat/librist.c
@@ -43,6 +43,9 @@
 ((patch) + ((minor)* 0x100) + ((major) *0x1))
 #define FF_LIBRIST_VERSION FF_LIBRIST_MAKE_VERSION(LIBRIST_API_VERSION_MAJOR, 
LIBRIST_API_VERSION_MINOR, LIBRIST_API_VERSION_PATCH)
 #define FF_LIBRIST_VERSION_41 FF_LIBRIST_MAKE_VERSION(4, 1, 0)
+#define FF_LIBRIST_VERSION_42 FF_LIBRIST_MAKE_VERSION(4, 2, 0)
+
+#define FF_LIBRIST_FIFO_DEFAULT_SHIFT 13
 
 typedef struct RISTContext {
 const AVClass *class;
@@ -52,6 +55,8 @@ typedef struct RISTContext {
 int packet_size;
 int log_level;
 int encryption;
+int fifo_shift;
+bool overrun_nonfatal;
 char *secret;
 
 struct rist_logging_settings logging_settings;
@@ -70,6 +75,8 @@ static const AVOption librist_options[] = {
 { "main",NULL,  0,   
AV_OPT_TYPE_CONST, {.i64=RIST_PROFILE_MAIN}, 0, 0, .flags = D|E, "profile" 
},
 { "advanced",NULL,  0,   
AV_OPT_TYPE_CONST, {.i64=RIST_PROFILE_ADVANCED}, 0, 0, .flags = D|E, "profile" 
},
 { "buffer_size", "set buffer_size in ms", OFFSET(buffer_size), 
AV_OPT_TYPE_INT, {.i64=0}, 0, 3, .flags = D|E },
+{ "fifo_size", "Set libRIST fifo buffer size, applied as: 
buffer_size=2^fifo_size", OFFSET(fifo_shift), AV_OPT_TYPE_INT, 
{.i64=FF_LIBRIST_FIFO_DEFAULT_SHIFT}, 10, 63, .flags = D|E },
+{ "overrun_nonfatal", "survive in case of libRIST receiving circular 
buffer overrun", OFFSET(overrun_nonfatal), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,  
  D },
 { "pkt_size","set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT,  
 {.i64=1316},  1, MAX_PAYLOAD_SIZE,.flags = D|E },
 { "log_level",   "set loglevel",OFFSET(log_level),   AV_OPT_TYPE_INT,  
 {.i64=RIST_LOG_INFO},-1, INT_MAX, .flags = D|E },
 { "secret", "set encryption secret",OFFSET(secret),  
AV_OPT_TYPE_STRING,{.str=NULL},  0, 0,   .flags = D|E },
@@ -161,6 +168,19 @@ static int librist_open(URLContext *h, const char *uri, 
int flags)
 if (ret < 0)
 goto err;
 
+//Prior to 4.2.0 there was a bug in libRIST which made this call always 
fail.
+#if FF_LIBRIST_VERSION >= FF_LIBRIST_VERSION_42
+if (flags & AVIO_FLAG_READ) {
+ret = rist_receiver_set_output_fifo_size(s->ctx, 2 << s->fifo_shift);
+if (ret != 0)
+goto err;
+}
+#else 
+if (s->fifo_buffer_size != FF_LIBRIST_FIFO_DEFAULT) {
+av_log(h, AV_LOG_ERROR, "libRIST prior to 0.2.7 has a bug which fails 
setting the fifo buffer size");
+}
+#endif
+
 if (((s->encryption == 128 || s->encryption == 256) && !s->secret) ||
 ((peer_config->key_size == 128 || peer_config->key_size == 256) && 
!peer_config->secret[0])) {
 av_log(h, AV_LOG_ERROR, "secret is mandatory if encryption is 
enabled\n");
@@ -223,8 +243,24 @@ static int librist_read(URLContext *h, uint8_t *buf, int 
size)
 return AVERROR_EXTERNAL;
 }
 
+#if FF_LIBRIST_VERSION >= FF_LIBRIST_VERSION_42
+if (data_block->flags & RIST_DATA_FLAGS_OVERFLOW == 
RIST_DATA_FLAGS_OVERFLOW) {
+if (!s->overrun_nonfatal) {
+av_log(h, AV_LOG_ERROR, "Fifo buffer overrun. "
+"To avoid, increase fifo_size URL option. "
+"To survive in such case, use overrun_nonfatal option\n");
+size = AVERROR(EIO);
+goto out_free;
+} else {
+av_log(h, AV_LOG_WARNING, "Fifo buffer buffer overrun. "
+"Surviving due to overrun_nonfatal option\n");
+}
+}
+#endif
+
 size = data_block->payload_len;
 memcpy(buf, data_block->payload, size);
+out_free:
 #if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
 rist_receiver_data_block_free((struct rist_data_block**)_block);
 #else
-- 
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 2/2] avfilter: add a vflip_vulkan filter

2021-11-17 Thread Lynne
Nov 17, 2021, 08:51 by jianhua...@intel.com:

> The following command is on how to apply vflip_vulkan filter:
>
> ffmpeg -init_hw_device vulkan -i input.264 -vf 
> hwupload=extra_hw_frames=16,vflip_vulkan,hwdownload,format=yuv420p output.264
>
> Signed-off-by: Wu Jianhua 
> ---
>  configure |   1 +
>  libavfilter/Makefile  |   1 +
>  libavfilter/allfilters.c  |   1 +
>  libavfilter/vf_vflip_vulkan.c | 277 ++
>  4 files changed, 280 insertions(+)
>  create mode 100644 libavfilter/vf_vflip_vulkan.c
>

The only difference between this and hflp_vulkan.c is a one-line
change in a shader. Could you merge the filters together?
Just add a flag to the init function and filter frame function,
and add separate hflip and vflip filter frame functions which
call the wrapped filter frame function with a different argument.
As for the name, I think vf_flip_vulkan.c would do.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: add hls_segment_options correct the segment options name

2021-11-17 Thread Steven Liu
From: Steven Liu 

Because the hls_ts_options will be misunderstand by user that only can
be used in mpegts segments option. So add this option for segments.

Signed-off-by: Steven Liu 
---
 doc/muxers.texi  | 4 
 libavformat/hlsenc.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 7eee8c1be6..287ea569fd 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -919,6 +919,10 @@ This example will create a directory hierarchy 2016/02/15 
(if any of them do not
 produce the playlist, @file{out.m3u8}, and segment files:
 @file{2016/02/15/file-20160215-1455569023.ts}, 
@file{2016/02/15/file-20160215-1455569024.ts}, etc.
 
+@item hls_segment_options @var{options_list}
+Set output format options using a :-separated list of key=value
+parameters. Values containing @code{:} special characters must be
+escaped.
 
 @item hls_key_info_file @var{key_info_file}
 Use the information in @var{key_info_file} for segment encryption. The first
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 98608a834a..db0a4675fd 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -3107,6 +3107,7 @@ static const AVOption options[] = {
 {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT 
(0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, 
INT_MIN, INT_MAX, E},
 {"hls_base_url",  "url to prepend to each playlist entry",   
OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
 {"hls_segment_filename", "filename template for segment files", 
OFFSET(segment_filename),   AV_OPT_TYPE_STRING, {.str = NULL},0,
   0, E},
+{"hls_segment_options","set segments files format options of hls", 
OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E},
 {"hls_segment_size", "maximum size per segment file, (in bytes)",  
OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},   0,   
INT_MAX,   E},
 {"hls_key_info_file","file with key URI and key file path", 
OFFSET(key_info_file),  AV_OPT_TYPE_STRING, {.str = NULL},0,
   0, E},
 {"hls_enc","enable AES128 encryption support", OFFSET(encrypt),  
AV_OPT_TYPE_BOOL, {.i64 = 0},0,   1, E},
-- 
2.25.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/2] avformat/hlsenc: deprecate hls_ts_options option

2021-11-17 Thread Steven Liu
From: Steven Liu 

Because the hls_ts_options will be misunderstand by user,
and then user can use hls_segment_options instead of hls_ts_options.

Signed-off-by: Steven Liu 
---
 doc/muxers.texi   | 2 ++
 libavformat/hlsenc.c  | 6 --
 libavformat/version.h | 4 
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 287ea569fd..a8e763a859 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -799,6 +799,7 @@ were recently referenced in the playlist. Default value is 
1, meaning segments o
 Set output format options using a :-separated list of key=value
 parameters. Values containing @code{:} special characters must be
 escaped.
+@code{hls_ts_options} is deprecated.
 
 @item hls_start_number_source
 Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to 
the specified source.
@@ -923,6 +924,7 @@ produce the playlist, @file{out.m3u8}, and segment files:
 Set output format options using a :-separated list of key=value
 parameters. Values containing @code{:} special characters must be
 escaped.
+@code{hls_segment_options} instead of hls_ts_options.
 
 @item hls_key_info_file @var{key_info_file}
 Use the information in @var{key_info_file} for segment encryption. The first
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index db0a4675fd..3a085d81bc 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -3102,12 +3102,14 @@ static const AVOption options[] = {
 {"hls_init_time", "set segment length at init list", 
OFFSET(init_time), AV_OPT_TYPE_DURATION, {.i64 = 0},   0, INT64_MAX, E},
 {"hls_list_size", "set maximum number of playlist entries",  
OFFSET(max_nb_segments),AV_OPT_TYPE_INT,{.i64 = 5}, 0, INT_MAX, E},
 {"hls_delete_threshold", "set number of unreferenced segments to keep 
before deleting",  OFFSET(hls_delete_threshold),AV_OPT_TYPE_INT,{.i64 = 
1}, 1, INT_MAX, E},
-{"hls_ts_options","set hls mpegts list of options for the container format 
used for hls", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,  
  E},
+#if FF_HLS_TS_OPTIONS
+{"hls_ts_options","set hls mpegts list of options for the container format 
used for hls(will be deprecated)", OFFSET(format_options), AV_OPT_TYPE_DICT, 
{.str = NULL},  0, 0,E},
+#endif
 {"hls_vtt_options","set hls vtt list of options for the container format 
used for hls", OFFSET(vtt_format_options_str), AV_OPT_TYPE_STRING, {.str = 
NULL},  0, 0,E},
 {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT 
(0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, 
INT_MIN, INT_MAX, E},
 {"hls_base_url",  "url to prepend to each playlist entry",   
OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
 {"hls_segment_filename", "filename template for segment files", 
OFFSET(segment_filename),   AV_OPT_TYPE_STRING, {.str = NULL},0,
   0, E},
-{"hls_segment_options","set segments files format options of hls", 
OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,E},
+{"hls_segment_options","set segments files format options of hls (instead 
of hls_ts_options)", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  
0, 0,E},
 {"hls_segment_size", "maximum size per segment file, (in bytes)",  
OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},   0,   
INT_MAX,   E},
 {"hls_key_info_file","file with key URI and key file path", 
OFFSET(key_info_file),  AV_OPT_TYPE_STRING, {.str = NULL},0,
   0, E},
 {"hls_enc","enable AES128 encryption support", OFFSET(encrypt),  
AV_OPT_TYPE_BOOL, {.i64 = 0},0,   1, E},
diff --git a/libavformat/version.h b/libavformat/version.h
index 81ed517609..5da9291009 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -64,6 +64,10 @@
 #ifndef FF_API_AVIOCONTEXT_WRITTEN
 #define FF_API_AVIOCONTEXT_WRITTEN  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #endif
+#ifndef FF_HLS_TS_OPTIONS
+#define FF_HLS_TS_OPTIONS   (LIBAVFORMAT_VERSION_MAJOR < 60)
+#endif
+
 
 
 #ifndef FF_API_R_FRAME_RATE
-- 
2.25.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".