Re: [FFmpeg-devel] [PATCH 3/5] avfilter/aphasemeter: add null check

2021-10-13 Thread Paul B Mahol
why is this needed?
___
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/5] avfilter/avfilter: Add avfilter_alloc() and avfilter_query_formats() for initializing filters without a graph

2021-10-13 Thread Paul B Mahol
On Wed, Oct 13, 2021 at 6:50 AM Soft Works  wrote:

> The purpose of these additions is for being able to programatically
> retrieve
> the supported formats of a filter for each input and output without adding
> the filter to a graph and creating connections.
>

That is flawed by definition.


>
> Signed-off-by: softworkz 
> ---
>  doc/APIchanges  |  3 +++
>  libavfilter/avfilter.c  |  4 ++--
>  libavfilter/avfilter.h  | 22 ++
>  libavfilter/avfiltergraph.c | 18 ++
>  libavfilter/version.h   |  2 +-
>  5 files changed, 42 insertions(+), 7 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 7b267a79ac..903de43365 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -14,6 +14,9 @@ libavutil: 2021-04-27
>
>  API changes, most recent first:
>
> +2021-10-12 - xx - lavf 8.13.100 - avfilter.h
> +  Add avfilter_alloc() and avfilter_query_formats().
> +
>  2021-09-21 - xx - lavu 57.7.100 - pixfmt.h
>Add AV_PIX_FMT_X2BGR10.
>
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 7362bcdab5..645af2cb11 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -769,12 +769,12 @@ void avfilter_free(AVFilterContext *filter)
>
>  for (i = 0; i < filter->nb_inputs; i++) {
>  free_link(filter->inputs[i]);
> -if (filter->input_pads[i].flags  & AVFILTERPAD_FLAG_FREE_NAME)
> +if (filter->input_pads && filter->input_pads[i].flags  &
> AVFILTERPAD_FLAG_FREE_NAME)
>  av_freep(&filter->input_pads[i].name);
>  }
>  for (i = 0; i < filter->nb_outputs; i++) {
>  free_link(filter->outputs[i]);
> -if (filter->output_pads[i].flags & AVFILTERPAD_FLAG_FREE_NAME)
> +if (filter->output_pads && filter->output_pads[i].flags &
> AVFILTERPAD_FLAG_FREE_NAME)
>  av_freep(&filter->output_pads[i].name);
>  }
>
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index f7208754a7..24119993d6 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -911,6 +911,28 @@ typedef struct AVFilterGraph {
>  unsigned disable_auto_convert;
>  } AVFilterGraph;
>
> +/**
> + * Allocate a new filter context and return it.
> + *
> + * @param filter what filter to create an instance of
> + * @param inst_name name to give to the new filter context
> + *
> + * @return newly created filter context or NULL on failure
> + *
> + * @note for adding a filter to a filtergraph, use
> + *   avfilter_graph_alloc_filter() instead.
> + */
> +AVFilterContext *avfilter_alloc(const AVFilter *filter, const char
> *inst_name);
> +
> +/**
> + * Query the formats of a filter.
> + *
> + * @param filter the filter context
> + *
> + * @return 0 on success
> + */
> +int avfilter_query_formats(AVFilterContext *filter);
> +
>  /**
>   * Allocate a filter graph.
>   *
> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
> index b8b432e98b..64379782fc 100644
> --- a/libavfilter/avfiltergraph.c
> +++ b/libavfilter/avfiltergraph.c
> @@ -81,6 +81,11 @@ int ff_graph_thread_init(AVFilterGraph *graph)
>  }
>  #endif
>
> +AVFilterContext *avfilter_alloc(const AVFilter *filter, const char
> *inst_name)
> +{
> +return ff_filter_alloc(filter, inst_name);
> +}
> +
>  AVFilterGraph *avfilter_graph_alloc(void)
>  {
>  AVFilterGraph *ret = av_mallocz(sizeof(*ret));
> @@ -395,6 +400,14 @@ static int formats_declared(AVFilterContext *f)
>  return 1;
>  }
>
> +int avfilter_query_formats(AVFilterContext *filter)
> +{
> +if (filter->filter->formats_state == FF_FILTER_FORMATS_QUERY_FUNC)
> +return filter_query_formats(filter);
> +
> +return ff_default_query_formats(filter);
> +}
> +
>  /**
>   * Perform one round of query_formats() and merging formats lists on the
>   * filter graph.
> @@ -418,10 +431,7 @@ static int query_formats(AVFilterGraph *graph, void
> *log_ctx)
>  AVFilterContext *f = graph->filters[i];
>  if (formats_declared(f))
>  continue;
> -if (f->filter->formats_state == FF_FILTER_FORMATS_QUERY_FUNC)
> -ret = filter_query_formats(f);
> -else
> -ret = ff_default_query_formats(f);
> +ret = avfilter_query_formats(f);
>  if (ret < 0 && ret != AVERROR(EAGAIN))
>  return ret;
>  /* note: EAGAIN could indicate a partial success, not counted yet
> */
> diff --git a/libavfilter/version.h b/libavfilter/version.h
> index e4c25b9225..dca5aacb45 100644
> --- a/libavfilter/version.h
> +++ b/libavfilter/version.h
> @@ -30,7 +30,7 @@
>  #include "libavutil/version.h"
>
>  #define LIBAVFILTER_VERSION_MAJOR   8
> -#define LIBAVFILTER_VERSION_MINOR  12
> +#define LIBAVFILTER_VERSION_MINOR  13
>  #define LIBAVFILTER_VERSION_MICRO 100
>
>
> --
> 2.30.2.windows.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg

Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Paul B Mahol
what about more complicated filters?
___
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/1] Print bit depth when executing 'ffmpeg -pix_fmts'

2021-10-13 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Tobias Rapp
> Sent: Wednesday, October 13, 2021 8:56 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH 1/1] Print bit depth when
> executing 'ffmpeg -pix_fmts'
> 
> On 13/10/2021 06:58, Soft Works wrote:
> > New output looks like this:
> >
> > Pixel formats:
> > I = Supported Input  format for conversion
> > .O... = Supported Output format for conversion
> > ..H.. = Hardware accelerated format
> > ...P. = Paletted format
> > B = Bitstream format
> > FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH
> > -
> > IO... yuv420p3 12 8
> > IO... yuyv4223 16 8
> > IO... rgb24  3 24 8
> > IO... bgr24  3 24 8
> >
> > [...]
> >
> > @@ -1772,7 +1772,8 @@ int show_pix_fmts(void *optctx, const char
> *opt, const char *arg)
> >  pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B'
> : '.',
> >  pix_desc->name,
> >  pix_desc->nb_components,
> > -   av_get_bits_per_pixel(pix_desc));
> > +   av_get_bits_per_pixel(pix_desc),
> > +   pix_desc->comp[0].depth);
> >   }
> >   return 0;
> >   }
> >
> 
> I think it is misleading to only print the bit-depth of the first
> component. You can already get bit-depth information for all
> components
> in different data formats with "ffprobe -show_pixel_formats".

The bit depth of the first component is often considered as the
"nominal" bit depth of formats: For example, yuva420p10 is 
said to be a "10bit format" even though it doesn't apply to all
components.

That's the intention of the output in this case, means it's for
user information, not a developer output.

Kind regards,
softworkz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Paul B Mahol
> Sent: Wednesday, October 13, 2021 9:18 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> filter input/output formats in help output
> 
> what about more complicated filters?

I guess you mean like this:

Filter amix
  Audio mixing.
Inputs:
dynamic (depending on the options)
Outputs:
   #0: default (audio) [flt, fltp, dbl, dblp]
amix AVOptions:
  inputs..F.A.. Number of inputs. (from 1 to 
32767) (default 2)
  duration  ..F.A.. How to determine the 
end-of-stream. (from 0 to 2) (default longest)
 longest 0..F.A.. Duration of longest input.
 shortest1..F.A.. Duration of shortest input.
 first   2..F.A.. Duration of first input.
  dropout_transition   ..F.A.. Transition time, in seconds, for 
volume renormalization when an input stream ends. (from 0 to INT_MAX) (default 
2)
  weights..F.AT. Set weight for each input. 
(default "1 1")
  normalize ..F.AT. Scale inputs (default true)
___
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/5] avfilter/avfilter: Add avfilter_alloc() and avfilter_query_formats() for initializing filters without a graph

2021-10-13 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Paul B Mahol
> Sent: Wednesday, October 13, 2021 9:16 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 1/5] avfilter/avfilter: Add
> avfilter_alloc() and avfilter_query_formats() for initializing
> filters without a graph
> 
> On Wed, Oct 13, 2021 at 6:50 AM Soft Works 
> wrote:
> 
> > The purpose of these additions is for being able to programatically
> > retrieve
> > the supported formats of a filter for each input and output without
> adding
> > the filter to a graph and creating connections.
> >
> 
> That is flawed by definition.

Could you please give an example where you think the output
would be incorrect?

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

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


Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Paul B Mahol
scale, extractplanes, alphaextract, waveform, vectorscope.
___
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/1] Print bit depth when executing 'ffmpeg -pix_fmts'

2021-10-13 Thread Paul B Mahol
On Wed, Oct 13, 2021 at 9:20 AM Soft Works  wrote:

>
>
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Tobias Rapp
> > Sent: Wednesday, October 13, 2021 8:56 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH 1/1] Print bit depth when
> > executing 'ffmpeg -pix_fmts'
> >
> > On 13/10/2021 06:58, Soft Works wrote:
> > > New output looks like this:
> > >
> > > Pixel formats:
> > > I = Supported Input  format for conversion
> > > .O... = Supported Output format for conversion
> > > ..H.. = Hardware accelerated format
> > > ...P. = Paletted format
> > > B = Bitstream format
> > > FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH
> > > -
> > > IO... yuv420p3 12 8
> > > IO... yuyv4223 16 8
> > > IO... rgb24  3 24 8
> > > IO... bgr24  3 24 8
> > >
> > > [...]
> > >
> > > @@ -1772,7 +1772,8 @@ int show_pix_fmts(void *optctx, const char
> > *opt, const char *arg)
> > >  pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B'
> > : '.',
> > >  pix_desc->name,
> > >  pix_desc->nb_components,
> > > -   av_get_bits_per_pixel(pix_desc));
> > > +   av_get_bits_per_pixel(pix_desc),
> > > +   pix_desc->comp[0].depth);
> > >   }
> > >   return 0;
> > >   }
> > >
> >
> > I think it is misleading to only print the bit-depth of the first
> > component. You can already get bit-depth information for all
> > components
> > in different data formats with "ffprobe -show_pixel_formats".
>
> The bit depth of the first component is often considered as the
> "nominal" bit depth of formats: For example, yuva420p10 is
> said to be a "10bit format" even though it doesn't apply to all
> components.
>
> That's the intention of the output in this case, means it's for
> user information, not a developer output.
>

This is again flawed design.


>
> Kind regards,
> softworkz
> ___
> 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/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Paul B Mahol
> Sent: Wednesday, October 13, 2021 9:27 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> filter input/output formats in help output
> 
> scale, extractplanes, alphaextract, waveform, vectorscope.

See the results below. Nothing is flawed. Of course there can't be an
output in all cases, as you have pointed out correctly.

But for the remaining 95% of filters, the formats output is very useful.
(and correct)


Filter extractplanes
  Extract planes as grayscale frames.
Inputs:
   #0: default (video)
Outputs:
dynamic (depending on the options)
extractplanes AVOptions:


