[Libva] How to resize image using hardware accelerate

Yann Dirson yann.dirson at blade-group.com
Tue Jul 12 07:37:40 UTC 2016


You can do this with a video post-processing operation. Just don't
specify any filter, setting the surface_region and output_region in
VAProcPipelineParameterBuffer will get the job done.
Here is an example (which does not rescale, only does colorspace
conversion, but you should get the idea):

    va_status = vaCreateBuffer(va_dpy, vpp_context_id,
                   VAProcPipelineParameterBufferType,
                   sizeof(VAProcPipelineParameterBuffer), 1, NULL,
                   &vpp_params_bufid);
    CHECK_VASTATUS(va_status, "vaCreateBuffer vpp_params_bufid");
    VAProcPipelineParameterBuffer *pipeline_param;
    VARectangle region = { .x = 0, .y = 0,
               .width = (unsigned short)stream_width,
               .height = (unsigned short)stream_height };
    va_status = vaMapBuffer(va_dpy, vpp_params_bufid, (void**)&pipeline_param);
    CHECK_VASTATUS(va_status, "vaMapBuffer vpp_params");

    pipeline_param->surface = surface_ids[cur_surface_idx];
    pipeline_param->surface_region = ®ion;
    pipeline_param->output_region = ®ion;
    pipeline_param->output_background_color = 0xff000000; // black -
FIXME: do that only on first frame!
    pipeline_param->filter_flags = VA_FILTER_SCALING_FAST;
    pipeline_param->num_filters = 0;
    va_status = vaUnmapBuffer(va_dpy, vpp_params_bufid);
    CHECK_VASTATUS(va_status, "vaUnmapBuffer vpp_params_bufid");

2016-07-12 9:21 GMT+02:00 He Zhenwei <hezhenwei at roseek.com>:
> Any one knows?
>
> -----Original Message-----
> From: He Zhenwei [mailto:hezhenwei at roseek.com]
> Sent: Wednesday, July 06, 2016 12:05 PM
> To: 'libva at lists.freedesktop.org'
> Subject: How to resize image
>
> Hi,
>
> I am new to Libva. I am recently asked to do image resizing using libva, but I cannot find any instructions how.
> Does anyone know the method? Thanks.
>
>
> Andy
>
>
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libva



-- 
Yann Dirson <yann at blade-group.com>
Blade -- 90 avenue des Ternes, 75017 Paris


More information about the Libva mailing list