📄 _csl_prevchecksettings.c
字号:
/** @file _csl_prevCheckSettings.c
*
* @brief File for functional layer of CSL API @a CSL_prevCheckSettings()
*
* Description
* - The @a CSL_prevCheckSettings() function definition & it's associated
* functions
*
* @date 6th June, 2005
* @author Jesse Villarreal
*/
#include <csl_prev_aux.h>
#include <csl_ccdc.h>
#pragma CODE_SECTION (CSL_prevCheckSettings, ".text:csl_section:prev");
/** @brief Checks for register setting violations
* If there are no violations, the function will return a CSL_SOK condition
* and the response value will be equal to 0. If there are any violations,
* the function will return the CSL_ESYS_FAIL error and the response value will
* have bits set which indicate any violations found. The following are the
* violation codes for the bits of the response variable:
*
* Bit 0: Output Width is over the limit (max: 1280 pixels)
* Bit 1: Output Width is not even
* Bit 2: Input Width is not a multiple of the AVE parameters
* Bit 3. Input to the Horizontal Median filter is not even
* Bit 4: Horizontal median filter is not supported for foveon formatted input
* Bit 5: Noise filter is not supported for foveon formatted input
* Bit 6: Input width is larger than CCDC output width
* Bit 7: Input height is larger than CCDC output height
* 8 - 31: RESERVED
*/
CSL_Status CSL_prevCheckSettings(
/** Pointer to the object that holds reference to the
* instance of PREV requested after the call
*/
CSL_PrevHandle hPrev,
/** Pointer to structure holding the data
*/
CSL_PrevErrorBits *response
){
CSL_PrevErrorBits error = CSL_PREV_ERR_NO_ERRORS;
Uint16 hin, ave;
CSL_PrevRegsOvly prevRegs = hPrev->regs;
// READ ALL OF THE PERTINENT REGISTER FIELDS
hin = CSL_FEXT(prevRegs->HORZ_INFO, PREV_HORZ_INFO_EPH) -
CSL_FEXT(prevRegs->HORZ_INFO, PREV_HORZ_INFO_SPH) + 1;
ave = 1 << CSL_FEXT(prevRegs->AVE, PREV_AVE_COUNT);
//CHECK SETTINGS FOR VIOLATIONS
{
CSL_PrevOutSizeData outSize;
CSL_prevGetOutSize(hPrev, &outSize);
if(outSize.width>1280)
error |= CSL_PREV_ERR_OUT_WIDTH_OVER_LIMIT; //Horz out width over limit
if(outSize.width%2)
error |= CSL_PREV_ERR_OUT_WIDTH_NOT_EVEN; //Horz out width not even
}
{
Uint16 odd, even, lcm;
odd = CSL_FEXT(prevRegs->AVE, PREV_AVE_ODDDIST) + 1;
even = CSL_FEXT(prevRegs->AVE, PREV_AVE_EVENDIST) + 1;
if(odd == even) {
lcm = odd;
}
else if(odd > even) {
if(odd%even){
lcm = even*odd;
}
else{
lcm = odd;
}
}
else{
if(even%odd){
lcm = even*odd;
}
else{
lcm = even;
}
}
if(hin%(ave*lcm))
error |= CSL_PREV_ERR_IN_WIDTH_NOT_MULT_OF_AVE_PARAMS;
}
{
Uint16 odd, even, hmed, cfa;
hmed = CSL_FEXT(prevRegs->PCR, PREV_PCR_HMEDEN);
odd = CSL_FEXT(prevRegs->HMED, PREV_HMED_ODDDIST);
even = CSL_FEXT(prevRegs->AVE, PREV_HMED_EVENDIST);
if( (hmed && (odd || even)) && ((hin/ave)%2)) {
error |= CSL_PREV_ERR_HMED_INPUT_NOT_EVEN;
}
cfa = CSL_FEXT(prevRegs->PCR, PREV_PCR_CFAFMT);
if(cfa == CSL_PREV_CFAFMT_RGBFOVEON_BYPASSCFA ||
cfa == CSL_PREV_CFAFMT_RRRGGGBBBFOVEON)
{
Uint16 nf;
if(hmed)
error |= CSL_PREV_ERR_HMED_NOT_SUPPORTED_FOR_FOVEON;
nf = CSL_FEXT(prevRegs->PCR, PREV_PCR_NFEN);
if(nf)
error |= CSL_PREV_ERR_NF_NOT_SUPPORTED_FOR_FOVEON;
}
}
{
Uint8 source;
source = CSL_FEXT(prevRegs->PCR, PREV_PCR_SOURCE);
if(source == CSL_PREV_SOURCE_CCDC)
{
Uint16 hout, vout, hend, vend;
CSL_CcdcRegsOvly ccdcRegs = (CSL_CcdcRegsOvly)_CSL_ccdcGetBaseAddr(CSL_CCDC_0);
hout = CSL_FEXT(ccdcRegs->VP_OUT, CCDC_VP_OUT_HORZ_NUM);
vout = CSL_FEXT(ccdcRegs->VP_OUT, CCDC_VP_OUT_VERT_NUM);
hend = CSL_FEXT(prevRegs->HORZ_INFO, PREV_HORZ_INFO_EPH) + 1;
vend = CSL_FEXT(prevRegs->VERT_INFO, PREV_VERT_INFO_ELV) + 1;
if(hout < hend)
error |= CSL_PREV_ERR_INPUT_WIDTH_LARGER_THAN_CCDC_OUT;
if(vout < vend)
error |= CSL_PREV_ERR_INPUT_HEIGHT_LARGER_THAN_CCDC_OUT;
}
}
*response = error;
if(error)
return (CSL_ESYS_FAIL);
else
return (CSL_SOK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -