From: Steinar H. Gunderson Date: Wed, 12 Feb 2014 01:04:19 +0000 (+0100) Subject: Move everything into “namespace movit”. X-Git-Tag: 1.0~45 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=cfc161e0289c2169d4835c48751ff56b97355eb2 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 namespace. --- diff --git a/README b/README index 702f29a..3f29bea 100644 --- a/README +++ b/README @@ -56,6 +56,7 @@ TL;DR, but I am interested in a programming example instead Assuming you have an OpenGL context already set up: + using namespace movit; EffectChain chain(1280, 720); ImageFormat inout_format; diff --git a/alpha_division_effect.cpp b/alpha_division_effect.cpp index 177a52c..45836ce 100644 --- a/alpha_division_effect.cpp +++ b/alpha_division_effect.cpp @@ -3,7 +3,11 @@ using namespace std; +namespace movit { + string AlphaDivisionEffect::output_fragment_shader() { return read_file("alpha_division_effect.frag"); } + +} // namespace diff --git a/alpha_division_effect.h b/alpha_division_effect.h index b95e9fe..6fcc716 100644 --- a/alpha_division_effect.h +++ b/alpha_division_effect.h @@ -7,6 +7,8 @@ #include "effect.h" +namespace movit { + class AlphaDivisionEffect : public Effect { public: AlphaDivisionEffect() {} @@ -14,4 +16,6 @@ public: std::string output_fragment_shader(); }; +} // namespace movit + #endif // !defined(_MOVIT_ALPHA_DIVISION_EFFECT_H) diff --git a/alpha_division_effect_test.cpp b/alpha_division_effect_test.cpp index b9c16b3..faa8b17 100644 --- a/alpha_division_effect_test.cpp +++ b/alpha_division_effect_test.cpp @@ -5,6 +5,8 @@ #include "image_format.h" #include "test_util.h" +namespace movit { + TEST(AlphaDivisionEffectTest, SimpleTest) { const int size = 2; float data[4 * size] = { @@ -35,3 +37,5 @@ TEST(AlphaDivisionEffectTest, ZeroAlphaIsPreserved) { EXPECT_EQ(0.0f, out_data[3]); EXPECT_EQ(0.0f, out_data[7]); } + +} // namespace movit diff --git a/alpha_multiplication_effect.cpp b/alpha_multiplication_effect.cpp index 6441485..3bc9459 100644 --- a/alpha_multiplication_effect.cpp +++ b/alpha_multiplication_effect.cpp @@ -3,7 +3,11 @@ using namespace std; +namespace movit { + string AlphaMultiplicationEffect::output_fragment_shader() { return read_file("alpha_multiplication_effect.frag"); } + +} // namespace movit diff --git a/alpha_multiplication_effect.h b/alpha_multiplication_effect.h index b9cf251..bc66d72 100644 --- a/alpha_multiplication_effect.h +++ b/alpha_multiplication_effect.h @@ -7,6 +7,8 @@ #include "effect.h" +namespace movit { + class AlphaMultiplicationEffect : public Effect { public: AlphaMultiplicationEffect() {} @@ -14,4 +16,6 @@ public: std::string output_fragment_shader(); }; +} // namespace movit + #endif // !defined(_MOVIT_ALPHA_MULTIPLICATION_EFFECT_H) diff --git a/alpha_multiplication_effect_test.cpp b/alpha_multiplication_effect_test.cpp index 62863e9..c63c0a3 100644 --- a/alpha_multiplication_effect_test.cpp +++ b/alpha_multiplication_effect_test.cpp @@ -7,6 +7,8 @@ #include "image_format.h" #include "test_util.h" +namespace movit { + TEST(AlphaMultiplicationEffectTest, SimpleTest) { const int size = 3; float data[4 * size] = { @@ -25,3 +27,5 @@ TEST(AlphaMultiplicationEffectTest, SimpleTest) { expect_equal(expected_data, out_data, 4, size); } + +} // namespace movit diff --git a/blur_effect.cpp b/blur_effect.cpp index 80aef74..9397ca4 100644 --- a/blur_effect.cpp +++ b/blur_effect.cpp @@ -12,6 +12,8 @@ #define NUM_TAPS 16 using namespace std; + +namespace movit { BlurEffect::BlurEffect() : radius(3.0f), @@ -196,3 +198,5 @@ void SingleBlurPassEffect::set_gl_state(GLuint glsl_program_num, const string &p void SingleBlurPassEffect::clear_gl_state() { } + +} // namespace movit diff --git a/blur_effect.h b/blur_effect.h index 84dd6ba..d97f5bd 100644 --- a/blur_effect.h +++ b/blur_effect.h @@ -16,6 +16,8 @@ #include "effect.h" +namespace movit { + class EffectChain; class Node; class SingleBlurPassEffect; @@ -92,4 +94,6 @@ private: int width, height, virtual_width, virtual_height; }; +} // namespace movit + #endif // !defined(_MOVIT_BLUR_EFFECT_H) diff --git a/blur_effect_test.cpp b/blur_effect_test.cpp index 4114bcb..1ef479e 100644 --- a/blur_effect_test.cpp +++ b/blur_effect_test.cpp @@ -9,6 +9,8 @@ #include "image_format.h" #include "test_util.h" +namespace movit { + TEST(BlurEffectTest, IdentityTransformDoesNothing) { const int size = 4; @@ -99,3 +101,5 @@ TEST(BlurEffectTest, BlurTwoDotsLargeRadius) { expect_equal(expected_data, out_data, size, size, 0.1f, 1e-3); } + +} // namespace movit diff --git a/colorspace_conversion_effect.cpp b/colorspace_conversion_effect.cpp index 0fcea61..2b8a0ca 100644 --- a/colorspace_conversion_effect.cpp +++ b/colorspace_conversion_effect.cpp @@ -9,6 +9,8 @@ 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; @@ -142,3 +144,5 @@ string ColorspaceConversionEffect::output_fragment_shader() return output_glsl_mat3("PREFIX(conversion_matrix)", m) + read_file("colorspace_conversion_effect.frag"); } + +} // namespace movit diff --git a/colorspace_conversion_effect.h b/colorspace_conversion_effect.h index ab8a8aa..76246d6 100644 --- a/colorspace_conversion_effect.h +++ b/colorspace_conversion_effect.h @@ -14,6 +14,8 @@ #include "effect.h" #include "image_format.h" +namespace movit { + class ColorspaceConversionEffect : public Effect { private: // Should not be instantiated by end users. @@ -34,4 +36,6 @@ private: Colorspace source_space, destination_space; }; +} // namespace movit + #endif // !defined(_MOVIT_COLORSPACE_CONVERSION_EFFECT_H) diff --git a/colorspace_conversion_effect_test.cpp b/colorspace_conversion_effect_test.cpp index 18f66ef..cf8aad7 100644 --- a/colorspace_conversion_effect_test.cpp +++ b/colorspace_conversion_effect_test.cpp @@ -6,6 +6,8 @@ #include "gtest/gtest.h" #include "test_util.h" +namespace movit { + TEST(ColorspaceConversionEffectTest, Reversible) { float data[] = { 0.0f, 0.0f, 0.0f, 1.0f, @@ -278,3 +280,5 @@ TEST(ColorspaceConversionEffectTest, sRGBToRec601_525) { expect_equal(expected_data, out_data, 4, 6); } + +} // namespace movit diff --git a/d65.h b/d65.h index 807c274..313fa45 100644 --- a/d65.h +++ b/d65.h @@ -1,6 +1,8 @@ #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 @@ -14,5 +16,7 @@ static const double d65_X = d65_x / d65_y; static const double d65_Y = 1.0; static const double d65_Z = d65_z / d65_y; +} // namespace movit + #endif // !defined(_MOVIT_D65_H) diff --git a/deconvolution_sharpen_effect.cpp b/deconvolution_sharpen_effect.cpp index c663d65..f564b68 100644 --- a/deconvolution_sharpen_effect.cpp +++ b/deconvolution_sharpen_effect.cpp @@ -19,6 +19,8 @@ using namespace Eigen; using namespace std; +namespace movit { + DeconvolutionSharpenEffect::DeconvolutionSharpenEffect() : R(5), circle_radius(2.0f), @@ -444,3 +446,5 @@ void DeconvolutionSharpenEffect::set_gl_state(GLuint glsl_program_num, const str set_uniform_vec4_array(glsl_program_num, prefix, "samples", samples, (R + 1) * (R + 1)); } + +} // namespace movit diff --git a/deconvolution_sharpen_effect.h b/deconvolution_sharpen_effect.h index 9279abf..e4cc9a5 100644 --- a/deconvolution_sharpen_effect.h +++ b/deconvolution_sharpen_effect.h @@ -25,6 +25,8 @@ #include "effect.h" +namespace movit { + class DeconvolutionSharpenEffect : public Effect { public: DeconvolutionSharpenEffect(); @@ -68,4 +70,6 @@ private: void update_deconvolution_kernel(); }; +} // namespace movit + #endif // !defined(_MOVIT_DECONVOLUTION_SHARPEN_EFFECT_H) diff --git a/deconvolution_sharpen_effect_test.cpp b/deconvolution_sharpen_effect_test.cpp index ba821ce..8829b9d 100644 --- a/deconvolution_sharpen_effect_test.cpp +++ b/deconvolution_sharpen_effect_test.cpp @@ -10,6 +10,8 @@ #include "image_format.h" #include "test_util.h" +namespace movit { + TEST(DeconvolutionSharpenEffectTest, IdentityTransformDoesNothing) { const int size = 4; @@ -232,3 +234,5 @@ TEST(DeconvolutionSharpenEffectTest, CircularDeconvolutionKeepsAlpha) { expect_equal(expected_alpha, out_data, size, size); } + +} // namespace movit diff --git a/demo.cpp b/demo.cpp index 81bda2d..3201f1e 100644 --- a/demo.cpp +++ b/demo.cpp @@ -35,6 +35,8 @@ #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; diff --git a/diffusion_effect.cpp b/diffusion_effect.cpp index fb78bb7..145eaf6 100644 --- a/diffusion_effect.cpp +++ b/diffusion_effect.cpp @@ -8,6 +8,8 @@ using namespace std; +namespace movit { + DiffusionEffect::DiffusionEffect() : blur(new BlurEffect), overlay_matte(new OverlayMatteEffect) @@ -46,3 +48,5 @@ string OverlayMatteEffect::output_fragment_shader() { return read_file("overlay_matte_effect.frag"); } + +} // namespace movit diff --git a/diffusion_effect.h b/diffusion_effect.h index 390787d..2c31e4a 100644 --- a/diffusion_effect.h +++ b/diffusion_effect.h @@ -18,6 +18,8 @@ #include "effect.h" +namespace movit { + class BlurEffect; class EffectChain; class Node; @@ -58,5 +60,6 @@ private: float blurred_mix_amount; }; +} // namespace movit #endif // !defined(_MOVIT_DIFFUSION_EFFECT_H) diff --git a/diffusion_effect_test.cpp b/diffusion_effect_test.cpp index 9faa7ba..7e50a04 100644 --- a/diffusion_effect_test.cpp +++ b/diffusion_effect_test.cpp @@ -8,6 +8,8 @@ #include "image_format.h" #include "test_util.h" +namespace movit { + TEST(DiffusionEffectTest, IdentityTransformDoesNothing) { const int size = 4; @@ -62,3 +64,5 @@ TEST(DiffusionEffectTest, FlattensOutWhitePyramid) { expect_equal(expected_data, out_data, size, size, 0.05f, 0.002); } + +} // namespace movit diff --git a/dither_effect.cpp b/dither_effect.cpp index 6e1ddd8..e9ea19f 100644 --- a/dither_effect.cpp +++ b/dither_effect.cpp @@ -10,6 +10,8 @@ using namespace std; +namespace movit { + namespace { // A simple LCG (linear congruental generator) random generator. @@ -122,3 +124,5 @@ void DitherEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, u 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 diff --git a/dither_effect.h b/dither_effect.h index a6c3c9c..20fb025 100644 --- a/dither_effect.h +++ b/dither_effect.h @@ -48,6 +48,8 @@ #include "effect.h" +namespace movit { + class DitherEffect : public Effect { private: // Should not be instantiated by end users; @@ -77,4 +79,6 @@ private: GLuint texnum; }; +} // namespace movit + #endif // !defined(_MOVIT_DITHER_EFFECT_H) diff --git a/dither_effect_test.cpp b/dither_effect_test.cpp index 6fd46db..8801aa0 100644 --- a/dither_effect_test.cpp +++ b/dither_effect_test.cpp @@ -8,6 +8,8 @@ #include "image_format.h" #include "test_util.h" +namespace movit { + TEST(DitherEffectTest, NoDitherOnExactValues) { const int size = 4; @@ -55,3 +57,5 @@ TEST(DitherEffectTest, SinusoidBelowOneLevelComesThrough) { EXPECT_NEAR(amplitude, sum / (size * 255.0f), 1.1e-5); } + +} // namespace movit diff --git a/effect.cpp b/effect.cpp index 93ba41a..eded11a 100644 --- a/effect.cpp +++ b/effect.cpp @@ -9,6 +9,8 @@ using namespace std; +namespace movit { + bool Effect::set_int(const string &key, int value) { if (params_int.count(key) == 0) { @@ -145,3 +147,5 @@ void Effect::set_gl_state(GLuint glsl_program_num, const string& prefix, unsigne } void Effect::clear_gl_state() {} + +} // namespace movit diff --git a/effect.h b/effect.h index a7d426c..ce07df4 100644 --- a/effect.h +++ b/effect.h @@ -18,6 +18,8 @@ #include "defs.h" +namespace movit { + class EffectChain; class Node; @@ -271,4 +273,6 @@ private: std::map params_vec4; }; +} // namespace movit + #endif // !defined(_MOVIT_EFFECT_H) diff --git a/effect_chain.cpp b/effect_chain.cpp index ec64b83..9aa092b 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -29,6 +29,8 @@ using namespace std; +namespace movit { + EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool) : aspect_nom(aspect_nom), aspect_denom(aspect_denom), @@ -1576,3 +1578,5 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height check_error(); } } + +} // namespace movit diff --git a/effect_chain.h b/effect_chain.h index 1f85051..642f079 100644 --- a/effect_chain.h +++ b/effect_chain.h @@ -26,6 +26,8 @@ #include "image_format.h" +namespace movit { + class Effect; class Input; struct Phase; @@ -266,4 +268,6 @@ private: bool owns_resource_pool; }; +} // namespace movit + #endif // !defined(_MOVIT_EFFECT_CHAIN_H) diff --git a/effect_chain_test.cpp b/effect_chain_test.cpp index 25cd50a..cf725f1 100644 --- a/effect_chain_test.cpp +++ b/effect_chain_test.cpp @@ -19,6 +19,8 @@ using namespace std; +namespace movit { + TEST(EffectChainTest, EmptyChain) { float data[] = { 0.0f, 0.25f, 0.3f, @@ -1019,3 +1021,5 @@ TEST(EffectChainTest, IdentityWithOwnPool) { // Reset the debug status again. movit_debug_level = MOVIT_DEBUG_OFF; } + +} // namespace movit diff --git a/effect_util.cpp b/effect_util.cpp index f49b477..35a94a7 100644 --- a/effect_util.cpp +++ b/effect_util.cpp @@ -6,6 +6,8 @@ using namespace std; +namespace movit { + GLint get_uniform_location(GLuint glsl_program_num, const string &prefix, const string &key) { string name = prefix + "_" + key; @@ -97,3 +99,5 @@ void set_uniform_mat3(GLuint glsl_program_num, const string &prefix, const strin glUniformMatrix3fv(location, 1, GL_FALSE, matrixf); check_error(); } + +} // namespace movit diff --git a/effect_util.h b/effect_util.h index 1c2e92c..65bd315 100644 --- a/effect_util.h +++ b/effect_util.h @@ -14,6 +14,8 @@ #include "util.h" +namespace movit { + class EffectChain; class Node; @@ -27,4 +29,6 @@ void set_uniform_vec4(GLuint glsl_program_num, const std::string &prefix, const 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) diff --git a/fft_pass_effect.cpp b/fft_pass_effect.cpp index 9e1b7b5..ccca74d 100644 --- a/fft_pass_effect.cpp +++ b/fft_pass_effect.cpp @@ -7,6 +7,8 @@ using namespace std; +namespace movit { + FFTPassEffect::FFTPassEffect() : input_width(1280), input_height(720), @@ -156,3 +158,5 @@ void FFTPassEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, assert(input_size % fft_size == 0); set_uniform_float(glsl_program_num, prefix, "num_repeats", input_size / fft_size); } + +} // namespace movit diff --git a/fft_pass_effect.h b/fft_pass_effect.h index f12bda7..1fd4ea2 100644 --- a/fft_pass_effect.h +++ b/fft_pass_effect.h @@ -57,6 +57,8 @@ #include "effect.h" +namespace movit { + class FFTPassEffect : public Effect { public: FFTPassEffect(); @@ -108,4 +110,6 @@ private: int inverse; // 0 = forward (FFT), 1 = reverse (IFFT). }; +} // namespace movit + #endif // !defined(_MOVIT_FFT_PASS_EFFECT_H) diff --git a/fft_pass_effect_test.cpp b/fft_pass_effect_test.cpp index 1d6693c..eb4e37c 100644 --- a/fft_pass_effect_test.cpp +++ b/fft_pass_effect_test.cpp @@ -12,6 +12,8 @@ #include "multiply_effect.h" #include "test_util.h" +namespace movit { + namespace { // Generate a random number uniformly distributed between [-1.0, 1.0]. @@ -333,3 +335,5 @@ TEST(FFTPassEffectTest, BigFFTAccuracy) { expect_equal(in, out2, 4, fft_size, max_error, rms_limit); } } + +} // namespace movit diff --git a/flat_input.cpp b/flat_input.cpp index d19cd4e..ed8e3e9 100644 --- a/flat_input.cpp +++ b/flat_input.cpp @@ -9,6 +9,8 @@ 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), @@ -118,3 +120,5 @@ void FlatInput::invalidate_pixel_data() texture_num = 0; } } + +} // namespace movit diff --git a/flat_input.h b/flat_input.h index 57f6f5a..dec0f1c 100644 --- a/flat_input.h +++ b/flat_input.h @@ -11,6 +11,8 @@ #include "init.h" #include "input.h" +namespace movit { + class ResourcePool; // A FlatInput is the normal, “classic” case of an input, where everything @@ -104,4 +106,6 @@ private: ResourcePool *resource_pool; }; +} // namespace movit + #endif // !defined(_MOVIT_FLAT_INPUT_H) diff --git a/flat_input_test.cpp b/flat_input_test.cpp index a297623..58d9eb9 100644 --- a/flat_input_test.cpp +++ b/flat_input_test.cpp @@ -9,6 +9,8 @@ #include "test_util.h" #include "util.h" +namespace movit { + TEST(FlatInput, SimpleGrayscale) { const int size = 4; @@ -264,3 +266,5 @@ TEST(FlatInput, PBO) { glDeleteBuffers(1, &pbo); } + +} // namespace movit diff --git a/gamma_compression_effect.cpp b/gamma_compression_effect.cpp index a90d67a..079f849 100644 --- a/gamma_compression_effect.cpp +++ b/gamma_compression_effect.cpp @@ -6,6 +6,8 @@ using namespace std; +namespace movit { + GammaCompressionEffect::GammaCompressionEffect() : destination_curve(GAMMA_LINEAR) { @@ -110,3 +112,5 @@ void GammaCompressionEffect::set_gl_state(GLuint glsl_program_num, const string set_uniform_float(glsl_program_num, prefix, "beta", 0.0181); } } + +} // namespace movit diff --git a/gamma_compression_effect.h b/gamma_compression_effect.h index 9577e02..83208cf 100644 --- a/gamma_compression_effect.h +++ b/gamma_compression_effect.h @@ -15,6 +15,8 @@ #include "effect.h" #include "image_format.h" +namespace movit { + class GammaCompressionEffect : public Effect { private: // Should not be instantiated by end users. @@ -36,4 +38,6 @@ private: GammaCurve destination_curve; }; +} // namespace movit + #endif // !defined(_MOVIT_GAMMA_COMPRESSION_EFFECT_H) diff --git a/gamma_compression_effect_test.cpp b/gamma_compression_effect_test.cpp index 41a700c..41fe776 100644 --- a/gamma_compression_effect_test.cpp +++ b/gamma_compression_effect_test.cpp @@ -13,6 +13,8 @@ #include "image_format.h" #include "test_util.h" +namespace movit { + TEST(GammaCompressionEffectTest, sRGB_KeyValues) { float data[] = { 0.0f, 1.0f, @@ -212,3 +214,5 @@ TEST(GammaCompressionEffectTest, Rec2020_12Bit_Inaccuracy) { // precision and inaccuracies in the polynomial approximation. expect_equal(expected_data, out_data, 4096, 1, 1.2 / 4095.0, 1e-5); } + +} // namespace movit diff --git a/gamma_expansion_effect.cpp b/gamma_expansion_effect.cpp index 696815e..24e8ea5 100644 --- a/gamma_expansion_effect.cpp +++ b/gamma_expansion_effect.cpp @@ -6,6 +6,8 @@ using namespace std; +namespace movit { + GammaExpansionEffect::GammaExpansionEffect() : source_curve(GAMMA_LINEAR) { @@ -121,3 +123,5 @@ void GammaExpansionEffect::set_gl_state(GLuint glsl_program_num, const string &p set_uniform_float(glsl_program_num, prefix, "beta", 0.0181 * 4.5); } } + +} // namespace movit diff --git a/gamma_expansion_effect.h b/gamma_expansion_effect.h index 92f0517..b5381ad 100644 --- a/gamma_expansion_effect.h +++ b/gamma_expansion_effect.h @@ -15,6 +15,8 @@ #include "effect.h" #include "image_format.h" +namespace movit { + class GammaExpansionEffect : public Effect { private: // Should not be instantiated by end users. @@ -37,4 +39,6 @@ private: GammaCurve source_curve; }; +} // namespace movit + #endif // !defined(_MOVIT_GAMMA_EXPANSION_EFFECT_H) diff --git a/gamma_expansion_effect_test.cpp b/gamma_expansion_effect_test.cpp index 0e7670d..d1d6d2a 100644 --- a/gamma_expansion_effect_test.cpp +++ b/gamma_expansion_effect_test.cpp @@ -8,6 +8,8 @@ #include "gtest/gtest-message.h" #include "test_util.h" +namespace movit { + TEST(GammaExpansionEffectTest, sRGB_KeyValues) { float data[] = { 0.0f, 1.0f, @@ -250,3 +252,5 @@ TEST(GammaExpansionEffectTest, Rec2020_12Bit_Inaccuracy) { // test_accuracy(expected_data, out_data, 4096, 1e-3, 0.01, 2.50, 1e-4); } + +} // namespace movit diff --git a/glow_effect.cpp b/glow_effect.cpp index 2cc6d01..778c557 100644 --- a/glow_effect.cpp +++ b/glow_effect.cpp @@ -9,6 +9,8 @@ using namespace std; +namespace movit { + GlowEffect::GlowEffect() : blur(new BlurEffect), cutoff(new HighlightCutoffEffect), @@ -57,3 +59,5 @@ string HighlightCutoffEffect::output_fragment_shader() { return read_file("highlight_cutoff_effect.frag"); } + +} // namespace movit diff --git a/glow_effect.h b/glow_effect.h index 91106e0..af83307 100644 --- a/glow_effect.h +++ b/glow_effect.h @@ -10,6 +10,8 @@ #include "effect.h" +namespace movit { + class BlurEffect; class EffectChain; class HighlightCutoffEffect; @@ -55,4 +57,6 @@ private: float cutoff; }; +} // namespace movit + #endif // !defined(_MOVIT_GLOW_EFFECT_H) diff --git a/glow_effect_test.cpp b/glow_effect_test.cpp index 4570d6f..11083a9 100644 --- a/glow_effect_test.cpp +++ b/glow_effect_test.cpp @@ -9,6 +9,8 @@ #include "image_format.h" #include "test_util.h" +namespace movit { + TEST(GlowEffectTest, NoAmountDoesNothing) { const int size = 4; @@ -108,3 +110,5 @@ TEST(GlowEffectTest, GlowsOntoZeroAlpha) { expect_equal(expected_data, out_data, 4, size); } + +} // namespace movit diff --git a/image_format.h b/image_format.h index 7ca334c..77838ec 100644 --- a/image_format.h +++ b/image_format.h @@ -11,6 +11,8 @@ // 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, @@ -52,4 +54,6 @@ struct ImageFormat { GammaCurve gamma_curve; }; +} // namespace movit + #endif // !defined(_MOVIT_IMAGE_FORMAT_H) diff --git a/init.cpp b/init.cpp index fd22778..5717dda 100644 --- a/init.cpp +++ b/init.cpp @@ -9,6 +9,8 @@ using namespace std; +namespace movit { + bool movit_initialized = false; MovitDebugLevel movit_debug_level = MOVIT_DEBUG_ON; float movit_texel_subpixel_precision; @@ -314,3 +316,5 @@ bool init_movit(const string& data_directory, MovitDebugLevel debug_level) movit_initialized = true; return true; } + +} // namespace movit diff --git a/init.h b/init.h index 25869d1..d6f6dd4 100644 --- a/init.h +++ b/init.h @@ -4,6 +4,8 @@ #include "defs.h" #include +namespace movit { + enum MovitDebugLevel { MOVIT_DEBUG_OFF = 0, MOVIT_DEBUG_ON = 1, @@ -65,4 +67,6 @@ extern bool movit_shader_rounding_supported; // Whether the GPU in use supports GL_EXT_texture_sRGB. extern bool movit_srgb_textures_supported; +} // namespace movit + #endif // !defined(_MOVIT_INIT_H) diff --git a/input.h b/input.h index e0febb1..7652e17 100644 --- a/input.h +++ b/input.h @@ -6,6 +6,8 @@ #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. // @@ -28,4 +30,6 @@ public: virtual GammaCurve get_gamma_curve() const = 0; }; +} // namespace movit + #endif // !defined(_MOVIT_INPUT_H) diff --git a/lift_gamma_gain_effect.cpp b/lift_gamma_gain_effect.cpp index 5bc989a..e9832f4 100644 --- a/lift_gamma_gain_effect.cpp +++ b/lift_gamma_gain_effect.cpp @@ -7,6 +7,8 @@ using namespace std; +namespace movit { + LiftGammaGainEffect::LiftGammaGainEffect() : lift(0.0f, 0.0f, 0.0f), gamma(1.0f, 1.0f, 1.0f), @@ -38,3 +40,5 @@ void LiftGammaGainEffect::set_gl_state(GLuint glsl_program_num, const string &pr 2.2f / gamma.b); set_uniform_vec3(glsl_program_num, prefix, "inv_gamma_22", (float *)&inv_gamma_22); } + +} // namespace movit diff --git a/lift_gamma_gain_effect.h b/lift_gamma_gain_effect.h index 60978f4..b500772 100644 --- a/lift_gamma_gain_effect.h +++ b/lift_gamma_gain_effect.h @@ -25,6 +25,8 @@ #include "effect.h" +namespace movit { + class LiftGammaGainEffect : public Effect { public: LiftGammaGainEffect(); @@ -38,4 +40,6 @@ private: RGBTriplet lift, gamma, gain; }; +} // namespace movit + #endif // !defined(_MOVIT_LIFT_GAMMA_GAIN_EFFECT_H) diff --git a/lift_gamma_gain_effect_test.cpp b/lift_gamma_gain_effect_test.cpp index a9e866d..612901f 100644 --- a/lift_gamma_gain_effect_test.cpp +++ b/lift_gamma_gain_effect_test.cpp @@ -8,6 +8,8 @@ #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, @@ -116,3 +118,5 @@ TEST(LiftGammaGainEffectTest, OutOfGamutColorsAreClipped) { expect_equal(expected_data, out_data, 4, 3); } + +} // namespace movit diff --git a/mirror_effect.cpp b/mirror_effect.cpp index 2aa1fea..d3c7a83 100644 --- a/mirror_effect.cpp +++ b/mirror_effect.cpp @@ -3,6 +3,8 @@ using namespace std; +namespace movit { + MirrorEffect::MirrorEffect() { } @@ -11,3 +13,5 @@ string MirrorEffect::output_fragment_shader() { return read_file("mirror_effect.frag"); } + +} // namespace movit diff --git a/mirror_effect.h b/mirror_effect.h index bd319cc..c4b46db 100644 --- a/mirror_effect.h +++ b/mirror_effect.h @@ -7,6 +7,8 @@ #include "effect.h" +namespace movit { + class MirrorEffect : public Effect { public: MirrorEffect(); @@ -18,4 +20,6 @@ public: virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; } }; +} // namespace movit + #endif // !defined(_MOVIT_MIRROR_EFFECT_H) diff --git a/mix_effect.cpp b/mix_effect.cpp index 6e279cb..9e27b12 100644 --- a/mix_effect.cpp +++ b/mix_effect.cpp @@ -3,6 +3,8 @@ using namespace std; +namespace movit { + MixEffect::MixEffect() : strength_first(0.5f), strength_second(0.5f) { @@ -14,3 +16,5 @@ string MixEffect::output_fragment_shader() { return read_file("mix_effect.frag"); } + +} // namespace movit diff --git a/mix_effect.h b/mix_effect.h index fda06a6..9abe601 100644 --- a/mix_effect.h +++ b/mix_effect.h @@ -8,6 +8,8 @@ #include "effect.h" +namespace movit { + class MixEffect : public Effect { public: MixEffect(); @@ -25,4 +27,6 @@ private: float strength_first, strength_second; }; +} // namespace movit + #endif // !defined(_MOVIT_MIX_EFFECT_H) diff --git a/mix_effect_test.cpp b/mix_effect_test.cpp index babb766..8432f1e 100644 --- a/mix_effect_test.cpp +++ b/mix_effect_test.cpp @@ -9,6 +9,8 @@ #include "mix_effect.h" #include "test_util.h" +namespace movit { + TEST(MixEffectTest, FiftyFiftyMix) { float data_a[] = { 0.0f, 0.25f, @@ -138,3 +140,5 @@ TEST(MixEffectTest, MixesLinearlyDespitesRGBInputsAndOutputs) { expect_equal(expected_data, out_data, 2, 2); } + +} // namespace movit diff --git a/multiply_effect.cpp b/multiply_effect.cpp index e0fc534..4eb072e 100644 --- a/multiply_effect.cpp +++ b/multiply_effect.cpp @@ -3,6 +3,8 @@ using namespace std; +namespace movit { + MultiplyEffect::MultiplyEffect() : factor(1.0f, 1.0f, 1.0f, 1.0f) { @@ -13,3 +15,5 @@ string MultiplyEffect::output_fragment_shader() { return read_file("multiply_effect.frag"); } + +} // namespace movit diff --git a/multiply_effect.h b/multiply_effect.h index 8de261a..50612fc 100644 --- a/multiply_effect.h +++ b/multiply_effect.h @@ -11,6 +11,8 @@ #include "effect.h" +namespace movit { + class MultiplyEffect : public Effect { public: MultiplyEffect(); @@ -21,4 +23,6 @@ private: RGBATuple factor; }; +} // namespace movit + #endif // !defined(_MOVIT_MULTIPLY_EFFECT_H) diff --git a/overlay_effect.cpp b/overlay_effect.cpp index 09c1638..3a42240 100644 --- a/overlay_effect.cpp +++ b/overlay_effect.cpp @@ -3,9 +3,13 @@ using namespace std; +namespace movit { + OverlayEffect::OverlayEffect() {} string OverlayEffect::output_fragment_shader() { return read_file("overlay_effect.frag"); } + +} // namespace movit diff --git a/overlay_effect.h b/overlay_effect.h index 444fe3f..489d8d7 100644 --- a/overlay_effect.h +++ b/overlay_effect.h @@ -14,6 +14,8 @@ #include "effect.h" +namespace movit { + class OverlayEffect : public Effect { public: OverlayEffect(); @@ -31,4 +33,6 @@ public: virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; } }; +} // namespace movit + #endif // !defined(_MOVIT_OVERLAY_EFFECT_H) diff --git a/overlay_effect_test.cpp b/overlay_effect_test.cpp index 5d86ec2..0a9682e 100644 --- a/overlay_effect_test.cpp +++ b/overlay_effect_test.cpp @@ -9,6 +9,8 @@ #include "overlay_effect.h" #include "test_util.h" +namespace movit { + TEST(OverlayEffectTest, TopDominatesBottomWhenNoAlpha) { float data_a[] = { 0.0f, 0.25f, @@ -91,3 +93,5 @@ TEST(OverlayEffectTest, PhotoshopReferenceTest) { expect_equal(expected_data, out_data, 4, 1); } + +} // namespace movit diff --git a/padding_effect.cpp b/padding_effect.cpp index 9d93aca..15381a3 100644 --- a/padding_effect.cpp +++ b/padding_effect.cpp @@ -7,6 +7,8 @@ using namespace std; +namespace movit { + PaddingEffect::PaddingEffect() : border_color(0.0f, 0.0f, 0.0f, 0.0f), output_width(1280), @@ -130,3 +132,5 @@ void PaddingEffect::inform_input_size(unsigned input_num, unsigned width, unsign input_width = width; input_height = height; } + +} // namespace movit diff --git a/padding_effect.h b/padding_effect.h index 9a32abb..3bd4aac 100644 --- a/padding_effect.h +++ b/padding_effect.h @@ -17,6 +17,8 @@ #include "effect.h" +namespace movit { + class PaddingEffect : public Effect { public: PaddingEffect(); @@ -39,4 +41,6 @@ private: float top, left; }; +} // namespace movit + #endif // !defined(_MOVIT_PADDING_EFFECT_H) diff --git a/padding_effect_test.cpp b/padding_effect_test.cpp index 36e7790..767f3e8 100644 --- a/padding_effect_test.cpp +++ b/padding_effect_test.cpp @@ -11,6 +11,8 @@ #include "test_util.h" #include "util.h" +namespace movit { + TEST(PaddingEffectTest, SimpleCenter) { float data[2 * 2] = { 1.0f, 0.5f, @@ -241,3 +243,5 @@ TEST(PaddingEffectTest, AlphaIsCorrectEvenWithNonLinearInputsAndOutputs) { 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 diff --git a/resample_effect.cpp b/resample_effect.cpp index 367e8b4..dbc5788 100644 --- a/resample_effect.cpp +++ b/resample_effect.cpp @@ -15,6 +15,8 @@ using namespace std; +namespace movit { + namespace { float sinc(float x) @@ -404,3 +406,5 @@ void SingleResamplePassEffect::set_gl_state(GLuint glsl_program_num, const strin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); check_error(); } + +} // namespace movit diff --git a/resample_effect.h b/resample_effect.h index 74585d6..628c61a 100644 --- a/resample_effect.h +++ b/resample_effect.h @@ -22,6 +22,8 @@ #include "effect.h" +namespace movit { + class EffectChain; class Node; class SingleResamplePassEffect; @@ -99,4 +101,6 @@ private: float slice_height; }; +} // namespace movit + #endif // !defined(_MOVIT_RESAMPLE_EFFECT_H) diff --git a/resample_effect_test.cpp b/resample_effect_test.cpp index dee08e3..971e694 100644 --- a/resample_effect_test.cpp +++ b/resample_effect_test.cpp @@ -11,6 +11,8 @@ #include "resample_effect.h" #include "test_util.h" +namespace movit { + namespace { float sinc(float x) @@ -208,3 +210,5 @@ TEST(ResampleEffectTest, HeavyResampleGetsSumRight) { // for 8-bit accuracy, though. expect_equal(expected_data, out_data, dwidth, dheight, 0.5 / 1023.0); } + +} // namespace movit diff --git a/resize_effect.cpp b/resize_effect.cpp index 70efea0..5fd761a 100644 --- a/resize_effect.cpp +++ b/resize_effect.cpp @@ -3,6 +3,8 @@ using namespace std; +namespace movit { + ResizeEffect::ResizeEffect() : width(1280), height(720) { @@ -20,3 +22,5 @@ void ResizeEffect::get_output_size(unsigned *width, unsigned *height, unsigned * *virtual_width = *width = this->width; *virtual_height = *height = this->height; } + +} // namespace movit diff --git a/resize_effect.h b/resize_effect.h index 774f510..dff6dcc 100644 --- a/resize_effect.h +++ b/resize_effect.h @@ -9,6 +9,8 @@ #include "effect.h" +namespace movit { + class ResizeEffect : public Effect { public: ResizeEffect(); @@ -28,4 +30,6 @@ private: int width, height; }; +} // namespace movit + #endif // !defined(_MOVIT_RESIZE_EFFECT_H) diff --git a/resource_pool.cpp b/resource_pool.cpp index 81a6bd4..4f2cc2b 100644 --- a/resource_pool.cpp +++ b/resource_pool.cpp @@ -14,6 +14,8 @@ 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), @@ -258,3 +260,5 @@ size_t ResourcePool::estimate_texture_size(const Texture2D &texture_format) return texture_format.width * texture_format.height * bytes_per_pixel; } + +} // namespace movit diff --git a/resource_pool.h b/resource_pool.h index ae89d9f..ea56d01 100644 --- a/resource_pool.h +++ b/resource_pool.h @@ -24,6 +24,8 @@ #include #include +namespace movit { + class ResourcePool { public: // program_freelist_max_length is how many compiled programs that are unused to keep @@ -106,4 +108,6 @@ private: static size_t estimate_texture_size(const Texture2D &texture_format); }; +} // namespace movit + #endif // !defined(_MOVIT_RESOURCE_POOL_H) diff --git a/sandbox_effect.cpp b/sandbox_effect.cpp index 840611e..76e1f5c 100644 --- a/sandbox_effect.cpp +++ b/sandbox_effect.cpp @@ -5,6 +5,8 @@ using namespace std; +namespace movit { + SandboxEffect::SandboxEffect() : parm(0.0f) { @@ -22,3 +24,5 @@ void SandboxEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, // Any OpenGL state you might want to set, goes here. } + +} // namespace movit diff --git a/sandbox_effect.h b/sandbox_effect.h index 80ef8a2..f06b2ef 100644 --- a/sandbox_effect.h +++ b/sandbox_effect.h @@ -13,6 +13,8 @@ #include "effect.h" +namespace movit { + class SandboxEffect : public Effect { public: SandboxEffect(); @@ -25,4 +27,6 @@ private: float parm; }; +} // namespace movit + #endif // !defined(_MOVIT_SANDBOX_EFFECT_H) diff --git a/saturation_effect.cpp b/saturation_effect.cpp index 637da86..f220610 100644 --- a/saturation_effect.cpp +++ b/saturation_effect.cpp @@ -5,6 +5,8 @@ using namespace std; +namespace movit { + SaturationEffect::SaturationEffect() : saturation(1.0f) { @@ -15,3 +17,5 @@ string SaturationEffect::output_fragment_shader() { return read_file("saturation_effect.frag"); } + +} // namespace movit diff --git a/saturation_effect.h b/saturation_effect.h index f4d69e6..a80740f 100644 --- a/saturation_effect.h +++ b/saturation_effect.h @@ -11,6 +11,8 @@ #include "effect.h" +namespace movit { + class SaturationEffect : public Effect { public: SaturationEffect(); @@ -22,4 +24,6 @@ private: float saturation; }; +} // namespace movit + #endif // !defined(_MOVIT_SATURATION_EFFECT_H) diff --git a/saturation_effect_test.cpp b/saturation_effect_test.cpp index dadb964..941df99 100644 --- a/saturation_effect_test.cpp +++ b/saturation_effect_test.cpp @@ -8,6 +8,8 @@ #include "saturation_effect.h" #include "test_util.h" +namespace movit { + TEST(SaturationEffectTest, SaturationOneIsPassThrough) { float data[] = { 1.0f, 0.5f, 0.75f, 0.6f, @@ -66,3 +68,5 @@ TEST(SaturationEffectTest, DoubleSaturation) { expect_equal(expected_data, out_data, 4, 3); } + +} // namespace movit diff --git a/test_util.cpp b/test_util.cpp index 61c3918..c7c2ac0 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -14,6 +14,8 @@ using namespace std; +namespace movit { + class Input; namespace { @@ -244,3 +246,5 @@ void test_accuracy(const float *expected, const float *result, unsigned num_valu double rms = sqrt(squared_difference) / num_values; EXPECT_LT(rms, rms_limit); } + +} // namespace movit diff --git a/test_util.h b/test_util.h index 992ca46..8fb17bf 100644 --- a/test_util.h +++ b/test_util.h @@ -5,6 +5,8 @@ #include "effect_chain.h" #include "image_format.h" +namespace movit { + class Input; class EffectChainTester { @@ -35,4 +37,6 @@ void expect_equal(const float *ref, const float *result, unsigned width, unsigne 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) diff --git a/unsharp_mask_effect.cpp b/unsharp_mask_effect.cpp index 115553b..9c68049 100644 --- a/unsharp_mask_effect.cpp +++ b/unsharp_mask_effect.cpp @@ -9,6 +9,8 @@ using namespace std; +namespace movit { + UnsharpMaskEffect::UnsharpMaskEffect() : blur(new BlurEffect), mix(new MixEffect) @@ -39,3 +41,5 @@ bool UnsharpMaskEffect::set_float(const string &key, float value) { } return blur->set_float(key, value); } + +} // namespace movit diff --git a/unsharp_mask_effect.h b/unsharp_mask_effect.h index ba54a96..e6d3790 100644 --- a/unsharp_mask_effect.h +++ b/unsharp_mask_effect.h @@ -16,6 +16,8 @@ #include "effect.h" +namespace movit { + class BlurEffect; class EffectChain; class MixEffect; @@ -43,4 +45,6 @@ private: MixEffect *mix; }; +} // namespace movit + #endif // !defined(_MOVIT_UNSHARP_MASK_EFFECT_H) diff --git a/unsharp_mask_effect_test.cpp b/unsharp_mask_effect_test.cpp index a44c407..69ea5f7 100644 --- a/unsharp_mask_effect_test.cpp +++ b/unsharp_mask_effect_test.cpp @@ -9,6 +9,8 @@ #include "test_util.h" #include "unsharp_mask_effect.h" +namespace movit { + TEST(UnsharpMaskEffectTest, NoAmountDoesNothing) { const int size = 4; @@ -72,3 +74,5 @@ TEST(UnsharpMaskEffectTest, UnblursGaussianBlur) { // 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 diff --git a/util.cpp b/util.cpp index 3b15c37..9e18e9f 100644 --- a/util.cpp +++ b/util.cpp @@ -11,6 +11,8 @@ using namespace std; +namespace movit { + extern string *movit_data_directory; void hsv2rgb(float h, float s, float v, float *r, float *g, float *b) @@ -175,3 +177,5 @@ void combine_two_samples(float w1, float w2, float *offset, float *total_weight, assert(*offset >= 0.0f); assert(*offset <= 1.0f); } + +} // namespace movit diff --git a/util.h b/util.h index 79b5987..cc82561 100644 --- a/util.h +++ b/util.h @@ -11,6 +11,8 @@ #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); @@ -41,6 +43,8 @@ std::string output_glsl_mat3(const std::string &name, const Eigen::Matrix3d &m); // (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 diff --git a/vignette_effect.cpp b/vignette_effect.cpp index 38bb878..94383ff 100644 --- a/vignette_effect.cpp +++ b/vignette_effect.cpp @@ -8,6 +8,8 @@ using namespace std; +namespace movit { + VignetteEffect::VignetteEffect() : center(0.5f, 0.5f), aspect_correction(1.0f, 1.0f), @@ -43,3 +45,5 @@ void VignetteEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, Point2D flipped_center(center.x, 1.0f - center.y); set_uniform_vec2(glsl_program_num, prefix, "flipped_center", (float *)&flipped_center); } + +} // namespace movit diff --git a/vignette_effect.h b/vignette_effect.h index 4501ebe..737a834 100644 --- a/vignette_effect.h +++ b/vignette_effect.h @@ -9,6 +9,8 @@ #include "effect.h" +namespace movit { + class VignetteEffect : public Effect { public: VignetteEffect(); @@ -26,4 +28,6 @@ private: float radius, inner_radius; }; +} // namespace movit + #endif // !defined(_MOVIT_VIGNETTE_EFFECT_H) diff --git a/vignette_effect_test.cpp b/vignette_effect_test.cpp index 5d79d2d..9c28852 100644 --- a/vignette_effect_test.cpp +++ b/vignette_effect_test.cpp @@ -9,6 +9,8 @@ #include "test_util.h" #include "vignette_effect.h" +namespace movit { + TEST(VignetteEffectTest, HugeInnerRadiusDoesNothing) { const int size = 4; @@ -91,3 +93,5 @@ TEST(VignetteEffectTest, BurstFromUpperLeftCorner) { expect_equal(expected_data, out_data, width, height); } + +} // namespace movit diff --git a/white_balance_effect.cpp b/white_balance_effect.cpp index ef60e7a..0aa85da 100644 --- a/white_balance_effect.cpp +++ b/white_balance_effect.cpp @@ -13,6 +13,8 @@ using namespace Eigen; using namespace std; +namespace movit { + namespace { // Temperature is in Kelvin. Formula from http://en.wikipedia.org/wiki/Planckian_locus#Approximation . @@ -148,3 +150,5 @@ void WhiteBalanceEffect::set_gl_state(GLuint glsl_program_num, const string &pre rgb_to_xyz_matrix; set_uniform_mat3(glsl_program_num, prefix, "correction_matrix", corr_matrix); } + +} // namespace movit diff --git a/white_balance_effect.h b/white_balance_effect.h index 5a8ecd5..43bfccb 100644 --- a/white_balance_effect.h +++ b/white_balance_effect.h @@ -8,6 +8,8 @@ #include "effect.h" +namespace movit { + class WhiteBalanceEffect : public Effect { public: WhiteBalanceEffect(); @@ -26,4 +28,6 @@ private: float output_color_temperature; }; +} // namespace movit + #endif // !defined(_MOVIT_WHITE_BALANCE_EFFECT_H) diff --git a/white_balance_effect_test.cpp b/white_balance_effect_test.cpp index 99afce5..5d51dd8 100644 --- a/white_balance_effect_test.cpp +++ b/white_balance_effect_test.cpp @@ -8,6 +8,8 @@ #include "test_util.h" #include "white_balance_effect.h" +namespace movit { + TEST(WhiteBalanceEffectTest, GrayNeutralDoesNothing) { float data[] = { 0.0f, 0.0f, 0.0f, 1.0f, @@ -102,3 +104,5 @@ TEST(WhiteBalanceEffectTest, HigherColorTemperatureIncreasesBlue) { 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 diff --git a/widgets.cpp b/widgets.cpp index 1c73136..3bf53c7 100644 --- a/widgets.cpp +++ b/widgets.cpp @@ -6,6 +6,8 @@ #define HSV_WHEEL_SIZE 128 +namespace movit { + GLuint hsv_wheel_num; void draw_hsv_wheel(float y, float rad, float theta, float value) @@ -155,3 +157,5 @@ void read_colorwheel(float xf, float yf, float *rad, float *theta, float *value) } } + +} // namespace movit diff --git a/widgets.h b/widgets.h index 18a8334..eb89a74 100644 --- a/widgets.h +++ b/widgets.h @@ -3,9 +3,13 @@ // 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) diff --git a/ycbcr_input.cpp b/ycbcr_input.cpp index 476f083..d3d7174 100644 --- a/ycbcr_input.cpp +++ b/ycbcr_input.cpp @@ -13,6 +13,8 @@ using namespace Eigen; using namespace std; +namespace movit { + namespace { // OpenGL has texel center in (0.5, 0.5), but different formats have @@ -249,3 +251,5 @@ void YCbCrInput::invalidate_pixel_data() } } } + +} // namespace movit diff --git a/ycbcr_input.h b/ycbcr_input.h index 997eb48..2466eed 100644 --- a/ycbcr_input.h +++ b/ycbcr_input.h @@ -14,6 +14,8 @@ #include "image_format.h" #include "input.h" +namespace movit { + class ResourcePool; struct YCbCrFormat { @@ -101,4 +103,6 @@ private: ResourcePool *resource_pool; }; +} // namespace movit + #endif // !defined(_MOVIT_YCBCR_INPUT_H) diff --git a/ycbcr_input_test.cpp b/ycbcr_input_test.cpp index 4beaaa3..352fe29 100644 --- a/ycbcr_input_test.cpp +++ b/ycbcr_input_test.cpp @@ -10,6 +10,8 @@ #include "util.h" #include "ycbcr_input.h" +namespace movit { + TEST(YCbCrInput, Simple444) { const int width = 1; const int height = 5; @@ -474,3 +476,5 @@ TEST(YCbCrInput, PBO) { glDeleteBuffers(1, &pbo); } + +} // namespace movit