This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

VICP颜色空间转换函数使用



您好,我在使用VICP库函数:

 

Int32 CPIS_colorSpcConv(

CPIS_Handle *handle,

CPIS_BaseParms *base,

CPIS_colorSpcConvParms *params,

CPIS_ExecType execType

);

使用过程中发现了两个问题,希望您能给与解答。首先介绍下我是如何用的,我想实现YUV444P向RGB的转换。各种参数如下(该参数我用C自己实现过了,能够实现YUV转RGB操作)。

 

Int16 g_VICP_iCoeffMatrix[9] = {1192, 1192, 1192, 0, -401, 2065, 1634, -833, 0}; //系数矩阵

Int16 g_VICP_i16PreOffset[3] = {-16, -128, -128}; //运算前输入加上的值

 

Int16  g_VICP_i16PostOffset[3] = {0, 0, 0}; //运算后输出加上的值

Int16  g_VICP_i16SignedInput[3] = {0, 0, 0}; //输入数据符号

Int16  g_VICP_i16SignedOutput[3] = {0, 0, 0}; //输出数据符号

 

Uint32 g_VICP_ui32QShift = 10; //结果左移10位


SpacConvBase->srcFormat[0] = CPIS_YUV_444P;

SpacConvBase->srcBuf[0].ptr = pui8YComponent;

SpacConvBase->srcBuf[0].stride = iWidth;

SpacConvBase->srcBuf[1].ptr = (char*)pui8UComponent;

SpacConvBase->srcBuf[1].stride = iWidth;

SpacConvBase->srcBuf[2].ptr = (char*)pui8VComponent;

SpacConvBase->srcBuf[2].stride = iWidth;

 

SpacConvBase->dstFormat[0] = CPIS_RGB_P; //

SpacConvBase->dstBuf[0].ptr = pui8RComponent;

SpacConvBase->dstBuf[0].stride = iWidth;

SpacConvBase->dstBuf[1].ptr = pui8GComponent;

SpacConvBase->dstBuf[1].stride = iWidth;

SpacConvBase->dstBuf[2].ptr = pui8BComponent;

SpacConvBase->dstBuf[2].stride = iWidth;

 

SpacConvBase->roiSize.width = iWidth;

SpacConvBase->roiSize.height = iHeight;

SpacConvBase->procBlockSize.width = g_VICP_ui32BlockWidth;

SpacConvBase->procBlockSize.height = g_VICP_ui32BlockHeight;

SpacConvBase->numInput = (iWidth * iHeight);

SpacConvBase->numOutput = (iWidth * iHeight);

SpacConvParams->matrix[0] = g_VICP_i16CoeffMatrixff[0];

SpacConvParams->matrix[1] = g_VICP_i16CoeffMatrixff[1];

SpacConvParams->matrix[2] = g_VICP_i16CoeffMatrixff[2];

SpacConvParams->matrix[3] = g_VICP_i16CoeffMatrixff[3];

SpacConvParams->matrix[4] = g_VICP_i16CoeffMatrixff[4];

SpacConvParams->matrix[5] = g_VICP_i16CoeffMatrixff[5];

SpacConvParams->matrix[6] = g_VICP_i16CoeffMatrixff[6];

SpacConvParams->matrix[7] = g_VICP_i16CoeffMatrixff[7];

SpacConvParams->matrix[8] = g_VICP_i16CoeffMatrixff[8];

SpacConvParams->qShift = g_VICP_ui32QShift;

SpacConvParams->preOffset[0] = g_VICP_i16PreOffset[0];

SpacConvParams->preOffset[1] = g_VICP_i16PreOffset[1];

SpacConvParams->preOffset[2] = g_VICP_i16PreOffset[2];  

SpacConvParams->postOffset[0] = g_VICP_i16PostOffset[0];

SpacConvParams->postOffset[1] = g_VICP_i16PostOffset[1];

SpacConvParams->postOffset[2] = g_VICP_i16PostOffset[2];

SpacConvParams->signedInput[0] = g_VICP_i16SignedInput[0];

SpacConvParams->signedInput[1] = g_VICP_i16SignedInput[1];

SpacConvParams->signedInput[2] = g_VICP_i16SignedInput[2];

SpacConvParams->signedOutput[0] = g_VICP_i16SignedOutput[0];

SpacConvParams->signedOutput[1] = g_VICP_i16SignedOutput[1];

SpacConvParams->signedOutput[2] = g_VICP_i16SignedOutput[2];

SpacConvParams->colorDsMode = g_VICP_ColorDsMode;

 

利用VICP库函数实现的图像颜色不正确。分析原因如下:

1、VICP对于输出为负数的值不会置为0,而是将其转换为无符号数

2、VICP运算过程中,对于单步运算的结果为负值时,也会将其转换为无符号数进行下一步运算。

具体分析见附件。

 

希望您能对这些问题给予解答,另外还请指导如何使用VICP库函数,VICP给的例程只是随机产生的一组数据,没有办法验证该函数的正确性,不知您是否有相关的例程。谢谢。

 

 

VICP库函数YUV转RGB问题分析.doc