int writeimage(char * name, int xres, int yres, unsigned char *imgdata, int format) { if (imgdata == NULL) return IMAGENULLDATA; switch (format) { case RT_FORMAT_PPM: return writeppm(name, xres, yres, imgdata); case RT_FORMAT_SGIRGB: return writergb(name, xres, yres, imgdata); case RT_FORMAT_JPEG: return writejpeg(name, xres, yres, imgdata); case RT_FORMAT_PNG: return writepng(name, xres, yres, imgdata); case RT_FORMAT_WINBMP: return writebmp(name, xres, yres, imgdata); case RT_FORMAT_TARGA: default: return writetga(name, xres, yres, imgdata); } }
int main(int argc, char * argv[]) { char readpath[BUFSZ]; char writepath[BUFSZ]; strcpy(readpath, argv[1]); strcpy(writepath, argv[2]); /* read YUV pixel pic to mem */ readyuv(readpath); /* convert YUV to RGB */ printf("converting %s to %s \n",readpath,writepath); yuv2rgb(pBmpBuf); printf("DONE\n"); /* data persistence */ writergb(writepath,bmpBuf); return 0; }