[FFmpeg-devel] [PATCH 2/3] avcodec/ffv1enc: Prevent generation of files with broken slices

Michael Niedermayer michael at niedermayer.cc
Thu Oct 24 03:57:58 EEST 2024


On Fri, Oct 11, 2024 at 09:39:14AM +0200, Lynne via ffmpeg-devel wrote:
> On 01/10/2024 22:31, Michael Niedermayer wrote:
[...]
> > +    int i = width * (int64_t)(num_h_slices - 1) / num_h_slices;
> > +
> > +    return width % mpw && (width - i) % mpw == 0;
> 
> Would a check (if height < (subsampling ? 3 : 1)) would have been enough?

no


> This isn't really readable nor understandable.

true
if you consider 4:2:0 then
there really are 4 cases for each slice left and right side even and odd
and the ones both starting and ending odd have the last line missing
But! the ones starting odd store the previous chroma line so
the odd odd case in the middle works out its only a problem if its the
last slice on the right or bottom and thats what we test for here


> 
> Furthermore, this function is called with both width and height, yet all
> variables are named with the assumption that only width is used.

ill add a commet to clarify this, not 100% happy but i cannot think of a
good term that represents both width and height without being confusingly
generic

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241024/d52728a2/attachment.sig>


More information about the ffmpeg-devel mailing list