As a project I'm making an own implementation of a JPEG decoder. For some
reasons it's impossible to use the IJG library. I'm basing my design on the
T.80 recommendations. Now I made an implementation in C of the
Generate_size_table procedure (figure C.1). Now I use a test image
compressed with the IJG tools, without any options. So this means I have a
color, baseline jpeg with everything default. This means four DHT segments
can be found and so four Size tables have to be generated. These four can be
generated by my implementation, however tbles 0,2 and 3 are totaly correct
when I check them. Table 1 isn't It always has a value too much. I've run
several debuggig sessions and I'm not able to find the cause. I'll give the
portion of code I use Here below. If some one of you would like to have the
total code I have till now you may mail a request to urn...@hotmail.com.
Many thanks in advance
Arne
void HuffmanGenerateSizeTable()
{
int i;
int j;
int k;
int l = 0;
while(l < huffmancount)
{
k = 0;
i = 1;
j = 1;
do{
while(!(j > Minfo.HTab[l].Bits[i]))
{
Minfo.HTab[l].HUFFSIZE[k] = i;
k++;
j++;
}
i++;
j = 1;
}while(!(i > 16));
Minfo.HTab[l].HUFFSIZE[k] = 0;
LASTK[l] = k;
l++;
}
#ifdef debug
printf("\n\r--GENERATE: Size Table--");
printf("\n\rDEBUG: \n");
for(l = 0; l < huffmancount; l++)
{
printf("\n\rTable nr: \n");
for(i = 0; i < LASTK[l]; i++)
{
if(i%10 == 0)
printf("\n\r");
printf(" %5d", Minfo.HTab[l].HUFFSIZE[i]);
}
}
printf("\n\r--********************************************--");
#endif
}