diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2012-04-11 13:22:48 -0700 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2012-04-11 13:22:48 -0700 |
commit | 1a820e90d8848c6b0ac7c78b5a2e8b28c9738a3a (patch) | |
tree | 6d7da6487df206f892f3629f62ec71a2d0331fe1 /distrib | |
parent | b12c531a21d1e6edcc28dcfcd4ea63bd36db30c1 (diff) | |
download | external_qemu-1a820e90d8848c6b0ac7c78b5a2e8b28c9738a3a.zip external_qemu-1a820e90d8848c6b0ac7c78b5a2e8b28c9738a3a.tar.gz external_qemu-1a820e90d8848c6b0ac7c78b5a2e8b28c9738a3a.tar.bz2 |
Enable multi-touch emulation with -gpu on
This CL implements a callback that gets invoked by OpenGLES emulator on it framebuffer
updates. This allows transferring framebuffer changes to the supporting device.
Proper implementation of this new callback also required changes to JPEG compression,
addressing:
1. OpenGLES framebuffer format is RGBA8889, which required implementing line conversion
for this format.
2. OpenGLES framebuffer is (or at least could be) bottom-up arranged. This requires changes
to the compressor, so it compresses the FB starting from the bottom, so the resulting
image is up-bottom.
Change-Id: Icd4efbe4a251c838adfa3518decbfc43a7ef06c8
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/jpeg-6b/jccolor.c | 53 | ||||
-rw-r--r-- | distrib/jpeg-6b/jcparam.c | 1 |
2 files changed, 54 insertions, 0 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 */ |