5 years agoMake Phase take other Phases as inputs, not Nodes.
Steinar H. Gunderson [Mon, 17 Mar 2014 23:57:53 +0000 (00:57 +0100)]
Make Phase take other Phases as inputs, not Nodes.

This was a refactoring I wanted to do for a while, but actually finding
the right structure was a bit tricky. In the process, the entire phase
generation logic was rewritten, but the separation between compilation
and Phase construction is much cleaner now, and the logic in general
is easier to follow with more use of explicit recursion.

I'm still not 100% happy about what might be overuse of output_node;
we still need to link Phase and Node (the link just goes the other way
now), but I'm not sure we need to use it in all the cases we currently do.

5 years agoDocument the FFTW3 requirement.
Steinar H. Gunderson [Mon, 17 Mar 2014 00:47:30 +0000 (01:47 +0100)]
Document the FFTW3 requirement.

5 years agoMovit can hardly be said to be in alpha stage anymore.
Steinar H. Gunderson [Mon, 17 Mar 2014 00:45:10 +0000 (01:45 +0100)]
Movit can hardly be said to be in alpha stage anymore.

5 years agoRemove obsolete file.
Steinar H. Gunderson [Mon, 17 Mar 2014 00:26:13 +0000 (01:26 +0100)]
Remove obsolete file.

This was part of my original scribblings, and is no longer needed.

5 years agoRelease Movit 1.0.3. 1.0.3
Steinar H. Gunderson [Sun, 16 Mar 2014 22:29:07 +0000 (23:29 +0100)]
Release Movit 1.0.3.

5 years agoMove private libs into Libs.private in the pkg-config file.
Steinar H. Gunderson [Sun, 16 Mar 2014 22:26:04 +0000 (23:26 +0100)]
Move private libs into Libs.private in the pkg-config file.

5 years agoAdd FFTW3 libs and flags to the pkg-config file.
Steinar H. Gunderson [Sun, 16 Mar 2014 22:22:43 +0000 (23:22 +0100)]
Add FFTW3 libs and flags to the pkg-config file.

5 years agoTake LDFLAGS properly from configure, and distinguish better between LDFLAGS and...
Steinar H. Gunderson [Sun, 16 Mar 2014 22:08:17 +0000 (23:08 +0100)]
Take LDFLAGS properly from configure, and distinguish better between LDFLAGS and LDLIBS.

5 years agoDo not link libmovit against SDL; only the unit tests need that.
Steinar H. Gunderson [Sun, 16 Mar 2014 22:01:29 +0000 (23:01 +0100)]
Do not link libmovit against SDL; only the unit tests need that.

5 years agoRelease Movit 1.0.2. 1.0.2
Steinar H. Gunderson [Sun, 16 Mar 2014 21:35:02 +0000 (22:35 +0100)]
Release Movit 1.0.2.

5 years agoMake $(libdir) on make install, in case it does not exist.
Steinar H. Gunderson [Sun, 16 Mar 2014 21:40:24 +0000 (22:40 +0100)]
Make $(libdir) on make install, in case it does not exist.

5 years agoMake make install honor DESTDIR.
Steinar H. Gunderson [Sun, 16 Mar 2014 21:33:53 +0000 (22:33 +0100)]
Make make install honor DESTDIR.

5 years agoRelease Movit 1.0.1. 1.0.1
Steinar H. Gunderson [Sun, 16 Mar 2014 21:19:24 +0000 (22:19 +0100)]
Release Movit 1.0.1.

5 years agoFix a C++11 incompatibility.
Steinar H. Gunderson [Sun, 16 Mar 2014 21:16:07 +0000 (22:16 +0100)]
Fix a C++11 incompatibility.

5 years agoRevert "Stop using -rpath when linking libmovit."
Steinar H. Gunderson [Sun, 16 Mar 2014 21:13:45 +0000 (22:13 +0100)]
Revert "Stop using -rpath when linking libmovit."

Actually, this is seemingly needed to build shared libraries at all. Doh.

