Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-15 21:46:32 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-26 17:06:25 +0300
commit4147bb905346570cab4c3d106bb94e08e4bb5a15 (patch)
treee0ad11be3846c561fff5b08cd39925e38187575a /libavcodec/ffv1enc.c
parent449cdfa687f788fa633f5c07e9e7ac71952dc6f6 (diff)
avcodec/ffv1enc: Try to choose slice count so that slice packet sizes are within the supported size
Fixes assertion failure Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/ffv1enc.c')
-rw-r--r--libavcodec/ffv1enc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 7f31606775..e59d540737 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -848,10 +848,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
if (s->version > 1) {
+ int plane_count = 1 + 2*s->chroma_planes + s->transparency;
s->num_v_slices = (avctx->width > 352 || avctx->height > 288 || !avctx->slices) ? 2 : 1;
- for (; s->num_v_slices < 9; 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++) {
- if (avctx->slices == s->num_h_slices * s->num_v_slices && avctx->slices <= 64 || !avctx->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;
+ if (s->num_h_slices > avctx->width || s->num_v_slices > avctx->height)
+ continue;
+ if (maxw * maxh * (int64_t)(s->bits_per_raw_sample+1) * plane_count > 8<<24)
+ continue;
+ if (avctx->slices == s->num_h_slices * s->num_v_slices && avctx->slices <= MAX_SLICES || !avctx->slices)
goto slices_ok;
}
}