ffv1enc_vulkan: allow setting the number of slices via -slices
Falls back to the exact same code the software encoder uses.
This commit is contained in:
parent
d9b773c22f
commit
e7b474783c
@ -516,7 +516,7 @@ static int sort_stt(FFV1Context *s, uint8_t stt[256])
|
||||
}
|
||||
|
||||
|
||||
static int encode_determine_slices(AVCodecContext *avctx)
|
||||
int ff_ffv1_encode_determine_slices(AVCodecContext *avctx)
|
||||
{
|
||||
FFV1Context *s = avctx->priv_data;
|
||||
int plane_count = 1 + 2*s->chroma_planes + s->transparency;
|
||||
@ -919,7 +919,7 @@ static int encode_init_internal(AVCodecContext *avctx)
|
||||
return ret;
|
||||
|
||||
if (s->version > 1) {
|
||||
if ((ret = encode_determine_slices(avctx)) < 0)
|
||||
if ((ret = ff_ffv1_encode_determine_slices(avctx)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = ff_ffv1_write_extradata(avctx)) < 0)
|
||||
|
@ -32,6 +32,7 @@ enum {
|
||||
};
|
||||
|
||||
av_cold int ff_ffv1_encode_init(AVCodecContext *avctx);
|
||||
av_cold int ff_ffv1_encode_determine_slices(AVCodecContext *avctx);
|
||||
av_cold int ff_ffv1_write_extradata(AVCodecContext *avctx);
|
||||
av_cold int ff_ffv1_encode_setup_plane_info(AVCodecContext *avctx,
|
||||
enum AVPixelFormat pix_fmt);
|
||||
|
@ -1540,8 +1540,14 @@ static av_cold int vulkan_encode_ffv1_init(AVCodecContext *avctx)
|
||||
f->num_v_slices = fv->num_v_slices;
|
||||
|
||||
if (f->num_h_slices <= 0 && f->num_v_slices <= 0) {
|
||||
f->num_h_slices = 32;
|
||||
f->num_v_slices = 32;
|
||||
if (avctx->slices) {
|
||||
err = ff_ffv1_encode_determine_slices(avctx);
|
||||
if (err < 0)
|
||||
return err;
|
||||
} else {
|
||||
f->num_h_slices = 32;
|
||||
f->num_v_slices = 32;
|
||||
}
|
||||
} else if (f->num_h_slices && f->num_v_slices <= 0) {
|
||||
f->num_v_slices = 1024 / f->num_h_slices;
|
||||
} else if (f->num_v_slices && f->num_h_slices <= 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user