[Libva] problem on va api of Hardware video decoding acceleration demos

Chen, Sean Sean.Chen at Polycom.com
Mon Jan 14 21:18:06 PST 2013


Hi Xiao!
Thanks your rapid feedback!
Could you give me a sample codes which can decode H.264 I frame and P frame?
So I can study it and evaluate VA API performance.
Regards
Sean

-----Original Message-----
From: Xiang, Haihao [mailto:haihao.xiang at intel.com] 
Sent: Sunday, December 15, 2013 12:58 PM
To: Chen, Sean
Cc: libva at lists.freedesktop.org
Subject: Re: [Libva] problem on va api of Hardware video decoding acceleration demos

On Mon, 2013-01-14 at 17:06 +0800, Chen, Sean wrote: 
> Hi All!
> 
> I have downloaded the Hardware video decoding acceleration demo codes 
> of VA API from freedesktop.org.
> 
> Since this codes decodes one H.264 I frame only,  I repeat decoding 
> process of this I frame as 100000 times in
> 
> order to get its CPU usage.
> 
>  
> 
> Detail changes as following black codes in vaapi.c in function of 
> vaapi_decode(), however, the cpu usage is still about 50%, which means 
> that hardware is not effective to decode h.264 stream.

You can think your case runs with infinite fps. Other the other hand,
vaEndPicture() runs in asynchronous mode,  so CPU is busy to pass parameters to the video driver in your case.

> Meanwhile, I can use Mplayer with VAAPI to decode H.264 HD mp4 file ,
> 
> whose CPU usage is only 2-4%.  

> My hardware environment is Intel Core I7-3610QM and HD graphics 4000, 
> and software is Ubuntu 12.10, libva 1.0.0.15
> 
> and vaapi intel driver 1.0.17.
> 
> So I want to know How can change example codes to verify VA API
> hardware acceleration ?   
> 
>  
> 
> int vaapi_decode(void)
> 
> {
> 
>     VAAPIContext * const vaapi = vaapi_get_context();
> 
>     VABufferID va_buffers[3];
> 
>     unsigned int n_va_buffers = 0, i ;
> 
>     VAStatus status;
> 
>  
> 
>     if (!vaapi || vaapi->context_id == 0 || vaapi->surface_id == 0)
> 
>         return -1;
> 
>  
> 
>     if (commit_slices(vaapi) < 0)
> 
>         return -1;
> 
>  
> 
>     vaUnmapBuffer(vaapi->display, vaapi->pic_param_buf_id);
> 
>     va_buffers[n_va_buffers++] = vaapi->pic_param_buf_id;
> 
>  
> 
>     if (vaapi->iq_matrix_buf_id) {
> 
>         vaUnmapBuffer(vaapi->display, vaapi->iq_matrix_buf_id);
> 
>         va_buffers[n_va_buffers++] = vaapi->iq_matrix_buf_id;
> 
>     }
> 
>  
> 
>     if (vaapi->bitplane_buf_id) {
> 
>         vaUnmapBuffer(vaapi->display, vaapi->bitplane_buf_id);
> 
>         va_buffers[n_va_buffers++] = vaapi->bitplane_buf_id;
> 
>     }
> 
>  
> 
> for(i = 0; i<100000;i++)
> 
> {
> 
>            status = vaBeginPicture(vaapi->display, vaapi->context_id,
> 
>                             vaapi->surface_id);
> 
>            if (!vaapi_check_status(status, "vaBeginPicture()"))
> 
>         return -1;
> 
>  
> 
>           status = vaRenderPicture(vaapi->display, vaapi->context_id,
> 
>                              va_buffers, n_va_buffers);
> 
>           if (!vaapi_check_status(status, "vaRenderPicture()"))
> 
>         return -1;
> 
>  
> 
>          status = vaRenderPicture(vaapi->display, vaapi->context_id,
> 
>                              vaapi->slice_buf_ids,
> 
>                              vaapi->n_slice_buf_ids);
> 
>          if (!vaapi_check_status(status, "vaRenderPicture()"))
> 
>         return -1;
> 
>  
> 
>          status = vaEndPicture(vaapi->display, vaapi->context_id);
> 
>          if (!vaapi_check_status(status, "vaEndPicture()"))
> 
>         return -1;
> 
>    }
> 
>  
> 
>     if (getimage_mode() == GETIMAGE_FROM_VIDEO)
> 
>         return vaapi_decode_to_image();
> 
>  
> 
>     return 0;
> 
> }
> 
> Regards
> 
> Sean
> 
>  
> 
>  
> 
> 
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva





More information about the Libva mailing list