Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

ippiWarpAffine status 30

zhan_z_
Beginner
1,248 Views

Hi, I'm using intel ipp9.0 for a 16bit unsigned image affine transform.My destination is to  zoom,pan and rotate the raw image.Then I'll display this image under the window (I just think this means the destROI?).

 I always get a status code of 30.

the passed in parameters:

pSrc: the raw image data. I get it as byte* .And make a convert to Ipp16u*.

srcSize: the sizeof raw image: width 2314 and height 2949

srcStep: I caculate it by this: int srcStep = ((srcBytesPerPixel(which is 16) * srcWidth) + 31) / 32 * 4;

srcROI:x 0 y 0 width 2314  and  height 2949

pDst:just a byte Pointer point to a byte array.

dstStep: I caculate this by:((destBytesPerPixel(16) * dstWidth) + 31) / 32 * 4;

dstROI:this is just the size of the windows, x 0 y 0 width 666 height 604

coeffs00~coeffs12: 0.204407945  0  342.0   0.0  0.204407945   1173.20264

 

IppStatus IPPInterpolationWrapper::IPPInterpolation::ippiWarpAffine_16u_C1R1(const Ipp16u* pSrc,
    IppiSize srcSize, 
    int srcStep, 
    IppiRect srcROI, 
    Ipp16u* pDst, 
    int dstStep, 
    IppiRect dstROI,
    double coeffs00,
    double coeffs01,
    double coeffs02,
    double coeffs10,
    double coeffs11,
    double coeffs12,
    int interpolation)
{
    IppiWarpSpec* pSpec = 0;
    Ipp8u* pInitBuf = 0;
    int specSize = 0, initSize = 0, bufSize = 0; Ipp8u* pBuffer = 0;
    const Ipp32u numChannels = 1;  //此参数修改通道数
    IppiPoint dstOffset = { 0, 0 };
    IppStatus status = ippStsNoErr;
    IppiBorderType borderType = ippBorderTransp;
    IppiWarpDirection direction = ippWarpForward;
    IppiSize dstRoiSize = { dstROI.width, dstROI.height };
    double cf[2][3];
    IppiSize srcRoiSize;
    Ipp16u* pSrcRoi = (Ipp16u*)((Ipp8u*)pSrc + srcROI.y * srcStep) + srcROI.x *
        numChannels;
    Ipp16u* pDstRoi = (Ipp16u*)((Ipp8u*)pDst + dstROI.y * dstStep) + dstROI.x *
        numChannels;
    IppiInterpolationType interp;
    int borderSize = 0;
    Ipp64f valB = 0.0, valC = 0.5; /* Catmull-Rom filter */
    if (srcROI.x < 0 || srcROI.y < 0 || srcROI.x >= srcSize.width || srcROI.y >=
        srcSize.height)
        return ippStsRectErr;
    if (dstROI.x < 0 || dstROI.y < 0)
        return ippStsRectErr;
    /* Clip the source roi */
    if (srcROI.x + srcROI.width > srcSize.width) srcROI.width = srcSize.width -
        srcROI.x;
    if (srcROI.y + srcROI.height > srcSize.height) srcROI.height = srcSize.height -
        srcROI.y;
    srcRoiSize.width = srcROI.width;
    srcRoiSize.height = srcROI.height;
    switch (interpolation)
    {
    case IPPI_INTER_NN:
        interp = ippNearest;
        break;
    case IPPI_INTER_LINEAR:
        interp = ippLinear;
        break;
    case IPPI_INTER_CUBIC:
        interp = ippCubic;
        borderSize = 1;
        break;
    default:
        return ippStsInterpolationErr;
    }
    /* compute new coefficients with taking into account ROI offsets*/
    /*cf[0][0] = coeffs00; cf[0][1] = coeffs01; cf[0][2] = coeffs02 +
        coeffs00 * srcROI.x + coeffs01 * srcROI.y - dstROI.x;
    cf[1][0] = coeffs10; cf[1][1] = coeffs11; cf[1][2] = coeffs12 +
        coeffs10 * srcROI.x + coeffs11 * srcROI.y - dstROI.y;*/
    cf[0][0] = coeffs00;
    cf[0][1] = coeffs01;
    cf[0][2] = coeffs02;
    cf[1][0] = coeffs10;
    cf[1][1] = coeffs11;
    cf[1][2] = coeffs12;
    /* define border type depending on the source ROI */
    if (srcROI.x >= borderSize) borderType = (IppiBorderType)(borderType |
        ippBorderInMemLeft);
    if (srcROI.y >= borderSize) borderType = (IppiBorderType)(borderType |
        ippBorderInMemTop);
    if (srcROI.x + srcROI.width <= srcSize.width - borderSize) borderType =
        (IppiBorderType)(borderType | ippBorderInMemRight);
    if (srcROI.y + srcROI.height <= srcSize.height - borderSize) borderType =
        (IppiBorderType)(borderType | ippBorderInMemBottom);
    /* Spec and init buffer sizes */
    status = ippiWarpAffineGetSize(srcRoiSize, dstRoiSize, ipp16u, cf, interp, direction,
        borderType, &specSize, &initSize);
    if (status < ippStsNoErr) return status;
    /* Memory allocation */
    pSpec = (IppiWarpSpec*)ippsMalloc_8u(specSize);
    if (pSpec == nullptr)
    {
        return ippStsNoMemErr;
    }
    /* Memory allocation */
    pInitBuf = ippsMalloc_8u(initSize);
    if (pInitBuf == nullptr)
    {
        ippsFree(pSpec);
        return ippStsNoMemErr;
    }
    /* Filter initialization */
    switch (interpolation)
    {
    case IPPI_INTER_NN:
        status = ippiWarpAffineNearestInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
            numChannels, borderType, 0, 0, pSpec);
        break;
    case IPPI_INTER_LINEAR:
        status = ippiWarpAffineLinearInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
            numChannels, borderType, 0, 0, pSpec);
        break;
    case IPPI_INTER_CUBIC:
        status = ippiWarpAffineCubicInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
            numChannels, valB, valC, borderType, 0, 0, pSpec, pInitBuf);
        break;
    }
    ippsFree(pInitBuf);
    if (status < ippStsNoErr)
    {
        ippsFree(pSpec);
        return status;
    }
    /* work buffer size */
    status = ippiWarpGetBufferSize(pSpec, dstRoiSize, &bufSize);
    if (status < ippStsNoErr)
    {
        ippsFree(pSpec);
        return status;
    }
    pBuffer = ippsMalloc_8u(bufSize);
    if (pBuffer == nullptr)
    {
        ippsFree(pSpec);
        return ippStsNoMemErr;
    }
    /* Warp processing */
    switch (interpolation)
    {
    case IPPI_INTER_NN:
        status = ippiWarpAffineNearest_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
            dstOffset, dstRoiSize, pSpec, pBuffer);
        break;
    case IPPI_INTER_LINEAR:
        status = ippiWarpAffineLinear_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
            dstOffset, dstRoiSize, pSpec, pBuffer);
        break;
    case IPPI_INTER_CUBIC:
        status = ippiWarpAffineCubic_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
            dstOffset, dstRoiSize, pSpec, pBuffer);
        break;
    }
    ippsFree(pSpec);
    ippsFree(pBuffer);
    return status;
}

 

