📄 dehuff.asm
字号:
; TEXAS INSTRUMENTS FRANCE
; Wireless Communication Applications / ASP
;
;
;
;
;
;
; ASM Code Module of the jpdvld.asm
;
;
;
;
;
;
;
;Archives: \jpdec_p3\code\src\jpdvld.asm
;
;Filename: jpdvld.asm
;
;Version: 1.0
;Status : draft (X)
; proposal ( )
; accepted ( )
;
;AUTHOR Marc PERESSE
;
; Application Specific Products -
; Wireless Communication Applications
; BP 5
; 06270 Villeneuve Loubet
; FRANCE
;
;
; UNDER LICENSE AGREEMENT.
;
;(C) Copyright 2001. Texas Instruments France. All rights reserved.
;
;
; Change history:
;
; VERSION DATE / AUTHORS COMMENT
; 0.0 14-Mar-00 / YOO original created
; 1.0 23-Feb-01 / PERESSE migration and optimization on C5510
;
;
; 1 ABSTRACT
;
; 1.1 Module Type
;
; This file contain the Huffman decoder function.
;
; 1.2 Functional Description
;
; This file contains one subroutine:
;
; 1) _f_jpegdechuff: Universal Huffman decoder.
;
; 1.3 Compilation Information
;
; Compiler: TMS320C55X ASSEMBLER
; Version: 1.80 (PC)
; Activation: cl55 -g -as -mg -iC:\jpdec_p3\code\inc -ml jpdvld.asm
;
;
; 1.4 Notes and tricky points
;
;
; 2 VOCABULARY
;
; 2.1 Definition of Special Words, Keywords
;
; 2.2 Local Compiler Flags
; 2.3 Local Constants
.mmregs
; 3 EXTERNAL RESOURCES
;
; 3.1 Include Files
; .include "vldconst.inc"
; .include "jpegdec.inc"
.include "IMG_JPEG_VLD_const.inc"
;include ".inc"
; 3.2 External Data within same module
.ref _lowmask, _bitmask
; 3.3 External Functions within same module
; 3.4 Import Functions of other module
; 4 FILE DATA STRUCTURES
.data
; 4.1 Internal Data within the same module
unzigzag_r: ; unzigzag matrix in reverse order
.word 0, 63, 62, 55, 47, 54, 61, 60
.word 53, 46, 39, 31, 38, 45, 52, 59
.word 58, 51, 44, 37, 30, 23, 15, 22
.word 29, 36, 43, 50, 57, 56, 49, 42
.word 35, 28, 21, 14, 7, 6, 13, 20
.word 27, 34, 41, 48, 40, 33, 26, 19
.word 12, 5, 4, 11, 18, 25, 32, 24
.word 17, 10, 3, 2, 9, 16, 8, 1
; 4.2 Internal Data for other modules
; 5 INTERNAL or EXPORT ROUTINES/FUNCTIONS
;
; 5.1 Internal Functions within the same module
; 5.2 Export Functions for other modules
.global _IMG_jpeg_vld
; HeaderBegin
;==============================================================================
;
;-----------------------------------------------------------------------------
; 6.1 _f_jpegdechuff
;
; 6.1.1 Functional Description
;
; It is an Export Function for the module.
;
;*************************************************************************
; C Protocol:
; void JpegDecHuff(stream_p, lastdc, dcdtab, dcdctl)
; Bistream *stream_p; /* pointer to bitstream info structure */
; int *lastdc; /* pointer to DC predictor */
; int *out_p; /* pointer to output buffer */
; int htype; /* Huffman table type (Luminance/Chrominance) */
;
; Output:
; Void
;
; Description:
; Decodes input stream specified by stream_p and stores output at
; out_p while properly updating lastdc. htype determines the Huffman
; table type (0: Luminance, 1: Chrominance)
;
; Created by: Youngjun Yoo (2000)
;*************************************************************************
;-----------------------------------------------------------------------------
;
; 6.1.2 Activation
;
; Activation example: f_jpegdechuff(bstr_p, jdcfg_p->lastdc+i, tmpmat, htype);
; Reentrancy: Yes
; Recursive : No
;
; 6.1.3 Inputs
;
; Data structure: XAR0/ *stream_p
; Data format: 23.0
; Use: pointer to bitstream info structure.
; typedef struct {
; int bit_ptr; /* bit counter for current word (MSB-16) */
; int buf_ptr; /* buffer counter for data buffer (*databuf) */
; int bits_count; /* Reserved */
; unsigned int *databuf; /* pointer to current data buffer */
; } jdbstr_t;
;
; Data structure: XAR1/ *lastdc
; Data format: 23.0
; Use: pointer to DC predictor.
;
;
; Data structure: XAR2/ *out_p
; Data format: 23.0
; Use: pointer to output buffer.
; Bit ordering: MSB/LSB
;
;
; Data structure: T0/ htype
; Data format: 16.0
; Use: Huffman table type (Luminance/Chrominance).
; Bit ordering: if needed MSB/LSB (optional)
;
; Data structure: XAR3/ hufvar
; Data format: 23.0
; Use: pointer to VLD structure:
; typedef struct {
; int UvldTabDC[2][32];
; int UvldCtlTabDC[2][17];
; int UvldTabAC[2][256];
; int UvldCtlTabAC[2][17];
; int UvldLenMaxDC[2];
; int UvldLenMaxAC[2];
; } vldvar_t;
; Bit ordering: MSB/LSB
;
;
;
; 6.1.4 Outputs
;
; Data structure: out_p[0..63]
; Data format: 23.0
; Use: pointer to output buffer.
; Bit ordering: MSB/LSB
;
; 6.1.5 Special required for data structure
;
; 6.1.6 Entry and output conditions
;
; This function is C callable which means:
; - We have to save T2, T3, XAR5, XAR6, XAR7
; - The status registers have to be in the same
; state than before the call (excepted some bits)
; 6.1.7 Execution
;
; Execution time: Not applicable to this function
; Call rate:
;
;
;==============================================================================
;HeaderEnd
.text
.c54cm_off
.ARMS_off
; 6.1.8 Code
InputAD .set 0x0000
;**************
_IMG_jpeg_vld:
;**************
.dp 0
bit(ST2, #ST2_ARMS) = #0
bit(ST1, #ST1_CPL) = #0
pshboth(XAR7)
pshboth(XAR5)
push(AR6, T3)
SP = SP + #-2
@InputAD = AR0
XAR6=XAR4
dbl(@(p_arg3)) = XAR2
BK03 = #MCUBUFFINLEN
XAR7 = XAR2 ; AR7 = out_p (pipeline latency -> don't move)
XAR4 = dbl(@(p_uvldlenmaxdc))
XAR5 = dbl(@(p_uvldlenmaxac))
dbl(@(p_arg2)) = XAR1
@(p_arg4) = T0
; reset output array
AC0 = #0 || repeat(#31) ; for (i=0;i<64;i++)
dbl(*AR2+) = AC0 ; *out_p++ = 0;
; DC decoding
AC1 = *AR4(T0) ; PASS0 = UvldLenMaxDC[htype]
@(d_pass0) = AC1
AC1 = *AR5(T0)
@(d_tmp) = AC1 ; TMP = UvldLenMaxAC[htype]
; for Pass0 of AC decoding
T0 = #UVLDCTLTABSIZE
AC1 = @(p_uvldctltabdc+1)
AC1 = AC1 + (@(p_arg4) * T0)
@(d_pass2) = AC1 ; PASS2 = UvldCtlTabDC[htype]
;;;;;;;;;;;;;;;;;;;;;;;;;;
XAR5=XAR6
; *AR5+=#0x10
; *AR5+=#0x0
;XAR5 = XAR0 ; (use PASS2 to take into account SP--)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
T3 = #UVLDDCTABSIZE
XAR1 = dbl(@(p_uvldtabdc))
AC1 = AR1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -