Assuming you have an OpenGL context already set up:
<code>
+ using namespace movit;
EffectChain chain(1280, 720);
ImageFormat inout_format;
using namespace std;
+namespace movit {
+
string AlphaDivisionEffect::output_fragment_shader()
{
return read_file("alpha_division_effect.frag");
}
+
+} // namespace
#include "effect.h"
+namespace movit {
+
class AlphaDivisionEffect : public Effect {
public:
AlphaDivisionEffect() {}
std::string output_fragment_shader();
};
+} // namespace movit
+
#endif // !defined(_MOVIT_ALPHA_DIVISION_EFFECT_H)
#include "image_format.h"
#include "test_util.h"
+namespace movit {
+
TEST(AlphaDivisionEffectTest, SimpleTest) {
const int size = 2;
float data[4 * size] = {
EXPECT_EQ(0.0f, out_data[3]);
EXPECT_EQ(0.0f, out_data[7]);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
string AlphaMultiplicationEffect::output_fragment_shader()
{
return read_file("alpha_multiplication_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class AlphaMultiplicationEffect : public Effect {
public:
AlphaMultiplicationEffect() {}
std::string output_fragment_shader();
};
+} // namespace movit
+
#endif // !defined(_MOVIT_ALPHA_MULTIPLICATION_EFFECT_H)
#include "image_format.h"
#include "test_util.h"
+namespace movit {
+
TEST(AlphaMultiplicationEffectTest, SimpleTest) {
const int size = 3;
float data[4 * size] = {
expect_equal(expected_data, out_data, 4, size);
}
+
+} // namespace movit
#define NUM_TAPS 16
using namespace std;
+
+namespace movit {
BlurEffect::BlurEffect()
: radius(3.0f),
void SingleBlurPassEffect::clear_gl_state()
{
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class EffectChain;
class Node;
class SingleBlurPassEffect;
int width, height, virtual_width, virtual_height;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_BLUR_EFFECT_H)
#include "image_format.h"
#include "test_util.h"
+namespace movit {
+
TEST(BlurEffectTest, IdentityTransformDoesNothing) {
const int size = 4;
expect_equal(expected_data, out_data, size, size, 0.1f, 1e-3);
}
+
+} // namespace movit
using namespace Eigen;
using namespace std;
+namespace movit {
+
// Color coordinates from Rec. 709; sRGB uses the same primaries.
static const double rec709_x_R = 0.640, rec709_x_G = 0.300, rec709_x_B = 0.150;
static const double rec709_y_R = 0.330, rec709_y_G = 0.600, rec709_y_B = 0.060;
return output_glsl_mat3("PREFIX(conversion_matrix)", m) +
read_file("colorspace_conversion_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
#include "image_format.h"
+namespace movit {
+
class ColorspaceConversionEffect : public Effect {
private:
// Should not be instantiated by end users.
Colorspace source_space, destination_space;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_COLORSPACE_CONVERSION_EFFECT_H)
#include "gtest/gtest.h"
#include "test_util.h"
+namespace movit {
+
TEST(ColorspaceConversionEffectTest, Reversible) {
float data[] = {
0.0f, 0.0f, 0.0f, 1.0f,
expect_equal(expected_data, out_data, 4, 6);
}
+
+} // namespace movit
#ifndef _MOVIT_D65_H
#define _MOVIT_D65_H 1
+namespace movit {
+
// The D65 illuminant, which is the standard white point (ie. what you should get
// for R=G=B=1) for almost all video color spaces in common use. It has a color
// temperature roughly around 6500 K, which is sort of bluish; it is intended to
static const double d65_Y = 1.0;
static const double d65_Z = d65_z / d65_y;
+} // namespace movit
+
#endif // !defined(_MOVIT_D65_H)
using namespace Eigen;
using namespace std;
+namespace movit {
+
DeconvolutionSharpenEffect::DeconvolutionSharpenEffect()
: R(5),
circle_radius(2.0f),
set_uniform_vec4_array(glsl_program_num, prefix, "samples", samples, (R + 1) * (R + 1));
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class DeconvolutionSharpenEffect : public Effect {
public:
DeconvolutionSharpenEffect();
void update_deconvolution_kernel();
};
+} // namespace movit
+
#endif // !defined(_MOVIT_DECONVOLUTION_SHARPEN_EFFECT_H)
#include "image_format.h"
#include "test_util.h"
+namespace movit {
+
TEST(DeconvolutionSharpenEffectTest, IdentityTransformDoesNothing) {
const int size = 4;
expect_equal(expected_alpha, out_data, size, size);
}
+
+} // namespace movit
#include "util.h"
#include "widgets.h"
+using namespace movit;
+
unsigned char result[WIDTH * HEIGHT * 4];
float lift_theta = 0.0f, lift_rad = 0.0f, lift_v = 0.0f;
using namespace std;
+namespace movit {
+
DiffusionEffect::DiffusionEffect()
: blur(new BlurEffect),
overlay_matte(new OverlayMatteEffect)
{
return read_file("overlay_matte_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class BlurEffect;
class EffectChain;
class Node;
float blurred_mix_amount;
};
+} // namespace movit
#endif // !defined(_MOVIT_DIFFUSION_EFFECT_H)
#include "image_format.h"
#include "test_util.h"
+namespace movit {
+
TEST(DiffusionEffectTest, IdentityTransformDoesNothing) {
const int size = 4;
expect_equal(expected_data, out_data, size, size, 0.05f, 0.002);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
namespace {
// A simple LCG (linear congruental generator) random generator.
set_uniform_float(glsl_program_num, prefix, "round_fac", round_fac);
set_uniform_float(glsl_program_num, prefix, "inv_round_fac", 1.0f / round_fac);
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class DitherEffect : public Effect {
private:
// Should not be instantiated by end users;
GLuint texnum;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_DITHER_EFFECT_H)
#include "image_format.h"
#include "test_util.h"
+namespace movit {
+
TEST(DitherEffectTest, NoDitherOnExactValues) {
const int size = 4;
EXPECT_NEAR(amplitude, sum / (size * 255.0f), 1.1e-5);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
bool Effect::set_int(const string &key, int value)
{
if (params_int.count(key) == 0) {
}
void Effect::clear_gl_state() {}
+
+} // namespace movit
#include "defs.h"
+namespace movit {
+
class EffectChain;
class Node;
std::map<std::string, float *> params_vec4;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_EFFECT_H)
using namespace std;
+namespace movit {
+
EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool)
: aspect_nom(aspect_nom),
aspect_denom(aspect_denom),
check_error();
}
}
+
+} // namespace movit
#include "image_format.h"
+namespace movit {
+
class Effect;
class Input;
struct Phase;
bool owns_resource_pool;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_EFFECT_CHAIN_H)
using namespace std;
+namespace movit {
+
TEST(EffectChainTest, EmptyChain) {
float data[] = {
0.0f, 0.25f, 0.3f,
// Reset the debug status again.
movit_debug_level = MOVIT_DEBUG_OFF;
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
GLint get_uniform_location(GLuint glsl_program_num, const string &prefix, const string &key)
{
string name = prefix + "_" + key;
glUniformMatrix3fv(location, 1, GL_FALSE, matrixf);
check_error();
}
+
+} // namespace movit
#include "util.h"
+namespace movit {
+
class EffectChain;
class Node;
void set_uniform_vec4_array(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values, size_t num_values);
void set_uniform_mat3(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const Eigen::Matrix3d &matrix);
+} // namespace movit
+
#endif // !defined(_MOVIT_EFFECT_UTIL_H)
using namespace std;
+namespace movit {
+
FFTPassEffect::FFTPassEffect()
: input_width(1280),
input_height(720),
assert(input_size % fft_size == 0);
set_uniform_float(glsl_program_num, prefix, "num_repeats", input_size / fft_size);
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class FFTPassEffect : public Effect {
public:
FFTPassEffect();
int inverse; // 0 = forward (FFT), 1 = reverse (IFFT).
};
+} // namespace movit
+
#endif // !defined(_MOVIT_FFT_PASS_EFFECT_H)
#include "multiply_effect.h"
#include "test_util.h"
+namespace movit {
+
namespace {
// Generate a random number uniformly distributed between [-1.0, 1.0].
expect_equal(in, out2, 4, fft_size, max_error, rms_limit);
}
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
FlatInput::FlatInput(ImageFormat image_format, MovitPixelFormat pixel_format, GLenum type, unsigned width, unsigned height)
: image_format(image_format),
pixel_format(pixel_format),
texture_num = 0;
}
}
+
+} // namespace movit
#include "init.h"
#include "input.h"
+namespace movit {
+
class ResourcePool;
// A FlatInput is the normal, “classic” case of an input, where everything
ResourcePool *resource_pool;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_FLAT_INPUT_H)
#include "test_util.h"
#include "util.h"
+namespace movit {
+
TEST(FlatInput, SimpleGrayscale) {
const int size = 4;
glDeleteBuffers(1, &pbo);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
GammaCompressionEffect::GammaCompressionEffect()
: destination_curve(GAMMA_LINEAR)
{
set_uniform_float(glsl_program_num, prefix, "beta", 0.0181);
}
}
+
+} // namespace movit
#include "effect.h"
#include "image_format.h"
+namespace movit {
+
class GammaCompressionEffect : public Effect {
private:
// Should not be instantiated by end users.
GammaCurve destination_curve;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_GAMMA_COMPRESSION_EFFECT_H)
#include "image_format.h"
#include "test_util.h"
+namespace movit {
+
TEST(GammaCompressionEffectTest, sRGB_KeyValues) {
float data[] = {
0.0f, 1.0f,
// precision and inaccuracies in the polynomial approximation.
expect_equal(expected_data, out_data, 4096, 1, 1.2 / 4095.0, 1e-5);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
GammaExpansionEffect::GammaExpansionEffect()
: source_curve(GAMMA_LINEAR)
{
set_uniform_float(glsl_program_num, prefix, "beta", 0.0181 * 4.5);
}
}
+
+} // namespace movit
#include "effect.h"
#include "image_format.h"
+namespace movit {
+
class GammaExpansionEffect : public Effect {
private:
// Should not be instantiated by end users.
GammaCurve source_curve;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_GAMMA_EXPANSION_EFFECT_H)
#include "gtest/gtest-message.h"
#include "test_util.h"
+namespace movit {
+
TEST(GammaExpansionEffectTest, sRGB_KeyValues) {
float data[] = {
0.0f, 1.0f,
//
test_accuracy(expected_data, out_data, 4096, 1e-3, 0.01, 2.50, 1e-4);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
GlowEffect::GlowEffect()
: blur(new BlurEffect),
cutoff(new HighlightCutoffEffect),
{
return read_file("highlight_cutoff_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class BlurEffect;
class EffectChain;
class HighlightCutoffEffect;
float cutoff;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_GLOW_EFFECT_H)
#include "image_format.h"
#include "test_util.h"
+namespace movit {
+
TEST(GlowEffectTest, NoAmountDoesNothing) {
const int size = 4;
expect_equal(expected_data, out_data, 4, size);
}
+
+} // namespace movit
// where Y' is derived from R'G'B' instead of RGB, since this is the same
// system as used in Rec. 601 and 709.
+namespace movit {
+
enum MovitPixelFormat {
FORMAT_RGB,
FORMAT_RGBA_PREMULTIPLIED_ALPHA,
GammaCurve gamma_curve;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_IMAGE_FORMAT_H)
using namespace std;
+namespace movit {
+
bool movit_initialized = false;
MovitDebugLevel movit_debug_level = MOVIT_DEBUG_ON;
float movit_texel_subpixel_precision;
movit_initialized = true;
return true;
}
+
+} // namespace movit
#include "defs.h"
#include <string>
+namespace movit {
+
enum MovitDebugLevel {
MOVIT_DEBUG_OFF = 0,
MOVIT_DEBUG_ON = 1,
// Whether the GPU in use supports GL_EXT_texture_sRGB.
extern bool movit_srgb_textures_supported;
+} // namespace movit
+
#endif // !defined(_MOVIT_INIT_H)
#include "effect.h"
#include "image_format.h"
+namespace movit {
+
// An input is a degenerate case of an effect; it represents the picture data
// that comes from the user. As such, it has zero “inputs” itself.
//
virtual GammaCurve get_gamma_curve() const = 0;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_INPUT_H)
using namespace std;
+namespace movit {
+
LiftGammaGainEffect::LiftGammaGainEffect()
: lift(0.0f, 0.0f, 0.0f),
gamma(1.0f, 1.0f, 1.0f),
2.2f / gamma.b);
set_uniform_vec3(glsl_program_num, prefix, "inv_gamma_22", (float *)&inv_gamma_22);
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class LiftGammaGainEffect : public Effect {
public:
LiftGammaGainEffect();
RGBTriplet lift, gamma, gain;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_LIFT_GAMMA_GAIN_EFFECT_H)
#include "lift_gamma_gain_effect.h"
#include "test_util.h"
+namespace movit {
+
TEST(LiftGammaGainEffectTest, DefaultIsNoop) {
float data[] = {
0.0f, 0.0f, 0.0f, 1.0f,
expect_equal(expected_data, out_data, 4, 3);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
MirrorEffect::MirrorEffect()
{
}
{
return read_file("mirror_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class MirrorEffect : public Effect {
public:
MirrorEffect();
virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
};
+} // namespace movit
+
#endif // !defined(_MOVIT_MIRROR_EFFECT_H)
using namespace std;
+namespace movit {
+
MixEffect::MixEffect()
: strength_first(0.5f), strength_second(0.5f)
{
{
return read_file("mix_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class MixEffect : public Effect {
public:
MixEffect();
float strength_first, strength_second;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_MIX_EFFECT_H)
#include "mix_effect.h"
#include "test_util.h"
+namespace movit {
+
TEST(MixEffectTest, FiftyFiftyMix) {
float data_a[] = {
0.0f, 0.25f,
expect_equal(expected_data, out_data, 2, 2);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
MultiplyEffect::MultiplyEffect()
: factor(1.0f, 1.0f, 1.0f, 1.0f)
{
{
return read_file("multiply_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class MultiplyEffect : public Effect {
public:
MultiplyEffect();
RGBATuple factor;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_MULTIPLY_EFFECT_H)
using namespace std;
+namespace movit {
+
OverlayEffect::OverlayEffect() {}
string OverlayEffect::output_fragment_shader()
{
return read_file("overlay_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class OverlayEffect : public Effect {
public:
OverlayEffect();
virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
};
+} // namespace movit
+
#endif // !defined(_MOVIT_OVERLAY_EFFECT_H)
#include "overlay_effect.h"
#include "test_util.h"
+namespace movit {
+
TEST(OverlayEffectTest, TopDominatesBottomWhenNoAlpha) {
float data_a[] = {
0.0f, 0.25f,
expect_equal(expected_data, out_data, 4, 1);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
PaddingEffect::PaddingEffect()
: border_color(0.0f, 0.0f, 0.0f, 0.0f),
output_width(1280),
input_width = width;
input_height = height;
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class PaddingEffect : public Effect {
public:
PaddingEffect();
float top, left;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_PADDING_EFFECT_H)
#include "test_util.h"
#include "util.h"
+namespace movit {
+
TEST(PaddingEffectTest, SimpleCenter) {
float data[2 * 2] = {
1.0f, 0.5f,
tester.run(out_data, GL_RGBA, COLORSPACE_REC_601_625, GAMMA_REC_709, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED);
expect_equal(expected_data, out_data, 4, 4);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
namespace {
float sinc(float x)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
check_error();
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class EffectChain;
class Node;
class SingleResamplePassEffect;
float slice_height;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_RESAMPLE_EFFECT_H)
#include "resample_effect.h"
#include "test_util.h"
+namespace movit {
+
namespace {
float sinc(float x)
// for 8-bit accuracy, though.
expect_equal(expected_data, out_data, dwidth, dheight, 0.5 / 1023.0);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
ResizeEffect::ResizeEffect()
: width(1280), height(720)
{
*virtual_width = *width = this->width;
*virtual_height = *height = this->height;
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class ResizeEffect : public Effect {
public:
ResizeEffect();
int width, height;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_RESIZE_EFFECT_H)
using namespace std;
+namespace movit {
+
ResourcePool::ResourcePool(size_t program_freelist_max_length,
size_t texture_freelist_max_bytes)
: program_freelist_max_length(program_freelist_max_length),
return texture_format.width * texture_format.height * bytes_per_pixel;
}
+
+} // namespace movit
#include <string>
#include <utility>
+namespace movit {
+
class ResourcePool {
public:
// program_freelist_max_length is how many compiled programs that are unused to keep
static size_t estimate_texture_size(const Texture2D &texture_format);
};
+} // namespace movit
+
#endif // !defined(_MOVIT_RESOURCE_POOL_H)
using namespace std;
+namespace movit {
+
SandboxEffect::SandboxEffect()
: parm(0.0f)
{
// Any OpenGL state you might want to set, goes here.
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class SandboxEffect : public Effect {
public:
SandboxEffect();
float parm;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_SANDBOX_EFFECT_H)
using namespace std;
+namespace movit {
+
SaturationEffect::SaturationEffect()
: saturation(1.0f)
{
{
return read_file("saturation_effect.frag");
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class SaturationEffect : public Effect {
public:
SaturationEffect();
float saturation;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_SATURATION_EFFECT_H)
#include "saturation_effect.h"
#include "test_util.h"
+namespace movit {
+
TEST(SaturationEffectTest, SaturationOneIsPassThrough) {
float data[] = {
1.0f, 0.5f, 0.75f, 0.6f,
expect_equal(expected_data, out_data, 4, 3);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
class Input;
namespace {
double rms = sqrt(squared_difference) / num_values;
EXPECT_LT(rms, rms_limit);
}
+
+} // namespace movit
#include "effect_chain.h"
#include "image_format.h"
+namespace movit {
+
class Input;
class EffectChainTester {
void expect_equal(const unsigned char *ref, const unsigned char *result, unsigned width, unsigned height, unsigned largest_difference_limit = 1, float rms_limit = 0.2);
void test_accuracy(const float *expected, const float *result, unsigned num_values, double absolute_error_limit, double relative_error_limit, double local_relative_error_limit, double rms_limit);
+} // namespace movit
+
#endif // !defined(_MOVIT_TEST_UTIL_H)
using namespace std;
+namespace movit {
+
UnsharpMaskEffect::UnsharpMaskEffect()
: blur(new BlurEffect),
mix(new MixEffect)
}
return blur->set_float(key, value);
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class BlurEffect;
class EffectChain;
class MixEffect;
MixEffect *mix;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_UNSHARP_MASK_EFFECT_H)
#include "test_util.h"
#include "unsharp_mask_effect.h"
+namespace movit {
+
TEST(UnsharpMaskEffectTest, NoAmountDoesNothing) {
const int size = 4;
// Add some leeway for the rest; unsharp masking is not expected to be extremely good.
expect_equal(expected_data, out_data, size, size, 0.1, 0.001);
}
+
+} // namespace movit
using namespace std;
+namespace movit {
+
extern string *movit_data_directory;
void hsv2rgb(float h, float s, float v, float *r, float *g, float *b)
assert(*offset >= 0.0f);
assert(*offset <= 1.0f);
}
+
+} // namespace movit
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
+namespace movit {
+
// Converts a HSV color to RGB. Assumes h in [0, 2pi> or [-pi, pi>
void hsv2rgb(float h, float s, float v, float *r, float *g, float *b);
// (estimated) squared errors of the two weights.
void combine_two_samples(float w1, float w2, float *offset, float *total_weight, float *sum_sq_error);
+} // namespace movit
+
#ifdef NDEBUG
#define check_error()
#else
using namespace std;
+namespace movit {
+
VignetteEffect::VignetteEffect()
: center(0.5f, 0.5f),
aspect_correction(1.0f, 1.0f),
Point2D flipped_center(center.x, 1.0f - center.y);
set_uniform_vec2(glsl_program_num, prefix, "flipped_center", (float *)&flipped_center);
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class VignetteEffect : public Effect {
public:
VignetteEffect();
float radius, inner_radius;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_VIGNETTE_EFFECT_H)
#include "test_util.h"
#include "vignette_effect.h"
+namespace movit {
+
TEST(VignetteEffectTest, HugeInnerRadiusDoesNothing) {
const int size = 4;
expect_equal(expected_data, out_data, width, height);
}
+
+} // namespace movit
using namespace Eigen;
using namespace std;
+namespace movit {
+
namespace {
// Temperature is in Kelvin. Formula from http://en.wikipedia.org/wiki/Planckian_locus#Approximation .
rgb_to_xyz_matrix;
set_uniform_mat3(glsl_program_num, prefix, "correction_matrix", corr_matrix);
}
+
+} // namespace movit
#include "effect.h"
+namespace movit {
+
class WhiteBalanceEffect : public Effect {
public:
WhiteBalanceEffect();
float output_color_temperature;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_WHITE_BALANCE_EFFECT_H)
#include "test_util.h"
#include "white_balance_effect.h"
+namespace movit {
+
TEST(WhiteBalanceEffectTest, GrayNeutralDoesNothing) {
float data[] = {
0.0f, 0.0f, 0.0f, 1.0f,
EXPECT_GT(out_data[4 * 1 + 2] - out_data[4 * 1 + 1], 0.05);
EXPECT_GT(out_data[4 * 1 + 1] - out_data[4 * 1 + 0], 0.05);
}
+
+} // namespace movit
#define HSV_WHEEL_SIZE 128
+namespace movit {
+
GLuint hsv_wheel_num;
void draw_hsv_wheel(float y, float rad, float theta, float value)
}
}
+
+} // namespace movit
// Some simple UI widgets for test use.
+namespace movit {
+
void draw_hsv_wheel(float y, float rad, float theta, float value);
void draw_saturation_bar(float y, float saturation);
void make_hsv_wheel_texture();
void read_colorwheel(float xf, float yf, float *rad, float *theta, float *value);
+} // namespace movit
+
#endif // !defined(_MOVIT_WIDGETS_H)
using namespace Eigen;
using namespace std;
+namespace movit {
+
namespace {
// OpenGL has texel center in (0.5, 0.5), but different formats have
}
}
}
+
+} // namespace movit
#include "image_format.h"
#include "input.h"
+namespace movit {
+
class ResourcePool;
struct YCbCrFormat {
ResourcePool *resource_pool;
};
+} // namespace movit
+
#endif // !defined(_MOVIT_YCBCR_INPUT_H)
#include "util.h"
#include "ycbcr_input.h"
+namespace movit {
+
TEST(YCbCrInput, Simple444) {
const int width = 1;
const int height = 5;
glDeleteBuffers(1, &pbo);
}
+
+} // namespace movit