Closed HanalogInstruments closed 2 years ago
The header of a JPEG file contains data necessary to decode the compressed image. For something like motion-jpeg (MJPEG), there are standard tables used for each frame that don't have to be sent, but normal images have potentially unique Huffman and quantization tables which need to go together with the image data. You're welcome to modify the library code to fit your needs, but it sounds like your idea about raw JPEG data may not be correct.
The header of a JPEG file contains data necessary to decode the compressed image. For something like motion-jpeg (MJPEG), there are standard tables used for each frame that don't have to be sent, but normal images have potentially unique Huffman and quantization tables which need to go together with the image data. You're welcome to modify the library code to fit your needs, but it sounds like your idea about raw JPEG data may not be correct.
How can i decode the mcu from raw data by array?
I would like to help you, but I don't understand what you're asking. Can you provide more details or a concrete example?
Ah i mean to decode to get the bit like this:
Also i want to know get width from raw data with this method:
https://arxiv.org/pdf/1410.2100.pdf
Thank you for providing that example of your intention. The tool in your screenshot above would still need the Huffman/Arithmetic tables from the JPEG header to correctly decode the compressed bits. There are standard tables that often used by encoders that you can try, but usually the data is mostly worthless without knowing the Huffman tables. You can get lucky in files with restart markers and get "anchor points" to organize the MCU layout a bit, but it would be difficult to decode correct DC/AC values without the Huffman info.
Thank you for providing that example of your intention. The tool in your screenshot above would still need the Huffman/Arithmetic tables from the JPEG header to correctly decode the compressed bits. There are standard tables that often used by encoders that you can try, but usually the data is mostly worthless without knowing the Huffman tables. You can get lucky in files with restart markers and get "anchor points" to organize the MCU layout a bit, but it would be difficult to decode correct DC/AC values without the Huffman info.
I found that when i use a same chroma sampling header from random jpeg have standard huffman coding and DQT Tables the jpeg working fine but the issue is demension from raw data not match to the header so i'm trying to find how to get width and the jpeg have algin issue
When i glue the header to raw data:
After try to change the height and width from SOF
The align issue i think when we can read the grid mcu like this so we can add how many mcu fix the mcu missing to SOS
Is hard to me when find: "decode jpeg mcu" on google not show any information about that
That's pretty impressive. Yes, visually you can see what the MCU alignment/width is, but doing that automatically is much harder. Something working in your favor is that digital camera images (e.g. iPhone) tend to have just a few fixed sizes, so the total MCU count can give you the info you need to know the image dimensions. Also the restart count can usually be a multiple of the MCUs per row.
That's pretty impressive. Yes, visually you can see what the MCU alignment/width is, but doing that automatically is much harder. Something working in your favor is that digital camera images (e.g. iPhone) tend to have just a few fixed sizes, so the total MCU count can give you the info you need to know the image dimensions. Also the restart count can usually be a multiple of the MCUs per row.
Could you take a example code from your library to read the mcu from this sample:
https://drive.google.com/drive/folders/1Ylc61SRLVCjZ2nSla7e-8xmfg95EyMuu
I use the FFD8->FFDA+12bytes from IMG_1333_q100_s2x1.jpg and add the raw data start from 153605 ( dec ) bytes to end of file of _NHL0591.JPG.nppp
And the demsion i found is W: 3888 H: 2464
The digital camera like canon, nikon using chroma 4:2:2, and iphone,... use 4:2:0 almost
I don't have any example code which does what you want. You can look at DecodeMCU() and see what you need to "feed" it, but you will need to create a valid "fast" lookup table for the AC and DC coefficients to be able to call that function. I'm sorry, but you're basically on your own.
I don't have any example code which does what you want. You can look at DecodeMCU() and see what you need to "feed" it, but you will need to create a valid "fast" lookup table for the AC and DC coefficients to be able to call that function. I'm sorry, but you're basically on your own.
I think in my case to fix the demension issue the poblem is:
https://www.disktuna.com/jpeg-visual-corruption/
Do you have any suggestion to fix the visual corruption like this?
I'm sorry, but again, I can't help you with your project beyond what I've already said.
Hi, Can i use your library to decode only raw data from jpeg file without header to make it viewer?