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
1388 f->num_h_slices = fv->num_h_slices;1388 f->num_h_slices = fv->num_h_slices;
1389 f->num_v_slices = fv->num_v_slices;1389 f->num_v_slices = fv->num_v_slices;
1390 1390
1391 if (f->num_h_slices <= 0)1391 if (f->num_h_slices <= 0 && f->num_v_slices <= 0) {
1392 f->num_h_slices = 32;1392 f->num_h_slices = 32;
1393 if (f->num_v_slices <= 0)
1394 f->num_v_slices = 32;1393 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 }
1395 1399
1396 f->num_h_slices = FFMIN(f->num_h_slices, avctx->width);1400 f->num_h_slices = FFMIN(f->num_h_slices, avctx->width);
1397 f->num_v_slices = FFMIN(f->num_v_slices, avctx->height);1401 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 }
1398 }1409 }
1399 1410
1400 if ((err = ff_ffv1_write_extradata(avctx)) < 0)1411 if ((err = ff_ffv1_write_extradata(avctx)) < 0)
@@ -1549,9 +1560,9 @@ static const AVOption vulkan_encode_ffv1_options[] = { · 148 unmodified lines
1549 { .i64 = -1 }, -1, 2, VE },1560 { .i64 = -1 }, -1, 2, VE },
1550 1561
1551 { "slices_h", "Number of horizontal slices", OFFSET(num_h_slices), AV_OPT_TYPE_INT,1562 { "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 },
1553 { "slices_v", "Number of vertical slices", OFFSET(num_v_slices), AV_OPT_TYPE_INT,1564 { "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 },
1555 1566
1556 { "force_pcm", "Code all slices with no prediction", OFFSET(force_pcm), AV_OPT_TYPE_BOOL,1567 { "force_pcm", "Code all slices with no prediction", OFFSET(force_pcm), AV_OPT_TYPE_BOOL,
1557 { .i64 = 0 }, 0, 1, VE },1568 { .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