mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
gaudi: fix exclusion's factor range
Avoid dividing by zero when the factor is zero. Instead, output a buffer with all color values as zero.
This commit is contained in:
parent
1fee98f5dd
commit
30780db15b
1 changed files with 9 additions and 0 deletions
|
@ -270,6 +270,9 @@ transform (guint32 * src, guint32 * dest, gint video_area, gint factor)
|
|||
guint32 in;
|
||||
gint x, red, green, blue;
|
||||
|
||||
if (G_UNLIKELY (factor == 0))
|
||||
return;
|
||||
|
||||
for (x = 0; x < video_area; x++) {
|
||||
in = *src++;
|
||||
|
||||
|
@ -277,6 +280,12 @@ transform (guint32 * src, guint32 * dest, gint video_area, gint factor)
|
|||
green = (in >> 8) & 0xff;
|
||||
blue = (in) & 0xff;
|
||||
|
||||
if (factor == 0) {
|
||||
red = 0;
|
||||
green = 0;
|
||||
blue = 0;
|
||||
}
|
||||
|
||||
red = factor -
|
||||
(((factor - red) * (factor - red) / factor) + ((green * red) / factor));
|
||||
green = factor -
|
||||
|
|
Loading…
Reference in a new issue