Is there a way to crop in VAAPI?

Yan Wang yan.wang at linux.intel.com
Wed Aug 7 06:43:20 UTC 2019


On 8/7/2019 9:40 AM, Nicolas Dufresne-5 [via GStreamer-devel] wrote:
> Le mardi 06 août 2019 à 14:31 +0800, Yan Wang a écrit :
>
> >
> > On 8/5/2019 9:29 PM, Nicolas Dufresne-5 [via GStreamer-devel] wrote:
> > >
> > > Le lun. 5 août 2019 02 h 55, Yan Wang <[hidden email]> a écrit :
> > > >
> > > > On 8/3/2019 9:25 PM, Nicolas Dufresne-5 [via GStreamer-devel] 
> wrote:
> > > > > Le vendredi 02 août 2019 à 20:45 -0500, kmliu a écrit :
> > > > >
> > > > > > I need to decode H.264 video via VAAPI and then extract the 
> decoded frames to
> > > > > > main memory. Since I intend to crop the frames anyway, I'd 
> like to crop them
> > > > > > while they're still in graphics memory, to reduce memory 
> bandwidth
> > > > > > consumption. So conceptually, I want to do this:
> > > > > >
> > > > > > gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! 
> vaapih264dec !
> > > > > > videocrop left=x right=x top=x bottom=x ! filesink 
> location=video.yuv
> > > > > >
> > > > > > But I think this will end up copying the whole frames to 
> main memory before
> > > > > > cropping it there. It would be nice if vaapipostproc 
> supports cropping?
> > > > >
> > > > > Another (simplier) option is to use gltransformation, but 
> apparently
> > > > > not all distro ship this plugin.
> > > >
> > > > May I add the crop option for vaapih264dec?
> > > >
> > > > It may be more direct.
> > > >
> > > >
> > >
> > > Sounds wrong to me, and I doubt you'll find an API to support 
> that. If there is one element in VAAPI that may have an API for this 
> it would be vaapipostproc.
> >
> > Yes. I know vaapipostproc can do this.
> >
> > IMHO, this could be done in decode context too if 
> VAConfigAttribDecProcessing can support it.
> >
> > https://github.com/intel/libva/blob/master/va/va.h#L520
> >
> > Currently It can do scaling (1/8 ~ 8x at most, CSC). Cropping can be 
> the special case of scaling.
> >
> > If vaapih264dec provides the interface, it can reduce the overhead 
> and power because it is fixed function. And no need vaapipostproc 
> context.
> >
> > But it may make vaapih264dec more complex and cannot support 
> multiply pipelines of decoding. So it is just one possible option.
>
> If you know how it works, just give it a try. You can find similar code
> in -good/sys/gstv4l2videodec.c, but only for the CSC bit. Scaling is
> more complex though, because of the pixel aspect ratio handling. It's
> this a proper scaler or just multiple of 2 ?

I will check -good/sys/gstv4l2videodec.c.

This scaling/CSC has some limitation. It could be attached only one 
decoding pipeline.

So it is different with normal videopostproc pipeline but videopostproc 
pipeline could select it too. The logic of the selection should be in 
media driver currently.

Of course, it can also be selected in gstreamer-vaapi directly.

Thanks for your comments.

Yan Wang

>
> >
> > Thanks.
> >
> > Yan Wang
> >
> > >
> > > > Thanks.
> > > >
> > > > Yan Wang
> > > >
> > > >
> > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> > > > > > _______________________________________________
> > > > > > gstreamer-devel mailing list
> > > > > > [hidden email]
> > > > > > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> > > > >
> > > > > _______________________________________________
> > > > > gstreamer-devel mailing list
> > > > > [hidden email]
> > > > > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> > > > >
> > > > > If you reply to this email, your message will be added to the 
> discussion below:
> > > > > 
> http://gstreamer-devel.966125.n4.nabble.com/Is-there-a-way-to-crop-in-VAAPI-tp4691566p4691569.html
> > > > > To start a new topic under GStreamer-devel, email [hidden email]
> > > > > To unsubscribe from GStreamer-devel, click here.
> > > > > NAML
> > > >
> > > > _______________________________________________
> > > > gstreamer-devel mailing list
> > > > [hidden email]
> > > > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> > >
> > > _______________________________________________
> > > gstreamer-devel mailing list
> > > [hidden email]
> > > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> > >
> > > If you reply to this email, your message will be added to the 
> discussion below:
> > > 
> http://gstreamer-devel.966125.n4.nabble.com/Is-there-a-way-to-crop-in-VAAPI-tp4691566p4691583.html
> > > To start a new topic under GStreamer-devel, email [hidden email] 
> </user/SendEmail.jtp?type=node&node=4691613&i=0>
> > > To unsubscribe from GStreamer-devel, click here.
> > > NAML
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email] </user/SendEmail.jtp?type=node&node=4691613&i=1>
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email] </user/SendEmail.jtp?type=node&node=4691613&i=2>
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://gstreamer-devel.966125.n4.nabble.com/Is-there-a-way-to-crop-in-VAAPI-tp4691566p4691613.html 
>
> To start a new topic under GStreamer-devel, email 
> ml+s966125n966125h86 at n4.nabble.com
> To unsubscribe from GStreamer-devel, click here 
> <http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=966125&code=eWFuLndhbmdAbGludXguaW50ZWwuY29tfDk2NjEyNXwxMDk4MzUzMzA=>.
> NAML 
> <http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190807/e889f554/attachment.html>


More information about the gstreamer-devel mailing list