v4l2codecs: h265dec: Avoid cropping for zero top/left alignments

If the conformance window does not requires cropping the top or left of the
window, we can use GstVideoMeta to crop in a zero-copy fashion. If a copy
is needed, the frame copy can also handle it, and is a lot faster.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9305>
This commit is contained in:
Nicolas Dufresne 2025-06-27 10:00:37 -04:00 committed by GStreamer Marge Bot
parent 0fbd76dd50
commit e7be87b3de

View File

@ -971,10 +971,12 @@ gst_v4l2_codec_h265_dec_new_sequence (GstH265Decoder * decoder,
self->crop_rect_x = sps->crop_rect_x;
self->crop_rect_y = sps->crop_rect_y;
/* conformance_window_flag could be set but with zeroed
* parameters so check if we really need to crop */
self->need_crop |= self->crop_rect_width != sps->width;
self->need_crop |= self->crop_rect_height != sps->height;
/*
* Conformance_window_flag could be set but with zeroed
* parameters so check if we really need to crop. We only need
* to crop if the x/y are not zero, otherwise it can be handled by
* GstVideoMeta in a zero-copy fashion.
*/
self->need_crop |= self->crop_rect_x != 0;
self->need_crop |= self->crop_rect_y != 0;
}