📄 img_pix_sat_c.c
字号:
/* ======================================================================== */
/* TEXAS INSTRUMENTS, INC. */
/* */
/* IMGLIB DSP Image/Video Processing Library */
/* */
/* 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) 2002 Texas Instruments, Incorporated. */
/* All Rights Reserved. */
/* ======================================================================== */
/* ======================================================================== */
/* TEXAS INSTRUMENTS, INC. */
/* */
/* NAME */
/* IMG_pix_sat */
/* */
/* REVISION DATE */
/* 02-Oct-2000 */
/* */
/* USAGE */
/* This routine is C callable, and has the following C prototype: */
/* */
/* void IMG_pix_sat */
/* ( */
/* int n, // Number of pixels // */
/* const short *restrict in_data, // Incoming data // */
/* unsigned char *restrict out_data // Outgoing data // */
/* ); */
/* */
/* This code performs the saturation of 16 bit signed numbers */
/* to 8 bit unsigned numbers. If the data is over 255 it is */
/* saturated to 255, if it is less than 0 it is saturated to 0. */
/* */
/* DESCRIPTION */
/* The function IMG_pix_sat() takes signed 16-bit input pixels and */
/* saturates them to unsigned 8-bit results. Pixel values above */
/* 255 are clamped to 255, and values below 0 are clamped to 0. */
/* */
/* ------------------------------------------------------------------------ */
/* Copyright (c) 2002 Texas Instruments, Incorporated. */
/* All Rights Reserved. */
/* ======================================================================== */
void IMG_pix_sat_c
(
int n,
const short *restrict in_data,
unsigned char *restrict out_data
)
{
int i, pixel;
for (i = 0; i < n; i++)
{
pixel = in_data[i];
if (pixel > 0xFF)
{
out_data[i] = 0xFF;
} else if (pixel < 0x00)
{
out_data[i] = 0x00;
} else
{
out_data[i] = pixel;
}
}
}
/* ======================================================================== */
/* End of file: img_pix_sat.c */
/* ------------------------------------------------------------------------ */
/* Copyright (c) 2002 Texas Instruments, Incorporated. */
/* All Rights Reserved. */
/* ======================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -