diff mbox series

[FFmpeg-devel] lsws/ppc/yuv2rgb: Fix transparency converting from yuv->rgb32

Message ID CAB0OVGqQHEqvKY9W7ts49Zo-4rtB+_2riZqX7_N6EatoerQWDQ@mail.gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] lsws/ppc/yuv2rgb: Fix transparency converting from yuv->rgb32 | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Carl Eugen Hoyos Jan. 23, 2021, 4:31 p.m. UTC
Hi!

Attached patch fixes ticket #9077 for me.

Please comment, Carl Eugen
Subject: [PATCH] lsws/ppc/yuv2rgb: Fix transparency converting from
 yuv->rgb32.

Based on 68363b69

Fixes ticket #9077.
---
 libswscale/ppc/yuv2rgb_altivec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Reimar Döffinger Jan. 23, 2021, 6:16 p.m. UTC | #1
Hi!

> On 23 Jan 2021, at 17:31, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> Attached patch fixes ticket #9077 for me.
> 
> Please comment, Carl Eugen
> <0001-lsws-ppc-yuv2rgb-Fix-transparency-converting-from-yu.patch>

Unfortunately I can’t test anything myself anymore since
I don’t have any devices with VGA input anymore (and connecting
the PPC MacMini via HDMI never worked reliably).
But checking the surrounding code it might make sense to check
if vec_splat(…{255}, 0) also works, or maybe even generates
better code.
The other cases where a non-0 constant (128) is needed in the
whole vector use vec_splat instead of duplicating the value,
so I assume there is a reason.
In this case actually even more, since the code is generic and
we might not actually know just how many 255s exactly we need
to put into that array?

Best regards,
Reimar
Carl Eugen Hoyos Jan. 23, 2021, 6:35 p.m. UTC | #2
Am Sa., 23. Jan. 2021 um 19:16 Uhr schrieb Reimar Döffinger
<Reimar.Doeffinger@gmx.de>:
>
> Hi!
>
> > On 23 Jan 2021, at 17:31, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> > Attached patch fixes ticket #9077 for me.
> >
> > Please comment, Carl Eugen
> > <0001-lsws-ppc-yuv2rgb-Fix-transparency-converting-from-yu.patch>
>
> Unfortunately I can’t test anything myself anymore since
> I don’t have any devices with VGA input anymore (and connecting
> the PPC MacMini via HDMI never worked reliably).
> But checking the surrounding code it might make sense to check
> if vec_splat(…{255}, 0) also works, or maybe even generates
> better code.
> The other cases where a non-0 constant (128) is needed in the
> whole vector use vec_splat instead of duplicating the value,
> so I assume there is a reason.
> In this case actually even more, since the code is generic and
> we might not actually know just how many 255s exactly we need
> to put into that array?

New patch attached, thank you!

Please comment, Carl Eugen
Reimar Döffinger Jan. 23, 2021, 10:21 p.m. UTC | #3
> On 23 Jan 2021, at 19:35, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 
> 
> New patch attached, thank you!
> 

Looks good to me.
I don’t know if I didn’t test the original change properly
or if compiler behaviour has changed/is different,
but this way should be more correct either way.
Carl Eugen Hoyos Jan. 24, 2021, 4:20 p.m. UTC | #4
Am Sa., 23. Jan. 2021 um 23:21 Uhr schrieb Reimar Döffinger
<Reimar.Doeffinger@gmx.de>:
>
>
>
> > On 23 Jan 2021, at 19:35, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> >
> >
> > New patch attached, thank you!
> >
>
> Looks good to me.

Patch applied.

Thank you, Carl Eugen
diff mbox series

Patch

diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
index 536545293d..d69ce4c016 100644
--- a/libswscale/ppc/yuv2rgb_altivec.c
+++ b/libswscale/ppc/yuv2rgb_altivec.c
@@ -424,13 +424,13 @@  static int altivec_ ## name(SwsContext *c, const unsigned char **in,          \
 }
 
 #define out_abgr(a, b, c, ptr)                                          \
-    vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255 }), c, b, a, ptr)
+    vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), c, b, a, ptr)
 #define out_bgra(a, b, c, ptr)                                          \
-    vec_mstrgb32(__typeof__(a), c, b, a, ((__typeof__(a)) { 255 }), ptr)
+    vec_mstrgb32(__typeof__(a), c, b, a, ((__typeof__(a)) { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), ptr)
 #define out_rgba(a, b, c, ptr)                                          \
-    vec_mstrgb32(__typeof__(a), a, b, c, ((__typeof__(a)) { 255 }), ptr)
+    vec_mstrgb32(__typeof__(a), a, b, c, ((__typeof__(a)) { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), ptr)
 #define out_argb(a, b, c, ptr)                                          \
-    vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255 }), a, b, c, ptr)
+    vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), a, b, c, ptr)
 #define out_rgb24(a, b, c, ptr) vec_mstrgb24(a, b, c, ptr)
 #define out_bgr24(a, b, c, ptr) vec_mstbgr24(a, b, c, ptr)