[Libva] performances question with libva on i5 sandy bridge
Gilles Chanteperdrix
gilles.chanteperdrix at xenomai.org
Sun Jan 18 15:20:17 PST 2015
Hi,
I am testing libva with ffmpeg on Linux to decode h264 video.
Linux version is 3.4.29
FFmpeg version is 2.5.3
Mesa version is 10.4.0
libdrm version is 2.4.58
libva version is 1.5.0
>From what I could gather from the documentation and examples, using
vaDeriveImage should be preferred if it is available. However, I
have compared, with top, the CPU consumed, and I observe that the
following code:
#ifdef USE_VADERIVEIMAGE
vrc = vaDeriveImage(ctx->display, buf->surface_id, &va_image);
CHECK_VASTATUS(vrc, "vaDeriveImage");
#else
vrc = vaGetImage(ctx->display, buf->surface_id,
0, 0, cctx->coded_width, cctx->coded_height,
va_image.image_id);
CHECK_VASTATUS(vrc, "vaGetImage");
#endif
vrc = vaMapBuffer(ctx->display, va_image.buf, &data);
CHECK_VASTATUS(vrc, "vaMapBuffer");
memcpy(f->img[0], data + va_image.offsets[0],
va_image.pitches[0] * cctx->coded_height);
memcpy(f->img[1], data + va_image.offsets[1],
va_image.pitches[1] * cctx->coded_height / 2);
vrc = vaUnmapBuffer(ctx->display, va_image.buf);
CHECK_VASTATUS(vrc, "vaUnmapBuffer");
#ifdef USE_VADERIVEIMAGE
vrc = vaDestroyImage(ctx->display, va_image.image_id);
CHECK_VASTATUS(vrc, "vaDestroyImage");
#endif
Results in a higher cpu consumption if compiled with
USE_VADERIVEIMAGE. Is this normal, or is there something I am doing
wrong? I can provide the complete code if needed.
As a second question, is there a function allowing to copy image
from a VA surface to custom pointers? I see I can build a buffer
with some custom pointers, but I do not see how to copy a surface to
them. I would like something like the inverse operation of
vaRenderPicture.
Thanks in advance.
Regards.
--
Gilles.
More information about the Libva
mailing list