Re: [FFmpeg-devel] [PATCH] doc/filters: update SITI description

2023-02-28 Thread Werner Robitza
On Wed, Mar 1, 2023 at 1:15 AM Thilo Borgmann  wrote:
>
> Am 28.02.23 um 18:12 schrieb Werner Robitza:
> > On Tue, Feb 28, 2023 at 2:16 PM Thilo Borgmann  
> > wrote:
> >>
> >> Am 28.02.23 um 14:13 schrieb Thilo Borgmann:
> >>> Am 28.02.23 um 12:42 schrieb Werner Robitza:
>  The filter implements the 'legacy' version from a superseded 
>  recommendation.
>  ---
> doc/filters.texi | 8 +---
> 1 file changed, 5 insertions(+), 3 deletions(-)
> 
>  diff --git a/doc/filters.texi b/doc/filters.texi
>  index 47e92b9269..25574cd55c 100644
>  --- a/doc/filters.texi
>  +++ b/doc/filters.texi
>  @@ -21593,9 +21593,11 @@ ffmpeg -i input1.mkv -i input2.mkv 
>  -filter_complex "[0:v][1:v] signature=nb_inpu
> @anchor{siti}
> @section siti
>  -Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, 
>  as defined
>  -in ITU-T P.910: Subjective video quality assessment methods for 
>  multimedia
>  -applications. Available PDF at 
>  @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
>  +Calculate Spatial Information (SI) and Temporal Information (TI) scores 
>  for a video,
>  +as defined in ITU-T Rec. P.910 (11/21): Subjective video quality 
>  assessment methods
>  +for multimedia applications. Available PDF at 
>  @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
>  +Note that this is a legacy implementation that corresponds to a 
>  superseded recommendation.
>  +Refer to ITU-T Rec. P.910 (07/22) for the latest version.
> It accepts the following option:
> >>>
> >>> Ok.
> >>
> >> You might want to add the URL of the current spec, though:
> >> https://www.itu.int/rec/T-REC-P.910-202207-I/en
> >
> > Sure, patch attached.
>
> Looks better but wait - why did you change the implemented version from 09/99 
> to 11/21 in the first place?
> (Does this not even make it more wrong?)

No, as the (legacy) definition of SI/TI is the same, no matter if you
are using the version from '99 or '21. It was only changed in '22.
But it is common practice to refer to the latest versions of ITU-T
recommendations where possible.
(If only to avoid people looking at really outdated versions and then
citing/using something from those.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] lavc/avcodec.h: extend documentation for avcodec_open2()

2023-02-28 Thread zhilizhao(赵志立)


> On Mar 1, 2023, at 06:40, Stefano Sabatini  wrote:
> 
> On date Tuesday 2023-02-28 23:28:56 +0100, Stefano Sabatini wrote:
>> In particular, clarify how to set options in the codec context, and mention 
>> when to use
>> avcodec_parameters_to_context().
>> 
>> Fix trac issue http://trac.ffmpeg.org/ticket/5781.
>> ---
>> libavcodec/avcodec.h | 29 -
>> 1 file changed, 24 insertions(+), 5 deletions(-)
> 

> In particular, clarify how to set options in the codec context, and mention 
> when to use
> avcodec_parameters_to_context().
> 
> Fix trac issues:
> http://trac.ffmpeg.org/ticket/5781
> http://trac.ffmpeg.org/ticket/5838
> ---
>  libavcodec/avcodec.h | 34 +-
>  1 file changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 9a0fe97cad..fbf1d3d83c 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2418,8 +2418,14 @@ int avcodec_parameters_to_context(AVCodecContext 
> *codec,
>   * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
>   * retrieving a codec.
>   *
> - * @note Always call this function before using decoding routines (such as
> - * @ref avcodec_receive_frame()).
> + * Depending on the codec, you might need to set options in the codec context
> + * also for decoding (e.g. width, height, or the pixel or audio sample 
> format in
> + * case the information is not is not available in the bitstream, e.g. as in

'is not is not'

> + * case of decoding raw audio or video).

in ’the’ case of.

> + *
> + * Options on the codec context can be either set by providing the options
> + * specified in an AVDictionary, or by setting the values on the context 
> itself,
> + * directly or by using the av_opt_set() API.
>   *
>   * @code
>   * av_dict_set(, "b", "2.5M", 0);
> @@ -2433,17 +2439,35 @@ int avcodec_parameters_to_context(AVCodecContext 
> *codec,
>   * exit(1);
>   * @endcode
>   *
> + * In case AVCodecParameters are available (e.g. when demuxing a stream using
> + * libavformat, and accessing the AVStream contained in the demuxer), the 
> codec
> + * parameters can be copied to the codec context using
> + * avcodec_parameters_to_context(), as in the following code:
> + *
> + * @code
> + * context = avcodec_alloc_context3(codec);
> + * if (avcodec_parameters_to_context(*dec_ctx, codecpar) < 0)
> + * exit(1);
> + * if (avcodec_open2(context, codec, NULL) < 0)
> + * exit(1);

What’s the dec_ctx?

> + * @endcode
> + *
> + * @note Always call this function before using decoding routines (such as
> + * @ref avcodec_receive_frame()).
> + *
>   * @param avctx The context to initialize.
>   * @param codec The codec to open this context for. If a non-NULL codec has 
> been
>   *  previously passed to avcodec_alloc_context3() or
>   *  for this context, then this parameter MUST be either NULL or
>   *  equal to the previously passed codec.
> - * @param options A dictionary filled with AVCodecContext and codec-private 
> options.
> - *On return this object will be filled with options that 
> were not found.
> + * @param options A dictionary filled with AVCodecContext and codec-private
> + *options, which are set on top of the options already set in
> + *avctx, can be NULL. On return this object will be filled 
> with
> + *options that were not found in avctx.
>   *
>   * @return zero on success, a negative value on error
>   * @see avcodec_alloc_context3(), avcodec_find_decoder(), 
> avcodec_find_encoder(),
> - *  av_dict_set(), av_opt_find().
> + *  av_dict_set(), av_opt_set(), av_opt_find(), 
> avcodec_parameters_to_context()
>   */
>  int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary 
> **options);
>  
> -- 
> 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] libswresample/audioconvert: check whether input frame data is null pointer

2023-02-28 Thread xufuji456
---
 libswresample/audioconvert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswresample/audioconvert.c b/libswresample/audioconvert.c
index 1d75ba1495..b297514b1a 100644
--- a/libswresample/audioconvert.c
+++ b/libswresample/audioconvert.c
@@ -242,7 +242,7 @@ int swri_audio_convert(AudioConvert *ctx, AudioData *out, 
AudioData *in, int len
 const int is= ich < 0 ? 0 : (in->planar ? 1 : in->ch_count) * in->bps;
 const uint8_t *pi= ich < 0 ? ctx->silence : in->ch[ich];
 uint8_t *end, *po = out->ch[ch];
-if(!po)
+if(!po || !pi)
 continue;
 end = po + os * len;
 ctx->conv_f(po+off*os, pi+off*is, is, os, end);
-- 
2.32.0 (Apple Git-132)

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

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


Re: [FFmpeg-devel] [PATCH] doc/filters: update SITI description

2023-02-28 Thread Thilo Borgmann

Am 28.02.23 um 18:12 schrieb Werner Robitza:

On Tue, Feb 28, 2023 at 2:16 PM Thilo Borgmann  wrote:


Am 28.02.23 um 14:13 schrieb Thilo Borgmann:

Am 28.02.23 um 12:42 schrieb Werner Robitza:

The filter implements the 'legacy' version from a superseded recommendation.
---
   doc/filters.texi | 8 +---
   1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 47e92b9269..25574cd55c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21593,9 +21593,11 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex 
"[0:v][1:v] signature=nb_inpu
   @anchor{siti}
   @section siti
-Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as 
defined
-in ITU-T P.910: Subjective video quality assessment methods for multimedia
-applications. Available PDF at 
@url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
+Calculate Spatial Information (SI) and Temporal Information (TI) scores for a 
video,
+as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment 
methods
+for multimedia applications. Available PDF at 
@url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
+Note that this is a legacy implementation that corresponds to a superseded 
recommendation.
+Refer to ITU-T Rec. P.910 (07/22) for the latest version.
   It accepts the following option:


Ok.


You might want to add the URL of the current spec, though:
https://www.itu.int/rec/T-REC-P.910-202207-I/en


Sure, patch attached.


Looks better but wait - why did you change the implemented version from 09/99 
to 11/21 in the first place?
(Does this not even make it more wrong?)

-Thilo


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

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


Re: [FFmpeg-devel] [PATCH] lavfi/buffersrc: issue more specific error in case of invalid parameters

2023-02-28 Thread Stefano Sabatini
On date Wednesday 2023-03-01 01:01:26 +0100, Stefano Sabatini wrote:
> ---
>  libavfilter/buffersrc.c | 13 ++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
> index ba17450b93..ea9556d691 100644
> --- a/libavfilter/buffersrc.c
> +++ b/libavfilter/buffersrc.c
> @@ -273,9 +273,16 @@ static av_cold int init_video(AVFilterContext *ctx)
>  {
>  BufferSourceContext *c = ctx->priv;
>  
> -if (c->pix_fmt == AV_PIX_FMT_NONE || !c->w || !c->h ||
> -av_q2d(c->time_base) <= 0) {
> -av_log(ctx, AV_LOG_ERROR, "Invalid parameters provided.\n");
> +if (c->pix_fmt == AV_PIX_FMT_NONE) {
> +av_log(ctx, AV_LOG_ERROR, "Unspecified pixel format\n");
> +return AVERROR(EINVAL);
> +}
> +if (!c->w || !c->h) {
> +av_log(ctx, AV_LOG_ERROR, "Invalid null size %dx%d\n", c->w, c->h);
> +return AVERROR(EINVAL);
> +}
> +if (av_q2d(c->time_base) <= 0) {
> +av_log(ctx, AV_LOG_ERROR, "Invalid time base %d/%d\n", 
> c->time_base.num, c->time_base.den);
>  return AVERROR(EINVAL);
>  }

BTW, I noticied this as part of debugging transcode.c (which looks
broken at the moment), since the timebase is read as 0/1 from the
decoder context, it would be a valid value when reading from the
AVStream (but this information is not copied by
avcodec_parameters_to_context). In decode_filter_video.c this is
indeed "fixed" by copying the timebase directly from the AVStream.

Is this expected? Shouldn't the timebase be copied to the decoder
context?
___
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] src/template_head2: Make "community" a seperate page containing Organisation and Code of Conduct.

2023-02-28 Thread Thilo Borgmann

Am 22.02.23 um 13:35 schrieb Thilo Borgmann:

Am 08.02.23 um 16:48 schrieb Thilo Borgmann:

Forgot to put this in the subject, this patch is for ffmpeg-web, of course.

-Thilo

Am 08.02.23 um 16:47 schrieb Thilo Borgmann:

---
  src/template_head2 | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)


Pushing soon.


Pushed.

Thanks,
Thilo

___
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] doc/dev_community: add the addresses of the committees

2023-02-28 Thread Thilo Borgmann

Am 22.02.23 um 13:34 schrieb Thilo Borgmann:

Am 08.02.23 um 16:57 schrieb Thilo Borgmann:

From: Nicolas George 

Omitting the .org from the address should be protection enough
against spam spiders.

Signed-off-by: Nicolas George 
---
  doc/dev_community/community.md | 4 
  1 file changed, 4 insertions(+)

diff --git a/doc/dev_community/community.md b/doc/dev_community/community.md
index 21e08e20e3..59519393e2 100644
--- a/doc/dev_community/community.md
+++ b/doc/dev_community/community.md
@@ -55,6 +55,8 @@ Candidates for election can either be suggested or 
self-nominated.
  The conflict resolution process is detailed in the [resolution 
process](resolution_process.md) document.
+The TC can be contacted at .
+
  ## Community committee
  The Community Committee (CC) is here to arbitrage and make decisions when
@@ -77,3 +79,5 @@ The members of the CC can be elected from outside of the GA.
  Candidates for election can either be suggested or self-nominated.
  The CC is governed by and responsible for enforcing the Code of Conduct.
+
+The CC can be contacted at .


Pushing both soon.


Pushed.

Thanks,
Thilo

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

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


[FFmpeg-devel] [PATCH] lavfi/buffersrc: issue more specific error in case of invalid parameters

2023-02-28 Thread Stefano Sabatini
---
 libavfilter/buffersrc.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index ba17450b93..ea9556d691 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -273,9 +273,16 @@ static av_cold int init_video(AVFilterContext *ctx)
 {
 BufferSourceContext *c = ctx->priv;
 
-if (c->pix_fmt == AV_PIX_FMT_NONE || !c->w || !c->h ||
-av_q2d(c->time_base) <= 0) {
-av_log(ctx, AV_LOG_ERROR, "Invalid parameters provided.\n");
+if (c->pix_fmt == AV_PIX_FMT_NONE) {
+av_log(ctx, AV_LOG_ERROR, "Unspecified pixel format\n");
+return AVERROR(EINVAL);
+}
+if (!c->w || !c->h) {
+av_log(ctx, AV_LOG_ERROR, "Invalid null size %dx%d\n", c->w, c->h);
+return AVERROR(EINVAL);
+}
+if (av_q2d(c->time_base) <= 0) {
+av_log(ctx, AV_LOG_ERROR, "Invalid time base %d/%d\n", 
c->time_base.num, c->time_base.den);
 return AVERROR(EINVAL);
 }
 
-- 
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 5/8] lavc/libvpxenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE

2023-02-28 Thread James Almer

On 2/28/2023 9:01 AM, Anton Khirnov wrote:

+#if FF_API_REORDERED_OPAQUE
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->reordered_opaque = fd.reordered_opaque;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif


If this was not being set before this patch, does it make sense at all 
to set it considering it's a deprecated field? I remember for example we 
would not fill avctx->coded_frame on new encoders after it was deprecated.

___
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] libavcodec/libfdk-aacnc: send encoder delay/padding in packet side data

2023-02-28 Thread JonHGee
Signed-off-by: JonHGee 
---
 libavcodec/libfdk-aacenc.c | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 54549de473..954ddab07f 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "audio_frame_queue.h"
@@ -46,6 +47,7 @@ typedef struct AACContext {
 int latm;
 int header_period;
 int vbr;
+int delay_sent;
 
 AudioFrameQueue afq;
 } AACContext;
@@ -368,7 +370,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
 int out_buffer_identifier = OUT_BITSTREAM_DATA;
 int out_buffer_size, out_buffer_element_size;
 void *in_ptr, *out_ptr;
-int ret;
+int ret, discard_padding;
 uint8_t dummy_buf[1];
 AACENC_ERROR err;
 
@@ -428,6 +430,27 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 ff_af_queue_remove(>afq, avctx->frame_size, >pts,
>duration);
 
+discard_padding = avctx->frame_size - avpkt->duration;
+// Check if subtraction resulted in an overflow
+if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) {
+av_log(avctx, AV_LOG_ERROR, "discard padding overflow\n");
+av_packet_unref(avpkt);
+return AVERROR(EINVAL);
+}
+if ((!s->delay_sent && avctx->initial_padding > 0) || discard_padding > 0) 
{
+uint8_t *side_data =
+av_packet_new_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
+if (!side_data) {
+av_packet_unref(avpkt);
+return AVERROR(ENOMEM);
+}
+if (!s->delay_sent) {
+AV_WL32(side_data, avctx->initial_padding);
+s->delay_sent = 1;
+}
+AV_WL32(side_data + 4, discard_padding);
+}
+
 avpkt->size = out_args.numOutBytes;
 *got_packet_ptr = 1;
 return 0;
-- 
2.39.2.722.g9855ee24e9-goog

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

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


Re: [FFmpeg-devel] [PATCH] Use https for repository links

2023-02-28 Thread Stefano Sabatini
On date Tuesday 2023-02-28 20:27:12 +0100, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  CREDITS| 4 ++--
>  doc/authors.texi   | 4 ++--
>  doc/git-howto.texi | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)

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


Re: [FFmpeg-devel] [PATCH] lavc/avcodec.h: extend documentation for avcodec_open2()

2023-02-28 Thread Stefano Sabatini
On date Tuesday 2023-02-28 23:28:56 +0100, Stefano Sabatini wrote:
> In particular, clarify how to set options in the codec context, and mention 
> when to use
> avcodec_parameters_to_context().
> 
> Fix trac issue http://trac.ffmpeg.org/ticket/5781.
> ---
>  libavcodec/avcodec.h | 29 -
>  1 file changed, 24 insertions(+), 5 deletions(-)

Updated with some more information, after I realized there was another
related issue.
>From e4e5622d1c4eac5dde4065b260523e4fd9ada85c Mon Sep 17 00:00:00 2001
From: Stefano Sabatini 
Date: Tue, 28 Feb 2023 23:26:43 +0100
Subject: [PATCH] lavc/avcodec.h: extend documentation for avcodec_open2()

In particular, clarify how to set options in the codec context, and mention when to use
avcodec_parameters_to_context().

Fix trac issues:
http://trac.ffmpeg.org/ticket/5781
http://trac.ffmpeg.org/ticket/5838
---
 libavcodec/avcodec.h | 34 +-
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 9a0fe97cad..fbf1d3d83c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2418,8 +2418,14 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
  * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
  * retrieving a codec.
  *
- * @note Always call this function before using decoding routines (such as
- * @ref avcodec_receive_frame()).
+ * Depending on the codec, you might need to set options in the codec context
+ * also for decoding (e.g. width, height, or the pixel or audio sample format in
+ * case the information is not is not available in the bitstream, e.g. as in
+ * case of decoding raw audio or video).
+ *
+ * Options on the codec context can be either set by providing the options
+ * specified in an AVDictionary, or by setting the values on the context itself,
+ * directly or by using the av_opt_set() API.
  *
  * @code
  * av_dict_set(, "b", "2.5M", 0);
@@ -2433,17 +2439,35 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
  * exit(1);
  * @endcode
  *
+ * In case AVCodecParameters are available (e.g. when demuxing a stream using
+ * libavformat, and accessing the AVStream contained in the demuxer), the codec
+ * parameters can be copied to the codec context using
+ * avcodec_parameters_to_context(), as in the following code:
+ *
+ * @code
+ * context = avcodec_alloc_context3(codec);
+ * if (avcodec_parameters_to_context(*dec_ctx, codecpar) < 0)
+ * exit(1);
+ * if (avcodec_open2(context, codec, NULL) < 0)
+ * exit(1);
+ * @endcode
+ *
+ * @note Always call this function before using decoding routines (such as
+ * @ref avcodec_receive_frame()).
+ *
  * @param avctx The context to initialize.
  * @param codec The codec to open this context for. If a non-NULL codec has been
  *  previously passed to avcodec_alloc_context3() or
  *  for this context, then this parameter MUST be either NULL or
  *  equal to the previously passed codec.
- * @param options A dictionary filled with AVCodecContext and codec-private options.
- *On return this object will be filled with options that were not found.
+ * @param options A dictionary filled with AVCodecContext and codec-private
+ *options, which are set on top of the options already set in
+ *avctx, can be NULL. On return this object will be filled with
+ *options that were not found in avctx.
  *
  * @return zero on success, a negative value on error
  * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
- *  av_dict_set(), av_opt_find().
+ *  av_dict_set(), av_opt_set(), av_opt_find(), avcodec_parameters_to_context()
  */
 int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
 
-- 
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] lavc/avcodec.h: extend documentation for avcodec_open2()

2023-02-28 Thread Stefano Sabatini
In particular, clarify how to set options in the codec context, and mention 
when to use
avcodec_parameters_to_context().

Fix trac issue http://trac.ffmpeg.org/ticket/5781.
---
 libavcodec/avcodec.h | 29 -
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 9a0fe97cad..2b7fb27721 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2418,8 +2418,9 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
  * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
  * retrieving a codec.
  *
- * @note Always call this function before using decoding routines (such as
- * @ref avcodec_receive_frame()).
+ * Options on the codec context can be either set by providing the options
+ * specified in an AVDictionary, or by setting the values on the context 
itself,
+ * directly or by using the av_opt_set() API.
  *
  * @code
  * av_dict_set(, "b", "2.5M", 0);
@@ -2433,17 +2434,35 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
  * exit(1);
  * @endcode
  *
+ * In case AVCodecParameters are available (e.g. when demuxing a stream using
+ * libavformat, and accessing the AVStream contained in the demuxer), the codec
+ * parameters can be copied to the codec context using
+ * avcodec_parameters_to_context(), as in the following code:
+ *
+ * @code
+ * context = avcodec_alloc_context3(codec);
+ * if (avcodec_parameters_to_context(*dec_ctx, codecpar) < 0)
+ * exit(1);
+ * if (avcodec_open2(context, codec, NULL) < 0)
+ * exit(1);
+ * @endcode
+ *
+ * @note Always call this function before using decoding routines (such as
+ * @ref avcodec_receive_frame()).
+ *
  * @param avctx The context to initialize.
  * @param codec The codec to open this context for. If a non-NULL codec has 
been
  *  previously passed to avcodec_alloc_context3() or
  *  for this context, then this parameter MUST be either NULL or
  *  equal to the previously passed codec.