This reverts commit 05466cbaae2befac3d3ab8bbba614bc08646d3f2.

5 years agoRelease Movit 1.0. 1.0
Steinar H. Gunderson [Sun, 16 Mar 2014 20:39:37 +0000 (21:39 +0100)]
Release Movit 1.0.

5 years agoMake a 'make dist' target.
Steinar H. Gunderson [Sun, 16 Mar 2014 20:08:28 +0000 (21:08 +0100)]
Make a 'make dist' target.

5 years agoAdd the two missing FFT shaders to MISSING_SHADERS.
Steinar H. Gunderson [Sun, 16 Mar 2014 19:19:36 +0000 (20:19 +0100)]
Add the two missing FFT shaders to MISSING_SHADERS.

5 years agoStop using -rpath when linking libmovit.
Steinar H. Gunderson [Sun, 16 Mar 2014 19:12:11 +0000 (20:12 +0100)]
Stop using -rpath when linking libmovit.

This was from pre-libtool days, and makes no sense now. Plus it seems to have
no actual effect.

5 years agoStart doing symbol versioning.
Steinar H. Gunderson [Sun, 16 Mar 2014 19:11:38 +0000 (20:11 +0100)]
Start doing symbol versioning.

As we prepare for 1.0, we want to make sure we have a proper soname.
See the comment for slightly more details.

5 years agoAdd an FFT convolution effect.
Steinar H. Gunderson [Sun, 16 Mar 2014 18:25:53 +0000 (19:25 +0100)]
Add an FFT convolution effect.

A lot of the later commits have been leading up to this, and I finally
got to the point where all the unit tests check out, everything seems
to work (modulo maybe some overflow issues) and we have a model that
matches what people actually expects from convolutions.

Note that this adds a dependency on FFTW3; we could probably have added
our own routines for such small needs, but like with Eigen, calling out to a
library is fine as long as it's of good quality (which FFTW certainly is) and
is widely available.

5 years agoMake SliceEffect slice from the top, not the bottom.
Steinar H. Gunderson [Sat, 15 Mar 2014 20:53:10 +0000 (21:53 +0100)]
Make SliceEffect slice from the top, not the bottom.

This is more consistent with the rest of Movit, and makes the rest
of the FFT implementation easier.

5 years agoRevert "Support pad/crop from bottom, not just from the top."
Steinar H. Gunderson [Sat, 15 Mar 2014 20:51:32 +0000 (21:51 +0100)]
Revert "Support pad/crop from bottom, not just from the top."

This turned out not to be so useful after all, as we'd like a more
consistent top-left coordinate system, and changes to do that will
obsolete this patch.

This reverts commit e92a5ffa19eb67b4db5af1db8559630139073668.

5 years agoIn the README, document that we have luma mix.
Steinar H. Gunderson [Sat, 15 Mar 2014 19:46:07 +0000 (20:46 +0100)]
In the README, document that we have luma mix.

5 years agoSupport pad/crop from bottom, not just from the top.
Steinar H. Gunderson [Sat, 15 Mar 2014 18:13:38 +0000 (19:13 +0100)]
Support pad/crop from bottom, not just from the top.

This is convenient for the FFTs that are coming.

5 years agoFix a bug where repeated vertical FFTs would reverse the output.
Steinar H. Gunderson [Sat, 15 Mar 2014 02:04:31 +0000 (03:04 +0100)]
Fix a bug where repeated vertical FFTs would reverse the output.

Unfortunately, the tests didn't catch this, as the Repeat test used
an even number of passes (being of size 64), which reversed things
back into place. It now tries a wider range of sizes to make sure
everything is okay.

5 years agoProperly install texture1d.frag, which is needed during init.
Steinar H. Gunderson [Thu, 13 Mar 2014 20:44:15 +0000 (21:44 +0100)]
Properly install texture1d.frag, which is needed during init.

5 years agoProperly install fp16.h.
Steinar H. Gunderson [Thu, 13 Mar 2014 20:41:35 +0000 (21:41 +0100)]
Properly install fp16.h.

5 years agoMore tweaks to the .ld generation.
Steinar H. Gunderson [Wed, 12 Mar 2014 21:48:07 +0000 (22:48 +0100)]
More tweaks to the .ld generation.

5 years agoAdd more unit tests for fp16.
Steinar H. Gunderson [Wed, 12 Mar 2014 00:24:39 +0000 (01:24 +0100)]
Add more unit tests for fp16.

This tests a few edge cases that are not adequately covered by the
random fp32 tests; in particular, the round-to-even logic had
no test coverage, which is bad.

5 years agoMake the COVERAGE variable into an --enable-coverage configure flag.
Steinar H. Gunderson [Wed, 12 Mar 2014 00:24:03 +0000 (01:24 +0100)]
Make the COVERAGE variable into an --enable-coverage configure flag.

This makes a lot more sense, since it controls compilation options.

5 years ago.gitignore lots of libtool stuff.
Steinar H. Gunderson [Tue, 11 Mar 2014 23:55:05 +0000 (00:55 +0100)]
.gitignore lots of libtool stuff.

5 years ago.gitignore more unit tests.
Steinar H. Gunderson [Tue, 11 Mar 2014 23:53:33 +0000 (00:53 +0100)]
.gitignore more unit tests.

5 years agoIgnore .ld files.
Steinar H. Gunderson [Tue, 11 Mar 2014 23:51:26 +0000 (00:51 +0100)]
Ignore .ld files.

5 years agoFix some formatting messups.
Steinar H. Gunderson [Tue, 11 Mar 2014 23:09:16 +0000 (00:09 +0100)]
Fix some formatting messups.

5 years agoAdd a simple luma wipe transition.
Steinar H. Gunderson [Tue, 11 Mar 2014 23:05:28 +0000 (00:05 +0100)]
Add a simple luma wipe transition.

5 years agoSupport GL_R and 16-bit fixed-point textures in FlatInput.
Steinar H. Gunderson [Tue, 11 Mar 2014 20:13:34 +0000 (21:13 +0100)]
Support GL_R and 16-bit fixed-point textures in FlatInput.

The motivating need is that we want GL_R16 textures soon.

5 years agoFix dependencies for .lo files.
Steinar H. Gunderson [Tue, 11 Mar 2014 00:38:05 +0000 (01:38 +0100)]
Fix dependencies for .lo files.

Dependencies were unfortunately de-facto broken after introduction of libtool,
causing much head scratching. Now fixed.

5 years agoAdd an effect for complex multiplication.
Steinar H. Gunderson [Mon, 10 Mar 2014 23:33:58 +0000 (00:33 +0100)]
Add an effect for complex multiplication.

This is another building block to make the FFTs useful.

5 years agoFormalize the notion of messing with sampler state.
Steinar H. Gunderson [Mon, 10 Mar 2014 22:59:28 +0000 (23:59 +0100)]
Formalize the notion of messing with sampler state.

This kills a lot of the assumptions that have been going around,
and should allow us to deal much better with the situation when
we have two or more inputs to an effect (where you basically can't
predict the sampler number used reliably); there's still an edge
case that's documented with a TODO, but this is generally much better.

5 years agoHandle texture non-bounce a bit better.
Steinar H. Gunderson [Mon, 10 Mar 2014 21:09:18 +0000 (22:09 +0100)]
Handle texture non-bounce a bit better.

This allows us to ignore the texture bounce flag when reading from a
FlatInput, and also handles better the case where an YCbCrInput is read
from multiple times (it's now bounced, which should be better for speed,
I think).

The main motivation, however, is to be able to control sampler state
a bit less hackish in the future.

5 years agoAdd support for fp16 and RG textures to FlatInput.
Steinar H. Gunderson [Sun, 9 Mar 2014 22:31:47 +0000 (23:31 +0100)]
Add support for fp16 and RG textures to FlatInput.

