diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com> | 2021-05-06 19:01:41 +0200 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-07-07 13:00:14 +0000 |
commit | 1b58c946808d8ce03a56c44c5a31eb5c1a1c07b2 (patch) | |
tree | ac605524a052c36b6c428025ec0e392799b4dbd3 | |
parent | 46b385886720b5b2eb9370192668f645a235f64e (diff) | |
download | gstreamer-plugins-base-1b58c946808d8ce03a56c44c5a31eb5c1a1c07b2.tar.gz |
video-converter: Set up gamma tables only once
When the video converter is using multiple threads, the gamma tables
were created multiple times, leaking the tables set up for the previous
thread.
Only calculate the tables once.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1217>
-rw-r--r-- | gst-libs/gst/video/video-converter.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c index 9dda88ef7..61c3ab574 100644 --- a/gst-libs/gst/video/video-converter.c +++ b/gst-libs/gst/video/video-converter.c @@ -1518,7 +1518,9 @@ setup_gamma_decode (GstVideoConverter * convert) func = convert->in_info.colorimetry.transfer; convert->gamma_dec.width = convert->current_width; - if (convert->current_bits == 8) { + if (convert->gamma_dec.gamma_table) { + GST_DEBUG ("gamma decode already set up"); + } else if (convert->current_bits == 8) { GST_DEBUG ("gamma decode 8->16: %d", func); convert->gamma_dec.gamma_func = gamma_convert_u8_u16; t = convert->gamma_dec.gamma_table = g_malloc (sizeof (guint16) * 256); @@ -1548,7 +1550,9 @@ setup_gamma_encode (GstVideoConverter * convert, gint target_bits) func = convert->out_info.colorimetry.transfer; convert->gamma_enc.width = convert->current_width; - if (target_bits == 8) { + if (convert->gamma_enc.gamma_table) { + GST_DEBUG ("gamma encode already set up"); + } else if (target_bits == 8) { guint8 *t; GST_DEBUG ("gamma encode 16->8: %d", func); |