- * @param options A dictionary filled with AVCodecContext and codec-private 
options.
- *On return this object will be filled with options that were 
not found.
+ * @param options A dictionary filled with AVCodecContext and codec-private
+ *options, which are set on top of the options already set in
+ *avctx, can be NULL. On return this object will be filled with
+ *options that were not found in avctx.
  *
  * @return zero on success, a negative value on error
  * @see avcodec_alloc_context3(), avcodec_find_decoder(), 
avcodec_find_encoder(),
- *  av_dict_set(), av_opt_find().
+ *  av_dict_set(), av_opt_set(), av_opt_find(), 
avcodec_parameters_to_context()
  */
 int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary 
**options);
 
-- 
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] libavcodec/libfdk-aacenc: Enable writing DRC metadata

2023-02-28 Thread Martin Storsjö

On Tue, 28 Feb 2023, Jonathan Gee wrote:


Looks mostly good to me now, thanks. I guess I can clean up the remaining
few nitpicks without you having to resubmit the patch. So unless you
disagree with the comments, I can push it with the minor touch-ups.

// Martin



Sounds good to me.  No disagreements here.  Thank you for going over
the patch!


Ok, pushed this one now then.

// Martin

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

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


Re: [FFmpeg-devel] [PATCH] libavcodec/libfdk-aacenc: Enable writing DRC metadata

2023-02-28 Thread Jonathan Gee
> Looks mostly good to me now, thanks. I guess I can clean up the remaining
> few nitpicks without you having to resubmit the patch. So unless you
> disagree with the comments, I can push it with the minor touch-ups.
>
> // Martin
>

Sounds good to me.  No disagreements here.  Thank you for going over
the patch!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavcodec/libfdk-aacenc: Enable writing DRC metadata

2023-02-28 Thread Martin Storsjö

On Tue, 28 Feb 2023, JonHGee wrote:


Signed-off-by: JonHGee 
---
libavcodec/libfdk-aacenc.c | 69 +++---
1 file changed, 56 insertions(+), 13 deletions(-)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 54549de473..123dabf3ae 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -46,6 +46,13 @@ typedef struct AACContext {
int latm;
int header_period;
int vbr;
+int drc_profile;
+int drc_target_ref;
+int comp_profile;
+int comp_target_ref;
+int prog_ref;
+int metadata_mode;
+AACENC_MetaData metaDataSetup;

AudioFrameQueue afq;
} AACContext;
@@ -64,6 +71,11 @@ static const AVOption aac_enc_options[] = {
{ "latm", "Output LATM/LOAS encapsulated data", offsetof(AACContext, latm), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "header_period", "StreamMuxConfig and PCE repetition period (in frames)", 
offsetof(AACContext, header_period), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0x, 
AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "vbr", "VBR mode (1-5)", offsetof(AACContext, vbr), AV_OPT_TYPE_INT, { 
.i64 = 0 }, 0, 5, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "drc_profile", "The desired compression profile for AAC DRC", 
offsetof(AACContext, drc_profile), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 256, AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_ENCODING_PARAM },


The indentation is still off here


+{ "drc_target_ref", "Expected target reference level at decoder side in dB (for 
clipping prevention/limiter)", offsetof(AACContext, drc_target_ref), AV_OPT_TYPE_INT, { .i64 = 
0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "comp_profile", "The desired compression profile for AAC DRC", 
offsetof(AACContext, comp_profile), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 256, AV_OPT_FLAG_AUDIO_PARAM 
| AV_OPT_FLAG_ENCODING_PARAM },
+{ "comp_target_ref", "Expected target reference level at decoder side in dB 
(for clipping prevention/limiter)", offsetof(AACContext, comp_target_ref), AV_OPT_TYPE_INT, { 
.i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "prog_ref", "The program reference level or dialog level in dB", 
offsetof(AACContext, prog_ref), AV_OPT_TYPE_INT, { .i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM 
| AV_OPT_FLAG_ENCODING_PARAM },
FF_AAC_PROFILE_OPTS
{ NULL }
};
@@ -319,6 +331,30 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
}
}

+s->metadata_mode = 0;
+if (s->prog_ref) {
+s->metadata_mode = 1;
+s->metaDataSetup.prog_ref_level_present = 1;
+s->metaDataSetup.prog_ref_level = s->prog_ref << 16;
+}
+if (s->drc_profile) {
+s->metadata_mode = 1;
+s->metaDataSetup.drc_profile = s->drc_profile;
+s->metaDataSetup.drc_TargetRefLevel = s->drc_target_ref << 16;
+if (s->comp_profile) {
+/* Including the comp_profile means that we need to set the mode 
to ETSI */
+s->metadata_mode = 2;
+s->metaDataSetup.comp_profile = s->comp_profile;
+s->metaDataSetup.comp_TargetRefLevel = s->comp_target_ref << 16;
+}
+}
+
+if ((err = aacEncoder_SetParam(s->handle, AACENC_METADATA_MODE, 
s->metadata_mode)) != AACENC_OK) {
+av_log(avctx, AV_LOG_ERROR, "Unable to set metadata mode to %d: %s\n",
+s->metadata_mode, aac_get_error(err));
+goto error;
+}
+
if ((err = aacEncEncode(s->handle, NULL, NULL, NULL, NULL)) != AACENC_OK) {
av_log(avctx, AV_LOG_ERROR, "Unable to initialize the encoder: %s\n",
   aac_get_error(err));
@@ -363,11 +399,13 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
AACENC_BufDesc in_buf   = { 0 }, out_buf = { 0 };
AACENC_InArgs  in_args  = { 0 };
AACENC_OutArgs out_args = { 0 };
-int in_buffer_identifier = IN_AUDIO_DATA;
-int in_buffer_size, in_buffer_element_size;
+void* inBuffer[] = { 0, >metaDataSetup };
+int in_buffer_identifiers[] = { IN_AUDIO_DATA, IN_METADATA_SETUP };
+int in_buffer_element_sizes[]   = { 2, sizeof(AACENC_MetaData) };


Still have the extra weird whitespace here


+int in_buffer_sizes[] = { 0 , sizeof(s->metaDataSetup) };


Extra space before comma


+void *out_ptr;
int out_buffer_identifier = OUT_BITSTREAM_DATA;
int out_buffer_size, out_buffer_element_size;
-void *in_ptr, *out_ptr;
int ret;
uint8_t dummy_buf[1];
AACENC_ERROR err;
@@ -376,13 +414,12 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
if (!frame) {
/* Must be a non-null pointer, even if it's a dummy. We could use
 * the address of anything else on the stack as well. */
-in_ptr   = dummy_buf;
-in_buffer_size   = 0;
+inBuffer[0]  = dummy_buf;


Re: [FFmpeg-devel] [PATCH 1/2] ffmpeg_demux: show fixed timestamps in ts_fixup

2023-02-28 Thread Stefano Sabatini
On date Saturday 2023-02-11 01:12:18 +0100, Stefano Sabatini wrote:
> On date Monday 2023-02-06 02:22:24 +0100, Stefano Sabatini wrote:
> > Help debugging.
> > ---
> >  fftools/ffmpeg_demux.c | 21 +
> >  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> Will apply in a few days.
> 
> BTW are categories exposed through the CLI (for example to only enable
> debug logs for a given category)?

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


Re: [FFmpeg-devel] [PATCH] doc/ffmpeg: extend -dts_delta_threshold option description

2023-02-28 Thread Stefano Sabatini
On date Monday 2023-02-20 18:57:44 +0100, Anton Khirnov wrote:
> Quoting Stefano Sabatini (2023-02-11 03:30:00)
> > On date Thursday 2023-02-09 00:41:18 +0100, Michael Niedermayer wrote:
> > > On Mon, Feb 06, 2023 at 02:25:23AM +0100, Stefano Sabatini wrote:
> > [...]
> > > > Subject: [PATCH 2/2] ffmpeg: review -dts_delta_threshold and 
> > > > -dts_delta_error
> > > >  options
> > > > 
> > > > Review handling of -dts_delta_threshold and -dts_delta_error options,
> > > > specify them as floating point expressed in seconds.
> 
> Maybe it's a bit nitpicky, but these are decimal numbers, not floating
> point.

Fixed and pushed, thanks.
___
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] libavcodec/libfdk-aacenc: Enable writing DRC metadata

2023-02-28 Thread JonHGee
Signed-off-by: JonHGee 
---
 libavcodec/libfdk-aacenc.c | 69 +++---
 1 file changed, 56 insertions(+), 13 deletions(-)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 54549de473..123dabf3ae 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -46,6 +46,13 @@ typedef struct AACContext {
 int latm;
 int header_period;
 int vbr;
+int drc_profile;
+int drc_target_ref;
+int comp_profile;
+int comp_target_ref;
+int prog_ref;
+int metadata_mode;
+AACENC_MetaData metaDataSetup;
 
 AudioFrameQueue afq;
 } AACContext;
@@ -64,6 +71,11 @@ static const AVOption aac_enc_options[] = {
 { "latm", "Output LATM/LOAS encapsulated data", offsetof(AACContext, 
latm), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_ENCODING_PARAM },
 { "header_period", "StreamMuxConfig and PCE repetition period (in 
frames)", offsetof(AACContext, header_period), AV_OPT_TYPE_INT, { .i64 = 0 }, 
0, 0x, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
 { "vbr", "VBR mode (1-5)", offsetof(AACContext, vbr), AV_OPT_TYPE_INT, { 
.i64 = 0 }, 0, 5, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "drc_profile", "The desired compression profile for AAC DRC", 
offsetof(AACContext, drc_profile), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 256, 
AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "drc_target_ref", "Expected target reference level at decoder side in dB 
(for clipping prevention/limiter)", offsetof(AACContext, drc_target_ref), 
AV_OPT_TYPE_INT, { .i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_ENCODING_PARAM },
+{ "comp_profile", "The desired compression profile for AAC DRC", 
offsetof(AACContext, comp_profile), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 256, 
AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "comp_target_ref", "Expected target reference level at decoder side in 
dB (for clipping prevention/limiter)", offsetof(AACContext, comp_target_ref), 
AV_OPT_TYPE_INT, { .i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_ENCODING_PARAM },
+{ "prog_ref", "The program reference level or dialog level in dB", 
offsetof(AACContext, prog_ref), AV_OPT_TYPE_INT, { .i64 = 0.0 }, -31.75, 0, 
AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
 FF_AAC_PROFILE_OPTS
 { NULL }
 };
@@ -319,6 +331,30 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
 }
 }
 
+s->metadata_mode = 0;
+if (s->prog_ref) {
+s->metadata_mode = 1;
+s->metaDataSetup.prog_ref_level_present = 1;
+s->metaDataSetup.prog_ref_level = s->prog_ref << 16;
+}
+if (s->drc_profile) {
+s->metadata_mode = 1;
+s->metaDataSetup.drc_profile = s->drc_profile;
+s->metaDataSetup.drc_TargetRefLevel = s->drc_target_ref << 16;
+if (s->comp_profile) {
+/* Including the comp_profile means that we need to set the mode 
to ETSI */
+s->metadata_mode = 2;
+s->metaDataSetup.comp_profile = s->comp_profile;
+s->metaDataSetup.comp_TargetRefLevel = s->comp_target_ref << 16;
+}
+}
+
+if ((err = aacEncoder_SetParam(s->handle, AACENC_METADATA_MODE, 
s->metadata_mode)) != AACENC_OK) {
+av_log(avctx, AV_LOG_ERROR, "Unable to set metadata mode to %d: %s\n",
+s->metadata_mode, aac_get_error(err));
+goto error;
+}
+
 if ((err = aacEncEncode(s->handle, NULL, NULL, NULL, NULL)) != AACENC_OK) {
 av_log(avctx, AV_LOG_ERROR, "Unable to initialize the encoder: %s\n",
aac_get_error(err));
@@ -363,11 +399,13 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 AACENC_BufDesc in_buf   = { 0 }, out_buf = { 0 };
 AACENC_InArgs  in_args  = { 0 };
 AACENC_OutArgs out_args = { 0 };
-int in_buffer_identifier = IN_AUDIO_DATA;
-int in_buffer_size, in_buffer_element_size;
+void* inBuffer[] = { 0, >metaDataSetup };
+int in_buffer_identifiers[] = { IN_AUDIO_DATA, IN_METADATA_SETUP };
+int in_buffer_element_sizes[]   = { 2, sizeof(AACENC_MetaData) };
+int in_buffer_sizes[] = { 0 , sizeof(s->metaDataSetup) };
+void *out_ptr;
 int out_buffer_identifier = OUT_BITSTREAM_DATA;
 int out_buffer_size, out_buffer_element_size;
-void *in_ptr, *out_ptr;
 int ret;
 uint8_t dummy_buf[1];
 AACENC_ERROR err;
@@ -376,13 +414,12 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 if (!frame) {
 /* Must be a non-null pointer, even if it's a dummy. We could use
  * the address of anything else on the stack as well. */
-in_ptr   = dummy_buf;
-in_buffer_size   = 0;
+inBuffer[0]  = dummy_buf;
 
 in_args.numInSamples = -1;
 } else {
-in_ptr   = frame->data[0];
-in_buffer_size   = 2 * 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function

2023-02-28 Thread James Zern
On Tue, Feb 28, 2023 at 12:49 PM James Almer  wrote:
>
> On 2/28/2023 5:40 PM, James Zern wrote:
> > On Tue, Feb 28, 2023 at 4:07 AM James Almer  wrote:
> >>
> >> It's used only by the encoder.
> >>
> >
> > It sets AVCodec.pix_fmts, but maybe the values reported aren't used
> > meaningfully.
>
> Indeed, they aren't. AVCodec.pix_fmts is a list of formats an encoder
> accepts as input. Decoders don't use that array.
>

lgtm. The documentation for that field maybe could use some
clarification. A few other decoders look to set this, h263dec being
one.

> >
> >> Signed-off-by: James Almer 
> >> ---
> >>   libavcodec/libvpxdec.c | 1 -
> >>   1 file changed, 1 deletion(-)
> >>
> >> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
> >> index 0ae19c3f72..8e6291fe20 100644
> >> --- a/libavcodec/libvpxdec.c
> >> +++ b/libavcodec/libvpxdec.c
> >> @@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = {
> >>   FF_CODEC_DECODE_CB(vpx_decode),
> >>   .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
> >> FF_CODEC_CAP_AUTO_THREADS,
> >> -.init_static_data = ff_vp9_init_static,
> >>   };
> >>   #endif /* CONFIG_LIBVPX_VP9_DECODER */
> >> --
> >> 2.39.2
> >>
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 8/8] lavc/libvpxenc: drop FrameListData.duration

2023-02-28 Thread James Zern
On Tue, Feb 28, 2023 at 4:02 AM Anton Khirnov  wrote:
>
> It is write-only.
> ---
>  libavcodec/libvpxenc.c | 3 ---
>  1 file changed, 3 deletions(-)
>

libaomenc.c transfers this to AVPacket. You added this in:
  7cf161abe5 lavc/libaomenc: pass through frame durations to encoded packets
Should the same be done here?
___
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] Website release notes for 6.0

2023-02-28 Thread Lynne
Feb 28, 2023, 20:47 by mich...@niedermayer.cc:

> Hi
>
> On Tue, Feb 28, 2023 at 08:44:01PM +0100, Marton Balint wrote:
>
>>
>>
>> On Tue, 28 Feb 2023, Lynne wrote:
>>
>> > Feb 28, 2023, 10:59 by d...@lynne.ee:
>> > 
>> > > Feb 28, 2023, 10:41 by d...@lynne.ee:
>> > > 
>> > > > Wrote the release notes for 6.0, containing an
>> > > > explanation of the new releases/ABI bump details,
>> > > > and an overview of what has changed.
>> > > > 
>> > > > Patch attached.
>> > > > 
>> > 
>> > Ping, release has been tagged for quite a while now.
>> > Final version:
>> > 
>> >     A new major release, FFmpeg 6.0 
>> > "Von Neumann",
>> >     is now available for download. This release has many new encoders and 
>> > decoders, filters,
>> >     ffmpeg CLI tool improvements, and also, changes the way releases are 
>> > done. All major
>> >     releases will now bump the version of the ABI. We plan to have a new 
>> > major release each
>> >     year. Another release-specific change is that deprecated APIs will be 
>> > removed after 3
>> >     releases, upon the next major bump. The last minor release of a major 
>> > version will be an
>> >     LTS release.
>>
>> For some reason LTS releases were only planned for every second year:
>>
>> https://ftp.belnet.be/mirror/FOSDEM/video/2023/K.3.401/om_vlc.webm#t=724
>>
>> So I'd remove the last sentence until this is clarified.
>>
>
> patch LGTM with the change
>

Applied the change and pushed, thanks
___
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 6/8] lavc/libvpxenc: drop a useless condition

2023-02-28 Thread James Zern
On Tue, Feb 28, 2023 at 4:02 AM Anton Khirnov  wrote:
>
> A non-NULL packet is always passed to frame_data_apply().
> ---
>  libavcodec/libvpxenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

lgtm

> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index af16e53deb..33f35bbaf4 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -401,7 +401,7 @@ static int frame_data_apply(AVCodecContext *avctx, AVFifo 
> *fifo, AVPacket *pkt)
>  {
>  FrameData fd;
>  uint8_t *data;
> -if (!pkt || av_fifo_peek(fifo, , 1, 0) < 0)
> +if (av_fifo_peek(fifo, , 1, 0) < 0)
>  return 0;
>  if (fd.pts != pkt->pts)
>  return 0;
> --
> 2.39.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 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 5/8] lavc/libvpxenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE

2023-02-28 Thread James Zern
On Tue, Feb 28, 2023 at 4:01 AM Anton Khirnov  wrote:
>
> ---
>  libavcodec/libvpxenc.c | 139 +
>  libavcodec/version.h   |   2 +-
>  2 files changed, 100 insertions(+), 41 deletions(-)
>

lgtm

> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 77921badba..af16e53deb 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -68,6 +68,14 @@ struct FrameListData {
>
>  typedef struct FrameData {
>  int64_t pts;
> +int64_t duration;
> +
> +#if FF_API_REORDERED_OPAQUE
> +int64_t  reordered_opaque;
> +#endif
> +void*frame_opaque;
> +AVBufferRef *frame_opaque_ref;
> +
>  AVBufferRef *hdr10_plus;
>  } FrameData;
>
> @@ -329,32 +337,101 @@ static av_cold void free_frame_list(struct 
> FrameListData *list)
>  }
>  }
>
> +static void frame_data_uninit(FrameData *fd)
> +{
> +av_buffer_unref(>frame_opaque_ref);
> +av_buffer_unref(>hdr10_plus);
> +}
> +
>  static av_cold void fifo_free(AVFifo **fifo)
>  {
>  FrameData fd;
>  while (av_fifo_read(*fifo, , 1) >= 0)
> -av_buffer_unref(_plus);
> +frame_data_uninit();
>  av_fifo_freep2(fifo);
>  }
>
> -static int frame_data_apply(AVFifo *fifo, AVPacket *pkt)
> +static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo,
> + const AVFrame *frame)
> +{
> +VPxContext *ctx = avctx->priv_data;
> +const struct vpx_codec_enc_cfg *enccfg = ctx->encoder.config.enc;
> +
> +FrameDatafd = { .pts = frame->pts };
> +

The alignment of this declaration looks strange.

> +AVFrameSideData *av_uninit(sd);
> +int ret;
> +
> +#if CONFIG_LIBVPX_VP9_ENCODER
> +// Keep HDR10+ if it has bit depth higher than 8 and
> +// it has PQ trc (SMPTE2084).

Out of curiosity are there any HDR10+ files in fate?

> [...]
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 06631ffa8c..789d9047c2 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -30,7 +30,7 @@
>  #include "version_major.h"
>
>  #define LIBAVCODEC_VERSION_MINOR   4
> -#define LIBAVCODEC_VERSION_MICRO 100
> +#define LIBAVCODEC_VERSION_MICRO 101
>

This needs a rebase to apply cleanly.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 4/8] lavc/libvpxenc: rename hdr10_plus_fifo and related objects

2023-02-28 Thread James Zern
On Tue, Feb 28, 2023 at 4:02 AM Anton Khirnov  wrote:
>
> This AVFifo is used to propagate HDR metadata from input frames to
> output packets, since libvpx does not allow passing through arbitrary
> user data.
>
> It will be extended to pass through other kinds of data in future
> commits, so give it a more generic name.
> ---
>  libavcodec/libvpxenc.c | 51 +-
>  1 file changed, 26 insertions(+), 25 deletions(-)
>

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


Re: [FFmpeg-devel] [PATCH 3/8] lavc/libvpxenc: reindent

2023-02-28 Thread James Zern
On Tue, Feb 28, 2023 at 4:01 AM Anton Khirnov  wrote:
>
> ---
>  libavcodec/libvpxenc.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>

lgtm.

> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index eaa4ad8f25..abaa8c3513 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -1284,11 +1284,11 @@ static int storeframe(AVCodecContext *avctx, struct 
> FrameListData *cx_frame,
>  AV_WB64(side_data, 1);
>  memcpy(side_data + 8, alpha_cx_frame->buf, alpha_cx_frame->sz);
>  }
> -if (ctx->hdr10_plus_fifo) {
> -int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
> -if (err < 0)
> -return err;
> -}
> +if (ctx->hdr10_plus_fifo) {
> +int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
> +if (err < 0)
> +return err;
> +}
>
>  return pkt->size;
>  }
> --
> 2.39.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 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/8] lavc/libvpxenc: drop frame_number