5 years agoIgnore libtool files in .gitignore.
Steinar H. Gunderson [Sun, 9 Mar 2014 20:58:41 +0000 (21:58 +0100)]
Ignore libtool files in .gitignore.

5 years agoAdd an effect to do re-slicing of the image, for overlap/discard.
Steinar H. Gunderson [Sun, 9 Mar 2014 20:55:39 +0000 (21:55 +0100)]
Add an effect to do re-slicing of the image, for overlap/discard.

This is another step on the way to making FFT convolutions useful.

5 years agoAdd utility functions for EffectChain to add inputs of different size from the output.
Steinar H. Gunderson [Sun, 9 Mar 2014 20:54:51 +0000 (21:54 +0100)]
Add utility functions for EffectChain to add inputs of different size from the output.

5 years agoDo our own fp16 conversion in ResampleEffect.
Steinar H. Gunderson [Sun, 9 Mar 2014 17:22:18 +0000 (18:22 +0100)]
Do our own fp16 conversion in ResampleEffect.

This not only fixes issues with poor downconversion on ATI, but also
allows us to normalize while being aware of fp16 roundoff issues.
Seems to about cut the error in half in the HeavyResampleGetsSumRight
test, which as far as I can see would take us up to 10-bit accuracy.

5 years agoStore all twiddle factors as fp16.
Steinar H. Gunderson [Sun, 9 Mar 2014 16:41:03 +0000 (17:41 +0100)]
Store all twiddle factors as fp16.

Seemingly this isn't such a big deal after all, especially now that
we have proper fp16 roundoff also on ATI.

5 years agoAdd a utility library for downconverting to fp16.
Steinar H. Gunderson [Sun, 9 Mar 2014 16:24:00 +0000 (17:24 +0100)]
Add a utility library for downconverting to fp16.

ATI's drivers don't do this properly by themselves, so we want to
do it on our side. Adapted from some code I wrote a few years ago.

5 years agoFix the widget display in the demo app.
Steinar H. Gunderson [Sun, 9 Mar 2014 11:36:00 +0000 (12:36 +0100)]
Fix the widget display in the demo app.

The demo app forgot to set a projection matrix, and when Movit itself
stopped setting one, the widget display broke.

5 years agoFix the roundoff test.
Steinar H. Gunderson [Sun, 9 Mar 2014 11:29:47 +0000 (12:29 +0100)]
Fix the roundoff test.

The wrong texture coordinates snuck in here when changing from fixed function.

5 years agoStop using 1D textures.
Steinar H. Gunderson [Sun, 9 Mar 2014 00:42:27 +0000 (01:42 +0100)]
Stop using 1D textures.

1D textures were never part of GLES, so use 2D textures with Nx1 instead.
Supposedly they are just as fast (although it feels a bit less elegant).

5 years agoRemove GL_LUMINANCE in more places.
Steinar H. Gunderson [Sat, 8 Mar 2014 23:41:38 +0000 (00:41 +0100)]
Remove GL_LUMINANCE in more places.

Causes problems with GL 3.2+ core contexts. Found by testing on ATI.

5 years agoUse the GL_RED texture format instead of GL_LUMINANCE.
Steinar H. Gunderson [Sat, 8 Mar 2014 21:13:59 +0000 (22:13 +0100)]
Use the GL_RED texture format instead of GL_LUMINANCE.

Seemingly GL_LUMINANCE is also deprecated; this actually decreases
support for GLES2 somewhat, but we need GLES3 anyway, so the net
loss shouldn't be too bad.

5 years agoUse triangle strips instead of quads.
Steinar H. Gunderson [Sat, 8 Mar 2014 20:44:43 +0000 (21:44 +0100)]
Use triangle strips instead of quads.

GL_QUADS is deprecated, seemingly, so rearrange things a bit so that
they become small triangle strips instead.

5 years agoUse VAOs to bind the VBOs.
Steinar H. Gunderson [Sat, 8 Mar 2014 20:35:29 +0000 (21:35 +0100)]
Use VAOs to bind the VBOs.

