|
以下翻转流程是否正确?
char * inbuf; //取值6410JPEG硬解码。
char * outbuf = (char *)malloc(srcwidth * srcheight);
HANDLE hVideoDrv = CreateFile( L"VDE0:", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
DWORD dwBytes;
//启动翻转功能
if (!DeviceIoControl(hVideoDrv,IOCTL_SVE_RSC_REQUEST_ROTATOR,NULL,0,NULL,0,&dwBytes,NULL))
{
return false;
}
//配置翻转功能
SVEARG_ROTATOR_PARAMETER tParamRotator;
tParamRotator.dwImgFormat = ROT_FORMAT_YUV422;
tParamRotator.dwOpType = rotatoroperationtype;
tParamRotator.dwSrcWidth = srcwidth;
tParamRotator.dwSrcHeight = srcheight;
if ( !DeviceIoControl(hVideoDrv, IOCTL_SVE_ROTATOR_SET_OPERATION_PARAM, &tParamRotator, sizeof(SVEARG_FIMD_WIN_MODE), NULL, 0, &dwBytes, NULL) )
{
return false;
}
SVEARG_ROTATOR_BUFFER tRotatorsrcBuffer;
tRotatorsrcBuffer.dwBufferRGBY = (DWORD)inbuf;
tRotatorsrcBuffer.dwBufferCb = tRotatorsrcBuffer.dwBufferRGBY + srcwidth * srcheight;
tRotatorsrcBuffer.dwBufferCr = tRotatorsrcBuffer.dwBufferCb + srcwidth * srcheight / 4;
if (!DeviceIoControl(hVideoDrv, IOCTL_SVE_ROTATOR_SET_SOURCE_BUFFER ,&tRotatorsrcBuffer,sizeof(SVEARG_ROTATOR_BUFFER),NULL,NULL,&dwBytes,NULL))
{
return false;
}
SVEARG_ROTATOR_BUFFER tRotatordstBuffer;
tRotatordstBuffer.dwBufferRGBY = (DWORD)outbuf;
tRotatordstBuffer.dwBufferCb = 0;
tRotatordstBuffer.dwBufferCr = 0;
if (!DeviceIoControl(hVideoDrv, IOCTL_SVE_ROTATOR_SET_DESTINATION_BUFFER ,&tRotatordstBuffer,sizeof(SVEARG_ROTATOR_BUFFER),NULL,NULL,&dwBytes,NULL))
{
return false;
}
//开始翻转功能
if (!DeviceIoControl(hVideoDrv,IOCTL_SVE_ROTATOR_SET_OPERATION_START,NULL,NULL,NULL,NULL,&dwBytes,NULL))
{
return false;
}
////执行翻转功能
if (!DeviceIoControl(hVideoDrv, IOCTL_SVE_ROTATOR_WAIT_OPERATION_DONE,NULL,NULL,NULL,NULL,&dwBytes,NULL))
{
return false;
}
//关闭翻转功能
if ( !DeviceIoControl(hVideoDrv, IOCTL_SVE_RSC_RELEASE_ROTATOR, NULL, 0, NULL, 0, &dwBytes, NULL) )
{
return false;
}
free(outbuf);
CloseHandle(hVideoDrv);
|
|