关于YUV420SP_UV的疑问
基于ipncrdk3.5版本三码流全功能做的修改
chain:cam->isp->dup->frameout(vpss)->framein(dsp)->dsp算法
isp出的YUV420SP_UV格式,进到dsp内做运算
按照以下的存放方式(软件自带的部分代码)
/* for Y plane */
*size = pFormat->pitch[0] * bufferHeight;
*size = pFormat->pitch[0] * bufferHeight;
/* cOffset is at end of Y plane */
*cOffset = *size;
*cOffset = *size;
if (pFormat->dataFormat == FVID2_DF_YUV420SP_UV)
{
/* C plane height is 1/2 of Y plane */
bufferHeight = bufferHeight / 2;
}
{
/* C plane height is 1/2 of Y plane */
bufferHeight = bufferHeight / 2;
}
/* for C plane */
*size += pFormat->pitch[1] * bufferHeight;
*size += pFormat->pitch[1] * bufferHeight;
即是 y层以 pFrame->addr[0][0]开始的pFormat->pitch[0] * bufferHeight
c层是以pFrame->addr[0][1]开始的pFormat->pitch[1] * bufferHeight/2
720*480的图像 打印出的信息为
w=720,h=480,pitch[0]=864,pitch[1]=864, addr[0][0]=b9d89660,addr[0][1]=b9e150a0
两个地址间相差578016
按照代码中的算法地址应该相差864*480=414720,为什么是这样?
另外,在里面做彩转黑时采用
memset(pFrame->addr[0][1], 0x80, pInFrameInfo->rtChInfo.pitch[1]*pInFrameInfo->rtChInfo.height/2)
只有上面少部分图像变灰色,而按照pInFrameInfo->rtChInfo.pitch[1]*pInFrameInfo->rtChInfo.height这个长度计算,图像可全变灰。
问下:这个YUV420SP_UV的存储格式是怎样,Y和C的长度是多少,各层的数据是怎么存储的