인텔 IPP가 이미지 크기 조정/변환 속도를 확인하기 위해 다음 코드를 시도했지만 끝에있는 ippsFree (pSpec)에서 계속 충돌합니다. 이유를 알 수 없습니다.인텔 IPP ippsFree() 충돌이 발생했습니다.
#include <stdint.h>
#include <memory>
#include <Windows.h>
#include <time.h>
#include "ipp.h"
int main(...) {
srand(time(NULL));
int width = 640;
int height = 480;
int channels = 2;
IppiResizeYUV422Spec* pSpec;
IppiSize dstSize, srcSize;
IppiPoint dstOffset = { 0, 0 };
srcSize.width = width;
srcSize.height = height;
dstSize.width = 2 * width;
dstSize.height = 2 * height;
std::unique_ptr<unsigned char[]> sourceData;
std::unique_ptr<unsigned char[]> destinationData;
std::unique_ptr<unsigned char[]> destinationDataRGB;
std::unique_ptr<unsigned char[]> workBuffer;
sourceData.reset(new unsigned char[srcSize.width * srcSize.height * channels]);
destinationData.reset(new unsigned char[dstSize.width * dstSize.height * channels]);
destinationDataRGB.reset(new unsigned char[dstSize.width * dstSize.height * 3]);
workBuffer.reset(new unsigned char[dstSize.width * dstSize.height * channels]);
memset(sourceData.get(), 0, srcSize.width * srcSize.height * channels);
memset(destinationData.get(), 0, dstSize.width * dstSize.height * channels);
memset(workBuffer.get(), 0, dstSize.width * dstSize.height * channels);
IppStatus error;
int specSize = 0, initSize = 0, buffSize = 0;
error = ippiResizeGetSize_8u(srcSize, dstSize, IppiInterpolationType::ippNearest, 0, &specSize, &initSize);
pSpec = (IppiResizeYUV422Spec*) ippsMalloc_8u(specSize);
error = ippiResizeYUV422NearestInit(srcSize, dstSize, pSpec);
IppiRect srcRoi = { 0, 0, srcSize.width, srcSize.height };
int64_t timerIPP9 = 0;
LARGE_INTEGER start, end;
LARGE_INTEGER tps;
QueryPerformanceFrequency(&tps);
for (unsigned int index = 0; index < 100; ++index) {
for (unsigned int imageIdx = 0; imageIdx < srcSize.width * srcSize.height * channels; ++imageIdx) {
sourceData.get()[imageIdx] = (rand() & 0xFF);
}
QueryPerformanceCounter(&start);
error = ippiResizeYUV422Nearest_8u_C2R(
sourceData.get(),
srcSize.width * channels,
destinationData.get(),
dstSize.width * channels,
dstOffset,
dstSize,
pSpec,
workBuffer.get());
QueryPerformanceCounter(&end);
timerIPP9 += end.QuadPart - start.QuadPart;
QueryPerformanceCounter(&start);
ippiYCbCr422ToRGB_8u_C2C3R(destinationData.get(), dstSize.width * channels, destinationDataRGB.get(), dstSize.width * 3, dstSize);
QueryPerformanceCounter(&end);
timerIPP9 += end.QuadPart - start.QuadPart;
printf("Test: %d, time: %d ms\r", index, timerIPP9 * 1000/tps.QuadPart);
}
ippsFree(pSpec);
printf("\n");
printf("Time taken: %d ms\n", timerIPP9 * 1000/tps.QuadPart);
system("Pause");
return 0;
}
난 변환기로 무작위 데이터를 파이핑하고 있지만 노이즈를 처리 할 수 있어야합니다 (여전히 유효한 이미지이므로). 내가 퍼즐을 해결 생각
최신 Intel IPP 2017.1.143 – SinisterMJ
할당 후 바로 해제 해 보셨습니까? 오류 응답을 확인하는 것처럼 보이지 않습니다. (부인 : 인텔 IPP를 한번도 사용하지 않았습니다.) – owacoder
인텔 IPP를 사용한 적이 한번도 없습니다. 문제는 여러분이'pSpec' 버퍼 밖에서 어떻게 든 씁니다. 그러면'ippsFree'를 호출 할 때이를 알 수 있습니까? – gurka