📄 img_thr_le2min.h
字号:
/* ======================================================================== */
/* TEXAS INSTRUMENTS, INC. */
/* */
/* IMGLIB DSP Image/Video Processing Library */
/* */
/* Release: Revision 1.04b */
/* CVS Revision: 1.8 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_le2min */
/* */
/* */
/* REVISION DATE */
/* 13-Mar-2002 */
/* */
/* USAGE */
/* This routine has the following C prototype: */
/* */
/* void IMG_thr_le2min */
/* ( */
/* 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 less than or equal to the */
/* threshold are set to 0 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_gt2thr, IMG_thr_le2thr, */
/* and IMG_thr_gt2max 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 CMPGTU4. The comparison results (stored in */
/* cFEDC, cBA98, c7654, and c3210) are expanded to masks using XPND4. */
/* The results are a set of four masks (xFEDC, xBA98, x7654, and */
/* x3210) which contain 0xFF in bytes that are greater than the */
/* threshold, and 0x00 in bytes that are less than or equal to the */
/* threshold. */
/* */
/* To complete the thresholding process, we compute the logical AND */
/* between our original pixel values and the mask. This forces */
/* values less than or equal to the threshold to 0x00, and leaves */
/* the other values unmodified. */
/* */
/* 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.1875 * rows * cols + 22. */
/* For rows = 32 and cols = 32, cycles = 214. */
/* */
/* This number includes 6 cycles of function call overhead. The */
/* exact overhead will vary depending on compiler options used. */
/* */
/* CODESIZE */
/* 164 bytes. */
/* ------------------------------------------------------------------------ */
/* Copyright (c) 2003 Texas Instruments, Incorporated. */
/* All Rights Reserved. */
/* ======================================================================== */
#ifndef IMG_THR_LE2MIN_H_
#define IMG_THR_LE2MIN_H_ 1
void IMG_thr_le2min
(
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 */
);
#endif
/* ======================================================================== */
/* End of file: img_thr_le2min.h */
/* ------------------------------------------------------------------------ */
/* Copyright (c) 2003 Texas Instruments, Incorporated. */
/* All Rights Reserved. */
/* ======================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -