AN2121 Freescale Semiconductor / Motorola, AN2121 Datasheet - Page 43

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
; now renormalize
RENORME:
rentest:
norenorm:
FLUSH:
; terminate the coded bitstream with the correct marker code
; setbits - set as many of the C register bits as possible
SETBITS:
; end SETBITS
test:
BYTEOUT:
; byteout procedure
cmpgt d0,d7
tfrt d7,d0
asl
ift
bmtsts
jf RENORME
move.b (r1)+,r6
move.b (r1)+,d5
asla r6
adda r2,r6
adda r4,r5
loopend0
add
or
cmpeq d12,d1
ift
cmpgt d12,d1
ift
asll d4,d1
jsr BYTEOUT
asll d4,d1
jsr BYTEOUT
bmtsts #$ff,d2.l
nop
ift deca r7
stop
bmtsts
#$ffff,d1.l
; if A > 0.75 no renormalisation is required. i.e. A and 0x8000 not = 0
; if A < 0.75, needs renormalisation
; the most sigfig number is not set
; therefore, A has fallen below 0.75 (i.e. 0x8000)
d1,d0,d12
d0,d0
jsr BYTEOUT
sub d13,d1,d1
sub d13,d1,d1
#$8000,d0.l
#$ff,d2.l
deceq d4
Appendix B. Arithmetic Encoder: Assembly Code
Freescale Semiconductor, Inc.
For More Information On This Product,
move.w d8,(r6)
iff add d7,d1,d1
asl
tfra r6,r5
; r2 is the base address of the CONTXT:index table so to
; access correct index need to offset
; r4 is the base address of the CONTXT:MPS table so to
; access correct MPS need to offset
; TEMPC
; C = C OR 0xffff
; if C >= TEMPC then C = C - 0x8000
; C = C << CT
; BYTEOUT
; C = C << CT
; BYTEOUT
; if B = 0xFF then discard B
; if B not = 0xFF then BP = BP + 1
; BP already points to BP + 1, therefore, decrement r7
; finished coding all pairs of input
Go to: www.freescale.com
d1,d1
; A and 0x8000 = 1?
; if = 0 (i.e. T cleared) repeat renormalisation
; get next CX/D pair
; CX is an index into two CONTXT tables of
; indices and MPS data in d5,
; need to have CX-1 because
; CONTXT table address starts at 0
; stored indices as words in table r5 is index into
; CONTXT:MPS table of bytes
= C + A
; A < Qe(I(CX))?, r6 -> I(CX),
; I(CX) = NMPS(I(CX))
; if true, A = Qe(I(CX)),
; else C = C + Qe(I(CX))
; CT = CT - 1, CT = 0?
; A = A << 1, C = C << 1,
; if CT = 0, output byte
; need to multiply CX by 2 because
; B = 0xFF?
39

Related parts for AN2121