AN2121 Freescale Semiconductor / Motorola, AN2121 Datasheet - Page 3

no-image

AN2121

Manufacturer Part Number
AN2121
Description
JPEG2000 Arithmetic Encoding on StarCore SC140
Manufacturer
Freescale Semiconductor / Motorola
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN2121SC
Manufacturer:
TERIDIAN
Quantity:
40
Abstract and Contents
This application note describes how the advanced features of the StarCore processor can be used to
implement the arithmetic coding algorithm employed in the JPEG2000 image compression standard. Both
C code and optimized assembler listings are presented, as well as a review of the basic principles of
arithmetic encoding.
1
2
2.1
2.1.1
2.1.2
2.1.2.1
2.1.2.2
2.1.2.3
2.2
2.3
2.3.1
2.3.2
2.4
2.4.1
2.4.2
2.4.2.1
2.4.2.2
2.4.3
2.4.4
2.4.5
2.4.6
3
3.1
3.1.1
3.1.2
3.1.3
3.2
3.2.1
3.2.1.1
3.2.1.2
3.2.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Background Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Huffman Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Arithmetic Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Binary Arithmetic Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
JPEG2000 Arithmetic Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
StarCore Implementation in C code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
StarCore Implementation in Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
The Huffman Coding Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Limitations of Huffman Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
BAC Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
BAC Decoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Removing Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Conditional Exchange of MPS Sense . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
An Adaptive BAC: Probability Estimation Process . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Finite Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Carry Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Software Versus Custom Hardware Implementation . . . . . . . . . . . . . . . . . . . . . . . . . 16
Encoder Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Flushing the Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
StarCore Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Address Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Change-of-Flow Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Practical Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Address Register Arithmetic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Multiple Address Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Minimum Obtainable Coding Rate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Varying Probability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
LPS Case. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
MPS Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
iii

Related parts for AN2121