I'm making a function to parse information from a jpeg header.
I can successfully locate the quantization table information byte (third byte after the 0xFF 0xDB
marker). I know that half of the byte denotes the precision level of the table, while the other half is the identification number for that quantization table.
What I am struggling with is which half of the byte is linked to each of those two values. The reason for my confusion is conflicting information.
This website states that the first four bits are the identification number, while the second four are precision.
This website states the inverse.
This document agrees with the latter.
Which of these is correct?
//i is the index of the 0xFF marker immediately before the 0xDB DQT marker byte
qTableID = (jpegData[i + 4] & 0xF0) >> 4; //gets the value of n: 0xn0
qTableID = (jpegData[i + 4] & 0x0F); //gets the value of n: 0x0n
By looking at the data of a few JPEG files I have determined that the first four bits are for precision and the second four are for the ID.