Filter alphaextract
  Extract an alpha channel as a grayscale image component.
Inputs:
   #0: default (video)
Outputs:
dynamic (depending on the options)


Filter waveform
  Video waveform monitor.
slice threading supported
Inputs:
   #0: default (video)
Outputs:
   #0: default (video)
waveform AVOptions:


Filter vectorscope
  Video vectorscope.
Inputs:
   #0: default (video)
Outputs:
   #0: default (video)
vectorscope AVOptions:


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

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


Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Soft Works
> Sent: Wednesday, October 13, 2021 9:36 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> filter input/output formats in help output
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Paul B Mahol
> > Sent: Wednesday, October 13, 2021 9:27 AM
> > To: FFmpeg development discussions and patches  > de...@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > filter input/output formats in help output
> >
> > scale, extractplanes, alphaextract, waveform, vectorscope.
> 
> See the results below. Nothing is flawed. Of course there can't be an
> output in all cases, as you have pointed out correctly.
> 
> But for the remaining 95% of filters, the formats output is very
> useful.
> (and correct)

I'd also like to point out that this information is currently completely
inaccessible for anybody without looking it up in the source code.

Knowing about a filter's supported formats is important for building
efficient filter chains and avoiding unexpected auto format 
conversions.

I had added this output years ago and the information (which is 
parsed from the help output) is an important prerequisite for our 
automated filter-string-building (outside of ffmpeg).

I also use it regularly for looking up filter formats and I think
it might be useful for others as well.

Kind regards,
softworkz


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

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


Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Paul B Mahol
On Wed, Oct 13, 2021 at 9:58 AM Soft Works  wrote:

>
>
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Soft Works
> > Sent: Wednesday, October 13, 2021 9:36 AM
> > To: FFmpeg development discussions and patches  > de...@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > filter input/output formats in help output
> >
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of
> > > Paul B Mahol
> > > Sent: Wednesday, October 13, 2021 9:27 AM
> > > To: FFmpeg development discussions and patches  > > de...@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > > filter input/output formats in help output
> > >
> > > scale, extractplanes, alphaextract, waveform, vectorscope.
> >
> > See the results below. Nothing is flawed. Of course there can't be an
> > output in all cases, as you have pointed out correctly.
> >
> > But for the remaining 95% of filters, the formats output is very
> > useful.
> > (and correct)
>

As proved by above, this is big hack and should not be applied, its also
ugly.


>
> I'd also like to point out that this information is currently completely
> inaccessible for anybody without looking it up in the source code.
>
> Knowing about a filter's supported formats is important for building
> efficient filter chains and avoiding unexpected auto format
> conversions.
>
> I had added this output years ago and the information (which is
> parsed from the help output) is an important prerequisite for our
> automated filter-string-building (outside of ffmpeg).
>
> I also use it regularly for looking up filter formats and I think
> it might be useful for others as well.
>
> Kind regards,
> softworkz
>
>
> ___
> 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/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Paul B Mahol
> Sent: Wednesday, October 13, 2021 10:16 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> filter input/output formats in help output
> 
> On Wed, Oct 13, 2021 at 9:58 AM Soft Works 
> wrote:
> 
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of
> > > Soft Works
> > > Sent: Wednesday, October 13, 2021 9:36 AM
> > > To: FFmpeg development discussions and patches  > > de...@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > > filter input/output formats in help output
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: ffmpeg-devel  On Behalf
> Of
> > > > Paul B Mahol
> > > > Sent: Wednesday, October 13, 2021 9:27 AM
> > > > To: FFmpeg development discussions and patches  > > > de...@ffmpeg.org>
> > > > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > > > filter input/output formats in help output
> > > >
> > > > scale, extractplanes, alphaextract, waveform, vectorscope.
> > >
> > > See the results below. Nothing is flawed. Of course there can't
> be an
> > > output in all cases, as you have pointed out correctly.
> > >
> > > But for the remaining 95% of filters, the formats output is very
> > > useful.
> > > (and correct)
> >
> 
> As proved by above, this is big hack and should not be applied, its
> also
> ugly.

I'm not sure what you mean. I do not see at which point this would 
qualify as a hack.

Anyway, then - would you have a better suggestion for getting at 
and printing out this information?

Or do you want to say that this information should remain hidden
knowledge only available to developers?

Thanks,
softworkz
___
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/1] Print bit depths when executing 'ffmpeg -pix_fmts'

2021-10-13 Thread Soft Works
New output looks like this:

Pixel formats:
I = Supported Input  format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
B = Bitstream format
FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS
-
IO... yuv420p3 12  8-8-8
IO... yuyv4223 16  8-8-8
IO... rgb24  3 24  8-8-8
IO... bgr24  3 24  8-8-8
IO... yuv422p3 16  8-8-8
IO... yuv444p3 24  8-8-8

[..]

Signed-off-by: softworkz 
---
v2: print depth values of all components

 fftools/cmdutils.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 2c8e98982f..426ba6c99f 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1754,7 +1754,7 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
"..H.. = Hardware accelerated format\n"
"...P. = Paletted format\n"
"B = Bitstream format\n"
-   "FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL\n"
+   "FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS\n"
"-\n");
 
 #if !CONFIG_SWSCALE
@@ -1764,7 +1764,7 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
 
 while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
 enum AVPixelFormat av_unused pix_fmt = 
av_pix_fmt_desc_get_id(pix_desc);
-printf("%c%c%c%c%c %-16s   %d%2d\n",
+printf("%c%c%c%c%c %-16s   %d%3d  %d",
sws_isSupportedInput (pix_fmt)  ? 'I' : '.',
sws_isSupportedOutput(pix_fmt)  ? 'O' : '.',
pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL   ? 'H' : '.',
@@ -1772,7 +1772,12 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
pix_desc->name,
pix_desc->nb_components,
-   av_get_bits_per_pixel(pix_desc));
+   av_get_bits_per_pixel(pix_desc),
+   pix_desc->comp[0].depth);
+
+for (unsigned i = 1; i < pix_desc->nb_components; i++)
+printf("-%d", pix_desc->comp[i].depth);
+printf("\n");
 }
 return 0;
 }
