📄 boundary.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 : boundary.asm
Label name : __boundary
Version : 1.3
Change History :
Version Date Author Comments
1.3 11/18/2002 Swarnalatha Tested with VDSP++ 3.0
compiler 6.2.2 on
ADSP-21535 Rev.0.2
1.2 11/13/2002 Swarnalatha Tested with VDSP++ 3.0
on ADSP-21535 Rev. 0.2
1.1 01/28/2002 Raghavendra Modified to match
silicon cycle count
1.0 06/29/2001 Raghavendra Original
Description : This function returns the non-zero gray value with its
co-ordinates in a given image.
The image assumes the background has zero value.
The X and Y co-ordinates are packed and higher half contains X
co-ordinate and lower half contains Y co-ordinate. XY
co-ordinate array is integer type and output array is
unsigned character type.
Prototype : void boundary(unsigned char* in, int row,int col,int *XY,
unsigned char * out);
in --> Address of Input image
row --> Number of row in the image
col --> Number of columns in image
xy --> Array to store XY co-ordinates
out --> Address Output image
Assumption : Input array and buffer which stores XY coordinate values
should be in different banks.
Registers used : R0-R3, I1, L1, P0-P2, LC0, LC1.
Performance :
Code Size : 72 bytes
Cycle count : 563 Cycles for 8x8 image with 36 non zero pixel
*******************************************************************************/
.section L1_code;
.global __boundary;
.align 8;
__boundary:
L1 = 0;
P2 = R0; // Address of input array
P0 = R1; // No. of ROWS
P1 = R2; // N0. of Columns
R3 = R1 - R1(NS) || R0 = [SP+12];
// Clear R3
R2 = 1;
I1 = R0;
LSETUP(ROW_ST,ROW_END)LC0 = P0;
// Loop counter == ROWS
P0 = [SP+16];
MNOP || R0 = B[P2++](Z);// fetch first input
MNOP; // To remove IAU empty stall
ROW_ST:
LSETUP(COL_ST,COL_END)LC1 = P1;
// Loop counter == COLS
COL_ST: B[P0] = R0; // store the input value
CC = R0 == 0; // check if input==0
R0 = B[P2++](Z);// fetch next input
IF CC JUMP COL_END;
// If true jump COL_END
[I1++] = R3 || R1 = B[P0++](z);
// Store XY co-ordinate and increment the pointer
COL_END: R3.L = R3.L + R2.L(NS);
// Increment Y co-ordinate
R3.L = 0; // Clear Y co-ordinate
ROW_END:R3.H = R3.H + R2.L(NS);
// Increment X co-ordinate
RTS;
NOP; // To avoid one stall if LINK or UNLINK happens to
// be the next instruction in the memory.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -