[FFmpeg-devel] [PATCH]Support 64bit RGB input

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Mar 2 20:21:09 CET 2012


Michael Niedermayer <michaelni <at> gmx.at> writes:

> On Wed, Feb 29, 2012 at 11:08:02PM +0100, Carl-Eugen Hoyos wrote:
> > Hi!
> > 
> > Attached patch allows to convert 64bit RGB input.
> 
> LGTM

Conversion to RGBA produces (nearly) transparent files 
because A1 and A2 overflow in yuv2rgb_1_c_template if 
input is 0xFF, patch follows inlined:

diff --git a/libswscale/output.c b/libswscale/output.c
index cae2c31..cc34dd8 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1042,5 +1042,9 @@ yuv2rgb_1_c_template
             if (hasAlpha) {
                 A1 = (abuf0[i * 2    ] + 64) >> 7;
                 A2 = (abuf0[i * 2 + 1] + 64) >> 7;
+                if ((A1 | A2) & 0x100) {
+                    A1 = av_clip_uint8(A1);
+                    A2 = av_clip_uint8(A2);
+                }
             }


If this is ok, should it be committed together with the RGBA64 patch 
or is it unrelated?

Thank you, Carl Eugen



More information about the ffmpeg-devel mailing list