Thursday, September 29, 2011

[android-developers] The RenderScript funtions rsUnpackColor8888 and rsPackColorTo8888 do not work as expected.

The following RenderScript code does not work as expected.


void root(const uchar4 *v_in, uchar4 *v_out, const void *usrData,
uint32_t x, uint32_t y) {
float4 f4 = rsUnpackColor8888(*v_in); // unpack the color data
*v_out = rsPackColorTo8888(f4); // repack the color data
without changing it
rsDebug("in ", v_in->x, v_in->y, v_in->z, v_in->w);
rsDebug("in ", f4.x, f4.y, f4.z, f4.w);
rsDebug("in ", v_out->x, v_out->y, v_out->z, v_out->w); // v_out
does not equal v_in!!!!!! Each uchar > 0 is reduced by 1
}

void filter() {
rsForEach(gScript, gIn, gOut, 0);
}

This code should just copy the data unchanged but it alters every
value not equal to zero! The error seems to be in rsUnpackColor8888
since a color value of 255 is converted to 0.9985 and not 1.0.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment