Hi,
I want to remap image, here is my code:
int nImageWidth{ 640 };
int nImageHeight{ 480 };
int radius{ 240 };
uint8_t * pOut{ new uint8_t[ nImageWidth * nImageHeight * 3 ] };
YUV2RGB( pIn, pOut );
//testsave pOut to bmp image OK
int dstStepCUDA;
Npp8u * pDstImgCUDA{ nppiMalloc_8u_C3( 4 * radius, 4 * radius, & dstStepCUDA) };
NPP_ASSERT_NOT_NULL( pDstImgCUDA );
NppiSize dstRectCUDA{ 4 * radius, 4 * radius };
//input image params from pOut
NppiSize srcSize{ nImageWidth, nImageHeight };
//square rect inside 4:3 image
NppiRect srcRect{ ( nImageWidth - nImageHeight ) / 2, 0, nImageHeight, nImageHeight };
//allocate host x, y maps
Npp32f * pMapX{ new Npp32f[ 4 * radius * 4 * radius ] };
Npp32f * pMapY{ new Npp32f[ 4 * radius * 4 * radius ] };
//fill maps OK
polar2LinearMaps( radius, radius, radius, 0.0, pMapX, pMapY );
//allocate device x map
Npp32f * pMapXCUDA = nppiMalloc_32f_C1(4 * radius, 4 * radius, & nMapPitchCUDA);
NPP_ASSERT_NOT_NULL( pMapXCUDA );
//upload cuda x map to device
NPP_CHECK_CUDA(
cudaMemcpy2D( pMapXCUDA, nMapPitchCUDA, pMapX, 4 * radius * sizeof(Npp32f), 4 * radius, 4 * radius, cudaMemcpyHostToDevice );
);
//allocate device y map
Npp32f * pMapYCUDA = nppiMalloc_32f_C1(4 * radius, 4 * radius, & nMapPitchCUDA);
NPP_ASSERT_NOT_NULL( pMapYCUDA );
//upload cuda y map to device
NPP_CHECK_CUDA(
cudaMemcpy2D( pMapYCUDA, nMapPitchCUDA, pMapY, 4 * radius * sizeof(Npp32f), 4 * radius, 4 * radius, cudaMemcpyHostToDevice );
);
Output is OK:
cudaSetDevice GPU 0 = GK20A
NPP Library Version 6.5.34
CUDA Driver Version: 6.5
CUDA Runtime Version: 6.5
Device 0: < GK20A >, Compute SM 3.2 detected
0 3314.55 ms
But if i apply remap function, Ubuntu freezes:
try{
qDebug() << nppiRemap_8u_C3R(
pOut, srcSize, nImageWidth * 3, srcRect,
pMapXCUDA, nMapPitchCUDA,
pMapYCUDA, nMapPitchCUDA,
pDstImgCUDA, dstStepCUDA, dstRectCUDA,
NPPI_INTER_NN
);
} catch( int a ){
qDebug() << "Caught exception number: " << a;
return;
}
Please help to understand my issue.
Best regards Viktor.