Books
in black and white
Main menu
Home About us Share a book
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

- Acharya T.

Acharya T. - John Wiley & Sons, 2000. - 292 p.
ISBN 0-471-48422-9
Download (direct link): standardforImagecompressioncon2000.pdf
Previous << 1 .. 67 68 69 70 71 72 < 73 > 74 75 76 77 78 79 .. 100 >> Next

A = A - qe;
/* new subinterval for MPS */
if ( A >= qe ) A = qe;
else
/* C is left unchanged */ /* conditional exchange */
>
CODING ALGORITHMS IN JPEG2000
QM-coder section in Chapter 2), and calls the “ByteOut()” procedure to output compressed data, if necessary.
Renormalizat ionENC()
{
do {
A = A « 1 C = C « 1 CT = CT -1 if ( CT == 0 ) call ByteOutQ;
> while ( A < 0x8000 )
/* left shift 1 bit */ /* left shift 1 bit */
ByteOut(): The “ByteOut” procedure is the one a that actually outputs the compressed data one byte at a time. It contains necessary procedures (bit.Stuffing() or no_bit_Stuffing()) to limit carry propagation into completed bytes, and bit-stuffing after a OxFF byte.
ByteOut()
{
if ( B == OxFF ) call bit_Stuff ingO ; else{
if ( C < 0x08000000 ) /* no carry bit */ call no_bit_Stuff ingO ; else {
B = B + 1; /* add carry bit to B */ if ( B == OxFF ){
C = C & 0x07FFFFFF; call bit_Stuff ingO ;
>
else
call no_bit_StuffingO ;
>
>
>
bit_Stuffing(): The carry bit c and the upper 7 ByteOut bits bs (as shown in Table 7.8) are moved into the byte B.
bit_Stuff ingO {
BP = BP + 1; /* output B */
B = C » 20; /* "cbbb bbbb" bits of C */
TIER-1 CODING IN JPEG2000
191
C = C & OxOOOFFFFF;
CT = 7;
>
no_bit-Stuffing (): The 8 ByteOut bits bs (as shown in Table 7.8) are moved into the byte B.
no_bit_Stuffing()
BP = BP + 1; /* output B */
B = C » 19; /* "bbb bbbb b" bits of C */
C = C & 0x0007FFFF;
CT = 8;
>
FLUSHregister(): After encoding all the symbols for each code-block generated by EBCOT, the “FLUSHregister” procedure is executed to stuff the register C with as many 1 bits as possible before it outputs the final bytes as compressed codewords.
FLUSHregister()
TempC = C + A;
C = C I OxOOOOFFFF;
if ( C >= TempC) C = C - 0x00008000;
C = C « CT; call ByteOut0;
C = C « CT; call ByteOut0;
if ( B == OxFF) discard B;
else
BP = BP + 1; /* output B */
7.3.3.2 Implementation of MQ-Decoder MQ-decoder requires three 16-bit registers Chigh, Clow, and A. Structures of these three registers are defined Table 7.9. Registers Chigh and Clow together can be considered as one 32-bit register C. During decoding, the new data is inserted into the upper 8 bits (b bits as shown in Table 7.9) of the Clow register one byte at a time. Register A is initialized with value 0x8000, as in the encoder.
192 CODING A L GORITHMS IN JPEG2000
Table 7.9 BAC Decoder Register Structures
Register MSB LSB
Chigh xxxx xxxx xxxx xxxx
Clow bbbb bbbb 0000 0000
A aaaa aaaa aaaa aaaa
The top-level flowchart for the MQ-decoder is shown in Figure 7.10. The pseudocode underlying procedures for implementation of the MQ-decoder algorithm is as follows.
• InitializationDECQ: The first input compressed byte will be put into the lower 8 bits position of the register Chigh, and then a new byte is read in using Byteln() procedure. In order to align the C register with the starting value of A, it is left-shifted 7 bits and the shift counter CT is adjusted accordingly.
Init i ali zat i onDEC() i
/* BP is pointing to the first compressed byte */
/* B is the byte pointed to by the pointer BP */
BP = BPST;
C = B « 16;
call BytelnQ ;
C = C « 7;
CT = CT - 7;
A = 0x8000;
reset I(CX) and MPS(CX) with their initial values.
>
• Byteln(): The “Byteln” procedure reads one byte of the compressed bitstream every time it is called, and compensates for any stuff bits following the OxFF byte that was inserted in the encoding process. If a OxFF byte is found with the next byte bigger than 0x8F, 1 bits are fed to the decoder.
BytelnQ
TIER-1 CODING IN JPEG2000
193
Fig. 7.10 BAC decoder flowchart.
CODING ALGORITHMS IN JPEG2000
if ( B == OxFF H
/* B1 is the byte pointed to by BP+1 */ if ( B1 > 0x8F ){
/* feed ’1' bits to the decoder */
C = C + OxFFOO;
CT = 8;
>
else ■[
BP = BP + 1;
C=C+(B«9);
CT = 7;
>
>
else ■[
BP = BP + 1;
C = C + ( B « 8 );
CT = 8;
>
>
LPS_EXCHANGE(): Based on the LPS subinterval value Qe(I(CX)) and the MPS subinterval value A, a conditional exchange may or may not occur. In either case, the new subinterval A will be updated with Qe(I(CX)). The decision bit D will be decoded according to the condition.
LPS_EXCHANGE()
if ( A < Qe(I(CX)) ){ /* conditional exchange */
A = Qe(I(CX));
D = MPS(CX);
I(CX) = NMPS(KCX));
>
else {
A = Qe(I(CX));
D = 1 - MPS(CX);
if ( SWITCH(KCX)) == 1 ) MPS(CX) = 1 - MPS (CX); I(CX) = NLPS(I(CX));
>
return D;
>
MPSJEXCHANGE0: Similar to the LPS-EXCHANGE() procedure, a conditional exchange may occur depending on the values of A and
TIER-2 CODING IN JPEG2000
195
Qe(I(CX)). The decision bit D will be decoded according to the condition. However, the MPS subinterval value A will not be updated inside the MPS-EXCHANGE() procedure.
MPS_EXCHANGE()
{
if ( A < Qe(I(CX)) ){ /* conditional exchange */
D = 1 - MPS(CX);
if ( SWITCH(I(CX)) == 1 ) MPS(CX) = 1 - MPS(CX);
I(CX) = NLPS(KCX));
>
else {
D = MPS(CX);
Previous << 1 .. 67 68 69 70 71 72 < 73 > 74 75 76 77 78 79 .. 100 >> Next