-- 
2.30.2.windows.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/1] fftools/ffmpeg: Output log message when interactive q command is received

2021-10-13 Thread Soft Works
When viewing logs, it's sometimes useful to be able to see whether
execution was ended via q command.

Signed-off-by: softworkz 
---
 fftools/ffmpeg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 7545b7c68e..d141f34df9 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3991,8 +3991,10 @@ static int check_keyboard_interaction(int64_t cur_time)
 last_time = cur_time;
 }else
 key = -1;
-if (key == 'q')
+if (key == 'q') {
+av_log(NULL, AV_LOG_INFO, "\n\n[q] command received. Exiting.\n\n");
 return AVERROR_EXIT;
+}
 if (key == '+') av_log_set_level(av_log_get_level()+10);
 if (key == '-') av_log_set_level(av_log_get_level()-10);
 if (key == 's') qp_hist ^= 1;
-- 
2.30.2.windows.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/1] avformat/dump: Print codec level and stream start offsets for input streams

2021-10-13 Thread Soft Works
Signed-off-by: softworkz 
---
 libavformat/dump.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 4824965ee9..17e216bf0f 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -562,6 +562,10 @@ static void dump_stream_format(const AVFormatContext *ic, 
int i,
 }
 
 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+
+if (st->codecpar->level > 0)
+av_log(NULL, AV_LOG_INFO, ", Level %d", st->codecpar->level);
+
 int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
 int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
 int tbn = st->time_base.den && st->time_base.num;
@@ -577,6 +581,11 @@ static void dump_stream_format(const AVFormatContext *ic, 
int i,
 print_fps(1 / av_q2d(st->time_base), "tbn");
 }
 
+if (st->start_time != AV_NOPTS_VALUE && st->start_time != 0 && 
st->time_base.den && st->time_base.num) {
+const double stream_start = st->start_time * av_q2d(st->time_base);
+av_log(NULL, AV_LOG_INFO, ", Start-Time %.3fs", stream_start);
+}
+
 if (st->disposition & AV_DISPOSITION_DEFAULT)
 av_log(NULL, AV_LOG_INFO, " (default)");
 if (st->disposition & AV_DISPOSITION_DUB)
-- 
2.30.2.windows.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 2/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Paul B Mahol
On Wed, Oct 13, 2021 at 10:24 AM Soft Works  wrote:

>
>
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Paul B Mahol
> > Sent: Wednesday, October 13, 2021 10:16 AM
> > To: FFmpeg development discussions and patches  > de...@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > filter input/output formats in help output
> >
> > On Wed, Oct 13, 2021 at 9:58 AM Soft Works 
> > wrote:
> >
> > >
> > >
> > > > -Original Message-
> > > > From: ffmpeg-devel  On Behalf Of
> > > > Soft Works
> > > > Sent: Wednesday, October 13, 2021 9:36 AM
> > > > To: FFmpeg development discussions and patches  > > > de...@ffmpeg.org>
> > > > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > > > filter input/output formats in help output
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: ffmpeg-devel  On Behalf
> > Of
> > > > > Paul B Mahol
> > > > > Sent: Wednesday, October 13, 2021 9:27 AM
> > > > > To: FFmpeg development discussions and patches  > > > > de...@ffmpeg.org>
> > > > > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > > > > filter input/output formats in help output
> > > > >
> > > > > scale, extractplanes, alphaextract, waveform, vectorscope.
> > > >
> > > > See the results below. Nothing is flawed. Of course there can't
> > be an
> > > > output in all cases, as you have pointed out correctly.
> > > >
> > > > But for the remaining 95% of filters, the formats output is very
> > > > useful.
> > > > (and correct)
> > >
> >
> > As proved by above, this is big hack and should not be applied, its
> > also
> > ugly.
>
> I'm not sure what you mean. I do not see at which point this would
> qualify as a hack.
>
> Anyway, then - would you have a better suggestion for getting at
> and printing out this information?
>
> Or do you want to say that this information should remain hidden
> knowledge only available to developers?
>

Formats can differ between each  input and output pad.


>
> Thanks,
> softworkz
> ___
> 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/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-13 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Paul B Mahol
> Sent: Wednesday, October 13, 2021 10:42 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> filter input/output formats in help output
> 
> On Wed, Oct 13, 2021 at 10:24 AM Soft Works 
> wrote:
> 
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of
> > > Paul B Mahol
> > > Sent: Wednesday, October 13, 2021 10:16 AM
> > > To: FFmpeg development discussions and patches  > > de...@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: Print
> > > filter input/output formats in help output
> > >
> > > On Wed, Oct 13, 2021 at 9:58 AM Soft Works
> 
> > > wrote:
> > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: ffmpeg-devel  On
> Behalf Of
> > > > > Soft Works
> > > > > Sent: Wednesday, October 13, 2021 9:36 AM
> > > > > To: FFmpeg development discussions and patches  > > > > de...@ffmpeg.org>
> > > > > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils:
> Print
> > > > > filter input/output formats in help output
> > > > >
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: ffmpeg-devel  On
> Behalf
> > > Of
> > > > > > Paul B Mahol
> > > > > > Sent: Wednesday, October 13, 2021 9:27 AM
> > > > > > To: FFmpeg development discussions and patches  > > > > > de...@ffmpeg.org>
> > > > > > Subject: Re: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils:
> Print
> > > > > > filter input/output formats in help output
> > > > > >
> > > > > > scale, extractplanes, alphaextract, waveform, vectorscope.
> > > > >
> > > > > See the results below. Nothing is flawed. Of course there
> can't
> > > be an
> > > > > output in all cases, as you have pointed out correctly.
> > > > >
> > > > > But for the remaining 95% of filters, the formats output is
> very
> > > > > useful.
> > > > > (and correct)
> > > >
> > >
> > > As proved by above, this is big hack and should not be applied,
> its
> > > also
> > > ugly.
> >
> > I'm not sure what you mean. I do not see at which point this would
> > qualify as a hack.
> >
> > Anyway, then - would you have a better suggestion for getting at
> > and printing out this information?
> >
> > Or do you want to say that this information should remain hidden
> > knowledge only available to developers?
> >
> 
> Formats can differ between each  input and output pad.