Needed for OpenGL 3.2+ core context support. Also refactor a bit,
since the amount of boilerplate was getting over the top.

5 years agoMake the initializing functions also drop fixed function usage.
Steinar H. Gunderson [Sat, 8 Mar 2014 17:37:25 +0000 (18:37 +0100)]
Make the initializing functions also drop fixed function usage.

5 years agoUse GLSL 1.30-style attributes for the main shader.
Steinar H. Gunderson [Sat, 8 Mar 2014 17:33:17 +0000 (18:33 +0100)]
Use GLSL 1.30-style attributes for the main shader.

This is in preparation for removing fixed-function use altogether,
for OpenGL 3.2+ core context support.

5 years agoCheck GLSL program link status, for better error reporting.
Steinar H. Gunderson [Sat, 8 Mar 2014 16:18:35 +0000 (17:18 +0100)]
Check GLSL program link status, for better error reporting.

5 years agoUse abort() on check_error() failure.
Steinar H. Gunderson [Sat, 8 Mar 2014 20:57:04 +0000 (21:57 +0100)]
Use abort() on check_error() failure.

This makes it much easier to trace them down in a debugger.

6 years agoFix a typo.
Steinar H. Gunderson [Wed, 12 Feb 2014 01:15:25 +0000 (02:15 +0100)]
Fix a typo.

6 years agoMove everything into “namespace movit”.
Steinar H. Gunderson [Wed, 12 Feb 2014 01:04:19 +0000 (02:04 +0100)]
Move everything into “namespace movit”.

This is a pretty hard API break, but it's probably the last big API
break before 1.0, and some of the names (e.g. Effect, Input ResourcePool)
are really so generic that they should not be allowed to pollute the global

6 years agoMake init_movit() return a true/false error value.
Steinar H. Gunderson [Wed, 12 Feb 2014 00:44:42 +0000 (01:44 +0100)]
Make init_movit() return a true/false error value.

This allows clients to programmatically enable/disable Movit usage
as needed on very old platforms.

6 years agoMake a pow() call unambiguous.
Steinar H. Gunderson [Mon, 27 Jan 2014 22:04:44 +0000 (23:04 +0100)]
Make a pow() call unambiguous.

6 years agoRemove the finalize() member function from Input.
Steinar H. Gunderson [Sun, 26 Jan 2014 23:44:44 +0000 (00:44 +0100)]
Remove the finalize() member function from Input.

It is no longer needed now that the texture is not created once,
but rather fetched on-demand from the ResourcePool.

6 years agoSend shader compile log to stderr instead of stdout.
Steinar H. Gunderson [Sun, 26 Jan 2014 23:04:36 +0000 (00:04 +0100)]
Send shader compile log to stderr instead of stdout.

Reported by Dan Dennedy.

6 years agoExplicitly declare use of round() as an #extension.
Steinar H. Gunderson [Sun, 26 Jan 2014 23:03:36 +0000 (00:03 +0100)]
Explicitly declare use of round() as an #extension.

round() is not part of GLSL 1.10, so we need to check explicitly for it
before we can use it.

Reported by Dan Dennedy.

6 years agoIn EffectChainTest, do not re-call init_movit()
Steinar H. Gunderson [Sun, 26 Jan 2014 01:44:17 +0000 (02:44 +0100)]
In EffectChainTest, do not re-call init_movit()

Seemingly this causes problems on ATI, for unknown reasons.
In any case, just flipping the debug level is much easier.

6 years agoMake the ResampleEffect accuracy test stricter.
Steinar H. Gunderson [Sat, 25 Jan 2014 18:43:29 +0000 (19:43 +0100)]
Make the ResampleEffect accuracy test stricter.

First, make sure we test one individual pass, and that we test it in
fp32. Second, set a limit that's actually grounded in something real,
not just a pretty power of 10.

6 years agoNormalize the resample weight after bilinear combining.
Steinar H. Gunderson [Sat, 25 Jan 2014 18:41:40 +0000 (19:41 +0100)]
Normalize the resample weight after bilinear combining.

