Re: [FFmpeg-devel] [PATCH v2 5/6] avutil/csp: add EOTF function definitions

2024-12-01 Thread Niklas Haas
On Sun, 01 Dec 2024 02:56:31 +0100 Michael Niedermayer  
wrote:
> Hi
>
> On Sat, Nov 30, 2024 at 03:27:53PM +0100, Niklas Haas wrote:
> > On Sat, 30 Nov 2024 15:23:50 +0100 Niklas Haas  wrote:
> > > From: Niklas Haas 
> > >
> > > The existing av_csp_trc_func_from_id() mostly implements the OETF, except 
> > > for
> > > PQ. As such, we are currently missing a precise definition of an ITU-R 
> > > EOTF.
> > > Introduce the new functions av_csp_itu_eotf() and av_csp_itu_eotf_inv(), 
> > > to fill
> > > this void. Note that this is not possible in all cases, e.g. 
> > > AVCOL_TRC_LOG which
> > > has no corresponding EOTF definition in any ITU-R standard.
> > >
> > > Note that we cannot implement the proper HLG and SMPTE 428 OOTFs without 
> > > access
> > > to all three color channels, because they are not independent per 
> > > channel. As a
> > > result, we need to define a new type to encapsulate a color triplet. I 
> > > have
> > > tentatively named this AVColor, in the hopes that it will become useful 
> > > in other
> > > contexts as well. The choice of an array rather than explicitly named 
> > > fields is
> > > to greatly simplify per-channel processing, matrix multiplications, and 
> > > the
> > > like.
> >
> > Forgot to update the commit message. I decided to nuke AVColor in favor of
> > passing a double[3] directly. It only makes the code inside the test 
> > framework
> > marginally less pretty, and actually improves the usability of the API in 
> > other
> > contexts IMO.
> >
> > > ---
> > >  doc/APIchanges  |   4 +
> > >  libavutil/csp.c | 205 
> > >  libavutil/csp.h |  33 +++
> > >  libavutil/version.h |   2 +-
> > >  4 files changed, 243 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/doc/APIchanges b/doc/APIchanges
> > > index db72121a61..12a2165837 100644
> > > --- a/doc/APIchanges
> > > +++ b/doc/APIchanges
> > > @@ -2,6 +2,10 @@ The last version increases of all libraries were on 
> > > 2024-03-07
> > >
> > >  API changes, most recent first:
> > >
> > > +2024-11-25 - xx - lavu 59.49.100 - csp.h
> > > +  Add struct AVColor, type av_csp_eotf_function, av_csp_itu_eotf() and
>
> This still talks about AVColor

Already fixed locally, alongside the commit message change.

>
> thx
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Some people wanted to paint the bikeshed green, some blue and some pink.
> People argued and fought, when they finally agreed, only rust was left.
> ___
> 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 v3 1/7] swscale/range_convert: saturate output instead of limiting input

2024-12-01 Thread Michael Niedermayer
On Sun, Dec 01, 2024 at 02:39:19AM +0100, Michael Niedermayer wrote:
> Hi Ramiro
> 
> On Sat, Nov 30, 2024 at 04:23:36PM +0100, Ramiro Polla wrote:
> > For bit depths <= 14, the result is saturated to 15 bits.
> > For bit depths > 14, the result is saturated to 19 bits.
> > 
> > x86_64:
> > chrRangeFromJpeg8_1920_c:5827.4   5804.5  ( 1.00x)
> > chrRangeFromJpeg16_1920_c:   5793.2   5792.8  ( 1.00x)
> > chrRangeToJpeg8_1920_c: 11726.2   9388.6  ( 1.25x)
> > chrRangeToJpeg16_1920_c:10610.8   5796.5  ( 1.83x)
> > lumRangeFromJpeg8_1920_c:4165.7   4147.9  ( 1.00x)
> > lumRangeFromJpeg16_1920_c:   4530.0   4529.0  ( 1.00x)
> > lumRangeToJpeg8_1920_c:  6044.8   5694.1  ( 1.06x)
> > lumRangeToJpeg16_1920_c: 5343.6   5334.2  ( 1.00x)
> > 
> > aarch64 A55:
> > chrRangeFromJpeg8_1920_c:   28839.3  28833.8  ( 1.00x)
> > chrRangeFromJpeg16_1920_c:  28843.8  28842.8  ( 1.00x)
> > chrRangeToJpeg8_1920_c: 44196.1  23070.6  ( 1.92x)
> > chrRangeToJpeg16_1920_c:36526.7  17313.8  ( 2.11x)
> > lumRangeFromJpeg8_1920_c:   15384.3  15388.1  ( 1.00x)
> > lumRangeFromJpeg16_1920_c:  15390.1  15388.0  ( 1.00x)
> > lumRangeToJpeg8_1920_c: 23066.7  19226.2  ( 1.20x)
> > lumRangeToJpeg16_1920_c:19224.6  19225.5  ( 1.00x)
> > 
> > aarch64 A76:
> > chrRangeFromJpeg8_1920_c:6316.2   6317.8  ( 1.00x)
> > chrRangeFromJpeg16_1920_c:   6321.9   6322.9  ( 1.00x)
> > chrRangeToJpeg8_1920_c: 11389.3   9287.1  ( 1.23x)
> > chrRangeToJpeg16_1920_c: 9514.4   6104.9  ( 1.56x)
> > lumRangeFromJpeg8_1920_c:4376.0   4359.1  ( 1.00x)
> > lumRangeFromJpeg16_1920_c:   4437.9   4358.8  ( 1.02x)
> > lumRangeToJpeg8_1920_c:  6667.0   5957.2  ( 1.12x)
> > lumRangeToJpeg16_1920_c: 6062.5   6072.5  ( 1.00x)
> > 
> > NOTE: all simd optimizations for range_convert have been disabled
> >   except for x86, which already had the same behaviour.
> >   they will be re-enabled when they are fixed for each architecture.
> > ---
> >  libswscale/aarch64/swscale.c  |  5 +
> >  libswscale/loongarch/swscale_init_loongarch.c |  5 +
> >  libswscale/riscv/swscale.c|  5 +
> >  libswscale/swscale.c  | 21 ---
> >  libswscale/x86/range_convert.asm  |  3 ---
> >  5 files changed, 29 insertions(+), 10 deletions(-)
> 
> [...]
> 
> > @@ -160,8 +160,10 @@ static void chrRangeToJpeg_c(int16_t *dstU, int16_t 
> > *dstV, int width)
> >  {
> >  int i;
> >  for (i = 0; i < width; i++) {
> > -dstU[i] = (FFMIN(dstU[i], 30775) * 4663 - 9289992) >> 12; // -264
> > -dstV[i] = (FFMIN(dstV[i], 30775) * 4663 - 9289992) >> 12; // -264
> > +int U = (dstU[i] * 4663 - 9289992) >> 12; // -264
> > +int V = (dstV[i] * 4663 - 9289992) >> 12; // -264
> 
> The way this is written it triggers undefined behavior if the input to teh 
> function
> is too large

I misread the code somehow, the FFMIN only protects the 16bit output which the
new code does too, so teh chaneg is ok

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
than the original author, trying to rewrite it will not make it better.


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

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


[FFmpeg-devel] [PATCH v2 1/3] Reapply "tests/fate: disable compression for zlib-based codecs"

2024-12-01 Thread Alexander Strasser via ffmpeg-devel
This reverts commit e206e72b83a0e512e21694a43af4df2b53f6d045.
---
 tests/fate/cover-art.mak  |  6 ++--
 tests/fate/image.mak  |  4 +--
 tests/fate/lavf-image.mak |  5 +--
 tests/fate/lavf-video.mak |  4 +--
 tests/fate/mov.mak|  2 +-
 tests/fate/vcodec.mak |  4 ++-
 tests/ref/fate/copy-apng  |  4 +--
 tests/ref/fate/cover-art-aiff-id3v2-remux |  6 ++--
 tests/ref/fate/cover-art-flac-remux   |  6 ++--
 tests/ref/fate/cover-art-mp3-id3v2-remux  |  6 ++--
 tests/ref/fate/mov-cover-image|  6 ++--
 tests/ref/fate/png-icc|  6 ++--
 tests/ref/fate/png-mdcv   |  4 +--
 tests/ref/lavf/apng   |  4 +--
 tests/ref/lavf/apng.png   |  4 +--
 tests/ref/lavf/gray16be.png   |  4 +--
 tests/ref/lavf/png|  4 +--
 tests/ref/lavf/rgb48be.png|  4 +--
 tests/ref/seek/vsynth_lena-flashsv| 40 +++
 tests/ref/vsynth/vsynth1-flashsv  |  4 +--
 tests/ref/vsynth/vsynth1-mpng |  4 +--
 tests/ref/vsynth/vsynth1-zlib |  4 +--
 tests/ref/vsynth/vsynth2-flashsv  |  4 +--
 tests/ref/vsynth/vsynth2-mpng |  4 +--
 tests/ref/vsynth/vsynth2-zlib |  4 +--
 tests/ref/vsynth/vsynth3-flashsv  |  4 +--
 tests/ref/vsynth/vsynth3-mpng |  4 +--
 tests/ref/vsynth/vsynth3-zlib |  4 +--
 tests/ref/vsynth/vsynth_lena-flashsv  |  4 +--
 tests/ref/vsynth/vsynth_lena-mpng |  4 +--
 tests/ref/vsynth/vsynth_lena-zlib |  4 +--
 31 files changed, 87 insertions(+), 84 deletions(-)

diff --git a/tests/fate/cover-art.mak b/tests/fate/cover-art.mak
index faa2182745..7f8958e33f 100644
--- a/tests/fate/cover-art.mak
+++ b/tests/fate/cover-art.mak
@@ -37,14 +37,14 @@ FATE_COVER_ART_REMUX-$(call ALLYES, FILE_PROTOCOL 
FLAC_DEMUXER MJPEG_DECODER \
 AIFF_DEMUXER BMP_DECODER PNG_DECODER \
 FRAMECRC_MUXER PIPE_PROTOCOL)\
+= fate-cover-art-aiff-id3v2-remux
-fate-cover-art-aiff-id3v2-remux: CMD = transcode flac 
$(TARGET_SAMPLES)/cover_art/cover_art.flac aiff "-map 0 -map 0:v -map 0:v -map 
0:v -c:a pcm_s16be -c:v:0 copy -filter:v:1 scale -c:v:1 png -filter:v:2 scale 
-c:v:2 bmp -c:v:3 copy -write_id3v2 1 -metadata:g unknown_key=unknown_value 
-metadata compilation=foo -metadata:s:v:0 title=first -metadata:s:v:1 
title=second -metadata:s:v:1 comment=Illustration -metadata:s:v:2 title=third 
-metadata:s:v:2 comment=Conductor -metadata:s:v:3 title=fourth -metadata:s:v:3 
comment=Composer" "-map 0 -c copy -t 0.1" "-show_entries 
format_tags:stream_tags:stream_disposition=attached_pic:stream=index,codec_name"
+fate-cover-art-aiff-id3v2-remux: CMD = transcode flac 
$(TARGET_SAMPLES)/cover_art/cover_art.flac aiff "-map 0 -map 0:v -map 0:v -map 
0:v -c:a pcm_s16be -c:v:0 copy -filter:v:1 scale -c:v:1 png 
-compression_level:v:1 0 -filter:v:2 scale -c:v:2 bmp -c:v:3 copy -write_id3v2 
1 -metadata:g unknown_key=unknown_value -metadata compilation=foo 
-metadata:s:v:0 title=first -metadata:s:v:1 title=second -metadata:s:v:1 
comment=Illustration -metadata:s:v:2 title=third -metadata:s:v:2 
comment=Conductor -metadata:s:v:3 title=fourth -metadata:s:v:3 
comment=Composer" "-map 0 -c copy -t 0.1" "-show_entries 
format_tags:stream_tags:stream_disposition=attached_pic:stream=index,codec_name"

 FATE_COVER_ART_REMUX-$(call ALLYES, FILE_PROTOCOL MP3_DEMUXER MJPEG_DECODER \
 SCALE_FILTER PNG_ENCODER BMP_ENCODER\
 MP3_MUXER BMP_DECODER PNG_DECODER   \
 FRAMECRC_MUXER PIPE_PROTOCOL)   \
+= fate-cover-art-mp3-id3v2-remux
-fate-cover-art-mp3-id3v2-remux: CMD = transcode mp3 
$(TARGET_SAMPLES)/exif/embedded_small.mp3 mp3 "-map 0 -map 0:v -map 0:v -c:a 
copy -filter:v:0 scale -filter:v:2 scale -c:v:0 bmp -c:v:1 copy -c:v:2 png 
-metadata:s:v:0 comment=Band/Orchestra" "-map 0 -c copy -t 0.1" "-show_entries 
stream_tags:stream_disposition=attached_pic:stream=index,codec_name"
+fate-cover-art-mp3-id3v2-remux: CMD = transcode mp3 
$(TARGET_SAMPLES)/exif/embedded_small.mp3 mp3 "-map 0 -map 0:v -map 0:v -c:a 
copy -filter:v:0 scale -filter:v:2 scale -c:v:0 bmp -c:v:1 copy -c:v:2 png 
-compression_level:v:2 0 -metadata:s:v:0 comment=Band/Orchestra" "-map 0 -c 
copy -t 0.1" "-show_entries 
stream_tags:stream_disposition=attached_pic:stream=index,codec_name"

 # Also covers muxing and demuxing of nonstandard channel layouts into FLAC
 # as well as the unorthodox multi_dim_quant option of the FLAC encoder.
@@ -55,7 +55,7 @@ FATE_COVER_ART_REMUX-$(call ALLYES, FILE_PROTOCOL MOV_DEMUXER 
OGG_DEMUXER   \
 FLAC_MUXER FL

[FFmpeg-devel] [PATCH v2 2/3] fate: Make it possible to have alternative reference files

2024-12-01 Thread Alexander Strasser via ffmpeg-devel
Sometimes deps (external from FFmpeg) can cause different results
either because of bugs or because of drop in replacements.

This feature of alternate reference files should only be used
where absolutely necessary because other solutions are not
feasible in practice. Maintaining two reference files is a
burden and updating one or the other can easily be forgotten.

Signed-off-by: Alexander Strasser 
---
 tests/fate-run.sh | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index c61a4dc992..5e9acb253d 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -687,6 +687,16 @@ if test -e "$ref" || test $cmp = "oneline" || test $cmp = 
"null" || test $cmp =
 null)   cat   "$outfile">$cmpfile ;;
 esac
 cmperr=$?
+if test $cmperr != 0 && test -e "$ref".alt && !(test $cmp = "oneline" || 
test $cmp = "null" || test $cmp = "grep") ; then
+case $cmp in
+diff)   diff -u -b "$ref".alt "$outfile">$cmpfile ;;
+rawdiff)diff -u"$ref".alt "$outfile">$cmpfile ;;
+oneoff) oneoff "$ref".alt "$outfile">$cmpfile ;;
+stddev) stddev "$ref".alt "$outfile">$cmpfile ;;
+esac
+cmperr=$?
+fi
+
 test $err = 0 && err=$cmperr
 if [ "$report_type" = "ignore" ]; then
 test $err = 0 || echo "IGNORE\t${test}" && err=0 && unset sig
