gstreamer/subprojects
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
..
gst-devtools validate: disable plugins in static build 2023-05-31 15:17:11 +00:00
gst-docs dsd: Add code for DSD audio support 2023-06-23 01:27:03 +00:00
gst-editing-services ges: Add support for gessrc as subtimeline element 2023-06-29 19:24:37 +00:00
gst-examples gst-examples: prepare for removal of kate plugin from cerbero 2023-06-05 06:45:54 +00:00
gst-integration-testsuites uridecodebin: Handle non dynamic sources with several source pads 2023-06-30 01:00:34 +00:00
gst-libav libav: Integrate FFmpeg's DSD support with GstDsd caps 2023-06-23 01:27:04 +00:00
gst-omx tools: add bad/ges/omx tools to gst_tools 2023-05-31 15:17:11 +00:00
gst-plugins-bad lc3: add unit test 2023-07-05 03:00:43 +00:00
gst-plugins-base uridecodebin3: Refuse sub uri in gapless mode 2023-07-03 16:02:40 +02:00
gst-plugins-good pngenc: Allocate a single GstMemory per frame 2023-07-05 08:41:14 +00:00
gst-plugins-ugly gstreamer-full: add full static support 2023-05-31 15:17:11 +00:00
gst-python python: More functions can be called before gst_init() 2023-06-02 13:25:23 +00:00
gst-rtsp-server rtspclientsink: add RTSP address pool for unicast UDP 2023-06-29 11:33:58 +00:00
gstreamer basesrc: Don't hold the object lock while pushing an event 2023-06-30 16:05:57 +00:00
gstreamer-sharp sharp: Mark _reserved fields as padding 2023-04-29 21:52:19 -04:00
gstreamer-vaapi vaapidecodebin: don't load vaapipostproc if not available 2023-06-08 12:50:41 +00:00
macos-bison-binary macos-bison-binary: Remove warning when running on arm64 2022-12-16 23:58:07 +00:00
packagefiles wrap: add libpsl patch to fix win build 2023-06-22 08:38:22 +00:00
win-flex-bison-binaries meson: Use run_command check: true for windows binary subprojects 2022-10-19 04:05:05 +00:00
win-nasm meson: Use run_command check: true for windows binary subprojects 2022-10-19 04:05:05 +00:00
avtp.wrap
bindinator.wrap
cairo.wrap subprojects: cairo: bump to 1.17.6 2022-09-17 22:41:40 +00:00
dav1d.wrap meson: add missing source_filename in the dav1d wrap 2023-04-03 14:29:36 +00:00
dssim.wrap
dv.wrap
expat.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
fdk-aac.wrap
FFmpeg.wrap
fontconfig.wrap subprojects: fontconfig: bump to 2.14.0 2022-09-17 22:41:40 +00:00
freetype2.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
fribidi.wrap subprojects: fribidi: bump to 1.0.12 2022-09-17 22:41:40 +00:00
gl-headers.wrap
glib-networking.wrap subprojects: update glib-networking to 2.74.0 and switch to file wrap 2022-11-18 00:51:48 +00:00
glib.wrap subprojects: update glib to 2.74.1 2022-11-18 00:50:56 +00:00
graphene.wrap
gst-plugins-rs.wrap gst-plugins-rs: Track main branch again 2023-01-24 19:08:50 +00:00
gtk-sharp.wrap
gtk.wrap meson: Use gtk tarball for the subproject wrap 2023-02-01 06:29:11 +00:00
harfbuzz.wrap subprojects: harfbuzz: bump to 5.2.0 2022-09-17 22:41:40 +00:00
json-glib.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
lame.wrap meson: Update lame to -7 which contains the def file fix 2022-12-19 01:43:08 +05:30
libdrm.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
libffi.wrap subprojects: libffi: pin to meson-3.2.9999.4 tag 2022-12-31 13:49:17 +00:00
libgudev.wrap meson: Add a wrap file for libgudev 2023-04-19 22:47:19 +00:00
libjpeg-turbo.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
liblc3.wrap lc3: plugin for LC3 audio codec 2023-07-05 03:00:43 +00:00
libmicrodns.wrap subprojects: libmicrodns: bump to 0.2.0 + meson fixes 2022-09-17 22:41:40 +00:00
libnice.wrap libnice: disable gst tests in static mode 2023-05-31 15:17:11 +00:00
libopenjp2.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
libpng.wrap
libpsl.wrap wrap: add libpsl patch to fix win build 2023-06-22 08:38:22 +00:00
libsoup.wrap subprojects: switch libsoup to a file wrap 2022-11-18 00:56:25 +00:00
libsrtp2.wrap subprojects: Update libsrtp2 wrap to v2.5.0 2023-02-01 10:34:35 +00:00
libva.wrap subprojects: libva: Pin to 2.19.0.pre1 (1c58941) 2023-06-15 21:14:29 +00:00
libwpe.wrap
libxml2.wrap libxml2: update to 2.10.3-4 2023-06-22 08:38:22 +00:00
ogg.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
openh264.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
opus.wrap
orc.wrap orc: update subproject wrap to 0.4.34 2023-05-30 01:21:20 +00:00
pango.wrap meson: Add a patch that fixes pangocairo usage in gst-plugins-rs 2022-12-17 07:37:03 +05:30
pixman.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
proxy-libintl.wrap
pycairo.wrap
pygobject.wrap meson: Allow sysdeps to be forced as fallback subprojects 2023-02-06 09:26:02 +00:00
sqlite3.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
vorbis.wrap meson: Update some wraps, remove unused wraps 2022-07-16 06:16:17 +00:00
webrtc-audio-processing.wrap meson: Update webrtc-audio-processing wrap to 1.1 2023-06-01 09:34:37 +00:00
wpebackend-fdo.wrap
x264.wrap
zlib.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00