[FFmpeg-devel] [PATCH] swscale alpha channel support
Michael Niedermayer
michaelni
Thu Mar 5 16:31:00 CET 2009
On Thu, Mar 05, 2009 at 09:25:51AM +0100, C?dric Schieli wrote:
> 2009/3/2 Michael Niedermayer <michaelni at gmx.at>:
> > On Fri, Feb 27, 2009 at 11:30:25PM +0100, C?dric Schieli wrote:
> > [...]
> >
> >> @@ -608,9 +635,15 @@
> >> ? ? ? ? ?Y >>=10;\
> >> ? ? ? ? ?U >>=10;\
> >> ? ? ? ? ?V >>=10;\
> >> + ? ? ? ?if (alpha){\
> >> + ? ? ? ? ? ?A = 0;\
> >> + ? ? ? ? ? ?for (j=0; j<lumFilterSize; j++)\
> >> + ? ? ? ? ? ? ? ?A += alpSrc[j][i ? ? ] * lumFilter[j];\
> >> + ? ? ? ? ? ?A >>=10;\
> >> + ? ? ? ?}\
> >>
> >
> > this does not look like its rounding to nearest
>
> Why not ? This is the exact same code as for the luma plane. Or am I
> missing something ?
the YUV are transformed to RGB and some "0.5" added before
final shiftdown later
alpha is possible shifted down redundantly twice and no "0.5" is
added (not sure i would have to reread teh code ...)
>
> [...]
>
> >> @@ -1095,11 +1147,28 @@
> >> ? ? ? ? ? ? ?switch(c->dstFormat)
> >> ? ? ? ? ? ? ?{
> >> ? ? ? ? ? ? ?case PIX_FMT_RGB32:
> >> + ? ? ? ? ? ? ? ?if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){
> >> + ? ? ? ? ? ? ? ? ? ?YSCALEYUV2PACKEDX
> >> + ? ? ? ? ? ? ? ? ? ?YSCALEYUV2RGBX
> >> + ? ? ? ? ? ? ? ? ? ?"movq ? ? ? ? ? ? ? ? ? ? ?%%mm2, "U_TEMP"(%0) ?\n\t"
> >> + ? ? ? ? ? ? ? ? ? ?"movq ? ? ? ? ? ? ? ? ? ? ?%%mm4, "V_TEMP"(%0) ?\n\t"
> >> + ? ? ? ? ? ? ? ? ? ?"movq ? ? ? ? ? ? ? ? ? ? ?%%mm5, "Y_TEMP"(%0) ?\n\t"
> >> + ? ? ? ? ? ? ? ? ? ?YSCALEYUV2PACKEDX_YA(ALP_MMX_FILTER_OFFSET)
> >> + ? ? ? ? ? ? ? ? ? ?"psraw ? ? ? ? ? ? ? ? ? ? ? ?$3, %%mm1 ? ? ? ? \n\t"
> >> + ? ? ? ? ? ? ? ? ? ?"psraw ? ? ? ? ? ? ? ? ? ? ? ?$3, %%mm7 ? ? ? ? \n\t"
> >> + ? ? ? ? ? ? ? ? ? ?"packuswb ? ? ? ? ? ? ? ? ?%%mm7, %%mm1 ? ? ? ? \n\t"
> >> + ? ? ? ? ? ? ? ? ? ?"movq ? ? ? ? ? ? ? "U_TEMP"(%0), %%mm2 ? ? ? ? \n\t"
> >> + ? ? ? ? ? ? ? ? ? ?"movq ? ? ? ? ? ? ? "V_TEMP"(%0), %%mm4 ? ? ? ? \n\t"
> >> + ? ? ? ? ? ? ? ? ? ?"movq ? ? ? ? ? ? ? "Y_TEMP"(%0), %%mm5 ? ? ? ? \n\t"
> >
> > it seems that YSCALEYUV2PACKEDX_YA could be changed to take teh registers as
> > parameters to avoid the movq TEMP stuff ?
> > also same applies to all other cases where its possible
>
> Patch attached
ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090305/45e6eb69/attachment.pgp>
More information about the ffmpeg-devel
mailing list