Hi, guys I convert preview yuv data to rgb in jni, then compose bitmap use the rgb data, but the image is like mosaic.
here is a sample image : https://mail.google.com/mail/?ui=2&ik=c2ccd577fd&view=att&th=1336875b99cdb1c4&attid=0.0.1&disp=emb&realattid=ii_133686ca710a02ac&zw After a close look at the image, it seems something wrong between rows, data in a row seems ok. It seems not anything wrong with the yuv to rgb code: unsigned char* pimg = (unsigned char*)dstBits; const uint8_t *src_y = (const uint8_t *)yuv; const uint8_t *src_u =(const uint8_t *)src_y + imageSize; for (size_t y = 0; y < height; ++y) { for (size_t x = 0; x < width; x += 2) { signed y1 = (signed)src_y[x] - 16; signed y2 = (signed)src_y[x + 1] - 16; signed v = (signed)src_u[x & ~1] - 128; signed u = (signed)src_u[(x & ~1) + 1] - 128; signed u_b = u * 517; signed u_g = -u * 100; signed v_g = -v * 208; signed v_r = v * 409; signed tmp1 = y1 * 298; signed b1 = (tmp1 + u_b) / 256; signed g1 = (tmp1 + v_g + u_g) / 256; signed r1 = (tmp1 + v_r) / 256; signed tmp2 = y2 * 298; signed b2 = (tmp2 + u_b) / 256; signed g2 = (tmp2 + v_g + u_g) / 256; signed r2 = (tmp2 + v_r) / 256; //dst_ptr[x / 2] = (rgb2 << 16) | rgb1; //dst_ptr[ x / 2] = rgb2; //dst_ptr[ x / 2 + 1] = rgb1; *pimg++ = kAdjustedClip[b1] ; *pimg++ = kAdjustedClip[g1] ; *pimg++ = kAdjustedClip[r1] ; *pimg++ = 255 ; *pimg++ = kAdjustedClip[b2] ; *pimg++ = kAdjustedClip[g2] ; *pimg++ = kAdjustedClip[r2] ; *pimg++ = 255 ; } src_y += width; if (y & 1) { src_u += width; } //dst_ptr += width ;//dstSkip / 4; } anyone has an idea? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