--
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v2 0/3] Make fate tests succeed with zlib-ng

2024-12-01 Thread Alexander Strasser via ffmpeg-devel
This is a fixed up version of the series I sent before.

This worked for me on Ubuntu 20.04 but probably will break
with older zlib versions as Hendrik pointed out in the
previous thread. Either we must update zlib on affected
FATE clients or add more .alt files to them as well.

We could also go the further the "no_file_checksums" as
was demonstrated by James' series.

I still prefer this way because it's simpler and retains
the value of the tests.

Of course I'm not opposing to implement zlib compression
in FFmpeg, but until that happens FATE should also work
on zlib-ng systems IMHO.


Best regards,
  Alexander

Alexander Strasser (3):
  Reapply "tests/fate: disable compression for zlib-based codecs"
  fate: Make it possible to have alternative reference files
  fate: Add .alt files so all tests pass on Ubuntu 20.04

 tests/fate-run.sh | 10 ++
 tests/fate/cover-art.mak  |  6 ++--
 tests/fate/image.mak  |  4 +--
 tests/fate/lavf-image.mak |  5 +--
 tests/fate/lavf-video.mak |  4 +--
 tests/fate/mov.mak|  2 +-
 tests/fate/vcodec.mak |  4 ++-
 tests/ref/fate/copy-apng  |  4 +--
 tests/ref/fate/cover-art-aiff-id3v2-remux |  6 ++--
 tests/ref/fate/cover-art-flac-remux   |  6 ++--
 tests/ref/fate/cover-art-mp3-id3v2-remux  |  6 ++--
 tests/ref/fate/mov-cover-image|  6 ++--
 tests/ref/fate/mov-cover-image.alt| 42 +++
 tests/ref/fate/png-icc|  6 ++--
 tests/ref/fate/png-mdcv   |  4 +--
 tests/ref/fate/png-mdcv.alt   | 22 
 tests/ref/lavf/apng   |  4 +--
 tests/ref/lavf/apng.png   |  4 +--
 tests/ref/lavf/gray16be.png   |  4 +--
 tests/ref/lavf/png|  4 +--
 tests/ref/lavf/rgb48be.png|  4 +--
 tests/ref/seek/vsynth_lena-flashsv| 40 ++---
 tests/ref/vsynth/vsynth1-flashsv  |  4 +--
 tests/ref/vsynth/vsynth1-mpng |  4 +--
 tests/ref/vsynth/vsynth1-zlib |  4 +--
 tests/ref/vsynth/vsynth2-flashsv  |  4 +--
 tests/ref/vsynth/vsynth2-mpng |  4 +--
 tests/ref/vsynth/vsynth2-zlib |  4 +--
 tests/ref/vsynth/vsynth3-flashsv  |  4 +--
 tests/ref/vsynth/vsynth3-mpng |  4 +--
 tests/ref/vsynth/vsynth3-zlib |  4 +--
 tests/ref/vsynth/vsynth_lena-flashsv  |  4 +--
 tests/ref/vsynth/vsynth_lena-mpng |  4 +--
 tests/ref/vsynth/vsynth_lena-zlib |  4 +--
 34 files changed, 161 insertions(+), 84 deletions(-)
 create mode 100644 tests/ref/fate/mov-cover-image.alt
 create mode 100644 tests/ref/fate/png-mdcv.alt

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

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


[FFmpeg-devel] [PATCH v2 3/3] fate: Add .alt files so all tests pass on Ubuntu 20.04

2024-12-01 Thread Alexander Strasser via ffmpeg-devel
In commit bce5855afb25d318e090c2e6c16117f065458356 we avoided the
problem by using compression level 0. That fixed the problem, but
introduced a problem with older versioins of original zlib. This
caused differences 2 or more fate tests depending on the zlib version
used. See e.g. zlib commit 8ba393e70d984d902b15b9e6876f4d0d38ae4be8 .

After re-applying bce5855afb25d318e090c2e6c16117f065458356 this
patch fixes the 2 mentioned cases for older zlib versions by
allowing an alternative reference file. The files accommodate
for the bug in the older version.

Signed-off-by: Alexander Strasser 
---
 tests/ref/fate/mov-cover-image.alt | 42 ++
 tests/ref/fate/png-mdcv.alt| 22 
 2 files changed, 64 insertions(+)
 create mode 100644 tests/ref/fate/mov-cover-image.alt
 create mode 100644 tests/ref/fate/png-mdcv.alt

diff --git a/tests/ref/fate/mov-cover-image.alt 
b/tests/ref/fate/mov-cover-image.alt
new file mode 100644
index 00..0c99cf7ae7
--- /dev/null
+++ b/tests/ref/fate/mov-cover-image.alt
@@ -0,0 +1,42 @@
+ad553810e0ce362697a2b21544daebde *tests/data/fate/mov-cover-image.mp4
+2063262 tests/data/fate/mov-cover-image.mp4
+#extradata 0:2, 0x00340022
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: aac
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+#tb 1: 1/9
+#media_type 1: video
+#codec_id 1: mjpeg
+#dimensions 1: 600x600
+#sar 1: 96/96
+#tb 2: 1/9
+#media_type 2: video
+#codec_id 2: png
+#dimensions 2: 600x600
+#sar 2: 1/1
+0,  -2112,  -2112, 1024,6, 0x027e00e8, F=0x5, S=1,   10
+0,  -1088,  -1088, 1024,6, 0x027e00e8, F=0x5
+0,-64,-64, 1024,6, 0x027e00e8
+1,  0,  0,0,25441, 0xe82503b0
+2,  0,  0,0,  1084000, 0x413c7ee9
+0,960,960, 1024,6, 0x027e00e8
+0,   1984,   1984, 1024,6, 0x027e00e8
+0,   3008,   3008, 1024,6, 0x027e00e8
+0,   4032,   4032, 1024,6, 0x027e00e8
+[STREAM]
+index=0
+codec_name=aac
+DISPOSITION:attached_pic=0
+[/STREAM]
+[STREAM]
+index=1
+codec_name=mjpeg
+DISPOSITION:attached_pic=1
+[/STREAM]
+[STREAM]
+index=2
+codec_name=png
+DISPOSITION:attached_pic=1
+[/STREAM]
diff --git a/tests/ref/fate/png-mdcv.alt b/tests/ref/fate/png-mdcv.alt
new file mode 100644
index 00..1339fe3a46
--- /dev/null
+++ b/tests/ref/fate/png-mdcv.alt
@@ -0,0 +1,22 @@
+b674209fd9cd8eff945a6bc1a4b306d3 *tests/data/fate/png-mdcv.image2pipe
+2774240 tests/data/fate/png-mdcv.image2pipe
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1280x720
+#sar 0: 0/1
+0,  0,  0,1,  2764800, 0x2bfc7b42
+frames.frame.0.side_data_list.side_data.0.side_data_type="Content light level 
metadata"
+frames.frame.0.side_data_list.side_data.0.max_content=1000
+frames.frame.0.side_data_list.side_data.0.max_average=200
+frames.frame.0.side_data_list.side_data.1.side_data_type="Mastering display 
metadata"
+frames.frame.0.side_data_list.side_data.1.red_x="13250/5"
+frames.frame.0.side_data_list.side_data.1.red_y="7500/5"
+frames.frame.0.side_data_list.side_data.1.green_x="34000/5"
+frames.frame.0.side_data_list.side_data.1.green_y="16000/5"
+frames.frame.0.side_data_list.side_data.1.blue_x="2/5"
+frames.frame.0.side_data_list.side_data.1.blue_y="0/5"
+frames.frame.0.side_data_list.side_data.1.white_point_x="15635/5"
+frames.frame.0.side_data_list.side_data.1.white_point_y="16450/5"
+frames.frame.0.side_data_list.side_data.1.min_luminance="50/1"
+frames.frame.0.side_data_list.side_data.1.max_luminance="1000/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] [RFC] libavcodec/mpeg12dec.c: CC data from skipped frames

2024-12-01 Thread Scott Theisen

Hello all,

In mpeg_decode_a53_cc() only the A/53 part 4 CC data ("GA94") is saved 
between frames.  The other formats incorrectly create a larger buffer 
than they use since 
https://github.com/FFmpeg/FFmpeg/commit/a705bcd763e344fac191e157ffeddc285388b7fa 
because they do not append to the previous data.


A/53 and SCTE-20 specify a maximum of one CC user data per picture 
header.  (I assume the same is true for DVD and DVB 0502.)


The a53_buf_ref is added to the frame in mpeg_field_start() which will 
only be called in decode_chunks() if not all of the picture data slices 
are skipped.


I have observed the A/53 code create a larger buffer at the start of a 
file or after skipping; presumably the I-frame following a GOP header is 
the first frame, then one or more B-frames have all of their slices 
skipped.  Otherwise, old_size is always 0.


Is a frame created when all the slices are skipped?  (If so, the CC data 
should be added to that frame.)


Should the CC data be preserved between the frames for all formats?

Thanks,

Scott Theisen
___
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/6] tools/target_dec_fuzzer: Adjust threshold for MSCC

2024-12-01 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
377574369/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSCC_fuzzer-4924697608781824

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index df2c3fc4ed2..4b9d4b6195c 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -265,6 +265,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_MOTIONPIXELS:maxpixels  /= 256;   break;
 case AV_CODEC_ID_MP4ALS:  maxsamples /= 65536; break;
 case AV_CODEC_ID_MSA1:maxpixels  /= 16384; break;
+case AV_CODEC_ID_MSCC:maxpixels  /= 4096;  break;
 case AV_CODEC_ID_MSRLE:   maxpixels  /= 16;break;
 case AV_CODEC_ID_MSS2:maxpixels  /= 16384; break;
 case AV_CODEC_ID_MSZH:maxpixels  /= 128;   break;
-- 
2.47.0

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

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


[FFmpeg-devel] [PATCH 3/6] avcodec/rv60dec: Check qp for intra

2024-12-01 Thread Michael Niedermayer
The rv60_qp_to_idx table only supports qp up to 31 on intra

Fixes: global-buffer-overflow
Fixes: 
377543818/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_fuzzer-5160167345291264

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/rv60dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/rv60dec.c b/libavcodec/rv60dec.c
index 64fa72d8f20..449650223d8 100644
--- a/libavcodec/rv60dec.c
+++ b/libavcodec/rv60dec.c
@@ -1779,6 +1779,8 @@ static int decode_cu_r(RV60Context * s, AVFrame * frame, 
ThreadContext * thread,
 ttype = cu.pu_type == PU_FULL ? TRANSFORM_8X8 : TRANSFORM_4X4;
 
 is_intra = cu.cu_type == CU_INTRA;
+if (is_intra && qp >= 32)
+return AVERROR_INVALIDDATA;
 cu_pos = ((xpos & 63) >> 3) + ((ypos & 63) >> 3) * 8;
 
 switch (ttype) {
-- 
2.47.0

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

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


[FFmpeg-devel] [PATCH 2/6] avformat/iamf_parse: Check output_channel_count

2024-12-01 Thread Michael Niedermayer
Fixes: -nan is outside the range of representable values of type 'int'
Fixes: 
377072730/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6545416570601472

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/iamf_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 1e1de167e6d..daed21e6904 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -417,7 +417,7 @@ static int ambisonics_config(void *s, AVIOContext *pb,
 
 output_channel_count = avio_r8(pb);  // C
 substream_count = avio_r8(pb);  // N
-if (audio_element->nb_substreams != substream_count)
+if (audio_element->nb_substreams != substream_count || 
output_channel_count == 0)
 return AVERROR_INVALIDDATA;
 
 order = floor(sqrt(output_channel_count - 1));
-- 
2.47.0

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

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


[FFmpeg-devel] [PATCH 1/6] tools/target_dec_fuzzer: Adjust threshold for VP6

2024-12-01 Thread Michael Niedermayer
Fixes: Timeout (would need 62sec)
Fixes: 
376731123/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP6_fuzzer-5926437896388608

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 118a0c7982e..df2c3fc4ed2 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -315,6 +315,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_VP3: maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP4: maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP5: maxpixels  /= 256;   break;
+case AV_CODEC_ID_VP6: maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP6F:maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP6A:maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP7: maxpixels  /= 256;   break;
-- 
2.47.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 5/6] avcodec/aacsbr_template: Clear n_q on error

2024-12-01 Thread Michael Niedermayer
Fixes: index 5 out of bounds for type 'uint8_t [5]'
Fixes: 
377748135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5167109774049280

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/aacsbr_template.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 436b549fe70..9fae44d9a5c 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -599,6 +599,7 @@ static int sbr_make_f_derived(AACDecContext *ac, 
SpectralBandReplication *sbr)
 
 if (sbr->n_q > 5) {
 av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: 
%d\n", sbr->n_q);
+sbr->n_q = 1;
 return -1;
 }
 
-- 
2.47.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 6/6] avcodec/vc1dec: Clear block_index in vc1_decode_reset()

2024-12-01 Thread Michael Niedermayer
Fixes: 
377965565/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-4504434689769472
Fixes: out of array access

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 5f1a5bd437c..2c314e7b55b 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -788,6 +788,7 @@ static av_cold void vc1_decode_reset(AVCodecContext *avctx)
 for (i = 0; i < 4; i++)
 av_freep(&v->sr_rows[i >> 1][i & 1]);
 ff_mpv_common_end(&v->s);
+memset(v->s.block_index, 0, sizeof(v->s.block_index));
 av_freep(&v->mv_type_mb_plane);
 av_freep(&v->direct_mb_plane);
 av_freep(&v->forward_mb_plane);
-- 
2.47.0

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

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


Re: [FFmpeg-devel] [PATCH 7/7] avcodec/hevc/hevcdec: initialize qp_y_tab

2024-12-01 Thread Michael Niedermayer
On Mon, Sep 23, 2024 at 11:32:49PM +0200, Michael Niedermayer wrote:
> This does not replicate on my setup, thus this is a blind fix based on 
> ossfuzz trace
> 
> Fixes: use of uninitialized value
> Fixes: 
> 71747/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5427736120721408
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hevc/hevcdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

If the United States is serious about tackling the national security threats 
related to an insecure 5G network, it needs to rethink the extent to which it
values corporate profits and government espionage over security.-Bruce Schneier


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 2/2] MAINTAINERS: mark vf_volumedetect as unmaintained

2024-12-01 Thread Michael Niedermayer
Hi Yiğithan

On Wed, Sep 04, 2024 at 09:26:19PM +0200, Michael Niedermayer wrote:
> Hi Yiğithan Yiğit
> 
> On Mon, Sep 02, 2024 at 11:52:52PM +0200, Yigithan Yigit wrote:
> > Hi Michael,
> > 
> > I am new to community, and I am not sure about qualifications of maintainer 
> > but If you prefer I can be the maintainer. 
> 
> some libavfilter filters may be difficult to maintain currently
> (thats because of pauls fork and paul working on libavfilter)
> 
> So if you want to try, you can, but there likely will be
> problems that would not occur in other parts of teh codebase.
> 
> if you want to try, some suggestions on what you could do
> * setup a clone of ffmpeg (on github or elsewhere) unless you already have one
> * set a branch up there with your changes, make sure requested modifications 
> have been done
> * once you are happy with the code and everyone else had a chance to
>   review it and noone had remaining complaints and the latest patches are on 
> ffmpeg-devel
>   with noone complaining,
>   -> simply ask me to apply the patches, ill then wait another 24h and if 
> noone complains
>   apply them
> * if this works for a few iterations then you should send a patch that adds 
> you to
>   MAINTAINERS

A few months passed, are you interrested in trying to maintain this ?
or should i mark it as unmaintained ?

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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

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


[FFmpeg-devel] [PATCH v2] avcodec/ffv1enc: Add enum for qtable

