Hi. I am staring to learn how to use libpng, libjpeg and libjpeg-turbo libraries. I have noticed they use common style:
First we declare some basic pointers like pointer to image object, pointer to row_pointers array, image structure and info structure.
Then we must open file, initiate the info structure and initiate the row_pointers.
Prepare decompression or directly read header.
Then we read the image. Then we have pointers in row_pointers which should refer to the loaded data. In libjpeg it is read row by row and then passed to the row_pointer[0] line by line.
Well, my question is what is best practice to work with images. I would like to learn some filters, changing colors, just like in Photoshop or similar programs. I was used to think that I would firs declare and allocate my image as one buffer of unsigned char*. Here in the libraries that have the row pointers. So I need to ask you about this - why it is so? Why not simple buffer?
Is it more powerful and faster to work with row pointers? Is it something with interlacing? I read interlacing is that you read odd and even rows separately, but here I see only one row_pointers not two arrays. I don't know how the libraries work internally. Are they able to use multithreading to read the image odd and even rows separately? I mean it would be 2x faster then reading line by line if it is possible to do that. Or what is sense of the interlacing?
Anyway do you know if libpng and lib-jepeg turbo can read the image line by line so I could maybe do that - read odd rows in one thread and even lines in second thread, would this be possible and efficient image reading?
My final question is if I must to copy the row_pointers to single buffer which I will use later for image filtering and special effects like Fourier transform or can I use for that effects the row_pointers and it will be more effective. I would like to skip unnecessary loops with pixel copy functions if data are already load in memory.