Yes, and this is shown correctly:

Filter paletteuse
  Use a palette to downsample an input video stream.
Inputs:
   #0: default (video) [bgra]
   #1: palette (video) [bgra]
Outputs:
   #0: default (video) [pal8]
...

No hack :-)

softworkz

___
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/1] fftools/ffmpeg: Output log message when interactive q command is received

2021-10-13 Thread Michael Koch

Are those keys listed somewhere in the documentation?

___
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/1] fftools/ffmpeg: Output log message when interactive q command is received

2021-10-13 Thread Gyan Doshi




On 2021-10-13 02:30 pm, Michael Koch wrote:

Are those keys listed somewhere in the documentation?


Not yet. Press ? to get a list at runtime.

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] Commit Message Line Wrapping

2021-10-13 Thread Soft Works
Hi everybody,

I have submitted a patch with the following commit message:
(with the patch being about text column alignment)

-

Before:

overlay AVOptions:
  x  ..FV... set the x expression (default "0")
  y  ..FV... set the y expression (default "0")
  eof_action..FV... Action to take when encountering 
EOF from secondary input  (from 0 to 2) (default repeat)
 repeat  0..FV... Repeat the previous frame.
 endall  1..FV... End both streams.
 pass2..FV... Pass through the main input.
  eval  ..FV... specify when to evaluate 
expressions (from 0 to 1) (default frame)

After:

overlay AVOptions:
   x  ..FV... set the x expression (default "0")
   y  ..FV... set the y expression (default "0")
   eof_action..FV... Action to take when encountering 
EOF from secondary input  (from 0 to 2) (default repeat)
 repeat  0..FV... Repeat the previous frame.
 endall  1..FV... End both streams.
 pass2..FV... Pass through the main input.
   eval  ..FV... specify when to evaluate 
expressions (from 0 to 1) (default frame)

-

Now, Patchwork tells: "Please wrap lines in the body of the commit message 
between 60 and 72 characters".
When I do this, I get the following result:

-

Before:

overlay AVOptions:
  x  ..FV... set the x expression 
(default "0")
  y  ..FV... set the y expression 
(default "0")
  eof_action..FV... Action to take when 
encountering EOF from secondary input  (from 0 to 2) (default 
repeat)
 repeat  0..FV... Repeat the previous 
frame.
 endall  1..FV... End both streams.
 pass2..FV... Pass through the main 
input.
  eval  ..FV... specify when to 
evaluate expressions (from 0 to 1) (default frame)

After:
a
overlay AVOptions:
   x  ..FV... set the x expression 
(default "0")
   y  ..FV... set the y expression 
(default "0")
   eof_action..FV... Action to take when 
encountering EOF from secondary input  (from 0 to 2) (default 
repeat)
 repeat  0..FV... Repeat the previous 
frame.
 endall  1..FV... End both streams.
 pass2..FV... Pass through the main 
input.
   eval  ..FV... specify when to 
evaluate expressions (from 0 to 1) (default frame)

-


Now I'm unsure.
Should I really change the commit message to the above and resubmit?

Thanks,
softworkz


___
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 v3 1/1] fftools/cmdutils: Print bit depths when executing 'ffmpeg -pix_fmts'

2021-10-13 Thread Soft Works
New output looks like this:

Pixel formats:
I = Supported Input  format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
B = Bitstream format
FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS
-
IO... yuv420p3 12  8-8-8
IO... yuyv4223 16  8-8-8
IO... rgb24  3 24  8-8-8
IO... bgr24  3 24  8-8-8
IO... yuv422p3 16  8-8-8
IO... yuv444p3 24  8-8-8

[..]

Signed-off-by: softworkz 
---
v3: add context prefix to commit message
v2: print depth values of all components

 fftools/cmdutils.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 2c8e98982f..426ba6c99f 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1754,7 +1754,7 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
"..H.. = Hardware accelerated format\n"
"...P. = Paletted format\n"
"B = Bitstream format\n"
-   "FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL\n"
+   "FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS\n"
"-\n");
 
 #if !CONFIG_SWSCALE
@@ -1764,7 +1764,7 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
 
 while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
 enum AVPixelFormat av_unused pix_fmt = 
av_pix_fmt_desc_get_id(pix_desc);
-printf("%c%c%c%c%c %-16s   %d%2d\n",
+printf("%c%c%c%c%c %-16s   %d%3d  %d",
sws_isSupportedInput (pix_fmt)  ? 'I' : '.',
sws_isSupportedOutput(pix_fmt)  ? 'O' : '.',
pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL   ? 'H' : '.',
@@ -1772,7 +1772,12 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
pix_desc->name,
pix_desc->nb_components,
-   av_get_bits_per_pixel(pix_desc));
+   av_get_bits_per_pixel(pix_desc),
+   pix_desc->comp[0].depth);
+
+for (unsigned i = 1; i < pix_desc->nb_components; i++)
+printf("-%d", pix_desc->comp[i].depth);
+printf("\n");
 }
 return 0;
 }
