⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _csl_reszcalchwsetup.c

📁 TI达芬奇dm644x各硬件模块测试代码
💻 C
字号:
/** @file _csl_reszCalcHwSetup.c
 *
 *  @brief    File for functional layer of CSL API @a CSL_reszCalcHwSetup()
 *
 *  Description
 *    - The @a CSL_reszCalcHwSetup() function definition & it's associated
 *      functions
 *
 *  @date 12th May, 2005
 *  @author Jesse Villarreal
 */

#include <csl_resz_aux.h>

#pragma CODE_SECTION (CSL_reszCalcHwSetup, ".text:csl_section:resz");

/** @brief Calculates the appropriate Resize value or Input Size and/or filter coefficients
 *		   If the input sizes or resize ratios are to be calculated, then the following four variables
 *		   must be set (not NULL): inputSize, outputSize, ratios, and startPhase.
 *		   
 *		   There are 2 modes of calculation in this function:
 *		   1.	Input & Output sizes known (Calculate Resize Values)
 *				Set inputSize values, outputSize value, and startPhase values to their desired values  
 *				and set ratio value = 0.  The return struct will set the appropriate
 *				ratio values and may modify the inputSize values to meet restrictions.
 *		   2.	Resize values & Output size known (Calculate Required Input Size)
 *				Set ratio values, outputSize values, and startPhase values to their desired values  
 *				and set inputSize values = 0.  The return struct will set the appropriate
 *				inputSize values.
 *
 *			Notes:	Since this function is ignorant as to the size and source of the 
 *					input, the input size set MAY not be =< the actual input.
 *				
 *					This function expects that either the 'input' or the 'ratio' value for a given is
 *					set to 0. If both in a single direction are 0, then the CSL_ESYS_INVPARAMS error
 *					is returned.
 *
 *		   This function will also calculate the filter coefficients for the given/calculated resize ratios
 *		   if the filterCoeffs variable is passed.  If the filterCoeffs is NULL, then the filter coefficients
 *		   will not be calculated and the variable will remain null.
 */
CSL_Status  CSL_reszCalcHwSetup(
    /** Pointer to the object that holds reference to the
     *  instance of RESZ requested after the call 
	 */
    CSL_ReszHandle                         hResz,
    /** Pointer to structure holding the data
	 */
    CSL_ReszHwSetup						*data
	){

	CSL_Status   status=CSL_SOK;
	CSL_ReszCalcReszVal		horzData, vertData;

    if(data == NULL) return (CSL_ESYS_INVPARAMS);

	vertData.input =	&data->inputSize.height;
	vertData.output =	&data->outputSize.height;
	vertData.phase =	&data->startPhase.vPhase;
	vertData.ratio =	&data->ratios.vrzValue;
	vertData.horzDir =	FALSE;
	vertData.inMax =	data->inMax;
	vertData.inSdram =	(data->inputSource == CSL_RESZ_INPUT_SDRAM);
	vertData.stPix =	0;
	if(CSL_reszCalcReszValue(hResz, &vertData) != CSL_SOK)  status = CSL_ESYS_INVPARAMS;

	horzData.input =	&data->inputSize.width;
	horzData.output =	&data->outputSize.width;
	horzData.phase =	&data->startPhase.hPhase;
	horzData.ratio =	&data->ratios.hrzValue;
	horzData.horzDir =	TRUE;
	horzData.inMax =	data->inMax;
	horzData.inSdram =	(data->inputSource == CSL_RESZ_INPUT_SDRAM);
	horzData.stPix =	0;
	if(CSL_reszCalcReszValue(hResz, &horzData) != CSL_SOK)  status = CSL_ESYS_INVPARAMS;

	if(data->inputSource == CSL_RESZ_INPUT_SDRAM)
	{
		Int16 startPos = (Int8)data->startPos.hStart;
		Uint8 temp = (data->inputType == CSL_RESZ_TYPE_INTERLEAVED) ? 16 : 32;
		Uint32 addr = (Uint32)data->inputAddr;

		addr += (data->inputLineOffset * vertData.stPix);

		startPos += horzData.stPix;

		if(startPos < 0)
		{
			addr -= 32;
			startPos += temp;
		}
		else if(startPos > (temp-1))
		{
			addr += 32;
			startPos -= temp;
		}
		data->startPos.hStart = (Uint16)startPos;
		data->inputAddr = (Uint32 *)addr;
	}
	else
	{
		data->startPos.hStart += horzData.stPix*2;
		data->startPos.vStart += vertData.stPix;
	}

	// Calculate the number of passes required for full resize
	{
		Uint16 maxWidth = (data->ratios.vrzValue > 512) ? 640 : 1280;
		data->numSlices =	(data->outputSize.width-1) / maxWidth + 1;
	}

	if(data->filterCoeffs != NULL)
	{
		if(data->filterCoeffs->horzFilter != NULL)
			CSL_reszCalcCoef(data->ratios.hrzValue, (short *)data->filterCoeffs->horzFilter);
		if(data->filterCoeffs->vertFilter != NULL)
			CSL_reszCalcCoef(data->ratios.vrzValue, (short *)data->filterCoeffs->vertFilter);
	}

    return status;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -