Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Issue related to intel media sdk decoder

Amol_A_
Beginner
755 Views

Hi,

Thanks for your support as always.

I am using Intel media SDK for decoding H.264 and i am providing input H.264 data through buffer (not from input file). Although i am getting YUV420 decoded output data from decoder but its colors are different from original colors.

Please provide your valuable suggestion.

Thanks,

Amol Agarwal

0 Kudos
1 Solution
Anthony_P_Intel
Employee
755 Views

Hi,

Yes, as Donald points out, this looks like it is just issue in the way you are viewing the data.

I believe the application to view NV12 data (PYUV) either does not support NV12 or is not selected to show NV12 formatting of the YUV420 data.

The version of PYUV I've seen does not support NV12, it only supports these:

  • P444 - Planar, progressive, 4:4:4
  • P422 - Planar, progressive, 4:2:2
  • P420 - Planar, progressive, 4:2:0
  • P411 - Planar, progressive, 4:1:1
  • P410 - Planar, progressive, 4:1:0
  • P400 - Planar, progressive, 4:0:0
  • IYUV - Planar, progressive, 4:2:0
  • I444 - Packed, progressive, 4:4:4
  • I422 - Packed, progressive, 4:2:2
  • I420 - Packed, progressive, 4:2:0
  • I411 - Packed, progressive, 4:1:1
  • I410 - Packed, progressive, 4:1:0
  • UYVY - Packed, progressive, 4:2:2
  • YUY2 - Packed, progressive, 4:2:2
  • YVYU - Packed, progressive, 4:2:2
  • VIX - Kakadu format for managing movies

View solution in original post

0 Kudos
7 Replies
Donald_G_
Beginner
755 Views

In what way are the colors different? How are you comparing them?

0 Kudos
Anthony_P_Intel
Employee
755 Views

Intel Media SDK API supports a few different "YUV420" formats.  Intel hardwware supports "NV12" which is a plane of Y followed by interleaved UV, while many of the samples support writing of planar IYUV (also known as i420), which is very simular to YV12 except the U and V planes are swapped.

The Media SDK API itself provides pointers to Y, U and V, and the actual YUV420 format is determined by the code that uses them.

0 Kudos
Amol_A_
Beginner
755 Views

Hi,

Thank you very much for your quick response.

As my problem is still not resolved hence i have attached screenshots to show the exact problem:

original.jpg: It is screen-shot of original video.

Issue.jpg: It is screen-shot of output of Intel Media SDK decoder. You can compare this with original.jpg to see the color related problem. This problem is occurring in complete decoded output video file although i have shared just one screen-shot.

Please provide your valuable suggestion.

Amol Agarwal 

0 Kudos
Donald_G_
Beginner
755 Views

It looks like something is wrong in your code to convert from the NV12 surface to whatever format you are sending to the output display. Can you show us your code for that area?

0 Kudos
Anthony_P_Intel
Employee
756 Views

Hi,

Yes, as Donald points out, this looks like it is just issue in the way you are viewing the data.

I believe the application to view NV12 data (PYUV) either does not support NV12 or is not selected to show NV12 formatting of the YUV420 data.

The version of PYUV I've seen does not support NV12, it only supports these:

  • P444 - Planar, progressive, 4:4:4
  • P422 - Planar, progressive, 4:2:2
  • P420 - Planar, progressive, 4:2:0
  • P411 - Planar, progressive, 4:1:1
  • P410 - Planar, progressive, 4:1:0
  • P400 - Planar, progressive, 4:0:0
  • IYUV - Planar, progressive, 4:2:0
  • I444 - Packed, progressive, 4:4:4
  • I422 - Packed, progressive, 4:2:2
  • I420 - Packed, progressive, 4:2:0
  • I411 - Packed, progressive, 4:1:1
  • I410 - Packed, progressive, 4:1:0
  • UYVY - Packed, progressive, 4:2:2
  • YUY2 - Packed, progressive, 4:2:2
  • YVYU - Packed, progressive, 4:2:2
  • VIX - Kakadu format for managing movies
0 Kudos
Amol_A_
Beginner
755 Views

Hi Everyone,

Thanks a lot for your quick responses.

>I believe the application to view NV12 data (PYUV) either does not support NV12 or is not selected to show NV12 formatting of the YUV420 data.

Actually sample application of Intel Media SDK 'Sample_Decode' is giving the output in NV12 format and PYUV application is able to play the NV12 output dump without any issue.

Code:

mfxStatus CSmplYUVWriter::WriteNextFrame(mfxFrameSurface1 *pSurface, mfxU8 *pOutData)

{

    mfxFrameInfo *pInfo = &pSurface->Info;
    mfxFrameData *pData = &pSurface->Data;

    mfxU32 i, j, h, w;
    
    switch (pInfo->FourCC)
    {
    case MFX_FOURCC_NV12:
        
    // Y component
        for (i = 0; i < pInfo->CropH; i++)
        {
        memcpy_s(pOutData + (i*pInfo->CropW), pInfo->Width * pInfo->Height *3/2, pData->Y + (pInfo->CropY * pData->Pitch + pInfo->CropX)+ i * pData->Pitch, pInfo->CropW);     

        }

        h = pInfo->CropH / 2;
        w = pInfo->CropW;

        //U component
        for (i = 0; i < h; i++)
        {
            for (j = 0; j < w; j += 2)
            {
        memcpy_s(pOutData + (pInfo->CropH * pInfo->CropW) + (j+(i*pInfo->CropW)), (pInfo->Width * pInfo->Height *3/2 - pInfo->CropH * pInfo->CropW), pData->UV + (pInfo->CropY * pData->Pitch / 2 + pInfo->CropX) + i * pData->Pitch + j, 1);

            }
        }

    //V component
        for (i = 0; i < h; i++)
        {
            for (j = 1; j < w; j += 2)
            {
        memcpy_s(pOutData + (pInfo->CropH * pInfo->CropW) + (j+(i*pInfo->CropW)), (pInfo->Width * pInfo->Height *3/2 - pInfo->CropH * pInfo->CropW), pData->UV + (pInfo->CropY * pData->Pitch / 2 + pInfo->CropX) + i * pData->Pitch + j, 1);

            }
        }
    }

    //Just to verify the decoder output 
    DWORD byteswritten = 0;
    int retn = 0;
    bool ret = WriteFile(m_hFile,pOutData,pInfo->Width * pInfo->Height*3/2,&byteswritten,NULL);
}

Please suggest if anything is wrong.

Amol Agarwal

0 Kudos
Anthony_P_Intel
Employee
755 Views

Hi,

Not sure where issue in your application/usage is.  The Media SDK API for decoding H.264 bitstream to NV12 surface in system memory or to D3D surface is most likely not the issue.  If you want to see all the parameters being used for Media SDK interface, you can use the "tracer" tool to capture a log.  If you supply the log here, I can take a look to see if any parameters are incorrect.

0 Kudos
Reply