2023-02-28 Thread James Zern
On Tue, Feb 28, 2023 at 4:02 AM Anton Khirnov  wrote:
>
> It is not used, except to check whether the packet is valid before
> writing HDR metadata to the packet in storeframe(). However, that check
> serves no purpose, as the encoded packet is already treated as valid
> higher up in this function.

lgtm. I agree, since the HDR path is VP9 only, there's no possibility
of having a separate alt-ref packet. The libaom wrapper could probably
use a similar update.

> ---
>  libavcodec/libvpxenc.c | 9 +
>  1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 339d4d8146..eaa4ad8f25 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -63,7 +63,6 @@ struct FrameListData {
>  uint32_t flags;  /**< flags for this frame */
>  uint64_t sse[4];
>  int have_sse;/**< true if we have pending sse[] */
> -uint64_t frame_number;
>  struct FrameListData *next;
>  };
>
> @@ -84,7 +83,6 @@ typedef struct VPxEncoderContext {
>  int deadline; //i.e., RT/GOOD/BEST
>  uint64_t sse[4];
>  int have_sse; /**< true if we have pending sse[] */
> -uint64_t frame_number;
>  struct FrameListData *coded_frame_list;
>  struct FrameListData *alpha_coded_frame_list;
>
> @@ -1220,9 +1218,8 @@ static inline void cx_pktcpy(struct FrameListData *dst,
>  dst->sz   = src->data.frame.sz;
>  dst->buf  = src->data.frame.buf;
>  dst->have_sse = 0;
> -/* For alt-ref frame, don't store PSNR or increment frame_number */
> +/* For alt-ref frame, don't store PSNR */
>  if (!(dst->flags & VPX_FRAME_IS_INVISIBLE)) {
> -dst->frame_number = ++ctx->frame_number;
>  dst->have_sse = ctx->have_sse;
>  if (ctx->have_sse) {
>  /* associate last-seen SSE to the frame. */
> @@ -1232,8 +1229,6 @@ static inline void cx_pktcpy(struct FrameListData *dst,
>  memcpy(dst->sse, ctx->sse, sizeof(dst->sse));
>  ctx->have_sse = 0;
>  }
> -} else {
> -dst->frame_number = -1;   /* sanity marker */
>  }
>  }
>
> @@ -1289,13 +1284,11 @@ static int storeframe(AVCodecContext *avctx, struct 
> FrameListData *cx_frame,
>  AV_WB64(side_data, 1);
>  memcpy(side_data + 8, alpha_cx_frame->buf, alpha_cx_frame->sz);
>  }
> -if (cx_frame->frame_number != -1) {
>  if (ctx->hdr10_plus_fifo) {
>  int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
>  if (err < 0)
>  return err;
>  }
> -}
>
>  return pkt->size;
>  }
> --
> 2.39.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 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/libvpxdec: remove unnecessary init_static_data function

2023-02-28 Thread James Almer

On 2/28/2023 5:40 PM, James Zern wrote:

On Tue, Feb 28, 2023 at 4:07 AM James Almer  wrote:


It's used only by the encoder.



It sets AVCodec.pix_fmts, but maybe the values reported aren't used
meaningfully.


Indeed, they aren't. AVCodec.pix_fmts is a list of formats an encoder 
accepts as input. Decoders don't use that array.





Signed-off-by: James Almer 
---
  libavcodec/libvpxdec.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 0ae19c3f72..8e6291fe20 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = {
  FF_CODEC_DECODE_CB(vpx_decode),
  .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
-.init_static_data = ff_vp9_init_static,
  };
  #endif /* CONFIG_LIBVPX_VP9_DECODER */
--
2.39.2


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

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

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

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


Re: [FFmpeg-devel] [PATCH 1/3] decklink: Don't take for granted that first frame to decklink output will be PTS 0

2023-02-28 Thread Marton Balint




On Thu, 23 Feb 2023, Devin Heitmueller wrote:


The existing code assumed that the first frame received by the decklink
output would always be PTS zero.  However if running in other timing
modes than the default of CBR, items such as frame dropping at the
beginning may result in starting at a non-zero PTS.

For example, in our setup because we discard probing data and run
with "-vsync 2" the first video frame scheduled to the decklink
output will have a PTS around 170.  Scheduling frames too far into
the future will either fail or cause a backlog of frames scheduled
far enough into the future that the entire pipeline will stall.

Issue can be reproduced with the following command-line:

./ffmpeg -copyts -i foo.ts -f decklink -vcodec v210 -ac 2  'DeckLink Duo (4)'

Keep track of the PTS of the first frame received, so that when
we enable start playback we can provide that value to the decklink
driver.

Signed-off-by: Devin Heitmueller 
---
libavdevice/decklink_common.h | 1 +
libavdevice/decklink_enc.cpp  | 7 +--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index 79d6ac5b38..088e165ee7 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -118,6 +118,7 @@ struct decklink_ctx {

/* Status */
int playback_started;
+int64_t first_pts;
int64_t last_pts;
unsigned long frameCount;
unsigned int dropped;
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index fb686b9032..c3dc2c0cac 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -486,6 +486,9 @@ static int decklink_write_video_packet(AVFormatContext 
*avctx, AVPacket *pkt)
ctx->frames_buffer_available_spots--;
pthread_mutex_unlock(>mutex);

+if (ctx->first_pts == 0)
+ctx->first_pts = pkt->pts;


And what if first packet pts is 0? Then the second packet pts will be 
assigned to first pts? Maybe you should use AV_NOPTS_VALUE for the default 
first_pts value and check for that instead.


Regards,
Marton


+
/* Schedule frame for playback. */
hr = ctx->dlo->ScheduleVideoFrame((class IDeckLinkVideoFrame *) frame,
  pkt->pts * ctx->bmd_tb_num,
@@ -505,14 +508,14 @@ static int decklink_write_video_packet(AVFormatContext 
*avctx, AVPacket *pkt)
   " Video may misbehave!\n");

/* Preroll video frames. */
-if (!ctx->playback_started && pkt->pts > ctx->frames_preroll) {
+if (!ctx->playback_started && pkt->pts > (ctx->first_pts + 
ctx->frames_preroll)) {
av_log(avctx, AV_LOG_DEBUG, "Ending audio preroll.\n");
if (ctx->audio && ctx->dlo->EndAudioPreroll() != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not end audio preroll!\n");
return AVERROR(EIO);
}
av_log(avctx, AV_LOG_DEBUG, "Starting scheduled playback.\n");
-if (ctx->dlo->StartScheduledPlayback(0, ctx->bmd_tb_den, 1.0) != S_OK) 
{
+if (ctx->dlo->StartScheduledPlayback(ctx->first_pts * ctx->bmd_tb_num, 
ctx->bmd_tb_den, 1.0) != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not start scheduled 
playback!\n");
return AVERROR(EIO);
}
--
2.35.1.655.ga68dfadae5

___
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 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function

2023-02-28 Thread James Zern
On Tue, Feb 28, 2023 at 4:07 AM James Almer  wrote:
>
> It's used only by the encoder.
>

It sets AVCodec.pix_fmts, but maybe the values reported aren't used
meaningfully.

> Signed-off-by: James Almer 
> ---
>  libavcodec/libvpxdec.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
> index 0ae19c3f72..8e6291fe20 100644
> --- a/libavcodec/libvpxdec.c
> +++ b/libavcodec/libvpxdec.c
> @@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = {
>  FF_CODEC_DECODE_CB(vpx_decode),
>  .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
>FF_CODEC_CAP_AUTO_THREADS,
> -.init_static_data = ff_vp9_init_static,
>  };
>  #endif /* CONFIG_LIBVPX_VP9_DECODER */
> --
> 2.39.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] Website release notes for 6.0

2023-02-28 Thread Michael Niedermayer
Hi

On Tue, Feb 28, 2023 at 08:44:01PM +0100, Marton Balint wrote:
> 
> 
> On Tue, 28 Feb 2023, Lynne wrote:
> 
> > Feb 28, 2023, 10:59 by d...@lynne.ee:
> > 
> > > Feb 28, 2023, 10:41 by d...@lynne.ee:
> > > 
> > > > Wrote the release notes for 6.0, containing an
> > > > explanation of the new releases/ABI bump details,
> > > > and an overview of what has changed.
> > > > 
> > > > Patch attached.
> > > > 
> > 
> > Ping, release has been tagged for quite a while now.
> > Final version:
> > 
> >     A new major release, FFmpeg 6.0 
> > "Von Neumann",
> >     is now available for download. This release has many new encoders and 
> > decoders, filters,
> >     ffmpeg CLI tool improvements, and also, changes the way releases are 
> > done. All major
> >     releases will now bump the version of the ABI. We plan to have a new 
> > major release each
> >     year. Another release-specific change is that deprecated APIs will be 
> > removed after 3
> >     releases, upon the next major bump. The last minor release of a major 
> > version will be an
> >     LTS release.
> 
> For some reason LTS releases were only planned for every second year:
> 
> https://ftp.belnet.be/mirror/FOSDEM/video/2023/K.3.401/om_vlc.webm#t=724
> 
> So I'd remove the last sentence until this is clarified.

patch LGTM with the change

thx

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

No great genius has ever existed without some touch of madness. -- Aristotle


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

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


Re: [FFmpeg-devel] [PATCH v4] avcodec/pngdec: read colorspace info when decoding with AVDISCARD_ALL

2023-02-28 Thread Leo Izen

On 2/27/23 11:34, Leo Izen wrote:

On 2/21/23 17:35, Leo Izen wrote:

These chunks are lightweight and it's useful information to have when
running ffmpeg -i or ffprobe, for example.
---
  libavcodec/pngdec.c  | 136 ++-
  tests/ref/fate/png-icc   |   8 +--
  tests/ref/fate/png-side-data |   2 +-
  3 files changed, 91 insertions(+), 55 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c


I will push this soon-ish if there's no other objections.

- Leo Izen (thebombzen)




Pushed as fadfa147f812a3fe9e68723347d37b9cccd6222d.

- Leo Izen (thebombzen)

___
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] Website release notes for 6.0

2023-02-28 Thread Marton Balint



On Tue, 28 Feb 2023, Lynne wrote:


Feb 28, 2023, 10:59 by d...@lynne.ee:


Feb 28, 2023, 10:41 by d...@lynne.ee:


Wrote the release notes for 6.0, containing an
explanation of the new releases/ABI bump details,
and an overview of what has changed.

Patch attached.



Ping, release has been tagged for quite a while now.
Final version:

    A new major release, FFmpeg 6.0 "Von 
Neumann",
    is now available for download. This release has many new encoders and 
decoders, filters,
    ffmpeg CLI tool improvements, and also, changes the way releases are done. 
All major
    releases will now bump the version of the ABI. We plan to have a new major 
release each
    year. Another release-specific change is that deprecated APIs will be 
removed after 3
    releases, upon the next major bump. The last minor release of a major 
version will be an
    LTS release.


For some reason LTS releases were only planned for every second year:

https://ftp.belnet.be/mirror/FOSDEM/video/2023/K.3.401/om_vlc.webm#t=724

So I'd remove the last sentence until this is clarified.

Regards,
Marton




    This means that releases will be done more often and will be more organized.

    New decoders featured are Bonk, RKA, Radiance, SC-4, APAC, VQC, WavArc and 
a few ADPCM formats.
    QSV and NVenc now support AV1 encoding. The FFmpeg CLI (we usually reffer 
to it as ffmpeg.c
    to avoid confusion) has speed-up improvements due to threading, as well as 
statistics options,
    and the ability to pass option values for filters from a file. There are 
quite a few new audio
    and video filters, such as adrc, showcwt, backgroundkey and ssim360, with a 
few hardware ones too.
    Finally, the release features many behind-the-scenes changes, including a 
new FFT and MDCT
    implementation used in codecs (expect a blog post about this soon), 
numerous bugfixes, better
    ICC profile handling and colorspace signalling improvement, introduction of 
a number of RISC-V
    vector and scalar assembly optimized routines, and a few new improved APIs, 
which can be viewed
    in the doc/APIchanges file in our tree.
    A few submitted features, such as the Vulkan improvements and more FFT 
optimizations will be in the
    next minor release, 6.1, which we plan to release soon, in line with our 
new release schedule.
    Some highlights are:



___
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] Use https for repository links

2023-02-28 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 CREDITS| 4 ++--
 doc/authors.texi   | 4 ++--
 doc/git-howto.texi | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/CREDITS b/CREDITS
index e29f0b853c..f1aea93d6b 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1,6 +1,6 @@
-See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to
+See the Git history of the project (https://git.ffmpeg.org/ffmpeg) to
 get the names of people who have contributed to FFmpeg.
 
 To check the log, you can type the command "git log" in the FFmpeg
 source directory, or browse the online repository at
-http://source.ffmpeg.org.
+https://git.ffmpeg.org/ffmpeg
diff --git a/doc/authors.texi b/doc/authors.texi
index 6c8c1d7efa..ce088392f8 100644
--- a/doc/authors.texi
+++ b/doc/authors.texi
@@ -3,9 +3,9 @@
 The FFmpeg developers.
 
 For details about the authorship, see the Git history of the project
-(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
+(https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
 @command{git log} in the FFmpeg source directory, or browsing the
-online repository at @url{http://source.ffmpeg.org}.
+online repository at @url{https://git.ffmpeg.org/ffmpeg}.
 
 Maintainers for the specific components are listed in the file
 @file{MAINTAINERS} in the source code tree.
diff --git a/doc/git-howto.texi b/doc/git-howto.texi
index 5bb39bb986..f4e2f2ec23 100644
--- a/doc/git-howto.texi
+++ b/doc/git-howto.texi
@@ -53,7 +53,7 @@ Most distribution and operating system provide a package for 
it.
 @section Cloning the source tree
 
 @example
-git clone git://source.ffmpeg.org/ffmpeg 
+git clone https://git.ffmpeg.org/ffmpeg.git 
 @end example
 
 This will put the FFmpeg sources into the directory @var{}.
-- 
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".


Re: [FFmpeg-devel] [PATCH] doc/filters: update SITI description

2023-02-28 Thread Werner Robitza
On Tue, Feb 28, 2023 at 2:16 PM Thilo Borgmann  wrote:
>
> Am 28.02.23 um 14:13 schrieb Thilo Borgmann:
> > Am 28.02.23 um 12:42 schrieb Werner Robitza:
> >> The filter implements the 'legacy' version from a superseded 
> >> recommendation.
> >> ---
> >>   doc/filters.texi | 8 +---
> >>   1 file changed, 5 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/doc/filters.texi b/doc/filters.texi
> >> index 47e92b9269..25574cd55c 100644
> >> --- a/doc/filters.texi
> >> +++ b/doc/filters.texi
> >> @@ -21593,9 +21593,11 @@ ffmpeg -i input1.mkv -i input2.mkv 
> >> -filter_complex "[0:v][1:v] signature=nb_inpu
> >>   @anchor{siti}
> >>   @section siti
> >> -Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as 
> >> defined
> >> -in ITU-T P.910: Subjective video quality assessment methods for multimedia
> >> -applications. Available PDF at 
> >> @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
> >> +Calculate Spatial Information (SI) and Temporal Information (TI) scores 
> >> for a video,
> >> +as defined in ITU-T Rec. P.910 (11/21): Subjective video quality 
> >> assessment methods
> >> +for multimedia applications. Available PDF at 
> >> @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
> >> +Note that this is a legacy implementation that corresponds to a 
> >> superseded recommendation.
> >> +Refer to ITU-T Rec. P.910 (07/22) for the latest version.
> >>   It accepts the following option:
> >
> > Ok.
>
> You might want to add the URL of the current spec, though:
> https://www.itu.int/rec/T-REC-P.910-202207-I/en

Sure, patch attached.


0001-doc-filters-update-SITI-description.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: fix NULL pointer dereference

2023-02-28 Thread Timo Rothenpieler

On 28.02.2023 16:03, Zhao Zhili wrote:

I can move the check from here to close(). assert is helpful if it can catch
bugs during development. It doesn't help much here since this is a rare case
which doesn't triggered during development.


Crashing with an assertion is still much better than dereferencing a 
NULL pointer.


I'll have a look at the calling function in a bit, to see if it can be 
refactored to never run into the chance of calling this function when 
not 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".


[FFmpeg-devel] [PATCH] libavformat/tcp: add local_addr/local_port for network option

2023-02-28 Thread jackarain
Signed-off-by: jackarain 
---
 doc/protocols.texi|  6 ++
 libavformat/network.c | 14 +
 libavformat/network.h |  2 +-
 libavformat/tcp.c | 49 ++-
 4 files changed, 65 insertions(+), 6 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 21ae6181a0..b3fad55591 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1882,6 +1882,12 @@ The list of supported options follows.
 Listen for an incoming connection. 0 disables listen, 1 enables listen in
 single client mode, 2 enables listen in multi-client mode. Default value is 0.
 
+@item local_addr=@var{addr}
+Local IP address of a network interface used for tcp socket connect.
+
+@item local_port=@var{port}
+Local port used for tcp socket connect.
+
 @item timeout=@var{microseconds}
 Set raise error timeout, expressed in microseconds.
 
diff --git a/libavformat/network.c b/libavformat/network.c
index 21e20b3e9a..de8b14be82 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -356,7 +356,7 @@ struct ConnectionAttempt {
 static int start_connect_attempt(struct ConnectionAttempt *attempt,
  struct addrinfo **ptr, int timeout_ms,
  URLContext *h,
- void (*customize_fd)(void *, int), void 
*customize_ctx)
+ int (*customize_fd)(void *, int), void 
*customize_ctx)
 {
 struct addrinfo *ai = *ptr;
 int ret;
@@ -371,8 +371,14 @@ static int start_connect_attempt(struct ConnectionAttempt 
*attempt,
 
 ff_socket_nonblock(attempt->fd, 1);
 
-if (customize_fd)
-customize_fd(customize_ctx, attempt->fd);
+if (customize_fd) {
+ret = customize_fd(customize_ctx, attempt->fd);
+if (ret) {
+closesocket(attempt->fd);
+attempt->fd = -1;
+return ret;
+}
+}
 
 while ((ret = connect(attempt->fd, ai->ai_addr, ai->ai_addrlen))) {
 ret = ff_neterrno();
@@ -402,7 +408,7 @@ static int start_connect_attempt(struct ConnectionAttempt 
*attempt,
 
 int ff_connect_parallel(struct addrinfo *addrs, int timeout_ms_per_address,
 int parallel, URLContext *h, int *fd,
-void (*customize_fd)(void *, int), void *customize_ctx)
+int (*customize_fd)(void *, int), void *customize_ctx)
 {
 struct ConnectionAttempt attempts[3];
 struct pollfd pfd[3];
diff --git a/libavformat/network.h b/libavformat/network.h
index 71c49a73fb..8a8cbe672e 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -336,6 +336,6 @@ void ff_log_net_error(void *ctx, int level, const char* 
prefix);
  */
 int ff_connect_parallel(struct addrinfo *addrs, int timeout_ms_per_address,
 int parallel, URLContext *h, int *fd,
-void (*customize_fd)(void *, int), void 
*customize_ctx);
+int (*customize_fd)(void *, int), void *customize_ctx);
 
 #endif /* AVFORMAT_NETWORK_H */
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index a11ccbb913..f9900c56a7 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -36,6 +36,8 @@ typedef struct TCPContext {
 const AVClass *class;
 int fd;
 int listen;
+char *local_port;
+char *local_addr;
 int open_timeout;
 int rw_timeout;
 int listen_timeout;
@@ -52,6 +54,8 @@ typedef struct TCPContext {
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
 { "listen",  "Listen for incoming connections",  OFFSET(listen),   
  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   2,   .flags = D|E },
+{ "local_port",  "Local port", 
OFFSET(local_port), AV_OPT_TYPE_STRING, { .str = NULL }, 0,   0, 
.flags = D|E },
+{ "local_addr",  "Local address",  
OFFSET(local_addr), AV_OPT_TYPE_STRING, { .str = NULL }, 0,   0, 
.flags = D|E },
 { "timeout", "set timeout (in microseconds) of socket I/O operations", 
OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
 { "listen_timeout",  "Connection awaiting timeout (in milliseconds)",  
OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
 { "send_buffer_size", "Socket send buffer size (in bytes)",
OFFSET(send_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
@@ -70,9 +74,42 @@ static const AVClass tcp_class = {
 .version= LIBAVUTIL_VERSION_INT,
 };
 
-static void customize_fd(void *ctx, int fd)
+static int customize_fd(void *ctx, int fd)
 {
 TCPContext *s = ctx;
+
+if (s->local_addr || s->local_port) {
+struct addrinfo hints = { 0 }, *ai;
+int ret;
+
+hints.ai_family = AF_UNSPEC;
+hints.ai_socktype = SOCK_STREAM;
+
+  

Re: [FFmpeg-devel] [PATCH] checkasm: add support for vvc alf

2023-02-28 Thread Nuo Mi
On Tue, Feb 28, 2023 at 7:51 PM Martin Storsjö  wrote:

> On Sun, 26 Feb 2023, Nuo Mi wrote:
>
> > +#include 
> > +
> > +#include "libavutil/intreadwrite.h"
> > +#include "libavutil/mem_internal.h"
> > +
> > +#include "libavcodec/avcodec.h"
> > +
> > +#include "libavcodec/vvcdsp.h"
> > +#include "libavcodec/vvcdec.h"
> > +
> > +#include "checkasm.h"
> > +
> > +static const uint32_t pixel_mask[3] = { 0x, 0x03ff03ff,
> 0x0fff0fff };
> > +
> > +#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
> > +#define PIXEL_STRIDE (ALF_SUBBLOCK_SIZE + 2 * ALF_PADDING_SIZE)
> > +#define BUF_SIZE (PIXEL_STRIDE * (MAX_CTU_SIZE + 3 * 2) * 2) //+3 * 2
> for top and bottom row, *2 for high bit depth
> > +#define LUMA_PARAMS_SIZE (ALF_SUBBLOCK_SIZE / 4 * ALF_SUBBLOCK_SIZE / 4
> * ALF_NUM_COEFF_LUMA)
> > +
> > +#define randomize_buffers(buf0, buf1, size) \
> > +do {\
> > +uint32_t mask = pixel_mask[(bit_depth - 8) >> 1];   \
> > +int k;  \
> > +for (k = 0; k < size; k += 4) { \
> > +uint32_t r = rnd() & mask;  \
> > +AV_WN32A(buf0 + k, r);  \
> > +AV_WN32A(buf1 + k, r);  \
> > +}   \
> > +} while (0)
> > +
> > +#define randomize_buffers2(buf, size, filter)   \
> > +do {\
> > +int k;  \
> > +if (filter) {   \
> > +for (k = 0; k < size; k++) {\
> > +uint8_t r = rnd();  \
> > +buf[k] = r; \
> > +}   \
> > +} else {\
> > +for (k = 0; k < size; k++) {\
> > +int16_t r = rnd();  \
> > +buf[k] = r; \
> > +}   \
> > +}   \
> > +} while (0)
>
> I don't quite see the point of the extra uint8_t/int16_t variable r here -
> you could just as well assign it directly to buf[k], no? Unless you
> specifically want the effect where you're narrowing the random value to a
> smaller range beforehand.
>
yes. clips can only get special values.
https://github.com/ffvvc/FFmpeg/blob/main/libavcodec/vvc_filter_template.c#L653
fixed by
https://github.com/ffvvc/FFmpeg/pull/42/commits/3034ea8050f7f2db580ef4a36bd806e16be943d4#diff-99295cc07508b29c356b6432f8dbd72c5dceb37584fb8b4be0d34da19455864dR61

>
> > +
> > +static void check_alf_luma_filter(VVCDSPContext *c, const int bit_depth)
> > +{
> > +LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
> > +LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
> > +LOCAL_ALIGNED_32(uint8_t, src0, [BUF_SIZE]);
> > +LOCAL_ALIGNED_32(uint8_t, src1, [BUF_SIZE]);
> > +int8_t filter[LUMA_PARAMS_SIZE];
> > +int16_t clip[LUMA_PARAMS_SIZE];
> > +ptrdiff_t stride = PIXEL_STRIDE * SIZEOF_PIXEL;
> > +int offset = (3 * PIXEL_STRIDE + 3) * SIZEOF_PIXEL;
> > +
> > +declare_func_emms(AV_CPU_FLAG_AVX2, void, uint8_t *dst, ptrdiff_t
> dst_stride, const uint8_t *src, ptrdiff_t src_stride,
> > +int width, int height, const int8_t *filter, const int16_t
> *clip);
> > +
> > +randomize_buffers(src0, src1, BUF_SIZE);
> > +randomize_buffers2(filter, LUMA_PARAMS_SIZE, 1);
> > +randomize_buffers2(clip, LUMA_PARAMS_SIZE, 2);
>
> Here, both invocations of randomize_buffers2 are called with filter=1 or
> 2, both which will pick the "if (filter) {" case, so the else in
> randomize_buffers2 is unused?
>
fixed

>
> > +
> > +for (int h = 4; h < ALF_SUBBLOCK_SIZE; h += 4) {
> > +for (int w = 4; w < ALF_SUBBLOCK_SIZE; w += 4) {
>
> Wouldn't you want to use <= instead of < for the comparisons here? I don't
> know vvc so I can't say for sure, but that would seem logical to me.
>
you are right, fixed.

>
> Are all aspect ratio combinations allowed here? E.g. the log mentions that
> you're testing 28x4 blocks. In dav1d, similar cases use logic of testing w
> in the range of [h/4, h*4] (plus limited to e.g. [4,64] at the same time).
> That would reduce the number of combinations to test, if they aren't
> really valid in practice.
>
yes. almost all 4x width and height are valid.  last col or row may have a
small width and height.

>
> > +if (check_func(c->alf.filter[LUMA],
> "vvc_alf_filter_luma_%dx%d_%d", w, h, bit_depth)) {
> > +memset(dst0, 0, BUF_SIZE);
> > +memset(dst1, 0, BUF_SIZE);
> > +call_ref(dst0, 

Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: fix NULL pointer dereference

2023-02-28 Thread Zhao Zhili

> From: ffmpeg-devel  On Behalf Of Timo 
> Rothenpieler
> Sent: 2023年2月28日 22:37
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: fix NULL pointer 
> dereference
> 
> On 28.02.2023 19:43, Zhao Zhili wrote:
> > From: Zhao Zhili 
> >
> > This can happen if encoder init failed before setup the queue, then
> > reorder_queue_flush() is called by close().
> >
> > Fix ticket #10221
> >
> > Signed-off-by: Zhao Zhili 
> > ---
> >   libavcodec/nvenc.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> > index 8a28454042..dda2dc3ba1 100644
> > --- a/libavcodec/nvenc.c
> > +++ b/libavcodec/nvenc.c
> > @@ -178,6 +178,8 @@ static void reorder_queue_flush(AVFifo *queue)
> >   {
> >   FrameData fd;
> >
> > +if (!queue)
> > +return;
> >   while (av_fifo_read(queue, , 1) >= 0)
> >   av_buffer_unref(_opaque_ref);
> >   }
> 
> This should probably be an assert0, and the function should not be
> called to begin with if the queue is NULL.

I can move the check from here to close(). assert is helpful if it can catch
bugs during development. It doesn't help much here since this is a rare case 
which doesn't triggered during development.

> ___
> 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] Website release notes for 6.0

2023-02-28 Thread Lynne
Feb 28, 2023, 10:59 by d...@lynne.ee:

> Feb 28, 2023, 10:41 by d...@lynne.ee:
>
>> Wrote the release notes for 6.0, containing an
>> explanation of the new releases/ABI bump details,
>> and an overview of what has changed.
>>
>> Patch attached.
>>

Ping, release has been tagged for quite a while now.
Final version:

    A new major release, FFmpeg 6.0 "Von 
Neumann",
    is now available for download. This release has many new encoders and 
decoders, filters,
    ffmpeg CLI tool improvements, and also, changes the way releases are done. 
All major
    releases will now bump the version of the ABI. We plan to have a new major 
release each
    year. Another release-specific change is that deprecated APIs will be 
removed after 3
    releases, upon the next major bump. The last minor release of a major 
version will be an
    LTS release.
    This means that releases will be done more often and will be more organized.

    New decoders featured are Bonk, RKA, Radiance, SC-4, APAC, VQC, WavArc and 
a few ADPCM formats.
    QSV and NVenc now support AV1 encoding. The FFmpeg CLI (we usually reffer 
to it as ffmpeg.c
    to avoid confusion) has speed-up improvements due to threading, as well as 
statistics options,
    and the ability to pass option values for filters from a file. There are 
quite a few new audio
    and video filters, such as adrc, showcwt, backgroundkey and ssim360, with a 
few hardware ones too.
    Finally, the release features many behind-the-scenes changes, including a 
new FFT and MDCT
    implementation used in codecs (expect a blog post about this soon), 
numerous bugfixes, better
    ICC profile handling and colorspace signalling improvement, introduction of 
a number of RISC-V
    vector and scalar assembly optimized routines, and a few new improved APIs, 
which can be viewed
    in the doc/APIchanges file in our tree.
    A few submitted features, such as the Vulkan improvements and more FFT 
optimizations will be in the
    next minor release, 6.1, which we plan to release soon, in line with our 
new release schedule.
    Some highlights are:

>From 8e48319997962a6927bd0837457c5872b6730333 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Tue, 28 Feb 2023 10:39:18 +0100
Subject: [PATCH] Website release notes for 6.0

---
 src/index | 75 +++
 1 file changed, 75 insertions(+)

diff --git a/src/index b/src/index
index 2aac720..6e0f0c7 100644
--- a/src/index
+++ b/src/index
@@ -35,6 +35,81 @@
 News
   
 
+  February 28th, 2023, FFmpeg 6.0 "Von Neumann"
+  
+A new major release, FFmpeg 6.0 "Von Neumann",
+is now available for download. This release has many new encoders and decoders, filters,
+ffmpeg CLI tool improvements, and also, changes the way releases are done. All major
+releases will now bump the version of the ABI. We plan to have a new major release each
+year. Another release-specific change is that deprecated APIs will be removed after 3
+releases, upon the next major bump. The last minor release of a major version will be an
+LTS release.
+This means that releases will be done more often and will be more organized.
+  
+  
+New decoders featured are Bonk, RKA, Radiance, SC-4, APAC, VQC, WavArc and a few ADPCM formats.
+QSV and NVenc now support AV1 encoding. The FFmpeg CLI (we usually reffer to it as ffmpeg.c
+to avoid confusion) has speed-up improvements due to threading, as well as statistics options,
+and the ability to pass option values for filters from a file. There are quite a few new audio
+and video filters, such as adrc, showcwt, backgroundkey and ssim360, with a few hardware ones too.
+Finally, the release features many behind-the-scenes changes, including a new FFT and MDCT
+implementation used in codecs (expect a blog post about this soon), numerous bugfixes, better
+ICC profile handling and colorspace signalling improvement, introduction of a number of RISC-V
+vector and scalar assembly optimized routines, and a few new improved APIs, which can be viewed
+in the doc/APIchanges file in our tree.
+A few submitted features, such as the Vulkan improvements and more FFT optimizations will be in the
+next minor release, 6.1, which we plan to release soon, in line with our new release schedule.
+Some highlights are:
+  
+  
+Radiance HDR image support
+ddagrab (Desktop Duplication) video capture filter
+ffmpeg -shortest_buf_duration option
+ffmpeg now requires threading to be built
+ffmpeg now runs every muxer in a separate thread
+Add new mode to cropdetect filter to detect crop-area based on motion vectors and edges
+VAAPI decoding and encoding for 10/12bit 422, 10/12bit 444 HEVC and VP9
+WBMP (Wireless Application Protocol Bitmap) image format
+a3dscope filter
+bonk decoder and demuxer
+Micronas SC-4 audio decoder
+LAF demuxer
+APAC decoder and demuxer
+Media 100i decoders
+   

Re: [FFmpeg-devel] [PATCH v2] avcodec: add D3D12VA hardware accelerated H264, HEVC, VP9, and AV1 decoding

2023-02-28 Thread Wu, Tong1
> [PATCH v2] avcodec: add D3D12VA hardware accelerated H264, HEVC, VP9,
> and AV1 decoding
> 
> Patches attached.

>-HWACCEL_D3D11VA2(h264),
>+   HWACCEL_D3D11VA(h264),

This shouldn't be changed. It will block d3d11va h264dec.

>+#endif
>+#if CONFIG_H264_D3D12DEC_HWACCEL
>+   HWACCEL_D3D12DEC(h264),


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

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


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: fix NULL pointer dereference

2023-02-28 Thread Timo Rothenpieler

On 28.02.2023 19:43, Zhao Zhili wrote:

From: Zhao Zhili 

This can happen if encoder init failed before setup the queue, then
reorder_queue_flush() is called by close().

Fix ticket #10221

Signed-off-by: Zhao Zhili 
---
  libavcodec/nvenc.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 8a28454042..dda2dc3ba1 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -178,6 +178,8 @@ static void reorder_queue_flush(AVFifo *queue)
  {
  FrameData fd;
  
+if (!queue)

+return;
  while (av_fifo_read(queue, , 1) >= 0)
  av_buffer_unref(_opaque_ref);
  }


This should probably be an assert0, and the function should not be 
called to begin with if the queue is NULL.

___
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] libavformat/tcp: add local_addr/local_port for network option

2023-02-28 Thread jackarain
Done.

Nicolas George  于2023年2月28日周二 18:57写道:

> jack (12023-02-28):
> > Signed-off-by: jack 
> > ---
> >  libavformat/tcp.c | 44 
> >  1 file changed, 44 insertions(+)
>
> Thanks for the patch
>
> You neglected to update the documentation, and a few remarks below.
>
> >
> > diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> > index a11ccbb913..598d61067e 100644
> > --- a/libavformat/tcp.c
> > +++ b/libavformat/tcp.c
> > @@ -36,6 +36,8 @@ typedef struct TCPContext {
> >  const AVClass *class;
> >  int fd;
> >  int listen;
> > +int local_port;
> > +char *local_addr;
> >  int open_timeout;
> >  int rw_timeout;
> >  int listen_timeout;
> > @@ -52,6 +54,8 @@ typedef struct TCPContext {
> >  #define E AV_OPT_FLAG_ENCODING_PARAM
> >  static const AVOption options[] = {
> >  { "listen",  "Listen for incoming connections",
> OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   2,
>  .flags = D|E },
> > +{ "local_port",  "Local port",
>OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },  -1,
> INT_MAX, .flags = D|E },
> > +{ "local_addr",  "Local address",
> OFFSET(local_addr), AV_OPT_TYPE_STRING, { .str = NULL },
>  0,   0, .flags = D|E },
> >  { "timeout", "set timeout (in microseconds) of socket I/O
> operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 },
>  -1, INT_MAX, .flags = D|E },
> >  { "listen_timeout",  "Connection awaiting timeout (in
> milliseconds)",  OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1
> }, -1, INT_MAX, .flags = D|E },
> >  { "send_buffer_size", "Socket send buffer size (in bytes)",
> OFFSET(send_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 },
>  -1, INT_MAX, .flags = D|E },
> > @@ -73,6 +77,39 @@ static const AVClass tcp_class = {
> >  static void customize_fd(void *ctx, int fd)
> >  {
> >  TCPContext *s = ctx;
> > +
>
> > +if (s->local_addr) {
>
> s->local_addr || s->local_port
>
> > +struct addrinfo hints = { 0 }, *ai;
> > +int ret;
> > +int port = 0;
> > +
> > +hints.ai_family = AF_UNSPEC;
> > +hints.ai_socktype = SOCK_STREAM;
> > +
> > +if (s->local_port > 0)
> > +port = s->local_port;
> > +
>
> > +ret = getaddrinfo(s->local_addr, "0", , );
>
> The provided port should be used instead of this "0", and be a string,
> and named service.
>
> (The remote port should be a string too, alas.)
>
> > +if (ret) {
>
> > +av_log(ctx, AV_LOG_WARNING,
> > +   "Failed to bind local addr: %s port: %d err: %s\n",
> > +s->local_addr, s->local_port, gai_strerror(ret));
>
> Should be an error: failing to bind on the specified address can be a
> security issue. And the error message is misleading.
>
> > +} else {
>
> > +if (ai->ai_family == AF_INET6) {
> > +struct sockaddr_in6 * sockaddr_v6 = (struct
> sockaddr_in6 *)ai->ai_addr;
> > +sockaddr_v6->sin6_port = htons(port);
> > +} else {
> > +struct sockaddr_in * sockaddr = (struct sockaddr_in
> *)ai->ai_addr;
> > +sockaddr->sin_port = htons(port);
> > +}
>
> Do not distinguish between protocols: ai_addr already contains all that
> is needed.
>
> > +ret = bind(fd, (struct sockaddr *)ai->ai_addr,
> (int)ai->ai_addrlen);
> > +if (ret) {
> > +av_log(ctx, AV_LOG_WARNING,
> > +"Failed to bind local addr: %s port: %d err: %s\n",
> > +s->local_addr, s->local_port, gai_strerror(ret));
> > +}
>
> You should be looping over the returned addresses.
>
> > +}
> > +}
> >  /* Set the socket's send or receive buffer sizes, if specified.
> > If unspecified or setting fails, system default is used. */
> >  if (s->recv_buffer_size > 0) {
> > @@ -129,6 +166,13 @@ static int tcp_open(URLContext *h, const char *uri,
> int flags)
> >  if (buf == endptr)
> >  s->listen = 1;
> >  }
> > +if (av_find_info_tag(buf, sizeof(buf), "local_port", p)) {
> > +s->local_port = strtol(buf, NULL, 10);
> > +}
> > +if (av_find_info_tag(buf, sizeof(buf), "local_addr", p)) {
> > +av_freep(>local_addr);
> > +s->local_addr = av_strndup(buf, strlen(buf));
> > +}
> >  if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
> >  s->rw_timeout = strtol(buf, NULL, 10);
> >  }
>
> Regards,
>
> --
>   Nicolas George
>
___
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] libavformat/tcp: add local_addr/local_port for network option

2023-02-28 Thread jackarain
Signed-off-by: jackarain 
---
 doc/protocols.texi|  6 ++
 libavformat/network.c | 14 +
 libavformat/network.h |  2 +-
 libavformat/tcp.c | 48 ++-
 4 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 21ae6181a0..b3fad55591 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1882,6 +1882,12 @@ The list of supported options follows.
 Listen for an incoming connection. 0 disables listen, 1 enables listen in
 single client mode, 2 enables listen in multi-client mode. Default value is 0.
 
+@item local_addr=@var{addr}
+Local IP address of a network interface used for tcp socket connect.
+
+@item local_port=@var{port}
+Local port used for tcp socket connect.
+
 @item timeout=@var{microseconds}
 Set raise error timeout, expressed in microseconds.
 
diff --git a/libavformat/network.c b/libavformat/network.c
index 21e20b3e9a..de8b14be82 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -356,7 +356,7 @@ struct ConnectionAttempt {
 static int start_connect_attempt(struct ConnectionAttempt *attempt,
  struct addrinfo **ptr, int timeout_ms,
  URLContext *h,
- void (*customize_fd)(void *, int), void 
*customize_ctx)
+ int (*customize_fd)(void *, int), void 
*customize_ctx)
 {
 struct addrinfo *ai = *ptr;
 int ret;
@@ -371,8 +371,14 @@ static int start_connect_attempt(struct ConnectionAttempt 
*attempt,
 
 ff_socket_nonblock(attempt->fd, 1);
 
-if (customize_fd)
-customize_fd(customize_ctx, attempt->fd);
+if (customize_fd) {
+ret = customize_fd(customize_ctx, attempt->fd);
+if (ret) {
+closesocket(attempt->fd);
+attempt->fd = -1;
+return ret;
+}
+}
 
 while ((ret = connect(attempt->fd, ai->ai_addr, ai->ai_addrlen))) {
 ret = ff_neterrno();
@@ -402,7 +408,7 @@ static int start_connect_attempt(struct ConnectionAttempt 
*attempt,
 
 int ff_connect_parallel(struct addrinfo *addrs, int timeout_ms_per_address,
 int parallel, URLContext *h, int *fd,
-void (*customize_fd)(void *, int), void *customize_ctx)
+int (*customize_fd)(void *, int), void *customize_ctx)
 {
 struct ConnectionAttempt attempts[3];
 struct pollfd pfd[3];
diff --git a/libavformat/network.h b/libavformat/network.h
index 71c49a73fb..8a8cbe672e 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -336,6 +336,6 @@ void ff_log_net_error(void *ctx, int level, const char* 
prefix);
  */
 int ff_connect_parallel(struct addrinfo *addrs, int timeout_ms_per_address,
 int parallel, URLContext *h, int *fd,
-void (*customize_fd)(void *, int), void 
*customize_ctx);
+int (*customize_fd)(void *, int), void *customize_ctx);
 
 #endif /* AVFORMAT_NETWORK_H */
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index a11ccbb913..ceb5a10426 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -36,6 +36,8 @@ typedef struct TCPContext {
 const AVClass *class;
 int fd;
 int listen;
+char *local_port;
+char *local_addr;
 int open_timeout;
 int rw_timeout;
 int listen_timeout;
@@ -52,6 +54,8 @@ typedef struct TCPContext {
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
 { "listen",  "Listen for incoming connections",  OFFSET(listen),   
  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   2,   .flags = D|E },
+{ "local_port",  "Local port", 
OFFSET(local_port), AV_OPT_TYPE_STRING, { .str = NULL }, 0,   0, 
.flags = D|E },
+{ "local_addr",  "Local address",  
OFFSET(local_addr), AV_OPT_TYPE_STRING, { .str = NULL }, 0,   0, 
.flags = D|E },
 { "timeout", "set timeout (in microseconds) of socket I/O operations", 
OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
 { "listen_timeout",  "Connection awaiting timeout (in milliseconds)",  
OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
 { "send_buffer_size", "Socket send buffer size (in bytes)",
OFFSET(send_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
@@ -70,9 +74,41 @@ static const AVClass tcp_class = {
 .version= LIBAVUTIL_VERSION_INT,
 };
 
-static void customize_fd(void *ctx, int fd)
+static int customize_fd(void *ctx, int fd)
 {
 TCPContext *s = ctx;
+
+if (s->local_addr || s->local_port) {
+struct addrinfo hints = { 0 }, *ai;
+int ret;
+
+hints.ai_family = AF_UNSPEC;
+hints.ai_socktype = SOCK_STREAM;
+
+  

Re: [FFmpeg-devel] [PATCH] libavcodec/libfdk-aacenc: Enable writing DRC metadata

2023-02-28 Thread Martin Storsjö

On Mon, 27 Feb 2023, JonHGee wrote:


Added basic DRC options and ref levels to AV options.
If any options are selected, metadata mode is set accordingly
and metadata is added to input buffer per FDK encoder API.

---
libavcodec/libfdk-aacenc.c | 72 ++
1 file changed, 58 insertions(+), 14 deletions(-)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 54549de473..4e67b1ece3 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -46,6 +46,12 @@ typedef struct AACContext {
int latm;
int header_period;
int vbr;
+int drc_profile;
+int drc_target_ref;
+int comp_profile;
+int comp_target_ref;
+int prog_ref;
+AACENC_MetaData metaDataSetup;

AudioFrameQueue afq;
} AACContext;
@@ -64,6 +70,11 @@ static const AVOption aac_enc_options[] = {
{ "latm", "Output LATM/LOAS encapsulated data", offsetof(AACContext, latm), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "header_period", "StreamMuxConfig and PCE repetition period (in frames)", 
offsetof(AACContext, header_period), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0x, 
AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "vbr", "VBR mode (1-5)", offsetof(AACContext, vbr), AV_OPT_TYPE_INT, { 
.i64 = 0 }, 0, 5, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "drc_profile", "The desired compression profile for AAC DRC", 
offsetof(AACContext, drc_profile), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 256, AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_ENCODING_PARAM },


The indentation of this line is a bit off


+{ "drc_target_ref", "Expected target reference level at decoder side in dB (for 
clipping prevention/limiter)", offsetof(AACContext, drc_target_ref), AV_OPT_TYPE_INT, { .i64 = 
0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "comp_profile", "The desired compression profile for AAC DRC", 
offsetof(AACContext, comp_profile), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 256, AV_OPT_FLAG_AUDIO_PARAM 
| AV_OPT_FLAG_ENCODING_PARAM },
+{ "comp_target_ref", "Expected target reference level at decoder side in dB 
(for clipping prevention/limiter)", offsetof(AACContext, comp_target_ref), AV_OPT_TYPE_INT, { 
.i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+{ "prog_ref", "The program reference level or dialog level in dB", 
offsetof(AACContext, prog_ref), AV_OPT_TYPE_INT, { .i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM 
| AV_OPT_FLAG_ENCODING_PARAM },
FF_AAC_PROFILE_OPTS
{ NULL }
};
@@ -127,6 +138,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
AACENC_ERROR err;
int aot = FF_PROFILE_AAC_LOW + 1;
int sce = 0, cpe = 0;
+int metadata_mode = 0;

if ((err = aacEncOpen(>handle, 0, avctx->ch_layout.nb_channels)) != 
AACENC_OK) {
av_log(avctx, AV_LOG_ERROR, "Unable to open the encoder: %s\n",
@@ -319,6 +331,29 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
}
}

+if (s->prog_ref) {
+metadata_mode = 1;
+s->metaDataSetup.prog_ref_level_present = 1;
+s->metaDataSetup.prog_ref_level = s->prog_ref << 16;
+}
+if (s->drc_profile) {
+metadata_mode = 1;
+s->metaDataSetup.drc_profile = s->drc_profile;
+s->metaDataSetup.drc_TargetRefLevel = s->drc_target_ref << 16;
+if (s->comp_profile) {
+// Including the comp_profile means that we need to set the mode 
to ETSI
+metadata_mode = 2;
+s->metaDataSetup.comp_profile = s->comp_profile;
+s->metaDataSetup.comp_TargetRefLevel = s->comp_target_ref << 16;
+}
+}
+
+if ((err = aacEncoder_SetParam(s->handle, AACENC_METADATA_MODE, 
metadata_mode)) != AACENC_OK) {
+av_log(avctx, AV_LOG_ERROR, "Unable to set metadata mode to %d: %s\n",
+metadata_mode, aac_get_error(err));
+goto error;
+}
+
if ((err = aacEncEncode(s->handle, NULL, NULL, NULL, NULL)) != AACENC_OK) {
av_log(avctx, AV_LOG_ERROR, "Unable to initialize the encoder: %s\n",
   aac_get_error(err));
@@ -363,11 +398,13 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
AACENC_BufDesc in_buf   = { 0 }, out_buf = { 0 };
AACENC_InArgs  in_args  = { 0 };
AACENC_OutArgs out_args = { 0 };
-int in_buffer_identifier = IN_AUDIO_DATA;
-int in_buffer_size, in_buffer_element_size;
+void* inBuffer[] = { 0, >metaDataSetup };
+int in_buffer_identifiers[] = { IN_AUDIO_DATA, IN_METADATA_SETUP };
+int in_buffer_element_sizes[]   = { 2, sizeof(AACENC_MetaData) };


Weird extra whitespace here


+int in_buffer_sizes[] = { 0 , sizeof(s->metaDataSetup) };
+void *out_ptr;
int out_buffer_identifier = OUT_BITSTREAM_DATA;
int out_buffer_size, out_buffer_element_size;
-void *in_ptr, *out_ptr;
int ret;
uint8_t dummy_buf[1];

Re: [FFmpeg-devel] [PATCH] libavcodec/hevc: remove duplicate semicolon in hevcdsp_init_neon

2023-02-28 Thread Martin Storsjö

On Tue, 28 Feb 2023, xufuji456 wrote:


---
libavcodec/arm/hevcdsp_init_neon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index 34f51b00d1..19e00af50e 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -119,7 +119,7 @@ QPEL_FUNC(ff_hevc_put_qpel_h3v3_neon_8);

#define QPEL_FUNC_UW_PIX(name) \
void name(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t 
_srcstride, \
-   int height, intptr_t mx, intptr_t my, int 
width);
+   int height, intptr_t mx, intptr_t my, int 
width)
QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w4_neon_8);
QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w8_neon_8);
QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w16_neon_8);
@@ -131,7 +131,7 @@ QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w64_neon_8);

#define QPEL_FUNC_UW(name) \
void name(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t 
_srcstride, \
-  int width, int height, const int16_t* src2, ptrdiff_t 
src2stride);
+  int width, int height, const int16_t* src2, ptrdiff_t src2stride)
QPEL_FUNC_UW(ff_hevc_put_qpel_uw_pixels_neon_8);
QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v1_neon_8);
QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v2_neon_8);
--
2.32.0 (Apple Git-132)


Thanks, pushed.

Note for the future; it'd be good if you'd mention the arch subdirectory 
at the start of the commit subject, e.g. "libavcodec: arm: hevc: ..." or 
"libavcodec/arm/hevc: ..." or something like that, to make the context 
more immediately obvious.


// Martin

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

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


Re: [FFmpeg-devel] [PATCH] doc/filters: update SITI description

2023-02-28 Thread Thilo Borgmann

Am 28.02.23 um 14:13 schrieb Thilo Borgmann:

Am 28.02.23 um 12:42 schrieb Werner Robitza:

The filter implements the 'legacy' version from a superseded recommendation.
---
  doc/filters.texi | 8 +---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 47e92b9269..25574cd55c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21593,9 +21593,11 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex 
"[0:v][1:v] signature=nb_inpu
  @anchor{siti}
  @section siti
-Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as 
defined
-in ITU-T P.910: Subjective video quality assessment methods for multimedia
-applications. Available PDF at 
@url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
+Calculate Spatial Information (SI) and Temporal Information (TI) scores for a 
video,
+as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment 
methods
+for multimedia applications. Available PDF at 
@url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
+Note that this is a legacy implementation that corresponds to a superseded 
recommendation.
+Refer to ITU-T Rec. P.910 (07/22) for the latest version.
  It accepts the following option:


Ok.


You might want to add the URL of the current spec, though:
https://www.itu.int/rec/T-REC-P.910-202207-I/en

-Thilo

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

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


Re: [FFmpeg-devel] [PATCH] doc/filters: update SITI description

2023-02-28 Thread Thilo Borgmann

Am 28.02.23 um 12:42 schrieb Werner Robitza:

The filter implements the 'legacy' version from a superseded recommendation.
---
  doc/filters.texi | 8 +---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 47e92b9269..25574cd55c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21593,9 +21593,11 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex 
"[0:v][1:v] signature=nb_inpu
  @anchor{siti}
  @section siti
  
-Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined

-in ITU-T P.910: Subjective video quality assessment methods for multimedia
-applications. Available PDF at 
@url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
+Calculate Spatial Information (SI) and Temporal Information (TI) scores for a 
video,
+as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment 
methods
+for multimedia applications. Available PDF at 
@url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
+Note that this is a legacy implementation that corresponds to a superseded 
recommendation.
+Refer to ITU-T Rec. P.910 (07/22) for the latest version.
  
  It accepts the following option:
  


Ok.

-Thilo
___
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] libavcodec/hevc: remove duplicate semicolon in hevcdsp_init_neon

2023-02-28 Thread xufuji456
---
 libavcodec/arm/hevcdsp_init_neon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index 34f51b00d1..19e00af50e 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -119,7 +119,7 @@ QPEL_FUNC(ff_hevc_put_qpel_h3v3_neon_8);
 
 #define QPEL_FUNC_UW_PIX(name) \
 void name(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, 
ptrdiff_t _srcstride, \
-   int height, intptr_t mx, intptr_t my, int 
width);
+   int height, intptr_t mx, intptr_t my, int 
width)
 QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w4_neon_8);
 QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w8_neon_8);
 QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w16_neon_8);
@@ -131,7 +131,7 @@ QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w64_neon_8);
 
 #define QPEL_FUNC_UW(name) \
 void name(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, 
ptrdiff_t _srcstride, \
-  int width, int height, const int16_t* src2, ptrdiff_t 
src2stride);
+  int width, int height, const int16_t* src2, ptrdiff_t src2stride)
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_pixels_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v1_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v2_neon_8);
-- 
2.32.0 (Apple Git-132)

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

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


Re: [FFmpeg-devel] [PATCH 4/4] lavc/mediacodecenc: List supported pixel formats on configuration error

2023-02-28 Thread zhilizhao(赵志立)
> This patch has been released by Epic Games' legal department.
> ---
>  libavcodec/mediacodecenc.c | 46 ++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
> index 03c80cbf99..1b8a2837c4 100644
> --- a/libavcodec/mediacodecenc.c
> +++ b/libavcodec/mediacodecenc.c
> @@ -97,6 +97,12 @@ static const enum AVPixelFormat avc_pix_fmts[] = {
>  AV_PIX_FMT_NONE
>  };
>  
> +static const int in_formats[] = {
> +COLOR_FormatYUV420Planar,
> +COLOR_FormatYUV420SemiPlanar,
> +COLOR_FormatSurface,
> +};
> +
>  static void mediacodec_output_format(AVCodecContext *avctx)
>  {
>  MediaCodecEncContext *s = avctx->priv_data;
> @@ -131,6 +137,45 @@ static enum AVPixelFormat color2pix_fmt(AVCodecContext 
> *avctx, int color_format)
>  av_assert0(0);
>  }
>  
> +// list pixel formats if the user tried to use one that isn't supported on 
> this device
> +static void list_pix_fmts(AVCodecContext *avctx, const char *mime)
> +{
> +MediaCodecEncContext *s = avctx->priv_data;
> +int out_formats[FF_ARRAY_ELEMS(in_formats)], n;
> +char *name = ff_AMediaCodec_getName(s->codec);
> +
> +if (!name) {
> +// API level likely below 28
> +return;
> +}
> +
> +if ((n = ff_AMediaCodec_color_formats_intersect(name, mime, in_formats,
> +
> FF_ARRAY_ELEMS(in_formats),
> +out_formats, avctx)) < 
> 0) {
> +goto done;
> +}
> +
> +for (int i = 0; i < n; i++) {
> +if (color2pix_fmt(avctx, out_formats[i]) == avctx->pix_fmt) {
> +// user specified a pixel format that is actually supported,
> +// no need to print anything
> +goto done;
> +}
> +}
> +
> +AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);

Missing ‘const’ and triggered -Wdeclaration-after-statement.

> +av_log(avctx, AV_LOG_ERROR, "pixel format %s not supported by MediaCodec 
> %s\n", desc->name, name);
> +av_log(avctx, AV_LOG_INFO, "supported formats are:");
> +for (int i = 0; i < n; i++) {
> +desc = av_pix_fmt_desc_get(color2pix_fmt(avctx, out_formats[i]));
> +av_log(avctx, AV_LOG_INFO, " %s", desc->name);
> +}
> +av_log(avctx, AV_LOG_INFO, "\n");

It’s not thread safe, it can be interrupted by other threads' log message.

> +
> +done:
> +av_free(name);
> +}
> +
>  static int mediacodec_init_bsf(AVCodecContext *avctx)
>  {
>  MediaCodecEncContext *s = avctx->priv_data;
> @@ -308,6 +353,7 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
>  ret = ff_AMediaCodec_configure(s->codec, format, s->window, NULL, ret);
>  if (ret) {
>  av_log(avctx, AV_LOG_ERROR, "MediaCodec configure failed, %s\n", 
> av_err2str(ret));
> +list_pix_fmts(avctx, codec_mime);
>  goto bailout;
>  }
>  
> -- 
> 2.30.2
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavcodec/libfdk-aacnc: send encoder delay/padding in packet side data

2023-02-28 Thread Martin Storsjö

On Fri, 24 Feb 2023, JonHGee wrote:


---
libavcodec/libfdk-aacenc.c | 27 ++-
1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 54549de473..55d10990e4 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -21,6 +21,7 @@

#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "audio_frame_queue.h"
@@ -46,6 +47,7 @@ typedef struct AACContext {
int latm;
int header_period;
int vbr;
+int delay_sent;

AudioFrameQueue afq;
} AACContext;
@@ -368,7 +370,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
int out_buffer_identifier = OUT_BITSTREAM_DATA;
int out_buffer_size, out_buffer_element_size;
void *in_ptr, *out_ptr;
-int ret;
+int ret, discard_padding;
uint8_t dummy_buf[1];
AACENC_ERROR err;

@@ -428,6 +430,29 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
ff_af_queue_remove(>afq, avctx->frame_size, >pts,
   >duration);

+discard_padding = avctx->frame_size - avpkt->duration;
+// Check if subtraction resulted in an overflow
+if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) {
+av_log(avctx, AV_LOG_ERROR, "discard padding overflow\n");
+av_packet_unref(avpkt);
+av_free(avpkt);


I don't think we can or should free the avpkt pointer here (which is 
allocated by the caller).



+return AVERROR(EINVAL);
+}
+if ((!s->delay_sent && avctx->initial_padding > 0) || discard_padding > 0) 
{
+uint8_t *side_data =
+av_packet_new_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
+if (!side_data) {
+av_packet_unref(avpkt);
+av_free(avpkt);
+return AVERROR(ENOMEM);
+}
+if (!s->delay_sent) {
+AV_WL32(side_data, avctx->initial_padding);
+s->delay_sent = 1;
+}
+AV_WL32(side_data + 4, discard_padding);
+}
+


Other than that, this seems reasonable. There's a bunch of stylistic 
choices that I'd do slightly differently here, but this seems to match 
existing code in libavcodec/libmp3lame.c, so it's probably ok to keep it 
matching.


// Martin

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

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


Re: [FFmpeg-devel] [PATCH 3/4] lavc/mediacodec_wrapper: Add function for probing supported color formats

2023-02-28 Thread zhilizhao(赵志立)
> This patch has been released by Epic Games' legal department.

This patch has the same -Wdeclaration-after-statement issue as patch 2/4.

PS: I’m not sure whether the legal statement is appropriate as commit
message. It should be self-evident for patches sending to the mailing
list :)

> ---
>  libavcodec/mediacodec_wrapper.c | 112 
>  libavcodec/mediacodec_wrapper.h |  15 +
>  2 files changed, 127 insertions(+)
> 
> diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
> index 82eead2833..9d2560205f 100644
> --- a/libavcodec/mediacodec_wrapper.c
> +++ b/libavcodec/mediacodec_wrapper.c
> @@ -532,6 +532,118 @@ done:
>  return name;
>  }
>  
___
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/4] lavc/mediacodec_wrapper: Refactor ff_AMediaCodecList_getCodecNameByType()

2023-02-28 Thread zhilizhao(赵志立)
> 
> A lot shorter, nested variables and keeps going in case of exceptions.
> Makes use of C99 declarations.
> 
> This patch has been released by Epic Games' legal department.

This patch triggered multiple warning:

warning: mixing declarations and code is incompatible with standards before C99 
[-Wdeclaration-after-statement]

C99 allows declaration-after-statement, but it’s not allowed by our
coding style. -Wdeclaration-after-statement is enabled explicitly in
configure.

> ---
>  libavcodec/mediacodec_wrapper.c | 162 +---
>  1 file changed, 45 insertions(+), 117 deletions(-)
> 
> diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
> index 34ec2134aa..82eead2833 100644
> --- a/libavcodec/mediacodec_wrapper.c
> +++ b/libavcodec/mediacodec_wrapper.c
> @@ -2,6 +2,7 @@
>   * Android MediaCodec Wrapper
>   *
>   * Copyright (c) 2015-2016 Matthieu Bouron 
> + * Modifications by Epic Games, Inc., 2023.
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -365,26 +366,13 @@ int 
> ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
>  char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, 
> int encoder, void *log_ctx)
>  {
>  int ret;
> -int i;
> -int codec_count;
>  int found_codec = 0;
>  char *name = NULL;
> -char *supported_type = NULL;
>  
>  JNIEnv *env = NULL;
>  struct JNIAMediaCodecListFields jfields = { 0 };
>  struct JNIAMediaFormatFields mediaformat_jfields = { 0 };
>  
> -jobject codec_name = NULL;
> -
> -jobject info = NULL;
> -jobject type = NULL;
> -jobjectArray types = NULL;
> -
> -jobject capabilities = NULL;
> -jobject profile_level = NULL;
> -jobjectArray profile_levels = NULL;
> -
>  JNI_GET_ENV_OR_RETURN(env, log_ctx, NULL);
>  
>  if ((ret = ff_jni_init_jfields(env, , 
> jni_amediacodeclist_mapping, 0, log_ctx)) < 0) {
> @@ -395,29 +383,26 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
> *mime, int profile, int e
>  goto done;
>  }
>  
> -codec_count = (*env)->CallStaticIntMethod(env, 
> jfields.mediacodec_list_class, jfields.get_codec_count_id);
> +int codec_count = (*env)->CallStaticIntMethod(env, 
> jfields.mediacodec_list_class, jfields.get_codec_count_id);
>  if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
>  goto done;
>  }
>  
> -for(i = 0; i < codec_count; i++) {
> -int j;
> -int type_count;
> -int is_encoder;
> -
> -info = (*env)->CallStaticObjectMethod(env, 
> jfields.mediacodec_list_class, jfields.get_codec_info_at_id, i);
> +for (int i = 0; i < codec_count && !found_codec; i++) {
> +jobject info = (*env)->CallStaticObjectMethod(env, 
> jfields.mediacodec_list_class, jfields.get_codec_info_at_id, i);
>  if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> -goto done;
> +continue;
>  }
>  
> -types = (*env)->CallObjectMethod(env, info, 
> jfields.get_supported_types_id);
> +jobject codec_name = NULL;
> +jobjectArray types = (*env)->CallObjectMethod(env, info, 
> jfields.get_supported_types_id);
>  if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> -goto done;
> +goto done_with_info;
>  }
>  
> -is_encoder = (*env)->CallBooleanMethod(env, info, 
> jfields.is_encoder_id);
> +int is_encoder = (*env)->CallBooleanMethod(env, info, 
> jfields.is_encoder_id);
>  if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> -goto done;
> +goto done_with_info;
>  }
>  
>  if (is_encoder != encoder) {
> @@ -427,7 +412,7 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
> *mime, int profile, int e
>  if (jfields.is_software_only_id) {
>  int is_software_only = (*env)->CallBooleanMethod(env, info, 
> jfields.is_software_only_id);
>  if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> -goto done;
> +goto done_with_info;
>  }
>  
>  if (is_software_only) {
> @@ -437,17 +422,12 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
> *mime, int profile, int e
>  
>  codec_name = (*env)->CallObjectMethod(env, info, 
> jfields.get_name_id);
>  if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> -goto done;
> +goto done_with_info;
>  }
>  
>  name = ff_jni_jstring_to_utf_chars(env, codec_name, log_ctx);
>  if (!name) {
> -goto done;
> -}
> -
> -if (codec_name) {
> -(*env)->DeleteLocalRef(env, codec_name);
> -codec_name = NULL;
> +goto done_with_info;
>  }
>  
>  /* Skip software decoders */
> @@ -459,141 +439,89 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
> *mime, int profile, int e
>  goto done_with_info;

Re: [FFmpeg-devel] [PATCH] libavcodec/hevc: add epel_put_pixels which same as qpel in arm

2023-02-28 Thread ??????
Thank you for your advice.
I will split it, and submit a new patch.
On the other hand, I will run "make fate-hevc" to check over.




--Original--
From:   
 "Martin Storsj?1?7"

https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: fix NULL pointer dereference

2023-02-28 Thread Steven Liu
Zhao Zhili  于2023年2月28日周二 18:44写道:
>
> From: Zhao Zhili 
>
> This can happen if encoder init failed before setup the queue, then
> reorder_queue_flush() is called by close().
>
> Fix ticket #10221
>
> Signed-off-by: Zhao Zhili 
> ---
>  libavcodec/nvenc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index 8a28454042..dda2dc3ba1 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -178,6 +178,8 @@ static void reorder_queue_flush(AVFifo *queue)
>  {
>  FrameData fd;
>
> +if (!queue)
> +return;
>  while (av_fifo_read(queue, , 1) >= 0)
>  av_buffer_unref(_opaque_ref);
>  }
> --
> 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".


lgtm

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

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


[FFmpeg-devel] [PATCH] avcodec/pthread_frame: remove forgotten deprecation warning wrappers

2023-02-28 Thread James Almer
Missed in e0786a8e.

Signed-off-by: James Almer 
---
 libavcodec/pthread_frame.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index d9d5afaa82..31785acbef 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -903,10 +903,8 @@ static int thread_get_buffer_internal(AVCodecContext 
*avctx, AVFrame *f, int fla
 return ff_get_buffer(avctx, f, flags);
 
 p = avctx->internal->thread_ctx;
-FF_DISABLE_DEPRECATION_WARNINGS
 if (atomic_load(>state) != STATE_SETTING_UP &&
 ffcodec(avctx->codec)->update_thread_context) {
-FF_ENABLE_DEPRECATION_WARNINGS
 av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after 
ff_thread_finish_setup()\n");
 return -1;
 }
-- 
2.39.2

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

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


[FFmpeg-devel] [PATCH 2/2] libavcodec/libvpxenc: move libvpx-vp9 init_static_data function to the only place it's used

2023-02-28 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/Makefile|  4 +--
 libavcodec/libvpx.c| 81 --
 libavcodec/libvpx.h| 10 --
 libavcodec/libvpxenc.c | 41 -
 4 files changed, 42 insertions(+), 94 deletions(-)
 delete mode 100644 libavcodec/libvpx.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 389253f5d0..6c797b8e14 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1121,8 +1121,8 @@ OBJS-$(CONFIG_LIBVORBIS_ENCODER)  += 
libvorbisenc.o \
  vorbis_data.o
 OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o
 OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o
-OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o libvpx.o
-OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o libvpx.o
+OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o
+OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o
 OBJS-$(CONFIG_LIBWEBP_ENCODER)+= libwebpenc_common.o libwebpenc.o
 OBJS-$(CONFIG_LIBWEBP_ANIM_ENCODER)   += libwebpenc_common.o 
libwebpenc_animencoder.o
 OBJS-$(CONFIG_LIBX262_ENCODER)+= libx264.o
diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
deleted file mode 100644
index 8601f82bd2..00
--- a/libavcodec/libvpx.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2013 Guillaume Martres 
- *
- * 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 
-#include "libvpx.h"
-#include "config.h"
-#include "config_components.h"
-
-#if CONFIG_LIBVPX_VP9_ENCODER
-#include 
-#include 
-#endif
-
-static const enum AVPixelFormat vp9_pix_fmts_def[] = {
-AV_PIX_FMT_YUV420P,
-AV_PIX_FMT_YUVA420P,
-AV_PIX_FMT_NONE
-};
-
-#if CONFIG_LIBVPX_VP9_ENCODER
-static const enum AVPixelFormat vp9_pix_fmts_highcol[] = {
-AV_PIX_FMT_YUV420P,
-AV_PIX_FMT_YUVA420P,
-AV_PIX_FMT_YUV422P,
-AV_PIX_FMT_YUV440P,
-AV_PIX_FMT_YUV444P,
-AV_PIX_FMT_GBRP,
-AV_PIX_FMT_NONE
-};
-
-static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
-AV_PIX_FMT_YUV420P,
-AV_PIX_FMT_YUVA420P,
-AV_PIX_FMT_YUV422P,
-AV_PIX_FMT_YUV440P,
-AV_PIX_FMT_YUV444P,
-AV_PIX_FMT_YUV420P10,
-AV_PIX_FMT_YUV422P10,
-AV_PIX_FMT_YUV440P10,
-AV_PIX_FMT_YUV444P10,
-AV_PIX_FMT_YUV420P12,
-AV_PIX_FMT_YUV422P12,
-AV_PIX_FMT_YUV440P12,
-AV_PIX_FMT_YUV444P12,
-AV_PIX_FMT_GBRP,
-AV_PIX_FMT_GBRP10,
-AV_PIX_FMT_GBRP12,
-AV_PIX_FMT_NONE
-};
-#endif
-
-av_cold void ff_vp9_init_static(FFCodec *codec)
-{
-codec->p.pix_fmts = vp9_pix_fmts_def;
-#if CONFIG_LIBVPX_VP9_ENCODER
-{
-vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx());
-if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH)
-codec->p.pix_fmts = vp9_pix_fmts_highbd;
-else
-codec->p.pix_fmts = vp9_pix_fmts_highcol;
-}
-#endif
-}
diff --git a/libavcodec/libvpx.h b/libavcodec/libvpx.h
index 331feb8745..4671e0edef 100644
--- a/libavcodec/libvpx.h
+++ b/libavcodec/libvpx.h
@@ -21,16 +21,6 @@
 #ifndef AVCODEC_LIBVPX_H
 #define AVCODEC_LIBVPX_H
 
-#include 
-
-#include "codec_internal.h"
-
 #define MAX_VPX_THREADS 64
 
-void ff_vp9_init_static(FFCodec *codec);
-#if 0
-enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img);
-vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat pix);
-#endif
-
 #endif /* AVCODEC_LIBVPX_H */
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 339d4d8146..5e6467a3d0 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1979,6 +1979,45 @@ static av_cold int vp9_init(AVCodecContext *avctx)
 return vpx_init(avctx, vpx_codec_vp9_cx());
 }
 
+static const enum AVPixelFormat vp9_pix_fmts_highcol[] = {
+AV_PIX_FMT_YUV420P,
+AV_PIX_FMT_YUVA420P,
+AV_PIX_FMT_YUV422P,
+AV_PIX_FMT_YUV440P,
+AV_PIX_FMT_YUV444P,
+AV_PIX_FMT_GBRP,
+AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
+AV_PIX_FMT_YUV420P,
+AV_PIX_FMT_YUVA420P,
+AV_PIX_FMT_YUV422P,
+AV_PIX_FMT_YUV440P,
+AV_PIX_FMT_YUV444P,
+AV_PIX_FMT_YUV420P10,
+AV_PIX_FMT_YUV422P10,
+AV_PIX_FMT_YUV440P10,
+AV_PIX_FMT_YUV444P10,
+

[FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function

2023-02-28 Thread James Almer
It's used only by the encoder.

Signed-off-by: James Almer 
---
 libavcodec/libvpxdec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 0ae19c3f72..8e6291fe20 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = {
 FF_CODEC_DECODE_CB(vpx_decode),
 .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
   FF_CODEC_CAP_AUTO_THREADS,
-.init_static_data = ff_vp9_init_static,
 };
 #endif /* CONFIG_LIBVPX_VP9_DECODER */
-- 
2.39.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] [PATCH 1/4] lavc/mediacodecenc: Add pix2color_fmt() and color2pix_fmt()

2023-02-28 Thread zhilizhao(赵志立)
> +static int pix2color_fmt(AVCodecContext *avctx, enum AVPixelFormat pix_fmt)
> +{
> +for (int i = 0; i < FF_ARRAY_ELEMS(color_formats); i++) {
> +if (pix_fmt == color_formats[i].pix_fmt) {
> +return color_formats[i].color_format;
> +}
> +}
> +av_assert0(0);
> +}

After extracting to a general function, there is no hint that pix_fmt comes
from avctx->pix_fmt. So I prefer return error code here.

> +
> +static enum AVPixelFormat color2pix_fmt(AVCodecContext *avctx, int 
> color_format)
> +{
> +for (int i = 0; i < FF_ARRAY_ELEMS(color_formats); i++) {
> +if (color_format == color_formats[i].color_format) {
> +return color_formats[i].pix_fmt;
> +}
> +}
> +av_assert0(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 7/8] lavc/libvpxenc: handle queue desync more gracefully

2023-02-28 Thread Anton Khirnov
If the packets returned by libvpx and our internal frame properties
queue get desynchronized for some reason (should not happen, but it is
not clear libvpx API guarantees this), we will keep adding to the queue
indefinitely and never remove anything.

Change the code to drain the queue even if timestamps do not match.
---
 libavcodec/libvpxenc.c | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 33f35bbaf4..aeeaa0e681 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -401,11 +401,16 @@ static int frame_data_apply(AVCodecContext *avctx, AVFifo 
*fifo, AVPacket *pkt)
 {
 FrameData fd;
 uint8_t *data;
+int ret = 0;
+
 if (av_fifo_peek(fifo, , 1, 0) < 0)
 return 0;
-if (fd.pts != pkt->pts)
-return 0;
-av_fifo_drain2(fifo, 1);
+if (fd.pts != pkt->pts) {
+av_log(avctx, AV_LOG_WARNING,
+   "Mismatching timestamps: libvpx %"PRId64" queued %"PRId64"; "
+   "this is a bug, please report it\n", pkt->pts, fd.pts);
+goto skip;
+}
 
 #if FF_API_REORDERED_OPAQUE
 FF_DISABLE_DEPRECATION_WARNINGS
@@ -419,20 +424,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
 pkt->opaque_ref = fd.frame_opaque_ref;
 fd.frame_opaque_ref = NULL;
 }
-av_buffer_unref(_opaque_ref);
 
 if (fd.hdr10_plus) {
 data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
fd.hdr10_plus->size);
 if (!data) {
-av_buffer_unref(_plus);
-return AVERROR(ENOMEM);
+ret = AVERROR(ENOMEM);
+goto skip;
 }
 
 memcpy(data, fd.hdr10_plus->data, fd.hdr10_plus->size);
-av_buffer_unref(_plus);
 }
 
-return 0;
+skip:
+av_fifo_drain2(fifo, 1);
+frame_data_uninit();
+
+return ret;
 }
 
 static av_cold int codecctl_int(AVCodecContext *avctx,
-- 
2.39.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 8/8] lavc/libvpxenc: drop FrameListData.duration

2023-02-28 Thread Anton Khirnov
It is write-only.
---
 libavcodec/libvpxenc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index aeeaa0e681..3d1abb7df9 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -58,8 +58,6 @@ struct FrameListData {
 size_t sz;   /**< length of compressed data */
 int64_t pts; /**< time stamp to show frame
   (in timebase units) */
-unsigned long duration;  /**< duration to show frame
-  (in timebase units) */
 uint32_t flags;  /**< flags for this frame */
 uint64_t sse[4];
 int have_sse;/**< true if we have pending sse[] */
@@ -1295,7 +1293,6 @@ static inline void cx_pktcpy(struct FrameListData *dst,
  VPxContext *ctx)
 {
 dst->pts  = src->data.frame.pts;
-dst->duration = src->data.frame.duration;
 dst->flags= src->data.frame.flags;
 dst->sz   = src->data.frame.sz;
 dst->buf  = src->data.frame.buf;
-- 
2.39.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/8] lavc/libvpxenc: drop frame_number

2023-02-28 Thread Anton Khirnov
It is not used, except to check whether the packet is valid before
writing HDR metadata to the packet in storeframe(). However, that check
serves no purpose, as the encoded packet is already treated as valid
higher up in this function.
---
 libavcodec/libvpxenc.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 339d4d8146..eaa4ad8f25 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -63,7 +63,6 @@ struct FrameListData {
 uint32_t flags;  /**< flags for this frame */
 uint64_t sse[4];
 int have_sse;/**< true if we have pending sse[] */
-uint64_t frame_number;
 struct FrameListData *next;
 };
 
@@ -84,7 +83,6 @@ typedef struct VPxEncoderContext {
 int deadline; //i.e., RT/GOOD/BEST
 uint64_t sse[4];
 int have_sse; /**< true if we have pending sse[] */
-uint64_t frame_number;
 struct FrameListData *coded_frame_list;
 struct FrameListData *alpha_coded_frame_list;
 
@@ -1220,9 +1218,8 @@ static inline void cx_pktcpy(struct FrameListData *dst,
 dst->sz   = src->data.frame.sz;
 dst->buf  = src->data.frame.buf;
 dst->have_sse = 0;
-/* For alt-ref frame, don't store PSNR or increment frame_number */
+/* For alt-ref frame, don't store PSNR */
 if (!(dst->flags & VPX_FRAME_IS_INVISIBLE)) {
-dst->frame_number = ++ctx->frame_number;
 dst->have_sse = ctx->have_sse;
 if (ctx->have_sse) {
 /* associate last-seen SSE to the frame. */
@@ -1232,8 +1229,6 @@ static inline void cx_pktcpy(struct FrameListData *dst,
 memcpy(dst->sse, ctx->sse, sizeof(dst->sse));
 ctx->have_sse = 0;
 }
-} else {
-dst->frame_number = -1;   /* sanity marker */
 }
 }
 
@@ -1289,13 +1284,11 @@ static int storeframe(AVCodecContext *avctx, struct 
FrameListData *cx_frame,
 AV_WB64(side_data, 1);
 memcpy(side_data + 8, alpha_cx_frame->buf, alpha_cx_frame->sz);
 }
-if (cx_frame->frame_number != -1) {
 if (ctx->hdr10_plus_fifo) {
 int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
 if (err < 0)
 return err;
 }
-}
 
 return pkt->size;
 }
-- 
2.39.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 6/8] lavc/libvpxenc: drop a useless condition

2023-02-28 Thread Anton Khirnov
A non-NULL packet is always passed to frame_data_apply().
---
 libavcodec/libvpxenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index af16e53deb..33f35bbaf4 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -401,7 +401,7 @@ static int frame_data_apply(AVCodecContext *avctx, AVFifo 
*fifo, AVPacket *pkt)
 {
 FrameData fd;
 uint8_t *data;
-if (!pkt || av_fifo_peek(fifo, , 1, 0) < 0)
+if (av_fifo_peek(fifo, , 1, 0) < 0)
 return 0;
 if (fd.pts != pkt->pts)
 return 0;
-- 
2.39.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 4/8] lavc/libvpxenc: rename hdr10_plus_fifo and related objects

2023-02-28 Thread Anton Khirnov
This AVFifo is used to propagate HDR metadata from input frames to
output packets, since libvpx does not allow passing through arbitrary
user data.

It will be extended to pass through other kinds of data in future
commits, so give it a more generic name.
---
 libavcodec/libvpxenc.c | 51 +-
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index abaa8c3513..77921badba 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -66,10 +66,10 @@ struct FrameListData {
 struct FrameListData *next;
 };
 
-typedef struct FrameHDR10Plus {
+typedef struct FrameData {
 int64_t pts;
 AVBufferRef *hdr10_plus;
-} FrameHDR10Plus;
+} FrameData;
 
 typedef struct VPxEncoderContext {
 AVClass *class;
@@ -130,7 +130,9 @@ typedef struct VPxEncoderContext {
 int corpus_complexity;
 int tpl_model;
 int min_gf_interval;
-AVFifo *hdr10_plus_fifo;
+
+// This FIFO is used to propagate various properties from frames to 
packets.
+AVFifo *fifo;
 /**
  * If the driver does not support ROI then warn the first time we
  * encounter a frame with ROI side data.
@@ -327,32 +329,32 @@ static av_cold void free_frame_list(struct FrameListData 
*list)
 }
 }
 
-static av_cold void free_hdr10_plus_fifo(AVFifo **fifo)
+static av_cold void fifo_free(AVFifo **fifo)
 {
-FrameHDR10Plus frame_hdr10_plus;
-while (av_fifo_read(*fifo, _hdr10_plus, 1) >= 0)
-av_buffer_unref(_hdr10_plus.hdr10_plus);
+FrameData fd;
+while (av_fifo_read(*fifo, , 1) >= 0)
+av_buffer_unref(_plus);
 av_fifo_freep2(fifo);
 }
 
-static int copy_hdr10_plus_to_pkt(AVFifo *fifo, AVPacket *pkt)
+static int frame_data_apply(AVFifo *fifo, AVPacket *pkt)
 {
-FrameHDR10Plus frame_hdr10_plus;
+FrameData fd;
 uint8_t *data;
-if (!pkt || av_fifo_peek(fifo, _hdr10_plus, 1, 0) < 0)
+if (!pkt || av_fifo_peek(fifo, , 1, 0) < 0)
 return 0;
-if (!frame_hdr10_plus.hdr10_plus || frame_hdr10_plus.pts != pkt->pts)
+if (!fd.hdr10_plus || fd.pts != pkt->pts)
 return 0;
 av_fifo_drain2(fifo, 1);
 
-data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
frame_hdr10_plus.hdr10_plus->size);
+data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
fd.hdr10_plus->size);
 if (!data) {
-av_buffer_unref(_hdr10_plus.hdr10_plus);
+av_buffer_unref(_plus);
 return AVERROR(ENOMEM);
 }
 
-memcpy(data, frame_hdr10_plus.hdr10_plus->data, 
frame_hdr10_plus.hdr10_plus->size);
-av_buffer_unref(_hdr10_plus.hdr10_plus);
+memcpy(data, fd.hdr10_plus->data, fd.hdr10_plus->size);
+av_buffer_unref(_plus);
 return 0;
 }
 
@@ -447,8 +449,8 @@ static av_cold int vpx_free(AVCodecContext *avctx)
 av_freep(>stats_out);
 free_frame_list(ctx->coded_frame_list);
 free_frame_list(ctx->alpha_coded_frame_list);
-if (ctx->hdr10_plus_fifo)
-free_hdr10_plus_fifo(>hdr10_plus_fifo);
+if (ctx->fifo)
+fifo_free(>fifo);
 return 0;
 }
 
@@ -919,9 +921,8 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 // Keep HDR10+ if it has bit depth higher than 8 and
 // it has PQ trc (SMPTE2084).
 if (enccfg.g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) 
{
-ctx->hdr10_plus_fifo = av_fifo_alloc2(1, sizeof(FrameHDR10Plus),
-  AV_FIFO_FLAG_AUTO_GROW);
-if (!ctx->hdr10_plus_fifo)
+ctx->fifo = av_fifo_alloc2(1, sizeof(FrameData), 
AV_FIFO_FLAG_AUTO_GROW);
+if (!ctx->fifo)
 return AVERROR(ENOMEM);
 }
 }
@@ -1284,8 +1285,8 @@ static int storeframe(AVCodecContext *avctx, struct 
FrameListData *cx_frame,
 AV_WB64(side_data, 1);
 memcpy(side_data + 8, alpha_cx_frame->buf, alpha_cx_frame->sz);
 }
-if (ctx->hdr10_plus_fifo) {
-int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
+if (ctx->fifo) {
+int err = frame_data_apply(ctx->fifo, pkt);
 if (err < 0)
 return err;
 }
@@ -1702,18 +1703,18 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket 
*pkt,
 }
 }
 
-if (ctx->hdr10_plus_fifo) {
+if (ctx->fifo) {
 AVFrameSideData *hdr10_plus_metadata;
 // Add HDR10+ metadata to queue.
 hdr10_plus_metadata = av_frame_get_side_data(frame, 
AV_FRAME_DATA_DYNAMIC_HDR_PLUS);
 if (hdr10_plus_metadata) {
 int err;
-struct FrameHDR10Plus data;
+FrameData data;
 data.pts = frame->pts;
 data.hdr10_plus = av_buffer_ref(hdr10_plus_metadata->buf);
 if (!data.hdr10_plus)
 return AVERROR(ENOMEM);
-err = av_fifo_write(ctx->hdr10_plus_fifo, , 1);
+err = 

[FFmpeg-devel] [PATCH 3/8] lavc/libvpxenc: reindent

2023-02-28 Thread Anton Khirnov
---
 libavcodec/libvpxenc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index eaa4ad8f25..abaa8c3513 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1284,11 +1284,11 @@ static int storeframe(AVCodecContext *avctx, struct 
FrameListData *cx_frame,
 AV_WB64(side_data, 1);
 memcpy(side_data + 8, alpha_cx_frame->buf, alpha_cx_frame->sz);
 }
-if (ctx->hdr10_plus_fifo) {
-int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
-if (err < 0)
-return err;
-}
+if (ctx->hdr10_plus_fifo) {
+int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
+if (err < 0)
+return err;
+}
 
 return pkt->size;
 }
-- 
2.39.1

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

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


[FFmpeg-devel] [PATCH 5/8] lavc/libvpxenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE

2023-02-28 Thread Anton Khirnov
---
 libavcodec/libvpxenc.c | 139 +
 libavcodec/version.h   |   2 +-
 2 files changed, 100 insertions(+), 41 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 77921badba..af16e53deb 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -68,6 +68,14 @@ struct FrameListData {
 
 typedef struct FrameData {
 int64_t pts;
+int64_t duration;
+
+#if FF_API_REORDERED_OPAQUE
+int64_t  reordered_opaque;
+#endif
+void*frame_opaque;
+AVBufferRef *frame_opaque_ref;
+
 AVBufferRef *hdr10_plus;
 } FrameData;
 
@@ -329,32 +337,101 @@ static av_cold void free_frame_list(struct FrameListData 
*list)
 }
 }
 
+static void frame_data_uninit(FrameData *fd)
+{
+av_buffer_unref(>frame_opaque_ref);
+av_buffer_unref(>hdr10_plus);
+}
+
 static av_cold void fifo_free(AVFifo **fifo)
 {
 FrameData fd;
 while (av_fifo_read(*fifo, , 1) >= 0)
-av_buffer_unref(_plus);
+frame_data_uninit();
 av_fifo_freep2(fifo);
 }
 
-static int frame_data_apply(AVFifo *fifo, AVPacket *pkt)
+static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo,
+ const AVFrame *frame)
+{
+VPxContext *ctx = avctx->priv_data;
+const struct vpx_codec_enc_cfg *enccfg = ctx->encoder.config.enc;
+
+FrameDatafd = { .pts = frame->pts };
+
+AVFrameSideData *av_uninit(sd);
+int ret;
+
+#if CONFIG_LIBVPX_VP9_ENCODER
+// Keep HDR10+ if it has bit depth higher than 8 and
+// it has PQ trc (SMPTE2084).
+sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);
+if (avctx->codec_id == AV_CODEC_ID_VP9 && sd &&
+enccfg->g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) {
+fd.hdr10_plus = av_buffer_ref(sd->buf);
+if (!fd.hdr10_plus)
+return AVERROR(ENOMEM);
+}
+#endif
+
+fd.duration = frame->duration;
+fd.frame_opaque = frame->opaque;
+if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE && frame->opaque_ref) {
+ret = av_buffer_replace(_opaque_ref, frame->opaque_ref);
+if (ret < 0)
+goto fail;
+}
+#if FF_API_REORDERED_OPAQUE
+FF_DISABLE_DEPRECATION_WARNINGS
+fd.reordered_opaque = frame->reordered_opaque;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ret = av_fifo_write(fifo, , 1);
+if (ret < 0)
+goto fail;
+
+return 0;
+fail:
+frame_data_uninit();
+return ret;
+}
+
+static int frame_data_apply(AVCodecContext *avctx, AVFifo *fifo, AVPacket *pkt)
 {
 FrameData fd;
 uint8_t *data;
 if (!pkt || av_fifo_peek(fifo, , 1, 0) < 0)
 return 0;
-if (!fd.hdr10_plus || fd.pts != pkt->pts)
+if (fd.pts != pkt->pts)
 return 0;
 av_fifo_drain2(fifo, 1);
 
-data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
fd.hdr10_plus->size);
-if (!data) {
+#if FF_API_REORDERED_OPAQUE
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->reordered_opaque = fd.reordered_opaque;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+pkt->duration = fd.duration;
+if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
+pkt->opaque = fd.frame_opaque;
+pkt->opaque_ref = fd.frame_opaque_ref;
+fd.frame_opaque_ref = NULL;
+}
+av_buffer_unref(_opaque_ref);
+
+if (fd.hdr10_plus) {
+data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
fd.hdr10_plus->size);
+if (!data) {
+av_buffer_unref(_plus);
+return AVERROR(ENOMEM);
+}
+
+memcpy(data, fd.hdr10_plus->data, fd.hdr10_plus->size);
 av_buffer_unref(_plus);
-return AVERROR(ENOMEM);
 }
 
-memcpy(data, fd.hdr10_plus->data, fd.hdr10_plus->size);
-av_buffer_unref(_plus);
 return 0;
 }
 
@@ -914,17 +991,14 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 return AVERROR(EINVAL);
 }
 
+ctx->fifo = av_fifo_alloc2(1, sizeof(FrameData), AV_FIFO_FLAG_AUTO_GROW);
+if (!ctx->fifo)
+return AVERROR(ENOMEM);
+
 #if CONFIG_LIBVPX_VP9_ENCODER
 if (avctx->codec_id == AV_CODEC_ID_VP9) {
 if (set_pix_fmt(avctx, codec_caps, , , _fmt))
 return AVERROR(EINVAL);
-// Keep HDR10+ if it has bit depth higher than 8 and
-// it has PQ trc (SMPTE2084).
-if (enccfg.g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) 
{
-ctx->fifo = av_fifo_alloc2(1, sizeof(FrameData), 
AV_FIFO_FLAG_AUTO_GROW);
-if (!ctx->fifo)
-return AVERROR(ENOMEM);
-}
 }
 #endif
 
@@ -1285,11 +1359,9 @@ static int storeframe(AVCodecContext *avctx, struct 
FrameListData *cx_frame,
 AV_WB64(side_data, 1);
 memcpy(side_data + 8, alpha_cx_frame->buf, alpha_cx_frame->sz);
 }
-if (ctx->fifo) {
-int err = frame_data_apply(ctx->fifo, pkt);
-if (err < 0)
-return err;
-}
+ret = 

[FFmpeg-devel] [PATCH 1/8] lavu/frame: improve AVFrame.opaque[_ref] documentation

2023-02-28 Thread Anton Khirnov
Make them match each other, mention interaction with
AV_CODEC_FLAG_COPY_OPAQUE.
---
 libavutil/frame.h | 30 +++---
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/libavutil/frame.h b/libavutil/frame.h
index 2580269549..4ed27cf43f 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -470,7 +470,18 @@ typedef struct AVFrame {
 int quality;
 
 /**
- * for some private data of the user
+ * Frame owner's private data.
+ *
+ * This field may be set by the code that allocates/owns the frame data.
+ * It is then not touched by any library functions, except:
+ * - it is copied to other references by av_frame_copy_props() (and hence 
by
+ *   av_frame_ref());
+ * - it is set to NULL when the frame is cleared by av_frame_unref()
+ * - on the caller's explicit request. E.g. libavcodec encoders/decoders
+ *   will copy this field to/from @ref AVPacket "AVPackets" if the caller 
sets
+ *   @ref AV_CODEC_FLAG_COPY_OPAQUE.
+ *
+ * @see opaque_ref the reference-counted analogue
  */
 void *opaque;
 
@@ -678,13 +689,18 @@ typedef struct AVFrame {
 AVBufferRef *hw_frames_ctx;
 
 /**
- * AVBufferRef for free use by the API user. FFmpeg will never check the
- * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
- * the frame is unreferenced. av_frame_copy_props() calls create a new
- * reference with av_buffer_ref() for the target frame's opaque_ref field.
+ * Frame owner's private data.
+ *
+ * This field may be set by the code that allocates/owns the frame data.
+ * It is then not touched by any library functions, except:
+ * - a new reference to the underlying buffer is propagated by
+ *   av_frame_copy_props() (and hence by av_frame_ref());
+ * - it is unreferenced in av_frame_unref();
+ * - on the caller's explicit request. E.g. libavcodec encoders/decoders
+ *   will propagate a new reference to/from @ref AVPacket "AVPackets" if 
the
+ *   caller sets @ref AV_CODEC_FLAG_COPY_OPAQUE.
  *
- * This is unrelated to the opaque field, although it serves a similar
- * purpose.
+ * @see opaque the plain pointer analogue
  */
 AVBufferRef *opaque_ref;
 
-- 
2.39.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] libavcodec/hevc: reuse scale_store on idct32x32_neon

2023-02-28 Thread Martin Storsjö

On Fri, 24 Feb 2023, xufuji456 wrote:


---
libavcodec/arm/hevcdsp_idct_neon.S | 18 ++
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/libavcodec/arm/hevcdsp_idct_neon.S 
b/libavcodec/arm/hevcdsp_idct_neon.S
index 75795e6a6a..41ca3b83a8 100644
--- a/libavcodec/arm/hevcdsp_idct_neon.S
+++ b/libavcodec/arm/hevcdsp_idct_neon.S
@@ -876,28 +876,14 @@ function func_tr_32x4_\name
movrel  r9, trans + 32
vld1.s16{q0}, [r9, :128]!
vld1.s16{q1}, [r9, :128]
-
-bl  tr_block1
-
add r4, sp, #2048
-vld1.s16{q14-q15}, [r4, :128]!
-butterfly32 q14, q10, q15, q11
-scale32 d22, d23, d20, d21, q1, q14, q10, q15, \shift
-
-vld1.s16{q14-q15}, [r4, :128]!
-butterfly32 q14, q12, q15, q13
-scale32 d2, d3, d28, d29, q1, q14, q12, q15, \shift

-transpose8_4x4  d22, d20, d2, d28
-transpose8_4x4  d29, d3, d21, d23
+bl  tr_block1
mov r1, r11
mov r2, #64
mov r8, #-64
add r3, r11, #(56 + 3 * 64)
-store16 d22, d23, d20, d21, d2, d3, d28, d29, r8
-
-@ reload multiplication coefficiens to q1
-vld1.s16{q1}, [r9, :128]
+scale_store \shift

bl  tr_block2
add r1, r11, #8
--
2.32.0 (Apple Git-132)


LGTM, thanks - pushed now.

// Martin

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

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


Re: [FFmpeg-devel] [PATCH] checkasm: add support for vvc alf

2023-02-28 Thread Martin Storsjö

On Sun, 26 Feb 2023, Nuo Mi wrote:


+#include 
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
+
+#include "libavcodec/avcodec.h"
+
+#include "libavcodec/vvcdsp.h"
+#include "libavcodec/vvcdec.h"
+
+#include "checkasm.h"
+
+static const uint32_t pixel_mask[3] = { 0x, 0x03ff03ff, 0x0fff0fff };
+
+#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
+#define PIXEL_STRIDE (ALF_SUBBLOCK_SIZE + 2 * ALF_PADDING_SIZE)
+#define BUF_SIZE (PIXEL_STRIDE * (MAX_CTU_SIZE + 3 * 2) * 2) //+3 * 2 for top 
and bottom row, *2 for high bit depth
+#define LUMA_PARAMS_SIZE (ALF_SUBBLOCK_SIZE / 4 * ALF_SUBBLOCK_SIZE / 4 * 
ALF_NUM_COEFF_LUMA)
+
+#define randomize_buffers(buf0, buf1, size) \
+do {\
+uint32_t mask = pixel_mask[(bit_depth - 8) >> 1];   \
+int k;  \
+for (k = 0; k < size; k += 4) { \
+uint32_t r = rnd() & mask;  \
+AV_WN32A(buf0 + k, r);  \
+AV_WN32A(buf1 + k, r);  \
+}   \
+} while (0)
+
+#define randomize_buffers2(buf, size, filter)   \
+do {\
+int k;  \
+if (filter) {   \
+for (k = 0; k < size; k++) {\
+uint8_t r = rnd();  \
+buf[k] = r; \
+}   \
+} else {\
+for (k = 0; k < size; k++) {\
+int16_t r = rnd();  \
+buf[k] = r; \
+}   \
+}   \
+} while (0)


I don't quite see the point of the extra uint8_t/int16_t variable r here - 
you could just as well assign it directly to buf[k], no? Unless you 
specifically want the effect where you're narrowing the random value to a 
smaller range beforehand.



+
+static void check_alf_luma_filter(VVCDSPContext *c, const int bit_depth)
+{
+LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
+LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
+LOCAL_ALIGNED_32(uint8_t, src0, [BUF_SIZE]);
+LOCAL_ALIGNED_32(uint8_t, src1, [BUF_SIZE]);
+int8_t filter[LUMA_PARAMS_SIZE];
+int16_t clip[LUMA_PARAMS_SIZE];
+ptrdiff_t stride = PIXEL_STRIDE * SIZEOF_PIXEL;
+int offset = (3 * PIXEL_STRIDE + 3) * SIZEOF_PIXEL;
+
+declare_func_emms(AV_CPU_FLAG_AVX2, void, uint8_t *dst, ptrdiff_t 
dst_stride, const uint8_t *src, ptrdiff_t src_stride,
+int width, int height, const int8_t *filter, const int16_t *clip);
+
+randomize_buffers(src0, src1, BUF_SIZE);
+randomize_buffers2(filter, LUMA_PARAMS_SIZE, 1);
+randomize_buffers2(clip, LUMA_PARAMS_SIZE, 2);


Here, both invocations of randomize_buffers2 are called with filter=1 or 
2, both which will pick the "if (filter) {" case, so the else in 
randomize_buffers2 is unused?



+
+for (int h = 4; h < ALF_SUBBLOCK_SIZE; h += 4) {
+for (int w = 4; w < ALF_SUBBLOCK_SIZE; w += 4) {


Wouldn't you want to use <= instead of < for the comparisons here? I don't 
know vvc so I can't say for sure, but that would seem logical to me.


Are all aspect ratio combinations allowed here? E.g. the log mentions that 
you're testing 28x4 blocks. In dav1d, similar cases use logic of testing w 
in the range of [h/4, h*4] (plus limited to e.g. [4,64] at the same time). 
That would reduce the number of combinations to test, if they aren't 
really valid in practice.



+if (check_func(c->alf.filter[LUMA], 
"vvc_alf_filter_luma_%dx%d_%d", w, h, bit_depth)) {
+memset(dst0, 0, BUF_SIZE);
+memset(dst1, 0, BUF_SIZE);
+call_ref(dst0, stride, src0 + offset, stride, w, h, filter, 
clip);
+call_new(dst1, stride, src1 + offset, stride, w, h, filter, 
clip);
+for (int i = 0; i < h; i++) {
+if (memcmp(dst0 + i * stride, dst1 + i * stride, w * 
SIZEOF_PIXEL))
+fail();
+}
+bench_new(dst1, stride, src1 + offset, stride, w, h, filter, 
clip);
+}
+if (check_func(c->alf.filter[CHROMA], 
"vvc_alf_filter_chroma_%dx%d_%d", w, h, bit_depth)) {
+memset(dst0, 0, BUF_SIZE);
+memset(dst1, 0, BUF_SIZE);
+call_ref(dst0, stride, src0 + offset, stride, w, h, filter, 
clip);
+call_new(dst1, stride, src1 + offset, stride, w, h, filter, 
clip);
+  

[FFmpeg-devel] [PATCH] doc/filters: update SITI description

2023-02-28 Thread Werner Robitza
The filter implements the 'legacy' version from a superseded recommendation.
---
 doc/filters.texi | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 47e92b9269..25574cd55c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21593,9 +21593,11 @@ ffmpeg -i input1.mkv -i input2.mkv -filter_complex 
"[0:v][1:v] signature=nb_inpu
 @anchor{siti}
 @section siti
 
-Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as 
defined
-in ITU-T P.910: Subjective video quality assessment methods for multimedia
-applications. Available PDF at 
@url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
+Calculate Spatial Information (SI) and Temporal Information (TI) scores for a 
video,
+as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment 
methods
+for multimedia applications. Available PDF at 
@url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
+Note that this is a legacy implementation that corresponds to a superseded 
recommendation.
+Refer to ITU-T Rec. P.910 (07/22) for the latest version.
 
 It accepts the following option:
 
-- 
2.39.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] [PATCH] libavcodec/hevc: add epel_put_pixels which same as qpel in arm

2023-02-28 Thread Martin Storsjö

On Sun, 26 Feb 2023, xufuji456 wrote:


---
libavcodec/arm/hevcdsp_init_neon.c | 21 +++--
1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
b/libavcodec/arm/hevcdsp_init_neon.c
index 8094e6c62e..4063acaf51 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -119,7 +119,7 @@ QPEL_FUNC(ff_hevc_put_qpel_h3v3_neon_8);

#define QPEL_FUNC_UW_PIX(name) \
void name(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t 
_srcstride, \
-   int height, intptr_t mx, intptr_t my, int 
width);
+   int height, intptr_t mx, intptr_t my, int 
width)
QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w4_neon_8);
QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w8_neon_8);
QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w16_neon_8);
@@ -131,7 +131,7 @@ QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w64_neon_8);

#define QPEL_FUNC_UW(name) \
void name(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t 
_srcstride, \
-  int width, int height, const int16_t* src2, ptrdiff_t 
src2stride);
+  int width, int height, const int16_t* src2, ptrdiff_t src2stride)


These changes look like cosmetic changes unrelated to the rest; please 
split such changes to a separate patch.



QPEL_FUNC_UW(ff_hevc_put_qpel_uw_pixels_neon_8);
QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v1_neon_8);
QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v2_neon_8);
@@ -293,6 +293,17 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, 
const int bit_depth)
c->put_hevc_qpel[8][0][0]  = ff_hevc_put_pixels_w48_neon_8;
c->put_hevc_qpel[9][0][0]  = ff_hevc_put_pixels_w64_neon_8;

+c->put_hevc_epel[0][0][0]  = ff_hevc_put_pixels_w2_neon_8;
+c->put_hevc_epel[1][0][0]  = ff_hevc_put_pixels_w4_neon_8;
+c->put_hevc_epel[2][0][0]  = ff_hevc_put_pixels_w6_neon_8;
+c->put_hevc_epel[3][0][0]  = ff_hevc_put_pixels_w8_neon_8;
+c->put_hevc_epel[4][0][0]  = ff_hevc_put_pixels_w12_neon_8;
+c->put_hevc_epel[5][0][0]  = ff_hevc_put_pixels_w16_neon_8;
+c->put_hevc_epel[6][0][0]  = ff_hevc_put_pixels_w24_neon_8;
+c->put_hevc_epel[7][0][0]  = ff_hevc_put_pixels_w32_neon_8;
+c->put_hevc_epel[8][0][0]  = ff_hevc_put_pixels_w48_neon_8;
+c->put_hevc_epel[9][0][0]  = ff_hevc_put_pixels_w64_neon_8;
+
c->put_hevc_qpel_uni[1][0][0]  = ff_hevc_put_qpel_uw_pixels_w4_neon_8;
c->put_hevc_qpel_uni[3][0][0]  = ff_hevc_put_qpel_uw_pixels_w8_neon_8;
c->put_hevc_qpel_uni[5][0][0]  = ff_hevc_put_qpel_uw_pixels_w16_neon_8;
@@ -300,6 +311,12 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, 
const int bit_depth)
c->put_hevc_qpel_uni[7][0][0]  = ff_hevc_put_qpel_uw_pixels_w32_neon_8;
c->put_hevc_qpel_uni[8][0][0]  = ff_hevc_put_qpel_uw_pixels_w48_neon_8;
c->put_hevc_qpel_uni[9][0][0]  = ff_hevc_put_qpel_uw_pixels_w64_neon_8;
+
+c->put_hevc_epel_uni[1][0][0]  = ff_hevc_put_qpel_uw_pixels_w4_neon_8;
+c->put_hevc_epel_uni[3][0][0]  = ff_hevc_put_qpel_uw_pixels_w8_neon_8;
+c->put_hevc_epel_uni[5][0][0]  = ff_hevc_put_qpel_uw_pixels_w16_neon_8;
+c->put_hevc_epel_uni[6][0][0]  = ff_hevc_put_qpel_uw_pixels_w24_neon_8;
+c->put_hevc_epel_uni[7][0][0]  = ff_hevc_put_qpel_uw_pixels_w32_neon_8;
}


