From: Jan Schmidt Date: Wed, 4 Nov 2020 17:43:47 +0000 (+1100) Subject: video-converter: Skip input lines where possible. X-Git-Tag: 1.19.3~511^2~372 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb9799e942cc8e83f85faea00a6735cf8e1fc6bb;p=platform%2Fupstream%2Fgstreamer.git video-converter: Skip input lines where possible. There is a case where there are no lines in the temp cache, and it's possible to skip straight to the request line and not generate intermediate ones. This is really only beneficial when doing nearest-neighbour downscaling, as other methods generally require all input lines sequentially to generate the output. In that case, this change has no effect and all lines are generated and cached as before. As a side effect however, this fixes corruption when downscaling using nearest-neighbour, as interactions with the pass_alloc flag and reuse of temporary lines causes the unecessarily-generated cache lines to overwrite the final output. Part-of: --- diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c index 8a556e2..7a8a6e2 100644 --- a/gst-libs/gst/video/video-converter.c +++ b/gst-libs/gst/video/video-converter.c @@ -612,6 +612,10 @@ gst_line_cache_get_lines (GstLineCache * cache, gint idx, gint out_line, if (cache->need_line == NULL) break; + /* We may be able to skip ahead to the earliest line needed */ + if (cache->lines->len == 0 && cache->first + cache->backlog < in_line) + cache->first = in_line - cache->backlog; + oline = out_line + cache->first + cache->lines->len - in_line; if (!cache->need_line (cache, idx, oline, cache->first + cache->lines->len,