History

ffv1enc_vulkan: remove arbitrary limitation of the number of slices

Lynne committed 1 year ago

Commit 4fefc6e1 parent ce8a0701 file · +15 −4Browse files

Unified · Split

libavcodec/ffv1enc_vulkan.c+15−4
@@ -1388,13 +1388,24 @@ static av_cold int vulkan_encode_ffv1_init(AVCodecContext *avctx) · 1387 unmodified lines
13881388 f->num_h_slices = fv->num_h_slices;
13891389 f->num_v_slices = fv->num_v_slices;
13901390
1391− if (f->num_h_slices <= 0)
1391+ if (f->num_h_slices <= 0 && f->num_v_slices <= 0) {
13921392 f->num_h_slices = 32;
1393− if (f->num_v_slices <= 0)
13941393 f->num_v_slices = 32;
1394+ } else if (f->num_h_slices && f->num_v_slices <= 0) {
1395+ f->num_v_slices = 1024 / f->num_h_slices;
1396+ } else if (f->num_v_slices && f->num_h_slices <= 0) {
1397+ f->num_h_slices = 1024 / f->num_v_slices;
1398+ }
13951399
13961400 f->num_h_slices = FFMIN(f->num_h_slices, avctx->width);
13971401 f->num_v_slices = FFMIN(f->num_v_slices, avctx->height);
1402+
1403+ if (f->num_h_slices * f->num_v_slices > 1024) {
1404+ av_log(avctx, AV_LOG_ERROR, "Too many slices (%i), maximum supported "
1405+ "by the standard is 1024\n",
1406+ f->num_h_slices * f->num_v_slices);
1407+ return AVERROR_PATCHWELCOME;
1408+ }
13981409 }
13991410
14001411 if ((err = ff_ffv1_write_extradata(avctx)) < 0)
@@ -1549,9 +1560,9 @@ static const AVOption vulkan_encode_ffv1_options[] = { · 148 unmodified lines
15491560 { .i64 = -1 }, -1, 2, VE },
15501561
15511562 { "slices_h", "Number of horizontal slices", OFFSET(num_h_slices), AV_OPT_TYPE_INT,
1552− { .i64 = -1 }, -1, 32, VE },
1563+ { .i64 = -1 }, -1, 1024, VE },
15531564 { "slices_v", "Number of vertical slices", OFFSET(num_v_slices), AV_OPT_TYPE_INT,
1554− { .i64 = -1 }, -1, 32, VE },
1565+ { .i64 = -1 }, -1, 1024, VE },
15551566
15561567 { "force_pcm", "Code all slices with no prediction", OFFSET(force_pcm), AV_OPT_TYPE_BOOL,
15571568 { .i64 = 0 }, 0, 1, VE },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t