diff mbox

[FFmpeg-devel] avcodec/ffv1enc: Allow less than 2 rows of slices for low vertical resolution

Message ID 20170626151249.1346-1-michael@niedermayer.cc
State Accepted
Commit 430d4f2bb52e6d1d7d375186cb5c710008a20603
Headers show

Commit Message

Michael Niedermayer June 26, 2017, 3:12 p.m. UTC
Fixes: Ticket5548

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/ffv1enc.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Paul B Mahol June 26, 2017, 3:33 p.m. UTC | #1
On 6/26/17, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: Ticket5548
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ffv1enc.c | 4 ++++
>  1 file changed, 4 insertions(+)

LGTM

Could this calculation be simplified? (Even with different results)
Just few operations without if/else?
Michael Niedermayer June 27, 2017, 11:35 a.m. UTC | #2
On Mon, Jun 26, 2017 at 05:33:02PM +0200, Paul B Mahol wrote:
> On 6/26/17, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > Fixes: Ticket5548
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/ffv1enc.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> 
> LGTM

applied


> 
> Could this calculation be simplified? (Even with different results)
> Just few operations without if/else?

tried to simplify it

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index e59d540737..39b52d5a48 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -850,6 +850,10 @@  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;
+
+        if (avctx->height < 5)
+            s->num_v_slices = 1;
+
         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++) {
                 int maxw = (avctx->width  + s->num_h_slices - 1) / s->num_h_slices;