Community
cancel
Showing results for 
Search instead for 
Did you mean: 
sumit_j_1
Beginner
493 Views

Vaapi based decoder example

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
493 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)

sumit_j_1
Beginner
493 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

 

sumit_j_1
Beginner
493 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.

493 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)

Reply