Line 96... |
Line 96... |
|
|
int i;
|
int i;
|
unsigned int col, cols, row, rows;
|
unsigned int col, cols, row, rows;
|
int compression;
|
int compression;
|
int sample;
|
int sample;
|
|
char* bmpfilename = "image03.bmp";
|
|
char* jpgfilename = "image03.jpg";
|
|
int bmpsizelimit = 2*1024*1024;
|
|
|
compression = 0;
|
compression = 0;
|
|
|
// bmpimage=(unsigned char*)0x70000000;
|
// bmpimage=(unsigned char*)0x70000000;
|
bmpimage=(unsigned char*)0x30000000;
|
bmpimage=(unsigned char*)0x30000000;
|
Line 107... |
Line 110... |
|
|
xil_printf("\r\nBMP2JPG Code Compiled at %s %s\r\n", __DATE__, __TIME__);
|
xil_printf("\r\nBMP2JPG Code Compiled at %s %s\r\n", __DATE__, __TIME__);
|
|
|
bmpheader=&_bmpheader;
|
bmpheader=&_bmpheader;
|
|
|
if ((infile = sysace_fopen("image01.bmp", "r")) == NULL) {
|
if ((infile = sysace_fopen(bmpfilename, "r")) == NULL) {
|
ejpgl_error(eOPENINPUT_FILE, 0);
|
ejpgl_error(eOPENINPUT_FILE, 0);
|
}
|
}
|
|
|
bmpsize = sysace_fread(bmpimage, 1, 1024*1024, infile);
|
xil_printf("File name %s\r\n", bmpfilename);
|
|
bmpsize = sysace_fread(bmpimage, 1, bmpsizelimit, infile);
|
xil_printf("bmpsize %d\r\n", bmpsize);
|
xil_printf("bmpsize %d\r\n", bmpsize);
|
|
if (bmpsize==bmpsizelimit) {
|
#if 0
|
|
bmpsize = sysace_fread(bmpimage, 1, 65536, infile);
|
|
xil_printf("bmpsize %d\r\n", bmpsize);
|
|
if (bmpsize==65536) {
|
|
ejpgl_error(eLARGE_INPUTFILE, 0);
|
ejpgl_error(eLARGE_INPUTFILE, 0);
|
}
|
}
|
#endif
|
|
|
|
/* if ((outfile2 = sysace_fopen("image01b.bmp", "w")) == NULL) { // see if the BMP file is correctly read into memory
|
/* if ((outfile2 = sysace_fopen("image01b.bmp", "w")) == NULL) { // see if the BMP file is correctly read into memory
|
ejpgl_error(eOPENOUTPUT_FILE, 0);
|
ejpgl_error(eOPENOUTPUT_FILE, 0);
|
}
|
}
|
|
|
Line 139... |
Line 138... |
xil_printf("Image height: %d pixels\r\n", bmpheader->height);
|
xil_printf("Image height: %d pixels\r\n", bmpheader->height);
|
|
|
rows = bmpheader->height>>4; // 3;
|
rows = bmpheader->height>>4; // 3;
|
cols = bmpheader->width>>4; // 3;
|
cols = bmpheader->width>>4; // 3;
|
|
|
if ((outfile = sysace_fopen("image01.jpg", "w")) == NULL) {
|
if ((outfile = sysace_fopen(jpgfilename, "w")) == NULL) {
|
ejpgl_error(eOPENOUTPUT_FILE, 0);
|
ejpgl_error(eOPENOUTPUT_FILE, 0);
|
}
|
}
|
|
|
writejpegheader(outfile,bmpheader);
|
writejpegheader(outfile,bmpheader);
|
|
|