0 Kudos
6 Replies
Valentin_K_Intel
Employee
1,248 Views

Hi Zhan,

The status 30 "ippStsWrongIntersectQuad" means that the transformed source image has no intersection with the given destination image ROI, so the output image is not changed. It is just a warning status, not error.

Best regards,
Valentin

0 Kudos
zhan_z_
Beginner
1,248 Views

Valentin K. (Intel) wrote:

Hi Zhan,

The status 30 "ippStsWrongIntersectQuad" means that the transformed source image has no intersection with the given destination image ROI, so the output image is not changed. It is just a warning status, not error.

Best regards,
Valentin

 

Thank you for relply. But I haven't solved my problem.My destination is using ippiWarpAffineLinear_16u_C1R to complete a affine transformation.

The raw image is 512*512 16unsigned bits/pixel grayscale image.I want to transform it to the central of a show window with a  size 1340*670.But I'm failed after one thousand trials and errors. I'm looking forward for your help. the annex I is desirable answer. The annex II is intel ipp answer. There three details:

1 there are two identical images in the show windows.
2 there are something like fogs above the image which should be identical to the left thumbnails.
3 the first show position should be on the central of the show windows.

Best regard.

0 Kudos
Valentin_K_Intel
Employee
1,248 Views

Ok, let's try to figure out all issues in order.

