- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi ! I try to convert a frame YUV420 to RGB32 with vpp conversion but when i draw the new picture I don't retrieve the same picture
I think the problem is the initialization of mfxframesurface for RGB4.
My code :
// Allocate surfaces for VPP: Out
width = (mfxU16)VPPParams.vpp.Out.Width;
height = (mfxU16)VPPParams.vpp.Out.Height;
surfaceSize = width * height*4 ;
mfxU8* surfaceBuffersOut = (mfxU8 *)new mfxU8[surfaceSize * nVPPSurfNumOut];
pVPPSurfacesOut = new mfxFrameSurface1*[nVPPSurfNumOut];
MSDK_CHECK_POINTER(pVPPSurfacesOut, MFX_ERR_MEMORY_ALLOC);
for (int i = 0; i < nVPPSurfNumOut; i++)
{
pVPPSurfacesOut = new mfxFrameSurface1;
memset(pVPPSurfacesOut, 0, sizeof(mfxFrameSurface1));
memcpy(&(pVPPSurfacesOut->Info), &(VPPParams.vpp.Out), sizeof(mfxFrameInfo));
pVPPSurfacesOut->Data.R = &surfaceBuffersOut[surfaceSize * i];
pVPPSurfacesOut->Data.G = pVPPSurfacesOut->Data.R + width * height;
pVPPSurfacesOut->Data.B = pVPPSurfacesOut->Data.R + width * height*2;
pVPPSurfacesOut->Data.A = pVPPSurfacesOut->Data.R + width * height*3;
pVPPSurfacesOut->Data.Pitch = width;
}
Thanks.
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Not sure the output is planar, I think it is probably chunky
try :
pVPPSurfacesOut->Data.R = &surfaceBuffersOut[surfaceSize * i];
pVPPSurfacesOut->Data.G = pVPPSurfacesOut->Data.R + 1;
pVPPSurfacesOut->Data.B = pVPPSurfacesOut->Data.R + 2;
pVPPSurfacesOut->Data.A = pVPPSurfacesOut->Data.R + 3;
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
If i try this and I display the pVPPSurfacesOut[nSurfIdxOut]->Data.R, pVPPSurfacesOut[nSurfIdxOut]->Data.G, pVPPSurfacesOut[nSurfIdxOut]->Data.B and pVPPSurfacesOut[nSurfIdxOut]->Data.A. I find the picture imgconverti.png. The real picture is forza480.bmp. But I change the pitch (pVPPSurfacesOut->Data.Pitch = 720*4;) I find the imgconverti1.png. If I copy the R with Height*Width*4 I find the correct picture. The problem is the pitch?
If i do this :
pVPPSurfacesOut->Data.R = &surfaceBuffersOut[surfaceSize * i];
pVPPSurfacesOut->Data.G = pVPPSurfacesOut->Data.R +width*height;
pVPPSurfacesOut->Data.B = pVPPSurfacesOut->Data.G +width*height;
pVPPSurfacesOut->Data.A = pVPPSurfacesOut->Data.B + width*height;
pVPPSurfacesOut->Data.Pitch = 720*4;
I retrieve the Width*Height/4 picture in R, the second Width*Height/4 picture in G, ... I display the correct picture.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I'm doing RGB4 to NV12, the opposite to you. However, I suspect that this is true. The data is stored as chunky, not planar. It is also BGRA, not RGBA. So in memory, the image data is stored as BGRA, BGRA, not BBBBBBBBBB, GGGGGGGGGGG, RRRRRRRRR, AAAAAAAAAAA etc. That is why you can just copy width*height*4 and you get the correct image. Base on what I see when I do RGBA to NV12, I still think the correct way to initialise it is
pVPPSurfacesOut->Data.B = &surfaceBuffersOut[surfaceSize * i];
pVPPSurfacesOut->Data.G = pVPPSurfacesOut->Data.B + 1;
pVPPSurfacesOut->Data.R = pVPPSurfacesOut->Data.B + 2;
pVPPSurfacesOut->Data.A = pVPPSurfacesOut->Data.B + 3;
pVPPSurfacesOut->Data.Pitch = 720*4;
Your images are typical of mixing planar and chunky data