[Bf-committers] Dithering

Ton Roosendaal ton at blender.org
Tue Nov 2 11:06:16 CET 2004


Hi,

Ack! My mistake with the '||' operator, has to be '&&' for sure.
Shorts and ints are signed by default (I thought for C thats  
standard?). In Blender chars however are unsigned by default, enforced  
with a compiler option.

-Ton-

On 2 Nov, 2004, at 1:40, Goran Kocov wrote:

> I noticed a couple of problems with the changes made
> to the dithering code in shadepixel_short()
> (rendercore.c):
>
> - I'm not sure about this (lack of experience with
> C/C++), but I think that the dither_value should be of
> signed short type, not just short (short goes from 0
> to 65535, so it can't have negative values, right?).
>
> - The if statements should use the && (AND) operator,
> not the II (OR) operator (using OR resulted in serious
> underflows and overflows).
>
> Here's a patch correcting the problems:
>
> http://www.geocities.com/gkocov/misc/rendercore.patch.txt
>
> --- Ton Roosendaal <ton at blender.org> wrote:
>> - You applied the dither in the old renderer before
>> color was gamma
>> corrected. That results in total loss of the dither
>> then. I've added it
>> after, and nicely with shorts.
>
> Are you certain about this? I tested my dithering code
> that adds the dithering before the gamma correction
> and I'm pretty sure there's no loss of the dithering.
> I mention this because the noise artifacts are much
> more noticable now that the dithering is applied after
> the color values are converted from float to short, so
> I think it would be better to use the old calculation.
>
>
> Goran
>
>
>
> 		
> __________________________________
> Do you Yahoo!?
> Check out the new Yahoo! Front Page.
> www.yahoo.com
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list