Hello all,

I have ANSI C routines for converting any of following colorspaces to
any other:

RGB/BGR 16 bit (565)
RGB/BGR 24 bit
RGB/BGR 32 bit
RGBA 32 bit (with alpha channel)
YUV420 planar (==YV12)
YUV422 planar
YUV422 packed (== YUY2)

All functions have one of the following prototypes:

// Conversion between packed formats

typedef void (*GVConvert_PACKED_PACKED)(guchar * in_pixels, guchar *
out_pixels, int num_pixels);

typedef void (*GVConvert_PACKED_ALPHA_PACKED)(guchar * in_pixels, guchar
* out_pixels, int num_pixels, guchar * background);

// Conversion from packed to planar YUV

typedef void (*GVConvert_PACKED_PLANAR)(guchar * in_pixels, guchar *
out_y, guchar * out_u, guchar * out_v, int width, int height);

typedef void (*GVConvert_PACKED_ALPHA_PLANAR)(guchar * in_pixels, guchar
* out_y, guchar * out_u,
                                              guchar * out_v, int width,
int height, guchar * background);

// Conversion from planar to packed YUV

typedef void(* GVConvert_PLANAR_PACKED)(guchar * in_y, guchar * in_u,
guchar * in_v, guchar * out_pixels, int width, int height);

// Conversion routines planar to planar

typedef void(* GVConvert_PLANAR_PLANAR)(guchar ** in_y_rows, guchar **
in_u_rows, guchar ** in_v_rows,
                                       guchar ** out_y_rows,
                                        guchar ** out_u_rows,
                                        guchar ** out_v_rows,
                                        int width,
                                        int height);

Maybe the different prototypes are a problem, but this was the most
convenient way for my project. The routines can surely be more
optimized, but they work well for now.
I would of course like to see assembler (MMX...) optimized routines for
this, but my assembler knowledge isn't enough for that.
The YUV<->RGB is done by lookup tables, which have to initialized first
(but only once), and RGB555 is missing.
I could contribute these functions if you are interested.

Best regards
Burkhard Plaum


_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile

Reply via email to