📄 img_thr_gt2thr.h64
字号:
;* ======================================================================== *;
;* TEXAS INSTRUMENTS, INC. *;
;* *;
;* IMGLIB DSP Image/Video Processing Library *;
;* *;
;* Release: Revision 1.04b *;
;* CVS Revision: 1.5 Sun Sep 29 03:32:30 2002 (UTC) *;
;* Snapshot date: 23-Oct-2003 *;
;* *;
;* This library contains proprietary intellectual property of Texas *;
;* Instruments, Inc. The library and its source code are protected by *;
;* various copyrights, and portions may also be protected by patents or *;
;* other legal protections. *;
;* *;
;* This software is licensed for use with Texas Instruments TMS320 *;
;* family DSPs. This license was provided to you prior to installing *;
;* the software. You may review this license by consulting the file *;
;* TI_license.PDF which accompanies the files in this library. *;
;* ------------------------------------------------------------------------ *;
;* Copyright (C) 2003 Texas Instruments, Incorporated. *;
;* All Rights Reserved. *;
;* ======================================================================== *;
;* ======================================================================== *;
;* Assembler compatibility shim for assembling 4.30 and later code on *;
;* tools prior to 4.30. *;
;* ======================================================================== *;
;* ======================================================================== *;
;* End of assembler compatibility shim. *;
;* ======================================================================== *;
* ========================================================================= *
* TEXAS INSTRUMENTS, INC. *
* *
* NAME *
* IMG_thr_gt2thr *
* *
* *
* REVISION DATE *
* 13-Sep-2002 *
* *
* USAGE *
* This routine has the following C prototype: *
* *
* void IMG_thr_gt2thr *
* ( *
* const unsigned char *in_data, /* Input image data */ *
* unsigned char *restrict out_data, /* Output image data */ *
* short cols, short rows, /* Image dimensions */ *
* unsigned char threshold /* Threshold value */ *
* ) *
* *
* This routine performs a thresholding operation on an input *
* image in in_data[] whose dimensions are given in the arguments *
* 'cols' and 'rows'. The thresholded pixels are written to the *
* output image pointed to by out_data[]. The input and output *
* are exactly the same dimensions. *
* *
* DESCRIPTION *
* Pixels that are above the threshold value are written to the *
* output unmodified. Pixels that are greater than the threshold *
* are set to the threshold value in the output image. *
* *
* The exact thresholding function performed is described by *
* the following transfer function diagram: *
* *
* *
* 255_| *
* | *
* | *
* O | *
* U | *
* T th _|. . . . . _________ *
* P | /. *
* U | / . *
* T | / . *
* | / . *
* 0_|/________.__________ *
* | | | *
* 0 th 255 *
* *
* INPUT *
* *
* Please see the IMGLIB functions IMG_thr_le2thr, IMG_thr_gt2max *
* and IMG_thr_le2min for other thresholding functions. *
* *
* ASSUMPTIONS *
* The input and output buffers do not alias. *
* *
* The input and output buffers must be double-word aligned. *
* *
* The total number of pixels rows*cols must be at least *
* 16 and a multiple of 16. *
* *
* TECHNIQUES *
* The loop is unrolled 16x. Packed-data processing techniques *
* allow us to process all 16 pixels in parallel. *
* *
* Two LDDW instructions load in 16 pixels, designated p0 thru p9 *
* pA thru pF. These pixels are packed in the four registers pFEDC, *
* pBA98, p7654, and p3210 as follows: *
* *
* Upper double-word: *
* *
* 31 24 16 8 0 31 24 16 8 0 *
* +----+----+----+----+ +----+----+----+----+ *
* pFEDC | pF | pE | pD | pC | pBA98 | pB | pA | p9 | p8 | *
* +----+----+----+----+ +----+----+----+----+ *
* *
* Lower double-word: *
* *
* 31 24 16 8 0 31 24 16 8 0 *
* +----+----+----+----+ +----+----+----+----+ *
* p7654 | p7 | p6 | p5 | p4 | p3210 | p3 | p2 | p1 | p0 | *
* +----+----+----+----+ +----+----+----+----+ *
* *
* (Note that this diagram assumes a little endian memory *
* configuration, although this kernel works equally well in *
* either endian mode.) *
* *
* We compare these four words against a packed copy of the threshold *
* value. The packed threshold contains four copies of the threshold *
* value, one in each byte, like so: *
* *
* 31 24 16 8 0 *
* +----+----+----+----+ *
* thththth | th | th | th | th | *
* +----+----+----+----+ *
* *
* We compare using MINU4. This instruction with select the smaller *
* value between our input pixels and the threshold value. The *
* result is that input values above the threshold are clamped to the *
* threshold value. *
* *
* The 16 results are then written with two STDWs. *
* *
* MEMORY NOTE *
* This code is ENDIAN NEUTRAL. *
* *
* The input and output arrays must be double-word aligned. *
* *
* No bank conflicts occur, regardless of the relative alignment of *
* in_data[] and out_data[]. *
* *
* CYCLES *
* cycles = 0.125 * rows * cols + 20. *
* For rows = 32 and cols = 32, cycles = 148. *
* *
* This number includes 6 cycles of function call overhead. The *
* exact overhead will vary depending on compiler options used. *
* *
* CODESIZE *
* 108 bytes. *
* ------------------------------------------------------------------------- *
* Copyright (c) 2003 Texas Instruments, Incorporated. *
* All Rights Reserved. *
* ========================================================================= *
.global _IMG_thr_gt2thr
* ========================================================================= *
* End of file: img_thr_gt2thr.h64 *
* ------------------------------------------------------------------------- *
* Copyright (c) 2003 Texas Instruments, Incorporated. *
* All Rights Reserved. *
* ========================================================================= *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -