Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -1388,13 +1388,24 @@ static av_cold int vulkan_encode_ffv1_init(AVCodecContext *avctx) · 1387 unmodified lines | ||
| 1388 | 1388 | f->num_h_slices = fv->num_h_slices; |
| 1389 | 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 | 1392 | f->num_h_slices = 32; |
| 1393 | − if (f->num_v_slices <= 0) | |
| 1394 | 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 | 1400 | f->num_h_slices = FFMIN(f->num_h_slices, avctx->width); |
| 1397 | 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 | 1411 | if ((err = ff_ffv1_write_extradata(avctx)) < 0) |
| @@ -1549,9 +1560,9 @@ static const AVOption vulkan_encode_ffv1_options[] = { · 148 unmodified lines | ||
| 1549 | 1560 | { .i64 = -1 }, -1, 2, VE }, |
| 1550 | 1561 | |
| 1551 | 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 | 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 | 1567 | { "force_pcm", "Code all slices with no prediction", OFFSET(force_pcm), AV_OPT_TYPE_BOOL, |
| 1557 | 1568 | { .i64 = 0 }, 0, 1, VE }, |