[Webkit-unassigned] [Bug 30308] [GStreamer] Add direct support for ARGB videos

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 12 22:41:45 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=30308





--- Comment #3 from Sebastian Dröge <slomo at circular-chaos.org>  2009-10-12 22:41:45 PDT ---
(In reply to comment #2)
> (From update of attachment 41048 [details])
> > +        m_buffer = gst_buffer_make_writable (m_buffer);
> 
> Space.

*sigh* I'm so used to those spaces that I don't even notice them anymore, sorry

> > +        int x, y;
> 
> You should declare these inside the for loops initialization.

Ah right, C++ can do that :)

> > +#if G_BYTE_ORDER == G_LITTLE_ENDIAN
> > +                a = data[3];
> > +                data[0] = (a > 0) ? MIN ((data[0] * 255 + a / 2) / a, 255) : 0;
> > +                data[1] = (a > 0) ? MIN ((data[1] * 255 + a / 2) / a, 255) : 0;
> > +                data[2] = (a > 0) ? MIN ((data[2] * 255 + a / 2) / a, 255) : 0;
> > +                data += 4;
> > +#else
> > +                a = data[0];
> > +                data[1] = (a > 0) ? MIN ((data[1] * 255 + a / 2) / a, 255) : 0;
> > +                data[2] = (a > 0) ? MIN ((data[2] * 255 + a / 2) / a, 255) : 0;
> > +                data[3] = (a > 0) ? MIN ((data[3] * 255 + a / 2) / a, 255) : 0;
> > +                data += 4;
> > +#endif
> 
> I was asking krit about this. He pointed me to code in
> WebCore/platform/graphics/Color.cpp that does this and is apparently faster. We
> are wondering if that code could be reused?

Well, the above code was wrong anyway (that was doing un-premultiplication but
we want premultiplication). But using the code from Color.cpp really can't be
faster... you don't want a function call for every pixel and even if it was
inlined the byte array had to be converted to a Color and then from a unsigned
int to 4 bytes again...

I'll attach a new patch that does it correctly... and in a more efficient
fashion (only a single time for every buffer and not from the main thread).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list