// Convert premultiplied alpha to postmultiplied alpha, simply by multiplying.
+#include <string>
+
#include "effect.h"
class AlphaDivisionEffect : public Effect {
// Unit tests for AlphaDivisionEffect.
-#include "test_util.h"
+#include <GL/glew.h>
#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
TEST(AlphaDivisionEffectTest, SimpleTest) {
const int size = 2;
// Convert postmultiplied alpha to premultiplied alpha, simply by multiplying.
+#include <string>
+
#include "effect.h"
class AlphaMultiplicationEffect : public Effect {
// Unit tests for AlphaMultiplicationEffect.
-#include "test_util.h"
+#include <GL/glew.h>
+
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
TEST(AlphaMultiplicationEffectTest, SimpleTest) {
const int size = 3;
-#include <math.h>
-#include <assert.h>
#include <GL/glew.h>
+#include <assert.h>
+#include <math.h>
+#include <algorithm>
#include "blur_effect.h"
#include "effect_chain.h"
// which is what the user is intended to use, instantiates two copies of
// SingleBlurPassEffect behind the scenes).
+#include <GL/glew.h>
+#include <assert.h>
+#include <stddef.h>
+#include <string>
+
#include "effect.h"
+class EffectChain;
+class Node;
class SingleBlurPassEffect;
class BlurEffect : public Effect {
// Unit tests for BlurEffect.
#include <math.h>
+#include <string.h>
-#include "test_util.h"
-#include "gtest/gtest.h"
#include "blur_effect.h"
+#include "effect_chain.h"
+#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
TEST(BlurEffectTest, IdentityTransformDoesNothing) {
const int size = 4;
#include <assert.h>
-
+#include <Eigen/Core>
#include <Eigen/LU>
#include "colorspace_conversion_effect.h"
-#include "util.h"
#include "d65.h"
+#include "util.h"
using namespace Eigen;
// We don't do any fancy gamut mapping or similar; colors that are out-of-gamut
// will simply stay out-of-gamut, and probably clip in the output stage.
+#include <string>
+
#include "effect.h"
#include "effect_chain.h"
+#include "image_format.h"
class ColorspaceConversionEffect : public Effect {
private:
// Unit tests for ColorspaceConversionEffect.
-#include "test_util.h"
-#include "gtest/gtest.h"
+#include <GL/glew.h>
+
#include "colorspace_conversion_effect.h"
+#include "gtest/gtest.h"
+#include "test_util.h"
TEST(ColorspaceConversionEffectTest, Reversible) {
float data[] = {
// Since all of our signals are symmetrical, discrete correlation and convolution
// is the same operation, and so we won't make a difference in notation.
-
-#include <math.h>
-#include <assert.h>
-#include <GL/glew.h>
#include <Eigen/Dense>
#include <Eigen/Cholesky>
+#include <GL/glew.h>
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <algorithm>
+#include <new>
#include "deconvolution_sharpen_effect.h"
#include "util.h"
//
// Jain, Anil K.: “Fundamentals of Digital Image Processing”, Prentice Hall, 1988.
-#include "effect.h"
-
+#include <GL/glew.h>
#include <Eigen/Dense>
+#include <string>
+
+#include "effect.h"
class DeconvolutionSharpenEffect : public Effect {
public:
// Unit tests for DeconvolutionSharpenEffect.
-#include "test_util.h"
-#include "gtest/gtest.h"
+#include <math.h>
+#include <stdlib.h>
+
#include "deconvolution_sharpen_effect.h"
+#include "effect_chain.h"
+#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
TEST(DeconvolutionSharpenEffectTest, IdentityTransformDoesNothing) {
const int size = 4;
#define WIDTH 1280
#define HEIGHT 720
-#include <string.h>
-#include <math.h>
-#include <time.h>
-#include <sys/time.h>
-#include <assert.h>
-
-#include <string>
-#include <vector>
-#include <map>
-
#include <GL/glew.h>
-
#include <SDL/SDL.h>
-#include <SDL/SDL_opengl.h>
+#include <SDL/SDL_error.h>
+#include <SDL/SDL_events.h>
#include <SDL/SDL_image.h>
+#include <SDL/SDL_keyboard.h>
+#include <SDL/SDL_keysym.h>
+#include <SDL/SDL_mouse.h>
+#include <SDL/SDL_video.h>
+#include <assert.h>
+#include <features.h>
+#include <math.h>
#include <png.h>
+#include <pngconf.h>
+#include <setjmp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <time.h>
-#include "init.h"
+#include "diffusion_effect.h"
#include "effect.h"
#include "effect_chain.h"
-#include "util.h"
-#include "widgets.h"
-
#include "flat_input.h"
+#include "image_format.h"
+#include "init.h"
#include "lift_gamma_gain_effect.h"
#include "saturation_effect.h"
-#include "diffusion_effect.h"
+#include "util.h"
+#include "widgets.h"
unsigned char result[WIDTH * HEIGHT * 4];
-#include <math.h>
#include <assert.h>
+#include <vector>
-#include "diffusion_effect.h"
#include "blur_effect.h"
+#include "diffusion_effect.h"
#include "effect_chain.h"
#include "util.h"
// where we first blur the picture, and then overlay it on the original
// using the original as a matte.
+#include <GL/glew.h>
+#include <assert.h>
+#include <string>
+
#include "effect.h"
class BlurEffect;
+class EffectChain;
+class Node;
class OverlayMatteEffect;
class DiffusionEffect : public Effect {
// Unit tests for DiffusionEffect.
-#include "test_util.h"
-#include "gtest/gtest.h"
#include "diffusion_effect.h"
+#include "effect_chain.h"
+#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
TEST(DiffusionEffectTest, IdentityTransformDoesNothing) {
const int size = 4;
-#include <math.h>
-#include <assert.h>
#include <GL/glew.h>
+#include <assert.h>
+#include <algorithm>
#include "dither_effect.h"
#include "util.h"
// like many LCD monitors do, but it starts to get very hairy, again, for limited gains.)
// The dither is also deterministic across runs.
+#include <GL/glew.h>
+#include <string>
+
#include "effect.h"
class DitherEffect : public Effect {
// Unit tests for DitherEffect.
+#include <GL/glew.h>
#include <math.h>
-#include "test_util.h"
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
TEST(DitherEffectTest, NoDitherOnExactValues) {
const int size = 4;
+#include <Eigen/Core>
+#include <GL/glew.h>
+#include <assert.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
-#include <GL/glew.h>
+#include <utility>
#include "effect.h"
-#include "effect_chain.h"
#include "util.h"
GLint get_uniform_location(GLuint glsl_program_num, const std::string &prefix, const std::string &key)
// effect instance; use the macro PREFIX() around your identifiers to
// automatically prepend that prefix.
+#include <GL/glew.h>
+#include <assert.h>
+#include <stddef.h>
+#include <Eigen/Core>
#include <map>
#include <string>
#include <vector>
-#include <assert.h>
-
-#include <Eigen/Core>
-
-#include <GL/glew.h>
#include "util.h"
class EffectChain;
#define GL_GLEXT_PROTOTYPES 1
-#include <stdio.h>
+#include <GL/glew.h>
+#include <assert.h>
+#include <locale.h>
#include <math.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <locale.h>
-#include <assert.h>
-#include <GL/glew.h>
-
#include <algorithm>
#include <set>
#include <stack>
#include <vector>
-#include "util.h"
-#include "effect_chain.h"
-#include "gamma_expansion_effect.h"
-#include "gamma_compression_effect.h"
-#include "colorspace_conversion_effect.h"
-#include "alpha_multiplication_effect.h"
#include "alpha_division_effect.h"
+#include "alpha_multiplication_effect.h"
+#include "colorspace_conversion_effect.h"
#include "dither_effect.h"
-#include "input.h"
+#include "effect.h"
+#include "effect_chain.h"
+#include "gamma_compression_effect.h"
+#include "gamma_expansion_effect.h"
#include "init.h"
+#include "input.h"
+#include "util.h"
EffectChain::EffectChain(float aspect_nom, float aspect_denom)
: aspect_nom(aspect_nom),
#ifndef _EFFECT_CHAIN_H
#define _EFFECT_CHAIN_H 1
+#include <GL/glew.h>
+#include <stdio.h>
+#include <map>
#include <set>
+#include <string>
#include <vector>
#include "effect.h"
#include "image_format.h"
#include "input.h"
+class Effect;
class EffectChain;
+class Input;
struct Phase;
// For internal use within Node.
// Note that this also contains the tests for some of the simpler effects.
#include <GL/glew.h>
+#include <assert.h>
+#include <stddef.h>
+#include "effect.h"
#include "effect_chain.h"
#include "flat_input.h"
#include "gtest/gtest.h"
+#include "input.h"
#include "mirror_effect.h"
#include "resize_effect.h"
#include "test_util.h"
+#include "util.h"
TEST(EffectChainTest, EmptyChain) {
float data[] = {
#ifndef _FLAT_INPUT_H
#define _FLAT_INPUT_H 1
+#include <GL/glew.h>
#include <assert.h>
+#include <string>
-#include "input.h"
+#include "effect.h"
+#include "image_format.h"
#include "init.h"
+#include "input.h"
// A FlatInput is the normal, “classic” case of an input, where everything
// comes from a single 2D array with chunky pixels.
// Unit tests for FlatInput.
-#include "test_util.h"
-#include "gtest/gtest.h"
+#include <stddef.h>
+
+#include "effect_chain.h"
#include "flat_input.h"
+#include "gtest/gtest.h"
+#include "test_util.h"
TEST(FlatInput, SimpleGrayscale) {
const int size = 4;
//
// Currently supports sRGB and Rec. 601/709.
+#include <string>
+
#include "effect.h"
#include "effect_chain.h"
+#include "image_format.h"
#define COMPRESSION_CURVE_SIZE 4096
// Pretty much the inverse of the GammaExpansionEffect tests;
// EffectChainTest tests that they are actually inverses.
-#include "test_util.h"
+#include <GL/glew.h>
#include "gtest/gtest.h"
-#include "gamma_expansion_effect.h"
+#include "image_format.h"
+#include "test_util.h"
TEST(GammaCompressionEffectTest, sRGB_KeyValues) {
float data[] = {
//
// Currently supports sRGB and Rec. 601/709.
+#include <string>
+
#include "effect.h"
#include "effect_chain.h"
+#include "image_format.h"
#define EXPANSION_CURVE_SIZE 256
// Unit tests for GammaExpansionEffect.
-#include "test_util.h"
-#include "gtest/gtest.h"
+#include <GL/glew.h>
+
#include "gamma_expansion_effect.h"
+#include "gtest/gtest.h"
+#include "test_util.h"
TEST(GammaExpansionEffectTest, sRGB_KeyValues) {
float data[] = {
-#include <math.h>
#include <assert.h>
+#include <vector>
-#include "glow_effect.h"
#include "blur_effect.h"
-#include "mix_effect.h"
#include "effect_chain.h"
+#include "glow_effect.h"
+#include "mix_effect.h"
#include "util.h"
GlowEffect::GlowEffect()
// Glow: Cut out the highlights of the image (everything above a certain threshold),
// blur them, and overlay them onto the original image.
+#include <GL/glew.h>
+#include <assert.h>
+#include <string>
+
#include "effect.h"
class BlurEffect;
-class MixEffect;
+class EffectChain;
class HighlightCutoffEffect;
+class MixEffect;
+class Node;
class GlowEffect : public Effect {
public:
#include <math.h>
-#include "test_util.h"
-#include "gtest/gtest.h"
+#include "effect_chain.h"
#include "glow_effect.h"
+#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
TEST(GlowEffectTest, NoAmountDoesNothing) {
const int size = 4;
#define GTEST_HAS_EXCEPTIONS 0
#include <SDL/SDL.h>
+#include <SDL/SDL_error.h>
+#include <SDL/SDL_video.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "gtest/gtest.h"
int main(int argc, char **argv) {
#include <GL/glew.h>
+#include <assert.h>
+#include <stddef.h>
+#include <algorithm>
#include <string>
#include "init.h"
-#include <math.h>
#include <GL/glew.h>
+#include <math.h>
#include "lift_gamma_gain_effect.h"
#include "util.h"
// Also, gamma is a case where we would not want premultiplied alpha.
// Thus, we have to divide away alpha first, and then re-multiply it back later.
+#include <GL/glew.h>
+#include <string>
+
#include "effect.h"
class LiftGammaGainEffect : public Effect {
// Unit tests for LiftGammaGainEffect.
-#include "test_util.h"
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "image_format.h"
#include "lift_gamma_gain_effect.h"
+#include "test_util.h"
TEST(LiftGammaGainEffectTest, DefaultIsNoop) {
float data[] = {
// A simple horizontal mirroring.
+#include <string>
+
#include "effect.h"
class MirrorEffect : public Effect {
// Combine two images: a*x + b*y. If you set a within [0,1] and b=1-a,
// you will get a fade; if not, you may get surprising results (consider alpha).
+#include <string>
+
#include "effect.h"
class MixEffect : public Effect {
// Unit tests for MixEffect.
-#include "test_util.h"
+#include <GL/glew.h>
+
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "image_format.h"
+#include "input.h"
#include "mix_effect.h"
+#include "test_util.h"
TEST(MixEffectTest, FiftyFiftyMix) {
float data_a[] = {
//
// The first input is the bottom, and the second is the top.
+#include <string>
+
#include "effect.h"
class OverlayEffect : public Effect {
// Unit tests for OverlayEffect.
-#include "test_util.h"
+#include <GL/glew.h>
+
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "image_format.h"
+#include "input.h"
#include "overlay_effect.h"
+#include "test_util.h"
TEST(OverlayEffectTest, TopDominatesBottomWhenNoAlpha) {
float data_a[] = {
-#include <math.h>
#include <GL/glew.h>
+#include <assert.h>
#include "padding_effect.h"
#include "util.h"
// You may not change it after calling finalize(), since that could change the
// graph (need_linear_light() etc. depend on the border color you choose).
+#include <GL/glew.h>
+#include <string>
+
#include "effect.h"
class PaddingEffect : public Effect {
// Unit tests for AlphaMultiplicationEffect.
-#include "test_util.h"
+#include <stddef.h>
+
+#include "effect_chain.h"
#include "flat_input.h"
-#include "padding_effect.h"
#include "gtest/gtest.h"
+#include "image_format.h"
+#include "padding_effect.h"
+#include "test_util.h"
+#include "util.h"
TEST(PaddingEffectTest, SimpleCenter) {
float data[2 * 2] = {
// Three-lobed Lanczos, the most common choice.
#define LANCZOS_RADIUS 3.0
-#include <math.h>
-#include <assert.h>
#include <GL/glew.h>
+#include <assert.h>
+#include <limits.h>
+#include <math.h>
+#include <stdio.h>
+#include <algorithm>
-#include "resample_effect.h"
#include "effect_chain.h"
+#include "resample_effect.h"
#include "util.h"
namespace {
// which is what the user is intended to use, instantiates two copies of
// SingleResamplePassEffect behind the scenes).
+#include <GL/glew.h>
+#include <assert.h>
+#include <stddef.h>
+#include <string>
+
#include "effect.h"
+class EffectChain;
+class Node;
class SingleResamplePassEffect;
class ResampleEffect : public Effect {
// Unit tests for ResampleEffect.
-#include "test_util.h"
+#include <math.h>
+#include <iomanip>
+
+#include "effect_chain.h"
+#include "flat_input.h"
#include "gtest/gtest.h"
+#include "image_format.h"
#include "resample_effect.h"
-#include "flat_input.h"
+#include "test_util.h"
namespace {
// (set by the two integer parameters "width" and "height").
// Mostly useful as part of other algorithms.
+#include <string>
+
#include "effect.h"
class ResizeEffect : public Effect {
-#include <math.h>
-#include <assert.h>
#include <GL/glew.h>
#include "sandbox_effect.h"
// throwaway code. When you're happy, you can do a bit of search and replace
// to give it a proper name and its own place in the build system.
+#include <GL/glew.h>
+#include <string>
+
#include "effect.h"
class SandboxEffect : public Effect {
// (saturation=1). Extrapolating that curve further (ie., saturation > 1)
// gives us increased saturation if so desired.
+#include <string>
+
#include "effect.h"
class SaturationEffect : public Effect {
// Unit tests for SaturationEffect.
-#include "test_util.h"
+#include <GL/glew.h>
+
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "image_format.h"
#include "saturation_effect.h"
+#include "test_util.h"
TEST(SaturationEffectTest, SaturationOneIsPassThrough) {
float data[] = {
-#include "init.h"
-#include "test_util.h"
+#include <assert.h>
+#include <gtest/gtest-message.h>
+#include <math.h>
+#include <stdio.h>
+#include <algorithm>
+#include <ostream>
+
#include "flat_input.h"
#include "gtest/gtest.h"
+#include "init.h"
+#include "test_util.h"
+#include "util.h"
-#include <stdio.h>
-#include <math.h>
-
-#include <algorithm>
+class Input;
namespace {
#ifndef _TEST_UTIL_H
#define _TEST_UTIL_H 1
+#include <GL/glew.h>
#include "effect_chain.h"
+#include "image_format.h"
+
+class Input;
class EffectChainTester {
public:
-#include <math.h>
#include <assert.h>
+#include <vector>
-#include "unsharp_mask_effect.h"
#include "blur_effect.h"
-#include "mix_effect.h"
#include "effect_chain.h"
+#include "mix_effect.h"
+#include "unsharp_mask_effect.h"
#include "util.h"
UnsharpMaskEffect::UnsharpMaskEffect()
// See DeconvolutionSharpenEffect for a different, possibly better
// sharpening algorithm.
+#include <GL/glew.h>
+#include <assert.h>
+#include <string>
+
#include "effect.h"
class BlurEffect;
+class EffectChain;
class MixEffect;
+class Node;
class UnsharpMaskEffect : public Effect {
public:
#include <math.h>
-#include "test_util.h"
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
#include "unsharp_mask_effect.h"
TEST(UnsharpMaskEffectTest, NoAmountDoesNothing) {
-#include <stdio.h>
+#include <GL/glew.h>
+#include <assert.h>
#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <assert.h>
-#include <GL/glew.h>
+#include <Eigen/Core>
-#include "util.h"
#include "init.h"
+#include "util.h"
extern std::string *movit_data_directory;
// Various utilities.
+#include <GL/glew.h>
#include <stdio.h>
#include <stdlib.h>
-
-#include <string>
#include <Eigen/Core>
-
-#include <GL/glew.h>
+#include <string>
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
-#include <math.h>
#include <GL/glew.h>
+#include <math.h>
#include "vignette_effect.h"
#include "util.h"
// A circular vignette, falling off as cos² of the distance from the center
// (the classic formula for approximating a real lens).
+#include <GL/glew.h>
+#include <string>
+
#include "effect.h"
class VignetteEffect : public Effect {
-#include <math.h>
-#include <assert.h>
-#include <GL/glew.h>
-
+#include <Eigen/Core>
#include <Eigen/LU>
+#include <GL/glew.h>
+#include <assert.h>
-#include "white_balance_effect.h"
-#include "util.h"
#include "d65.h"
+#include "util.h"
+#include "white_balance_effect.h"
using namespace Eigen;
// Color correction in LMS color space.
+#include <GL/glew.h>
+#include <string>
+
#include "effect.h"
class WhiteBalanceEffect : public Effect {
// Unit tests for WhiteBalanceEffect.
-#include "test_util.h"
+#include <iomanip>
+
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
#include "white_balance_effect.h"
TEST(WhiteBalanceEffectTest, GrayNeutralDoesNothing) {
-#include <math.h>
#include <GL/glew.h>
+#include <math.h>
#include "widgets.h"
#include "util.h"
-#include <string.h>
-#include <assert.h>
-#include <GL/glew.h>
-
+#include <Eigen/Core>
#include <Eigen/LU>
+#include <GL/glew.h>
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
-#include "ycbcr_input.h"
#include "util.h"
+#include "ycbcr_input.h"
using namespace Eigen;
// imprecisely, called “YUV”), which is typically what you get from a video decoder.
// It upsamples planes as needed, using the default linear upsampling OpenGL gives you.
+#include <GL/glew.h>
+#include <assert.h>
+#include <string>
+
+#include "effect.h"
+#include "image_format.h"
#include "input.h"
struct YCbCrFormat {
// Unit tests for YCbCrInput.
// FIXME: This class really ought to support mipmaps.
-#include "test_util.h"
+#include <stddef.h>
+
+#include "effect_chain.h"
#include "gtest/gtest.h"
+#include "test_util.h"
#include "ycbcr_input.h"
TEST(YCbCrInput, Simple444) {