how to compress the whole image on one run (libjpeg IJG)?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: how to compress the whole image on one run (libjpeg IJG)?

  1. #1
    Join Date
    Apr 2011
    Posts
    20

    Question how to compress the whole image on one run (libjpeg IJG)?

    Hello,

    since I loose the control of my application, as soon as I start the compression/decompression process of the incoming image frame (from the usb camera), I tried to implement the compression in another way than standard. Normally, there is a while loop, where the image is compressed row for row. Maybe this while loop stucks my programm. Therefore I tried to do the compression in one step by the following code:

    Code:
    JSAMPROW row_pointer[1];        /* pointer to a single row */
    	int row_stride;                 /* physical row width in buffer */
    	row_stride = m_compressInfo.image_width * 3;   /* JSAMPLEs per row in image_buffer */
    
    	unsigned char* copyPointer =(unsigned char*) m_pcImageMemory;
    
    	// how many rows per run should be compressed
    	unsigned int howManyRows =  m_compressInfo.image_height / 48;
    
    	// compress the raw data row by row
    	while (m_compressInfo.next_scanline < m_compressInfo.image_height)
    	{
    		// define the next row of raw data
    		row_pointer[0]  =  copyPointer;
    		//jpeg_write_scanlines(&m_compressInfo, row_pointer, 1);
    		//copyPointer += row_stride;
    		jpeg_write_scanlines(&m_compressInfo, row_pointer, howManyRows);
    		copyPointer += row_stride*howManyRows;
    	}
    Even, if I reduce the number of rows to be compressed to 10 rows (image_height = 480 px), then there is an exception however. The exception occures in the function "null_convert()" within the file jccolor.c.

    Could you tell me please, what is my mistake and how to compress more than 1 row in one step?

    Thanks.

    best regards,

    vanselm

  2. #2
    Join Date
    Jun 2011
    Posts
    1

    Re: how to compress the whole image on one run (libjpeg IJG)?

    Is your question still valid?

  3. #3
    Join Date
    Apr 2011
    Posts
    20

    Re: how to compress the whole image on one run (libjpeg IJG)?

    Actually, I'm using another library now (libjpeg-turbo). But I'm still curious how could I do it with the jpeglib library. So if you know how to achieve it, you can post your solution here.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center