2024-12-01 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1enc.c| 8 +++-
 libavcodec/ffv1enc.h| 6 ++
 libavcodec/ffv1enc_vulkan.c | 8 +++-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index c96c71b1096..696823b7967 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1346,7 +1346,13 @@ static const AVOption options[] = {
 { "context", "Context model", OFFSET(context_model), AV_OPT_TYPE_INT,
 { .i64 = 0 }, 0, 1, VE },
 { "qtable", "Quantization table", OFFSET(qtable), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 2, VE },
+{ .i64 = -1 }, -1, 2, VE , .unit = "qtable"},
+{ "default", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_DEFAULT }, INT_MIN, INT_MAX, VE, .unit = "qtable" 
},
+{ "8bit", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
+{ "greater8bit", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_GT8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
 
 { NULL }
 };
diff --git a/libavcodec/ffv1enc.h b/libavcodec/ffv1enc.h
index e22693f2a89..2ecc2d16ec9 100644
--- a/libavcodec/ffv1enc.h
+++ b/libavcodec/ffv1enc.h
@@ -25,6 +25,12 @@
 
 #include "avcodec.h"
 
+enum {
+QTABLE_DEFAULT = -1,
+QTABLE_8BIT,
+QTABLE_GT8BIT,
+};
+
 av_cold int ff_ffv1_encode_init(AVCodecContext *avctx);
 av_cold int ff_ffv1_write_extradata(AVCodecContext *avctx);
 av_cold int ff_ffv1_encode_setup_plane_info(AVCodecContext *avctx,
diff --git a/libavcodec/ffv1enc_vulkan.c b/libavcodec/ffv1enc_vulkan.c
index cdb0096969e..41d396fb32c 100644
--- a/libavcodec/ffv1enc_vulkan.c
+++ b/libavcodec/ffv1enc_vulkan.c
@@ -1795,7 +1795,13 @@ static const AVOption vulkan_encode_ffv1_options[] = {
 { "range_tab", "Range with custom table", 0, AV_OPT_TYPE_CONST,
 { .i64 = AC_RANGE_CUSTOM_TAB }, INT_MIN, INT_MAX, VE, .unit = 
"coder" },
 { "qtable", "Quantization table", OFFSET(ctx.qtable), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 2, VE },
+{ .i64 = -1 }, -1, 2, VE , .unit = "qtable"},
+{ "default", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_DEFAULT }, INT_MIN, INT_MAX, VE, .unit = "qtable" 
},
+{ "8bit", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
+{ "greater8bit", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_GT8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
 
 { "slices_h", "Number of horizontal slices", OFFSET(num_h_slices), 
AV_OPT_TYPE_INT,
 { .i64 = -1 }, -1, 1024, VE },
-- 
2.47.0

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

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/ffv1enc: Add enum for qtable

2024-12-01 Thread Michael Niedermayer
Hi

On Sat, Nov 30, 2024 at 04:22:13PM +0900, Lynne via ffmpeg-devel wrote:
> On 30/11/2024 04:33, Michael Niedermayer wrote:
> 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >   libavcodec/ffv1enc.c | 14 +-
> >   1 file changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
> > index c96c71b1096..742db549e5f 100644
> > --- a/libavcodec/ffv1enc.c
> > +++ b/libavcodec/ffv1enc.c
> > @@ -41,6 +41,12 @@
> >   #include "ffv1.h"
> >   #include "ffv1enc.h"
> > +enum {
> > +QTABLE_DEFAULT = -1,
> > +QTABLE_8BIT,
> > +QTABLE_GT8BIT,
> > +};
> > +
> >   static const int8_t quant5_10bit[256] = {
> >0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,
> >1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
> > @@ -1346,7 +1352,13 @@ static const AVOption options[] = {
> >   { "context", "Context model", OFFSET(context_model), AV_OPT_TYPE_INT,
> >   { .i64 = 0 }, 0, 1, VE },
> >   { "qtable", "Quantization table", OFFSET(qtable), AV_OPT_TYPE_INT,
> > -{ .i64 = -1 }, -1, 2, VE },
> > +{ .i64 = -1 }, -1, 2, VE , .unit = "qtable"},
> > +{ "default", NULL, 0, AV_OPT_TYPE_CONST,
> > +{ .i64 = QTABLE_DEFAULT }, INT_MIN, INT_MAX, VE, .unit = 
> > "qtable" },
> > +{ "8bit", NULL, 0, AV_OPT_TYPE_CONST,
> > +{ .i64 = QTABLE_8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" 
> > },
> > +{ "greater8bit", NULL, 0, AV_OPT_TYPE_CONST,
> > +{ .i64 = QTABLE_GT8BIT }, INT_MIN, INT_MAX, VE, .unit = 
> > "qtable" },
> >   { NULL }
> >   };
> 
> 
> Could you apply this to ffv1enc_vulkan.c as well? It uses the same
> quantization table

ok, but i dont have a working vulkan setup so i cannot really test this

thx

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

The worst form of inequality is to try to make unequal things equal.
-- 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] fate: Add a target for listing failed tests

2024-12-01 Thread Alexander Strasser via ffmpeg-devel
Hi Martin!

On 2024-11-07 11:36 +0200, Martin Storsjö wrote:
> If running tests with "make -j fate", the execution will stop
> after the first failing test. To get an overview of the whole
> test suite, one rather would run "make -k -j fate", which then
> again buries the results about what tests actually failed further
> up in the console log.
>
> Add a target so one can run "make fate-list-failing", to see a list
> of all tests that failed the last time they were executed.
>
> Also add a companion target "fate-clear-results" which removes all
> the old test results. (When executing a subset of tests, the result
> files of all tests that aren't executed stay untouched. This also
> allows getting rid of results for tests that no longer are present
> in the testsuite.)

Looks good and useful to me.

Just a few ideas follow:

> ---
> So far, I've always just manually run
> "cat tests/data/fate/*.rep | cut -f 1-2 -d : | grep -v :0", but
> perhaps we should at least wrap it up in something more convenient
> for the other developers.
> ---
>  doc/build_system.txt | 6 ++
>  doc/fate.texi| 7 +++
>  tests/Makefile   | 6 ++
>  3 files changed, 19 insertions(+)
>
> diff --git a/doc/build_system.txt b/doc/build_system.txt
> index 0b1b0c2054..91c7a5e9af 100644
> --- a/doc/build_system.txt
> +++ b/doc/build_system.txt
> @@ -30,6 +30,12 @@ fate
>  fate-list
>  List all fate/regression test targets.
>
> +fate-list-failing
> +List the fate tests that failed the last time they were executed.
> +
> +fate-clear-results
> +Remove the test results from previous test executions.
> +

Would it be better to use the same description as int fate.texi ?


>  install
>  Install headers, libraries and programs.
>
> diff --git a/doc/fate.texi b/doc/fate.texi
> index 17644ce65a..bf01816af8 100644
> --- a/doc/fate.texi
> +++ b/doc/fate.texi
> @@ -208,6 +208,13 @@ Download/synchronize sample files to the configured 
> samples directory.
>  @item fate-list
>  Will list all fate/regression test targets.
>
> +@item fate-list-failing
> +List the fate tests that failed the last time they were executed.
> +
> +@item fate-clear-results
> +Remove the test results from previous test executions (getting rid of
> +potentially stale results from fate-list-failing).
> +
>  @item fate
>  Run the FATE test suite (requires the fate-suite dataset).
>  @end table
> diff --git a/tests/Makefile b/tests/Makefile
> index 9b70145015..adb0799328 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -313,6 +313,12 @@ $(FATE): $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) | 
> $(FATE_OUTDIRS)
>  fate-list:
>   @printf '%s\n' $(sort $(FATE))
>
> +fate-list-failing:
> + @cat tests/data/fate/*.rep | cut -f 1-2 -d : | grep -v :0 | sed 
> 's/:.*//;s/^/fate-/'
> +
> +fate-clear-results:
> + @rm -f tests/data/fate/*.rep
> +
>  coverage.info: TAG = LCOV
>  coverage.info:
>   $(M)lcov -q -d $(CURDIR) -b $(patsubst src%,./,$(SRC_LINK)) --capture | 
> \
> --

Maybe the attached patch would make sense on top of your changes?


Best regards,
  Alexander
From 130ca8d85dcb1fecace596e1f23e0414d56348ef Mon Sep 17 00:00:00 2001
From: Alexander Strasser 
Date: Sun, 1 Dec 2024 15:06:53 +0100
Subject: [PATCH] fate: Simplify implementation for target fate-list-failing

Make it a little easier to read and use one awk invocation as opposed
to a combination of cat, cut, grep, and sed.

Signed-off-by: Alexander Strasser 
---
 tests/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/Makefile b/tests/Makefile
index adb0799328..2c4ad7c18f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -314,7 +314,7 @@ fate-list:
@printf '%s\n' $(sort $(FATE))

 fate-list-failing:
-   @cat tests/data/fate/*.rep | cut -f 1-2 -d : | grep -v :0 | sed 
's/:.*//;s/^/fate-/'
+   @awk -F: '$$2 != 0 { print "fate-" $$1 }' tests/data/fate/*.rep

 fate-clear-results:
@rm -f tests/data/fate/*.rep
--

___
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 2/6] avutil/csp: eliminate redundant branch

2024-12-01 Thread Ronald S. Bultje
Hi,

On Sun, Dec 1, 2024 at 9:24 AM Leo Izen  wrote:

>
>
> On 11/30/24 9:23 AM, Niklas Haas wrote:
> > From: Niklas Haas 
> >
> > ---
> >   libavutil/csp.c | 6 +-
> >   1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/libavutil/csp.c b/libavutil/csp.c
> > index 7ef822c60b..3dd7bc2562 100644
> > --- a/libavutil/csp.c
> > +++ b/libavutil/csp.c
> > @@ -290,11 +290,7 @@ static const av_csp_trc_function
> trc_funcs[AVCOL_TRC_NB] = {
> >
> >   av_csp_trc_function av_csp_trc_func_from_id(enum
> AVColorTransferCharacteristic trc)
> >   {
> > -av_csp_trc_function func;
> >   if (trc >= AVCOL_TRC_NB)
> >   return NULL;
> > -func = trc_funcs[trc];
> > -if (!func)
> > -return NULL;
> > -return func;
> > +return trc_funcs[trc];
> >   }
>
> This is future-proof in case there's gaps in H.273, which there are in
> some cases.
>
> Also it prevents a segfault crash if someone passes an enum that hasn't
> been added to FFmpeg yet, but has been added to H.273.
>

This was also brought up in the previous version in
https://ffmpeg.org//pipermail/ffmpeg-devel/2024-November/336626.html

Ronald
___
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] avutil/mem_internal: Don't use alignas for MSVC

2024-12-01 Thread James Almer

On 11/30/2024 6:13 AM, Zhao Zhili wrote:

From: Zhao Zhili 

MSVC messed up standard C features, again.
---
  libavutil/mem_internal.h | 4 
  1 file changed, 4 insertions(+)

diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h
index 249ec3a642..2eb4aef5b0 100644
--- a/libavutil/mem_internal.h
+++ b/libavutil/mem_internal.h
@@ -78,6 +78,10 @@
  #define DECLARE_ALIGNED_T(n,t,v)alignas(FFMIN(n, 16)) t v
  #define DECLARE_ASM_ALIGNED(n,t,v)  alignas(FFMIN(n, 16)) t av_used v
  #define DECLARE_ASM_CONST(n,t,v)alignas(FFMIN(n, 16)) static const t 
av_used v
+#elif defined(_MSC_VER)
+#define DECLARE_ALIGNED_T(n,t,v)__declspec(align(n)) t v
+#define DECLARE_ASM_ALIGNED(n,t,v)  __declspec(align(n)) t v
+#define DECLARE_ASM_CONST(n,t,v)__declspec(align(n)) static const t v
  #else
  #define DECLARE_ALIGNED_T(n,t,v)alignas(n) t v
  #define DECLARE_ASM_ALIGNED(n,t,v)  alignas(n) t av_used v


Ok.



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 v2 2/6] avutil/csp: eliminate redundant branch

2024-12-01 Thread Leo Izen




On 11/30/24 9:23 AM, Niklas Haas wrote:

From: Niklas Haas 

---
  libavutil/csp.c | 6 +-
  1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavutil/csp.c b/libavutil/csp.c
index 7ef822c60b..3dd7bc2562 100644
--- a/libavutil/csp.c
+++ b/libavutil/csp.c
@@ -290,11 +290,7 @@ static const av_csp_trc_function trc_funcs[AVCOL_TRC_NB] = 
{
  
  av_csp_trc_function av_csp_trc_func_from_id(enum AVColorTransferCharacteristic trc)

  {
-av_csp_trc_function func;
  if (trc >= AVCOL_TRC_NB)
  return NULL;
-func = trc_funcs[trc];
-if (!func)
-return NULL;
-return func;
+return trc_funcs[trc];
  }


This is future-proof in case there's gaps in H.273, which there are in 
some cases.


Also it prevents a segfault crash if someone passes an enum that hasn't 
been added to FFmpeg yet, but has been added to H.273.


- Leo Izen

___
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/cbs_h266: Fix typo

2024-12-01 Thread Alexander Strasser via ffmpeg-devel
Introduced in commit 98698ed3c24bfd0b1e6e6db943b5f25f6046cee7

Fixes: CID1635788 CID1635789
Signed-off-by: Alexander Strasser 
---

Just picked this up because of Coverity.
Not sure how to verify/test this change, but it seems plausible.

  Alexander

 libavcodec/cbs_h266_syntax_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h266_syntax_template.c 
b/libavcodec/cbs_h266_syntax_template.c
index 43def9220f..029fbd5e4f 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -1151,7 +1151,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, 
RWContext *rw,
 else
 infer(sps_subpic_width_minus1[0], max_width_minus1);
 if (current->sps_pic_height_max_in_luma_samples > ctb_size_y)
-us(hlen, sps_subpic_height_minus1[0], 0, max_width_minus1, 1, 
0);
+us(hlen, sps_subpic_height_minus1[0], 0, max_height_minus1, 1, 
0);
 else
 infer(sps_subpic_height_minus1[0], max_height_minus1);
 if (!current->sps_independent_subpics_flag) {
--
___
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 06/11] fftools/ffprobe: remove film_grain and closed_captions properties

2024-12-01 Thread Marth64
> this needs update to fate tests
I am reworking this set and will include the fate test fix
in the same commit for the next version.

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


Re: [FFmpeg-devel] [PATCH v2] avformat/mov: use dvdclut for YUV to RGB conversion of DVD subtitle palettes

2024-12-01 Thread Marth64
Any opinions on v3?
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".


Re: [FFmpeg-devel] [PATCH v2 00/11] fix broken CC detection and ffprobe fields (cover letter)

2024-12-01 Thread James Almer

On 11/28/2024 5:02 PM, Marton Balint wrote:



On Wed, 27 Nov 2024, Marth64 wrote:

As it stands today, ffprobe has two stream-level fields 
(closed_captions and film_grain)
that do not work. Their value is always 0 because ffprobe cannot 
access the internal
codec properties in the stream context when it is setting up its 
internal streams.


Additionally, avformat/dump used to successfully print about the 
presence of
Closed Captions (EIA-608/CEA-708) and the presence of film grain. This 
does
not work either anymore, because avformat_find_stream_info() does not 
copy

them in the skeleton context it uses after calling codec_close().

To clarify: the aforementioned features/code are broken.

So, to the user, Closed Caption detection as a feature is broken, and 
ffprobe

and the dump is essentially having two fields that do not work.

This patchset aims to fix the issue by:
(1) Adding a video stream disposition, AV_DISPOSITION_CAPTIONS_EIA608 
that

   can be set in avformat_find_stream_info(), and using it to express
   the presence of Closed Captions (EIA-608/CEA-708)


Manually mapping between different codec properties and stream 
dispositions seems ugly, and I am not sure if we should even use the 
disposition field for something like this.


I suggest you try adding the "properties" attribute to 
AVCodecParameters, because as far as I see it is very similar to profile 
or level. Can you see if that works? If it does, we might even promote 
the FF_CODEC_PROPERTY flags to AV_CODEC_PROPERTY so they will become 
properly public.


I don't agree it should be in codecpar. It's rarely (if ever) filled 
during header parsing (codec or container), and instead set when parsing 
a frame that contains the relevant characteristic that's exported here 
as a "property", like captions or film grain parameters. Therefore it's 
not a field used for initialization.




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] avcodec/cbs_h266: Fix typo

2024-12-01 Thread Frank Plowman
On 01/12/2024 19:44, Alexander Strasser via ffmpeg-devel wrote:
> Introduced in commit 98698ed3c24bfd0b1e6e6db943b5f25f6046cee7
> 
> Fixes: CID1635788 CID1635789
> Signed-off-by: Alexander Strasser 
> ---
> 
> Just picked this up because of Coverity.
> Not sure how to verify/test this change, but it seems plausible.
> 
>   Alexander
> 
>  libavcodec/cbs_h266_syntax_template.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_h266_syntax_template.c 
> b/libavcodec/cbs_h266_syntax_template.c
> index 43def9220f..029fbd5e4f 100644
> --- a/libavcodec/cbs_h266_syntax_template.c
> +++ b/libavcodec/cbs_h266_syntax_template.c
> @@ -1151,7 +1151,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, 
> RWContext *rw,
>  else
>  infer(sps_subpic_width_minus1[0], max_width_minus1);
>  if (current->sps_pic_height_max_in_luma_samples > ctb_size_y)
> -us(hlen, sps_subpic_height_minus1[0], 0, max_width_minus1, 
> 1, 0);
> +us(hlen, sps_subpic_height_minus1[0], 0, max_height_minus1, 
> 1, 0);
>  else
>  infer(sps_subpic_height_minus1[0], max_height_minus1);
>  if (!current->sps_independent_subpics_flag) {
> --
> ___
> 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".

Looks good to me.

Thanks,
Frank

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

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


Re: [FFmpeg-devel] [PATCH 08/10] swscale/swscale_unscaled: Fix odd height with nv24_to_yuv420p_chroma()

2024-12-01 Thread Michael Niedermayer
On Sat, Sep 28, 2024 at 02:01:33AM +0200, Michael Niedermayer wrote:
> On Wed, Sep 25, 2024 at 03:16:30PM +0200, Ramiro Polla wrote:
> > On Tue, Sep 24, 2024 at 3:35 PM Michael Niedermayer
> >  wrote:
> > > On Mon, Sep 23, 2024 at 12:42:22AM +0200, Ramiro Polla wrote:
> > > > Hi,
> > > >
> > > > On Mon, Sep 23, 2024 at 12:04 AM Michael Niedermayer
> > > >  wrote:
> > > > >
> > > > > Fixes: out of array read
> > > > > Fixes: 71726/clusterfuzz-testcase-ffmpeg_SWS_fuzzer-5876893532880896
> > > > >
> > > > > Found-by: continuous fuzzing process 
> > > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > > Signed-off-by: Michael Niedermayer 
> > > > > ---
> > > > >  libswscale/swscale_unscaled.c | 2 ++
> > > > >  1 file changed, 2 insertions(+)
> > > > >
> > > > > diff --git a/libswscale/swscale_unscaled.c 
> > > > > b/libswscale/swscale_unscaled.c
> > > > > index dc1d5f35932..d403c953cc7 100644
> > > > > --- a/libswscale/swscale_unscaled.c
> > > > > +++ b/libswscale/swscale_unscaled.c
> > > > > @@ -230,6 +230,8 @@ static void nv24_to_yuv420p_chroma(uint8_t *dst1, 
> > > > > int dstStride1,
> > > > >  const uint8_t *src2 = src + srcStride;
> > > > >  // average 4 pixels into 1 (interleaved U and V)
> > > > >  for (int y = 0; y < h; y += 2) {
> > > > > +if (y + 1 == h)
> > > > > +src2 = src1;
> > > > >  for (int x = 0; x < w; x++) {
> > > > >  dst1[x] = (src1[4 * x + 0] + src1[4 * x + 2] +
> > > > > src2[4 * x + 0] + src2[4 * x + 2]) >> 2;
> > > >
> > > > I would prefer to keep nv24_to_yuv420p_chroma() expecting height to be
> > > > a multiple of 2. We could add && !(c->srcH & 1) before selecting
> > > > nv24ToYuv420Wrapper.
> > >
> > > what advantage does this have ?
> > 
> > This would also have the benefit of keeping the function clearer, and
> > we wouldn't have to add special cases that might or might not be ok.
> 
> > It would also make it easier to write simd code, since we wouldn't
> > have to worry about these special cases.
> 
> The SIMD code could support a subset of the c code
> 
> 
> > 
> > It is also easy to forget these corner cases, which leads to some
> > converters behaving differently in corner cases. For example, the
> > current yuyv422 to yuv420p scaler just doesn't output the last line if
> > it has an odd height. What is the correct fix? Should we convert the
> > last line differently like in this case? Should we duplicate the
> > second-to-last line? Should we just add a couple lines of code to
> > tweak the converter? Should we instead call this function with an even
> > height, and call another function for the last line?
> 
> >
> > IMO a converter to yuv420p with odd width or height shouldn't be an
> > unscaled converter, since we're effectively scaling the chroma planes
> > (and not just by a factor of two). In this case, the regular scaler
> > would be used.
> 
> Iam not sure i understand correctly, but
> assuming a 99 lines 4:4:4 scaled to 99 lines 4:2:0
> the chroma here is not a simple "99 to 50 lines rescaling"
> the chroma samples must stay co-located in relation to the luma samples
> that can only happen with s 2:1 not a 99:50 rescaling
> but maybe i misunderstood what you meant

The fuzzer found another sample for this issue:
377735917/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6686071112400896

I still think my patch is fine, if someone else wants to disable the code
from being used for odd sizes thats not breaking the code, it just would
then not be used in some cases it could be used for.

If you prefer to only disable this for odd cases, please disable it.
I just want the bug fixed and not left open

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


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] avformat/iamf_parse: ambisonics mode > 1 will crash

2024-12-01 Thread Michael Niedermayer
On Sat, Nov 30, 2024 at 03:24:31PM -0300, James Almer wrote:
> On 11/29/2024 2:17 PM, Michael Niedermayer wrote:
> > ambisonics mode > 1 does not initialize any layer but layer 0
> > is unconditionally dereferenced
> > 
> > Fixes: poc-2024-11
> > Fixes: null pointer dereference
> > Found-by: 苏童 <220235...@seu.edu.cn>
> > Signed-off-by: Michael Niedermayer 
> > ---
> >   libavformat/iamf_parse.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
> > index 4aed894796f..1e1de167e6d 100644
> > --- a/libavformat/iamf_parse.c
> > +++ b/libavformat/iamf_parse.c
> > @@ -413,7 +413,7 @@ static int ambisonics_config(void *s, AVIOContext *pb,
> >   ambisonics_mode = ffio_read_leb(pb);
> >   if (ambisonics_mode > 1)
> > -return 0;
> > +return AVERROR_INVALIDDATA;
> >   output_channel_count = avio_r8(pb);  // C
> >   substream_count = avio_r8(pb);  // N
> 
> Ok, but change the commit subject to something like "reject ambisonics mode
> > 1" or "abort on ambisonics mode > 1".

will apply with that change

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

z(9) = an object that transcends all computable functions describable
in finite terms. - ChatGPT in 2024


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] swscale/ppc: disable YUV2RGB AltiVec acceleration

2024-12-01 Thread Michael Niedermayer
Hi Sean

On Thu, Nov 28, 2024 at 02:52:16PM -0500, Sean McGovern wrote:
> The FATE test 'checkasm-sw_yuv2rgb' currently fails on this platform,
> in both little- and big-endian configurations with AltiVec enabled.
> 
> Disable it for the time being.
> ---
>  libswscale/ppc/yuv2rgb_altivec.c | 8 
>  1 file changed, 8 insertions(+)

will apply

thx

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
than the original author, trying to rewrite it will not make it better.


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 3/6] avcodec/rv60dec: Check qp for intra

2024-12-01 Thread Peter Ross
On Mon, Dec 02, 2024 at 12:24:53AM +0100, Michael Niedermayer wrote:
> The rv60_qp_to_idx table only supports qp up to 31 on intra
> 
> Fixes: global-buffer-overflow
> Fixes: 
> 377543818/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_fuzzer-5160167345291264
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/rv60dec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/rv60dec.c b/libavcodec/rv60dec.c
> index 64fa72d8f20..449650223d8 100644
> --- a/libavcodec/rv60dec.c
> +++ b/libavcodec/rv60dec.c
> @@ -1779,6 +1779,8 @@ static int decode_cu_r(RV60Context * s, AVFrame * 
> frame, ThreadContext * thread,
>  ttype = cu.pu_type == PU_FULL ? TRANSFORM_8X8 : TRANSFORM_4X4;
>  
>  is_intra = cu.cu_type == CU_INTRA;
> +if (is_intra && qp >= 32)
> +return AVERROR_INVALIDDATA;
>  cu_pos = ((xpos & 63) >> 3) + ((ypos & 63) >> 3) * 8;

nice find by clusterfuzz. please apply

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/h2645_parse: Ignore NAL with nuh_layer_id == 63

2024-12-01 Thread Michael Niedermayer
On Mon, Nov 18, 2024 at 04:09:10AM +0100, Michael Niedermayer wrote:
> Comply with "For purposes other than determining the amount of data in the 
> decoding units
> of the bitstream, decoders shall ignore all data that follow the value 63 for 
> nuh_layer_id in a NAL unit"
> Rec. ITU-T H.265 v8 (08/2021) Page 67
> 
> Fixes: index 63 out of bounds for type 'const int8_t[63]' (aka 'const signed 
> char[63]')
> Fixes: clusterfuzz-testcase-fuzzer_loadfile-5109286752026624
> Reported-by: Kacper Michajlow 
> Found-by: ossfuzz
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/h2645_parse.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

will apply

[...]
-- 
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 1/2] swscale/slice: clear allocated memory in alloc_lines()

2024-12-01 Thread Michael Niedermayer
On Sat, Oct 19, 2024 at 03:17:21AM +0200, Michael Niedermayer wrote:
> Fixes: use of uninitialized memory in hScale16To15_c()
> Fixes: 
> 373924007/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5841199968092160
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libswscale/slice.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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

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


Re: [FFmpeg-devel] [PATCH 02/10] MAINTAINERS: aacdec seems unmaintained, aacdec_usac seems maintained by Lynne

2024-12-01 Thread Michael Niedermayer
Hi Lynne

On Sat, Sep 28, 2024 at 06:00:11AM +0200, Lynne via ffmpeg-devel wrote:
> On 22/09/2024 23:56, Michael Niedermayer wrote:
> > CC: Lynne 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >   MAINTAINERS | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 5b6fbfdc48d..882ecae1d32 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -146,6 +146,8 @@ Codecs:
> > 4xm.c [2] Michael Niedermayer
> > 8bps.cRoberto Togni
> > 8svx.cJaikrishnan Menon
> > +  aacdec*   [0]
> > +  aacdec_usac*  Lynne
> > aacenc*, aaccoder.c   Rostislav Pehlivanov
> > adpcm.c   Zane van Iperen
> > alacenc.c Jaikrishnan Menon
> 
> I pretty much rewrote aacdec while refactoring, I maintain it.

is it ok if i add instead ?

+  aacdec*   [2] Lynne


thx


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


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 5/7] avformat/qcp: Check for read failure in header

2024-12-01 Thread Michael Niedermayer
On Mon, Sep 23, 2024 at 11:32:47PM +0200, Michael Niedermayer wrote:
> Fixes: Use of uninitialized value
> Fixes: 
> 71551/clusterfuzz-testcase-minimized-ffmpeg_dem_QCP_fuzzer-4647386712965120
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/qcp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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 2/8] avcodec/rangecoder: Do not loop renormalization

2024-12-01 Thread Michael Niedermayer
On Wed, Oct 16, 2024 at 09:49:49PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/rangecoder.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patch 2-6

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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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 4/7] avcodec/eatgq: Check bytestream2_get_buffer() for failure

2024-12-01 Thread Michael Niedermayer
On Mon, Sep 23, 2024 at 11:32:46PM +0200, Michael Niedermayer wrote:
> Fixes: Use of uninitialized memory
> Fixes: 
> 71546/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGQ_fuzzer-5607656650244096
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/eatgq.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

[...]
-- 
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 3/7] avcodec/eatgq: move array to where it is used

2024-12-01 Thread Michael Niedermayer
On Mon, Sep 23, 2024 at 11:32:45PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/eatgq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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 v2] avcodec/ffv1enc: Add enum for qtable

2024-12-01 Thread Lynne via ffmpeg-devel

On 02/12/2024 11:15, Michael Niedermayer wrote:


Signed-off-by: Michael Niedermayer 
---
  libavcodec/ffv1enc.c| 8 +++-
  libavcodec/ffv1enc.h| 6 ++
  libavcodec/ffv1enc_vulkan.c | 8 +++-
  3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index c96c71b1096..696823b7967 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1346,7 +1346,13 @@ static const AVOption options[] = {
  { "context", "Context model", OFFSET(context_model), AV_OPT_TYPE_INT,
  { .i64 = 0 }, 0, 1, VE },
  { "qtable", "Quantization table", OFFSET(qtable), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 2, VE },
+{ .i64 = -1 }, -1, 2, VE , .unit = "qtable"},
+{ "default", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_DEFAULT }, INT_MIN, INT_MAX, VE, .unit = "qtable" 
},
+{ "8bit", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
+{ "greater8bit", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_GT8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
  
  { NULL }

  };
diff --git a/libavcodec/ffv1enc.h b/libavcodec/ffv1enc.h
index e22693f2a89..2ecc2d16ec9 100644
--- a/libavcodec/ffv1enc.h
+++ b/libavcodec/ffv1enc.h
@@ -25,6 +25,12 @@
  
  #include "avcodec.h"
  
+enum {

+QTABLE_DEFAULT = -1,
+QTABLE_8BIT,
+QTABLE_GT8BIT,
+};
+
  av_cold int ff_ffv1_encode_init(AVCodecContext *avctx);
  av_cold int ff_ffv1_write_extradata(AVCodecContext *avctx);
  av_cold int ff_ffv1_encode_setup_plane_info(AVCodecContext *avctx,
diff --git a/libavcodec/ffv1enc_vulkan.c b/libavcodec/ffv1enc_vulkan.c
index cdb0096969e..41d396fb32c 100644
--- a/libavcodec/ffv1enc_vulkan.c
+++ b/libavcodec/ffv1enc_vulkan.c
@@ -1795,7 +1795,13 @@ static const AVOption vulkan_encode_ffv1_options[] = {
  { "range_tab", "Range with custom table", 0, AV_OPT_TYPE_CONST,
  { .i64 = AC_RANGE_CUSTOM_TAB }, INT_MIN, INT_MAX, VE, .unit = 
"coder" },
  { "qtable", "Quantization table", OFFSET(ctx.qtable), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 2, VE },
+{ .i64 = -1 }, -1, 2, VE , .unit = "qtable"},
+{ "default", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_DEFAULT }, INT_MIN, INT_MAX, VE, .unit = "qtable" 
},
+{ "8bit", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
+{ "greater8bit", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = QTABLE_GT8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
  
  { "slices_h", "Number of horizontal slices", OFFSET(num_h_slices), AV_OPT_TYPE_INT,

  { .i64 = -1 }, -1, 1024, VE },



Thanks, tested and it works fine.

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

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


[FFmpeg-devel] Check MSE bound in FATE

2024-12-01 Thread Pierre-Anthony Lemieux
Hi all,

Osamu and I are looking at adding FATE tests that checks that the MSE
of a decode image compared to a reference image does not exceed a
conformance threshold (see [1]).

Is there a precedent for adding small shell scripts along the lines of
the following to FATE?

https://gist.github.com/palemieux/99b36faa9108089440f2a68df0f2c0a7

Multiple tests might reuse the same approach.

Any alternatives?

Thanks,

-- Pierre

[1] https://ffmpeg.org/pipermail/ffmpeg-devel/2024-November/335778.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avformat/mm: fix packets pts generation and add seek support

2024-12-01 Thread Peter Ross
Signed-off-by: Peter Ross 
---
Author: Paul B Mahol 
Date:   Wed Jun 26 09:07:29 2024 +0200

 libavformat/mm.c  | 31 ++
 tests/ref/fate/alg-mm | 62 +--
 2 files changed, 45 insertions(+), 48 deletions(-)

diff --git a/libavformat/mm.c b/libavformat/mm.c
index 07ba6ac4f5..13717b3254 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -58,10 +58,6 @@
 #define MM_PALETTE_COUNT128
 #define MM_PALETTE_SIZE (MM_PALETTE_COUNT*3)
 
-typedef struct MmDemuxContext {
-  unsigned int audio_pts, video_pts;
-} MmDemuxContext;
-
 static int probe(const AVProbeData *p)
 {
 int len, type, fps, w, h;
@@ -88,7 +84,6 @@ static int probe(const AVProbeData *p)
 
 static int read_header(AVFormatContext *s)
 {
-MmDemuxContext *mm = s->priv_data;
 AVIOContext *pb = s->pb;
 AVStream *st;
 
@@ -133,30 +128,29 @@ static int read_header(AVFormatContext *s)
 avpriv_set_pts_info(st, 64, 1, 8000); /* 8000 hz */
 }
 
-mm->audio_pts = 0;
-mm->video_pts = 0;
 return 0;
 }
 
 static int read_packet(AVFormatContext *s,
AVPacket *pkt)
 {
-MmDemuxContext *mm = s->priv_data;
 AVIOContext *pb = s->pb;
 unsigned char preamble[MM_PREAMBLE_SIZE];
 unsigned int type, length;
+int64_t pos = avio_tell(pb);
 int ret;
 
-while(1) {
+while (1) {
+if (avio_feof(pb))
+return AVERROR_EOF;
 
-if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
+if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE)
 return AVERROR(EIO);
-}
 
 type = AV_RL16(&preamble[0]);
 length = AV_RL16(&preamble[2]);
 
-switch(type) {
+switch (type) {
 case MM_TYPE_RAW :
 case MM_TYPE_PALETTE :
 case MM_TYPE_INTER :
@@ -173,9 +167,12 @@ static int read_packet(AVFormatContext *s,
 return AVERROR(EIO);
 pkt->size = length + MM_PREAMBLE_SIZE;
 pkt->stream_index = 0;
-pkt->pts = mm->video_pts;
 if (type!=MM_TYPE_PALETTE)
-mm->video_pts++;
+pkt->duration = 1;
+if (type == MM_TYPE_RAW ||
+type == MM_TYPE_INTRA)
+pkt->flags |= AV_PKT_FLAG_KEY;
+pkt->pos = pos;
 return 0;
 
 case MM_TYPE_AUDIO :
@@ -184,8 +181,8 @@ static int read_packet(AVFormatContext *s,
 if ((ret = av_get_packet(s->pb, pkt, length)) < 0)
 return ret;
 pkt->stream_index = 1;
-pkt->pts = mm->audio_pts;
-mm->audio_pts += length;
+pkt->duration = length;
+pkt->pos = pos;
 return 0;
 
 default :
@@ -200,7 +197,7 @@ static int read_packet(AVFormatContext *s,
 const FFInputFormat ff_mm_demuxer = {
 .p.name = "mm",
 .p.long_name= NULL_IF_CONFIG_SMALL("American Laser Games MM"),
-.priv_data_size = sizeof(MmDemuxContext),
+.p.flags= AVFMT_GENERIC_INDEX,
 .read_probe = probe,
 .read_header= read_header,
 .read_packet= read_packet,
diff --git a/tests/ref/fate/alg-mm b/tests/ref/fate/alg-mm
index 5788012713..17ccd8e316 100644
--- a/tests/ref/fate/alg-mm
+++ b/tests/ref/fate/alg-mm
@@ -3,34 +3,34 @@
 #codec_id 0: rawvideo
 #dimensions 0: 256x160
 #sar 0: 0/1
-0,  0,  0,1,   122880, 0x4ed8123f
-0,  1,  1,1,   122880, 0xc4c35304
-0,  2,  2,1,   122880, 0xbd3015fd
-0,  3,  3,1,   122880, 0xece5dbab
-0,  4,  4,1,   122880, 0x13249f3f
-0,  5,  5,1,   122880, 0x58f75895
-0,  6,  6,1,   122880, 0xe6570f7d
-0,  7,  7,1,   122880, 0xcce88145
-0,  8,  8,1,   122880, 0x796f633c
-0,  9,  9,1,   122880, 0x182c3cd3
-0, 10, 10,1,   122880, 0x04b2513b
-0, 11, 11,1,   122880, 0x6b7e2e42
-0, 12, 12,1,   122880, 0x2fa47070
-0, 13, 13,1,   122880, 0x7142919e
-0, 14, 14,1,   122880, 0x8995337e
-0, 15, 15,1,   122880, 0x5146ca20
-0, 16, 16,1,   122880, 0x9aadb491
-0, 17, 17,1,   122880, 0x2d5b0032
-0, 18, 18,1,   122880, 0x5c7c8314
-0, 19, 19,1,   122880, 0x2ba8253c
-0, 20, 20,1,   122880, 0xd19d504b
-0, 21, 21,1,   122880, 0x4ff15fd1
-0, 22, 22,1,   122880, 0x76039f9f
-0, 23, 23,1,   122880, 0xcce84d35
-0, 24, 24,1,   122880, 0x68c5797c
-0, 25, 25,1,   122880, 0xf1da4293
-0, 26, 26,  

[FFmpeg-devel] [PATCH] avcodec/png{dec, enc}: update mDCV and cLLI chunk capitalization

2024-12-01 Thread Leo Izen
The PNGv3 Specification Draft [1] has changed the capitalization
of mDCV and cLLI chunks (formerly mDCv and cLLi). This patch updates
FFmpeg to work with the new chunk names while retaining decode-side
compatibility with files created using the old names.

[1]: https://w3c.github.io/png/

Signed-off-by: Leo Izen 
---
 libavcodec/pngdec.c | 12 +++-
 libavcodec/pngenc.c |  4 ++--
 tests/ref/fate/png-mdcv |  2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index c5b32c166d..f8cb61775e 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -757,7 +757,7 @@ static int populate_avctx_color_fields(AVCodecContext 
*avctx, AVFrame *frame)
 if (clli) {
 /*
  * 0.0001 divisor value
- * see: https://www.w3.org/TR/png-3/#cLLi-chunk
+ * see: https://www.w3.org/TR/png-3/#cLLI-chunk
  */
 clli->MaxCLL = s->clli_max / 1;
 clli->MaxFALL = s->clli_avg / 1;
@@ -1566,18 +1566,20 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
 
 break;
 }
-case MKTAG('c', 'L', 'L', 'i'):
+case MKTAG('c', 'L', 'L', 'i'): /* legacy spelling, for backwards 
compat */
+case MKTAG('c', 'L', 'L', 'I'):
 if (bytestream2_get_bytes_left(&gb_chunk) != 8) {
-av_log(avctx, AV_LOG_WARNING, "Invalid cLLi chunk size: %d\n", 
bytestream2_get_bytes_left(&gb_chunk));
+av_log(avctx, AV_LOG_WARNING, "Invalid cLLI chunk size: %d\n", 
bytestream2_get_bytes_left(&gb_chunk));
 break;
 }
 s->have_clli = 1;
 s->clli_max = bytestream2_get_be32u(&gb_chunk);
 s->clli_avg = bytestream2_get_be32u(&gb_chunk);
 break;
-case MKTAG('m', 'D', 'C', 'v'):
+case MKTAG('m', 'D', 'C', 'v'): /* legacy spelling, for backward 
compat */
+case MKTAG('m', 'D', 'C', 'V'):
 if (bytestream2_get_bytes_left(&gb_chunk) != 24) {
-av_log(avctx, AV_LOG_WARNING, "Invalid mDCv chunk size: %d\n", 
bytestream2_get_bytes_left(&gb_chunk));
+av_log(avctx, AV_LOG_WARNING, "Invalid mDCV chunk size: %d\n", 
bytestream2_get_bytes_left(&gb_chunk));
 break;
 }
 s->have_mdcv = 1;
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index cb79c04e11..37e8d5bfcf 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -445,7 +445,7 @@ static int encode_headers(AVCodecContext *avctx, const 
AVFrame *pict)
 AVContentLightMetadata *clli = (AVContentLightMetadata *) 
side_data->data;
 AV_WB32(s->buf, clli->MaxCLL * 1);
 AV_WB32(s->buf + 4, clli->MaxFALL * 1);
-png_write_chunk(&s->bytestream, MKTAG('c', 'L', 'L', 'i'), s->buf, 8);
+png_write_chunk(&s->bytestream, MKTAG('c', 'L', 'L', 'I'), s->buf, 8);
 }
 
 side_data = av_frame_get_side_data(pict, 
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
@@ -460,7 +460,7 @@ static int encode_headers(AVCodecContext *avctx, const 
AVFrame *pict)
 AV_WB16(s->buf + 14, PNG_Q2D(mdcv->white_point[1], 5));
 AV_WB32(s->buf + 16, PNG_Q2D(mdcv->max_luminance, 1));
 AV_WB32(s->buf + 20, PNG_Q2D(mdcv->min_luminance, 1));
-png_write_chunk(&s->bytestream, MKTAG('m', 'D', 'C', 'v'), s->buf, 
24);
+png_write_chunk(&s->bytestream, MKTAG('m', 'D', 'C', 'V'), s->buf, 
24);
 }
 }
 
diff --git a/tests/ref/fate/png-mdcv b/tests/ref/fate/png-mdcv
index c524a94ded..4328c56349 100644
--- a/tests/ref/fate/png-mdcv
+++ b/tests/ref/fate/png-mdcv
@@ -1,4 +1,4 @@
-fc68fe6c8c72343b96d2695f6913995b *tests/data/fate/png-mdcv.image2pipe
+b1837f5557ad969a3f9763840480d5c0 *tests/data/fate/png-mdcv.image2pipe
 439248 tests/data/fate/png-mdcv.image2pipe
 #tb 0: 1/25
 #media_type 0: video
-- 
2.47.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 v4 3/8] swscale/aarch64/range_convert: saturate output instead of limiting input

2024-12-01 Thread Ramiro Polla
aarch64 A55:
chrRangeFromJpeg8_1920_c:28836.2 (1.00x)
chrRangeFromJpeg8_1920_neon:  5312.6 (5.43x)  5313.9 (5.43x)
chrRangeToJpeg8_1920_c:  44196.2 (1.00x)
chrRangeToJpeg8_1920_neon:6034.6 (7.32x)  5551.3 (7.96x)
lumRangeFromJpeg8_1920_c:15388.5 (1.00x)
lumRangeFromJpeg8_1920_neon:  3150.7 (4.88x)  3152.3 (4.88x)
lumRangeToJpeg8_1920_c:  23069.7 (1.00x)
lumRangeToJpeg8_1920_neon:3873.2 (5.96x)  3628.7 (6.36x)

aarch64 A76:
chrRangeFromJpeg8_1920_c: 6334.7 (1.00x)
chrRangeFromJpeg8_1920_neon:  2264.5 (2.80x)  2344.5 (2.70x)
chrRangeToJpeg8_1920_c:  11474.5 (1.00x)
chrRangeToJpeg8_1920_neon:2646.5 (4.34x)  2824.2 (4.06x)
lumRangeFromJpeg8_1920_c: 4453.2 (1.00x)
lumRangeFromJpeg8_1920_neon:  1104.8 (4.03x)  1104.5 (4.03x)
lumRangeToJpeg8_1920_c:   6645.0 (1.00x)
lumRangeToJpeg8_1920_neon:1310.5 (5.07x)  1329.8 (5.00x)
---
 libswscale/aarch64/range_convert_neon.S | 39 -
 libswscale/aarch64/swscale.c|  5 
 2 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/libswscale/aarch64/range_convert_neon.S 
b/libswscale/aarch64/range_convert_neon.S
index 30991ab2a6..2f418adb24 100644
--- a/libswscale/aarch64/range_convert_neon.S
+++ b/libswscale/aarch64/range_convert_neon.S
@@ -20,12 +20,8 @@
 
 #include "libavutil/aarch64/asm.S"
 
-.macro lumConvertRange name, max, mult, offset, shift
+.macro lumConvertRange name, fromto, mult, offset, shift
 function ff_\name, export=1
-.if \max != 0
-mov w3, #\max
-dup v24.8h, w3
-.endif
 mov w3, #\mult
 dup v25.4s, w3
 movzw3, #(\offset & 0x)
@@ -33,17 +29,19 @@ function ff_\name, export=1
 dup v26.4s, w3
 1:
 ld1 {v0.8h}, [x0]
-.if \max != 0
-sminv0.8h, v0.8h, v24.8h
-.endif
 mov v16.16b, v26.16b
 mov v18.16b, v26.16b
 sxtlv20.4s, v0.4h
 sxtl2   v22.4s, v0.8h
 mla v16.4s, v20.4s, v25.4s
 mla v18.4s, v22.4s, v25.4s
+.ifc \fromto, To
+sqshrn  v0.4h, v16.4s, #\shift
+sqshrn2 v0.8h, v18.4s, #\shift
+.else
 shrnv0.4h, v16.4s, #\shift
 shrn2   v0.8h, v18.4s, #\shift
+.endif
 subsw1, w1, #8
 st1 {v0.8h}, [x0], #16
 b.gt1b
@@ -51,12 +49,8 @@ function ff_\name, export=1
 endfunc
 .endm
 
-.macro chrConvertRange name, max, mult, offset, shift
+.macro chrConvertRange name, fromto, mult, offset, shift
 function ff_\name, export=1
-.if \max != 0
-mov w3, #\max
-dup v24.8h, w3
-.endif
 mov w3, #\mult
 dup v25.4s, w3
 movzw3, #(\offset & 0x)
@@ -65,10 +59,6 @@ function ff_\name, export=1
 1:
 ld1 {v0.8h}, [x0]
 ld1 {v1.8h}, [x1]
-.if \max != 0
-sminv0.8h, v0.8h, v24.8h
-sminv1.8h, v1.8h, v24.8h
-.endif
 mov v16.16b, v26.16b
 mov v17.16b, v26.16b
 mov v18.16b, v26.16b
@@ -81,10 +71,17 @@ function ff_\name, export=1
 mla v17.4s, v21.4s, v25.4s
 mla v18.4s, v22.4s, v25.4s
 mla v19.4s, v23.4s, v25.4s
+.ifc \fromto, To
+sqshrn  v0.4h, v16.4s, #\shift
+sqshrn  v1.4h, v17.4s, #\shift
+sqshrn2 v0.8h, v18.4s, #\shift
+sqshrn2 v1.8h, v19.4s, #\shift
+.else
 shrnv0.4h, v16.4s, #\shift
 shrnv1.4h, v17.4s, #\shift
 shrn2   v0.8h, v18.4s, #\shift
 shrn2   v1.8h, v19.4s, #\shift
+.endif
 subsw2, w2, #8
 st1 {v0.8h}, [x0], #16
 st1 {v1.8h}, [x1], #16
@@ -93,7 +90,7 @@ function ff_\name, export=1
 endfunc
 .endm
 
-lumConvertRange lumRangeToJpeg_neon,   30189, 19077, -39057361, 14
-chrConvertRange chrRangeToJpeg_neon,   30775,  4663,  -9289992, 12
-lumConvertRange lumRangeFromJpeg_neon, 0, 14071,  33561947, 14
-chrConvertRange chrRangeFromJpeg_neon, 0,  1799,   4081085, 11
+lumConvertRange lumRangeToJpeg_neon,   To,   19077, -39057361, 14
+chrConvertRange chrRangeToJpeg_neon,   To,4663,  -9289992, 12
+lumConvertRange lumRangeFromJpeg_neon, From, 14071,  33561947, 14
+chrConvertRange chrRangeFromJpeg_neon, From,  1799,   4081085, 11
diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index 1fce77df26..5173359e09 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -225,10 +225,6 @@ void ff_chrRangeToJpeg_neon(int16_t *dstU, int16_t *dstV, 
int width);
 
 av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
 {
-/* This code is currently disabled because 

[FFmpeg-devel] [PATCH v4 5/8] swscale/x86/range_convert: update sse2 and avx2 range_convert functions to new API

2024-12-01 Thread Ramiro Polla
chrRangeFromJpeg8_1920_c:2127.4 (1.00x)
chrRangeFromJpeg8_1920_sse2:  816.0 (2.61x)  813.5 (2.62x)
chrRangeFromJpeg8_1920_avx2:  408.9 (5.20x)  405.4 (5.25x)
chrRangeToJpeg8_1920_c:  3166.9 (1.00x)
chrRangeToJpeg8_1920_sse2:815.0 (3.89x)  815.0 (3.89x)
chrRangeToJpeg8_1920_avx2:404.5 (7.83x)  405.5 (7.81x)
lumRangeFromJpeg8_1920_c:1263.0 (1.00x)
lumRangeFromJpeg8_1920_sse2:  411.0 (3.07x)  413.2 (3.06x)
lumRangeFromJpeg8_1920_avx2:  200.5 (6.30x)  201.9 (6.26x)
lumRangeToJpeg8_1920_c:  1886.8 (1.00x)
lumRangeToJpeg8_1920_sse2:412.0 (4.58x)  408.9 (4.61x)
lumRangeToJpeg8_1920_avx2:208.5 (9.05x)  205.7 (9.17x)
---
 libswscale/x86/range_convert.asm | 86 
 libswscale/x86/swscale.c | 17 +++
 2 files changed, 50 insertions(+), 53 deletions(-)

diff --git a/libswscale/x86/range_convert.asm b/libswscale/x86/range_convert.asm
index ffda009c4e..27be2a4b31 100644
--- a/libswscale/x86/range_convert.asm
+++ b/libswscale/x86/range_convert.asm
@@ -20,39 +20,29 @@
 
 %include "libavutil/x86/x86util.asm"
 
-SECTION_RODATA
-
-chr_to_mult:times 4 dw 4663, 0
-chr_to_offset:  times 4 dd -9289992
-%define chr_to_shift 12
-
-chr_from_mult:  times 4 dw 1799, 0
-chr_from_offset:times 4 dd 4081085
-%define chr_from_shift 11
-
-lum_to_mult:times 4 dw 19077, 0
-lum_to_offset:  times 4 dd -39057361
-%define lum_to_shift 14
-
-lum_from_mult:  times 4 dw 14071, 0
-lum_from_offset:times 4 dd 33561947
-%define lum_from_shift 14
-
 SECTION .text
 
 ;-
 ; lumConvertRange
 ;
-; void ff_lumRangeToJpeg_(int16_t *dst, int width);
-; void ff_lumRangeFromJpeg_(int16_t *dst, int width);
+; void ff_lumRangeToJpeg_(int16_t *dst, int width,
+;  uint32_t coeff, int64_t offset);
+; void ff_lumRangeFromJpeg_(int16_t *dst, int width,
+;uint32_t coeff, int64_t offset);
 ;
 ;-
 
-%macro LUMCONVERTRANGE 4
-cglobal %1, 2, 2, 5, dst, width
+%macro LUMCONVERTRANGE 1
+cglobal lumRange%1Jpeg, 4, 4, 5, dst, width, coeff, offset
 shl  widthd, 1
-VBROADCASTI128   m2, [%2]
-VBROADCASTI128   m3, [%3]
+movdxm2, coeffd
+VBROADCASTSS m2, xm2
+%if ARCH_X86_64
+movqxm3, offsetq
+%else
+movqxm3, offsetm
+%endif
+VBROADCASTSS m3, xm3
 pxor m4, m4
 adddstq, widthq
 neg  widthq
@@ -64,8 +54,8 @@ cglobal %1, 2, 2, 5, dst, width
 pmaddwd  m1, m2
 padddm0, m3
 padddm1, m3
-psradm0, %4
-psradm1, %4
+psradm0, 14
+psradm1, 14
 packssdw m0, m1
 movu  [dstq+widthq], m0
 add  widthq, mmsize
@@ -76,16 +66,24 @@ cglobal %1, 2, 2, 5, dst, width
 ;-
 ; chrConvertRange
 ;
-; void ff_chrRangeToJpeg_(int16_t *dstU, int16_t *dstV, int width);
-; void ff_chrRangeFromJpeg_(int16_t *dstU, int16_t *dstV, int width);
+; void ff_chrRangeToJpeg_(int16_t *dstU, int16_t *dstV, int width,
+;  uint32_t coeff, int64_t offset);
+; void ff_chrRangeFromJpeg_(int16_t *dstU, int16_t *dstV, int width,
+;uint32_t coeff, int64_t offset);
 ;
 ;-
 
-%macro CHRCONVERTRANGE 4
-cglobal %1, 3, 3, 7, dstU, dstV, width
+%macro CHRCONVERTRANGE 1
+cglobal chrRange%1Jpeg, 5, 5, 7, dstU, dstV, width, coeff, offset
 shl  widthd, 1
-VBROADCASTI128   m4, [%2]
-VBROADCASTI128   m5, [%3]
+movdxm4, coeffd
+VBROADCASTSS m4, xm4
+%if ARCH_X86_64
+movqxm5, offsetq
+%else
+movqxm5, offsetm
+%endif
+VBROADCASTSS m5, xm5
 pxor m6, m6
 add   dstUq, widthq
 add   dstVq, widthq
@@ -105,10 +103,10 @@ cglobal %1, 3, 3, 7, dstU, dstV, width
 padddm1, m5
 padddm2, m5
 padddm3, m5
-psradm0, %4
-psradm1, %4
-psradm2, %4
-psradm3, %4
+psradm0, 14
+psradm1, 14
+psradm2, 14
+psradm3, 14
 packssdw m0, m1
 packssdw m2, m3
 movu [dstUq+widthq], m0
@@ -119,15 +117,15 @@ cglobal %1, 3, 3, 7, dstU, dstV, width
 %endmacro
 
 INIT_XMM sse2
-LUMCONVERTRANGE lumRangeToJpeg,   lum_to_mult,   lum_to_offset,   lum_to_shift
-CHRCONVERTRANGE chrRangeToJpeg,   chr_to_mult,   chr_to_offset,   chr_to_shift
-LUMCONVERTRANGE lumRangeFromJpeg, lum_from_mult, lum_from_offset, 
lum_from_shift
-CHRCONVERTRANGE chrRangeFromJpeg, chr_from_mult, chr_from_offset, 

[FFmpeg-devel] [PATCH v4 2/8] swscale/range_convert: saturate output instead of limiting input

2024-12-01 Thread Ramiro Polla
For bit depths <= 14, the result is saturated to 15 bits.
For bit depths > 14, the result is saturated to 19 bits.

x86_64:
chrRangeFromJpeg8_1920_c:2126.5   2127.4  (1.00x)
chrRangeFromJpeg16_1920_c:   2331.4   2325.2  (1.00x)
chrRangeToJpeg8_1920_c:  3163.0   3166.9  (1.00x)
chrRangeToJpeg16_1920_c: 3163.7   2152.4  (1.47x)
lumRangeFromJpeg8_1920_c:1262.2   1263.0  (1.00x)
lumRangeFromJpeg16_1920_c:   1079.5   1080.5  (1.00x)
lumRangeToJpeg8_1920_c:  1860.5   1886.8  (0.99x)
lumRangeToJpeg16_1920_c: 1910.2   1077.0  (1.77x)

aarch64 A55:
chrRangeFromJpeg8_1920_c:   28836.2  28835.2  (1.00x)
chrRangeFromJpeg16_1920_c:  28840.1  28839.8  (1.00x)
chrRangeToJpeg8_1920_c: 44196.2  23074.7  (1.92x)
chrRangeToJpeg16_1920_c:36527.3  17318.9  (2.11x)
lumRangeFromJpeg8_1920_c:   15388.5  15389.7  (1.00x)
lumRangeFromJpeg16_1920_c:  15389.3  15388.2  (1.00x)
lumRangeToJpeg8_1920_c: 23069.7  19227.8  (1.20x)
lumRangeToJpeg16_1920_c:19227.8  15387.0  (1.25x)

aarch64 A76:
chrRangeFromJpeg8_1920_c:6334.7   6324.4  (1.00x)
chrRangeFromJpeg16_1920_c:   6336.0   6339.9  (1.00x)
chrRangeToJpeg8_1920_c: 11474.5   9656.0  (1.19x)
chrRangeToJpeg16_1920_c: 9640.5   6340.4  (1.52x)
lumRangeFromJpeg8_1920_c:4453.2   4422.0  (1.01x)
lumRangeFromJpeg16_1920_c:   4414.2   4420.9  (1.00x)
lumRangeToJpeg8_1920_c:  6645.0   5949.1  (1.12x)
lumRangeToJpeg16_1920_c: 6005.2   4446.8  (1.35x)

NOTE: all simd optimizations for range_convert have been disabled
  except for x86, which already had the same behaviour.
  they will be re-enabled when they are fixed for each architecture.
---
 libswscale/aarch64/swscale.c  |  5 +
 libswscale/loongarch/swscale_init_loongarch.c |  5 +
 libswscale/riscv/swscale.c|  5 +
 libswscale/swscale.c  | 21 ---
 libswscale/x86/range_convert.asm  |  3 ---
 5 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index 5173359e09..1fce77df26 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -225,6 +225,10 @@ void ff_chrRangeToJpeg_neon(int16_t *dstU, int16_t *dstV, 
int width);
 
 av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
 {
+/* This code is currently disabled because of changes in the base
+ * implementation of these functions. This code should be enabled
+ * again once those changes are ported to this architecture. */
+#if 0
 int cpu_flags = av_get_cpu_flags();
 
 if (have_neon(cpu_flags)) {
@@ -238,6 +242,7 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsInternal 
*c)
 }
 }
 }
+#endif
 }
 
 av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c)
diff --git a/libswscale/loongarch/swscale_init_loongarch.c 
b/libswscale/loongarch/swscale_init_loongarch.c
index 5204a8b66d..f0b8a7db12 100644
--- a/libswscale/loongarch/swscale_init_loongarch.c
+++ b/libswscale/loongarch/swscale_init_loongarch.c
@@ -26,6 +26,10 @@
 
 av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
 {
+/* This code is currently disabled because of changes in the base
+ * implementation of these functions. This code should be enabled
+ * again once those changes are ported to this architecture. */
+#if 0
 int cpu_flags = av_get_cpu_flags();
 
 if (have_lsx(cpu_flags)) {
@@ -52,6 +56,7 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal 
*c)
 }
 }
 #endif // #if HAVE_LASX
+#endif
 }
 
 av_cold void ff_sws_init_swscale_loongarch(SwsInternal *c)
diff --git a/libswscale/riscv/swscale.c b/libswscale/riscv/swscale.c
index 3bdaf20af4..49c492f153 100644
--- a/libswscale/riscv/swscale.c
+++ b/libswscale/riscv/swscale.c
@@ -28,6 +28,10 @@ void ff_range_chr_from_jpeg_16_rvv(int16_t *, int16_t *, 
int);
 
 av_cold void ff_sws_init_range_convert_riscv(SwsInternal *c)
 {
+/* This code is currently disabled because of changes in the base
+ * implementation of these functions. This code should be enabled
+ * again once those changes are ported to this architecture. */
+#if 0
 #if HAVE_RVV
 int flags = av_get_cpu_flags();
 
@@ -47,6 +51,7 @@ av_cold void ff_sws_init_range_convert_riscv(SwsInternal *c)
 c->chrConvertRange = convs[from].chr;
 }
 #endif
