static void imageProcess(const void* p, int width, int height) { unsigned char* src = (unsigned char*)p; #if 0 unsigned char *dst = NV12ToRGB(src, width, height); unsigned char *rgb_buf = malloc(width * height * 3); NV12ToRGB(src, width, height); jpegWrite(dst, width, height); #else unsigned char *yuv_src[3]; yuv_src[0] = src; yuv_src[2] = src+width*height; yuv_src[1] = src+width*height + width*height/4; unsigned char *rgb_buf = malloc(width * height * 3); yuv_to_rgb(yuv_src, 0, width, height, rgb_buf); jpegWrite(rgb_buf, width, height); BOOL CreateBmp(const char *filename, uint8_t *pRGBBuffer, int width, int height, int bpp); CreateBmp("out.bmp", rgb_buf, width, height, 24); #endif }
static void imageProcess(const void* p, int width, int height) { unsigned char* src = (unsigned char*)p; unsigned char *dst = NV12ToRGB(src, width, height); jpegWrite(dst, width, height); }
static void Process(unsigned char* p, int width, int height, char * outfilename) { unsigned char *rgb_buf = malloc(width * height * 3); ConvertYUV2RGB(p, rgb_buf, width, height); jpegWrite(rgb_buf, width, height, outfilename); free(rgb_buf); }
bool writeJpeg( const Matrix &matrix, const char *fileName, int quality ) { if( fileName == 0 || *fileName == 0 ) { return log_error( "Bad file name" ); } ImageRgb image; if( !createImage( image, matrix )) { return false; } return jpegWrite( image, fileName, quality ); // Quality bounds checked in jpegWrite() }
/** process image read */ static void imageProcess(const void* p) { unsigned char* src = (unsigned char*)p; unsigned char* dst = malloc(width*height*3*sizeof(char)); YUV420toYUV444(width, height, src, dst); // write jpeg jpegWrite(dst); // free temporary image free(dst); }
static void process_image(char *p) { int bpp = 16; if (discard_count) { discard_count -= 1; printf("will discard %d more frames\n", discard_count); return; } if (save_jpeg) { unsigned char *src = (unsigned char *)p; // convert from YUV422 to RGB888 YUV422toRGB888(g_pix_width, g_pix_height, src, g_img_buf); // write jpeg jpegWrite(g_img_buf); } else { save_yuv(bpp, p); /* 422 */ } file_loop++; }
/** process image read */ static void imageProcess(const void* p, struct timeval timestamp) { //timestamp.tv_sec //timestamp.tv_usec unsigned char* src = (unsigned char*)p; unsigned char* dst = malloc(width*height*3*sizeof(char)); YUV420toYUV444(width, height, src, dst); if(continuous==1) { static uint32_t img_ind = 0; int64_t timestamp_long; timestamp_long = timestamp.tv_sec*1e6 + timestamp.tv_usec; sprintf(jpegFilename,continuousFilenameFmt,jpegFilenamePart,img_ind++,timestamp_long); } // write jpeg jpegWrite(dst,jpegFilename); // free temporary image free(dst); }