In the first case the resize operation with shift is performed. So we have the transformation coefficients ((0.204407945, 0.0, 342.0), (0.0, 0.204407945, 1173.20264)) that means that the source image is scaled and after shifted with the translate vector (342.0, 1173.20264). The scale operation is performed relative to (0,0) point, so the left corner of the scaled image is in (0,0) point. After scaling the shift operation is executed, so the left corner of the image is shifted to (342.0, 1173.20264) that is outside of the image borders (x: 0; y: 0; width: 666; height :604), hence the status "ippStsWrongIntersectQuad" is returned.

zhan z. wrote:

The raw image is 512*512 16unsigned bits/pixel grayscale image.I want to transform it to the central of a show window with a  size 1340*670.

Could you please provide the code example with transformation coefficients to investigate the issue? At the first glance it can be the problem with image steps.

Best regards,
Valentin

 

0 Kudos
zhan_z_
Beginner
1,248 Views

Valentin K. (Intel) wrote:

Ok, let's try to figure out all issues in order.

In the first case the resize operation with shift is performed. So we have the transformation coefficients ((0.204407945, 0.0, 342.0), (0.0, 0.204407945, 1173.20264)) that means that the source image is scaled and after shifted with the translate vector (342.0, 1173.20264). The scale operation is performed relative to (0,0) point, so the left corner of the scaled image is in (0,0) point. After scaling the shift operation is executed, so the left corner of the image is shifted to (342.0, 1173.20264) that is outside of the image borders (x: 0; y: 0; width: 666; height :604), hence the status "ippStsWrongIntersectQuad" is returned.

Quote:

zhan z. wrote:

 

The raw image is 512*512 16unsigned bits/pixel grayscale image.I want to transform it to the central of a show window with a  size 1340*670.

 

 

Could you please provide the code example with transformation coefficients to investigate the issue? At the first glance it can be the problem with image steps.

Best regards,
Valentin

 

 

Thank you very much, what a nice man. I just follow your caculation process.  I inspect the  transformation coefficients carefully. Now my destImage is

on the right place. There are still three questions.

1. the Image seems not scale as my expect.

2. There're always two identical images on the show window.

3. the dest image has a layer of foggy. 

(if that is convenient, please check attached files. The attached I is the desirable Image which we get from our alternative software. In the alternative software the affine parameters are the same as Intel ipp process. The attached II is Intel Ipp processed destImage.)

The code example for transformation coefficients:

 

  Matrix ceoffes = new Matrix();
            //1 transfer the image center to show wnd center, host means  the window host.
            ceoffes.Translate(-Convert.ToSingle(this.host.HostSize.Width) / 2, -Convert.ToSingle(this.host.HostSize.Height) / 2);
            //2 do scale, ratate and translate
            double ratox = this.host.HostSize.Width / (double)this.host.DicomImage.DicomImage.Width;
            double ratoy = this.host.HostSize.Height / (double)this.host.DicomImage.DicomImage.Height;
            if (ratox > ratoy)
            {
                ratox = ratoy;
            }
            ceoffes.Scale(ratox, ratox);
            ceoffes.Rotate(0);
            ceoffes.Translate(offsetX, offsetY);
            //3 move the image back to it's center, dicomImage means the raw Image.
            ceoffes.Translate(this.host.DicomImage.DicomImage.Width / 2, this.host.DicomImage.DicomImage.Height / 2);

 

