Re: [FFmpeg-devel] [PATCH] swscale/output: add full chroma interpolation support for x2rgb10

2024-11-01 Thread Michael Niedermayer
On Fri, Nov 01, 2024 at 10:29:07AM -0300, James Almer wrote:
> On 11/1/2024 8:27 AM, Michael Niedermayer wrote:
> > On Wed, Oct 30, 2024 at 12:20:19PM -0300, James Almer wrote:
> > > Signed-off-by: James Almer 
> > > ---
> > >   libswscale/output.c | 25 +
> > >   libswscale/utils.c  |  4 +++-
> > >   tests/ref/fate/filter-pixfmts-scale |  4 ++--
> > >   3 files changed, 30 insertions(+), 3 deletions(-)
> > 
> > LGTM
> > 
> > thx
> 
> I updated https://github.com/jamrial/FFmpeg/commits/pixdesc/ if you want to
> look at all the recent patches i sent in a single branch.

your pixdesc branch seems working fine
(with "fate/vvc: Add a sample which lose frames before 5c66a3" reverted)

tested on linux x86-32/64, mingw32/64, mips & arm

thx

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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] swscale/output: add XV48 output support

2024-11-01 Thread Michael Niedermayer
On Thu, Oct 31, 2024 at 04:13:38PM -0300, James Almer wrote:
> On 10/31/2024 3:34 PM, Michael Niedermayer wrote:
> > On Tue, Oct 29, 2024 at 04:50:47PM -0300, James Almer wrote:
> > > On 10/29/2024 4:29 PM, Michael Niedermayer wrote:
> > > > On Tue, Oct 29, 2024 at 01:03:21PM +0100, Michael Niedermayer wrote:
> > > > > On Fri, Oct 25, 2024 at 07:56:29PM -0300, James Almer wrote:
> > > > > > On 10/25/2024 7:18 PM, Michael Niedermayer wrote:
> > > > > > > On Wed, Oct 23, 2024 at 04:36:44PM -0300, James Almer wrote:
> > > > > > > > Signed-off-by: James Almer 
> > > > > > > > ---
> > > > > > > > libswscale/output.c  | 37 
> > > > > > > > +++-
> > > > > > > > libswscale/utils.c   |  4 +--
> > > > > > > > tests/ref/fate/filter-pixdesc-xv48be |  1 +
> > > > > > > > tests/ref/fate/filter-pixdesc-xv48le |  1 +
> > > > > > > > tests/ref/fate/filter-pixfmts-copy   |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-crop   |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-field  |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-fieldorder |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-hflip  |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-il |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-null   |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-scale  |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-transpose  |  2 ++
> > > > > > > > tests/ref/fate/filter-pixfmts-vflip  |  2 ++
> > > > > > > > 14 files changed, 48 insertions(+), 15 deletions(-)
> > > > > > > > create mode 100644 tests/ref/fate/filter-pixdesc-xv48be
> > > > > > > > create mode 100644 tests/ref/fate/filter-pixdesc-xv48le
> > > > > > > 
> > > > > > > didnt apply cleanly so no test but LGTM
> > > > > > > 
> > > > > > > thx
> > > > > > 
> > > > > > It was Niklas recent renaming patch. You can try a rebased version 
> > > > > > in
> > > > > 
> > > > > > https://github.com/jamrial/FFmpeg/commits/pixdesc/
> > > > > 
> > > > > thanks, that helped, swscale patches seem turning stale within the 
> > > > > 500ms
> > > > > transit time to the ML
> > > > > 
> > > > > the swscale changes in that branch look good
> > > > > tests seems passing on mingw32/64 linux x86-32/64 and mips
> > > > 
> > > > i had to leave before qemu arm tests finished and of course arm faild :)
> > > > 
> > > > make fate-pixfmt-x2bgr10le fate-pixfmt-x2rgb10le -k
> > > > TESTpixfmt-x2bgr10le
> > > > --- src/tests/ref/fate/pixfmt-x2bgr10le 2024-10-29 20:26:42.011219228 
> > > > +0100
> > > > +++ tests/data/fate/pixfmt-x2bgr10le2024-10-29 20:28:11.519912980 
> > > > +0100
> > > > @@ -1,2 +1,2 @@
> > > > -028652e885aef68639341bbc8415be57 *tests/data/pixfmt/x2bgr10le.yuv
> > > > +040ceb964e1401b964d72f97c44ca596 *tests/data/pixfmt/x2bgr10le.yuv
> > > >15206400 tests/data/pixfmt/x2bgr10le.yuv
> > > > Test pixfmt-x2bgr10le failed. Look at 
> > > > tests/data/fate/pixfmt-x2bgr10le.err for details.
> > > > make: *** [src/tests/Makefile:311: fate-pixfmt-x2bgr10le] Error 1
> > > > TESTpixfmt-x2rgb10le
> > > > --- src/tests/ref/fate/pixfmt-x2rgb10le 2024-10-29 20:26:42.011219228 
> > > > +0100
> > > > +++ tests/data/fate/pixfmt-x2rgb10le2024-10-29 20:28:12.371919593 
> > > > +0100
> > > > @@ -1,2 +1,2 @@
> > > > -028652e885aef68639341bbc8415be57 *tests/data/pixfmt/x2rgb10le.yuv
> > > > +040ceb964e1401b964d72f97c44ca596 *tests/data/pixfmt/x2rgb10le.yuv
> > > >15206400 tests/data/pixfmt/x2rgb10le.yuv
> > > > Test pixfmt-x2rgb10le failed. Look at 
> > > > tests/data/fate/pixfmt-x2rgb10le.err for details.
> > > > make: *** [src/tests/Makefile:311: fate-pixfmt-x2rgb10le] Error 1
> > > > 
> > > > thx
> > > 
> > > That is a test from a patch i didn't push, so not a problem in git head at
> > > least.
> > > 
> > > Is that a BE arm machine?
> > 
> > no
> > 
> > 
> > > The only thing i can think about is the check in
> > > swscale/output.c for AV_PIX_FMT_X2RGB10, which for that target would 
> > > become
> > > AV_PIX_FMT_X2RGB10BE, and thus not trigger with this test.
> > > This is IMO wrong because the yuv2packed* pointers are in turn set for 
> > > both
> > > LE and BE.
> > 
> > arm has some funny behavior with misaligned 32bit access
> > that is IIRC, if you cast a uint8_t * to int *  and it was not an address 
> > thats
> > a multiple of 4 and derefernce you can get results that you dont expect 
> > IIRC.
> > 
> > if that makes no sense then i dont know, but tell me and ill just
> > retest
> 
> I tried applying the patch adding this test and running it under gcc-ubsan
> and it didn't complain about unaligned accesses, so i don't know what could
> be happening if that target is not BE.

patch doesnt apply anymore but your pixdesc branch worked fine on arm

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"Nothing to hide" only works if the fo

Re: [FFmpeg-devel] [PATCH] avformat/vpk: fix divide by zero

2024-11-01 Thread Michael Niedermayer
Hi

