SRHNCalcResidual_PSF3x3, SRHNCalcResidual_PSF2x2

Computes residuals for the likelihood part of the target function or its gradient.

Syntax

IppStatus ippiSRHNCalcResidual_PSF3x3_8u32f_C1R(const Ipp32f* pHighRes, int highResStep, const Ipp8u* pLowRes, const Ipp32s* pOffset, const Ipp16u* pCoeff, Ipp32f* pRes, int len, const IppiSRHNSpec_PSF3x3* pPSF);

IppStatus ippiSRHNCalcResidual_PSF3x3_16u32f_C1R(const Ipp32f* pHighRes, int highResStep, const Ipp16u* pLowRes, const Ipp32s* pOffset, const Ipp16u* pCoeff, Ipp32f* pRes, int len, const IppiSRHNSpec_PSF3x3* pPSF);

IppStatus ippiSRHNCalcResidual_PSF2x2_16u32f_C1R(const Ipp32f* pHighRes, int highResStep, const Ipp16u* pLowRes, const Ipp32s* pOffset, const Ipp16u* pCoeff, Ipp32f* pRes, int len, const IppiSRHNSpec_PSF2x2* pPSF);

IppStatus ippiSRHNCalcResidual_PSF2x2_8u32f_C1R(const Ipp32f* pHighRes, int highResStep, const Ipp8u* pLowRes, const Ipp32s* pOffset, const Ipp16u* pCoeff, Ipp32f* pRes, int len, const IppiSRHNSpec_PSF2x2* pPSF);

Parameters

pHighRes
Pointer to high-resolution image.
highResStep
Distance in bytes between starts of consecutive lines in the pHighRes image.
pLowRes
Pointer to the array of pixel values from low-resolution images.
pOffset
Pointer to the array of offsets of 3x3 or 2x2 areas in the high-resolution image.
pCoeff
Pointer to the array of indexes of the coefficients in the input PSF table.
pRes
Pointer to the output array containing the calculated residuals.
len
Number of elements in the arrays pLowRes, pOffset, pCoeff and pRes.
pPSF
Pointer to the initialized table for 3x3 or 2x2 PSF.

Description

The functions ippiSRHNCalcResidual_PSF3x3 and ippiSRHNCalcResidual_PSF2x2 are declared in the ippcv.h file.

These functions computes residuals pRes for the likelihood part of the target function C (g) or its gradient ∇C(g). The calculated values are used as the arguments of the robust error functions or their derivatives. The following pseudocode shows how the calculation is performed.

for( int i = 0; i < len; i++ ) {
		const Ipp32f* ptr = hiRes + ofs[i];
		const Ipp32f* c = psf->cTab[coeff[i]];
		Ipp32f sum = 0;
		for( int dy = 0; dy < K; dy++ )
			for( int dx = 0; dx < K; dx++ )
				sum += c[dy*K+dx]*ptr[dy*hiResStep + dx];
		residual[i] = sum - lowRes[i];
}

Here K=3 for the 3x3 PSF, and K=2 for the 2x2 PSF.

The results stored in the pRes then can be passed to the robust error functions: ippsCauchy, ippsCauchyD, and ippsCauchyDD2 (see section "Arithmetic Functions" in the “Intel IPP Reference Manual” vol.1).

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error if one of the specified pointer is NULL.

ippStsSizeErr

Indicates an error if len is less than 0.

ippStsStepErr

Indicates an error if highResStep is less than 2*sizeof(Ipp32f) for 3x3 PSF, and less than 3*sizeof(Ipp32f) for the 2x2 PSF.

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.