mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
videobalance: Reduce number of allocations per instance
This commit is contained in:
parent
3ef25c28cd
commit
0515f88f7c
2 changed files with 10 additions and 25 deletions
|
@ -536,26 +536,8 @@ gst_video_balance_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
GList *channels = NULL;
|
GList *channels = NULL;
|
||||||
GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
|
GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
|
||||||
gint i;
|
|
||||||
|
|
||||||
if (balance->tableu) {
|
g_free (balance->tableu[0]);
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
g_free (balance->tableu[i]);
|
|
||||||
g_free (balance->tableu);
|
|
||||||
balance->tableu = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (balance->tablev) {
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
g_free (balance->tablev[i]);
|
|
||||||
g_free (balance->tablev);
|
|
||||||
balance->tablev = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (balance->tabley) {
|
|
||||||
g_free (balance->tabley);
|
|
||||||
balance->tabley = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
channels = balance->channels;
|
channels = balance->channels;
|
||||||
while (channels) {
|
while (channels) {
|
||||||
|
@ -623,12 +605,13 @@ gst_video_balance_init (GstVideoBalance * videobalance,
|
||||||
videobalance->hue = DEFAULT_PROP_HUE;
|
videobalance->hue = DEFAULT_PROP_HUE;
|
||||||
videobalance->saturation = DEFAULT_PROP_SATURATION;
|
videobalance->saturation = DEFAULT_PROP_SATURATION;
|
||||||
|
|
||||||
videobalance->tabley = g_new (guint8, 256);
|
videobalance->tableu[0] = g_new (guint8, 256 * 256 * 2);
|
||||||
videobalance->tableu = g_new (guint8 *, 256);
|
|
||||||
videobalance->tablev = g_new (guint8 *, 256);
|
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
videobalance->tableu[i] = g_new (guint8, 256);
|
videobalance->tableu[i] =
|
||||||
videobalance->tablev[i] = g_new (guint8, 256);
|
videobalance->tableu[0] + i * 256 * sizeof (guint8);
|
||||||
|
videobalance->tablev[i] =
|
||||||
|
videobalance->tableu[0] + 256 * 256 * sizeof (guint8) +
|
||||||
|
i * 256 * sizeof (guint8);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_video_balance_update_properties (videobalance);
|
gst_video_balance_update_properties (videobalance);
|
||||||
|
|
|
@ -67,7 +67,9 @@ struct _GstVideoBalance {
|
||||||
gint size;
|
gint size;
|
||||||
|
|
||||||
/* tables */
|
/* tables */
|
||||||
guint8 *tabley, **tableu, **tablev;
|
guint8 tabley[256];
|
||||||
|
guint8 *tableu[256];
|
||||||
|
guint8 *tablev[256];
|
||||||
|
|
||||||
void (*process) (GstVideoBalance *balance, guint8 *data);
|
void (*process) (GstVideoBalance *balance, guint8 *data);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue