sws_utils: work around libswscale crash with --contrast=-100

This commit is contained in:
wm4 2013-10-16 21:39:51 +02:00
parent 0052445e86
commit 6f139ad981
1 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include "sws_utils.h" #include "sws_utils.h"
#include "mpvcore/mp_common.h"
#include "video/mp_image.h" #include "video/mp_image.h"
#include "video/img_format.h" #include "video/img_format.h"
#include "fmt-conversion.h" #include "fmt-conversion.h"
@ -327,7 +328,7 @@ int mp_sws_set_vf_equalizer(struct mp_sws_context *sws, struct vf_seteq *eq)
if (!strcmp(eq->item, "brightness")) if (!strcmp(eq->item, "brightness"))
sws->brightness = ((eq->value << 16) + 50) / 100; sws->brightness = ((eq->value << 16) + 50) / 100;
else if (!strcmp(eq->item, "contrast")) else if (!strcmp(eq->item, "contrast"))
sws->contrast = (((eq->value + 100) << 16) + 50) / 100; sws->contrast = MPMAX(1, (((eq->value + 100) << 16) + 50) / 100);
else if (!strcmp(eq->item, "saturation")) else if (!strcmp(eq->item, "saturation"))
sws->saturation = (((eq->value + 100) << 16) + 50) / 100; sws->saturation = (((eq->value + 100) << 16) + 50) / 100;
else else