On Fri, Nov 01, 2024 at 02:20:33PM +0100, Kacper Michajlow wrote:
> On Sat, 10 Aug 2024 at 18:49, Kacper Michajlow  wrote:
> >
> > On Sat, 10 Aug 2024 at 11:25, Andreas Rheinhardt
> >  wrote:
> > >
> > > Kacper Michajlow:
> > > > On Fri, 9 Aug 2024 at 22:51, Michael Niedermayer 
> > > >  wrote:
> > > >>
> > > >> On Wed, Aug 07, 2024 at 03:42:46PM +0200, Kacper Michajłow wrote:
> > > >>> Can happen after calling avformat_find_stream_info() when the codec
> > > >>> fails to open, but return value is 0 and subsequent uses of this 
> > > >>> context
> > > >>> have zero value in channel number.
> > > >>>
> > > >>> Found by OSS-Fuzz.
> > > >>>
> > > >>> Signed-off-by: Kacper Michajłow 
> > > >>> ---
> > > >>>  libavformat/vpk.c | 2 ++
> > > >>>  1 file changed, 2 insertions(+)
> > > >>>
> > > >>> diff --git a/libavformat/vpk.c b/libavformat/vpk.c
> > > >>> index 001ad33555..aa98ef2dd4 100644
> > > >>> --- a/libavformat/vpk.c
> > > >>> +++ b/libavformat/vpk.c
> > > >>> @@ -86,6 +86,8 @@ static int vpk_read_packet(AVFormatContext *s, 
> > > >>> AVPacket *pkt)
> > > >>>
> > > >>>  vpk->current_block++;
> > > >>>  if (vpk->current_block == vpk->block_count) {
> > > >>> +if (par->ch_layout.nb_channels <= 0)
> > > >>> +return AVERROR_INVALIDDATA;
> > > >>>  unsigned size = vpk->last_block_size / 
> > > >>> par->ch_layout.nb_channels;
> > > >>>  unsigned skip = (par->block_align - vpk->last_block_size) / 
> > > >>> par->ch_layout.nb_channels;
> > > >>>  uint64_t pos = avio_tell(s->pb);
> > > >>
> > > >> iam not sure if a parser or other should replace a valid set of
> > > >> parameters by an invalid
> > > >> (this patch implies that such a action occured)
> > > >>
> > > >> can you explain more detailedly by what and why channels is set to 0 ?
> > > >>
> > > >
> > > > You are right, it might be better to improve this to not override the
> > > > params. Let me explain what happens, I didn't read through the whole
> > > > avformat_find_stream_info() to know what would be the best approach
> > > > yet. I will try to look at it, but if you have immediate ideas, that
> > > > would be nice.
> > > >
> > > > 1. avformat_open_input() sets nb_channels to 108
> > > >
> > > > 2. Just after that we call avformat_find_stream_info(avfc, NULL); this
> > > > returns 0 (success), but as a result it overrides params already
> > > > present in the context.
> > > > log for reference, during the find stream info call
> > > > [ffmpeg/demuxer] vpk: Before avformat_find_stream_info() pos:
> > > > 538976288 bytes read:21 seeks:1 nb_streams:1
> > > > [ffmpeg/demuxer] vpk: Failed to open codec in avformat_find_stream_info
> > > > [lavf] mp_seek(0x51218090, 0, size)
> > > > [lavf] 0=mp_read(0x51218090, 0x7fe4c7ce8800, 5000), pos:
> > > > 538976288, eof:1
> > > > [lavf] 0=mp_read(0x51218090, 0x52d0a400, 32768), pos: 
> > > > 538976288, eof:1
> > > > [ffmpeg/audio] adpcm_psx: Decoder requires channel layout to be set
> > > > [ffmpeg/demuxer] vpk: Failed to open codec in avformat_find_stream_info
> > > > [lavf] mp_seek(0x51218090, 0, size)
> > > > [lavf] mp_seek(0x51218090, 0, size)
> > > > [lavf] mp_seek(0x51218090, 0, size)
> > > > [ffmpeg/demuxer] vpk: stream 0: start_time: NOPTS duration: 0.069852
> > > > [ffmpeg/demuxer] vpk: format: start_time: NOPTS duration: 0.069852
> > > > (estimate from stream) bitrate=2 kb/s
> > > > [ffmpeg/demuxer] vpk: Could not find codec parameters for stream 0
> > > > (Audio: adpcm_psx, 538976288 Hz, 0 channels): unspecified sample
> > > > format
> > > > [ffmpeg/demuxer] Consider increasing the value for the
> > > > 'analyzeduration' (0) and 'probesize' (500) options
> > > > [ffmpeg/demuxer] vpk: After avformat_find_stream_info() pos: 538976288
> > > > bytes read:21 seeks:1 frames:0
> > > >
> > > > 3. the nb_channels value is cleared in avformat_find_stream_info() ->
> > > > avcodec_parameters_from_context() -> codec_parameters_reset() and
> > > > remains 0.
> > >
> > > This seems like the error: Why is AVCodecParameters being set from an
> > > AVCodecContext if the codec could not be successfully opened?
> >
> > avcodec_open2() is only emitting a warning, no other action taken.
> > https://github.com/FFmpeg/FFmpeg/blob/1b8d95da3a4a5c9441238928a36b653da693c286/libavformat/demux.c#L2603-L2605
> >
> > later "some" things happen, but I think we could check if we have
> > codec params before assigning them
> >
> > diff --git a/libavformat/demux.c b/libavformat/demux.c
> > index dc65f9ad91..e8785304ca 100644
> > --- a/libavformat/demux.c
> > +++ b/libavformat/demux.c
> > @@ -3038,7 +3038,7 @@ int avformat_find_stream_info(AVFormatContext
> > *ic, AVDictionary **options)
> > AVStream *const st = ic->streams[i];
> > FFStream *const sti = ffstream(st);
> >
> > - if (sti->avctx_inited) {
> > + if (sti->avctx_inited && has_codec_parameters(sti, NULL)) {
> > ret = avcodec_parameters_from_context(st->codecpar, sti->avctx);
> > if (ret < 0)

Re: [FFmpeg-devel] [PATCH] libavutil/ppc: Include the hardware feature flags like the other archs

2024-11-01 Thread Michael Niedermayer
On Fri, Nov 01, 2024 at 01:45:46AM -0400, Brad Smith wrote:
> ping.

it builds on my old cross compile environment on ubuntu
but i have no real ppc here to test beyond that

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] avcodec/aac/aacdec: set profile after decoding an audio specific config

2024-11-01 Thread Xiaolei Yu
Fix the reported profile when probing an fMP4 initialization segment
---
 libavcodec/aac/aacdec.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c
index f6e79700d5..a779b47b39 100644
--- a/libavcodec/aac/aacdec.c
+++ b/libavcodec/aac/aacdec.c
@@ -1063,6 +1063,13 @@ static int decode_audio_specific_config_gb(AACDecContext 
*ac,
 return AVERROR(ENOSYS);
 }
 
+if (m4ac->ps)
+avctx->profile = AV_PROFILE_AAC_HE_V2;
+else if (m4ac->ext_object_type != AOT_NULL)
+avctx->profile = m4ac->ext_object_type - 1;
+else
+avctx->profile = m4ac->object_type - 1;
+
 ff_dlog(avctx,
 "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
 m4ac->object_type, m4ac->chan_config, m4ac->sampling_index,
-- 
2.45.2
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] x86/vvc: Fix build error for arch x86_32

2024-11-01 Thread Zhao Zhili
From: Zhao Zhili 

There were static functions which built for x86_32, but the simd
functions they reference only available for x86_64.
---
 libavcodec/x86/vvc/vvcdsp_init.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c
index f3e2e3a27b..7b6aa50676 100644
--- a/libavcodec/x86/vvc/vvcdsp_init.c
+++ b/libavcodec/x86/vvc/vvcdsp_init.c
@@ -30,6 +30,8 @@
 #include "libavcodec/vvc/dsp.h"
 #include "libavcodec/x86/h26x/h2656dsp.h"
 
+#if ARCH_X86_64
+
 #define PUT_PROTOTYPE(name, depth, opt) \
 void ff_vvc_put_ ## name ## _ ## depth ## _##opt(int16_t *dst, const uint8_t 
*src, ptrdiff_t srcstride, int height, const int8_t *hf, const int8_t *vf, int 
width);
 
@@ -356,6 +358,9 @@ int ff_vvc_sad_avx2(const int16_t *src0, const int16_t 
*src1, int dx, int dy, in
 #define SAD_INIT() c->inter.sad = ff_vvc_sad_avx2
 #endif
 
+
+#endif // ARCH_X86_64
+
 void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd)
 {
 #if ARCH_X86_64
-- 
2.34.1

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

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] fate/vvc: Add a sample which lose frames before 5c66a3

2024-11-01 Thread Zhao Zhili

> 在 2024年11月2日,上午7:01,Michael Niedermayer  写道:
> 
> On Fri, Nov 01, 2024 at 09:11:47AM +, Zhao Zhili wrote:
>> ffmpeg | branch: master | Zhao Zhili  | Wed Sep 18 
>> 14:56:22 2024 +0800| [1864025458021a2d2c542f56e268ee1106f84460] | committer: 
>> Zhao Zhili
>> fate/vvc: Add a sample which lose frames before 5c66a3
>> Signed-off-by: Zhao Zhili 
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1864025458021a2d2c542f56e268ee1106f84460
>> ---
>> tests/fate/vvc.mak|  3 ++-
>> tests/ref/fate/vvc-output-ref | 35 +++
>> 2 files changed, 37 insertions(+), 1 deletion(-)
> 
> this breaks on x86-32
> 
> --- src/tests/ref/fate/vvc-output-ref2024-11-01 23:57:17.138355344 +0100
> +++ tests/data/fate/vvc-output-ref2024-11-01 23:57:43.014716555 +0100
> @@ -4,32 +4,32 @@
> #dimensions 0: 480x320
> #sar 0: 0/1
> 0,  0,  0,1,   230400, 0x3293f7f1
> -0,  1,  1,1,   230400, 0xe2570fa4
> -0,  2,  2,1,   230400, 0xecd608fb
> -0,  3,  3,1,   230400, 0xea46f9f4
> -0,  4,  4,1,   230400, 0xb715d24a
> -0,  5,  5,1,   230400, 0x69faaf46
> -0,  6,  6,1,   230400, 0xf9a362db
> -0,  7,  7,1,   230400, 0x2dcd19ca
> -0,  8,  8,1,   230400, 0xf8fda185
> -0,  9,  9,1,   230400, 0x48a35bfd
> +0,  1,  1,1,   230400, 0x627008c8
> +0,  2,  2,1,   230400, 0x6ed9fa1b
> +0,  3,  3,1,   230400, 0xf49ce95a
> +0,  4,  4,1,   230400, 0x3886bf16
> +0,  5,  5,1,   230400, 0x67fe9745
> +0,  6,  6,1,   230400, 0xfbd5466d
> +0,  7,  7,1,   230400, 0xcc74fbec
> +0,  8,  8,1,   230400, 0x37f18143
> +0,  9,  9,1,   230400, 0xe99c39c8
> 0, 10, 10,1,   230400, 0x27efe832
> -0, 11, 11,1,   230400, 0x74279617
> -0, 12, 12,1,   230400, 0x91935248
> -0, 13, 13,1,   230400, 0x29b621e6
> -0, 14, 14,1,   230400, 0x89b1ec0b
> -0, 15, 15,1,   230400, 0x898fdba1
> -0, 16, 16,1,   230400, 0xc6d18e6f
> -0, 17, 17,1,   230400, 0xedff651b
> -0, 18, 18,1,   230400, 0x677e2260
> -0, 19, 19,1,   230400, 0x930918ef
> +0, 11, 11,1,   230400, 0x87ee9347
> +0, 12, 12,1,   230400, 0x05b240ac
> +0, 13, 13,1,   230400, 0x9c3c0fe9
> +0, 14, 14,1,   230400, 0x83e3dbff
> +0, 15, 15,1,   230400, 0xa760d011
> +0, 16, 16,1,   230400, 0xaa73859a
> +0, 17, 17,1,   230400, 0x22875e87
> +0, 18, 18,1,   230400, 0x08af1bb6
> +0, 19, 19,1,   230400, 0x761d10dc
> 0, 20, 20,1,   230400, 0x70da2c30
> -0, 21, 21,1,   230400, 0x699a3b9d
> -0, 22, 22,1,   230400, 0xff3b1b3a
> -0, 23, 23,1,   230400, 0xca11d9a5
> -0, 24, 24,1,   230400, 0x904394e0
> -0, 25, 25,1,   230400, 0x392e5445
> -0, 26, 26,1,   230400, 0x6191f4d8
> -0, 27, 27,1,   230400, 0xa7d7be12
> -0, 28, 28,1,   230400, 0xbb29752c
> -0, 29, 29,1,   230400, 0x14ff297e
> +0, 21, 21,1,   230400, 0xf126321e
> +0, 22, 22,1,   230400, 0x80ea0742
> +0, 23, 23,1,   230400, 0x68a4cb1f
> +0, 24, 24,1,   230400, 0xe2e97a53
> +0, 25, 25,1,   230400, 0xc9cb338a
> +0, 26, 26,1,   230400, 0x7fe6d117
> +0, 27, 27,1,   230400, 0x5b1898de
> +0, 28, 28,1,   230400, 0x6a005043
> +0, 29, 29,1,   230400, 0xa282ff6d
> Test vvc-output-ref failed. Look at tests/data/fate/vvc-output-ref.err for 
> details.
> make: *** [src/tests/Makefile:311: fate-vvc-output-ref] Error 1

There are visible artifacts with x86-32, I think the test catch a real bug. cc 
nuomi.
 
> 
> thx
> 
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Concerning the gods, I have no means of knowing whether they exist or not
> or of what sort they may be, because of the obscurity of the subject, and
> the brevity of human life -- Protagoras
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> 

[FFmpeg-devel] [PATCH] doc/Makefile: add MAKEINFO variable

2024-11-01 Thread Patrice Dumas
Here is a small patch that I propose, to be able to test another version
of makeinfo more easily.

---
 doc/Makefile | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/Makefile b/doc/Makefile
index 98d29f1c66..cd397b518c 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -49,11 +49,12 @@ apidoc: doc/doxy/html
 documentation: $(DOCS)
 
 TEXIDEP = perl $(SRC_PATH)/doc/texidep.pl $(SRC_PATH) $< $@ >$(@:%=%.d)
+MAKEINFO = makeinfo
 
 doc/%.txt: TAG = TXT
 doc/%.txt: doc/%.texi
$(Q)$(TEXIDEP)
-   $(M)makeinfo --force --no-headers -o $@ $< 2>/dev/null
+   $(M)$(MAKEINFO) --force --no-headers -o $@ $< 2>/dev/null
 
 GENTEXI  = format codec
 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
@@ -68,11 +69,11 @@ doc/%-all.html: TAG = HTML
 ifdef HAVE_MAKEINFO_HTML
 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.pm $(GENTEXI)
$(Q)$(TEXIDEP)
-   $(M)makeinfo --html -I doc --no-split -D config-not-all 
--init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
+   $(M)$(MAKEINFO) --html -I doc --no-split -D config-not-all 
--init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
 
 doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.pm $(GENTEXI)
$(Q)$(TEXIDEP)
-   $(M)makeinfo --html -I doc --no-split -D config-all 
--init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
+   $(M)$(MAKEINFO) --html -I doc --no-split -D config-all 
--init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
 else
 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
$(Q)$(TEXIDEP)
-- 
2.45.2
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avformat/vpk: fix divide by zero

2024-11-01 Thread Kacper Michajlow
On Sat, 10 Aug 2024 at 18:49, Kacper Michajlow  wrote:
>
> On Sat, 10 Aug 2024 at 11:25, Andreas Rheinhardt
>  wrote:
> >
> > Kacper Michajlow:
> > > On Fri, 9 Aug 2024 at 22:51, Michael Niedermayer  
> > > wrote:
> > >>
> > >> On Wed, Aug 07, 2024 at 03:42:46PM +0200, Kacper Michajłow wrote:
> > >>> Can happen after calling avformat_find_stream_info() when the codec
> > >>> fails to open, but return value is 0 and subsequent uses of this context
> > >>> have zero value in channel number.
> > >>>
> > >>> Found by OSS-Fuzz.
> > >>>
> > >>> Signed-off-by: Kacper Michajłow 
> > >>> ---
> > >>>  libavformat/vpk.c | 2 ++
> > >>>  1 file changed, 2 insertions(+)
> > >>>
> > >>> diff --git a/libavformat/vpk.c b/libavformat/vpk.c
> > >>> index 001ad33555..aa98ef2dd4 100644
> > >>> --- a/libavformat/vpk.c
> > >>> +++ b/libavformat/vpk.c
> > >>> @@ -86,6 +86,8 @@ static int vpk_read_packet(AVFormatContext *s, 
> > >>> AVPacket *pkt)
> > >>>
> > >>>  vpk->current_block++;
> > >>>  if (vpk->current_block == vpk->block_count) {
> > >>> +if (par->ch_layout.nb_channels <= 0)
> > >>> +return AVERROR_INVALIDDATA;
> > >>>  unsigned size = vpk->last_block_size / 
> > >>> par->ch_layout.nb_channels;
> > >>>  unsigned skip = (par->block_align - vpk->last_block_size) / 
> > >>> par->ch_layout.nb_channels;
> > >>>  uint64_t pos = avio_tell(s->pb);
> > >>
> > >> iam not sure if a parser or other should replace a valid set of
> > >> parameters by an invalid
> > >> (this patch implies that such a action occured)
> > >>
> > >> can you explain more detailedly by what and why channels is set to 0 ?
> > >>
> > >
> > > You are right, it might be better to improve this to not override the
> > > params. Let me explain what happens, I didn't read through the whole
> > > avformat_find_stream_info() to know what would be the best approach
> > > yet. I will try to look at it, but if you have immediate ideas, that
> > > would be nice.
> > >
> > > 1. avformat_open_input() sets nb_channels to 108
> > >
> > > 2. Just after that we call avformat_find_stream_info(avfc, NULL); this
> > > returns 0 (success), but as a result it overrides params already
> > > present in the context.
> > > log for reference, during the find stream info call
> > > [ffmpeg/demuxer] vpk: Before avformat_find_stream_info() pos:
> > > 538976288 bytes read:21 seeks:1 nb_streams:1
> > > [ffmpeg/demuxer] vpk: Failed to open codec in avformat_find_stream_info
> > > [lavf] mp_seek(0x51218090, 0, size)
> > > [lavf] 0=mp_read(0x51218090, 0x7fe4c7ce8800, 5000), pos:
> > > 538976288, eof:1
> > > [lavf] 0=mp_read(0x51218090, 0x52d0a400, 32768), pos: 538976288, 
> > > eof:1
> > > [ffmpeg/audio] adpcm_psx: Decoder requires channel layout to be set
> > > [ffmpeg/demuxer] vpk: Failed to open codec in avformat_find_stream_info
> > > [lavf] mp_seek(0x51218090, 0, size)
> > > [lavf] mp_seek(0x51218090, 0, size)
> > > [lavf] mp_seek(0x51218090, 0, size)
> > > [ffmpeg/demuxer] vpk: stream 0: start_time: NOPTS duration: 0.069852
> > > [ffmpeg/demuxer] vpk: format: start_time: NOPTS duration: 0.069852
> > > (estimate from stream) bitrate=2 kb/s
> > > [ffmpeg/demuxer] vpk: Could not find codec parameters for stream 0
> > > (Audio: adpcm_psx, 538976288 Hz, 0 channels): unspecified sample
> > > format
> > > [ffmpeg/demuxer] Consider increasing the value for the
> > > 'analyzeduration' (0) and 'probesize' (500) options
> > > [ffmpeg/demuxer] vpk: After avformat_find_stream_info() pos: 538976288
> > > bytes read:21 seeks:1 frames:0
> > >
> > > 3. the nb_channels value is cleared in avformat_find_stream_info() ->
> > > avcodec_parameters_from_context() -> codec_parameters_reset() and
> > > remains 0.
> >
> > This seems like the error: Why is AVCodecParameters being set from an
> > AVCodecContext if the codec could not be successfully opened?
>
> avcodec_open2() is only emitting a warning, no other action taken.
> https://github.com/FFmpeg/FFmpeg/blob/1b8d95da3a4a5c9441238928a36b653da693c286/libavformat/demux.c#L2603-L2605
>
> later "some" things happen, but I think we could check if we have
> codec params before assigning them
>
> diff --git a/libavformat/demux.c b/libavformat/demux.c
> index dc65f9ad91..e8785304ca 100644
> --- a/libavformat/demux.c
> +++ b/libavformat/demux.c
> @@ -3038,7 +3038,7 @@ int avformat_find_stream_info(AVFormatContext
> *ic, AVDictionary **options)
> AVStream *const st = ic->streams[i];
> FFStream *const sti = ffstream(st);
>
> - if (sti->avctx_inited) {
> + if (sti->avctx_inited && has_codec_parameters(sti, NULL)) {
> ret = avcodec_parameters_from_context(st->codecpar, sti->avctx);
> if (ret < 0)
> goto find_stream_info_err;
>
> But the question is if we want to preserve old values in case of
> failed open or clear those values to indicate that really there are no
> valid parameters, because we failed to open the codec with current
> ones.
>
> - Kacper
>
> > >
> > > 4. as we can see th

Re: [FFmpeg-devel] [PATCH] swscale/output: fix x2rbg10/x2bgr10 output

2024-11-01 Thread James Almer

On 11/1/2024 1:52 PM, Michael Niedermayer wrote:

On Tue, Oct 29, 2024 at 07:19:13PM -0300, James Almer wrote:

Checking for AV_PIX_FMT_X2RGB10 means the condition will succeed only for the
version matching the host's endinaness, when only LE is supported, and thus
the wrong path will be taken on BE systems.

Signed-off-by: James Almer 
---
  libswscale/output.c | 12 +---
  1 file changed, 5 insertions(+), 7 deletions(-)


breaks (qemu) mips

--- src/tests/ref/fate/filter-pixdesc-x2rgb10le 2024-10-26 22:34:14.532454440 
+0200
+++ tests/data/fate/filter-pixdesc-x2rgb10le2024-11-01 17:50:04.659478576 
+0100
@@ -1 +1 @@
-pixdesc-x2rgb10le   d34a93b55f4041742b95837b272e
+pixdesc-x2rgb10le   45f6ccc4efa56ae1b38f4741b12e1a75
Test filter-pixdesc-x2rgb10le failed. Look at 
tests/data/fate/filter-pixdesc-x2rgb10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2rgb10le] Error 1
make: *** Waiting for unfinished jobs
--- src/tests/ref/fate/filter-pixdesc-x2bgr10le 2024-10-26 22:34:14.532454440 
+0200
+++ tests/data/fate/filter-pixdesc-x2bgr10le2024-11-01 17:50:04.675478694 
+0100
@@ -1 +1 @@
-pixdesc-x2bgr10le   0ea287ba7ea42330714e7020f2fde7d0
+pixdesc-x2bgr10le   f9ce2cc71dc00df2c212b68caf181765
Test filter-pixdesc-x2bgr10le failed. Look at 
tests/data/fate/filter-pixdesc-x2bgr10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2bgr10le] Error 1


I see now that ff_yuv2rgb_c_init_tables() byteswaps the tables, so i 
guess this change isn't needed and I'm dropping it (Updated the branch 
as well).




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

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


[FFmpeg-devel] [PATCH v2 3/3] avcodec/cuvid: introduce a ringbuffer to reattach additional data

2024-11-01 Thread Clément Péron
From: Troy Benson 

Cuvid data packet have specific format that don't contain any side data.
In order to keep additional information and metadata, we need to implement
a ring buffer and reattach side data to decoded frame.

Signed-off-by: Troy Benson 
Signed-off-by: Clément Péron 
---
 libavcodec/cuviddec.c | 175 ++
 1 file changed, 175 insertions(+)

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 3fae9c12eb..464da4d2f4 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -51,6 +51,162 @@
 #define CUVID_HAS_AV1_SUPPORT
 #endif
 
+/// @brief Structure to store source packets.
+/// This struct implements a circular buffer to store source packets.
+/// The packets are packets that have already been sent to the decoder.
+/// The reason we need the packets is because they may contain additional 
information and metadata,
+/// that we need to attach to the decoded frame so that the muxers and filters 
can use it.
+typedef struct sourcePkts
+{
+/// @brief Array of AVPackets.
+AVPacket **pkts;
+/// @brief Number of packets to store.
+int capacity;
+/// @brief Index of the first packet.
+int start_idx;
+/// @brief Number of packets stored. (typically we found while testing 
that this hovers around 8)
+int count;
+} sourcePkts;
+
+/// @brief Allocates a sourcePkts structure.
+/// @param avctx - AVCodecContext (for logging)
+/// @param source_pkts (output)
+/// @param capacity - number of pkts to store
+/// @return int = 0 on success, < 0 on error
+int sourcePkts_alloc(AVCodecContext *avctx, sourcePkts *source_pkts, int 
capacity);
+
+/// @brief Clears the sourcePkts structure of pkts with pts less than the 
given pts.
+/// @param avctx - AVCodecContext (for logging)
+/// @param source_pkts - sourcePkts structure
+/// @param pts - pts to clear pkts before
+/// @return int = 0 on success, < 0 on error
+int sourcePkts_clear(AVCodecContext *avctx, sourcePkts *source_pkts, int64_t 
pts);
+
+/// @brief Converts a logical index to a physical index.
+/// @param source_pkts - sourcePkts structure
+/// @param idx - logical index
+/// @return int - physical index
+int sourcePkts_idx(sourcePkts *source_pkts, int idx);
+
+/// @brief Adds a pkt to the sourcePkts structure.
+/// @param avctx - AVCodecContext (for logging)
+/// @param source_pkts - sourcePkts structure
+/// @param pkt - AVPacket to add
+/// @return int = 0 on success, < 0 on error
+int sourcePkts_add(AVCodecContext *avctx, sourcePkts *source_pkts, AVPacket 
*pkt);
+
+/// @brief Clears the sourcePkts structure.
+/// @param avctx - AVCodecContext (for logging)
+/// @param source_pkts - sourcePkts structure
+/// @return int = 0 on success, < 0 on error
+int sourcePkts_free(AVCodecContext *avctx, sourcePkts *source_pkts);
+
+/// @brief Finds a pkt with the given pts.
+/// @param avctx - AVCodecContext (for logging)
+/// @param source_pkts - sourcePkts structure
+/// @param pts - pts to find
+/// @return int - physical index of pkt, -1 if not found
+int sourcePkts_find(AVCodecContext *avctx, sourcePkts *source_pkts, int64_t 
pts);
+
+int sourcePkts_alloc(AVCodecContext *avctx, sourcePkts *source_pkts, int 
capacity)
+{
+assert(source_pkts->pkts == NULL);
+source_pkts->pkts = av_malloc_array(capacity, sizeof(AVPacket *));
+if (!source_pkts->pkts)
+return AVERROR(ENOMEM);
+
+source_pkts->capacity = capacity;
+source_pkts->start_idx = 0;
+source_pkts->count = 0;
+
+av_log(avctx, AV_LOG_TRACE, "sourcePkts_alloc: capacity: %d\n", capacity);
+
+return 0;
+}
+
+// Converts a logical index to a physical index.
+int sourcePkts_idx(sourcePkts *source_pkts, int idx)
+{
+return (source_pkts->start_idx + idx) % source_pkts->capacity;
+}
+
+int sourcePkts_find(AVCodecContext *avctx, sourcePkts *source_pkts, int64_t 
pts)
+{
+for (int i = 0; i < source_pkts->count; i++)
+{
+int idx = sourcePkts_idx(source_pkts, i);
+av_log(avctx, AV_LOG_TRACE, "sourcePkts_find: idx: %d, pts: %ld == 
%ld\n", idx, source_pkts->pkts[idx]->pts, pts);
+if (source_pkts->pkts[idx]->pts == pts)
+return idx;
+}
+
+return -1;
+}
+
+int sourcePkts_add(AVCodecContext *avctx, sourcePkts *source_pkts, AVPacket 
*pkt)
+{
+int ret = 0;
+int idx = 0;
+
+if (!pkt || pkt->pts == AV_NOPTS_VALUE) return ret;
+
+if (sourcePkts_find(avctx, source_pkts, pkt->pts) >= 0)
+{
+av_log(avctx, AV_LOG_TRACE, "sourcePkts_add: pkt already exists, pts: 
%ld\n", pkt->pts);
+return ret;
+}
+
+if (source_pkts->capacity == source_pkts->count)
+{
+av_log(avctx, AV_LOG_TRACE, "sourcePkts_add: capacity reached, 
clearing old pkts\n");
+ret = sourcePkts_clear(avctx, source_pkts, pkt->pts);
+if (ret < 0) return ret;
+}
+
+idx = sourcePkts_idx(source_pkts, source_pkts->count);
+source_pkts->pkts[idx] = av_packet_clone(pkt);
+if (!source_pkts->pkts[idx]) return AVE

[FFmpeg-devel] [PATCH v2 1/3] libavutil/frame: Introduce a new AV_FRAME_DATA_PRFT

2024-11-01 Thread Clément Péron
This will be used to propagate the Producer Reference Timestamp.

Signed-off-by: Clément Péron 
---
 libavcodec/decode.c  | 1 +
 libavfilter/f_sidedata.c | 1 +
 libavutil/frame.c| 1 +
 libavutil/frame.h| 5 +
 4 files changed, 8 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 3380cb27cf..c00e7a62fc 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1523,6 +1523,7 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext 
*avctx,
 { AV_PKT_DATA_S12M_TIMECODE,  AV_FRAME_DATA_S12M_TIMECODE 
},
 { AV_PKT_DATA_SKIP_SAMPLES,   AV_FRAME_DATA_SKIP_SAMPLES },
 { AV_PKT_DATA_LCEVC,  AV_FRAME_DATA_LCEVC },
+{ AV_PKT_DATA_PRFT,   AV_FRAME_DATA_PRFT },
 { AV_PKT_DATA_NB }
 };
 
diff --git a/libavfilter/f_sidedata.c b/libavfilter/f_sidedata.c
index 23dffec803..c5691a1030 100644
--- a/libavfilter/f_sidedata.c
+++ b/libavfilter/f_sidedata.c
@@ -81,6 +81,7 @@ static const AVOption filt_name##_options[] = { \
 {   "DYNAMIC_HDR_VIVID",  "", 0, AV_OPT_TYPE_CONST,  
{.i64 = AV_FRAME_DATA_DYNAMIC_HDR_VIVID  }, 0, 0, FLAGS, .unit = "type" 
}, \
 {   "AMBIENT_VIEWING_ENVIRONMENT","", 0, AV_OPT_TYPE_CONST,  
{.i64 = AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT}, 0, 0, FLAGS, .unit = "type" 
}, \
 {   "VIDEO_HINT", "", 0, AV_OPT_TYPE_CONST,  
{.i64 = AV_FRAME_DATA_VIDEO_HINT }, 0, 0, FLAGS, .unit = "type" 
}, \
+{   "PRFT",   "", 0, AV_OPT_TYPE_CONST,  
{.i64 = AV_FRAME_DATA_PRFT   }, 0, 0, FLAGS, .unit = "type" 
}, \
 { NULL } \
 }
 
diff --git a/libavutil/frame.c b/libavutil/frame.c
index f0a0dba018..8cfd21df5b 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -48,6 +48,7 @@ static const AVSideDataDescriptor sd_props[] = {
 [AV_FRAME_DATA_DOVI_METADATA]   = { "Dolby Vision Metadata" },
 [AV_FRAME_DATA_LCEVC]   = { "LCEVC NAL data" },
 [AV_FRAME_DATA_VIEW_ID] = { "View ID" },
+[AV_FRAME_DATA_PRFT]= { "Producer time reference" 
},
 [AV_FRAME_DATA_STEREO3D]= { "Stereo 3D",   
 AV_SIDE_DATA_PROP_GLOBAL },
 [AV_FRAME_DATA_REPLAYGAIN]  = { "AVReplayGain",
 AV_SIDE_DATA_PROP_GLOBAL },
 [AV_FRAME_DATA_DISPLAYMATRIX]   = { "3x3 displaymatrix",   
 AV_SIDE_DATA_PROP_GLOBAL },
diff --git a/libavutil/frame.h b/libavutil/frame.h
index f7806566d5..25657e153f 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -243,6 +243,11 @@ enum AVFrameSideDataType {
  * The data is an int storing the view ID.
  */
 AV_FRAME_DATA_VIEW_ID,
+
+/**
+ * Producer time reference data in the form of the AVProducerReferenceTime 
struct.
+ */
+AV_FRAME_DATA_PRFT,
 };
 
 enum AVActiveFormatDescription {
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH v2 0/3] Propagate PRFT side data

2024-11-01 Thread Clément Péron
Hi,

This is in the continuity of the v1 that was sent in September.

The idea is to be able to access the Producer Timestamp aka PRFT
of a RTSP stream in the encoder to be able to write it in the final
file.

There is also a patch to be able to forward any side data when the
decoder used is cuvid.

Thanks for your comment,
Regards

Changes since v1:
 - Rebase on master
 - Add cuvid ringbuffer

Clément Péron (2):
  libavutil/frame: Introduce a new AV_FRAME_DATA_PRFT
  avcodec/rawenc: propagate the Producer Reference time

Troy Benson (1):
  avcodec/cuvid: introduce a ringbuffer to reattach additional data

 libavcodec/cuviddec.c| 175 +++
 libavcodec/decode.c  |   1 +
 libavcodec/rawenc.c  |  12 +++
 libavfilter/f_sidedata.c |   1 +
 libavutil/frame.c|   1 +
 libavutil/frame.h|   5 ++
 6 files changed, 195 insertions(+)

-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH v2 2/3] avcodec/rawenc: propagate the Producer Reference time

2024-11-01 Thread Clément Péron
The Producer Reference time contains the source time when the frame
has been produced. This is usefull in the muxer so propagate it.

Signed-off-by: Clément Péron 
---
 libavcodec/rawenc.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index 8c577006d9..f238c8e165 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -49,6 +49,8 @@ static av_cold int raw_encode_init(AVCodecContext *avctx)
 static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
   const AVFrame *frame, int *got_packet)
 {
+AVFrameSideData *side_data;
+
 int ret = av_image_get_buffer_size(frame->format,
frame->width, frame->height, 1);
 
@@ -78,6 +80,16 @@ static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
 }
 }
 *got_packet = 1;
+
+// Forward the PRFT to Mux
+side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_PRFT);
+if (side_data && side_data->size) {
+uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_PRFT, 
side_data->size);
+if (!buf)
+return AVERROR(ENOMEM);
+memcpy(buf, side_data->data, side_data->size);
+}
+
 return 0;
 }
 
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH] avcodec/jpegxl_parser: check entropy_decoder_read_symbol return value