-- 
2.30.2.windows.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 1/1] avformat/dump: Print codec level and stream start offsets for input streams

2021-10-13 Thread Soft Works
Signed-off-by: softworkz 
---
v2: rearrange code to fix warning

 libavformat/dump.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 4824965ee9..58bb28d06e 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -566,6 +566,9 @@ static void dump_stream_format(const AVFormatContext *ic, 
int i,
 int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
 int tbn = st->time_base.den && st->time_base.num;
 
+if (st->codecpar->level > 0)
+av_log(NULL, AV_LOG_INFO, ", Level %d", st->codecpar->level);
+
 if (fps || tbr || tbn)
 av_log(NULL, AV_LOG_INFO, "%s", separator);
 
@@ -577,6 +580,11 @@ static void dump_stream_format(const AVFormatContext *ic, 
int i,
 print_fps(1 / av_q2d(st->time_base), "tbn");
 }
 
+if (st->start_time != AV_NOPTS_VALUE && st->start_time != 0 && 
st->time_base.den && st->time_base.num) {
+const double stream_start = st->start_time * av_q2d(st->time_base);
+av_log(NULL, AV_LOG_INFO, ", Start-Time %.3fs", stream_start);
+}
+
 if (st->disposition & AV_DISPOSITION_DEFAULT)
 av_log(NULL, AV_LOG_INFO, " (default)");
 if (st->disposition & AV_DISPOSITION_DUB)
-- 
2.30.2.windows.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] avfilter/vf_guided: support enhanced guided filter

2021-10-13 Thread Paul B Mahol
Why this filter is being applied at first place at all?

It is extraordinary slow and used very slow algorithm and reallocates
memory all the 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 1/2] avfilter: add limitdiff video filter

2021-10-13 Thread Paul B Mahol
will apply soon
___
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 xcorrelate video filter

2021-10-13 Thread Paul B Mahol
will apply soon
___
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] avformat/westwood_vqa: Store VQFL codebook chunks

2021-10-13 Thread Paul B Mahol
will apply soon
___
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_lut3d: fix building with --disable-optimizations

2021-10-13 Thread Paul B Mahol
applied
___
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] libavcodec/flac_parser: Validate subframe zero bit and type

2021-10-13 Thread Mattias Wadman
Reduces the risk of finding false frames that happens to have valid values and 
CRC.

