[FFmpeg-devel] avcodec/ffv1enc: permit 1024 slices

Jerome Martinez jerome at mediaarea.net
Tue Apr 8 23:54:47 EEST 2025


The FFV1 decoder accepts 1024 slices but the encoder does not currently 
permit it.
Let's permit 32x32 (which is the GPU encoder setting, by the way).
-------------- next part --------------
From 216f14a7bf0c4f71b7c8e15c7f2d91088818a20d Mon Sep 17 00:00:00 2001
From: Jerome Martinez <jerome at mediaarea.net>
Date: Tue, 8 Apr 2025 22:07:47 +0200
Subject: [PATCH] avcodec/ffv1enc: permit 1024 slices

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

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 35a1ae16d4..807850a432 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -569,7 +569,7 @@ int ff_ffv1_encode_determine_slices(AVCodecContext *avctx)
     int max_v_slices = AV_CEIL_RSHIFT(avctx->height, s->chroma_v_shift);
     s->num_v_slices = (avctx->width > 352 || avctx->height > 288 || !avctx->slices) ? 2 : 1;
     s->num_v_slices = FFMIN(s->num_v_slices, max_v_slices);
-    for (; s->num_v_slices < 32; s->num_v_slices++) {
+    for (; s->num_v_slices <= 32; s->num_v_slices++) {
         for (s->num_h_slices = s->num_v_slices; s->num_h_slices <= 2*s->num_v_slices; s->num_h_slices++) {
             int maxw = (avctx->width  + s->num_h_slices - 1) / s->num_h_slices;
             int maxh = (avctx->height + s->num_v_slices - 1) / s->num_v_slices;
-- 
2.46.0.windows.1



More information about the ffmpeg-devel mailing list