Then I use the "ippiWarpAffineLinear_16u_C1R" to do affine transform:

the passed in parameters:

pSrc: the raw image data. I get it as byte* .And make a convert to Ipp16u*.

srcSize: the sizeof raw image: width 2012 and height 2012

srcStep: I caculate it by this: int srcStep = ((srcBytesPerPixel(which is 16) * srcWidth) + 31) / 32 * 4;

srcROI:x 0 y 0 width 2012 and  height 2012 

pDst:just a byte Pointer point to a byte array. (I allocate this as

byte[] pDst = new byte(destwidth * destHeight * 2);

 )

dstStep: I caculate this by:((destBytesPerPixel(16) * dstWidth) + 31) / 32 * 4;

dstROI:this is just the size of the windows, x 0 y 0 width 1345 height 610

coeffs00~coeffs12: 0.3031809  0   367.5  0.0   0.3031809  0  (the dest Image is on the right place.)

IppStatus IPPInterpolationWrapper::IPPInterpolation::ippiWarpAffine_16u_C1R1(const Ipp16u* pSrc,
	IppiSize srcSize, 
	int srcStep, 
	IppiRect srcROI, 
	Ipp16u* pDst, 
	int dstStep, 
	IppiRect dstROI,
	double coeffs00,
	double coeffs01,
	double coeffs02,
	double coeffs10,
	double coeffs11,
	double coeffs12,
	int interpolation)
{
	IppiWarpSpec* pSpec = 0;
	Ipp8u* pInitBuf = 0;
	int specSize = 0, initSize = 0, bufSize = 0; Ipp8u* pBuffer = 0;
	const Ipp32u numChannels = 1;  //此参数修改通道数
	IppiPoint dstOffset = { 0, 0 };
	IppStatus status = ippStsNoErr;
	IppiBorderType borderType = ippBorderTransp;
	IppiWarpDirection direction = ippWarpForward;
	IppiSize dstRoiSize = { dstROI.width, dstROI.height };
	double cf[2][3];
	IppiSize srcRoiSize;
	Ipp16u* pSrcRoi = (Ipp16u*)((Ipp8u*)pSrc + srcROI.y * srcStep) + srcROI.x *
		numChannels;
	Ipp16u* pDstRoi = (Ipp16u*)((Ipp8u*)pDst + dstROI.y * dstStep) + dstROI.x *
		numChannels;
	IppiInterpolationType interp;
	int borderSize = 0;
	Ipp64f valB = 0.0, valC = 0.5; /* Catmull-Rom filter */
	if (srcROI.x < 0 || srcROI.y < 0 || srcROI.x >= srcSize.width || srcROI.y >=
		srcSize.height)
		return ippStsRectErr;
	if (dstROI.x < 0 || dstROI.y < 0)
		return ippStsRectErr;
	/* Clip the source roi */
	if (srcROI.x + srcROI.width > srcSize.width) srcROI.width = srcSize.width -
		srcROI.x;
	if (srcROI.y + srcROI.height > srcSize.height) srcROI.height = srcSize.height -
		srcROI.y;
	srcRoiSize.width = srcROI.width;
	srcRoiSize.height = srcROI.height;
	switch (interpolation)
	{
	case IPPI_INTER_NN:
		interp = ippNearest;
		break;
	case IPPI_INTER_LINEAR:
		interp = ippLinear;
		break;
	case IPPI_INTER_CUBIC:
		interp = ippCubic;
		borderSize = 1;
		break;
	default:
		return ippStsInterpolationErr;
	}
	/* compute new coefficients with taking into account ROI offsets*/
	cf[0][0] = coeffs00; cf[0][1] = coeffs01; cf[0][2] = coeffs02 +
		coeffs00 * srcROI.x + coeffs01 * srcROI.y - dstROI.x;
	cf[1][0] = coeffs10; cf[1][1] = coeffs11; cf[1][2] = coeffs12 +
		coeffs10 * srcROI.x + coeffs11 * srcROI.y - dstROI.y;
	/*cf[0][0] = coeffs00;
	cf[0][1] = coeffs01;
	cf[0][2] = coeffs02;
	cf[1][0] = coeffs10;
	cf[1][1] = coeffs11;
	cf[1][2] = coeffs12;*/
	/* define border type depending on the source ROI */
	if (srcROI.x >= borderSize) borderType = (IppiBorderType)(borderType |
		ippBorderInMemLeft);
	if (srcROI.y >= borderSize) borderType = (IppiBorderType)(borderType |
		ippBorderInMemTop);
	if (srcROI.x + srcROI.width <= srcSize.width - borderSize) borderType =
		(IppiBorderType)(borderType | ippBorderInMemRight);
	if (srcROI.y + srcROI.height <= srcSize.height - borderSize) borderType =
		(IppiBorderType)(borderType | ippBorderInMemBottom);

	/* Spec and init buffer sizes */
	status = ippiWarpAffineGetSize(srcRoiSize, dstRoiSize, ipp16u, cf, interp, direction,
		borderType, &specSize, &initSize);
	if (status < ippStsNoErr) return status;
	/* Memory allocation */
	pSpec = (IppiWarpSpec*)ippsMalloc_8u(specSize);
	//pSpec = (IppiWarpSpec*)ippsMalloc_16u(specSize);
	if (pSpec == nullptr)
	{
		return ippStsNoMemErr;
	}
	/* Memory allocation */
	pInitBuf = ippsMalloc_8u(initSize);
	if (pInitBuf == nullptr)
	{
		ippsFree(pSpec);
		return ippStsNoMemErr;
	}
	/* Filter initialization */
	switch (interpolation)
	{
	case IPPI_INTER_NN:
		status = ippiWarpAffineNearestInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
			numChannels, borderType, 0, 0, pSpec);
		break;
	case IPPI_INTER_LINEAR:
		status = ippiWarpAffineLinearInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
			numChannels, borderType, 0, 0, pSpec);
		break;
	case IPPI_INTER_CUBIC:
		status = ippiWarpAffineCubicInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
			numChannels, valB, valC, borderType, 0, 0, pSpec, pInitBuf);
		break;
	}
	ippsFree(pInitBuf);
	if (status < ippStsNoErr)
	{
		ippsFree(pSpec);
		return status;
	}
	/* work buffer size */
	status = ippiWarpGetBufferSize(pSpec, dstRoiSize, &bufSize);
	if (status < ippStsNoErr)
	{
		ippsFree(pSpec);
		return status;
	}
	pBuffer = ippsMalloc_8u(bufSize);
	if (pBuffer == nullptr)
	{
		ippsFree(pSpec);
		return ippStsNoMemErr;
	}
	/* Warp processing */
	switch (interpolation)
	{
	case IPPI_INTER_NN:
		status = ippiWarpAffineNearest_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
			dstOffset, dstRoiSize, pSpec, pBuffer);
		break;
	case IPPI_INTER_LINEAR:
		status = ippiWarpAffineLinear_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
			dstOffset, dstRoiSize, pSpec, pBuffer);
		break;
	case IPPI_INTER_CUBIC:
		status = ippiWarpAffineCubic_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
			dstOffset, dstRoiSize, pSpec, pBuffer);
		break;
	}
	ippsFree(pSpec);
	ippsFree(pBuffer);
	return status;
}

 

