Re: [FFmpeg-devel] [PATCH] libavformat/mxfdec.c: Recognize and Ignore MXF fill boxes

2024-09-13 Thread Nicolas Gaullier
>De : ffmpeg-devel  De la part de martin 
>schitter
>Envoyé : jeudi 12 septembre 2024 13:54
>On 12.09.24 13:14, Nicolas Gaullier wrote:
>> The message "Recognize and Ignore" does not make it clear what issue or 
>> grave defect is solved here.
>> I see in the code that fill items are currently recognized as dark metadata 
>> and ignored likewise, but I don't see any issue here.
>> Maybe could you comment a little bit about your intent ?
>
>While developing this DNxUncompressed code I always got lots of this "Dark key 
>..." log messages in the debug output. This kind of output wouldn't be a 
>surprise, if the key belongs to some rare and utterly irrelevant data >box. 
>but in this particular case the key stands for empty "fill" blocks, which are 
>frequently used in various places in MXF files. They are an elementary 
>building block of this container format.
>
>On the muxer side of ffmpegs MXF code 'fill' is known and used in many places, 
>but the demuxer doesn't recognize this element and just always prints these 
>warnings about something "unknown". That's highly irritating and >also 
>inefficient, because 'fill' is used quite frequently e.g. as place holder to 
>align frame data on 256byte boundaries etc.
>
>It's really trivial to fix and I don't see, why we should debate any longer 
>about this obvious flaw instead of just quickly solving the issue.
>
>But if you want, you can rewrite the wording to "Recognize 'fill' in MXF data 
>and suppress output" or whatever you like...

I am not against the idea of the patch: filler items should not be logged as 
dark metadata. I just wanted to check with you that it was indeed the only 
issue.
So it is not a big issue, and I find the patch confusing both because of the 
commit msg and code:
- the commit msg should not claim it "adds support for" filler items: mxf files 
with fillers are already supported/playable.
Maybe just a single line like "avformat/mxfdec: suppress verbose log for 
fillers" ?
- why not using a simple "if" on the av_log rather than inserting a new block 
of code ?

Thank you,
Nicolas

___
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/vaapi_encode_av1: Fix encode fail since 9db68ed0

2024-09-13 Thread Lynne via ffmpeg-devel

On 13/09/2024 05:15, fei.w.wang-at-intel@ffmpeg.org wrote:

From: Fei Wang 

Signed-off-by: Fei Wang 
---
  libavcodec/vaapi_encode_av1.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c
index 6d1be9fc07..1b350cd936 100644
--- a/libavcodec/vaapi_encode_av1.c
+++ b/libavcodec/vaapi_encode_av1.c
@@ -637,7 +637,7 @@ static int 
vaapi_encode_av1_init_picture_params(AVCodecContext *avctx,
  slot = ((VAAPIEncodeAV1Picture*)ref_pic->codec_priv)->slot;
  av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE);
  
-vpic->reference_frames[slot] = ((VAAPIEncodePicture *)ref_pic)->recon_surface;

+vpic->reference_frames[slot] = ((VAAPIEncodePicture 
*)ref_pic->priv)->recon_surface;
  }
  }
  


LGTM
thanks


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital 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] libavformat/mxfdec.c: Recognize and Ignore MXF fill boxes

2024-09-13 Thread martin schitter




On 13.09.24 10:23, Nicolas Gaullier wrote:
I am not against the idea of the patch: filler items should not be logged as dark metadata. 


Fine! -- that's the main point!


I find the patch confusing both because of the commit msg and code:
- the commit msg should not claim it "adds support for" filler items: mxf files 
with fillers are already supported/playable.


It adds a small amount of support, because without adding this key entry 
you can not identify and selective process 'fill' boxes.


Sure -- the files are already playable, and the processing is even 
faster without any further handling of this specific kind of content, 
but you will never be able to suppress the misleading verbose logging 
without such a modification.



- why not using a simple "if" on the av_log rather than inserting a new block 
of code ?


Somehow you always have to differentiate 'fill' boxes from other unknown 
elements if you want to change the present behavior.


Sure -- it would be possible to change just the printed output in this 
already present `av_log` call, but the necessary code would IMHO much 
more "confusing":


a selective handling of a specific kind of entity in a branch of the 
code flow, which is strictly dedicated to warn about "unknown" content. 
That's simply a paradox, a developers joke or just something highly 
"confusing".


But change and rename my patch however you like!

I can not do more than suggesting this very simple improvement.
Or at least something, which I personally would see as an improvement.

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 21/60] fftools/ffmpeg_mux_init: fix variable shadowing

2024-09-13 Thread Anton Khirnov
Quoting Marvin Scholz (2024-09-08 22:21:03)
> ---
>  fftools/ffmpeg_mux_init.c | 17 +++--
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
> index 8d475f5b45..c2867192ee 100644
> --- a/fftools/ffmpeg_mux_init.c
> +++ b/fftools/ffmpeg_mux_init.c
> @@ -661,11 +661,9 @@ static int new_stream_video(Muxer *mux, const 
> OptionsContext *o,
>  }
>  opt_match_per_stream_str(ost, &o->chroma_intra_matrices, oc, st, 
> &chroma_intra_matrix);
>  if (chroma_intra_matrix) {
> -uint16_t *p = av_mallocz(sizeof(*video_enc->chroma_intra_matrix) 
> * 64);
> -if (!p)
> +if (!(video_enc->chroma_intra_matrix = 
> av_mallocz(sizeof(*video_enc->chroma_intra_matrix) * 64)))

I heavily dislike assignments inside if().

Otherwise looks ok

-- 
Anton Khirnov
___
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 22/60] fftools/ffmpeg_demux: fix variable shadowing

2024-09-13 Thread Anton Khirnov
Quoting Marvin Scholz (2024-09-08 22:26:09)
> ---
>  fftools/ffmpeg_demux.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)

LGTM

-- 
Anton Khirnov
___
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 23/60] fftools/ffmpeg_demux: narrow variable scope

2024-09-13 Thread Anton Khirnov
Quoting Marvin Scholz (2024-09-08 22:27:44)
> ---
>  fftools/ffmpeg_demux.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Ok

-- 
Anton Khirnov
___
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 24/60] avcodec/libx264: fix variable shadowing

2024-09-13 Thread Anton Khirnov
Quoting Marvin Scholz (2024-09-08 22:50:45)
> ---
>  libavcodec/libx264.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Looks ok

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

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


Re: [FFmpeg-devel] [PATCH 25/60] avcodec/mjpegdec: fix variable shadowing

2024-09-13 Thread Anton Khirnov
Quoting Marvin Scholz (2024-09-08 23:03:35)
> ---
>  libavcodec/mjpegdec.c| 15 +++
>  libavcodec/mjpegenc_common.c | 13 ++---
>  2 files changed, 13 insertions(+), 15 deletions(-)

Looks ok

-- 
Anton Khirnov
___
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 26/60] avcodec/g2meet: fix variable shadowing

2024-09-13 Thread Anton Khirnov
Quoting Marvin Scholz (2024-09-08 23:25:51)
> ---
>  libavcodec/g2meet.c | 12 +---
>  1 file changed, 5 insertions(+), 7 deletions(-)

Looks good

-- 
Anton Khirnov
___
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/7] avformat/mov_chan: Check for FF_SANE_NB_CHANNELS

2024-09-13 Thread Anton Khirnov
Quoting Michael Niedermayer (2024-09-13 01:33:31)
> We do not support more channels. For example avcodec_open2() limits channels 
> this way too
> 
> The example file contains multiple chunks with over 16 million channels

We had this discussion already. Ad-hoc checks like this are only
addressing a symptom (probably one of many), and hide the actual bug.

> +#include "libavcodec/internal.h"

I dislike this as well.

-- 
Anton Khirnov
___
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/af_channelmap: fix channelmap_init error handling

2024-09-13 Thread Anton Khirnov
Quoting Marvin Scholz (2024-09-11 21:07:29)
> The channelmap_init function was returning success even on error after
> 7dc81d33c241b9e176ea85956e8317f29bc9e3c0 due to shadowing of the
> outer ret variable.
> 
> Fixes CID1619297 Logically dead code
> ---
>  libavfilter/af_channelmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Looks good.

Thanks,

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

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


Re: [FFmpeg-devel] [PATCH] avformat/dashdec: The segments in dash file doesn't read completely when segment's size and duration is very small.

2024-09-13 Thread Steven Liu
Steven Liu  于2024年9月2日周一 16:46写道:
>
> jiangjie  于2024年9月2日周一 16:35写道:
> >
> > If the segment is very small, avformat_find_stream_info will read all 
> > audio/video data in this segment. cur->is_restart_needed is set to 0 later 
> > in dash_read_packet function, and no chance to be set to 1 again in the 
> > read_data function.
> >
> > Reproduction:
> > ffmpeg -f lavfi -i mandelbrot -f lavfi -i anullsrc -c:v vp8 -g 5 -r 5 -c:a 
> > libopus -use_template 0 -seg_duration 1 -t 15 -y test_720.mpd
> > ffprobe -show_packets test_720.mpd
> >
> > The duration of the test_720.mpd file is 15 seconds, but the duration that 
> > ffprobe show is small than 15 second.
> > ---
> >  libavformat/dashdec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> > index 63070b77be..12960d0312 100644
> > --- a/libavformat/dashdec.c
> > +++ b/libavformat/dashdec.c
> > @@ -2207,9 +2207,9 @@ static int dash_read_packet(AVFormatContext *s, 
> > AVPacket *pkt)
> >  if (cur->is_restart_needed) {
> >  cur->cur_seg_offset = 0;
> >  cur->init_sec_buf_read_offset = 0;
> > +cur->is_restart_needed = 0;
> >  ff_format_io_close(cur->parent, &cur->input);
> >  ret = reopen_demux_for_component(s, cur);
> > -cur->is_restart_needed = 0;
> >  }
> >  }
> >  return AVERROR_EOF;
> > --
> > 2.43.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".
>
> good catch
> LGTM

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


