diff options
author | Mike Melanson <mike@multimedia.cx> | 2002-07-15 00:51:17 +0000 |
---|---|---|
committer | Mike Melanson <mike@multimedia.cx> | 2002-07-15 00:51:17 +0000 |
commit | 5a47aa47798718be5961dfcfae8d9c61fe93792e (patch) | |
tree | 83685c7cc669d511e6b7930d041ac4d575808660 | |
parent | 53c5ec96b87ef2bb61c7d3188d549623495d4500 (diff) | |
download | xine-lib-5a47aa47798718be5961dfcfae8d9c61fe93792e.tar.gz xine-lib-5a47aa47798718be5961dfcfae8d9c61fe93792e.tar.bz2 |
added some pixel unpacking macros
CVS patchset: 2268
CVS date: 2002/07/15 00:51:17
-rw-r--r-- | src/xine-utils/color.c | 13 | ||||
-rw-r--r-- | src/xine-utils/xineutils.h | 22 |
2 files changed, 33 insertions, 2 deletions
diff --git a/src/xine-utils/color.c b/src/xine-utils/color.c index b3929aa38..342cb4b95 100644 --- a/src/xine-utils/color.c +++ b/src/xine-utils/color.c @@ -61,7 +61,16 @@ * strategy is to maintain a YUV palette rather than an RGB palette and * render the image directly in YUV. * - * $Id: color.c,v 1.2 2002/07/14 20:13:23 tmmm Exp $ + * Some utility macros that you may find useful in your decoder are + * UNPACK_RGB15, UNPACK_RGB16, UNPACK_BGR15, and UNPACK_BGR16. All are + * located in xineutils.h. All of them take a packed pixel, either in + * RGB or BGR format depending on the macro, and unpack them into the + * component red, green, and blue bytes. If a CPU has special instructions + * to facilitate these operations (such as the PPC AltiVec pixel-unpacking + * instructions), these macros will automatically map to those special + * instructions. + * + * $Id: color.c,v 1.3 2002/07/15 00:51:17 tmmm Exp $ */ #include "xine_internal.h" @@ -310,6 +319,8 @@ void yuv444_to_yuy2_mmx(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { secondary_samples = width_mod / 2; rewind_bytes = 6 - width_mod; toss_out_shift = rewind_bytes * 8; +//printf ("width_mod = %d, secondary_samples = %d, rewind_bytes = %d, toss_out_shift = %d\n", +// width_mod, secondary_samples, rewind_bytes, toss_out_shift); /* set up some MMX registers: mm0 = 0, mm7 = color filter */ pxor_r2r(mm0, mm0); diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 65b9d02da..985961a88 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xineutils.h,v 1.16 2002/07/14 01:27:03 tmmm Exp $ + * $Id: xineutils.h,v 1.17 2002/07/15 00:51:17 tmmm Exp $ * */ #ifndef XINEUTILS_H @@ -753,6 +753,26 @@ extern void (*yuv444_to_yuy2) (unsigned char) \ ((v_r_table[r] + v_g_table[g] + v_b_table[b]) / SCALEFACTOR + CENTERSAMPLE) +#define UNPACK_BGR15(packed_pixel, r, g, b) \ + b = (packed_pixel & 0x7C00) >> 7; \ + g = (packed_pixel & 0x03E0) >> 2; \ + r = (packed_pixel & 0x001F) << 3; + +#define UNPACK_BGR16(packed_pixel, r, g, b) \ + b = (packed_pixel & 0xF800) >> 8; \ + g = (packed_pixel & 0x07E0) >> 3; \ + r = (packed_pixel & 0x001F) << 3; + +#define UNPACK_RGB15(packed_pixel, r, g, b) \ + r = (packed_pixel & 0x7C00) >> 7; \ + g = (packed_pixel & 0x03E0) >> 2; \ + b = (packed_pixel & 0x001F) << 3; + +#define UNPACK_RGB16(packed_pixel, r, g, b) \ + r = (packed_pixel & 0xF800) >> 8; \ + g = (packed_pixel & 0x07E0) >> 3; \ + b = (packed_pixel & 0x001F) << 3; + extern int y_r_table[256]; extern int y_g_table[256]; extern int y_b_table[256]; |