| | |
| | |
|
| | | //#define YUV420_TO_RGB888 1
|
| | | //#define YUV420_TO_RGB565 1
|
| | | #define YUV420_TO_ARGB8888 1
|
| | | #define YUV420_TO_ABGR8888 1
|
| | |
|
| | | struct FcPmBreackerContext
|
| | | {
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | bool convertYUV420ToARGB8888()
|
| | | bool convertYUV420ToABGR8888()
|
| | | {
|
| | | int src_height = height;
|
| | | int src_width = width;
|
| | |
| | | const uint8* src_u = (const uint8*)(src_y + (src_height * src_width));
|
| | | const uint8* src_v = (const uint8*)(src_u + (src_height * src_width / 4));
|
| | |
|
| | | libyuv::I420ToARGB(src_y, src_width,
|
| | | libyuv::I420ToABGR(src_y, src_width, // android ARGB_8888 is ABGR
|
| | | src_u, SUBSAMPLE(src_width, 2),
|
| | | src_v, SUBSAMPLE(src_width, 2),
|
| | | frameRGB, 4 * src_width,
|
| | | src_width, src_height);
|
| | | frameRGBSize = src_height * src_width * 4;
|
| | |
|
| | | //{
|
| | | // static size_t f = 0;
|
| | | // char fname[50];
|
| | | // sprintf(fname, "/sdcard/face-%u.argb", ++f);
|
| | | // FILE *pFile = fopen(fname, "wb");
|
| | | // fwrite(frameRGB, 1, frameRGBSize, pFile);
|
| | | // fclose(pFile);
|
| | | // if (f > 10)exit(0);
|
| | | //}
|
| | |
|
| | | return true;
|
| | | }
|
| | | };
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | #elif YUV420_TO_ARGB8888
|
| | | #elif YUV420_TO_ABGR8888
|
| | |
|
| | | bool FaceCache::getFaceListImage(std::vector<NativeImgIdx>& imgIdxes, uint8_t* buffImg, size_t& buffImgMaxSize)
|
| | | {
|
| | |
| | | if (ctx.frameRGBSize == 0)
|
| | | {
|
| | | //#todo should optimize not convert the whole image
|
| | | if (! ctx.convertYUV420ToARGB8888())
|
| | | if (! ctx.convertYUV420ToABGR8888())
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | NativeImgIdx imgidx;
|
| | | imgidx.offset = offset;
|
| | | imgidx.size = roiMat.total() * roiMat.elemSize();
|
| | | imgidx.type = MB_Frame::MBFT_ARGB8888;
|
| | | imgidx.type = MB_Frame::MBFT_ABGR8888;
|
| | | imgidx.width = roiMat.cols;
|
| | | imgidx.height = roiMat.rows;
|
| | |
|