2024-11-01 Thread Kacper Michajłow
Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow 
---
 libavcodec/jpegxl_parser.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c
index 8c45e1a1b7..746c429b9c 100644
--- a/libavcodec/jpegxl_parser.c
+++ b/libavcodec/jpegxl_parser.c
@@ -1311,7 +1311,7 @@ static int parse_frame_header(void *avctx, 
JXLParseContext *ctx, GetBitContext *
 // permuted toc
 if (get_bits1(gb)) {
 JXLEntropyDecoder dec;
-uint32_t end, lehmer = 0;
+int64_t end, lehmer = 0;
 ret = entropy_decoder_init(avctx, gb, &dec, 8);
 if (ret < 0)
 return ret;
@@ -1320,13 +1320,13 @@ static int parse_frame_header(void *avctx, 
JXLParseContext *ctx, GetBitContext *
 return AVERROR_BUFFER_TOO_SMALL;
 }
 end = entropy_decoder_read_symbol(gb, &dec, toc_context(toc_count));
-if (end > toc_count) {
+if (end < 0 || end > toc_count) {
 entropy_decoder_close(&dec);
 return AVERROR_INVALIDDATA;
 }
 for (uint32_t i = 0; i < end; i++) {
 lehmer = entropy_decoder_read_symbol(gb, &dec, 
toc_context(lehmer));
-if (get_bits_left(gb) < 0) {
+if (lehmer < 0 || get_bits_left(gb) < 0) {
 entropy_decoder_close(&dec);
 return AVERROR_BUFFER_TOO_SMALL;
 }
-- 
2.45.1

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

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


Re: [FFmpeg-devel] [PATCH 2/2] fate/filter-video: add more rgbtestsrc tests

2024-11-01 Thread James Almer

On 11/1/2024 1:44 PM, Michael Niedermayer wrote:

On Wed, Oct 30, 2024 at 10:25:42AM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  tests/fate/filter-video.mak| 12 
  tests/ref/fate/filter-rgbtestsrc-gbrp  | 10 ++
  tests/ref/fate/filter-rgbtestsrc-gbrp10| 10 ++
  tests/ref/fate/filter-rgbtestsrc-rgba  | 10 ++
  tests/ref/fate/filter-rgbtestsrc-x2rgb10le | 10 ++
  5 files changed, 52 insertions(+)
  create mode 100644 tests/ref/fate/filter-rgbtestsrc-gbrp
  create mode 100644 tests/ref/fate/filter-rgbtestsrc-gbrp10
  create mode 100644 tests/ref/fate/filter-rgbtestsrc-rgba
  create mode 100644 tests/ref/fate/filter-rgbtestsrc-x2rgb10le


mips is unhappy:

The filters 'Parsed_format_1' and 'format' do not have a common format and 
automatic conversion is disabled.
[fc#0 @ 0x7f000750] Error configuring filter graph: Invalid argument
[fc#0 @ 0x7f000750] Task finished with error code: -22 (Invalid argument)
[fc#0 @ 0x7f000750] Terminating thread with return code -22 (Invalid argument)
[vost#0:0/rawvideo @ 0x7f0028b0] [enc:rawvideo @ 0x7f002cc0] Could not open 
encoder before EOF
[vost#0:0/rawvideo @ 0x7f0028b0] Task finished with error code: -22 (Invalid 
argument)
[vost#0:0/rawvideo @ 0x7f0028b0] Terminating thread with return code -22 
(Invalid argument)
[out#0/framecrc @ 0x7f0021f0] Nothing was written into output file, because at 
least one of its streams received no packets.
frame=0 fps=0.0 q=0.0 Lsize=   0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!
threads=1
make: *** [src/tests/Makefile:315: fate-filter-rgbtestsrc-gbrp10] Error 234

thx
Forgot to insert the scale filter at the end of the chain, which is 
needed for BE hosts.

Should be fixed in https://github.com/jamrial/FFmpeg/commits/pixdesc/



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] swscale/output: fix x2rbg10/x2bgr10 output

2024-11-01 Thread Michael Niedermayer
On Tue, Oct 29, 2024 at 07:19:13PM -0300, James Almer wrote:
> Checking for AV_PIX_FMT_X2RGB10 means the condition will succeed only for the
> version matching the host's endinaness, when only LE is supported, and thus
> the wrong path will be taken on BE systems.
> 
> Signed-off-by: James Almer 
> ---
>  libswscale/output.c | 12 +---
>  1 file changed, 5 insertions(+), 7 deletions(-)

breaks (qemu) mips

--- src/tests/ref/fate/filter-pixdesc-x2rgb10le 2024-10-26 22:34:14.532454440 
+0200
+++ tests/data/fate/filter-pixdesc-x2rgb10le2024-11-01 17:50:04.659478576 
+0100
@@ -1 +1 @@
-pixdesc-x2rgb10le   d34a93b55f4041742b95837b272e
+pixdesc-x2rgb10le   45f6ccc4efa56ae1b38f4741b12e1a75
Test filter-pixdesc-x2rgb10le failed. Look at 
tests/data/fate/filter-pixdesc-x2rgb10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2rgb10le] Error 1
make: *** Waiting for unfinished jobs
--- src/tests/ref/fate/filter-pixdesc-x2bgr10le 2024-10-26 22:34:14.532454440 
+0200
+++ tests/data/fate/filter-pixdesc-x2bgr10le2024-11-01 17:50:04.675478694 
+0100
@@ -1 +1 @@
-pixdesc-x2bgr10le   0ea287ba7ea42330714e7020f2fde7d0
+pixdesc-x2bgr10le   f9ce2cc71dc00df2c212b68caf181765
Test filter-pixdesc-x2bgr10le failed. Look at 
tests/data/fate/filter-pixdesc-x2bgr10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2bgr10le] Error 1



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

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


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

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


Re: [FFmpeg-devel] [PATCH 2/2] fate/filter-video: add more rgbtestsrc tests

2024-11-01 Thread Michael Niedermayer
On Wed, Oct 30, 2024 at 10:25:42AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  tests/fate/filter-video.mak| 12 
>  tests/ref/fate/filter-rgbtestsrc-gbrp  | 10 ++
>  tests/ref/fate/filter-rgbtestsrc-gbrp10| 10 ++
>  tests/ref/fate/filter-rgbtestsrc-rgba  | 10 ++
>  tests/ref/fate/filter-rgbtestsrc-x2rgb10le | 10 ++
>  5 files changed, 52 insertions(+)
>  create mode 100644 tests/ref/fate/filter-rgbtestsrc-gbrp
>  create mode 100644 tests/ref/fate/filter-rgbtestsrc-gbrp10
>  create mode 100644 tests/ref/fate/filter-rgbtestsrc-rgba
>  create mode 100644 tests/ref/fate/filter-rgbtestsrc-x2rgb10le

mips is unhappy:

The filters 'Parsed_format_1' and 'format' do not have a common format and 
automatic conversion is disabled.
[fc#0 @ 0x7f000750] Error configuring filter graph: Invalid argument
[fc#0 @ 0x7f000750] Task finished with error code: -22 (Invalid argument)
[fc#0 @ 0x7f000750] Terminating thread with return code -22 (Invalid argument)
[vost#0:0/rawvideo @ 0x7f0028b0] [enc:rawvideo @ 0x7f002cc0] Could not open 
encoder before EOF
[vost#0:0/rawvideo @ 0x7f0028b0] Task finished with error code: -22 (Invalid 
argument)
[vost#0:0/rawvideo @ 0x7f0028b0] Terminating thread with return code -22 
(Invalid argument)
[out#0/framecrc @ 0x7f0021f0] Nothing was written into output file, because at 
least one of its streams received no packets.
frame=0 fps=0.0 q=0.0 Lsize=   0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!
threads=1
make: *** [src/tests/Makefile:315: fate-filter-rgbtestsrc-gbrp10] Error 234

thx

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- 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 1/2] vsrc_testsrc: add support for x2rgb10le to rgbtestsrc

2024-11-01 Thread Michael Niedermayer
On Wed, Oct 30, 2024 at 10:25:41AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavfilter/vsrc_testsrc.c | 11 +++
>  1 file changed, 11 insertions(+)

mips is unhappy before and after this patch

--- src/tests/ref/fate/filter-pixdesc-x2bgr10le 2024-10-26 22:34:14.532454440 
+0200
+++ tests/data/fate/filter-pixdesc-x2bgr10le2024-11-01 17:45:20.577481969 
+0100
@@ -1 +1 @@
-pixdesc-x2bgr10le   0ea287ba7ea42330714e7020f2fde7d0
+pixdesc-x2bgr10le   f9ce2cc71dc00df2c212b68caf181765
Test filter-pixdesc-x2bgr10le failed. Look at 
tests/data/fate/filter-pixdesc-x2bgr10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2bgr10le] Error 1
make: *** Waiting for unfinished jobs
--- src/tests/ref/fate/filter-pixdesc-x2rgb10le 2024-10-26 22:34:14.532454440 
+0200
+++ tests/data/fate/filter-pixdesc-x2rgb10le2024-11-01 17:45:20.581481994 
+0100
@@ -1 +1 @@
-pixdesc-x2rgb10le   d34a93b55f4041742b95837b272e
+pixdesc-x2rgb10le   45f6ccc4efa56ae1b38f4741b12e1a75
Test filter-pixdesc-x2rgb10le failed. Look at 
tests/data/fate/filter-pixdesc-x2rgb10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2rgb10le] Error 1

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The difference between a dictatorship and a democracy is that every 4 years
the population together is allowed to provide 1 bit of input to the government.


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] vsrc_testsrc: add support for x2rgb10le to rgbtestsrc

2024-11-01 Thread James Almer

On 11/1/2024 1:48 PM, Michael Niedermayer wrote:

On Wed, Oct 30, 2024 at 10:25:41AM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  libavfilter/vsrc_testsrc.c | 11 +++
  1 file changed, 11 insertions(+)


mips is unhappy before and after this patch

--- src/tests/ref/fate/filter-pixdesc-x2bgr10le 2024-10-26 22:34:14.532454440 
+0200
+++ tests/data/fate/filter-pixdesc-x2bgr10le2024-11-01 17:45:20.577481969 
+0100
@@ -1 +1 @@
-pixdesc-x2bgr10le   0ea287ba7ea42330714e7020f2fde7d0
+pixdesc-x2bgr10le   f9ce2cc71dc00df2c212b68caf181765
Test filter-pixdesc-x2bgr10le failed. Look at 
tests/data/fate/filter-pixdesc-x2bgr10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2bgr10le] Error 1
make: *** Waiting for unfinished jobs
--- src/tests/ref/fate/filter-pixdesc-x2rgb10le 2024-10-26 22:34:14.532454440 
+0200
+++ tests/data/fate/filter-pixdesc-x2rgb10le2024-11-01 17:45:20.581481994 
+0100
@@ -1 +1 @@
-pixdesc-x2rgb10le   d34a93b55f4041742b95837b272e
+pixdesc-x2rgb10le   45f6ccc4efa56ae1b38f4741b12e1a75
Test filter-pixdesc-x2rgb10le failed. Look at 
tests/data/fate/filter-pixdesc-x2rgb10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2rgb10le] Error 1


filter-pixdesc tests don't use rgbtestsrc, so how can it change at all?



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

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


[FFmpeg-devel] [PATCH] doc/t2h: Support texinfo 7.1 and 7.2 pretest

2024-11-01 Thread Patrice Dumas


Here is a proposed patch for portability of doc/t2h.pm for GNU Texinfo
7.1 and 7.1.90 (7.2 pretest).  I tested against 7.1 and 7.1.90 (7.2
pretest).  There is a difference in the headings compared to the website
version, maybe related to FA_ICONS not being set the same, but the
result seems correct.

I also renamed $element to $output_unit in ffmpeg_heading_command as in
new equivalent makeinfo/texi2any code the $element variable is the
$command variable in ffmpeg_heading_command, which is very confusing.  I
left as is the $command variable to have a patch easier to read, but it
could make sense to rename $command as $element later on.

The patch could also have effects with Texinfo 7.0, since some of the
changes are for that version, but that probably never show up because it
is for situations that may not exist in ffmpeg manuals (for example
@node without sectioning command), or because the code is robust to some
missing information (case of $heading_level in ffmpeg_heading_command
that was not set, as far as I can tell).

---
 doc/t2h.pm | 169 -
 1 file changed, 129 insertions(+), 40 deletions(-)

diff --git a/doc/t2h.pm b/doc/t2h.pm
index b7485e1f1e..1359960f27 100644
--- a/doc/t2h.pm
+++ b/doc/t2h.pm
@@ -54,12 +54,24 @@ sub get_formatting_function($$) {
 }
 
 # determine texinfo version
-my $program_version_num = 
version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
+my $package_version = ff_get_conf('PACKAGE_VERSION');
+$package_version =~ s/\+dev$//;
+my $program_version_num = version->declare($package_version)->numify;
 my $program_version_6_8 = $program_version_num >= 6.008000;
 
 # no navigation elements
 ff_set_from_init_file('HEADERS', 0);
 
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+if (scalar(keys(%sectioning_commands)) == 0) {
+  %sectioning_commands = %Texinfo::Commands::sectioning_heading_commands;
+}
+
+my %root_commands = %Texinfo::Common::root_commands;
+if (scalar(keys(%root_commands)) == 0) {
+  %root_commands = %Texinfo::Commands::root_commands;
+}
+
 sub ffmpeg_heading_command($)
 {
 my $self = shift;
@@ -77,6 +89,9 @@ sub ffmpeg_heading_command($)
 return $result;
 }
 
+# no need to set it as the $element_id is output unconditionally
+my $heading_id;
+
 my $element_id = $self->command_id($command);
 $result .= "\n"
 if (defined($element_id) and $element_id ne '');
@@ -84,24 +99,40 @@ sub ffmpeg_heading_command($)
 print STDERR "Process $command "
 .Texinfo::Structuring::_print_root_command_texi($command)."\n"
 if ($self->get_conf('DEBUG'));
-my $element;
-if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
-and $command->{'parent'}
-and $command->{'parent'}->{'type'}
-and $command->{'parent'}->{'type'} eq 'element') {
-$element = $command->{'parent'};
+my $output_unit;
+if ($root_commands{$command->{'cmdname'}}) {
+if ($command->{'associated_unit'}) {
+  $output_unit = $command->{'associated_unit'};
+} elsif ($command->{'structure'}
+ and $command->{'structure'}->{'associated_unit'}) {
+  $output_unit = $command->{'structure'}->{'associated_unit'};
+} elsif ($command->{'parent'}
+ and $command->{'parent'}->{'type'}
+ and $command->{'parent'}->{'type'} eq 'element') {
+  $output_unit = $command->{'parent'};
+}
 }
-if ($element) {
+
+if ($output_unit) {
 $result .= &{get_formatting_function($self, 
'format_element_header')}($self, $cmdname,
-   $command, $element);
+   $command, $output_unit);
 }
 
 my $heading_level;
 # node is used as heading if there is nothing else.
 if ($cmdname eq 'node') {
-if (!$element or (!$element->{'extra'}->{'section'}
-and $element->{'extra'}->{'node'}
-and $element->{'extra'}->{'node'} eq $command
+if (!$output_unit or
+(((!$output_unit->{'extra'}->{'section'}
+  and $output_unit->{'extra'}->{'node'}
+  and $output_unit->{'extra'}->{'node'} eq $command)
+ or
+ ((($output_unit->{'extra'}->{'unit_command'}
+and $output_unit->{'extra'}->{'unit_command'} eq $command)
+   or
+   ($output_unit->{'unit_command'}
+and $output_unit->{'unit_command'} eq $command))
+  and $command->{'extra'}
+  and not $command->{'extra'}->{'associated_section'}))
  # bogus node may not have been normalized
 and defined($command->{'extra'}->{'normalized'}))) {
 if ($command->{'extra'}->{'normalized'} eq 'Top') {
@@ -111,7 +142,15 @@ sub ffmpeg_heading_command($)
 }
 }
 } else {
-$hea

Re: [FFmpeg-devel] [PATCH] swscale/output: add full chroma interpolation support for x2rgb10

2024-11-01 Thread James Almer

On 11/1/2024 8:27 AM, Michael Niedermayer wrote:

On Wed, Oct 30, 2024 at 12:20:19PM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  libswscale/output.c | 25 +
  libswscale/utils.c  |  4 +++-
  tests/ref/fate/filter-pixfmts-scale |  4 ++--
  3 files changed, 30 insertions(+), 3 deletions(-)


LGTM

thx


I updated https://github.com/jamrial/FFmpeg/commits/pixdesc/ if you want 
to look at all the recent patches i sent in a single branch.




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

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


[FFmpeg-devel] [PATCH v6] avcodec/jpeg2000: Fix FF_DWT97_INT to pass the conformance testing defined in ISO/IEC 15444-4

2024-11-01 Thread Osamu Watanabe
Fix for the integer version of the inverse 9-7 DWT processing (FF_DWT97_INT, 
https://trac.ffmpeg.org/ticket/10123), which is activated with -flags +bitexact.

I went through the code path for the DWT 9-7 transform (integer) and improved 
precision to match conformance codestream.

As a result, the encoded codestream size is slightly larger for a given Q 
value. For example, -flags +bitexact -i lena.pnm -q: 20 -format j2k -y tmp.j2c 
gives 13K (HEAD) and 19K (with this patch).

This commit also updates the source and reference files for affected FATE tests.

Signed-off-by: Osamu Watanabe 
---
 libavcodec/jpeg2000.c|  11 +-
 libavcodec/jpeg2000dec.c | 150 +--
 libavcodec/jpeg2000dwt.c |  47 +++
 libavcodec/jpeg2000dwt.h |   1 +
 libavcodec/jpeg2000htdec.c   |   9 +-
 libavcodec/tests/jpeg2000dwt.c   |   5 +
 tests/ref/fate/j2k-dwt   |  40 +++---
 tests/ref/fate/jpeg2000-dcinema  |   4 +-
 tests/ref/fate/jpeg2000dec-p0_04 |   2 +-
 tests/ref/fate/jpeg2000dec-p0_05 |   2 +-
 tests/ref/fate/jpeg2000dec-p0_09 |   2 +-
 tests/ref/vsynth/vsynth1-jpeg2000-97 |   8 +-
 tests/ref/vsynth/vsynth2-jpeg2000-97 |   8 +-
 tests/ref/vsynth/vsynth3-jpeg2000-97 |   8 +-
 tests/ref/vsynth/vsynth_lena-jpeg2000-97 |   8 +-
 15 files changed, 163 insertions(+), 142 deletions(-)

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index d6ffb02319..7911500901 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -260,9 +260,7 @@ static void init_band_stepsize(AVCodecContext *avctx,
 band->f_stepsize *= F_LFTG_X * F_LFTG_X * 4;
 break;
 }
-if (codsty->transform == FF_DWT97) {
-band->f_stepsize *= pow(F_LFTG_K, 2*(codsty->nreslevels2decode - 
reslevelno) + lband - 2);
-}
+band->f_stepsize *= pow(F_LFTG_K, 2*(codsty->nreslevels2decode - 
reslevelno) + lband - 2);
 }
 
 if (band->f_stepsize > (INT_MAX >> 15)) {
@@ -270,12 +268,7 @@ static void init_band_stepsize(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_ERROR, "stepsize out of range\n");
 }
 
-band->i_stepsize = band->f_stepsize * (1 << 15);
-
-/* FIXME: In OpenJPEG code stepsize = stepsize * 0.5. Why?
- * If not set output of entropic decoder is not correct. */
-if (!av_codec_is_encoder(avctx->codec))
-band->f_stepsize *= 0.5;
+band->i_stepsize = (int)floorf(band->f_stepsize * (1 << 15));
 }
 
 static int init_prec(AVCodecContext *avctx,
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 5b05ff2455..c9d8b025b1 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1885,14 +1885,15 @@ static void decode_sigpass(Jpeg2000T1Context *t1, int 
width, int height,
 && !(t1->flags[(y+1) * t1->stride + x+1] & (JPEG2000_T1_SIG | 
JPEG2000_T1_VIS))) {
 if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + 
ff_jpeg2000_getsigctxno(t1->flags[(y+1) * t1->stride + x+1] & flags_mask, 
bandno))) {
 int xorbit, ctxno = 
ff_jpeg2000_getsgnctxno(t1->flags[(y+1) * t1->stride + x+1] & flags_mask, 
&xorbit);
-if (t1->mqc.raw)
- t1->data[(y) * t1->stride + x] = 
ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask;
-else
- t1->data[(y) * t1->stride + x] = 
(ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ?
-   -mask : mask;
-
+if (t1->mqc.raw) {
+t1->data[(y) * t1->stride + x] |= 
ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) << 31;
+t1->data[(y) * t1->stride + x] |= mask;
+} else {
+t1->data[(y) * t1->stride + x] |= 
(ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) << 31;
+t1->data[(y) * t1->stride + x] |= mask;
+}
 ff_jpeg2000_set_significance(t1, x, y,
- t1->data[(y) * t1->stride 
+ x] < 0);
+ t1->data[(y) * t1->stride 
+ x] & INT32_MIN);
 }
 t1->flags[(y + 1) * t1->stride + x + 1] |= JPEG2000_T1_VIS;
 }
@@ -1902,11 +1903,10 @@ static void decode_sigpass(Jpeg2000T1Context *t1, int 
width, int height,
 static void decode_refpass(Jpeg2000T1Context *t1, int width, int height,
int bpno, int vert_causal_ctx_csty_symbol)
 {
-int phalf, nhalf;
+int phalf;
 int y0, x, y;
 
 phalf = 1 << (bpno - 1);
-nhalf = -phalf;
 
 for (y0 = 0; y0 < height; y0 += 4)
 for (x = 0; x < width; x++)
@@ -1915,10 +1915,13 

Re: [FFmpeg-devel] [PATCH] libavutil/ppc: defines involving bit shifts should be unsigned

2024-11-01 Thread Brad Smith

I had a bigger diff to handle all of the same type of flags in the same
manner, but I can post that separately.

LGTM.

On 2024-11-02 2:13 a.m., Sean McGovern wrote:

Otherwise, these can overflow at the boundaries of the integer type.
---
  libavutil/ppc/cpu.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 62d495ec1d..9f9c073434 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -53,9 +53,9 @@
  #define AT_HWCAP226
  #endif
  
-#define HWCAP_PPC_VSX(1 << 7)

-#define HWCAP_PPC_ALTIVEC(1 << 28)
-#define HWCAP2_PPC_ARCH_2_07 (1 << 31)
+#define HWCAP_PPC_VSX(1U << 7)
+#define HWCAP_PPC_ALTIVEC(1U << 28)
+#define HWCAP2_PPC_ARCH_2_07 (1U << 31)
  
  /**

   * This function MAY rely on signal() or fork() in order to make sure AltiVec

___
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] libavutil/ppc: defines involving bit shifts should be unsigned

2024-11-01 Thread Sean McGovern
Otherwise, these can overflow at the boundaries of the integer type.
---
 libavutil/ppc/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 62d495ec1d..9f9c073434 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -53,9 +53,9 @@
 #define AT_HWCAP226
 #endif
 
-#define HWCAP_PPC_VSX(1 << 7)
-#define HWCAP_PPC_ALTIVEC(1 << 28)
-#define HWCAP2_PPC_ARCH_2_07 (1 << 31)
+#define HWCAP_PPC_VSX(1U << 7)
+#define HWCAP_PPC_ALTIVEC(1U << 28)
+#define HWCAP2_PPC_ARCH_2_07 (1U << 31)
 
 /**
  * This function MAY rely on signal() or fork() in order to make sure AltiVec
-- 
2.45.2

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

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


Re: [FFmpeg-devel] [PATCH] avformat/vpk: fix divide by zero

2024-11-01 Thread Kacper Michajlow
On Sat, 2 Nov 2024 at 01:54, Michael Niedermayer  wrote:
>
> Hi
>
> On Fri, Nov 01, 2024 at 02:20:33PM +0100, Kacper Michajlow wrote:
> > On Sat, 10 Aug 2024 at 18:49, Kacper Michajlow  wrote:
> > >
> > > On Sat, 10 Aug 2024 at 11:25, Andreas Rheinhardt
> > >  wrote:
> > > >
> > > > Kacper Michajlow:
> > > > > On Fri, 9 Aug 2024 at 22:51, Michael Niedermayer 
> > > > >  wrote:
> > > > >>
> > > > >> On Wed, Aug 07, 2024 at 03:42:46PM +0200, Kacper Michajłow wrote:
> > > > >>> Can happen after calling avformat_find_stream_info() when the codec
> > > > >>> fails to open, but return value is 0 and subsequent uses of this 
> > > > >>> context
> > > > >>> have zero value in channel number.
> > > > >>>
> > > > >>> Found by OSS-Fuzz.
> > > > >>>
> > > > >>> Signed-off-by: Kacper Michajłow 
> > > > >>> ---
> > > > >>>  libavformat/vpk.c | 2 ++
> > > > >>>  1 file changed, 2 insertions(+)
> > > > >>>
> > > > >>> diff --git a/libavformat/vpk.c b/libavformat/vpk.c
> > > > >>> index 001ad33555..aa98ef2dd4 100644
> > > > >>> --- a/libavformat/vpk.c
> > > > >>> +++ b/libavformat/vpk.c
> > > > >>> @@ -86,6 +86,8 @@ static int vpk_read_packet(AVFormatContext *s, 
> > > > >>> AVPacket *pkt)
> > > > >>>
> > > > >>>  vpk->current_block++;
> > > > >>>  if (vpk->current_block == vpk->block_count) {
> > > > >>> +if (par->ch_layout.nb_channels <= 0)
> > > > >>> +return AVERROR_INVALIDDATA;
> > > > >>>  unsigned size = vpk->last_block_size / 
> > > > >>> par->ch_layout.nb_channels;
> > > > >>>  unsigned skip = (par->block_align - vpk->last_block_size) 
> > > > >>> / par->ch_layout.nb_channels;
> > > > >>>  uint64_t pos = avio_tell(s->pb);
> > > > >>
> > > > >> iam not sure if a parser or other should replace a valid set of
> > > > >> parameters by an invalid
> > > > >> (this patch implies that such a action occured)
> > > > >>
> > > > >> can you explain more detailedly by what and why channels is set to 0 
> > > > >> ?
> > > > >>
> > > > >
> > > > > You are right, it might be better to improve this to not override the
> > > > > params. Let me explain what happens, I didn't read through the whole
> > > > > avformat_find_stream_info() to know what would be the best approach
> > > > > yet. I will try to look at it, but if you have immediate ideas, that
> > > > > would be nice.
> > > > >
> > > > > 1. avformat_open_input() sets nb_channels to 108
> > > > >
> > > > > 2. Just after that we call avformat_find_stream_info(avfc, NULL); this
> > > > > returns 0 (success), but as a result it overrides params already
> > > > > present in the context.
> > > > > log for reference, during the find stream info call
> > > > > [ffmpeg/demuxer] vpk: Before avformat_find_stream_info() pos:
> > > > > 538976288 bytes read:21 seeks:1 nb_streams:1
> > > > > [ffmpeg/demuxer] vpk: Failed to open codec in 
> > > > > avformat_find_stream_info
> > > > > [lavf] mp_seek(0x51218090, 0, size)
> > > > > [lavf] 0=mp_read(0x51218090, 0x7fe4c7ce8800, 5000), pos:
> > > > > 538976288, eof:1
> > > > > [lavf] 0=mp_read(0x51218090, 0x52d0a400, 32768), pos: 
> > > > > 538976288, eof:1
> > > > > [ffmpeg/audio] adpcm_psx: Decoder requires channel layout to be set
> > > > > [ffmpeg/demuxer] vpk: Failed to open codec in 
> > > > > avformat_find_stream_info
> > > > > [lavf] mp_seek(0x51218090, 0, size)
> > > > > [lavf] mp_seek(0x51218090, 0, size)
> > > > > [lavf] mp_seek(0x51218090, 0, size)
> > > > > [ffmpeg/demuxer] vpk: stream 0: start_time: NOPTS duration: 0.069852
> > > > > [ffmpeg/demuxer] vpk: format: start_time: NOPTS duration: 0.069852
> > > > > (estimate from stream) bitrate=2 kb/s
> > > > > [ffmpeg/demuxer] vpk: Could not find codec parameters for stream 0
> > > > > (Audio: adpcm_psx, 538976288 Hz, 0 channels): unspecified sample
> > > > > format
> > > > > [ffmpeg/demuxer] Consider increasing the value for the
> > > > > 'analyzeduration' (0) and 'probesize' (500) options
> > > > > [ffmpeg/demuxer] vpk: After avformat_find_stream_info() pos: 538976288
> > > > > bytes read:21 seeks:1 frames:0
> > > > >
> > > > > 3. the nb_channels value is cleared in avformat_find_stream_info() ->
> > > > > avcodec_parameters_from_context() -> codec_parameters_reset() and
> > > > > remains 0.
> > > >
> > > > This seems like the error: Why is AVCodecParameters being set from an
> > > > AVCodecContext if the codec could not be successfully opened?
> > >
> > > avcodec_open2() is only emitting a warning, no other action taken.
> > > https://github.com/FFmpeg/FFmpeg/blob/1b8d95da3a4a5c9441238928a36b653da693c286/libavformat/demux.c#L2603-L2605
> > >
> > > later "some" things happen, but I think we could check if we have
> > > codec params before assigning them
> > >
> > > diff --git a/libavformat/demux.c b/libavformat/demux.c
> > > index dc65f9ad91..e8785304ca 100644
> > > --- a/libavformat/demux.c
> > > +++ b/libavformat/demux.c
> > > @@ -3038,7 +3038,7 @@ int avformat_find_stream_info(AVFormatContext
> 

Re: [FFmpeg-devel] [PATCH] libavutil/ppc: Include the hardware feature flags like the other archs

2024-11-01 Thread Sean McGovern
Hi Brad,

On Fri, Nov 1, 2024 at 1:46 AM Brad Smith
 wrote:
>
> ping.

Sorry for not ringing in on this sooner, the PowerMac G5 FATE node
does not like this:

src/libavutil/ppc/cpu.c:85:18: runtime error: left shift of 1 by 31
places cannot be represented in type 'int'

Probably something needs to be 'unsigned'.

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

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] fate/vvc: Add a sample which lose frames before 5c66a3

2024-11-01 Thread Michael Niedermayer
On Fri, Nov 01, 2024 at 09:11:47AM +, Zhao Zhili wrote:
> ffmpeg | branch: master | Zhao Zhili  | Wed Sep 18 
> 14:56:22 2024 +0800| [1864025458021a2d2c542f56e268ee1106f84460] | committer: 
> Zhao Zhili
> 
> fate/vvc: Add a sample which lose frames before 5c66a3
> 
> Signed-off-by: Zhao Zhili 
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1864025458021a2d2c542f56e268ee1106f84460
> ---
> 
>  tests/fate/vvc.mak|  3 ++-
>  tests/ref/fate/vvc-output-ref | 35 +++
>  2 files changed, 37 insertions(+), 1 deletion(-)

this breaks on x86-32

--- src/tests/ref/fate/vvc-output-ref   2024-11-01 23:57:17.138355344 +0100
+++ tests/data/fate/vvc-output-ref  2024-11-01 23:57:43.014716555 +0100
@@ -4,32 +4,32 @@
 #dimensions 0: 480x320
 #sar 0: 0/1
 0,  0,  0,1,   230400, 0x3293f7f1
-0,  1,  1,1,   230400, 0xe2570fa4
-0,  2,  2,1,   230400, 0xecd608fb
-0,  3,  3,1,   230400, 0xea46f9f4
-0,  4,  4,1,   230400, 0xb715d24a
-0,  5,  5,1,   230400, 0x69faaf46
-0,  6,  6,1,   230400, 0xf9a362db
-0,  7,  7,1,   230400, 0x2dcd19ca
-0,  8,  8,1,   230400, 0xf8fda185
-0,  9,  9,1,   230400, 0x48a35bfd
+0,  1,  1,1,   230400, 0x627008c8
+0,  2,  2,1,   230400, 0x6ed9fa1b
+0,  3,  3,1,   230400, 0xf49ce95a
+0,  4,  4,1,   230400, 0x3886bf16
+0,  5,  5,1,   230400, 0x67fe9745
+0,  6,  6,1,   230400, 0xfbd5466d
+0,  7,  7,1,   230400, 0xcc74fbec
+0,  8,  8,1,   230400, 0x37f18143
+0,  9,  9,1,   230400, 0xe99c39c8
 0, 10, 10,1,   230400, 0x27efe832
-0, 11, 11,1,   230400, 0x74279617
-0, 12, 12,1,   230400, 0x91935248
-0, 13, 13,1,   230400, 0x29b621e6
-0, 14, 14,1,   230400, 0x89b1ec0b
-0, 15, 15,1,   230400, 0x898fdba1
-0, 16, 16,1,   230400, 0xc6d18e6f
-0, 17, 17,1,   230400, 0xedff651b
-0, 18, 18,1,   230400, 0x677e2260
-0, 19, 19,1,   230400, 0x930918ef
+0, 11, 11,1,   230400, 0x87ee9347
+0, 12, 12,1,   230400, 0x05b240ac
+0, 13, 13,1,   230400, 0x9c3c0fe9
+0, 14, 14,1,   230400, 0x83e3dbff
+0, 15, 15,1,   230400, 0xa760d011
+0, 16, 16,1,   230400, 0xaa73859a
+0, 17, 17,1,   230400, 0x22875e87
+0, 18, 18,1,   230400, 0x08af1bb6
+0, 19, 19,1,   230400, 0x761d10dc
 0, 20, 20,1,   230400, 0x70da2c30
-0, 21, 21,1,   230400, 0x699a3b9d
-0, 22, 22,1,   230400, 0xff3b1b3a
-0, 23, 23,1,   230400, 0xca11d9a5
-0, 24, 24,1,   230400, 0x904394e0
-0, 25, 25,1,   230400, 0x392e5445
-0, 26, 26,1,   230400, 0x6191f4d8
-0, 27, 27,1,   230400, 0xa7d7be12
-0, 28, 28,1,   230400, 0xbb29752c
-0, 29, 29,1,   230400, 0x14ff297e
+0, 21, 21,1,   230400, 0xf126321e
+0, 22, 22,1,   230400, 0x80ea0742
+0, 23, 23,1,   230400, 0x68a4cb1f
+0, 24, 24,1,   230400, 0xe2e97a53
+0, 25, 25,1,   230400, 0xc9cb338a
+0, 26, 26,1,   230400, 0x7fe6d117
+0, 27, 27,1,   230400, 0x5b1898de
+0, 28, 28,1,   230400, 0x6a005043
+0, 29, 29,1,   230400, 0xa282ff6d
Test vvc-output-ref failed. Look at tests/data/fate/vvc-output-ref.err for 
details.
make: *** [src/tests/Makefile:311: fate-vvc-output-ref] Error 1

thx

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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] libavutil/ppc: Include the hardware feature flags like the other archs

2024-11-01 Thread Brad Smith

On 2024-11-01 8:50 p.m., Michael Niedermayer wrote:

On Fri, Nov 01, 2024 at 01:45:46AM -0400, Brad Smith wrote:

ping.

it builds on my old cross compile environment on ubuntu
but i have no real ppc here to test beyond that

thx


Tested with a Linux Power8 VM.

[almalinux@ffmpeg1 tests]$ ./cpu
cpu_flags(raw) = 0x0007
cpu_flags_str(raw) = altivec vsx power8
cpu_flags(effective) = 0x0007
cpu_flags_str(effective) = altivec vsx power8
threads = auto (cpu_count = 2)



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

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


Re: [FFmpeg-devel] [PATCH] libavutil/ppc: Include the hardware feature flags like the other archs

2024-11-01 Thread Brad Smith

ping.

On 2024-10-20 3:44 a.m., Brad Smith wrote:

libavutil/ppc: Include the hardware feature flags like the other archs

Also include the hardware feature flags like the other archs do and
clean up the code a bit.

Tested on Linux POWER8.

Signed-off-by: Brad Smith 
---
  libavutil/ppc/cpu.c | 35 +--
  1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 9381272175..62d495ec1d 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -46,6 +46,17 @@
  #include "libavutil/cpu.h"
  #include "libavutil/cpu_internal.h"
  
+#ifndef AT_HWCAP

+#define AT_HWCAP 16
+#endif
+#ifndef AT_HWCAP2
+#define AT_HWCAP226
+#endif
+
+#define HWCAP_PPC_VSX(1 << 7)
+#define HWCAP_PPC_ALTIVEC(1 << 28)
+#define HWCAP2_PPC_ARCH_2_07 (1 << 31)
+
  /**
   * This function MAY rely on signal() or fork() in order to make sure AltiVec
   * is present.
@@ -65,20 +76,14 @@ int ff_get_cpu_flags_ppc(void)
  int flags = 0;
  
  unsigned long hwcap = ff_getauxval(AT_HWCAP);

-#ifdef PPC_FEATURE2_ARCH_2_07
  unsigned long hwcap2 = ff_getauxval(AT_HWCAP2);
-#endif
  
-if (hwcap & PPC_FEATURE_HAS_ALTIVEC)

+if (hwcap & HWCAP_PPC_ALTIVEC)
 flags |= AV_CPU_FLAG_ALTIVEC;
-#ifdef PPC_FEATURE_HAS_VSX
-if (hwcap & PPC_FEATURE_HAS_VSX)
+if (hwcap & HWCAP_PPC_VSX)
 flags |= AV_CPU_FLAG_VSX;
-#endif
-#ifdef PPC_FEATURE2_ARCH_2_07
-if (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+if (hwcap2 & HWCAP2_PPC_ARCH_2_07)
 flags |= AV_CPU_FLAG_POWER8;
-#endif
  
  return flags;

  #elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__)
@@ -112,23 +117,17 @@ int ff_get_cpu_flags_ppc(void)
  if (buf[i] == AT_NULL)
  goto out;
  if (buf[i] == AT_HWCAP) {
-if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC)
+if (buf[i + 1] & HWCAP_PPC_ALTIVEC)
  ret = AV_CPU_FLAG_ALTIVEC;
-#ifdef PPC_FEATURE_HAS_VSX
-if (buf[i + 1] & PPC_FEATURE_HAS_VSX)
+if (buf[i + 1] & HWCAP_PPC_VSX)
  ret |= AV_CPU_FLAG_VSX;
-#endif
  if (ret & AV_CPU_FLAG_VSX)
  av_assert0(ret & AV_CPU_FLAG_ALTIVEC);
  }
-#ifdef AT_HWCAP2 /* not introduced until glibc 2.18 */
  else if (buf[i] == AT_HWCAP2) {
-#ifdef PPC_FEATURE2_ARCH_2_07
-if (buf[i + 1] & PPC_FEATURE2_ARCH_2_07)
+if (buf[i + 1] & HWCAP2_PPC_ARCH_2_07)
  ret |= AV_CPU_FLAG_POWER8;
-#endif
  }
-#endif /* AT_HWCAP2 */
  }
  }
  

___
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] swscale/output: add full chroma interpolation support for x2rgb10

2024-11-01 Thread Michael Niedermayer
On Wed, Oct 30, 2024 at 12:20:19PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libswscale/output.c | 25 +
>  libswscale/utils.c  |  4 +++-
>  tests/ref/fate/filter-pixfmts-scale |  4 ++--
>  3 files changed, 30 insertions(+), 3 deletions(-)

LGTM

thx

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


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