+#endif
 }
 
 #define RVV_INPUT(name) \
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 3c4637c0a1..9d430920aa 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -160,8 +160,10 @@ static void chrRangeToJpeg_c(int16_t *dstU, int16_t *dstV, 
int width)
 {
 int i;
 for (i = 0; i < width; i++) {
-dstU[i] = (FFMIN(dstU[i], 30775) * 4663 - 9289992) >> 12; // -264
-dstV[i] = (FFMIN(dstV[i], 30775) * 4663 - 9289992) >> 12; // -264
+int U = (dstU[i] * 4663 - 9289992) >> 12; // -264
+int V = (dstV[i] * 4663 - 9289992) >> 12; // -264
+

[FFmpeg-devel] [PATCH v4 1/8] checkasm/sw_range_convert: test negative input values

2024-12-01 Thread Ramiro Polla
---
 tests/checkasm/sw_range_convert.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/tests/checkasm/sw_range_convert.c 
b/tests/checkasm/sw_range_convert.c
index bf14209987..ba576ff08c 100644
--- a/tests/checkasm/sw_range_convert.c
+++ b/tests/checkasm/sw_range_convert.c
@@ -65,6 +65,8 @@ static void check_lumConvertRange(int from)
 
 LOCAL_ALIGNED_32(int16_t, dst0, [LARGEST_INPUT_SIZE * 2]);
 LOCAL_ALIGNED_32(int16_t, dst1, [LARGEST_INPUT_SIZE * 2]);
+int32_t *dst0_32 = (int32_t *) dst0;
+int32_t *dst1_32 = (int32_t *) dst1;
 
 declare_func(void, int16_t *dst, int width);
 
@@ -89,6 +91,11 @@ static void check_lumConvertRange(int from)
 int width = input_sizes[dstWi];
 if (check_func(c->lumConvertRange, "%s%d_%d", func_str, bit_depth, 
width)) {
 randomize_buffers(dst0, dst1, bit_depth, width);
+if (bit_depth == 16) {
+dst1_32[2] = dst0_32[2] = -1;
+} else {
+dst1[2] = dst0[2] = -1;
+}
 call_ref(dst0, width);
 call_new(dst1, width);
 if (memcmp(dst0, dst1, width * sample_size))
@@ -115,6 +122,8 @@ static void check_chrConvertRange(int from)
 LOCAL_ALIGNED_32(int16_t, dstV0, [LARGEST_INPUT_SIZE * 2]);
 LOCAL_ALIGNED_32(int16_t, dstU1, [LARGEST_INPUT_SIZE * 2]);
 LOCAL_ALIGNED_32(int16_t, dstV1, [LARGEST_INPUT_SIZE * 2]);
+int32_t *dstU0_32 = (int32_t *) dstU0;
+int32_t *dstU1_32 = (int32_t *) dstU1;
 
 declare_func(void, int16_t *dstU, int16_t *dstV, int width);
 
@@ -140,6 +149,11 @@ static void check_chrConvertRange(int from)
 if (check_func(c->chrConvertRange, "%s%d_%d", func_str, bit_depth, 
width)) {
 randomize_buffers(dstU0, dstU1, bit_depth, width);
 randomize_buffers(dstV0, dstV1, bit_depth, width);
+if (bit_depth == 16) {
+dstU1_32[2] = dstU0_32[2] = -1;
+} else {
+dstU1[2] = dstU0[2] = -1;
+}
 call_ref(dstU0, dstV0, width);
 call_new(dstU1, dstV1, width);
 if (memcmp(dstU0, dstU1, width * sample_size) ||
-- 
2.39.5

___
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 v4 0/8] swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats

2024-12-01 Thread Ramiro Polla
changes from v3:
- removed left-over FFMIN() on input in lumRangeToJpeg16_c();
- restored cast to signed int before right shift that was mistakenly removed in 
chrRangeToJpeg16_c();
- restored disabling of aarch64 simd functions after changing to new API;
- add test for negative input values
- fixed {lum,chr}ConvertRange16 for negative input (dropped sse2 implementation 
since it does not have pmuldq);
- reordered commits;
- reran all benchmarks;

checkasm --bench for entire patchset:

x86_64:
chrRangeFromJpeg8_1920_c:  2126.5   2114.7  (1.01x)
chrRangeFromJpeg8_1920_sse2:817.0814.2  (1.00x)
chrRangeFromJpeg8_1920_avx2:404.4405.5  (1.00x)
chrRangeFromJpeg16_1920_c: 2331.4   3153.9  (0.74x)
chrRangeToJpeg8_1920_c:3163.0   3163.9  (1.00x)
chrRangeToJpeg8_1920_sse2:  814.5814.8  (1.00x)
chrRangeToJpeg8_1920_avx2:  404.4405.7  (1.00x)
chrRangeToJpeg16_1920_c:   3163.7   3165.0  (1.00x)
lumRangeFromJpeg8_1920_c:  1262.2   1306.8  (0.97x)
lumRangeFromJpeg8_1920_sse2:411.9414.4  (0.99x)
lumRangeFromJpeg8_1920_avx2:206.9206.0  (1.00x)
lumRangeFromJpeg16_1920_c: 1079.5   1298.5  (0.83x)
lumRangeToJpeg8_1920_c:1860.5   1906.0  (0.98x)
lumRangeToJpeg8_1920_sse2:  411.9412.9  (1.00x)
lumRangeToJpeg8_1920_avx2:  198.9205.9  (0.97x)
lumRangeToJpeg16_1920_c:   1910.2   1905.0  (1.00x)

aarch64 A55:
chrRangeFromJpeg8_1920_c: 28836.2  28836.8  (1.00x)
chrRangeFromJpeg8_1920_neon:   5312.6   5310.2  (1.00x)
chrRangeFromJpeg16_1920_c:28840.1  32684.2  (0.88x)
chrRangeToJpeg8_1920_c:   44196.2  23073.2  (1.92x)
chrRangeToJpeg8_1920_neon: 6034.6   5547.4  (1.09x)
chrRangeToJpeg16_1920_c:  36527.3  24996.8  (1.46x)
lumRangeFromJpeg8_1920_c: 15388.5  15383.5  (1.00x)
lumRangeFromJpeg8_1920_neon:   3150.7   3147.4  (1.00x)
lumRangeFromJpeg16_1920_c:15389.3  17305.2  (0.89x)
lumRangeToJpeg8_1920_c:   23069.7  19226.2  (1.20x)
lumRangeToJpeg8_1920_neon: 3873.2   3627.8  (1.07x)
lumRangeToJpeg16_1920_c:  19227.8  21144.8  (0.91x)

aarch64 A76:
chrRangeFromJpeg8_1920_c:  6334.7   6263.8  (1.01x)
chrRangeFromJpeg8_1920_neon:   2264.5   2307.0  (0.98x)
chrRangeFromJpeg16_1920_c: 6336.0  11523.8  (0.55x)
chrRangeToJpeg8_1920_c:   11474.5   9610.4  (1.19x)
chrRangeToJpeg8_1920_neon: 2646.5   2794.2  (0.95x)
chrRangeToJpeg16_1920_c:   9640.5  11655.2  (0.83x)
lumRangeFromJpeg8_1920_c:  4453.2   4420.8  (1.01x)
lumRangeFromJpeg8_1920_neon:   1104.8   1107.0  (1.00x)
lumRangeFromJpeg16_1920_c: 4414.2   5762.0  (0.77x)
lumRangeToJpeg8_1920_c:6645.0   5980.8  (1.11x)
lumRangeToJpeg8_1920_neon: 1310.5   1334.0  (0.98x)
lumRangeToJpeg16_1920_c:   6005.2   5946.2  (1.01x)

Ramiro Polla (8):
  checkasm/sw_range_convert: test negative input values
  swscale/range_convert: saturate output instead of limiting input
  swscale/aarch64/range_convert: saturate output instead of limiting
input
  swscale/range_convert: fix mpeg ranges in yuv range conversion for
non-8-bit pixel formats
  swscale/x86/range_convert: update sse2 and avx2 range_convert
functions to new API
  swscale/aarch64/range_convert: update neon range_convert functions to
new API
  swscale/x86: add sse4 and avx2 {lum,chr}ConvertRange16
  swscale/aarch64: add neon {lum,chr}ConvertRange16

 libswscale/aarch64/range_convert_neon.S   | 152 ++
 libswscale/aarch64/swscale.c  |  36 +++-
 libswscale/hscale.c   |   6 +-
 libswscale/loongarch/swscale_init_loongarch.c |   5 +
 libswscale/riscv/swscale.c|   5 +
 libswscale/swscale.c  | 122 ++--
 libswscale/swscale_internal.h |  26 ++-
 libswscale/x86/range_convert.asm  | 159 ++-
 libswscale/x86/swscale.c  |  50 +++--
 tests/checkasm/sw_range_convert.c |  82 +++-
 .../fate/filter-alphaextract_alphamerge_rgb   | 100 +-
 tests/ref/fate/filter-pixdesc-gray10be|   2 +-
 tests/ref/fate/filter-pixdesc-gray10le|   2 +-
 tests/ref/fate/filter-pixdesc-gray12be|   2 +-
 tests/ref/fate/filter-pixdesc-gray12le|   2 +-
 tests/ref/fate/filter-pixdesc-gray14be|   2 +-
 tests/ref/fate/filter-pixdesc-gray14le|   2 +-
 tests/ref/fate/filter-pixdesc-gray16be|   2 +-
 tests/ref/fate/filter-pixdesc-gray16le|   2 +-
 tests/ref/fate/filter-pixdesc-gray9be |   2 +-
 tests/ref/fate/filter-pixdesc-gray9le |   2 +-
 tests/ref/fate/filter-pixdesc-ya16be  |   2 +-
 tests/ref/fate/filter-pixdesc-ya16le  |   2 +-
 tests/ref/fate/filter-pixdesc-yuvj411p|   2 +-
 tests/ref/fate/filter-pixdesc-yuvj420p|   2 +-
 tests/ref/fate/filter-pixdesc-yuvj422p|   2 +-
 tests/ref/fate/filter-pixdesc-yuvj440p|   2 +-
 tests/ref/fate/filter-pixdesc-yuvj444p|   2 +-
 tests/ref

[FFmpeg-devel] [PATCH v4 8/8] swscale/aarch64: add neon {lum, chr}ConvertRange16

2024-12-01 Thread Ramiro Polla
aarch64 A55:
chrRangeFromJpeg16_1920_c:32684.2
chrRangeFromJpeg16_1920_neon:  8431.2 (3.88x)
chrRangeToJpeg16_1920_c:  24996.8
chrRangeToJpeg16_1920_neon:9395.0 (2.66x)
lumRangeFromJpeg16_1920_c:17305.2
lumRangeFromJpeg16_1920_neon:  4586.5 (3.77x)
lumRangeToJpeg16_1920_c:  21144.8
lumRangeToJpeg16_1920_neon:5069.8 (4.17x)

aarch64 A76:
chrRangeFromJpeg16_1920_c:11523.8
chrRangeFromJpeg16_1920_neon:  3367.5 (3.42x)
chrRangeToJpeg16_1920_c:  11655.2
chrRangeToJpeg16_1920_neon:4087.2 (2.85x)
lumRangeFromJpeg16_1920_c: 5762.0
lumRangeFromJpeg16_1920_neon:  1815.8 (3.17x)
lumRangeToJpeg16_1920_c:   5946.2
lumRangeToJpeg16_1920_neon:2148.2 (2.77x)
---
 libswscale/aarch64/range_convert_neon.S | 98 +++--
 libswscale/aarch64/swscale.c| 36 ++---
 2 files changed, 116 insertions(+), 18 deletions(-)

diff --git a/libswscale/aarch64/range_convert_neon.S 
b/libswscale/aarch64/range_convert_neon.S
index 462ba6f866..c0eb714333 100644
--- a/libswscale/aarch64/range_convert_neon.S
+++ b/libswscale/aarch64/range_convert_neon.S
@@ -20,12 +20,42 @@
 
 #include "libavutil/aarch64/asm.S"
 
-.macro lumConvertRange fromto
-function ff_lumRange\fromto\()Jpeg_neon, export=1
+.macro lumConvertRange fromto, bit_depth
+function ff_lumRange\fromto\()Jpeg\bit_depth\()_neon, export=1
 // x0  int16_t *dst
 // w1  int width
 // w2  uint32_t coeff
 // x3  int64_t offset
+.if \bit_depth == 16
+.ifc \fromto, To
+moviv25.4s, #1
+moviv24.4s, #1<<3, lsl #16
+sub v24.4s, v24.4s, v25.4s
+.endif
+dup v25.4s, w2
+dup v26.2d, x3
+1:
+ld1 {v0.4s, v1.4s}, [x0]
+mov v16.16b, v26.16b
+mov v17.16b, v26.16b
+mov v18.16b, v26.16b
+mov v19.16b, v26.16b
+smlal   v16.2d, v0.2s, v25.2s
+smlal2  v17.2d, v0.4s, v25.4s
+smlal   v18.2d, v1.2s, v25.2s
+smlal2  v19.2d, v1.4s, v25.4s
+shrnv0.2s, v16.2d, 18
+shrn2   v0.4s, v17.2d, 18
+shrnv1.2s, v18.2d, 18
+shrn2   v1.4s, v19.2d, 18
+subsw1, w1, #8
+.ifc \fromto, To
+sminv0.4s, v0.4s, v24.4s
+sminv1.4s, v1.4s, v24.4s
+.endif
+st1 {v0.4s, v1.4s}, [x0], #32
+b.gt1b
+.else
 dup v25.4s, w2
 dup v26.4s, w3
 1:
@@ -46,17 +76,64 @@ function ff_lumRange\fromto\()Jpeg_neon, export=1
 subsw1, w1, #8
 st1 {v0.8h}, [x0], #16
 b.gt1b
+.endif
 ret
 endfunc
 .endm
 
-.macro chrConvertRange fromto
-function ff_chrRange\fromto\()Jpeg_neon, export=1
+.macro chrConvertRange fromto, bit_depth
+function ff_chrRange\fromto\()Jpeg\bit_depth\()_neon, export=1
 // x0  int16_t *dstU
 // x1  int16_t *dstV
 // w2  int width
 // w3  uint32_t coeff
 // x4  int64_t offset
+.if \bit_depth == 16
+.ifc \fromto, To
+moviv25.4s, #1
+moviv24.4s, #1<<3, lsl #16
+sub v24.4s, v24.4s, v25.4s
+.endif
+dup v25.4s, w3
+dup v26.2d, x4
+1:
+ld1 {v0.4s, v1.4s}, [x0]
+ld1 {v2.4s, v3.4s}, [x1]
+mov v16.16b, v26.16b
+mov v17.16b, v26.16b
+mov v18.16b, v26.16b
+mov v19.16b, v26.16b
+mov v20.16b, v26.16b
+mov v21.16b, v26.16b
+mov v22.16b, v26.16b
+mov v23.16b, v26.16b
+smlal   v16.2d, v0.2s, v25.2s
+smlal2  v17.2d, v0.4s, v25.4s
+smlal   v18.2d, v1.2s, v25.2s
+smlal2  v19.2d, v1.4s, v25.4s
+smlal   v20.2d, v2.2s, v25.2s
+smlal2  v21.2d, v2.4s, v25.4s
+smlal   v22.2d, v3.2s, v25.2s
+smlal2  v23.2d, v3.4s, v25.4s
+shrnv0.2s, v16.2d, 18
+shrn2   v0.4s, v17.2d, 18
+shrnv1.2s, v18.2d, 18
+shrn2   v1.4s, v19.2d, 18
+shrnv2.2s, v20.2d, 18
+shrn2   v2.4s, v21.2d, 18
+shrnv3.2s, v22.2d, 18
+shrn2   v3.4s, v23.2d, 18
+subsw2, w2, #8
+.ifc \fromto, To
+sminv0.4s, v0.4s, v24.4s
+sminv1.4s, v1.4s, v24.4s
+sminv2.4s, v2.4s, v24.4s
+sminv3.4s, v3.4s, v24.4s
+.endif
+st1 {v0.4s, v1.4s}, [x0], #32
+st1 {v2.4s, v3.4s}, [x1], #32
+b.gt1b
+.else
 dup v25.4s, w3
 dup v26.4s, w4
 1:
@@ -89,11 +166,16 @@ function ff_ch

[FFmpeg-devel] [PATCH v4 7/8] swscale/x86: add sse4 and avx2 {lum, chr}ConvertRange16

2024-12-01 Thread Ramiro Polla
chrRangeFromJpeg16_1920_c:3153.9
chrRangeFromJpeg16_1920_sse4: 1770.0 (1.78x)
chrRangeFromJpeg16_1920_avx2:  891.5 (3.54x)
chrRangeToJpeg16_1920_c:  3165.0
chrRangeToJpeg16_1920_sse4:   1953.2 (1.62x)
chrRangeToJpeg16_1920_avx2:973.0 (3.25x)
lumRangeFromJpeg16_1920_c:1298.5
lumRangeFromJpeg16_1920_sse4:  886.5 (1.46x)
lumRangeFromJpeg16_1920_avx2:  447.7 (2.90x)
lumRangeToJpeg16_1920_c:  1905.0
lumRangeToJpeg16_1920_sse4:993.0 (1.92x)
lumRangeToJpeg16_1920_avx2:498.9 (3.82x)
---
 libswscale/x86/range_convert.asm | 114 +--
 libswscale/x86/swscale.c |  54 ---
 2 files changed, 122 insertions(+), 46 deletions(-)

diff --git a/libswscale/x86/range_convert.asm b/libswscale/x86/range_convert.asm
index 27be2a4b31..e5b8866a1f 100644
--- a/libswscale/x86/range_convert.asm
+++ b/libswscale/x86/range_convert.asm
@@ -20,21 +20,24 @@
 
 %include "libavutil/x86/x86util.asm"
 
+SECTION_RODATA
+pack19: times 4 dd (1 << 19) - 1
+
 SECTION .text
 
 ;-
 ; lumConvertRange
 ;
-; void ff_lumRangeToJpeg_(int16_t *dst, int width,
-;  uint32_t coeff, int64_t offset);
-; void ff_lumRangeFromJpeg_(int16_t *dst, int width,
-;uint32_t coeff, int64_t offset);
+; void ff_lumRangeToJpeg{8,16}_(int16_t *dst, int width,
+;uint32_t coeff, int64_t offset);
+; void ff_lumRangeFromJpeg{8,16}_(int16_t *dst, int width,
+;  uint32_t coeff, int64_t offset);
 ;
 ;-
 
-%macro LUMCONVERTRANGE 1
-cglobal lumRange%1Jpeg, 4, 4, 5, dst, width, coeff, offset
-shl  widthd, 1
+%macro LUMCONVERTRANGE 2
+cglobal lumRange%1Jpeg%2, 4, 4, 5, dst, width, coeff, offset
+shl  widthd, %2 >> 3
 movdxm2, coeffd
 VBROADCASTSS m2, xm2
 %if ARCH_X86_64
@@ -42,12 +45,34 @@ cglobal lumRange%1Jpeg, 4, 4, 5, dst, width, coeff, offset
 %else
 movqxm3, offsetm
 %endif
+%if %2 == 16
+VBROADCASTSD m3, xm3
+%ifidni %1,To
+VBROADCASTI128   m4, [pack19]
+%endif
+%elif %2 == 8
 VBROADCASTSS m3, xm3
 pxor m4, m4
+%endif ; %2 == 8/16
 adddstq, widthq
 neg  widthq
 .loop:
 movu m0, [dstq+widthq]
+%if %2 == 16
+pshufd   m1, m0, 0xb1
+pmuldq   m0, m2
+pmuldq   m1, m2
+paddqm0, m3
+paddqm1, m3
+psrlqm0, 18
+psrlqm1, 18
+pshufd   m0, m0, 0xd8
+pshufd   m1, m1, 0xd8
+punpckldqm0, m1
+%ifidni %1,To
+PMINSD   m0, m4, m1
+%endif
+%elif %2 == 8
 punpckhwdm1, m0, m4
 punpcklwdm0, m4
 pmaddwd  m0, m2
@@ -57,6 +82,7 @@ cglobal lumRange%1Jpeg, 4, 4, 5, dst, width, coeff, offset
 psradm0, 14
 psradm1, 14
 packssdw m0, m1
+%endif ; %2 == 8/16
 movu  [dstq+widthq], m0
 add  widthq, mmsize
 jl .loop
@@ -66,16 +92,16 @@ cglobal lumRange%1Jpeg, 4, 4, 5, dst, width, coeff, offset
 ;-
 ; chrConvertRange
 ;
-; void ff_chrRangeToJpeg_(int16_t *dstU, int16_t *dstV, int width,
-;  uint32_t coeff, int64_t offset);
-; void ff_chrRangeFromJpeg_(int16_t *dstU, int16_t *dstV, int width,
-;uint32_t coeff, int64_t offset);
+; void ff_chrRangeToJpeg{8,16}_(int16_t *dstU, int16_t *dstV, int width,
+;uint32_t coeff, int64_t offset);
+; void ff_chrRangeFromJpeg{8,16}_(int16_t *dstU, int16_t *dstV, int width,
+;  uint32_t coeff, int64_t offset);
 ;
 ;-
 
-%macro CHRCONVERTRANGE 1
-cglobal chrRange%1Jpeg, 5, 5, 7, dstU, dstV, width, coeff, offset
-shl  widthd, 1
+%macro CHRCONVERTRANGE 2
+cglobal chrRange%1Jpeg%2, 5, 5, 7, dstU, dstV, width, coeff, offset
+shl  widthd, %2 >> 3
 movdxm4, coeffd
 VBROADCASTSS m4, xm4
 %if ARCH_X86_64
@@ -83,14 +109,47 @@ cglobal chrRange%1Jpeg, 5, 5, 7, dstU, dstV, width, coeff, 
offset
 %else
 movqxm5, offsetm
 %endif
+%if %2 == 16
+VBROADCASTSD m5, xm5
+%ifidni %1,To
+VBROADCASTI128   m6, [pack19]
+%endif
+%elif %2 == 8
 VBROADCASTSS m5, xm5
 pxor m6, m6
+%endif ; %2 == 8/16
 add   dstUq, widthq
 add   dstVq, widthq
 neg  widthq
 .loop:
 movu m0, [dstUq+widthq]
 movu m2, [dstVq+widthq]
+%if %2 == 16
+pshufd   m1, m0, 0xb1
+pshufd   m3, m2, 0xb1
+pmuldq   m0, m4

[FFmpeg-devel] [PATCH v4 6/8] swscale/aarch64/range_convert: update neon range_convert functions to new API

2024-12-01 Thread Ramiro Polla
aarch64 A55:
chrRangeFromJpeg8_1920_c:28835.2 (1.00x)
chrRangeFromJpeg8_1920_neon:  5313.9 (5.43x)  5308.4 (5.43x)
chrRangeToJpeg8_1920_c:  23074.7 (1.00x)
chrRangeToJpeg8_1920_neon:5551.3 (4.16x)  5549.2 (4.16x)
lumRangeFromJpeg8_1920_c:15389.7 (1.00x)
lumRangeFromJpeg8_1920_neon:  3152.3 (4.88x)  3147.7 (4.89x)
lumRangeToJpeg8_1920_c:  19227.8 (1.00x)
lumRangeToJpeg8_1920_neon:3628.7 (5.30x)  3630.2 (5.30x)

aarch64 A76:
chrRangeFromJpeg8_1920_c:6324.4 (1.00x)
chrRangeFromJpeg8_1920_neon: 2344.5 (2.70x) 2304.2 (2.74x)
chrRangeToJpeg8_1920_c:  9656.0 (1.00x)
chrRangeToJpeg8_1920_neon:   2824.2 (3.42x) 2794.2 (3.46x)
lumRangeFromJpeg8_1920_c:4422.0 (1.00x)
lumRangeFromJpeg8_1920_neon: 1104.5 (4.00x) 1106.2 (4.00x)
lumRangeToJpeg8_1920_c:  5949.1 (1.00x)
lumRangeToJpeg8_1920_neon:   1329.8 (4.47x) 1328.2 (4.48x)
---
 libswscale/aarch64/range_convert_neon.S | 59 +
 libswscale/aarch64/swscale.c| 17 ---
 2 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/libswscale/aarch64/range_convert_neon.S 
b/libswscale/aarch64/range_convert_neon.S
index 2f418adb24..462ba6f866 100644
--- a/libswscale/aarch64/range_convert_neon.S
+++ b/libswscale/aarch64/range_convert_neon.S
@@ -20,12 +20,13 @@
 
 #include "libavutil/aarch64/asm.S"
 
-.macro lumConvertRange name, fromto, mult, offset, shift
-function ff_\name, export=1
-mov w3, #\mult
-dup v25.4s, w3
-movzw3, #(\offset & 0x)
-movkw3, #((\offset >> 16) & 0x), lsl #16
+.macro lumConvertRange fromto
+function ff_lumRange\fromto\()Jpeg_neon, export=1
+// x0  int16_t *dst
+// w1  int width
+// w2  uint32_t coeff
+// x3  int64_t offset
+dup v25.4s, w2
 dup v26.4s, w3
 1:
 ld1 {v0.8h}, [x0]
@@ -36,11 +37,11 @@ function ff_\name, export=1
 mla v16.4s, v20.4s, v25.4s
 mla v18.4s, v22.4s, v25.4s
 .ifc \fromto, To
-sqshrn  v0.4h, v16.4s, #\shift
-sqshrn2 v0.8h, v18.4s, #\shift
+sqshrn  v0.4h, v16.4s, 14
+sqshrn2 v0.8h, v18.4s, 14
 .else
-shrnv0.4h, v16.4s, #\shift
-shrn2   v0.8h, v18.4s, #\shift
+shrnv0.4h, v16.4s, 14
+shrn2   v0.8h, v18.4s, 14
 .endif
 subsw1, w1, #8
 st1 {v0.8h}, [x0], #16
@@ -49,13 +50,15 @@ function ff_\name, export=1
 endfunc
 .endm
 
-.macro chrConvertRange name, fromto, mult, offset, shift
-function ff_\name, export=1
-mov w3, #\mult
+.macro chrConvertRange fromto
+function ff_chrRange\fromto\()Jpeg_neon, export=1
+// x0  int16_t *dstU
+// x1  int16_t *dstV
+// w2  int width
+// w3  uint32_t coeff
+// x4  int64_t offset
 dup v25.4s, w3
-movzw3, #(\offset & 0x)
-movkw3, #((\offset >> 16) & 0x), lsl #16
-dup v26.4s, w3
+dup v26.4s, w4
 1:
 ld1 {v0.8h}, [x0]
 ld1 {v1.8h}, [x1]
@@ -72,15 +75,15 @@ function ff_\name, export=1
 mla v18.4s, v22.4s, v25.4s
 mla v19.4s, v23.4s, v25.4s
 .ifc \fromto, To
-sqshrn  v0.4h, v16.4s, #\shift
-sqshrn  v1.4h, v17.4s, #\shift
-sqshrn2 v0.8h, v18.4s, #\shift
-sqshrn2 v1.8h, v19.4s, #\shift
+sqshrn  v0.4h, v16.4s, 14
+sqshrn  v1.4h, v17.4s, 14
+sqshrn2 v0.8h, v18.4s, 14
+sqshrn2 v1.8h, v19.4s, 14
 .else
-shrnv0.4h, v16.4s, #\shift
-shrnv1.4h, v17.4s, #\shift
-shrn2   v0.8h, v18.4s, #\shift
-shrn2   v1.8h, v19.4s, #\shift
+shrnv0.4h, v16.4s, 14
+shrnv1.4h, v17.4s, 14
+shrn2   v0.8h, v18.4s, 14
+shrn2   v1.8h, v19.4s, 14
 .endif
 subsw2, w2, #8
 st1 {v0.8h}, [x0], #16
@@ -90,7 +93,7 @@ function ff_\name, export=1
 endfunc
 .endm
 
-lumConvertRange lumRangeToJpeg_neon,   To,   19077, -39057361, 14
-chrConvertRange chrRangeToJpeg_neon,   To,4663,  -9289992, 12
-lumConvertRange lumRangeFromJpeg_neon, From, 14071,  33561947, 14
-chrConvertRange chrRangeFromJpeg_neon, From,  1799,   4081085, 11
+lumConvertRange To
+chrConvertRange To
+lumConvertRange From
+chrConvertRange From
diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index 1fce77df26..b8679734c4 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -218,17 +218,17 @@ NEON_INPUT(bgra32);
 NEON_INPUT(rgb24);
 NEON_INPUT(rgba32);
 
-void ff_lumRangeFromJpeg_neon(int16_t *dst, int width);
-void ff_chrRangeFromJpeg_neon(int16_t *dstU, int16_t *dstV, int width);
-void ff_lumR