videofilter: Allow to filter only areas indicated by GstVideoRegionOfInterestMeta
As a follow up of the issue https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1253, there is interest on modifying gstvideofilter to optionally filter just regions of interests.
I quote @thiblahute 's proposal:
The goal is to have GstVideoFilter handle the 'cropped view of the frames' for all its subclasses, calling
GstVideoFilter:transform_frame_ip
with the frame that has been mapped only for the region where the effect has to be applied. For a same frame with several ROI (selectable by the user),VideoFilter::transform_frame_ip
could be called several time for a same frame with the different regions mapped (the ordering of the ROI will matter when there are intersections.. but we should ignore that).For
VideoFilter::transform_frame
iself, and as a second step (as I think as a first step we should just support filter that only implementVideoFilter::transform_frame_ip
), we should have VideoFilter copy the input buffer, crop it, calltransform_frame
with a cropped version of the input/output buffers, then blend the buffer back into the original full frame.NOTE: This feature should be opt-in by subclasses of
VideoFilter
and we should see how that could work for hw accelerated effects.
Also from @meh 's comment:
some alignment might be needed, for example to deal with chroma subsampling, but that could be clearly documented.
If such an approach is possible, we could then apply any existing effect to regions of interest. The API should also allow specifying what ROI types we want the effect applied to.