Hi,
The patch below removes the hard coded image size from jpeg2yuv.
This makes it possible to decode bigger jpegs, e.g. photos from a
digital camera.
Gert
--- lavtools/jpeg2yuv.c.1 2006-05-27 13:24:12.000000000 +0200
+++ lavtools/jpeg2yuv.c 2006-05-27 13:50:27.000000000 +0200
@@ -42,8 +42,6 @@
#include "yuv4mpeg.h"
#include "mpegconsts.h"
-#define MAXPIXELS (1280*1024) /* Maximum size of final image */
-
typedef struct _parameters {
@@ -356,7 +354,7 @@
FILE *jpegfile;
int loops; /* number of loops to go */
uint8_t *yuv[3]; /* buffer for Y/U/V planes of decoded JPEG */
- static uint8_t jpegdata[MAXPIXELS]; /* that ought to be enough */
+ uint8_t *jpegdata;
y4m_stream_info_t streaminfo;
y4m_frame_info_t frameinfo;
loops = param->loop;
@@ -398,7 +396,14 @@
} else {
mjpeg_debug("Preparing frame");
- jpegsize = fread(jpegdata, sizeof(unsigned char), MAXPIXELS,
jpegfile);
+ fseek(jpegfile, 0, SEEK_END);
+ jpegsize = ftell(jpegfile);
+ fseek(jpegfile, 0, SEEK_SET);
+
+ jpegdata = (uint8_t *)malloc(jpegsize);
+
+ fread(jpegdata, sizeof(unsigned char), jpegsize, jpegfile);
+
fclose(jpegfile);
/* decode_jpeg_raw:s parameters from 20010826
@@ -483,6 +488,7 @@
free(yuv[0]);
free(yuv[1]);
free(yuv[2]);
+ free(jpegdata);
return 0;
}
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users