Hi, I've been trying to modify the epeg library to accept raw rgb images for a robot project i'm involved in. Basicaly I'm feeding data straight from a webcam to the epeg lib for fast conversion to jpeg, all in memory.
I got the source and added a function to create an Epeg_Image to load the raw data into so I could skip the decode and scale phases in the epeg_encode() function I also exposed the _epeg_encode function so that I could access it directly. So... My problem is that I can´t complete the encode function it crashes while trying to iterate through the image lines. ... from _epeg_encode() while (im->out.jinfo.next_scanline < im->out.h) jpeg_write_scanlines(&(im->out.jinfo), &(im->lines[im->out.jinfo.next_scanline]), 1); ... it crashes in the third pass (gdb recived a SIGKILL) the function that creates the Epeg_Image struct looks like this: Epeg_Image* epeg_create_rgb_image(int width, int height, unsigned char* data) { Epeg_Image *im; im = calloc(1, sizeof(Epeg_Image)); // set file to null or empty im->in.file = NULL; im->in.f = NULL; im->in.comment = NULL; im->out.comment = NULL; im->out.thumbnail_info = 0; im->out.f = NULL; im->out.file = NULL; im->in.jinfo.scale_num = 1; im->in.jinfo.scale_denom = 1; im->in.jinfo.do_fancy_upsampling = FALSE; im->in.jinfo.do_block_smoothing = FALSE; im->in.jinfo.out_color_space = JCS_RGB; im->in.jinfo.output_components = 3; im->out.h = height; im->out.w = width; im->out.quality = 75; im->color_space = EPEG_RGB8; unsigned char* p; p = data; im->pixels = p; if (!im->pixels) return NULL; im->lines = malloc(height * sizeof(char *)); if (!im->lines) return NULL; return im; } I'm certain that the source of my problems lies in this function and how I configure the jpeg structs. If someone can see what I'm missing I'd be very grateful. I would us this like this: unsigned char* data; int size; unsigned char** output; int out_size; readCamera(data, size); // unimportant how this function works Epeg_Image* im = epeg_create_rgb_image(352, 288, data); epeg_encode_raw(im); // calls the _epeg_encode() function epeg_memory_output_set(output, size); epeg_close(); Thanks for your time, regards, Freyr ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel