[FFmpeg-devel] [PATCH 2/3] avcodec/ffv1enc: Prevent generation of files with broken slices
Lynne
dev at lynne.ee
Fri Oct 11 10:39:14 EEST 2024
On 01/10/2024 22:31, Michael Niedermayer wrote:
> Fixes: Ticket5548
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
> libavcodec/ffv1.c | 7 +++++++
> libavcodec/ffv1.h | 1 +
> libavcodec/ffv1enc.c | 4 ++++
> 3 files changed, 12 insertions(+)
>
> diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
> index 56a36e479fc..2b8564c2f56 100644
> --- a/libavcodec/ffv1.c
> +++ b/libavcodec/ffv1.c
> @@ -119,6 +119,13 @@ av_cold int ff_ffv1_init_slices_state(FFV1Context *f)
> return 0;
> }
>
> +int ff_need_new_slices(int width, int num_h_slices, int chroma_shift) {
Wrong coding style.
> + int mpw = 1<<chroma_shift;
Same, leave a space.
> + 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? This isn't really readable nor understandable.
Furthermore, this function is called with both width and height, yet all
variables are named with the assumption that only width is used.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xA2FEA5F03F034464.asc
Type: application/pgp-keys
Size: 624 bytes
Desc: OpenPGP public key
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241011/4e51e9b6/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241011/4e51e9b6/attachment.sig>
More information about the ffmpeg-devel
mailing list