Fixes ticket #9185 ffmpeg flac decoder incorrectly finds junk frame
https://trac.ffmpeg.org/ticket/9185
---
 libavcodec/flac_parser.c | 30 --
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index d3d9c889a1..2c550507fc 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -96,8 +96,34 @@ static int frame_header_is_valid(AVCodecContext *avctx, 
const uint8_t *buf,
  FLACFrameInfo *fi)
 {
 GetBitContext gb;
-init_get_bits(&gb, buf, MAX_FRAME_HEADER_SIZE * 8);
-return !ff_flac_decode_frame_header(avctx, &gb, fi, 127);
+uint8_t subframe_type;
+
+// header plus one byte from first subframe
+init_get_bits(&gb, buf, MAX_FRAME_HEADER_SIZE * 8 + 8);
+if (ff_flac_decode_frame_header(avctx, &gb, fi, 127)) {
+return 0;
+}
+// subframe zero bit
+if (get_bits1(&gb) != 0) {
+return 0;
+}
+// subframe type
+// 00 : SUBFRAME_CONSTANT
+// 01 : SUBFRAME_VERBATIM
+// 1x : reserved
+// 0001xx : reserved
+// 001xxx : if(xxx <= 4) SUBFRAME_FIXED, xxx=order ; else reserved
+// 01 : reserved
+// 1x : SUBFRAME_LPC, x=order-1
+subframe_type = get_bits(&gb, 6);
+if (!(subframe_type == 0 ||
+  subframe_type == 1 ||
+  ((subframe_type >= 8) && (subframe_type <= 12)) ||
+  (subframe_type >= 32))) {
+return 0;
+}
+
+return 1;
 }
 
 /**
-- 
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".


Re: [FFmpeg-devel] Commit Message Line Wrapping

2021-10-13 Thread Michael Niedermayer
On Wed, Oct 13, 2021 at 11:46:30AM +, Soft Works wrote:
> Hi everybody,
> 
> I have submitted a patch with the following commit message:
> (with the patch being about text column alignment)
> 
> -
> 
> Before:
> 
> overlay AVOptions:
>   x  ..FV... set the x expression (default 
> "0")
>   y  ..FV... set the y expression (default 
> "0")
>   eof_action..FV... Action to take when encountering 
> EOF from secondary input  (from 0 to 2) (default repeat)
>  repeat  0..FV... Repeat the previous frame.
>  endall  1..FV... End both streams.
>  pass2..FV... Pass through the main input.
>   eval  ..FV... specify when to evaluate 
> expressions (from 0 to 1) (default frame)
> 
> After:
> 
> overlay AVOptions:
>x  ..FV... set the x expression (default 
> "0")
>y  ..FV... set the y expression (default 
> "0")
>eof_action..FV... Action to take when 
> encountering EOF from secondary input  (from 0 to 2) (default repeat)
>  repeat  0..FV... Repeat the previous frame.
>  endall  1..FV... End both streams.
>  pass2..FV... Pass through the main input.
>eval  ..FV... specify when to evaluate 
> expressions (from 0 to 1) (default frame)
> 
> -
> 
> Now, Patchwork tells: "Please wrap lines in the body of the commit message 
> between 60 and 72 characters".
> When I do this, I get the following result:
> 
> -
> 
> Before:
> 
> overlay AVOptions:
>   x  ..FV... set the x expression 
> (default "0")
>   y  ..FV... set the y expression 
> (default "0")
>   eof_action..FV... Action to take when 
> encountering EOF from secondary input  (from 0 to 2) (default 
> repeat)
>  repeat  0..FV... Repeat the previous 
> frame.
>  endall  1..FV... End both streams.
>  pass2..FV... Pass through the main 
> input.
>   eval  ..FV... specify when to 
> evaluate expressions (from 0 to 1) (default frame)
> 
> After:
> a
> overlay AVOptions:
>x  ..FV... set the x expression 
> (default "0")
>y  ..FV... set the y expression 
> (default "0")
>eof_action..FV... Action to take when 
> encountering EOF from secondary input  (from 0 to 2) (default 
> repeat)
>  repeat  0..FV... Repeat the previous 
> frame.
>  endall  1..FV... End both streams.
>  pass2..FV... Pass through the main 
> input.
>eval  ..FV... specify when to 
> evaluate expressions (from 0 to 1) (default frame)
> 
> -
> 
> 
> Now I'm unsure.
> Should I really change the commit message to the above and resubmit?

I think its better to ignore Patchwork in this rare case

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/speexdec: Seed should be unsigned otherwise the operations done on it are undefined

2021-10-13 Thread Michael Niedermayer
On Tue, Oct 12, 2021 at 06:31:14PM +0200, Paul B Mahol wrote:
> ok

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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 01/10] avcodec/binkaudio: Remove AV_CODEC_CAP_DELAY

2021-10-13 Thread Paul B Mahol
LGTM
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v2 0/3] introduce public AVIOContext::bytes_{read, written}

2021-10-13 Thread Jan Ekström
After a brief discussion with Michael on IRC, this seems to be the idea of a
path forward that was agreed upon.

1. AVIOContext::written was supposed to be a private field [1], so move the
   value utilized internally to FFIOContext, and set the AVIOContext value
   from there.
2. Introduce public AVIOContext::bytes_{read,written} statistics fields.
3. Deprecate AVIOContext::written.

I was not sure whether deprecation or straight-out removal was the right thing
to do - since while the field was meant to be internal it was not marked as
such in FFmpeg's merged state of the struct (which is why it did not get
cleaned up into FFIOContext earlier) - but in order to not get stuck on that,
I am now posting this with the full deprecation changes. This way (hopefully)
this change will get more eyeballs and if someone thinks this could just be
removed the patches can be changed to do that instead.

[1] 
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=3f75e5116b900f1428aa13041fc7d6301bf1988a

Best regards,
Jan

Jan Ekström (3):
  avformat/avio: privatize point of truth for AVIOContext::written
  avformat/avio{,buf}: introduce public
AVIOContext::bytes_{read,written}
  avformat/avio{,buf}: deprecate AVIOContext::written

 doc/APIchanges  | 12 
 libavformat/avio.h  | 16 
 libavformat/avio_internal.h |  5 +
 libavformat/aviobuf.c   | 22 ++
 libavformat/version.h   |  5 -
 5 files changed, 55 insertions(+), 5 deletions(-)

-- 
2.31.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 1/3] avformat/avio: privatize point of truth for AVIOContext::written

2021-10-13 Thread Jan Ekström
Looking at 3f75e5116b900f1428aa13041fc7d6301bf1988a, the field
was supposed to be private, but during merging the field and the
group that had the comment about it got separated.

Thus, move the actual privately utilized state of this variable
into the private FFIOContext.
---
 libavformat/avio_internal.h |  5 +
 libavformat/aviobuf.c   | 11 +++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index eded38759b..28ea38079d 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -51,6 +51,11 @@ typedef struct FFIOContext {
  */
 int64_t bytes_read;
 
