Fix #33357: Strip modificator Bright/Contrast doesn't work correct for byte images
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 30 Nov 2012 13:42:52 +0000 (13:42 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 30 Nov 2012 13:42:52 +0000 (13:42 +0000)
source/blender/blenkernel/intern/seqmodifier.c

index 609724e802f9ac8f94ee9eed53903414e0e8180b..5b2e9f2bf23aac57fbe1e6bbc61a4851b6a1b317 100644 (file)
@@ -427,17 +427,17 @@ static void brightcontrast_apply_threaded(int width, int height, unsigned char *
                                unsigned char *pixel = rect + pixel_index;
 
                                for (c = 0; c < 3; c++) {
-                                       i = pixel[c];
+                                       i = (float) pixel[c] / 255.0f;
                                        v = a * i + b;
 
                                        if (mask_rect) {
                                                unsigned char *m = mask_rect + pixel_index;
                                                float t = (float) m[c] / 255.0f;
 
-                                               pixel[c] = pixel[c] * (1.0f - t) + v * t;
+                                               v = (float) pixel[c] * (1.0f - t) + v * t;
                                        }
-                                       else
-                                               pixel[c] = v;
+
+                                       pixel[c] = FTOCHAR(v);
                                }
                        }
                        else if (rect_float) {