A method, an apparatus (100) and a computer program product for entropy
coding of discrete wavelet transform (DWT) coefficient bits that are arranged into
code blocks and coded in bitplane order using three coding passes for each bitplane
are disclosed. In the method, transform coefficients of a code block (200)
in sign-magnitude form are pre-analyzed. Statistical data about the coefficients
is stored, preferably with the coefficients. Significance state data (330),
coded data (340), magnitude refinement data (350), bit data (310),
and sign data (320) for the code block are buffered. More preferably, the
buffering is implemented using a FIFO (120, 1130), located between a context
generation module (110, 1120) and an arithmetic coder (130, 1150).
Based upon the statistical data, at least one command for at least one sequence
of bit and context pairs is generated for arithmetic encoding.