Re: [FFmpeg-devel] [RFC/PATCH] MV-HEVC decoding

2024-09-13 Thread Anton Khirnov
Quoting Danny Hong (2024-09-09 19:45:57)
> Thanks for the patch set!  Ran some initial tests and here are some
> findings:
> 
> 1. Tested using the HTM ref SW encoded bitstreams; the HTM encoded 2 layer
> MV-HEVC elementary streams are decoded by both the HTM decoder and ffmpeg,
> and both resulted in the same decoded pixels for both views.
> 
> 2. Tested with the iPhone captured sample videos (some samples are
> available from
> https://blog.frame.io/2024/02/01/how-to-capture-and-view-vision-pro-spatial-video/).
> To decode using the HTM decoder, converted the .mov file to .hevc
> elementary stream (using "ffmpeg -view_ids -1 -i sample.mov -vcodec copy
> sample.hevc").  The iPhone captured MV-HEVC seems to be non-conformant as

Note that -view_ids is a decoder option and does nothing with
streamcopy.
Also, that option is intended for API users, with ffmpeg CLI you should
be using view specifiers instead.

> for the very first AU we have the following NAL units: prefix SEI (layer ID
> 0), CRA (layer ID 0), prefix SEI (layer ID 0), CRA (layer ID 1).  Based on
> Section 7.4.2.4.4 of the HEVC spec, a prefix SEI with layer ID 0 indicates
> a new AU, so the bitstream is not conformant for the 2 layer case.  The
> reference HTM decoder seems to be tolerant to this and correctly decodes
> the "non-conformant" elementary stream, but ffmpeg does not.  However,
> ffmpeg does decode the .mov container file correctly as each AU is
> correctly passed to the decoder as a video sample.  Aside from this
> con-conformance issue, both the HTM decoder and ffmpeg seem to produce
> pixel exact views.  For the view by view comparison, I had to manually skip
> some initial frames output by the HTM decoder, as ffmpeg did not output
> some of the first few views/frames.
> 
> 3.  When ffmpeg skips some of the decoded views for output, I think it
> makes sense to skip both views of an AU (when both views are being
> output)?  Currently one view from an AU can be skipped without skipping its
> corresponding other view.  To avoid some of the views from being skipped, I
> had to use the "-vsync 0" option for my tests.  When I use this option, I
> see the following warning: "Application provided invalid, non monotonically
> increasing dts to muxer in stream 0: 1 >= 1".  This seems due to both views
> of an AU having the same DTS, which is expected.

Use view specifiers to split the views into their own streams. I do not
want too much multiview-speficic logic into ffmpeg CLI, as it is a
rather obscure feature.

-- 
Anton Khirnov
___
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/mxfdec.c: Recognize and Ignore MXF fill boxes

2024-09-13 Thread Tomas Härdin
fre 2024-09-13 klockan 08:23 + skrev Nicolas Gaullier:
> 
> - why not using a simple "if" on the av_log rather than inserting a
> new block of code ?

That's way ugly

RE: performance, we might want to move to a hash table based approach
so we don't scan the entire table every time. The approach in this
patch would be detrimental to such a change (it's an extra if that's
always evaluated), hence why I prefer a table based approach. I'll post
an alternative patch in a bit

Also I just noticed the "Dark key" nag only get printed with -loglevel
verbose. Hence why it's gone unnoticed

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

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


[FFmpeg-devel] [PATCH 1/2] lavf/mxfdec: Switch to mxf_metadata_read_table loop to FF_ARRAY_ELEMS, skip if read == NULL

2024-09-13 Thread Tomas Härdin
Passes fate-mxf

/Tomas
From c96a96dc1f245210997a7d21b158ce504bdf4c73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= 
Date: Fri, 13 Sep 2024 14:09:56 +0200
Subject: [PATCH 1/2] lavf/mxfdec: Switch to mxf_metadata_read_table loop to
 FF_ARRAY_ELEMS, skip if read == NULL

---
 libavformat/mxfdec.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index ac63c0d5ad..65ffa0d6b8 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -328,7 +328,7 @@ typedef int MXFMetadataReadFunc(void *arg, AVIOContext *pb, int tag, int size, U
 
 typedef struct MXFMetadataReadTableEntry {
 const UID key;
-MXFMetadataReadFunc *read;
+MXFMetadataReadFunc *read; /* if NULL then skip KLV */
 int ctx_size;
 enum MXFMetadataSetType type;
 } MXFMetadataReadTableEntry;
@@ -3235,7 +3235,6 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x04,0x01,0x02,0x02,0x00,0x00 }, mxf_read_cryptographic_context, sizeof(MXFCryptoContext), CryptoContext },
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 }, mxf_read_index_table_segment, sizeof(MXFIndexTableSegment), IndexTableSegment },
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x23,0x00 }, mxf_read_essence_container_data, sizeof(MXFEssenceContainerData), EssenceContainerData },
-{ { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL },
 };
 
 static int mxf_metadataset_init(MXFMetadataSet *ctx, enum MXFMetadataSetType type, MXFPartition *partition)
@@ -3716,7 +3715,7 @@ static int mxf_read_header(AVFormatContext *s)
 mxf_read_random_index_pack(s);
 
 while (!avio_feof(s->pb)) {
-const MXFMetadataReadTableEntry *metadata;
+size_t x;
 
 ret = klv_read_packet(mxf, &klv, s->pb);
 if (ret < 0 || IS_KLV_KEY(klv.key, ff_mxf_random_index_pack_key)) {
@@ -3762,14 +3761,19 @@ static int mxf_read_header(AVFormatContext *s)
 /* we're still parsing forward. proceed to parsing this partition pack */
 }
 
-for (metadata = mxf_metadata_read_table; metadata->read; metadata++) {
+for (x = 0; x < FF_ARRAY_ELEMS(mxf_metadata_read_table); x++) {
+const MXFMetadataReadTableEntry *metadata = &mxf_metadata_read_table[x];
 if (IS_KLV_KEY(klv.key, metadata->key)) {
-if ((ret = mxf_parse_klv(mxf, klv, metadata->read, metadata->ctx_size, metadata->type)) < 0)
-return ret;
+if (metadata->read) {
+if ((ret = mxf_parse_klv(mxf, klv, metadata->read, metadata->ctx_size, metadata->type)) < 0)
+return ret;
+} else {
+avio_skip(s->pb, klv.length);
+}
 break;
 }
 }
-if (!metadata->read) {
+if (x >= FF_ARRAY_ELEMS(mxf_metadata_read_table)) {
 av_log(s, AV_LOG_VERBOSE, "Dark key " PRIxUID "\n",
 UID_ARG(klv.key));
 avio_skip(s->pb, klv.length);
-- 
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] lavf/mxfdec: Handle KLV fill

2024-09-13 Thread Tomas Härdin
Cuts down on "Dark key" spam in verbose mode, as pointed out by Martin
Schitter

/Tomas
From 0ca53ebb7835624261b97903136579ec9a529736 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= 
Date: Fri, 13 Sep 2024 14:10:34 +0200
Subject: [PATCH 2/2] lavf/mxfdec: Handle KLV fill

---
 libavformat/mxfdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 65ffa0d6b8..81938fe374 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3235,6 +3235,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x04,0x01,0x02,0x02,0x00,0x00 }, mxf_read_cryptographic_context, sizeof(MXFCryptoContext), CryptoContext },
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 }, mxf_read_index_table_segment, sizeof(MXFIndexTableSegment), IndexTableSegment },
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x23,0x00 }, mxf_read_essence_container_data, sizeof(MXFEssenceContainerData), EssenceContainerData },
+{ { 0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x01,0x02,0x10,0x01,0x00,0x00,0x00 } }, /* KLV fill, skip */
 };
 
 static int mxf_metadataset_init(MXFMetadataSet *ctx, enum MXFMetadataSetType type, MXFPartition *partition)
-- 
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] libavformat/mxfdec.c: Recognize and Ignore MXF fill boxes

2024-09-13 Thread martin schitter



On 13.09.24 13:59, Tomas Härdin wrote:

RE: performance, we might want to move to a hash table based approach
so we don't scan the entire table every time. The approach in this
patch would be detrimental to such a change (it's an extra if that's
always evaluated), hence why I prefer a table based approach. I'll post
an alternative patch in a bit


Your suggested alternative looks indeed much more elegant! :)

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] [PATCH] tests: Fate sample tests for DNxUncompressed

2024-09-13 Thread Martin Schitter
This is set of sample tests, which should cover all currently supportet
DNxUncompressed decoding capabilities.

I'll send the compressed samples attached to the next mail.

---
 tests/Makefile  |  1 +
 tests/fate/dnxuc.mak| 40 +
 tests/ref/fate/dnxuc-cb-rgb-10  |  8 ++
 tests/ref/fate/dnxuc-cb-rgb-12  |  8 ++
 tests/ref/fate/dnxuc-cb-rgb-8   |  8 ++
 tests/ref/fate/dnxuc-cb-rgb-float   |  8 ++
 tests/ref/fate/dnxuc-cb-rgb-half|  8 ++
 tests/ref/fate/dnxuc-cb-yuv422-10   |  8 ++
 tests/ref/fate/dnxuc-cb-yuv422-12   |  8 ++
 tests/ref/fate/dnxuc-cb-yuv422-8|  8 ++
 tests/ref/fate/dnxuc-ramp-rgb-10|  8 ++
 tests/ref/fate/dnxuc-ramp-rgb-12|  8 ++
 tests/ref/fate/dnxuc-ramp-rgb-8 |  8 ++
 tests/ref/fate/dnxuc-ramp-rgb-float |  8 ++
 tests/ref/fate/dnxuc-ramp-rgb-half  |  8 ++
 tests/ref/fate/dnxuc-ramp-yuv422-10 |  8 ++
 tests/ref/fate/dnxuc-ramp-yuv422-12 |  8 ++
 tests/ref/fate/dnxuc-ramp-yuv422-8  |  8 ++
 18 files changed, 169 insertions(+)
 create mode 100644 tests/fate/dnxuc.mak
 create mode 100644 tests/ref/fate/dnxuc-cb-rgb-10
 create mode 100644 tests/ref/fate/dnxuc-cb-rgb-12
 create mode 100644 tests/ref/fate/dnxuc-cb-rgb-8
 create mode 100644 tests/ref/fate/dnxuc-cb-rgb-float
 create mode 100644 tests/ref/fate/dnxuc-cb-rgb-half
 create mode 100644 tests/ref/fate/dnxuc-cb-yuv422-10
 create mode 100644 tests/ref/fate/dnxuc-cb-yuv422-12
 create mode 100644 tests/ref/fate/dnxuc-cb-yuv422-8
 create mode 100644 tests/ref/fate/dnxuc-ramp-rgb-10
 create mode 100644 tests/ref/fate/dnxuc-ramp-rgb-12
 create mode 100644 tests/ref/fate/dnxuc-ramp-rgb-8
 create mode 100644 tests/ref/fate/dnxuc-ramp-rgb-float
 create mode 100644 tests/ref/fate/dnxuc-ramp-rgb-half
 create mode 100644 tests/ref/fate/dnxuc-ramp-yuv422-10
 create mode 100644 tests/ref/fate/dnxuc-ramp-yuv422-12
 create mode 100644 tests/ref/fate/dnxuc-ramp-yuv422-8

diff --git a/tests/Makefile b/tests/Makefile
index 9b70145..e073915 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -172,6 +172,7 @@ include $(SRC_PATH)/tests/fate/dca.mak
 include $(SRC_PATH)/tests/fate/demux.mak
 include $(SRC_PATH)/tests/fate/dfa.mak
 include $(SRC_PATH)/tests/fate/dnxhd.mak
+include $(SRC_PATH)/tests/fate/dnxuc.mak
 include $(SRC_PATH)/tests/fate/dpcm.mak
 include $(SRC_PATH)/tests/fate/dvvideo.mak
 include $(SRC_PATH)/tests/fate/ea.mak
diff --git a/tests/fate/dnxuc.mak b/tests/fate/dnxuc.mak
new file mode 100644
index 000..f7cc2f4
--- /dev/null
+++ b/tests/fate/dnxuc.mak
@@ -0,0 +1,40 @@
+FATE_DNXUC_CB = fate-dnxuc-cb-rgb-8 \
+fate-dnxuc-cb-rgb-10 \
+fate-dnxuc-cb-rgb-12 \
+fate-dnxuc-cb-rgb-half \
+fate-dnxuc-cb-rgb-float \
+fate-dnxuc-cb-yuv422-8 \
+fate-dnxuc-cb-yuv422-10 \
+fate-dnxuc-cb-yuv422-12
+
+FATE_DNXUC_RAMP =   fate-dnxuc-ramp-rgb-8 \
+fate-dnxuc-ramp-rgb-10 \
+fate-dnxuc-ramp-rgb-12 \
+fate-dnxuc-ramp-rgb-half \
+fate-dnxuc-ramp-rgb-float \
+fate-dnxuc-ramp-yuv422-8 \
+fate-dnxuc-ramp-yuv422-10 \
+fate-dnxuc-ramp-yuv422-12
+
+FATE_DNXUC-$(call FRAMECRC, MXF, DNXUC) += $(FATE_DNXUC_CB) $(FATE_DNXUC_RAMP)
+
+FATE_SAMPLES_FFMPEG += $(FATE_DNXUC-yes)
+fate-dnxuc: $(FATE_DNXUC-yes) $(FATE_VCODEC_DNXUC)
+
+fate-dnxuc-cb-rgb-8: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/cb_rgb_8.mxf
+fate-dnxuc-cb-rgb-10: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/cb_rgb_10.mxf
+fate-dnxuc-cb-rgb-12: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/cb_rgb_12.mxf
+fate-dnxuc-cb-rgb-half: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/cb_rgb_half.mxf
+fate-dnxuc-cb-rgb-float: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/cb_rgb_float.mxf
+fate-dnxuc-cb-yuv422-8: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/cb_yuv422_8.mxf
+fate-dnxuc-cb-yuv422-10: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/cb_yuv422_10.mxf
+fate-dnxuc-cb-yuv422-12: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/cb_yuv422_12.mxf
+
+fate-dnxuc-ramp-rgb-8: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/ramp_rgb_8.mxf
+fate-dnxuc-ramp-rgb-10: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/ramp_rgb_10.mxf
+fate-dnxuc-ramp-rgb-12: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/ramp_rgb_12.mxf
+fate-dnxuc-ramp-rgb-half: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/ramp_rgb_half.mxf
+fate-dnxuc-ramp-rgb-float: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/ramp_rgb_float.mxf
+fate-dnxuc-ramp-yuv422-8: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/dnxuc/ramp_yuv422_8.mxf
+fate-dnxuc-ramp-yuv422-10: CMD = framecrc -flags +b

Re: [FFmpeg-devel] [PATCH] tests: Fate sample tests for DNxUncompressed

2024-09-13 Thread martin schitter

Here are the necessary samples for the fate checks.

Please upload them to the fate sample collection.

thanks
martin


On 13.09.24 14:48, Martin Schitter wrote:

I'll send the compressed samples attached to the next mail.


dnxuc.tar.xz
Description: application/xz
___
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] A change in r_frame_rate values after upgrade to FFmpeg 6.1

2024-09-13 Thread Antoni Bizoń
Hello,
I recently upgraded FFmpeg to version 6.1 in my web application and encountered 
a change while running my app's tests. After the upgrade, ffprobe reported an 
r_frame_rate of 60/1 instead of the expected 30/1 for two videos in my test 
suite.
After investigating, I traced the issue to the following commit: 
e930b834a928546f9cbc937f6633709053448232.
It seems that the newer version no longer reduces the frame rate as it did 
previously. Could you clarify if this behavior is more accurate, or if the 
frame rate reduction should still be expected?
Thank you for your help!
Best regards,
Antoni BIzoń
___
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/h264: ignore POC when flag is set

2024-09-13 Thread Kevin Wang
It seems that my patch didn't get picked up by patchwork :( Did I miss
a formatting step?

On Fri, Sep 13, 2024 at 1:40 AM  wrote:
>
> From: Kevin Wang 
>
> When the flag AV_CODEC_FLAG_OUTPUT_CORRUPT or AV_CODEC_FLAG2_SHOW_ALL
> is set, ignore any out of order POC's as they may still be valid
> frames.
>
> Fixes https://trac.ffmpeg.org/ticket/11190.
>
> Signed-off-by: Kevin Wang 
> ---
>  libavcodec/h264_slice.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index a66b75ca80..fc5a829755 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -1341,7 +1341,8 @@ static int h264_select_output_frame(H264Context *h)
>  out_idx = i;
>  }
>  if (h->avctx->has_b_frames == 0 &&
> -((h->delayed_pic[0]->f->flags & AV_FRAME_FLAG_KEY) ||
> h->delayed_pic[0]->mmco_reset))
> +// Check if we should ignore the output order and output the frame
> +((h->delayed_pic[0]->f->flags & AV_FRAME_FLAG_KEY) ||
> h->delayed_pic[0]->mmco_reset || h->avctx->flags &
> (AV_CODEC_FLAG_OUTPUT_CORRUPT | AV_CODEC_FLAG2_SHOW_ALL)))
>  h->next_outputed_poc = INT_MIN;
>  out_of_order = out->poc < h->next_outputed_poc;
>
> --
> 2.34.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] [FFmpeg-cvslog] fftools/ffmpeg_mux_init: default to input timebase for streamcopy

2024-09-13 Thread Michael Niedermayer via ffmpeg-devel
On Tue, Jul 09, 2024 at 09:19:54AM +, Anton Khirnov wrote:
> ffmpeg | branch: master | Anton Khirnov  | Fri Jul  5 
> 12:30:04 2024 +0200| [10185e2d4c1e9839bc58a1d6a63c861677b13fd0] | committer: 
> Anton Khirnov
> 
> fftools/ffmpeg_mux_init: default to input timebase for streamcopy
> 
> Stop trying to invent some "framerate-based" timebase when there is no
> reason to think the stream is CFR at all.
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10185e2d4c1e9839bc58a1d6a63c861677b13fd0
> ---

This breaks:
./ffmpeg -f concat -i ~/tickets/3108/concatfile.txt -codec copy -bitexact 
/tmp/file3108-before-10185e2d4c1e9839bc58a1d6a63c861677b13fd0.avi
(i assume the zip on the tracker contains all source files, if not i can 
provide the source files)

