[MPlayer-dev-eng] [PATCH] RGB/BGR big-endian fixes
Michael Niedermayer
michaelni at gmx.at
Fri Feb 10 18:57:04 CET 2006
Hi
On Fri, Feb 10, 2006 at 04:02:11AM +0100, Diego Biurrun wrote:
> On Thu, Feb 09, 2006 at 12:50:59PM +0100, Michael Niedermayer wrote:
> >
> > On Thu, Feb 09, 2006 at 11:13:28AM +0100, Diego Biurrun wrote:
> > >
> > > This patch fixes both bgr16 and rgb24 with vo_x11.
> > >
> > > Michael, OK to commit?
> >
> > ok, except maybe the indention of the preprocessor directives could be
> > hmm changed somewhat ...
>
> Could you elaborate please? I don't see offhand how you would like the
> code to be formatted...
well, the patch:
for(i=0; i<num_pixels; i++)
{
+ #ifdef WORDS_BIGENDIAN
+ /* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
+ dst[3*i + 0] = src[4*i + 1];
+ dst[3*i + 1] = src[4*i + 2];
+ dst[3*i + 2] = src[4*i + 3];
+ #else
dst[3*i + 0] = src[4*i + 2];
dst[3*i + 1] = src[4*i + 1];
dst[3*i + 2] = src[4*i + 0];
+ #endif
}
should be:
for(i=0; i<num_pixels; i++)
{
+ #ifdef WORDS_BIGENDIAN
+ /* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
+ dst[3*i + 0] = src[4*i + 1];
+ dst[3*i + 1] = src[4*i + 2];
+ dst[3*i + 2] = src[4*i + 3];
+ #else
dst[3*i + 0] = src[4*i + 2];
dst[3*i + 1] = src[4*i + 1];
dst[3*i + 2] = src[4*i + 0];
+ #endif
}
or:
for(i=0; i<num_pixels; i++)
{
+# ifdef WORDS_BIGENDIAN
+ /* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
+ dst[3*i + 0] = src[4*i + 1];
+ dst[3*i + 1] = src[4*i + 2];
+ dst[3*i + 2] = src[4*i + 3];
+# else
dst[3*i + 0] = src[4*i + 2];
dst[3*i + 1] = src[4*i + 1];
dst[3*i + 2] = src[4*i + 0];
+# endif
}
--
Michael
More information about the MPlayer-dev-eng
mailing list