[Libva] problem on va api of Hardware video decoding acceleration demos
Chen, Sean
Sean.Chen at Polycom.com
Mon Jan 14 01:06:07 PST 2013
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. 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libva/attachments/20130114/50a36c13/attachment.html>
More information about the Libva
mailing list