-
May 6th, 2011, 02:43 AM
#1
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
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|