We introduce a small bit of error in the combining (due to having to
compensate for lack of subpixel sampling precision), so normalize
after it rather than before it. Also, do a second normalization pass,
which seemingly helps sometimes (probably due to inaccuracies in the
float sum).

This seems to kill about half the precision loss on Intel, at least.

6 years agoDon't dither alpha.
Steinar H. Gunderson [Sat, 25 Jan 2014 12:57:41 +0000 (13:57 +0100)]
Don't dither alpha.

For alpha, correct rounding is more important to us than overall
spectral properties, simply because 255 -> 255 is such an important

6 years agoRescale resampling weights so that the sum becomes one.
Steinar H. Gunderson [Sat, 25 Jan 2014 11:42:56 +0000 (12:42 +0100)]
Rescale resampling weights so that the sum becomes one.

For some reason, I had forgotten this, and it showed up because Qt
has buggy handling of pixels with alpha != 0xff. Add unit test
so it doesn't happen again.

I'm a bit concerned that rounding might cause problems so that we
should perhaps renormalize after the bilinear conversion, but we
can deal with that later if it should show up.

6 years agoRemove sandbox_effect from coverage.
Steinar H. Gunderson [Thu, 23 Jan 2014 01:20:23 +0000 (02:20 +0100)]
Remove sandbox_effect from coverage.

6 years agoAnother round of include-what-you-use.
Steinar H. Gunderson [Thu, 23 Jan 2014 01:13:27 +0000 (02:13 +0100)]
Another round of include-what-you-use.

6 years agoSet an explicit C++ tag on libtool, to ease compiling with Clang.
Steinar H. Gunderson [Thu, 23 Jan 2014 01:00:44 +0000 (02:00 +0100)]
Set an explicit C++ tag on libtool, to ease compiling with Clang.

6 years agoAdd SHELL override from autoconf, since otherwise libtool might break on systems...
Steinar H. Gunderson [Thu, 23 Jan 2014 00:50:33 +0000 (01:50 +0100)]
Add SHELL override from autoconf, since otherwise libtool might break on systems with dash.

6 years agoMove to 'using namespace std;' in all .cpp files.
Steinar H. Gunderson [Thu, 23 Jan 2014 00:35:34 +0000 (01:35 +0100)]
Move to 'using namespace std;' in all .cpp files.

There's no intrinsic value to writing std:: over and over again.
We keep it in the .h file, of course, in order not to pollute
clients' namespaces.

6 years agoTweak the exclusion rules for coverage computation a bit.
Steinar H. Gunderson [Thu, 23 Jan 2014 00:03:30 +0000 (01:03 +0100)]
Tweak the exclusion rules for coverage computation a bit.

6 years agoAdd a unit test for VignetteEffect, and fix two bugs.
Steinar H. Gunderson [Wed, 22 Jan 2014 23:43:58 +0000 (00:43 +0100)]
Add a unit test for VignetteEffect, and fix two bugs.

As usual, adding unit tests uncovers bugs (although one was known
in this case):

 - Make VignetteEffect work with any aspect, not only 16:9 (known).
 - Make sure (0,0) is upper-left for center, not lower-left as in

6 years agoAdd a unit test for EffectChain without shared ResourcePool.
Steinar H. Gunderson [Wed, 22 Jan 2014 21:48:40 +0000 (22:48 +0100)]
Add a unit test for EffectChain without shared ResourcePool.

Also tests debug output; just that it doesn't crash, but that's nice
in itself. This code was seeing a bit scary low coverage after some
test changes.

6 years agoUnbreak demo build (it was broken due to a typo).
Steinar H. Gunderson [Wed, 22 Jan 2014 20:04:44 +0000 (21:04 +0100)]
Unbreak demo build (it was broken due to a typo).

6 years agoSome tweaks to the libtool parts of the Makefile.
Steinar H. Gunderson [Wed, 22 Jan 2014 09:39:47 +0000 (10:39 +0100)]
Some tweaks to the libtool parts of the Makefile.

We don't need to build all the non-lib files (especially the unit tests)
using libtool, so save some CPU time there. Also, unbreak coverage builds.

6 years agoUse the libtool autoconf macros.
Steinar H. Gunderson [Wed, 22 Jan 2014 00:59:10 +0000 (01:59 +0100)]
Use the libtool autoconf macros.

6 years agoUse libtool for building libraries and binaries.
Steinar H. Gunderson [Wed, 22 Jan 2014 00:16:18 +0000 (01:16 +0100)]
Use libtool for building libraries and binaries.

This means we get a shared library built, which should make building
in MLT a lot easier.

Note that Movit still does not export a stable ABI! This is reflected
in that the version number is still 0.0.0 and does not change between

6 years agoFix mis-feeing in the ResourcePool destructor.
Steinar H. Gunderson [Tue, 21 Jan 2014 22:58:11 +0000 (23:58 +0100)]
Fix mis-feeing in the ResourcePool destructor.

6 years agoMake FlatInput and YCbCrInput release the texture to the pool on invalidate_pixel_data().
Steinar H. Gunderson [Tue, 21 Jan 2014 22:09:59 +0000 (23:09 +0100)]
Make FlatInput and YCbCrInput release the texture to the pool on invalidate_pixel_data().

6 years agoUse the ResourcePool to allocate RTT textures in EffectChain.
Steinar H. Gunderson [Tue, 21 Jan 2014 22:02:22 +0000 (23:02 +0100)]
Use the ResourcePool to allocate RTT textures in EffectChain.

6 years agoImplement the texture freelist in ResourcePool.
Steinar H. Gunderson [Tue, 21 Jan 2014 21:26:12 +0000 (22:26 +0100)]
Implement the texture freelist in ResourcePool.

6 years agoAdd missing format LUMINANCE8.
Steinar H. Gunderson [Tue, 21 Jan 2014 20:41:57 +0000 (21:41 +0100)]
Add missing format LUMINANCE8.

6 years agoFix YCbCrInput after the ResourcePool texture changes.
Steinar H. Gunderson [Tue, 21 Jan 2014 20:39:09 +0000 (21:39 +0100)]
Fix YCbCrInput after the ResourcePool texture changes.

6 years agoComplete a forgotten comment.
Steinar H. Gunderson [Tue, 21 Jan 2014 20:01:25 +0000 (21:01 +0100)]
Complete a forgotten comment.

6 years agoAdd support to the ResourcePool for 2D textures.
Steinar H. Gunderson [Tue, 21 Jan 2014 19:42:34 +0000 (20:42 +0100)]
Add support to the ResourcePool for 2D textures.

Currently we don't have a freelist, but this will change shortly.

6 years agoRetire the GL_GENERATE_MIPMAP hack for FlatInput.
Steinar H. Gunderson [Mon, 20 Jan 2014 23:56:27 +0000 (00:56 +0100)]
Retire the GL_GENERATE_MIPMAP hack for FlatInput.

I found very similar workaround code for this bug in Chromium,
with the following comment:

  // Workaround for Mac driver bug. In the large scheme of things setting
  // glTexParamter twice for glGenerateMipmap is probably not a lage performance
  // hit so there's probably no need to make this conditional. The bug appears
  // to be that if the filtering mode is set to something that doesn't require
  // mipmaps for rendering, or is never set to something other than the default,
  // then glGenerateMipmap misbehaves.

Going back all the way to the point in which this code was written,
it is indeed true; we called glGenerateMipmap(), and then right afterwards
set the mode to GL_LINEAR_MIPMAP_NEAREST. Since then, the code has been
reorganized and moved around a lot, and now we set the mode long before
the first call to glGenerateMipmap(), and thus we can retire the hack;
simply generate mipmaps on-demand, and that's the end of it. I tested
with the Mesa 8.0.x version where I originally saw this bug, and it passes
flat_input_test without any problems (well, actually all tests except
the tests for deconvolution sharpen, whose shaders are too big for it).

