so candy, here you go...
seems you're using some screwed lzw algorithm - I haven't seen this with variable bitsize yet and if I start decoding the first 5 with 3bits per code I get something strange: dictionary entry 4 is 0,0 and in the next decoding step entry 5 will be created with 0,0 too - this can't be.. hmm.Candy wrote: If you do make one, please do a jpeg stream... gotta learn decoding them :)
It's 1-bit btw, with 0=white, 1=black, 2=clearcode, 3=EOI. Thus it starts with 3-bit (5x), then 4-bit (8x), then 5-bit... etc :)
Think I've padded a bit there...
the quantization table should be included in the jpeg standard (otherwise nobody could implement it ;)Got some hints to default quantization tables for jpeg?
the one-dimensional DCT works as follows:And preferably a nice calculation method to do the DCT?
all there's done is take 8 base vectors x[sub]0[/sub],..x[sub]7[/sub] from |R[sup]8[/sup], in each vector you put the samples of a cosine with frequencies ranging from 0 Hz to 3.5 Hz (center align the cosines) for the vector 0 to 7 respectively.
then take your sample data you want to transform, put that in another vector z from |R[sup]8[/sup].
then just do 8 dot products:
<z,x[sub]0[/sub]>
<z,x[sub]1[/sub]>
...
<z,x[sub]7[/sub]>
and you get the values for your transformed vector.
this is nothing more than a simple base transform. note that if you write down the base transform matrix, this matrix is orthogonal, so the inverse DCT is nothing else than multplying with the transpose of this matrix :)
If I look at this mathematical stuff closer, it also looks like a simple correlation (convolution stuff) to me, but I haven't read much on this topic yet..
well anyway I just made up a quickie (I was doing stuff like the following all day, so..):
8 functions which make a bitmap:
f1(c,b,a) = f8(c,b,a) = !a&&b || a&&!c || !b&&c
f2(c,b,a) = f7(c,b,a) = !a&&!b&&!c || a&&b&&c
f3(c,b,a) = f6(c,b,a) = !a&&!b || !a&&!c || a&&b&&c
f4(c,b,a) = f5(c,b,a) = !a&&!b || a&&c
each function calculates the bits for a column of the bitmap - just supply binary increasing arguments, e.g. f1(false,false,false) f1(false,false,true) f1(false,true,false) f1(false,true,true), f1(true,false,false),...
(yes the bitmap has a height of 8 then ;)
[me=mpp.eox3]listening to "aiboforcen - not unique" says now good night :)[/me]