aboutsummaryrefslogtreecommitdiffstats
path: root/distrib
diff options
context:
space:
mode:
Diffstat (limited to 'distrib')
-rw-r--r--distrib/jpeg-6b/jccolor.c53
-rw-r--r--distrib/jpeg-6b/jcparam.c1
-rw-r--r--distrib/jpeg-6b/jmorecfg.h4
-rw-r--r--distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c24
-rw-r--r--distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h6
5 files changed, 87 insertions, 1 deletions
diff --git a/distrib/jpeg-6b/jccolor.c b/distrib/jpeg-6b/jccolor.c
index 67078ab..61e262d 100644
--- a/distrib/jpeg-6b/jccolor.c
+++ b/distrib/jpeg-6b/jccolor.c
@@ -219,6 +219,52 @@ rgb565_ycc_convert (j_compress_ptr cinfo,
}
}
}
+
+/* Converts RGBA8888 row into YCbCr */
+METHODDEF(void)
+rgba8888_ycc_convert (j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
+{
+ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ register int r, g, b;
+ register INT32 * ctab = cconvert->rgb_ycc_tab;
+ register INT32* inptr;
+ register JSAMPROW outptr0, outptr1, outptr2;
+ register JDIMENSION col;
+ JDIMENSION num_cols = cinfo->image_width;
+
+ while (--num_rows >= 0) {
+ inptr = (INT32*)(*input_buf++);
+ outptr0 = output_buf[0][output_row];
+ outptr1 = output_buf[1][output_row];
+ outptr2 = output_buf[2][output_row];
+ output_row++;
+ for (col = 0; col < num_cols; col++) {
+ register const unsigned char* color = (unsigned char*)(inptr + col);
+ r = (*color) & 0xff; color++;
+ g = (*color) & 0xff; color++;
+ b = (*color) & 0xff; color++;
+ /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
+ * must be too; we do not need an explicit range-limiting operation.
+ * Hence the value being shifted is never negative, and we don't
+ * need the general RIGHT_SHIFT macro.
+ */
+ /* Y */
+ outptr0[col] = (JSAMPLE)
+ ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+ >> SCALEBITS);
+ /* Cb */
+ outptr1[col] = (JSAMPLE)
+ ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
+ >> SCALEBITS);
+ /* Cr */
+ outptr2[col] = (JSAMPLE)
+ ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
+ >> SCALEBITS);
+ }
+ }
+}
#endif /* ANDROID_RGB */
/**************** Cases other than RGB -> YCbCr **************/
@@ -505,6 +551,10 @@ jinit_color_converter (j_compress_ptr cinfo)
if (cinfo->input_components != 2)
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
break;
+ case JCS_RGBA_8888:
+ if (cinfo->input_components != 4)
+ ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+ break;
#endif /* ANDROID_RGB */
default: /* JCS_UNKNOWN can be anything */
@@ -551,6 +601,9 @@ jinit_color_converter (j_compress_ptr cinfo)
else if (cinfo->in_color_space == JCS_RGB_565) {
cconvert->pub.start_pass = rgb_ycc_start;
cconvert->pub.color_convert = rgb565_ycc_convert;
+ } else if (cinfo->in_color_space == JCS_RGBA_8888) {
+ cconvert->pub.start_pass = rgb_ycc_start;
+ cconvert->pub.color_convert = rgba8888_ycc_convert;
}
#endif /* ANDROID_RGB */
else
diff --git a/distrib/jpeg-6b/jcparam.c b/distrib/jpeg-6b/jcparam.c
index b305179..f8404dd 100644
--- a/distrib/jpeg-6b/jcparam.c
+++ b/distrib/jpeg-6b/jcparam.c
@@ -379,6 +379,7 @@ jpeg_default_colorspace (j_compress_ptr cinfo)
break;
#ifdef ANDROID_RGB
case JCS_RGB_565:
+ case JCS_RGBA_8888:
jpeg_set_colorspace(cinfo, JCS_YCbCr);
break;
#endif /* ANDROID_RGB */
diff --git a/distrib/jpeg-6b/jmorecfg.h b/distrib/jpeg-6b/jmorecfg.h
index 236bbcb..9dfde01 100644
--- a/distrib/jpeg-6b/jmorecfg.h
+++ b/distrib/jpeg-6b/jmorecfg.h
@@ -17,12 +17,14 @@
*
*/
+#include <inttypes.h>
+
#define ANDROID_RGB
#ifdef ANDROID_RGB
#define PACK_SHORT_565(r,g,b) ((((r)<<8)&0xf800)|(((g)<<3)&0x7E0)|((b)>>3))
#define PACK_TWO_PIXELS(l,r) ((r<<16) | l)
-#define PACK_NEED_ALIGNMENT(ptr) (((int)(ptr))&3)
+#define PACK_NEED_ALIGNMENT(ptr) (((int)(intptr_t)(ptr))&3)
#define WRITE_TWO_PIXELS(addr, pixels) do { \
((INT16*)(addr))[0] = (pixels); \
((INT16*)(addr))[1] = (pixels)>>16; \
diff --git a/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c b/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c
index 7b99d73..6e97c32 100644
--- a/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c
+++ b/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c
@@ -109,6 +109,21 @@ char *(*pXGetICValues)(XIC, ...) = NULL;
#undef SDL_X11_SYM
+static void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len)
+{
+ xReq *req;
+ WORD64ALIGN
+ if (dpy->bufptr + len > dpy->bufmax)
+ _XFlush(dpy);
+ dpy->last_req = dpy->bufptr;
+ req = (xReq*)dpy->bufptr;
+ req->reqType = type;
+ req->length = len / 4;
+ dpy->bufptr += len;
+ dpy->request++;
+ return req;
+}
+
static int x11_load_refcount = 0;
void SDL_X11_UnloadSymbols(void)
@@ -168,6 +183,15 @@ int SDL_X11_LoadSymbols(void)
X11_GetSym("XGetICValues",&SDL_X11_HAVE_UTF8,(void **)&pXGetICValues);
#endif
+ /*
+ * In case we're built with newer Xlib headers, we need to make sure
+ * that _XGetRequest() is available, even on older systems.
+ * Otherwise, various Xlib macros we use will call a NULL pointer.
+ */
+ if (!SDL_X11_HAVE_XGETREQUEST) {
+ p_XGetRequest = SDL_XGetRequest_workaround;
+ }
+
if (SDL_X11_HAVE_BASEXLIB) { /* all required symbols loaded. */
SDL_ClearError();
XInitThreads();
diff --git a/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h b/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
index b8d90e4..610982c 100644
--- a/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
+++ b/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
@@ -181,6 +181,12 @@ SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,
#endif
/*
+ * libX11 1.4.99.1 added _XGetRequest, and macros use it behind the scenes.
+ */
+SDL_X11_MODULE(XGETREQUEST)
+SDL_X11_SYM(void *,_XGetRequest,(Display* a,CARD8 b,size_t c),(a,b,c),return)
+
+/*
* These only show up on some variants of Unix.
*/
#if defined(__osf__)