[vlc-devel] [PATCH 4/6] chroma: cvpx: avoid conversion to self without resize

Alexandre Janniaux ajanni at videolabs.io
Tue Jun 9 18:43:58 CEST 2020


CVP* -> CVP* with the star equal to the same value is possible when
building a resize+chroma chain, but in the case of chroma only we don't
want to add additional steps.
---
 modules/video_chroma/cvpx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/video_chroma/cvpx.c b/modules/video_chroma/cvpx.c
index 24d14bb69f..1614aeb7ee 100644
--- a/modules/video_chroma/cvpx.c
+++ b/modules/video_chroma/cvpx.c
@@ -414,6 +414,12 @@ Open_CVPX_to_CVPX(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
 
+    /* Avoid conversion to self if we're not resizing */
+    if (filter->fmt_in.video.i_chroma == filter->fmt_out.video.i_chroma &&
+        filter->fmt_in.video.i_visible_width == filter->fmt_out.video.i_visible_width &&
+        filter->fmt_in.video.i_visible_height == filter->fmt_out.video.i_visible_height)
+        return VLC_EGENERIC;
+
     if (filter->vctx_in == NULL ||
         vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_CVPX)
         return VLC_EGENERIC;
-- 
2.27.0



More information about the vlc-devel mailing list