This change breaks "make fate-hevc" and can't be applied.

// Martin

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

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


Re: [FFmpeg-devel] [PATCH] libavcodec/hevc: add hevc idct4x4 neon of aarch64 after fixed

2023-02-28 Thread Martin Storsjö

On Fri, 24 Feb 2023, xufuji456 wrote:


---
libavcodec/aarch64/hevcdsp_idct_neon.S| 40 +++
libavcodec/aarch64/hevcdsp_init_aarch64.c |  4 +++
2 files changed, 44 insertions(+)


Thanks, this looks good to me now, will push in a moment.

The subject of the commit doesn't need to include "after fixed" or such 
comments - those comments are kinda irrelevant once the commit gets 
pushed.


It's usually good practice to include checkasm benchmark numbers (and 
mention what system the numbers are from) when posting assembly 
optimizations.


// Martin

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

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


Re: [FFmpeg-devel] [PATCH] libavformat/tcp: add local_addr/local_port for network option

2023-02-28 Thread Nicolas George
jack (12023-02-28):
> Signed-off-by: jack 
> ---
>  libavformat/tcp.c | 44 
>  1 file changed, 44 insertions(+)

Thanks for the patch

You neglected to update the documentation, and a few remarks below.

> 
> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> index a11ccbb913..598d61067e 100644
> --- a/libavformat/tcp.c
> +++ b/libavformat/tcp.c
> @@ -36,6 +36,8 @@ typedef struct TCPContext {
>  const AVClass *class;
>  int fd;
>  int listen;
> +int local_port;
> +char *local_addr;
>  int open_timeout;
>  int rw_timeout;
>  int listen_timeout;
> @@ -52,6 +54,8 @@ typedef struct TCPContext {
>  #define E AV_OPT_FLAG_ENCODING_PARAM
>  static const AVOption options[] = {
>  { "listen",  "Listen for incoming connections",  OFFSET(listen), 
> AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   2,   .flags = D|E },
> +{ "local_port",  "Local port",   
>   OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },  -1, 
> INT_MAX, .flags = D|E },
> +{ "local_addr",  "Local address",
>   OFFSET(local_addr), AV_OPT_TYPE_STRING, { .str = NULL }, 0,   
> 0, .flags = D|E },
>  { "timeout", "set timeout (in microseconds) of socket I/O 
> operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, 
> -1, INT_MAX, .flags = D|E },
>  { "listen_timeout",  "Connection awaiting timeout (in milliseconds)",
>   OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 
> INT_MAX, .flags = D|E },
>  { "send_buffer_size", "Socket send buffer size (in bytes)",  
>   OFFSET(send_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 
> INT_MAX, .flags = D|E },
> @@ -73,6 +77,39 @@ static const AVClass tcp_class = {
>  static void customize_fd(void *ctx, int fd)
>  {
>  TCPContext *s = ctx;
> +

> +if (s->local_addr) {

s->local_addr || s->local_port

> +struct addrinfo hints = { 0 }, *ai;
> +int ret;
> +int port = 0;
> +
> +hints.ai_family = AF_UNSPEC;
> +hints.ai_socktype = SOCK_STREAM;
> +
> +if (s->local_port > 0)
> +port = s->local_port;
> +

> +ret = getaddrinfo(s->local_addr, "0", , );

The provided port should be used instead of this "0", and be a string,
and named service.

(The remote port should be a string too, alas.)

> +if (ret) {

> +av_log(ctx, AV_LOG_WARNING,
> +   "Failed to bind local addr: %s port: %d err: %s\n",
> +s->local_addr, s->local_port, gai_strerror(ret));

Should be an error: failing to bind on the specified address can be a
security issue. And the error message is misleading.

> +} else {

> +if (ai->ai_family == AF_INET6) {
> +struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 
> *)ai->ai_addr;
> +sockaddr_v6->sin6_port = htons(port);
> +} else {
> +struct sockaddr_in * sockaddr = (struct sockaddr_in 
> *)ai->ai_addr;
> +sockaddr->sin_port = htons(port);
> +}

Do not distinguish between protocols: ai_addr already contains all that
is needed.

> +ret = bind(fd, (struct sockaddr *)ai->ai_addr, 
> (int)ai->ai_addrlen);
> +if (ret) {
> +av_log(ctx, AV_LOG_WARNING,
> +"Failed to bind local addr: %s port: %d err: %s\n",
> +s->local_addr, s->local_port, gai_strerror(ret));
> +}

You should be looping over the returned addresses.

> +}
> +}
>  /* Set the socket's send or receive buffer sizes, if specified.
> If unspecified or setting fails, system default is used. */
>  if (s->recv_buffer_size > 0) {
> @@ -129,6 +166,13 @@ static int tcp_open(URLContext *h, const char *uri, int 
> flags)
>  if (buf == endptr)
>  s->listen = 1;
>  }
> +if (av_find_info_tag(buf, sizeof(buf), "local_port", p)) {
> +s->local_port = strtol(buf, NULL, 10);
> +}
> +if (av_find_info_tag(buf, sizeof(buf), "local_addr", p)) {
> +av_freep(>local_addr);
> +s->local_addr = av_strndup(buf, strlen(buf));
> +}
>  if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
>  s->rw_timeout = strtol(buf, NULL, 10);
>  }

Regards,

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

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


[FFmpeg-devel] [PATCH] avcodec/nvenc: fix NULL pointer dereference

2023-02-28 Thread Zhao Zhili
From: Zhao Zhili 

This can happen if encoder init failed before setup the queue, then
reorder_queue_flush() is called by close().

Fix ticket #10221

Signed-off-by: Zhao Zhili 
---
 libavcodec/nvenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 8a28454042..dda2dc3ba1 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -178,6 +178,8 @@ static void reorder_queue_flush(AVFifo *queue)
 {
 FrameData fd;
 
+if (!queue)
+return;
 while (av_fifo_read(queue, , 1) >= 0)
 av_buffer_unref(_opaque_ref);
 }
-- 
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] avcodec/aacps_tablegen: fix build error after 21814a7

2023-02-28 Thread Zhao Zhili
From: Zhao Zhili 

Fix tickets #10225

DECLARE_ALIGNED has been moved to mem_internal.h.

Signed-off-by: Zhao Zhili 
---
 libavcodec/aacps_tablegen.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aacps_tablegen.h b/libavcodec/aacps_tablegen.h
index 0ac4f68d68..5fdd7f0a9d 100644
--- a/libavcodec/aacps_tablegen.h
+++ b/libavcodec/aacps_tablegen.h
@@ -34,7 +34,7 @@
 #include "libavutil/common.h"
 #include "libavutil/libm.h"
 #include "libavutil/mathematics.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
 #define NR_ALLPASS_BANDS20 30
 #define NR_ALLPASS_BANDS34 50
 #define PS_AP_LINKS 3
-- 
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] libavformat/tcp: add local_addr/local_port for network option

2023-02-28 Thread jack
Signed-off-by: jack 
---
 libavformat/tcp.c | 44 
 1 file changed, 44 insertions(+)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index a11ccbb913..598d61067e 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -36,6 +36,8 @@ typedef struct TCPContext {
 const AVClass *class;
 int fd;
 int listen;
+int local_port;
+char *local_addr;
 int open_timeout;
 int rw_timeout;
 int listen_timeout;
@@ -52,6 +54,8 @@ typedef struct TCPContext {
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
 { "listen",  "Listen for incoming connections",  OFFSET(listen),   
  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   2,   .flags = D|E },
+{ "local_port",  "Local port", 
OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },  -1, INT_MAX, 
.flags = D|E },
+{ "local_addr",  "Local address",  
OFFSET(local_addr), AV_OPT_TYPE_STRING, { .str = NULL }, 0,   0, 
.flags = D|E },
 { "timeout", "set timeout (in microseconds) of socket I/O operations", 
OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
 { "listen_timeout",  "Connection awaiting timeout (in milliseconds)",  
OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
 { "send_buffer_size", "Socket send buffer size (in bytes)",
OFFSET(send_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
@@ -73,6 +77,39 @@ static const AVClass tcp_class = {
 static void customize_fd(void *ctx, int fd)
 {
 TCPContext *s = ctx;
+
+if (s->local_addr) {
+struct addrinfo hints = { 0 }, *ai;
+int ret;
+int port = 0;
+
+hints.ai_family = AF_UNSPEC;
+hints.ai_socktype = SOCK_STREAM;
+
+if (s->local_port > 0)
+port = s->local_port;
+
+ret = getaddrinfo(s->local_addr, "0", , );
+if (ret) {
+av_log(ctx, AV_LOG_WARNING,
+   "Failed to bind local addr: %s port: %d err: %s\n",
+s->local_addr, s->local_port, gai_strerror(ret));
+} else {
+if (ai->ai_family == AF_INET6) {
+struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 
*)ai->ai_addr;
+sockaddr_v6->sin6_port = htons(port);
+} else {
+struct sockaddr_in * sockaddr = (struct sockaddr_in 
*)ai->ai_addr;
+sockaddr->sin_port = htons(port);
+}
+ret = bind(fd, (struct sockaddr *)ai->ai_addr, 
(int)ai->ai_addrlen);
+if (ret) {
+av_log(ctx, AV_LOG_WARNING,
+"Failed to bind local addr: %s port: %d err: %s\n",
+s->local_addr, s->local_port, gai_strerror(ret));
+}
+}
+}
 /* Set the socket's send or receive buffer sizes, if specified.
If unspecified or setting fails, system default is used. */
 if (s->recv_buffer_size > 0) {
@@ -129,6 +166,13 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
 if (buf == endptr)
 s->listen = 1;
 }
+if (av_find_info_tag(buf, sizeof(buf), "local_port", p)) {
+s->local_port = strtol(buf, NULL, 10);
+}
+if (av_find_info_tag(buf, sizeof(buf), "local_addr", p)) {
+av_freep(>local_addr);
+s->local_addr = av_strndup(buf, strlen(buf));
+}
 if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
 s->rw_timeout = strtol(buf, NULL, 10);
 }
-- 
2.39.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] Website release notes for 6.0

2023-02-28 Thread Lynne
Feb 28, 2023, 10:41 by d...@lynne.ee:

> Wrote the release notes for 6.0, containing an
> explanation of the new releases/ABI bump details,
> and an overview of what has changed.
>
> Patch attached.
>

Corrected a spelling mistake, more specifically stated
which release is an LTS release, and a minor adjustments:

    A new major release, FFmpeg 6.0 "Von 
Neumann",
    is now available for download. This release has many new encoders and 
decoders, filters,
    ffmpeg CLI tool improvements, and also, changes the way releases are done. 
All major
    releases will now bump the version of the ABI. We plan to have a new major 
release each
    year. Another release-specific change is that deprecated APIs will be 
removed after 3
    releases, upon the next major bump. The last minor release of a major 
version will be an
    LTS release.
    This means that releases will be done more often and will be more organized.

    New decoders featured are Bonk, RKA, Radiance, SC-4, APAC, VQC, WavArc and 
a few ADPCM formats.
    QSV and NVenc now support AV1 encoding. The FFmpeg CLI (we usually reffer 
to it as ffmpeg.c
    to avoid confusion) has speed-up improvements due to threading, as well as 
statistics options,
    and the ability to pass option values for filters from a file. There are 
quite a few new audio
    and video filters, such as adrc, showcwt, backgroundkey and ssim360, with a 
few hardware ones too.
    Finally, the release features many behind-the-scenes changes, including a 
new FFT and MDCT
    implementation used in codecs, numerous bugfixes, better ICC profile 
handling and colorspace
    signalling improvement, introduction of a number of RISC-V vector and 
scalar assembly optimized
    routines, and a few new improved APIs, which can be viewed in the 
doc/APIchanges file in our tree.
    A few submitted features, such as the Vulkan improvements and more FFT 
optimizations will be in the
    next minor release, 6.1, which we plan to release soon, in line with our 
new release schedule.
    Some highlights are:


>From edfaf7b8e1ddda8be20aa425d22961afe80095ac Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Tue, 28 Feb 2023 10:39:18 +0100
Subject: [PATCH] Website release notes for 6.0

---
 src/index | 74 +++
 1 file changed, 74 insertions(+)

diff --git a/src/index b/src/index
index 2aac720..a933b2f 100644
--- a/src/index
+++ b/src/index
@@ -35,6 +35,80 @@
 News
   
 
+  February 28th, 2023, FFmpeg 6.0 "Von Neumann"
+  
+A new major release, FFmpeg 6.0 "Von Neumann",
+is now available for download. This release has many new encoders and decoders, filters,
+ffmpeg CLI tool improvements, and also, changes the way releases are done. All major
+releases will now bump the version of the ABI. We plan to have a new major release each
+year. Another release-specific change is that deprecated APIs will be removed after 3
+releases, upon the next major bump. The last minor release of a major version will be an
+LTS release.
+This means that releases will be done more often and will be more organized.
+  
+  
+New decoders featured are Bonk, RKA, Radiance, SC-4, APAC, VQC, WavArc and a few ADPCM formats.
+QSV and NVenc now support AV1 encoding. The FFmpeg CLI (we usually reffer to it as ffmpeg.c
+to avoid confusion) has speed-up improvements due to threading, as well as statistics options,
+and the ability to pass option values for filters from a file. There are quite a few new audio
+and video filters, such as adrc, showcwt, backgroundkey and ssim360, with a few hardware ones too.
+Finally, the release features many behind-the-scenes changes, including a new FFT and MDCT
+implementation used in codecs, numerous bugfixes, better ICC profile handling and colorspace
+signalling improvement, introduction of a number of RISC-V vector and scalar assembly optimized
+routines, and a few new improved APIs, which can be viewed in the doc/APIchanges file in our tree.
+A few submitted features, such as the Vulkan improvements and more FFT optimizations will be in the
+next minor release, 6.1, which we plan to release soon, in line with our new release schedule.
+Some highlights are:
+  
+  
+Radiance HDR image support
+ddagrab (Desktop Duplication) video capture filter
+ffmpeg -shortest_buf_duration option
+ffmpeg now requires threading to be built
+ffmpeg now runs every muxer in a separate thread
+Add new mode to cropdetect filter to detect crop-area based on motion vectors and edges
+VAAPI decoding and encoding for 10/12bit 422, 10/12bit 444 HEVC and VP9
+WBMP (Wireless Application Protocol Bitmap) image format
+a3dscope filter
+bonk decoder and demuxer
+Micronas SC-4 audio decoder
+LAF demuxer
+APAC decoder and demuxer
+Media 100i decoders
+DTS to PTS reorder bsf
+ViewQuest VQC decoder
+backgroundkey filter
+

Re: [FFmpeg-devel] [PATCH] aarch64: hevcdsp_idct: Reuse preexisting macros for transposes

2023-02-28 Thread Martin Storsjö

On Thu, 23 Feb 2023, Martin Storsjö wrote:


Signed-off-by: Martin Storsjö 
---
libavcodec/aarch64/hevcdsp_idct_neon.S | 16 +++-
1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S 
b/libavcodec/aarch64/hevcdsp_idct_neon.S
index 124c50998a..c61fcb175d 100644
--- a/libavcodec/aarch64/hevcdsp_idct_neon.S
+++ b/libavcodec/aarch64/hevcdsp_idct_neon.S
@@ -25,6 +25,7 @@
 */

#include "libavutil/aarch64/asm.S"
+#include "neon.S"

const trans, align=4
.short  64, 83, 64, 36
@@ -279,20 +280,9 @@ endfunc
 sub\out3, v28.4s, v30.4s
.endm

-.macro transpose8_4x4 r0, r1, r2, r3
-trn1v2.8h, \r0\().8h, \r1\().8h
-trn2v3.8h, \r0\().8h, \r1\().8h
-trn1v4.8h, \r2\().8h, \r3\().8h
-trn2v5.8h, \r2\().8h, \r3\().8h
-trn1\r0\().4s, v2.4s, v4.4s
-trn2\r2\().4s, v2.4s, v4.4s
-trn1\r1\().4s, v3.4s, v5.4s
-trn2\r3\().4s, v3.4s, v5.4s
-.endm
-
.macro transpose_8x8 r0, r1, r2, r3, r4, r5, r6, r7
-transpose8_4x4  \r0, \r1, \r2, \r3
-transpose8_4x4  \r4, \r5, \r6, \r7
+transpose_4x8H  \r0, \r1, \r2, \r3, v2, v3, v4, v5
+transpose_4x8H  \r4, \r5, \r6, \r7, v2, v3, v4, v5
.endm


I'll go ahead and push this.

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

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


[FFmpeg-devel] Website release notes for 6.0

2023-02-28 Thread Lynne
Wrote the release notes for 6.0, containing an
explanation of the new releases/ABI bump details,
and an overview of what has changed.

Patch attached.

>From 20ec89bc3e79406dcff6c56663a5f18fffc349e7 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Tue, 28 Feb 2023 10:39:18 +0100
Subject: [PATCH] Website release notes for 6.0

---
 src/index | 71 +++
 1 file changed, 71 insertions(+)

diff --git a/src/index b/src/index
index 2aac720..7d83a29 100644
--- a/src/index
+++ b/src/index
@@ -35,6 +35,77 @@
 News
   
 
+  February 28th, 2023, FFmpeg 6.0 "Von Neumann"
+  
+A new major release, FFmpeg 6.0 "Von Newmann",
+is now available for download. This release has many new encoders and decoders, filters,
+ffmpeg CLI tool improvements, and also, changes the way releases are done. All major
+releases will now bump the version of the ABI. We plan to have a new major release each
+year. Another release-specific change is that deprecated APIs will be removed after 3
+releases, upon the next major bump. The last release of a major version will be LTS.
+This means that releases will be done more often and will be more organized.
+  
+  
+New decoders featured are Bonk, RKA, Radiance, SC-4, APAC, VQC, WavArc and a few ADPCM formats.
+QSV and NVenc now support AV1 encoding. The FFmpeg CLI (we usually reffer to it as ffmpeg.c
+to avoid confusion) has speed-up improvements due to threading, as well as statistics options,
+and the ability to pass option values for filters from a file. There are quite a few new audio
+and video filters, such as adrc, showcwt, backgroundkey and ssim360, with a few hardware ones too.
+Finally, the release features many behind-the-scenes changes, including a new FFT and MDCT
+implementation used in codecs, numerous bugfixes, better ICC profile handling and colorspace
+signalling improvement, introduction of a number of RISC-V vector and scalar assembly optimized
+routines, and a few new improved APIs, which can be viewed in the doc/APIchanges file in our tree.
+Some highlights are:
+  
+  
+Radiance HDR image support
+ddagrab (Desktop Duplication) video capture filter
+ffmpeg -shortest_buf_duration option
+ffmpeg now requires threading to be built
+ffmpeg now runs every muxer in a separate thread
+Add new mode to cropdetect filter to detect crop-area based on motion vectors and edges
+VAAPI decoding and encoding for 10/12bit 422, 10/12bit 444 HEVC and VP9
+WBMP (Wireless Application Protocol Bitmap) image format
+a3dscope filter
+bonk decoder and demuxer
+Micronas SC-4 audio decoder
+LAF demuxer
+APAC decoder and demuxer
+Media 100i decoders
+DTS to PTS reorder bsf
+ViewQuest VQC decoder
+backgroundkey filter
+nvenc AV1 encoding support
+MediaCodec decoder via NDKMediaCodec
+MediaCodec encoder
+oneVPL support for QSV
+QSV AV1 encoder
+QSV decoding and encoding for 10/12bit 422, 10/12bit 444 HEVC and VP9
+showcwt multimedia filter
+corr video filter
+adrc audio filter
+afdelaysrc audio filter
+WADY DPCM decoder and demuxer
+CBD2 DPCM decoder
+ssim360 video filter
+ffmpeg CLI new options: -stats_enc_pre[_fmt], -stats_enc_post[_fmt], -stats_mux_pre[_fmt]
+hstack_vaapi, vstack_vaapi and xstack_vaapi filters
+XMD ADPCM decoder and demuxer
+media100 to mjpegb bsf
+ffmpeg CLI new option: -fix_sub_duration_heartbeat
+WavArc decoder and demuxer
+CrystalHD decoders deprecated
+SDNS demuxer
+RKA decoder and demuxer
+filtergraph syntax in ffmpeg CLI now supports passing file contents
+ as option values, by prefixing option name with '/'
+hstack_qsv, vstack_qsv and xstack_qsv filters
+  
+  
+We strongly recommend users, distributors, and system integrators to
+upgrade unless they use current git master.
+  
+
   July 22nd, 2022, FFmpeg 5.1 "Riemann"
   
 FFmpeg 5.1 "Riemann", a new
-- 
2.39.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] [PATCH v2 0/4] Add hevc alpha layer decoding basic support

2023-02-28 Thread zhilizhao(赵志立)


> On Jan 6, 2023, at 23:52, Zhao Zhili  wrote:
> 
> From: Zhao Zhili 
> 
> v2:
> 1. Check vps_max_layers and vps_max_layer_id inside hevc decoder
> 2. Add hevc_extract_layer bsf to do the job rather than modifing 
> hevc_metadata,
> 3. Check vps_max_layers_minus1 and vps_max_layer_id inside bsf
> 4. Update vps_max_layers_minus1 and vps_max_layer_id when rewrite as base 
> layer
> 5. vps_extension should be updated rather than drop entirely, add a TODO

Will push soon if there's no objections.

> 
> -
> 1. Don't drop nal->nuh_layer_id > 0 until decoder.
> 2. Make hevcdec able to decode a selected layer.
> 3. Add hevc_extract_layer bsf to extract a selected layer.
> 
> Partially fix #7965. There is a sample in ticket #7965 which can be used to 
> test
> the patchset. Or use videotoolbox encoder to create a sample (FFmpeg needs to 
> be
> patched first, "avutil/hwcontext_videotoolbox: BGRA should be full range"
> http://ffmpeg.org/pipermail/ffmpeg-devel/2023-January/305252.html), e.g.,
> 
> ./ffmpeg -i cctv.mp4 \
>-i pig.mp4 \
>-c:v hevc_videotoolbox \
>-alpha_quality 0.75 \
>-filter_complex '[1:v]scale=640x480[v1];[0:v][v1]alphamerge[v2]' \
>-map [v2] -an -t 60 \
>-pix_fmt bgra \
>-b:v 4M \
>-tag:v hvc1 \
>alpha.mp4 -y
> 
> 
> Now it's able to use two decoders to decode the base layer and alpha
> layer, and then combine the results, e.g.,
> 
> ./ffmpeg -i alpha.mp4 \
>   -strict -2  -nuh_layer_id 1 -i alpha.mp4 \
>   -frames 60 \
>   -filter_complex '[0:v][1:v]alphamerge[vout]' \
>   -map '[vout]' -an test-%d.png
> 
> It only works with software decoder.
> 
> hevc_extract_layer can be used together with hardware decoder. The following
> example is how to extract the alpha layer and rewrite as base layer:
> 
> ./ffmpeg -i alpha.mp4 \
>   -an -c:v copy \
>   -bsf:v hevc_extract_layer=nuh_layer_id=1 \
>   test.mp4
> 
> Zhao Zhili (4):
>  avcodec/hevc_parse: keep nal->nuh_layer_id > 0
>  avcodec/cbs_h2645: keep nal->nuh_layer_id > 0
>  avcodec/hevcdec: add nuh_layer_id option
>  avcodec: add hevc_extract_layer bsf
> 
> configure   |   1 +
> doc/bitstream_filters.texi  |  12 +++
> libavcodec/Makefile |   1 +
> libavcodec/bitstream_filters.c  |   1 +
> libavcodec/cbs_h2645.c  |   3 -
> libavcodec/hevc_extract_layer_bsf.c | 126 
> libavcodec/hevc_parse.c |   2 -
> libavcodec/hevcdec.c|  56 -
> libavcodec/version.h|   2 +-
> 9 files changed, 197 insertions(+), 7 deletions(-)
> create mode 100644 libavcodec/hevc_extract_layer_bsf.c
> 
> -- 
> 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 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".