Hi,
I have a requirement to encode /decode AYUV file using intel one VPL library. i already found samples to encode decode YUV420 ( hello-encode/hello-decode sample in intel VPL library).
Anyone help me to get a sample code to encode /decode AYUV file.
Thanks
Areekkal
链接已复制
Hi,
i modified the hello-encode.cpp and hello-decode.cpp with MFX_FOURCC_AYUV and it successfully encoded and decoded. But the decoded file contains a vertical white strip. modified code is below.
In hello-encode.cpp, set FourCC and chroma format as below.
encodeParams.mfx.CodecId = MFX_CODEC_HEVC; // MFX_CODEC_AVC;
encodeParams.mfx.TargetUsage = MFX_TARGETUSAGE_BALANCED;
encodeParams.mfx.TargetKbps = TARGETKBPS;
encodeParams.mfx.RateControlMethod = MFX_RATECONTROL_VBR;
encodeParams.mfx.FrameInfo.FrameRateExtN = FRAMERATE;
encodeParams.mfx.FrameInfo.FrameRateExtD = 1;
encodeParams.mfx.FrameInfo.FourCC = MFX_FOURCC_AYUV; // MFX_FOURCC_NV12;
encodeParams.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV444; // MFX_CHROMAFORMAT_YUV420;
encodeParams.mfx.FrameInfo.CropW = cliParams.srcWidth;
encodeParams.mfx.FrameInfo.CropH = cliParams.srcHeight;
encodeParams.mfx.FrameInfo.Width = ALIGN16(cliParams.srcWidth);
encodeParams.mfx.FrameInfo.Height = ALIGN16(cliParams.srcHeight);
encodeParams.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY; // MFX_IOPATTERN_IN_VIDEO_MEMORY;
Util.hpp -> mfxStatus ReadRawFrame(mfxFrameSurface1 *surface, FILE *f) added one more entry in switch (info->FourCC)
case MFX_FOURCC_AYUV:
// In AYUV, you will typically have four planes: A, Y, U, and V
pitch = data->Pitch;
printf("In ReadRawFrame -- MFX_FOURCC_AYUV\n");
// read luminance (Y) plane
for (i = 0; i < height; i++)
{
bytes_read = (mfxU32)fread(data->Y + i * pitch, 1, pitch, f);
if (pitch != bytes_read)
{
std::cout << "In ReadRawFrame -- Byte read are not equal to pitch - Reading Y -->> Byte Read =" << bytes_read << std::endl;
fclose(yDest);
return MFX_ERR_MORE_DATA;
}
// fwrite(data->Y + i * pitch, 1, pitch, yDest);
}
break;
While iam doing decode operation, added one more entry in switch (info->FourCC)
case MFX_FOURCC_AYUV:
printf("In WriteRawFrame -- MFX_FOURCC_AYUV\n");
pitch = data->Pitch;
// A,Y,U,V
for (i = 0; i < height; i++)
{
fwrite(data->Y + i * pitch, 1, pitch, f);
}
break;
Original inputfile ( AYUV file ) and decoded output file is attached.
Hi,
Thank you for posting in Intel communities.
Can you please share the following details which will help us to reproduce the issue from our end:
1. Intel VPL version.
2. OS details.
3. Processor and kernel details.
We could see a video file from your screenshots. Can you send the Original input file ( AYUV file ) and the decoded output file so that we can try reproducing your exact steps with the same video file of yours?
Regards,
Diya
