[Libva] How to resize image using hardware accelerate

He Zhenwei hezhenwei at roseek.com
Tue Jul 12 08:13:54 UTC 2016


Thank you very much Dirson,

I will try and give feed back later.

Andy.


-----Original Message-----
From: Yann Dirson [mailto:yann.dirson at blade-group.com] 
Sent: Tuesday, July 12, 2016 3:38 PM
To: He Zhenwei
Cc: libva at lists.freedesktop.org
Subject: Re: [Libva] How to resize image using hardware accelerate

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