After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 500152 - videotestsrc: reduce cpu usage for static and cachable patterns
videotestsrc: reduce cpu usage for static and cachable patterns
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal enhancement
: git master
Assigned To: Edward Hervey
GStreamer Maintainers
: 754632 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-11-28 08:28 UTC by Laurent Glayal
Modified: 2018-11-03 11:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
reduce CPU usage for unicolor buffers (3.52 KB, patch)
2007-11-28 08:29 UTC, Laurent Glayal
rejected Details | Review
videotestsrc: Don't re-render every frame when it's not needed. (6.81 KB, patch)
2010-07-22 14:32 UTC, Edward Hervey
needs-work Details | Review

Description Laurent Glayal 2007-11-28 08:28:34 UTC
Patch to avoid computing of each new video buffer when using a unicolor one. Just keep the result in memory and copy it for each new one.
Comment 1 Laurent Glayal 2007-11-28 08:29:01 UTC
Created attachment 99763 [details] [review]
reduce CPU usage for unicolor buffers
Comment 2 David Schleef 2007-12-07 23:07:33 UTC
The image rendering is done for every frame on purpose, so that if a downstream element stomps on the buffer (which it isn't supposed to, but...) it doesn't affect future buffers.

Also, this patch does not appear to handle changing properties correctly.  It also will have problems after renegotiating caps.
Comment 3 Sebastian Dröge (slomo) 2009-05-07 12:26:42 UTC
Closing this as WONTFIX as the behaviour is correct.
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2009-05-17 19:22:38 UTC
Not sure if WONTFIX is the right resolution.
Having a static-red, static-black et.c variants would be nice (does not need to be all patterns). This comes handy in testing/profiling elements.

Laurent, would you be willing to rework the patch to add the static ones as new patterns (and fix it so that it handles renegotiation)? If so, please reopen.
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2009-05-17 19:25:50 UTC
this check is too weak:
if (v->unicolor_buffer == NULL || (v->unicolor_buffer_size != ((guint) (p->endptr - p->yp)))) {

if the yuv format changes, the size might still be the same.

Comment 6 Edward Hervey 2010-07-21 15:49:58 UTC
Sorry, I'm reopening this. The reason stated by ds in Comment #2 is unacceptable.

If some elements write in read-only buffers... those elements should be fixed.

That being said, the patch isn't good either.
Comment 7 Tim-Philipp Müller 2010-07-21 15:59:44 UTC
I too think the current behaviour is desirable as default, but wouldn't object if a property was added that allows buffer re-use and avoids excessive repainting.

It's not videotestsrc's job to create output that might expose bugs in elements, its job is to create as perfect a signal/stream as possible, and this includes outputting buffers with freshly allocated data for each buffer IMHO.
Comment 8 David Schleef 2010-07-21 20:14:50 UTC
FWIW, I don't necessarily think the current behavior is correct, I was just giving the reason why it was chosen.

The original purpose of videotestsrc was was to create the default pattern in as many formats as possible, and do it *correctly* and *reliably*.  It helped uncover lots of bugs in other elements, in X drivers, etc.  These days, everything else is just as reliable, plus we have a convenience library for video formats.  (Which, btw, videotestsrc does not use, but that's another matter.)  And now vts has lots of patterns and is useful for other purposes, so imo videotestsrc has outgrown that original purpose.

So I'm in favor of fixing up vts for repurposing.  In particular, I like the idea of not regenerating the same buffer.  I also like the idea of generating a scan line and then memcpy'ing a bunch of times for patterns like smpte and checkers-*.  I'm also in favor of using libgstvideo.  And any changes that can make it more Orc friendly.
Comment 9 Edward Hervey 2010-07-22 08:38:51 UTC
Reopening since it seems there's interest in it. Will clean-up attach my avoid-regenerating patch here soon.
Comment 10 Edward Hervey 2010-07-22 14:32:33 UTC
Created attachment 166393 [details] [review]
videotestsrc: Don't re-render every frame when it's not needed.

For all the formats that support it and whenever downstream hasn't
changed, we returned a metadata-writable read-only copy of the
original buffer.
Comment 11 Sebastian Dröge (slomo) 2011-05-18 20:51:14 UTC
Can we commit this now?
Comment 12 David Schleef 2011-05-18 21:03:26 UTC
The zone plate patterns are not static, nor is ball.  Setting horizontal-speed makes most patterns non-static.

I would prefer pattern_is_static to cachable_format, and make the default FALSE.

Otherwise, push it.
Comment 13 Julien Isorce 2014-11-01 09:17:41 UTC
I think it still make sense to have this. Especially on embedded to have a low cpu source for testing the rest of the pipeline.
Comment 14 Sebastian Dröge (slomo) 2014-11-06 10:57:41 UTC
Yes, just needs someone to update the patch and actually do it
Comment 15 Sebastian Dröge (slomo) 2015-09-06 15:33:50 UTC
*** Bug 754632 has been marked as a duplicate of this bug. ***
Comment 16 Edward Hervey 2018-05-04 09:08:28 UTC
Assign to myself, need to refactor it.
Comment 17 GStreamer system administrator 2018-11-03 11:13:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/10.