On Thu, 4 Aug 2005 13:25:59 +0000 Freyr Magn__sson <[EMAIL PROTECTED]> babbled:

> 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.

epeg WONT speed anything up here or change much - it's advantages in fast jpeg
thumbnailing are all in its load phase making use of libjpeg features to scale
while loading. it's likely not really worth using for this kind of thing - it
wont work better than using imlib2 for example.

> 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)

it's possible that the amount of allocate ram is not enough for the width/height
of the image you give libjpeg.

> 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.

your pixel data should be width * height * 3 bytes of pixel data.

> 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
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    [EMAIL PROTECTED]
裸好多                              [EMAIL PROTECTED]
Tokyo, Japan (東京 日本)


-------------------------------------------------------
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

Reply via email to