jpeg plugin stuff

Eric Joseph Hudson eric138 at cc.gatech.edu
Thu Jul 13 05:56:56 UTC 2000


for the huffman encoding of the jpeg reading it has a method to 
decode bytes of the file 
(JPEGReadWriter>>decodeBlockInto:component:dcTable:acTable:). 
This method then uses other methods within JPEGReadWriter such as 
getBits and peekBits and they in turn call a method called fillBuffer 
and fillBuffer accesses things from the stream by doing 
stream peekFor: 16r00.
where stream is an instance variable in ImageReadWriter (parent class 
of JPEGReadWriter).

so here's the order of the calls with comments below them indicating 
who they call within their method.
JPEGReadWriter>>decodeMCU
	"calls decodeBlockInto:component:dcTable:acTable:"
JPEGReadWriter>>decodeBlockInto:component:dcTable:acTable:
	"calls getBits and peekBits (among other things)"
JPEGReadWriter>>decodeByte:withTable:
	"calls getBits and peekBits (among other things)"
JPEGReadWriter>>getBits
	"calls fillBuffer (among other things)"
JPEGReadWriter>>peekBits
	"calls fillBuffer (among other things)"
JPEGReadWriter>>fillBuffer
	"makes references to the JPEGReadWriter's stream"


I found after testing different jpegs that the huffman encoding is 
taking a good bit of time, so it should become a primitive. The two 
that take the most time in huffman encoding are the decodeBlock... and
decodeByte:withTable: messages. So for huffman encoding I just wanted 
to write primitives for these two. And I thought that these primitives 
(located in JPEGReadWriterPlugin) could make calls to getBits and 
peekBits (located in JPEGReadWriter). But this is where the problem of 
compiling comes. In the translated code, it makes references to these 
calls which are in JPEGReadWriter not in JPEGReadWriterPlugin, but the 
receiver of the JPEGReadWriterPlugin is JPEGReadWriter so it is 
accessable off of the stack so I don't see why it would be a problem.

It would be easy to write the sub-routines for getBits 
and peekBits (and other such sub-routines) but for things which access 
the stream (like fillBuffer which is called by getBits and peekBits), 
it looks like it would be turtles all the way down, just writing 
sub-routine after sub-routine for stuff that already exists.
The same problem occurs in the discrete cosine transfer and the color 
mapping primitives. They all need access to JPEGReadWriter's
methods. thanks in advance for any help.

-eric joseph hudson <eric138 at cc.gatech.edu>

On Wed, 12 Jul 2000, Tim Rowledge wrote:

> You might want to post some example snippets of the code that is causng
> you trouble.
> 
> -- 
> Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
> CChheecckk yyoouurr dduupplleexx sswwiittcchh..
> 
> 





More information about the Squeak-dev mailing list