diff mbox

[FFmpeg-devel] lavfi/mergeplanes: Fix >8bit formats

Message ID alpine.DEB.2.11.1610300028040.5965@rainbow.studorg.tuwien.ac.at
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Oct. 29, 2016, 10:29 p.m. UTC
Hi!

Attached patch fixes the command line provided in ticket #5916.

Please comment, Carl Eugen

Comments

Paul B Mahol Oct. 30, 2016, 7:53 a.m. UTC | #1
On 10/30/16, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
> Hi!
>
> Attached patch fixes the command line provided in ticket #5916.
>
> Please comment, Carl Eugen

Can you explain why this patch is correct way to fix bug?
Carl Eugen Hoyos Oct. 30, 2016, 2:15 p.m. UTC | #2
> Am 30.10.2016 um 00:53 schrieb Paul B Mahol <onemda@gmail.com>:
> 
>> On 10/30/16, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
>> Hi!
>> 
>> Attached patch fixes the command line provided in ticket #5916.
> 
> Can you explain why this patch is correct way to fix bug?

I don't know if the patch is correct (that's one of the reasons I sent it here).
Currently, afaict, for formats >8bit the mergeplanes filter only copies the left half of the frame from input to output, the patch tries to fix this.

Do you think this should be fixed differently (or that there is no such bug)?

Carl Eugen
diff mbox

Patch

From 4cb6347dd80bac8ffe65ba65c819a947d25955f6 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Sun, 30 Oct 2016 00:25:12 +0200
Subject: [PATCH] lavfi/mergeplanes: Fix >8 bit for big endian formats.

Fixes part of ticket #5916.
---
 libavfilter/vf_mergeplanes.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c
index 8128f33..c4948cc 100644
--- a/libavfilter/vf_mergeplanes.c
+++ b/libavfilter/vf_mergeplanes.c
@@ -192,9 +192,9 @@  static int config_output(AVFilterLink *outlink)
     outlink->sample_aspect_ratio = ctx->inputs[0]->sample_aspect_ratio;
 
     s->planewidth[1]  =
-    s->planewidth[2]  = AV_CEIL_RSHIFT(outlink->w, s->outdesc->log2_chroma_w);
+    s->planewidth[2]  = AV_CEIL_RSHIFT(((s->outdesc->comp[1].depth > 8) + 1) * outlink->w, s->outdesc->log2_chroma_w);
     s->planewidth[0]  =
-    s->planewidth[3]  = outlink->w;
+    s->planewidth[3]  = ((s->outdesc->comp[0].depth > 8) + 1) * outlink->w;
     s->planeheight[1] =
     s->planeheight[2] = AV_CEIL_RSHIFT(outlink->h, s->outdesc->log2_chroma_h);
     s->planeheight[0] =
@@ -220,9 +220,9 @@  static int config_output(AVFilterLink *outlink)
         }
 
         inputp->planewidth[1]  =
-        inputp->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, indesc->log2_chroma_w);
+        inputp->planewidth[2]  = AV_CEIL_RSHIFT(((indesc->comp[1].depth > 8) + 1) * inlink->w, indesc->log2_chroma_w);
         inputp->planewidth[0]  =
-        inputp->planewidth[3]  = inlink->w;
+        inputp->planewidth[3]  = ((indesc->comp[0].depth > 8) + 1) * inlink->w;
         inputp->planeheight[1] =
         inputp->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, indesc->log2_chroma_h);
         inputp->planeheight[0] =
-- 
1.8.4.5