mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
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/1140>
This commit is contained in:
parent
b835356d6c
commit
ef324fa068
1 changed files with 6 additions and 2 deletions
|
@ -1506,7 +1506,9 @@ setup_gamma_decode (GstVideoConverter * convert)
|
||||||
func = convert->in_info.colorimetry.transfer;
|
func = convert->in_info.colorimetry.transfer;
|
||||||
|
|
||||||
convert->gamma_dec.width = convert->current_width;
|
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);
|
GST_DEBUG ("gamma decode 8->16: %d", func);
|
||||||
convert->gamma_dec.gamma_func = gamma_convert_u8_u16;
|
convert->gamma_dec.gamma_func = gamma_convert_u8_u16;
|
||||||
t = convert->gamma_dec.gamma_table = g_malloc (sizeof (guint16) * 256);
|
t = convert->gamma_dec.gamma_table = g_malloc (sizeof (guint16) * 256);
|
||||||
|
@ -1538,7 +1540,9 @@ setup_gamma_encode (GstVideoConverter * convert, gint target_bits)
|
||||||
func = convert->out_info.colorimetry.transfer;
|
func = convert->out_info.colorimetry.transfer;
|
||||||
|
|
||||||
convert->gamma_enc.width = convert->current_width;
|
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;
|
guint8 *t;
|
||||||
|
|
||||||
GST_DEBUG ("gamma encode 16->8: %d", func);
|
GST_DEBUG ("gamma encode 16->8: %d", func);
|
||||||
|
|
Loading…
Reference in a new issue