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.

Vaapi based decoder example

sumit_j_1
Beginner
1,767 Views

Hi,

I am looking for a Vaapi based decoder example which takes a video or an image frame and decode it into .yuv file.

There are some existing example but there is no clear explanation of how to proceed.

Plz  share some example or user guide  or source code.

Regards,

Sumit Jha 

0 Kudos
4 Replies
Sravanthi_K_Intel
1,767 Views

Hi Sumit - Did you have a chance to look at our media code samples - https://software.intel.com/en-us/intel-media-server-studio-support/code-samples

In this samples package, you will find sample_decode that can be compiled for a Linux platform and decode videos (h264/mpeg2/etc.,) to YUV. Let me know if this helps. (Please note, for the samples to work, you will need to download and install Media Server Studio - you can find it here - https://software.intel.com/en-us/intel-media-server-studio/try-buy)

0 Kudos
sumit_j_1
Beginner
1,767 Views

Hi SRAVANTHI K.,

I tried those code. In those codes media SDK api  internally calls VAAPI API and for user those VAAPI calls are hidden.

I am looking for a decoder sample code where application direct calls VAAPI- API not through MEDIA SDK API.

Help me to locate such code.

Regards,

Sumit

 

0 Kudos
sumit_j_1
Beginner
1,767 Views

HI,

I am looking for vaapi - api based decoder samples. I tried one from this

http://cgit.freedesktop.org/libva/tree/test/decode/mpeg2vldemo.cpp

This example render output on display. So i modified this code to dump data in yuv file,

I have few doubts regarding this example-

> thsi is slice based processing. Is it possible to use for full frame if so then what are the changes required ? For processing it creates "VASliceDataBufferType" can i make it  fro full frame type. ?

> Why it is creating 4 buffers ? How can i use same for one full frame whose size if greater than 16..i.e from MxN image.

>My output is coming like this-( from above link code)

see in image attached.

why there is ' green and pink band in my output image ?

the code for copying output from surface to my file is as follow-

 printf("Image format is NV12\n");
 vaMapBuffer(va_dpy,imagefromSurface.buf,(void **)&buffer);
    Y = buffer + imagefromSurface.offsets[0];
    U = buffer + imagefromSurface.offsets[1];
    V = U + 1;
          for ( i=0 ; i < imagefromSurface.width; i++){
         datasize= imagefromSurface.width;
        //printf("datsize= %d.",datasize);
         fwrite(Y,sizeof(unsigned char),datasize,fSink);
         Y=Y+ imagefromSurface.pitches[0];
     }
     for( i=0; i < imagefromSurface.width/2; i++){
         datasize= imagefromSurface.width;
         fwrite(U,sizeof(unsigned char),datasize,fSink);
         U=U+imagefromSurface.pitches[1];
     }

Plz suggest where I am doing mistakes.

Thanks in advance.

0 Kudos
Sravanthi_K_Intel
1,767 Views

Hi Sumit - If you are looking for a generic decoder based on VAAPI, it is out of MSDK scope. We can provide information on the samples we have developed, but not on externally developed ones.

Having said that, looking at your output, it seems like your fwrite() routine to dump the raw frames is not correct. If your output is NV12 and you want to convert it to YUV420 - please take a look at WriteRawFrame() routine in our samples/tutorials applications. (https://software.intel.com/en-us/intel-media-server-studio-support/code-samples, https://software.intel.com/en-us/intel-media-server-studio-support/training)

0 Kudos
Reply