-rw-r- 1 michael michael 3088008 Sep 13 18:01 
/tmp/file3108-after-10185e2d4c1e9839bc58a1d6a63c861677b13fd0.avi
-rw-r- 1 michael michael 2824008 Sep 13 18:01 
/tmp/file3108-before-10185e2d4c1e9839bc58a1d6a63c861677b13fd0.avi

the framerate is 600 fps after this:

Input #0, avi, from 
'/tmp/file3108-after-10185e2d4c1e9839bc58a1d6a63c861677b13fd0.avi':
  Duration: 00:00:20.13, start: 0.00, bitrate: 1227 kb/s
  Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 
480x270 [SAR 1:1 DAR 16:9], 978 kb/s, 600 fps, 25 tbr, 600 tbn
  Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, 
fltp, 131 kb/s

michael@zb:~/ffmpeg-git/ffmpeg$ ./ffprobe 
/tmp/file3108-before-10185e2d4c1e9839bc58a1d6a63c861677b13fd0.avi
Input #0, avi, from 
'/tmp/file3108-before-10185e2d4c1e9839bc58a1d6a63c861677b13fd0.avi':
  Duration: 00:00:20.13, start: 0.00, bitrate: 1122 kb/s
  Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 
480x270 [SAR 1:1 DAR 16:9], 978 kb/s, 50 fps, 25 tbr, 50 tbn


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

Those who are best at talking, realize last or never when they are wrong.


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 v3 2/2] configure: correctly set sanitizer toolchain compilers

2024-09-13 Thread Martin Storsjö

On Thu, 12 Sep 2024, Marvin Scholz wrote:


Previously only the C compiler was set, which would lead to
confusing situations where even though clang-asan was selected,
it would still use g++ for C++ code, failing because configure
does not support mixing compilers in this way (which is a separate
issue not addressed by this commit).
---
configure | 70 ---
1 file changed, 41 insertions(+), 29 deletions(-)


Both these patches seem ok to me.

// 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 1/7] avformat/mov_chan: Check for FF_SANE_NB_CHANNELS

2024-09-13 Thread Michael Niedermayer
On Fri, Sep 13, 2024 at 12:08:45PM +0200, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2024-09-13 01:33:31)
> > We do not support more channels. For example avcodec_open2() limits 
> > channels this way too
> > 
> > The example file contains multiple chunks with over 16 million channels
> 
> We had this discussion already.

I remembered something too, but couldnt find the thread within teh time i was 
looking for it


> Ad-hoc checks like this are only
> addressing a symptom (probably one of many), and hide the actual bug.

If you have a better fix, submit it.
If you want me to implement this differently, the first step is to describe
what you have in mind, that the implementation should look like.

But if one
1. allocates an attacker specified amount of memory
2. iterate over it by an attacker specified number of times
3. the case is never supported for numbers over 512
4. doing that 512 check leads to rejected patches

Then theres a problem

Also if the suggestion is to add a user specified limit. This can
be done for git master, for previous release branches thats not an
option and as we only backport from master in general we still need
this kind of fix before a user specified limit.


> 
> > +#include "libavcodec/internal.h"
> 
> I dislike this as well.

I am fine with it.

But if you dont, then maybe you can suggest another way to check
for the number that we support.

Thx

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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 v3 2/2] configure: correctly set sanitizer toolchain compilers

2024-09-13 Thread epirat07


On 13 Sep 2024, at 19:43, Martin Storsjö wrote:

> On Thu, 12 Sep 2024, Marvin Scholz wrote:
>
>> Previously only the C compiler was set, which would lead to
>> confusing situations where even though clang-asan was selected,
>> it would still use g++ for C++ code, failing because configure
>> does not support mixing compilers in this way (which is a separate
>> issue not addressed by this commit).
>> ---
>> configure | 70 ---
>> 1 file changed, 41 insertions(+), 29 deletions(-)
>
> Both these patches seem ok to me.

Thanks for the review.

I intend to merge these on Monday if there are no further comments till 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".
___
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] [RFC/PATCH] MV-HEVC decoding

2024-09-13 Thread Danny Hong
 Quoting Anton Khirnov (2024-09-13 12:44:55)
> Note that -view_ids is a decoder option and does nothing with
> streamcopy.
> Also, that option is intended for API users, with ffmpeg CLI you should
> be using view specifiers instead.

Thanks!  Tried with "-map 0:v:view:all" and the result is the same.  The
resulting elementary stream cannot be decoded by ffmpeg as the stream is
not conformant.

> Use view specifiers to split the views into their own streams. I do not
> want too much multiview-speficic logic into ffmpeg CLI, as it is a
> rather obscure feature.

But the "-map 0:v:view:all" option is still available to output both views
as a single stream with alternating views, no?
Using "-map 0:v:vidx:0 -f rawvideo out0.yuv420p -map 0:v:vidx:1 -f rawvideo
out1.yuv420p" to split the views into separate streams seems to work fine
without the issues mentioned before.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v2 1/2] doc/developer: add examples to clarify code style

