On Thu, 9 Jan 2025, Michael Niedermayer wrote:

Hi

On Tue, Jan 07, 2025 at 12:08:39AM +0100, Marton Balint wrote:
All elements should be within 1-255.
---
 libavcodec/encode.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

this breaks:

./ffmpeg -i lena.pnm -qscale 4 -intra_matrix 
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
 -chroma_intra_matrix 
400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400
 -bitexact custommatrix10,400.jpg

I have not double checked the spec, but the resulting file worked fine
before the patch

Hmm, apparenly JPEG does not write directly the matrices to the file but the qscale corrected variants, so values larger than 255 can be OK. And even if there is an overflow, it uses clipping, so any positive value seems OK there.

I will rework this and use a codec specific check instead of a generic one...

Regards,
Marton


thx

[...]

--
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu

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

Reply via email to