update contrast and brightness algorythm