Age | Commit message (Collapse) | Author |
|
While it might be handy to have type-less functionality which is
similar to how C++ math is implemented it can not be easily achieved
with just preprocessor in a way which does not have side-effects on
wrong usage.
There macros where often used on a non-trivial expression, and there
was at least one usage where it was causing an actual side effect/bug
on Windows (see change around square_f(sh[index++]) in studiolight.c).
For such cases it is handy to have a function which is guaranteed to
have zero side-effects. The motivation behind actually removing the
macros is that there is already a way to do similar calculation. Also,
not having such macros is a way to guarantee that its usage is not
changed in a way which have side-effects and that it's not used as an
inspiration for cases where it should not be used.
Differential Revision: https://developer.blender.org/D7051
|
|
|
|
- Unlock property range.
- Use triangular noise to keep perceptual noise error more uniform.
Remap range to preserve perceptual intensity.
- Center noise distribution around 0 for GPU implementation because of
rounding.
- Do dithering after merging overlays.
Effect of using triangular noise is not really noticeable if you don't use
really low bitdepth. But doing a test in the shader were we artificially
reduce the bitdepth (`col = (col * 16) / 16;`) reveals the real difference.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6850
|
|
Nearly all byte-color functions use 'uchar'
causing casts when then colors were passed in.
Declare as uchar to remove the need for casts.
|
|
|
|
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
|
|
|
|
While \file doesn't need an argument, it can't have another doxy
command after it.
|
|
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
|
|
BF-admins agree to remove header information that isn't useful,
to reduce noise.
- BEGIN/END license blocks
Developers should add non license comments as separate comment blocks.
No need for separator text.
- Contributors
This is often invalid, outdated or misleading
especially when splitting files.
It's more useful to git-blame to find out who has developed the code.
See P901 for script to perform these edits.
|
|
- FTOCHAR -> unit_float_to_uchar_clamp
- F3TOCHAR3 -> unit_float_to_uchar_clamp_v3 (swap args)
- F4TOCHAR4 -> unit_float_to_uchar_clamp_v4 (swap args)
- FTOUSHORT -> unit_float_to_ushort_clamp
- USHORTTOUCHAR -> unit_ushort_to_uchar
|
|
|
|
Self-explanatory. to find broken links run `sphinx-build -b linkcheck sphinx-in sphinx-out`
Reviewers: mont29
Tags: #bf_blender, #python, #infrastructure:_websites
Differential Revision: https://developer.blender.org/D2297
|
|
|
|
|
|
Using SSE2 intrinsics when available for this kind of conversions.
It's not totally accurate, but accurate enough for the purposes where
we're using direct colorspace conversion by-passing OCIO.
Partially based on code from Cycles, partially based on other online
articles:
https://stackoverflow.com/questions/6475373/optimizations-for-pow-with-const-non-integer-exponent
Makes projection painting on hi-res float textures smoother.
This commit also enables global SSE2 in Blender. It shouldn't
bring any regressions in supported hardware (we require SSE2 since
2.64 now), but should keep an eye on because compilers might have
some bugs with that (unlikely, but possible).
|
|
|
|
|
|
This adds back rgb_to_grayscale,
not all color is managed or depends on the current loaded blend file's CM options.
Noted in comments that this is only to be used outside the CM pipeline.
|
|
calculations and use the OCIO one instead.
|
|
projection painting (2D will be separate commit).
|
|
possible, true/false for booleans, format for float litterals).
|
|
|
|
|
|
previous fix for 2D image painting were done, and also:
* For brushes that do masking (keeping the max contribution to a pixel limited),
the alpha from textures is now part of the mask. In many cases the logic
worked out the same and where it didn't it used to cause artifacts.
* Color interpolation for smear and soften tools now happens in premultipied
space, to avoid bleeding of RGB colors from zero alpha areas.
* Fix a few cases where byte <=> float conversion was not doing the proper
straight <=> premul conversion.
* Replace some float division by constants with multiplications, is faster.
Note: float texture painting seems to have some issues updating the OpenGL
texture, but issue was already there before this commit.
|
|
white background color
|
|
|
|
Additional changes:
- Made mipmapping operate with unsigned short instead of char
which allowed to eliminate extra division by 255, so prevision
should be a bit better now.
- Actually, this is not real unsigned short range, but it's a
range of 255*255 which is more convenient for mipmapping, so
made conversion functions private for scaling.c
Not sure it worth making this functions operate in 65535
range, for now current behavior seems to be just fine.
|
|
Regression was caused by alpha premul cleanup commit and the reason
of slowdown was uchar <-> float conversion which is slow.
Replaced with uchar <-> int conversion which seeps to be accurate
enough and mostly eliminates slowdown.
Slowdown was easy to notice when movie clip is used for 3d vierport
background and undistortion is enabled. In this case every frame
will re-calculate mipmaps.
It's still a nit slower than mipmap generation before cleanup
commit, but couldn't think about extra boost here atm.
|
|
This assumptions are now made:
- Internally float buffers are always linear alpha-premul colors
- Readers should worry about delivering float buffers with that
assumptions.
- There's an input image setting to say whether it's stored with
straight/premul alpha on the disk.
- Byte buffers are now assumed have straight alpha, readers should
deliver straight alpha.
Some implementation details:
- Removed scene's color unpremultiply setting, which was very
much confusing and was wrong for default settings.
Now all renderers assumes to deliver premultiplied alpha.
- IMB_buffer_byte_from_float will now linearize alpha when
converting from buffer.
- Sequencer's effects were changed to assume bytes have got
straight alpha. Most of effects will work with bytes still,
however for glow it was more tricky to avoid data loss, so
there's a commented out glow implementation which converts
byte buffer to floats first, operates on floats and returns
bytes back. It's slower and not sure if it should actually
be used -- who're using glow on alpha anyway?
- Sequencer modifiers should also be working nice with straight
bytes now.
- GLSL preview will predivide float textures to make nice shading,
shading with byte textures worked nice (GLSL was assuming straight
alpha).
- Blender Internal will set alpha=1 to the whole sky. The same
happens in Cycles and there's no way to avoid this -- sky is
neither straight nor premul and doesn't fit color pipeline well.
- Straight alpha mode for render result was also eliminated.
- Conversion to correct alpha need to be done before linearizing
float buffer.
- TIFF will now load and save files with proper alpha mode setting
in file meta data header.
- Remove Use Alpha from texture mapping and replaced with image
datablock setting.
Behaves much more predictable and clear from code point of view
and solves possible regressions when non-premultiplied images were
used as textures with ignoring alpha channel.
|
|
linearrgb_to_srgb_ushort4_predivide() was calling `linearrgb_to_srgb(t) * alpha` twice in the FTOUSHORT macro, which gcc didn't optimize out.
|
|
not working at all.
|
|
about color conversion.
|
|
normalise->normalize).
|
|
|
|
|
|
|
|
|
|
use glGetFloatv(GL_CURRENT_COLOR, curcol), which also become confusing to debug if in some cases the color was set beforehand.
|
|
|
|
|
|
else if's
|
|
|
|
|
|
* correct cmake/clang warning.
* use same include guard names as everywhere else for BLI math inline.
* correct define for madd_sh_shfl
|
|
|
|
made some small edits
- removed changes to AVI reading since the data types are apart of the format spec.
- absf -> abs for a double value in render code.
|
|
many, also don't check uchar range after casting to int, this can still cause
overflow with large float values.
|
|
rgb_uchar_to_float and swap args (math functions mostly have dest arg first like strcpy).
|
|
linearrgb_to_srgb_uchar3, was being done inline.
|