📄 scan_block.asm
字号:
/*******************************************************************************
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved.
Developed by Joint Development Software Application Team, IPDC, Bangalore, India
for Blackfin DSPs ( Micro Signal Architecture 1.0 specification).
By using this module you agree to the terms of the Analog Devices License
Agreement for DSP Software.
********************************************************************************
Module name : scan_block.asm
Label name : __scan_block
Version : 1.0
Change History :
Version Date Author Comments
1.0 10/20/2001 Sunder Original
Description : This function scans a given block whose width and height are
powers of 2. The scan pattern that is followed is the one
given in the
Prototype : char *__scan_block(char block[], int total, char destn[],
int offsets[], int width);
block -> Address of first element of the block,
total -> Total no. of elements in the block,
destn -> Bitstream location where the next symbol has to
be stored
offsets -> Address of the offsets table
width -> Width of the image
Returns : The address where the next symbol has to be written
Registers used : R0-R7, P0-P5, LC0.
Performance :
Code size : 114 Bytes
Cycle count : 46 (for block size of 4 when they are zerotree
descendants and hence not coded in the bitstream)
45 (for block size of 4 and all coefficients are
coded)
*******************************************************************************/
.section L1_code;
.global __scan_block;
.align 8;
__scan_block:
[--SP] = (R7:4,P5:3); //PUSH R7-R4,P5-P3 ON STACK
P0 = R0; //Address of block start
P1 = R2; //Destination address
R4 = R4-R4 (NS) || R7 = [SP+40];
//Counter ; Address of offsets
R1 = R1>>2 || P2 = [SP+44];
//R1 contains totalsize/4 || width of the block
P5 = R1; //P5 now contains totalsize/4 to be loaded in loop
// counter
R5.L = 0x0202;
R5.H = 0x0202;
R0 = 0x04;
R2 = 1;
R4 = 4;
LSETUP(_loop_START,_loop_end) LC0 = P5;
_loop_START:
R2 = R2 << 2 || R3.L = W[P0++P2];
R6 = R7+R2;
P5 = R6;
R6 = R4 << 0 || R3.H = W[P0];
R4 = R4+R0;
R6 = R6^R4;
R2.L = ONES R6 || P4 = [P5];
//count no. of ones || Load the required offset
CC = R3; //If the four coeffs are zero then skip coding them
//as they are ZT descendants
IF !CC JUMP _loop_end;
R3 = R3^R5; //ZT map value XOR 0x02 = Appropriate symbol code
R3 = R3>>8 || B[P1++] = R3;
R3 = R3>>8 || B[P1++] = R3;
R3 = R3>>8 || B[P1++] = R3;
B[P1++] = R3;
_loop_end:
P0 = P0+P4; //offset the ztmap read pointer appropriately
(R7:4,P5:3) = [SP++]; //POP R7-R4,P5-P3 FROM STACK
R0 = P1; //Return no. of symbols written into the bitstream
RTS;
__scan_block.end:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -