gstreamer/subprojects/gst-plugins-good/ext
Jordan Petridis 1ef13dda12 pngenc: Allocate a single GstMemory per frame
Previously, we would create a new GstMemory per write operation
and then append them to the GstBuffer. This would cause a reallocation
every 16 Memories which is an issue since the png encoder will usually
do write in a pattern of 4, 8 and 8k bytes repeating until the frame
is done.

Instead allocate a single GstMemory and keep writting it into it
with a manual index. Much like the jpegenc does.

Doing some basic testing With a testsrc snow pattern at 4k and 8k
the same pipeline would take ~3.30s to encode a 4k frame and ~23s
for an 8k. At 4k 0.70s/33% is taken by memory allocations, while at
8k its ~10.5s/45%.

With this patch, at 4k the pipeline takes ~2.40s and at 8k only 9.60s
making this 28% and 58% faster accordingly on my laptop, and
allocation runtime is dropped to subsecond times.

Here's the test pipeline used, increase num-buffers in image freeze
to gather more samples.

```
gst-launch-1.0 videotestsrc num-buffers=1 pattern=snow ! imagefreeze num-buffers=1 ! \
  video/x-raw,width=7680,height=4320 ! pngenc ! fakesink
```

Close #2717

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4944>
2023-07-05 08:41:14 +00:00
..
aalib meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
adaptivedemux2 hlsdemux2: Ensure processed webvtt ends with empty new line 2023-07-04 10:57:01 +02:00
amrnb amrnb, amrwbdec: move AMR-NB and AMR-WB plugins to -good 2023-05-02 23:33:12 +00:00
amrwbdec amrnb, amrwbdec: move AMR-NB and AMR-WB plugins to -good 2023-05-02 23:33:12 +00:00
cairo meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
dv meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
flac flacenc: Fix mapping of GStreamer image tag type to FLAC image tag type 2023-03-18 16:17:01 +02:00
gdk_pixbuf gdkpixbuf: drop use of GSlice 2023-01-24 15:25:06 +00:00
gtk gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
jack jack: tone down log ERRORs in case no JACK server is running 2023-05-08 21:20:20 +00:00
jpeg jpegdec: be stricter when detecting interlaced video 2023-05-25 18:34:34 +00:00
lame meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
libcaca Move files from gst-plugins-good into the "subprojects/gst-plugins-good/" subdir 2021-09-24 16:13:50 -03:00
libpng pngenc: Allocate a single GstMemory per frame 2023-07-05 08:41:14 +00:00
mpg123 meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
pulse pulse: Change bitfield booleans to normal gbooleans 2023-05-14 15:58:35 +00:00
qt build/android: remove all references to gnustl 2023-06-03 23:21:34 +00:00
qt6 meson: Support building qml6glsink on win32 2023-06-02 14:27:44 +05:30
raw1394 Move files from gst-plugins-good into the "subprojects/gst-plugins-good/" subdir 2021-09-24 16:13:50 -03:00
shout2 shout: fix minimum requirement to libshout >= 2.4.3 2022-09-19 20:50:25 +03:00
soup souphttpsrc: forward accept-certificate signal from libsoup-3 2023-06-29 16:27:31 +00:00
speex meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
taglib meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
twolame meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
vpx vpx: drop use of GSlice 2023-01-24 15:25:06 +00:00
wavpack gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
meson.build amrnb, amrwbdec: move AMR-NB and AMR-WB plugins to -good 2023-05-02 23:33:12 +00:00