0 Kudos
Valentin_K_Intel
Employee
1,248 Views

Hi Zhan,

I could not reproduce the issue. I used the coefficients and image parameters values you gave: 

static IppiRect srcROI  = { 0, 0, 2012, 2012};
static IppiRect dstROI  = { 0, 0, 1345, 610};
static IppiSize srcSize = { 2012, 2012 };
static int srcStep = 4024;
static int dstStep = 2692;
static double coeffs00 =  0.3031809;
static double coeffs01 =  0.00;
static double coeffs02 =  367.5;
static double coeffs10 =  0.00;
static double coeffs11 =  0.3031809;
static double coeffs12 =  0.00;

IppStatus Process_16u_C1R(const Ipp16u* pSrc, Ipp16u* pDst)
{
       return ippiWarpAffine_16u_C1R1(pSrc, srcSize, srcStep, srcROI, pDst, dstStep, dstROI,
                            coeffs00, coeffs01, coeffs02,
                            coeffs10, coeffs11, coeffs12, IPPI_INTER_LINEAR);
}

IppStatus ippiWarpAffine_16u_C1R1(const Ipp16u* pSrc,
    IppiSize srcSize, 
    int srcStep, 
    IppiRect srcROI, 
    Ipp16u* pDst, 
    int dstStep, 
    IppiRect dstROI,
    double coeffs00,
    double coeffs01,
    double coeffs02,
    double coeffs10,
    double coeffs11,
    double coeffs12,
    int interpolation)
{
    IppiWarpSpec* pSpec = 0;
    Ipp8u* pInitBuf = 0;
    int specSize = 0, initSize = 0, bufSize = 0; Ipp8u* pBuffer = 0;
    const Ipp32u numChannels = 1;  //此参数修改通道数
    IppiPoint dstOffset = { 0, 0 };
    IppStatus status = ippStsNoErr;
    IppiBorderType borderType = ippBorderTransp;
    IppiWarpDirection direction = ippWarpForward;
    IppiSize dstRoiSize = { dstROI.width, dstROI.height };
    double cf[2][3];
    IppiSize srcRoiSize;
    Ipp16u* pSrcRoi = (Ipp16u*)((Ipp8u*)pSrc + srcROI.y * srcStep) + srcROI.x *
        numChannels;
    Ipp16u* pDstRoi = (Ipp16u*)((Ipp8u*)pDst + dstROI.y * dstStep) + dstROI.x *
        numChannels;
    IppiInterpolationType interp;
    int borderSize = 0;
    Ipp64f valB = 0.0, valC = 0.5; /* Catmull-Rom filter */
    if (srcROI.x < 0 || srcROI.y < 0 || srcROI.x >= srcSize.width || srcROI.y >=
        srcSize.height)
        return ippStsRectErr;
    if (dstROI.x < 0 || dstROI.y < 0)
        return ippStsRectErr;
    /* Clip the source roi */
    if (srcROI.x + srcROI.width > srcSize.width) srcROI.width = srcSize.width -
        srcROI.x;
    if (srcROI.y + srcROI.height > srcSize.height) srcROI.height = srcSize.height -
        srcROI.y;
    srcRoiSize.width = srcROI.width;
    srcRoiSize.height = srcROI.height;
    switch (interpolation)
    {
    case IPPI_INTER_NN:
        interp = ippNearest;
        break;
    case IPPI_INTER_LINEAR:
        interp = ippLinear;
        break;
    case IPPI_INTER_CUBIC:
        interp = ippCubic;
        borderSize = 1;
        break;
    default:
        return ippStsInterpolationErr;
    }
    /* compute new coefficients with taking into account ROI offsets*/
    /*cf[0][0] = coeffs00; cf[0][1] = coeffs01; cf[0][2] = coeffs02 +
        coeffs00 * srcROI.x + coeffs01 * srcROI.y - dstROI.x;
    cf[1][0] = coeffs10; cf[1][1] = coeffs11; cf[1][2] = coeffs12 +
        coeffs10 * srcROI.x + coeffs11 * srcROI.y - dstROI.y;*/
    cf[0][0] = coeffs00;
    cf[0][1] = coeffs01;
    cf[0][2] = coeffs02;
    cf[1][0] = coeffs10;
    cf[1][1] = coeffs11;
    cf[1][2] = coeffs12;
    /* define border type depending on the source ROI */
    if (srcROI.x >= borderSize) borderType = (IppiBorderType)(borderType |
        ippBorderInMemLeft);
    if (srcROI.y >= borderSize) borderType = (IppiBorderType)(borderType |
        ippBorderInMemTop);
    if (srcROI.x + srcROI.width <= srcSize.width - borderSize) borderType =
        (IppiBorderType)(borderType | ippBorderInMemRight);
    if (srcROI.y + srcROI.height <= srcSize.height - borderSize) borderType =
        (IppiBorderType)(borderType | ippBorderInMemBottom);
    /* Spec and init buffer sizes */
    status = ippiWarpAffineGetSize(srcRoiSize, dstRoiSize, ipp16u, cf, interp, direction,
        borderType, &specSize, &initSize);
    if (status < ippStsNoErr) return status;
    /* Memory allocation */
    pSpec = (IppiWarpSpec*)ippsMalloc_8u(specSize);
    if (pSpec == nullptr)
    {
        return ippStsNoMemErr;
    }
    /* Memory allocation */
    pInitBuf = ippsMalloc_8u(initSize);
    if (pInitBuf == nullptr)
    {
        ippsFree(pSpec);
        return ippStsNoMemErr;
    }
    /* Filter initialization */
    switch (interpolation)
    {
    case IPPI_INTER_NN:
        status = ippiWarpAffineNearestInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
            numChannels, borderType, 0, 0, pSpec);
        break;
    case IPPI_INTER_LINEAR:
        status = ippiWarpAffineLinearInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
            numChannels, borderType, 0, 0, pSpec);
        break;
    case IPPI_INTER_CUBIC:
        status = ippiWarpAffineCubicInit(srcRoiSize, dstRoiSize, ipp16u, cf, direction,
            numChannels, valB, valC, borderType, 0, 0, pSpec, pInitBuf);
        break;
    }
    ippsFree(pInitBuf);
    if (status < ippStsNoErr)
    {
        ippsFree(pSpec);
        return status;
    }
    /* work buffer size */
    status = ippiWarpGetBufferSize(pSpec, dstRoiSize, &bufSize);
    if (status < ippStsNoErr)
    {
        ippsFree(pSpec);
        return status;
    }
    pBuffer = ippsMalloc_8u(bufSize);
    if (pBuffer == nullptr)
    {
        ippsFree(pSpec);
        return ippStsNoMemErr;
    }
    /* Warp processing */
    switch (interpolation)
    {
    case IPPI_INTER_NN:
        status = ippiWarpAffineNearest_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
            dstOffset, dstRoiSize, pSpec, pBuffer);
        break;
    case IPPI_INTER_LINEAR:
        status = ippiWarpAffineLinear_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
            dstOffset, dstRoiSize, pSpec, pBuffer);
        break;
    case IPPI_INTER_CUBIC:
        status = ippiWarpAffineCubic_16u_C1R(pSrcRoi, srcStep, pDstRoi, dstStep,
            dstOffset, dstRoiSize, pSpec, pBuffer);
        break;
    }
    ippsFree(pSpec);
    ippsFree(pBuffer);
    return status;
}

I allocated the destination image as: 

byte* pDst = new byte(dstROI.width * dstStep);

The destination image that I obtained is correct.

Thanks,
Valentin

0 Kudos
Valentin_K_Intel
Employee
1,248 Views

Zhan,

Could you please provide parameters of the machine that you are used to run IPP warp functions and the version of IPP library (IPP 9.0, IPP 9.0 U1, IPP 9.0 U2)?

It would be great, if you create a simple sample code to reproduce the problem.

Thanks,
Valentin

0 Kudos
Reply