This is nice not only because it gives us a less hacky structure, but also
because GL_GENERATE_MIPMAPS is a nightmare for the driver to handle;
several edge conditions are tricky, from what I've been told.

6 years agoDisable OpenGL dithering, just to be on the safe side.
Steinar H. Gunderson [Sun, 19 Jan 2014 22:54:49 +0000 (23:54 +0100)]
Disable OpenGL dithering, just to be on the safe side.

I don't actually think any modern OpenGL implementations actually
heed this flag for 8-bit rendering, but it's fine to be on the safe
side nevertheless.

6 years agoRound explicitly after dithering, for GPUs that don't do it properly themselves.
Steinar H. Gunderson [Sun, 19 Jan 2014 22:53:18 +0000 (23:53 +0100)]
Round explicitly after dithering, for GPUs that don't do it properly themselves.

This was causing unit test failures in the DitherEffect unit test both on
ATI and nVidia GPUs; Intel also rounds somewhat inaccurately, but much,
much better, so the extra code won't be activated for them.

I think this might be driver-dependent, but we will detect it correctly
in any case.

6 years agoStore GL_FLOAT FlatInputs as fp32, not fp16.
Steinar H. Gunderson [Sun, 19 Jan 2014 19:42:22 +0000 (20:42 +0100)]
Store GL_FLOAT FlatInputs as fp32, not fp16.

There are two primary reasons for this:

 - GL_FLOAT FlatInput is primarily used for tests, and even more importantly,
   mostly accuracy tests. ATI's drivers appear to round off fp32 -> fp16
   wrong (truncate instead of round), which breaks some of these tests.
 - In case someone _would_ use GL_FLOAT inputs, they'd probably be updated
   every frame anyway, so the fp32 -> fp16 conversion step (probably on CPU)
   will negate any performance benefits by fp16 sampling anyway.

6 years agoTurn off .dot and .frag file generation during unit tests.
Steinar H. Gunderson [Sun, 19 Jan 2014 17:41:21 +0000 (18:41 +0100)]
Turn off .dot and .frag file generation during unit tests.

Even though this is sometimes useful in the effect_chain_test,
this makes the test suite literally five times as fast on my
machine due to all the disk I/O. We can always turn it on again
when debugging specific issues.

6 years agoAdd a new effect that can do FFT/IFFT.
Steinar H. Gunderson [Sun, 19 Jan 2014 17:27:55 +0000 (18:27 +0100)]
Add a new effect that can do FFT/IFFT.

6 years agoWe need to link the main library against pthreads now, since we lock in ResourcePool.
Steinar H. Gunderson [Sun, 19 Jan 2014 16:46:26 +0000 (17:46 +0100)]
We need to link the main library against pthreads now, since we lock in ResourcePool.

6 years agoMake effect_id phase-local instead of global.
Steinar H. Gunderson [Sat, 18 Jan 2014 21:07:29 +0000 (22:07 +0100)]
Make effect_id phase-local instead of global.

This is mainly to reduce the number of substantially identical shaders
we have to keep around and compile; even though two chains may be
different, often, some phase (and very often, a large one at that)
will be similar. However, in the old system, since effects had global
IDs, a change in an earlier phase would displace identifiers in a
later one, and the shader would be uncacheable.

Note that this means that an effect can actually have multiple effect_ids
now (since it could already be part of multiple phases). This is the
reason why we can't just keep having a single effect_id on the node
that we set phase-locally; it really needs to be different between phases.

6 years agoAdd a shared ResourcePool to share resources between EffectChains.
Steinar H. Gunderson [Fri, 17 Jan 2014 21:25:12 +0000 (22:25 +0100)]
Add a shared ResourcePool to share resources between EffectChains.

Right now in this first implementation, we only share shaders,
which mainly saves compile time when multiple EffectChains are
similar (e.g., many clips all are modified by white balance only).
However, in the future, the plan is for them to also be able to
share temporary textures.