2024-09-13 Thread Marvin Scholz
Given the frequency that new developers, myself included, get the
code style wrong, it is useful to add some examples to clarify how
things should be done.
---
 doc/developer.texi | 101 -
 1 file changed, 100 insertions(+), 1 deletion(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 41b21938ef..ea143549b4 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -115,7 +115,7 @@ Objective-C where required for interacting with 
macOS-specific interfaces.
 
 @section Code formatting conventions
 
-There are the following guidelines regarding the indentation in files:
+There are the following guidelines regarding the code style in files:
 
 @itemize @bullet
 @item
@@ -135,6 +135,105 @@ K&R coding style is used.
 @end itemize
 The presentation is one inspired by 'indent -i4 -kr -nut'.
 
+@subsection Examples
+Some notable examples to illustrate common code style in FFmpeg:
+
+@itemize @bullet
+
+@item
+Space around assignments and after
+@code{if}/@code{do}/@code{while}/@code{for} keywords:
+
+@example c, good
+// Good
+if (condition)
+av_foo();
+@end example
+
+@example c, good
+// Good
+for (size_t i = 0; i < len; i++)
+av_bar(i);
+@end example
+
+@example c, good
+// Good
+size_t size = 0;
+@end example
+
+However no spaces between the parentheses and condition, unless it helps
+readability of complex conditions, so the following should not be done:
+
+@example c, bad
+// Bad style
+if ( condition )
+av_foo();
+@end example
+
+@item
+No unnecessary parentheses, unless it helps readability:
+
+@example c, good
+// Good
+int fields = ilace ? 2 : 1;
+@end example
+
+@item
+No braces around single-line blocks:
+
+@example c, good
+// Good
+if (bits_pixel == 24)
+avctx->pix_fmt = AV_PIX_FMT_BGR24;
+else if (bits_pixel == 8)
+avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+else @{
+av_log(avctx, AV_LOG_ERROR, "Invalid pixel format.\n");
+return AVERROR_INVALIDDATA;
+@}
+@end example
+
+@item
+Avoid assignments in conditions where it makes sense:
+
+@example c, good
+// Good
+video_enc->chroma_intra_matrix = 
av_mallocz(sizeof(*video_enc->chroma_intra_matrix) * 64)
+if (!video_enc->chroma_intra_matrix)
+return AVERROR(ENOMEM);
+@end example
+
+@example c, bad
+// Bad style
+if (!(video_enc->chroma_intra_matrix = 
av_mallocz(sizeof(*video_enc->chroma_intra_matrix) * 64)))
+return AVERROR(ENOMEM);
+@end example
+
+@example c, good
+// Ok
+while ((entry = av_dict_iterate(options, entry)))
+av_log(ctx, AV_LOG_INFO, "Item '%s': '%s'\n", entry->key, entry->value);
+@end example
+
+@item
+When declaring a pointer variable, the @code{*} goes with the variable not the 
type:
+
+@example c, good
+// Good
+AVStream *stream;
+@end example
+
+@example c, bad
+// Bad style
+AVStream* stream;
+@end example
+
+@end itemize
+
+If you work on a file that does not follow these guidelines consistently,
+change the parts that you are editing to follow these guidelines but do
+not make unrelated changes in the file to make it conform to these.
+
 @subsection Vim configuration
 In order to configure Vim to follow FFmpeg formatting conventions, paste
 the following snippet into your @file{.vimrc}:

base-commit: 6229e4ac425b4566446edefb67d5c225eb397b58
-- 
2.39.3 (Apple Git-146)


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

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


[FFmpeg-devel] [PATCH v2 2/2] doc: add styles for good/bad code examples

2024-09-13 Thread Marvin Scholz
Makes it easier to immediately see if the code examples given in the
style documentation are good or bad examples, making it harder to
accidentally confuse a bad example for a good one.
---
 doc/style.min.css | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/style.min.css b/doc/style.min.css
index 6843fda57d..a502310bb9 100644
--- a/doc/style.min.css
+++ b/doc/style.min.css
@@ -20,4 +20,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 
OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
- */body{background-color:#313131;color:#e6e6e6;text-align:justify}body, h1, 
h2, h3, h4, h5, h6{font-family:"Lucida Grande","Lucida Sans Unicode","Lucida 
Sans","Helvetica Neue",Helvetica,Verdana,Tahoma,sans-serif}a{color:#4cae4c}a 
strong{color:#e6e6e6}a:hover{color:#7fc77f}a:hover 
strong{color:#4cae4c}main{width:100% ! 
important;min-height:600px;margin:auto}h1, h2, h3, 
h4{font-weight:bold;text-align:left}h1, h2, h3{color:#bebebe}h1 strong, h2 
strong, h3 strong{color:#e6e6e6}h4, h5, h6{color:#3c8b3c}h1{border-bottom:4px 
#bebebe solid;padding:20px 2%}h3{border-bottom:2px #bebebe solid;padding:15px 
1%}h4{border-bottom:1px solid #e6e6e6;padding:10px 0;margin:20px 
0;color:#e6e6e6}.list-group 
.list-group-item{background-color:#3e3e3e;border-color:black}.list-group.list-group-big
 .list-group-item{padding:25px}.list-group 
a.list-group-item{color:#7fc77f}.list-group 
a.list-group-item:hover{background-color:#313131;color:#4cae4c}.well{background-color:#242424;border-color:black;color:#bebebe}.
 well strong{color:#e6e6e6}.well code{background-color:#313131}.well 
hr{border-color:#3c8b3c}.well h3{margin:5px 0 15px 0;border:0;padding:0}.well 
a{color:#4cae4c}.well a.btn{color:white}.well small{display:block;padding:0 
10px;font-style:italic}.well.example{padding-top:40px;margin-bottom:130px}.well.example
 pre{margin:50px;margin-bottom:30px;font-size:1.5em}.well.example 
.btn{margin-right:50px;margin-bottom:20px}.well.well-with-icon{min-height:136px}.well.well-with-icon
 .pull-right,.well.well-with-icon 
.pull-left{background-color:#4cae4c;color:#e6e6e6;padding:10px;border-radius:5px;margin:5px}.well.well-with-icon
 .pull-right{margin-left:20px}.well.well-with-icon 
.pull-left{margin-right:20px}a.well{display:block}a.well:hover{text-decoration:none;opacity:0.8}.info,
 .warning{margin:10px;padding:10px;background-color:#3e3e3e;color:#e6e6e6}.info 
code, .warning code{background-color:#313131}.info{border-left:10px #4cae4c 
solid}.warning{border-left:10px #ae4c4c solid}.with-icon{padding:30
 px}.with-icon .pull-left{padding-right:30px}.with-icon 
.pull-right{padding-left:30px}dd{margin-left:20px}code{background-color:#242424;color:#7fc77f;display:inline-block;margin:5px}.table{margin:20px
 0;border-radius:4px}.table th,.table td,.table tr{border:1px solid 
#171717}.table tr th{background-color:#3e3e3e;border-bottom:2px solid 
#e6e6e6}.table tr:nth-child(odd){background-color:#242424}#sidebar-wrapper, 
.navbar{background-color:#171717;overflow-x:hidden}#sidebar-wrapper 
.sidebar-brand img,#sidebar-wrapper .navbar-brand img, .navbar .sidebar-brand 
img, .navbar .navbar-brand img{opacity:0.6;margin-right:8px}#sidebar-wrapper 
.sidebar-brand:hover,#sidebar-wrapper .navbar-brand:hover, .navbar 
.sidebar-brand:hover, .navbar .navbar-brand:hover{color:#fff}#sidebar-wrapper 
.sidebar-brand:hover img,#sidebar-wrapper .navbar-brand:hover img, .navbar 
.sidebar-brand:hover img, .navbar .navbar-brand:hover 
img{opacity:1}#sidebar-wrapper .sidebar-nav li ul, .navbar .sidebar-nav li 
ul{list-styl
 e-type:none;padding:0}#sidebar-wrapper .sidebar-nav li ul li, .navbar 
.sidebar-nav li ul li{line-height:20px}#sidebar-wrapper .sidebar-nav li ul li 
a, .navbar .sidebar-nav li ul li 
a{padding-left:20px}.content-header{height:auto;background-color:#242424}.content-header
 
h1{color:#e6e6e6;display:block;margin:0;margin-bottom:20px;line-height:normal;border-bottom:none}#download
 h4, #index h4{margin-top:180px}#download h4.first, #index 
h4.first{margin-top:20px}#download h4.first small, #index h4.first 
small{color:inherit;font-size:1em}#download .btn-download-wrapper, #index 
.btn-download-wrapper{text-align:center;margin:160px auto}#download 
.btn-download-wrapper .btn, #index .btn-download-wrapper 
.btn{font-size:3em;padding:3%;display:inline-block;margin-bottom:5px}#download 
.btn-download-wrapper small, #index .btn-download-wrapper 
small{display:block;font-size:0.4em}#download h2.description, #index 
h2.description{color:#e6e6e6;font-size:2em;font-weight:bold;margin:120px 
50px;line-height:
 2em}#download h2.description .label, #index h2.description 
.label{font-size:0.5em}#download .btn-download-wrapper{margin:40px 
auto}#download .os-selector{text-align:center;color:#e6e6e6;margin:30px 
0}#download .os-selector 
a.btn-build{color:#e6e6e6;display:block;padding:20px;border-rad

Re: [FFmpeg-devel] [PATCH] doc/developer: add examples to clarify code style

2024-09-13 Thread epirat07



On 18 May 2024, at 20:22, Andrew Sayers wrote:

> I would have found this very helpful!

Thanks for the review, I just submitted a new version that hopefully
addresses most of your points.

>
> On Sat, May 18, 2024 at 07:00:50PM +0200, Marvin Scholz wrote:
>> Given the frequency that new developers, myself included, get the
>> code style wrong, it is useful to add some examples to clarify how
>> things should be done.
>> ---
>>  doc/developer.texi | 57 +-
>>  1 file changed, 56 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/developer.texi b/doc/developer.texi
>> index 63835dfa06..d7bf3f9cb8 100644
>> --- a/doc/developer.texi
>> +++ b/doc/developer.texi
>> @@ -115,7 +115,7 @@ Objective-C where required for interacting with 
>> macOS-specific interfaces.
>>
>>  @section Code formatting conventions
>>
>> -There are the following guidelines regarding the indentation in files:
>> +There are the following guidelines regarding the code style in files:
>>
>>  @itemize @bullet
>>  @item
>> @@ -135,6 +135,61 @@ K&R coding style is used.
>>  @end itemize
>>  The presentation is one inspired by 'indent -i4 -kr -nut'.
>>
>> +@subsection Examples
>> +Some notable examples to illustrate common code style in FFmpeg:
>> +
>> +@itemize @bullet
>> +
>> +@item
>> +Spaces around @code{if}/@code{do}/@code{while}/@code{for} conditions and 
>> assigments:
>
> s/assigments/assignments/
>
> Also, this might be more readable as "Space around assignments and after
> @code{if}... keywords"?  On first pass, I assumed this was telling me
> `( condition )` is correct, then had to re-read when the example showed
> it wasn't.
>
>> +
>> +@example c
>> +if (condition)
>
> `condition` here differs from `cond` below, despite conveying the same 
> meaning.
> Either word is fine so long as it's the same word in both places.
>
>> +av_foo();
>> +@end example
>> +
>> +@example c
>> +for (size_t i = 0; i < len; i++)
>
> This lightly implies we prefer `i < len` over `i != len` and `i++` over `++i`.
> Is that something people round here have strong opinions about?  Maybe iterate
> over a linked list if this is a controversial question?
>
>> +av_bar(i);
>> +@end example
>> +
>> +@example c
>> +size_t size = 0;
>> +@end example
>> +
>> +However no spaces between the parentheses and condition, unless it helps
>> +readability of complex conditions, so the following should not be done:
>> +
>> +@example c
>> +// Wrong:
>
> Nitpick: if you're going to say "// Wrong" here, it might be better to 
> introduce
> the mechanism with some "// Good"s or something above.  The consistency 
> reduces
> cognitive load on the learner, and it's a good excuse to add a little 
> positivity
> to a nerve-wracking experience.
>
>> +if ( cond )
>> +av_foo();
>> +@end example
>> +
>> +@item
>> +No unnecessary parentheses, unless it helps readability:
>> +
>> +@example c
>> +flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
>> +@end example
>
> Can the example use "+" or "*" instead of "|"?  I've had so many bugs where
> I got the precedence wrong, I'm not sure whether this is supposed to be a good
> or bad example of readability.
>
>> +
>> +@item
>> +No braces around single-line blocks:
>> +
>> +@example c
>> +if (bits_pixel == 24)
>> +avctx->pix_fmt = AV_PIX_FMT_BGR24;
>> +else if (bits_pixel == 8)
>> +avctx->pix_fmt = AV_PIX_FMT_GRAY8;
>> +else @{
>> +av_log(avctx, AV_LOG_ERROR, "Invalid pixel format.\n");
>> +return AVERROR_INVALIDDATA;
>> +@}
>> +@end example
>> +
>> +@end itemize
>> +
>> +
>>  @subsection Vim configuration
>>  In order to configure Vim to follow FFmpeg formatting conventions, paste
>>  the following snippet into your @file{.vimrc}:
>
> Some other things that could help (in decreasing order of importance)...
>
> * if you find a piece of code that looks wrong, should you...
>   a) ignore the guide and match your style to the surroundings?
>   b) follow the guide and accept the file will look inconsistent?
>   c) add an extra patch to fix the formatting?
>
> (I suspect the answer is (b), but could well be wrong)
>
> * example of brace style for both functions and structs
>   (as a newbie you don't know if you're about to meet one of those people
>   who get all bent out of shape when they see a bracket on a line on its own
>   )
>
> * prefer `foo=bar; if (foo)` over `if ((foo=bar))`
>   (the latter is sadly used in the code, but is a speedbump for reviewers)
>
> * `foo *bar`, not `foo* bar`
>   (I always forget this, not important if it's just me)
>
> Also, way outside the scope of this patch, but a linter that checks these 
> things
> would be very much appreciated.  There's a lot to get wrong with your first 
> patch,
> and a program that just said "yep that's formatted correctly" might save a 
> newbie
> enough time to learn git-send-email instead.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/m

Re: [FFmpeg-devel] [RFC/PATCH] MV-HEVC decoding

2024-09-13 Thread James Almer

On 9/13/2024 2:58 PM, Danny Hong wrote:

  Quoting Anton Khirnov (2024-09-13 12:44:55)

Note that -view_ids is a decoder option and does nothing with
streamcopy.
Also, that option is intended for API users, with ffmpeg CLI you should
be using view specifiers instead.


Thanks!  Tried with "-map 0:v:view:all" and the result is the same.  The
resulting elementary stream cannot be decoded by ffmpeg as the stream is
not conformant.


Are you talking about decoding the resulting raw bitstream created from 
doing stream copy from the source mov? If so, what's happening is 
probably that the parser is splitting AUs when the second SEI with 
layer_id == 0 shows up in those non-conformant samples.
This doesn't happen if you try to decode directly from the mov as the 
parser does not attempt to do any packetization then.





Use view specifiers to split the views into their own streams. I do not
want too much multiview-speficic logic into ffmpeg CLI, as it is a
rather obscure feature.


But the "-map 0:v:view:all" option is still available to output both views
as a single stream with alternating views, no?
Using "-map 0:v:vidx:0 -f rawvideo out0.yuv420p -map 0:v:vidx:1 -f rawvideo
out1.yuv420p" to split the views into separate streams seems to work fine
without the issues mentioned before.
___
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".




OpenPGP_signature.asc
Description: OpenPGP digital 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] ffbuild: add METALCC and METALLIB to BRIEF

2024-09-13 Thread epirat07
On 12 Jul 2024, at 20:38, Marvin Scholz wrote:

> ---
>  ffbuild/common.mak | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

If no one has objections in the meantime, I will merge it next week.

> diff --git a/ffbuild/common.mak b/ffbuild/common.mak
> index 87a3ffd2b0..023adb8567 100644
> --- a/ffbuild/common.mak
> +++ b/ffbuild/common.mak
> @@ -18,7 +18,7 @@ BIN2C = $(BIN2CEXE)
>  ifndef V
>  Q  = @
>  ECHO   = printf "$(1)\t%s\n" $(2)
> -BRIEF  = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD STRIP CP WINDRES NVCC 
> BIN2C
> +BRIEF  = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD STRIP CP WINDRES NVCC 
> BIN2C METALCC METALLIB
>  SILENT = DEPCC DEPHOSTCC DEPAS DEPX86ASM RANLIB RM
>
>  MSG= $@
>
> base-commit: 85706f5136cf7c88f95843b2634dd3f7d7d2cb6d
> -- 
> 2.39.3 (Apple Git-146)
___
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] [RFC/PATCH] MV-HEVC decoding

2024-09-13 Thread Danny Hong
Quoting James Almer (2024-09-13 22:19:35)
> Are you talking about decoding the resulting raw bitstream created from
> doing stream copy from the source mov? If so, what's happening is
> probably that the parser is splitting AUs when the second SEI with
> layer_id == 0 shows up in those non-conformant samples.
> This doesn't happen if you try to decode directly from the mov as the
> parser does not attempt to do any packetization then.

Yes, this is due to hevc_find_frame_end (in libavcodec/hevc/parser.c)
correctly marking a new AU when prefix NAL with layer ID 0 is detected.  I
think Apple is incorrectly placing the prefix NAL to precede the VCL NAL
with layer ID 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] [RFC/PATCH] MV-HEVC decoding

2024-09-13 Thread James Almer

On 9/13/2024 5:51 PM, Danny Hong wrote:

Quoting James Almer (2024-09-13 22:19:35)

Are you talking about decoding the resulting raw bitstream created from
doing stream copy from the source mov? If so, what's happening is
probably that the parser is splitting AUs when the second SEI with
layer_id == 0 shows up in those non-conformant samples.
This doesn't happen if you try to decode directly from the mov as the
parser does not attempt to do any packetization then.


Yes, this is due to hevc_find_frame_end (in libavcodec/hevc/parser.c)
correctly marking a new AU when prefix NAL with layer ID 0 is detected.  I
think Apple is incorrectly placing the prefix NAL to precede the VCL NAL
with layer ID 1.


It's probably not misplaced but mistagged as nuh_layer_id == 0 when it 
should be 1 (Can SEI NALUs be in anything other than the base layer?).
The SEI is User Data Unregistered, and its contents are different than 
the one preceding the base layer VCL NALU. so i guess it's some Apple 
specific metadata that applies to each corresponding view that they 
didn't bother to document.


Can this issue be raised to them?



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

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


[FFmpeg-devel] [WIP PATCH 0/1] avcodec/aacenc: improve bit_rate_tolerance=0

2024-09-13 Thread Pauli Virtanen
In the FFMPEG native AAC encoder, bit_rate_tolerance=0 (-bt:a 0)
enforces a strict bitrate mode, where maximum length of the AAC frame
(frame_bits) is capped below nominal bitrate (rate_bits).

It currently seems to have some issues:

- encoder can get stuck in an infinite loop
- sound quality issues, as it's never scaling lambda above the initial value
- bitrates can be far below bit_rate target

Some samples for reproducing:
https://gitlab.freedesktop.org/pvir/repros/-/tree/main/ffmpeg-aacenc-bt

The option was added in the native AAC encoder in commit b92af7b64e7acd,
and it is needed in Bluetooth A2DP AAC encoding, where each frame must
fit into MTU or it cannot be sent to receiver. (AFAIK, receivers don't
support fragmentation, and everyone including Android seems to be just
using FDK-AAC with its equivalent AACENC_PEAK_BITRATE option.)

I would like to allow using FFMPEG native AAC encoder for Bluetooth AAC
audio in PipeWire instead of FDK-AAC that we require right now, but the
above quality problems of the encoder are a problem for this right now.
(If you want to test PW+FFMPEG-AAC yourself, you can build PipeWire from
https://gitlab.freedesktop.org/pvir/pipewire/-/commits/libav
try it out with some BT headphones that support AAC.)

It would be great to have the situation improved. Here's a patch trying
to address some of the issues with bit_rate_tolerance=0, by doing the
following:

- target a bitrate slightly below frame_bits cap with the usual code path

- if frame_bits exceeds cap, find good lambda with a root finding method
  (usually converges in a few iterations).

The sound quality with this patch seems better than before, as now it
maintains sufficient bitrate.

Problems remain, though:

- it appears the resulting frame_bits depends also on some other state
  than s->lambda. iteration with lambda1, lambda2>lambda1, and then again
  with lambda1 can produce different frame_bits on the two lambda1
  iterations. Is there some state that is modified across iterations?

  The problem here is that the root finding sometimes cannot go back to
  OK value of lambda it found earlier, so the frame ends up being too
  large.

- for some inputs, frame_bits appears to not be reduced much by any
  value of lambda.  This is the case where it previously went to
  nonterminating loop.  Now I just made it return the too large frame in
  this case, and let the caller deal with it...

It doesn't look like that can be fixed by just playing with lambda,
maybe some other changes in the encoder are needed.  There's a sample of
such "adversarial" input in the above link.

I'm not at the moment familiar enough with AAC encoding to know how to
fix the above, that'd need some more work / additional hints.

Pauli Virtanen (1):
  avcodec/aacenc: improve bit_rate_tolerance=0

 libavcodec/aacenc.c | 153 +++-
 libavcodec/aacenc.h |   1 +
 2 files changed, 124 insertions(+), 30 deletions(-)

-- 
2.46.0

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

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


[FFmpeg-devel] [WIP PATCH 1/1] avcodec/aacenc: improve bit_rate_tolerance=0

2024-09-13 Thread Pauli Virtanen
bit_rate_tolerance=0 has a few problems:

- infinite loop if frame_bits doesn't become small enough for any lambda
- bad quality, as it's never increasing lambda above the initial value
- not doing the restoring of coeffs after adjusting lambda

Attempt to address these:

- target bitrate a bit below frame_bits cap with the usual code path
- if frame_bits exceeds cap, find good lambda with a zero finding method

The zero finding usually converges in 1-3 iterations.

Remaining problems:

- instead of the infinite loop, we now silently return the too large
  frame, and let the caller handle it. This is still a bug, but fixing it
  needs something else than playing with lambda.

- it appears the resulting frame_bits depends also on some other state
  than s->lambda. iteration with lambda1, lambda2>lambda1, and then again
  with lambda1 produces different frame_bits on the two lambda1
  iterations. In this case the root finding can fail, as it cannot any
  more return to a previous "good" lambda.

The sound quality from this patch with bit_rate_tolerance=0 is improved,
as it now maintains sufficient bitrate closer to the target.  Encoding
is also faster now that less re-encoding is done:

Before: ffmpeg -i sample.flac -c aac -b:a 200k -bt:a 0 -y before.aac
size=2776KiB time=00:03:10.98 bitrate= 119.1kbits/s speed=14.4x

After: ffmpeg -i sample.flac -c aac -b:a 200k -bt:a 0 -y after.aac
size=3897KiB time=00:03:10.98 bitrate= 167.1kbits/s speed=23.6x

Signed-off-by: Pauli Virtanen 
---
 libavcodec/aacenc.c | 153 +++-
 libavcodec/aacenc.h |   1 +
 2 files changed, 124 insertions(+), 30 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 88037c7f87..ffa72be217 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -826,6 +826,58 @@ static void copy_input_samples(AACEncContext *s, const 
AVFrame *frame)
 }
 }
 
+/**
+ * Finding zero of function f(x).
+ * The initial zero bracketing assumes f(x) is increasing.
+ */
+typedef struct FindZero {
+int init;  ///< bitmask of whether x[0] (0x1) and x[1] (0x2) are valid
+float x[2];///< zero of f(x) is in interval (x[0], x[1])
+float f[2];///< interpolation values
+int i; ///< which x[i] is latest
+float b;   ///< bracketing multiplier
+} FindZero;
+
+/** Return next x to evaluate f(x) at to approach the zero. */
+static float find_zero_next(FindZero *r, float x, float f)
+{
+if (r->init != 0x3) {
+/* Bracket the zero, assuming x > 0 and f(x) is increasing */
+r->b = FFMIN(2 + 2 * r->b, 65536.0f);
+if (f < 0) {
+r->x[0] = x;
+r->f[0] = f;
+r->init |= 0x1;
+if (r->init != 0x3)
+return x * r->b;
+} else {
+r->x[1] = x;
+r->f[1] = f;
+r->init |= 0x2;
+if (r->init != 0x3)
+return x / r->b;
+}
+r->i = 1;
+} else {
+/* Anderson-Bjoerck false position method */
+if ((f < 0) != (r->f[r->i] < 0)) {
+r->i = !r->i;
+} else {
+float m = 1 - (float)f / r->f[r->i];
+
+if (m <= 0)
+m = 0.5f;
+
+r->f[!r->i] *= m;
+}
+
+r->x[r->i] = x;
+r->f[r->i] = f;
+}
+
+return (r->x[0] * r->f[1] - r->x[1] * r->f[0]) / (r->f[1] - r->f[0]);
+}
+
 static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 const AVFrame *frame, int *got_packet_ptr)
 {
@@ -839,6 +891,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
 int ms_mode = 0, is_mode = 0, tns_mode = 0, pred_mode = 0;
 int chan_el_counter[4];
 FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
+FindZero find_lambda = { 0 };
 
 /* add current frame to queue */
 if (frame) {
@@ -1100,32 +1153,58 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
  */
 frame_bits = put_bits_count(&s->pb);
 rate_bits = avctx->bit_rate * 1024 / avctx->sample_rate;
-rate_bits = FFMIN(rate_bits, 6144 * s->channels - 3);
+rate_bits = FFMIN(rate_bits, s->max_frame_bits);
 too_many_bits = FFMAX(target_bits, rate_bits);
-too_many_bits = FFMIN(too_many_bits, 6144 * s->channels - 3);
+too_many_bits = FFMIN(too_many_bits, s->max_frame_bits);
 too_few_bits = FFMIN(FFMAX(rate_bits - rate_bits/4, target_bits), 
too_many_bits);
 
-/* When strict bit-rate control is demanded */
-if (avctx->bit_rate_tolerance == 0) {
-if (rate_bits < frame_bits) {
-float ratio = ((float)rate_bits) / frame_bits;
-s->lambda *= FFMIN(0.9f, ratio);
-continue;
-}
-/* reset lambda when solution is found */
-s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 
120;
-break;
-}
-
 

Re: [FFmpeg-devel] [PATCH v2 1/2] doc/developer: add examples to clarify code style

2024-09-13 Thread martin schitter

These a very helpful instructive examples.

Nevertheless, I would highly prefer a preconfigured `make fmt` command, 
which works similar to `cargo fmt` or `deno fmt` and corrects and checks 
formating issues without any human intervention. That's IMHO more 
productive than constantly work against the default behavior of ones 
beloved code editor or educative/social pressure to adapt to a project 
specific kind of cosmetic code modification.


martin

On 18.05.24 19:00, Marvin Scholz wrote:

Given the frequency that new developers, myself included, get the
code style wrong, it is useful to add some examples to clarify how
things should be done.


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

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


Re: [FFmpeg-devel] [PATCH v2 1/2] doc/developer: add examples to clarify code style

2024-09-13 Thread epirat07


On 14 Sep 2024, at 0:12, martin schitter wrote:

> These a very helpful instructive examples.
>
> Nevertheless, I would highly prefer a preconfigured `make fmt` command, which 
> works similar to `cargo fmt` or `deno fmt` and corrects and checks formating 
> issues without any human intervention. That's IMHO more productive than 
> constantly work against the default behavior of ones beloved code editor or 
> educative/social pressure to adapt to a project specific kind of cosmetic 
> code modification.
>

I agree it would be nice to have an easy way, like clang-format or so,
but I doubt it will happen any time soon as its not trivial to do I think…

> martin
>
> On 18.05.24 19:00, Marvin Scholz wrote:
>> Given the frequency that new developers, myself included, get the
>> code style wrong, it is useful to add some examples to clarify how
>> things should be done.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avcodec/refstruct: inline ff_refstruct_pool_alloc()

2024-09-13 Thread James Almer
Much like ff_refstruct_pool_alloc_ext(), it's a wrapper around
ff_refstruct_pool_alloc_ext_c().

Signed-off-by: James Almer 
---
 libavcodec/refstruct.c |  5 -
 libavcodec/refstruct.h | 17 -
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/libavcodec/refstruct.c b/libavcodec/refstruct.c
index f89af156c2..13778f3f58 100644
--- a/libavcodec/refstruct.c
+++ b/libavcodec/refstruct.c
@@ -332,11 +332,6 @@ static void refstruct_pool_uninit(FFRefStructOpaque 
unused, void *obj)
 }
 }
 
-FFRefStructPool *ff_refstruct_pool_alloc(size_t size, unsigned flags)
-{
-return ff_refstruct_pool_alloc_ext(size, flags, NULL, NULL, NULL, NULL, 
NULL);
-}
-
 FFRefStructPool *ff_refstruct_pool_alloc_ext_c(size_t size, unsigned flags,
FFRefStructOpaque opaque,
int  
(*init_cb)(FFRefStructOpaque opaque, void *obj),
diff --git a/libavcodec/refstruct.h b/libavcodec/refstruct.h
index c64ad62b6b..f9cd406bf2 100644
--- a/libavcodec/refstruct.h
+++ b/libavcodec/refstruct.h
@@ -220,11 +220,6 @@ typedef struct FFRefStructPool FFRefStructPool;
  */
 #define FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME   (1 << 18)
 
-/**
- * Equivalent to ff_refstruct_pool_alloc(size, flags, NULL, NULL, NULL, NULL, 
NULL)
- */
-FFRefStructPool *ff_refstruct_pool_alloc(size_t size, unsigned flags);
-
 /**
  * Allocate an FFRefStructPool, potentially using complex callbacks.
  *
@@ -266,6 +261,18 @@ FFRefStructPool *ff_refstruct_pool_alloc_ext(size_t size, 
unsigned flags,
  init_cb, reset_cb, free_entry_cb, 
free_cb);
 }
 
+/**
+ * A wrapper around ff_refstruct_pool_alloc_ext_c() for the common case
+ * of no custom callbacks.
+ *
+ * @see ff_refstruct_pool_alloc_ext_c()
+ */
+static inline
+FFRefStructPool *ff_refstruct_pool_alloc(size_t size, unsigned flags)
+{
+return ff_refstruct_pool_alloc_ext(size, flags, NULL, NULL, NULL, NULL, 
NULL);
+}
+
 /**
  * Get an object from the pool, reusing an old one from the pool when
  * available.
-- 
2.46.0

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

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


[FFmpeg-devel] [PATCH] avcodec/bsf/dts2pts: use a RefStruct pool to allocate nodes

2024-09-13 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/bsf/dts2pts.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/bsf/dts2pts.c b/libavcodec/bsf/dts2pts.c
index ba4dc43f84..2be79c624b 100644
--- a/libavcodec/bsf/dts2pts.c
+++ b/libavcodec/bsf/dts2pts.c
@@ -34,6 +34,7 @@
 #include "cbs_h264.h"
 #include "h264_parse.h"
 #include "h264_ps.h"
+#include "refstruct.h"
 
 typedef struct DTS2PTSNode {
 int64_t  dts;
@@ -61,6 +62,7 @@ typedef struct DTS2PTSH264Context {
 typedef struct DTS2PTSContext {
 struct AVTreeNode *root;
 AVFifo *fifo;
+FFRefStructPool *node_pool;
 
 // Codec specific function pointers and constants
 int (*init)(AVBSFContext *ctx);
@@ -110,7 +112,7 @@ static int dec_poc(void *opaque, void *elem)
 static int free_node(void *opaque, void *elem)
 {
 DTS2PTSNode *node = elem;
-av_free(node);
+ff_refstruct_unref(&node);
 return 0;
 }
 
@@ -124,7 +126,7 @@ static int alloc_and_insert_node(AVBSFContext *ctx, int64_t 
ts, int64_t duration
 DTS2PTSNode *poc_node, *ret;
 if (!node)
 return AVERROR(ENOMEM);
-poc_node = av_malloc(sizeof(*poc_node));
+poc_node = ff_refstruct_pool_get(s->node_pool);
 if (!poc_node) {
 av_free(node);
 return AVERROR(ENOMEM);
@@ -135,7 +137,7 @@ static int alloc_and_insert_node(AVBSFContext *ctx, int64_t 
ts, int64_t duration
 ret = av_tree_insert(&s->root, poc_node, cmp_insert, &node);
 if (ret && ret != poc_node) {
 *ret = *poc_node;
-av_free(poc_node);
+ff_refstruct_unref(&poc_node);
 av_free(node);
 }
 }
@@ -394,6 +396,11 @@ static int dts2pts_init(AVBSFContext *ctx)
 if (!s->fifo)
 return AVERROR(ENOMEM);
 
+s->node_pool = ff_refstruct_pool_alloc(sizeof(DTS2PTSNode), 0);
+
+if (!s->node_pool)
+return AVERROR(ENOMEM);
+
 ret = ff_cbs_init(&s->cbc, ctx->par_in->codec_id, ctx);
 if (ret < 0)
 return ret;
@@ -459,7 +466,7 @@ static int dts2pts_filter(AVBSFContext *ctx, AVPacket *out)
 if (!poc_node || poc_node->dts != out->pts)
 continue;
 av_tree_insert(&s->root, poc_node, cmp_insert, &node);
-av_free(poc_node);
+ff_refstruct_unref(&poc_node);
 av_free(node);
 poc_node = av_tree_find(s->root, &dup, cmp_find, NULL);
 }
@@ -521,6 +528,7 @@ static void dts2pts_close(AVBSFContext *ctx)
 dts2pts_flush(ctx);
 
 av_fifo_freep2(&s->fifo);
+ff_refstruct_pool_uninit(&s->node_pool);
 ff_cbs_fragment_free(&s->au);
 ff_cbs_close(&s->cbc);
 }
-- 
2.46.0

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

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


[FFmpeg-devel] [PATCH v2] libavutil/ppc: Make use of getauxval() and elf_aux_info() on ppc

2024-09-13 Thread Brad Smith
Subject: [PATCH] libavutil/ppc: Make use of getauxval() and elf_aux_info() on 
ppc

Modern Linux has getauxval() and FreeBSD/OpenBSD ppc have elf_aux_info().

Signed-off-by: Brad Smith 
---
adjust to build with older glibc.

 libavutil/ppc/cpu.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 2b13cda662..5dd23013fb 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -20,6 +20,8 @@
 
 #ifdef __APPLE__
 #include 
+#elif HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
+#include 
 #elif defined(__linux__)
 #include 
 #include 
@@ -56,6 +58,26 @@ int ff_get_cpu_flags_ppc(void)
 if (result == VECTORTYPE_ALTIVEC)
 return AV_CPU_FLAG_ALTIVEC;
 return 0;
+#elif HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
+int flags = 0;
+
+unsigned long hwcap = ff_getauxval(AT_HWCAP);
+#ifdef PPC_FEATURE2_ARCH_2_07
+unsigned long hwcap2 = ff_getauxval(AT_HWCAP2);
+#endif
+
+if (hwcap & PPC_FEATURE_HAS_ALTIVEC)
+   flags |= AV_CPU_FLAG_ALTIVEC;
+#ifdef PPC_FEATURE_HAS_VSX
+if (hwcap & PPC_FEATURE_HAS_VSX)
+   flags |= AV_CPU_FLAG_VSX;
+#endif
+#ifdef PPC_FEATURE2_ARCH_2_07
+if (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+   flags |= AV_CPU_FLAG_POWER8;
+#endif
+
+return flags;
 #elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__)
 #if defined(__NetBSD__) || defined(__OpenBSD__)
 int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
-- 
2.46.0

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

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


[FFmpeg-devel] [PATCH] avcodec/amfenc: Update supported HEVC color ranges

2024-09-13 Thread Cameron Gutman
We properly set AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE since fb4dd4b6f48.

Signed-off-by: Cameron Gutman 
---
 libavcodec/amfenc_hevc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 4898824f3a..71e7d8aa61 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -536,7 +536,7 @@ const FFCodec ff_hevc_amf_encoder = {
 .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
   FF_CODEC_CAP_INIT_CLEANUP,
 .p.pix_fmts = ff_amf_pix_fmts,
-.color_ranges   = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
+.color_ranges   = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
 .p.wrapper_name = "amf",
 .hw_configs = ff_amfenc_hw_configs,
 };
-- 
2.43.0.windows.1

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

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


[FFmpeg-devel] [PATCH] avcodec/amfenc: Fix inverted loop filter option

2024-09-13 Thread Cameron Gutman
The AMF HEVC encoder takes a bool option for whether deblocking filter
should be _disabled_ instead of whether it should _enabled_ like the
AMF H.264 encoder does. The logic was accidentally copied from H.264 to
HEVC without negating the bool value, so the deblocking filter was
actually disabled when AV_CODEC_FLAG_LOOP_FILTER was set.

Before this patch:
--
no flags set => deblocking filter on
flags +loop  => deblocking filter off
flags -loop  => deblocking filter on

After this patch:
-
no flags set => deblocking filter on
flags +loop  => deblocking filter on
flags -loop  => deblocking filter off

Signed-off-by: Cameron Gutman 
---
 libavcodec/amfenc_hevc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 71e7d8aa61..7b4b2f722d 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -269,7 +269,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (avctx->slices > 1) {
 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_SLICES_PER_FRAME, avctx->slices);
 }
-AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_DE_BLOCKING_FILTER_DISABLE, deblocking_filter);
+AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_DE_BLOCKING_FILTER_DISABLE, !deblocking_filter);
 
 if (ctx->header_insertion_mode != -1) {
 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE, ctx->header_insertion_mode);
@@ -511,6 +511,7 @@ static const FFCodecDefault defaults[] = {
 { "slices", "1"   },
 { "qmin",   "-1"  },
 { "qmax",   "-1"  },
+{ "flags",  "+loop"},
 { NULL},
 };
 static const AVClass hevc_amf_class = {
-- 
2.43.0.windows.1

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

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


[FFmpeg-devel] [PATCH] hw_base_enc: inject side data to crop output for AV1

2024-09-13 Thread Lynne via ffmpeg-devel
Unlike H264/H265, AV1 contains no fields to crop encoded output
to specific sizes.
AMD's hardware cannot handle encoding of unaligned dimensions for
AV1, hence it codes 1920x1080 as 1920x1088.

Add side data to crop the output back to the original dimensions.
There's an AV1-spec extension planned to fix this here:
https://github.com/AOMediaCodec/av1-spec/pull/346

But it seems to have stuck for now.
---
 libavcodec/hw_base_encode.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index 7b6ec97d3b..6e67c9c301 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -22,6 +22,7 @@
 #include "libavutil/log.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/intreadwrite.h"
 
 #include "encode.h"
 #include "avcodec.h"
@@ -551,6 +552,30 @@ int 
ff_hw_base_encode_set_output_property(FFHWBaseEncodeContext *ctx,
 (3 * ctx->output_delay + ctx->async_depth)];
 }
 
+if ((avctx->codec_id == AV_CODEC_ID_AV1) &&
+((avctx->coded_width != avctx->width) ||
+ (avctx->coded_height != avctx->height)) {
+int err;
+size_t crop_data_size = 4*4;
+
+uint8_t *crop_data = av_mallocz(crop_data_size);
+if (!crop_data) {
+av_buffer_unref(&pkt->buf);
+return AVERROR(ENOMEM);
+}
+
+AV_WL32(&crop_data[2], ctx->surface_width - avctx->width);
+AV_WL32(&crop_data[3], ctx->surface_height - avctx->height);
+
+err = av_packet_add_side_data(pkt, AV_PKT_DATA_FRAME_CROPPING,
+  crop_data, crop_data_size);
+if (err < 0) {
+av_buffer_unref(&pkt->buf);
+av_free(crop_data);
+return err;
+}
+}
+
 return 0;
 }
 
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [RFC] 7.1 Release

2024-09-13 Thread Marth64
I submitted DVD seeking support in a small single commit patch. While not
breaking it would be nice to have if I’m not too late. Thank you.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v2] hw_base_enc: inject side data to crop output for AV1

2024-09-13 Thread Lynne via ffmpeg-devel
Unlike H264/H265, AV1 contains no fields to crop encoded output
to specific sizes.
AMD's hardware cannot handle encoding of unaligned dimensions for
AV1, hence it codes 1920x1080 as 1920x1088.

Add side data to crop the output back to the original dimensions.
There's an AV1-spec extension planned to fix this here:
https://github.com/AOMediaCodec/av1-spec/pull/346

But it seems to have stuck for now.
---
 libavcodec/hw_base_encode.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index 7b6ec97d3b..c28f1aa91c 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -22,6 +22,7 @@
 #include "libavutil/log.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/intreadwrite.h"
 
 #include "encode.h"
 #include "avcodec.h"
@@ -551,6 +552,30 @@ int 
ff_hw_base_encode_set_output_property(FFHWBaseEncodeContext *ctx,
 (3 * ctx->output_delay + ctx->async_depth)];
 }
 
+if ((avctx->codec_id == AV_CODEC_ID_AV1) &&
+((avctx->coded_width != avctx->width) ||
+ (avctx->coded_height != avctx->height))) {
+int err;
+size_t crop_data_size = 4*4;
+
+uint8_t *crop_data = av_mallocz(crop_data_size);
+if (!crop_data) {
+av_buffer_unref(&pkt->buf);
+return AVERROR(ENOMEM);
+}
+
+AV_WL32(&crop_data[2], ctx->surface_width - avctx->width);
+AV_WL32(&crop_data[3], ctx->surface_height - avctx->height);
+
+err = av_packet_add_side_data(pkt, AV_PKT_DATA_FRAME_CROPPING,
+  crop_data, crop_data_size);
+if (err < 0) {
+av_buffer_unref(&pkt->buf);
+av_free(crop_data);
+return err;
+}
+}
+
 return 0;
 }
 
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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