diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-13 18:28:45 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-13 18:28:45 +0400 |
commit | 5aee7c7744005d11a9cc060e99b840749b671cfa (patch) | |
tree | 3d8fa65ac17e822c905f40c3778e93895ce59b30 /source | |
parent | d94b2efbb96316a0b645fe8970c551b2d73e42dc (diff) |
Correction to YCCK and CNYK jpeg images loading into blender
There was incorrect formula applied on color components, used the same
as gimp uses. It makes image looking nicer in blender, however it's
still not 100% correct. Seems lots of software are handling profiles
from jpeg file nicely. But that's another topic.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/imbuf/intern/jpeg.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index d96a01d7093..758617bdd48 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -348,25 +348,12 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla g = *buffer++; b = *buffer++; k = *buffer++; - - k = 255 - k; - r -= k; - if (r & 0xffffff00) { - if (r < 0) r = 0; - else r = 255; - } - g -= k; - if (g & 0xffffff00) { - if (g < 0) g = 0; - else g = 255; - } - b -= k; - if (b & 0xffffff00) { - if (b < 0) b = 0; - else b = 255; - } - - rect[3] = 255 - k; + + r = (r * k) / 255; + g = (g * k) / 255; + b = (b * k) / 255; + + rect[3] = 255; rect[2] = b; rect[1] = g; rect[0] = r; |