+/**
+ * Bytes written statistic
+ */
+int64_t bytes_written;
+
 /**
  * seek statistic
  */
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 3d87d66091..7afbff0266 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -164,8 +164,10 @@ static void writeout(AVIOContext *s, const uint8_t *data, 
int len)
 if (ret < 0) {
 s->error = ret;
 } else {
-if (s->pos + len > s->written)
-s->written = s->pos + len;
+if (s->pos + len > ctx->bytes_written) {
+ctx->bytes_written = s->pos + len;
+s->written = ctx->bytes_written;
+}
 }
 }
 if (ctx->current_type == AVIO_DATA_MARKER_SYNC_POINT ||
@@ -337,13 +339,14 @@ int64_t avio_skip(AVIOContext *s, int64_t offset)
 
 int64_t avio_size(AVIOContext *s)
 {
+FFIOContext *const ctx = ffiocontext(s);
 int64_t size;
 
 if (!s)
 return AVERROR(EINVAL);
 
-if (s->written)
-return s->written;
+if (ctx->bytes_written)
+return ctx->bytes_written;
 
 if (!s->seek)
 return AVERROR(ENOSYS);
-- 
2.31.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/3] avformat/avio{, buf}: introduce public AVIOContext::bytes_{read, written}

2021-10-13 Thread Jan Ekström
Such fields can be seen as generally useful in cases where the
API user is not implementing custom AVIO callbacks, but still would
like to know if data is being read or written out, such as in case
data is being read from input but no AVPacket has been received yet.
---
 doc/APIchanges|  3 +++
 libavformat/avio.h| 10 ++
 libavformat/aviobuf.c |  4 +++-
 libavformat/version.h |  2 +-
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7b267a79ac..806eaf4c83 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2021-09-26 - xx - lavf 59.7.100 - avio.h
+  Introduce public bytes_{read,written} statistic fields to AVIOContext.
+
 2021-09-21 - xx - lavu 57.7.100 - pixfmt.h
   Add AV_PIX_FMT_X2BGR10.
 
diff --git a/libavformat/avio.h b/libavformat/avio.h
index a7b56ab667..0f9a0f909f 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -297,6 +297,16 @@ typedef struct AVIOContext {
  * used keeping track of already written data for a later flush.
  */
 unsigned char *buf_ptr_max;
+
+/**
+ * Read-only statistic of bytes read for this AVIOContext.
+ */
+int64_t bytes_read;
+
+/**
+ * Read-only statistic of bytes written for this AVIOContext.
+ */
+int64_t bytes_written;
 } AVIOContext;
 
 /**
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 7afbff0266..436a264f83 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -165,7 +165,7 @@ static void writeout(AVIOContext *s, const uint8_t *data, 
int len)
 s->error = ret;
 } else {
 if (s->pos + len > ctx->bytes_written) {
-ctx->bytes_written = s->pos + len;
+s->bytes_written = ctx->bytes_written = s->pos + len;
 s->written = ctx->bytes_written;
 }
 }
@@ -575,6 +575,7 @@ static void fill_buffer(AVIOContext *s)
 s->buf_ptr = dst;
 s->buf_end = dst + len;
 ffiocontext(s)->bytes_read += len;
+s->bytes_read = ffiocontext(s)->bytes_read;
 }
 }
 
@@ -648,6 +649,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
 } else {
 s->pos += len;
 ffiocontext(s)->bytes_read += len;
+s->bytes_read = ffiocontext(s)->bytes_read;
 size -= len;
 buf += len;
 // reset the buffer
diff --git a/libavformat/version.h b/libavformat/version.h
index d5dd22059b..474640bb78 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   6
+#define LIBAVFORMAT_VERSION_MINOR   7
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.31.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 3/3] avformat/avio{, buf}: deprecate AVIOContext::written

2021-10-13 Thread Jan Ekström
Originally added as a private entry in commit
3f75e5116b900f1428aa13041fc7d6301bf1988a, but its grouping with
the comment noting its private state was missed during merging of
the field from Libav (most likely due to an already existing field
in between).

Users should migrate to the public field AVIOContext::bytes_written.
---
 doc/APIchanges| 9 +
 libavformat/avio.h| 6 ++
 libavformat/aviobuf.c | 9 +
 libavformat/version.h | 5 -
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 806eaf4c83..2fc964d80d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,15 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2021-10-13 - xx - lavf 59.8.100 - avio.h
+  Deprecate AVIOContext.written. Originally added as a private entry in
+  commit 3f75e5116b900f1428aa13041fc7d6301bf1988a, but its grouping with
+  the comment noting its private state was missed during merging of the field
+  from Libav (most likely due to an already existing field in between).
+
+  Users should migrate to the public field AVIOContext.bytes_written, which
+  returns the same value.
+
 2021-09-26 - xx - lavf 59.7.100 - avio.h
   Introduce public bytes_{read,written} statistic fields to AVIOContext.
 
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 0f9a0f909f..7d33e971cb 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -290,7 +290,13 @@ typedef struct AVIOContext {
  */
 int ignore_boundary_point;
 
+#if FF_API_AVIOCONTEXT_WRITTEN
+/**
+ * @deprecated AVIOContext::bytes_written should be utilized instead.
+ */
+attribute_deprecated
 int64_t written;
+#endif
 
 /**
  * Maximum reached position before a backward seek in the write buffer,
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 436a264f83..7a0cd27151 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -22,6 +22,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/crc.h"
 #include "libavutil/dict.h"
+#include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
@@ -124,7 +125,11 @@ void ffio_init_context(FFIOContext *ctx,
 ctx->current_type= AVIO_DATA_MARKER_UNKNOWN;
 ctx->last_time   = AV_NOPTS_VALUE;
 ctx->short_seek_get  = NULL;
+#if FF_API_AVIOCONTEXT_WRITTEN
+FF_DISABLE_DEPRECATION_WARNINGS
 s->written   = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
 
 AVIOContext *avio_alloc_context(
@@ -166,7 +171,11 @@ static void writeout(AVIOContext *s, const uint8_t *data, 
int len)
 } else {
 if (s->pos + len > ctx->bytes_written) {
 s->bytes_written = ctx->bytes_written = s->pos + len;
+#if FF_API_AVIOCONTEXT_WRITTEN
+FF_DISABLE_DEPRECATION_WARNINGS
 s->written = ctx->bytes_written;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
 }
 }
diff --git a/libavformat/version.h b/libavformat/version.h
index 474640bb78..81ed517609 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   7
+#define LIBAVFORMAT_VERSION_MINOR   8
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -61,6 +61,9 @@
 #ifndef FF_API_COMPUTE_PKT_FIELDS2
 #define FF_API_COMPUTE_PKT_FIELDS2  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #endif
+#ifndef FF_API_AVIOCONTEXT_WRITTEN
+#define FF_API_AVIOCONTEXT_WRITTEN  (LIBAVFORMAT_VERSION_MAJOR < 60)
+#endif
 
 
 #ifndef FF_API_R_FRAME_RATE
-- 
2.31.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] avfilter/vf_fftfilt: Use av_clip_uintp2

2021-10-13 Thread Martin Storsjö
The refactoring in 844890b1bc86316a38bc9e1dbf8ba0dd254307e3 caused
fate-source to point out that this could be av_clip_uintp2.

Signed-off-by: Martin Storsjö 
---
 libavfilter/vf_fftfilt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_fftfilt.c b/libavfilter/vf_fftfilt.c
index d5e49c345d..a59ef075ca 100644
--- a/libavfilter/vf_fftfilt.c
+++ b/libavfilter/vf_fftfilt.c
@@ -191,7 +191,7 @@ static int irdft_horizontal8(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_
 uint8_t *dst = out->data[plane] + i * out->linesize[plane];
 
 for (int j = 0; j < w; j++)
-dst[j] = av_clip(lrintf(src[j] * scale), 0, 255);
+dst[j] = av_clip_uintp2(lrintf(src[j] * scale), 8);
 }
 }
 
-- 
2.30.1 (Apple Git-130)

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