]> git.sesse.net Git - movit/commitdiff
Move to 'using namespace std;' in all .cpp files.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 23 Jan 2014 00:35:34 +0000 (01:35 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 23 Jan 2014 00:35:34 +0000 (01:35 +0100)
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.

34 files changed:
alpha_division_effect.cpp
alpha_multiplication_effect.cpp
blur_effect.cpp
colorspace_conversion_effect.cpp
deconvolution_sharpen_effect.cpp
diffusion_effect.cpp
dither_effect.cpp
effect.cpp
effect_chain.cpp
effect_chain_test.cpp
effect_util.cpp
fft_pass_effect.cpp
flat_input.cpp
gamma_compression_effect.cpp
gamma_expansion_effect.cpp
glow_effect.cpp
init.cpp
lift_gamma_gain_effect.cpp
mirror_effect.cpp
mix_effect.cpp
multiply_effect.cpp
overlay_effect.cpp
padding_effect.cpp
resample_effect.cpp
resize_effect.cpp
resource_pool.cpp
sandbox_effect.cpp
saturation_effect.cpp
test_util.cpp
unsharp_mask_effect.cpp
util.cpp
vignette_effect.cpp
white_balance_effect.cpp
ycbcr_input.cpp

index 9f7b3b789a74ad1e0111ca34d1d9f001adab4cda..177a52cc23b37d9bb82036a02f69d3ec143ec5a7 100644 (file)
@@ -1,7 +1,9 @@
 #include "alpha_division_effect.h"
 #include "util.h"
 
-std::string AlphaDivisionEffect::output_fragment_shader()
+using namespace std;
+
+string AlphaDivisionEffect::output_fragment_shader()
 {
        return read_file("alpha_division_effect.frag");
 }
index dff6f15a4b83565c471342d7f090bd662e12543e..64414852b4b04e304fe47685e57758ef776f54f3 100644 (file)
@@ -1,7 +1,9 @@
 #include "alpha_multiplication_effect.h"
 #include "util.h"
 
-std::string AlphaMultiplicationEffect::output_fragment_shader()
+using namespace std;
+
+string AlphaMultiplicationEffect::output_fragment_shader()
 {
        return read_file("alpha_multiplication_effect.frag");
 }
index 0ec1b1dc857fbec5dbb30568d30058ebb274841b..80aef747c8a6bba0da40f20b0a06e91b810e2937 100644 (file)
@@ -10,6 +10,8 @@
 
 // Must match blur_effect.frag.
 #define NUM_TAPS 16
+
+using namespace std;
        
 BlurEffect::BlurEffect()
        : radius(3.0f),
@@ -56,8 +58,8 @@ void BlurEffect::update_radius()
        float adjusted_radius = radius;
        while ((mipmap_width > 1 || mipmap_height > 1) && adjusted_radius * 1.5f > NUM_TAPS / 2) {
                // Find the next mipmap size (round down, minimum 1 pixel).
-               mipmap_width = std::max(mipmap_width / 2, 1u);
-               mipmap_height = std::max(mipmap_height / 2, 1u);
+               mipmap_width = max(mipmap_width / 2, 1u);
+               mipmap_height = max(mipmap_height / 2, 1u);
 
                // Approximate when mipmap sizes are odd, but good enough.
                adjusted_radius = radius * float(mipmap_width) / float(input_width);
@@ -78,7 +80,7 @@ void BlurEffect::update_radius()
        assert(ok);
 }
 
-bool BlurEffect::set_float(const std::string &key, float value) {
+bool BlurEffect::set_float(const string &key, float value) {
        if (key == "radius") {
                radius = value;
                update_radius();
@@ -102,12 +104,12 @@ SingleBlurPassEffect::SingleBlurPassEffect(BlurEffect *parent)
        register_int("virtual_height", &virtual_height);
 }
 
-std::string SingleBlurPassEffect::output_fragment_shader()
+string SingleBlurPassEffect::output_fragment_shader()
 {
        return read_file("blur_effect.frag");
 }
 
-void SingleBlurPassEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void SingleBlurPassEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index bd4f70eb41d1d0059fab43e591b8132ef48a43f9..0fcea612c4198b8cf8d8a96d40bfbea4c8b25f8e 100644 (file)
@@ -7,6 +7,7 @@
 #include "util.h"
 
 using namespace Eigen;
+using namespace std;
 
 // 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;
@@ -126,7 +127,7 @@ Matrix3d ColorspaceConversionEffect::get_xyz_matrix(Colorspace space)
        return m;
 }
 
-std::string ColorspaceConversionEffect::output_fragment_shader()
+string ColorspaceConversionEffect::output_fragment_shader()
 {
        // Create a matrix to convert from source space -> XYZ,
        // another matrix to convert from XYZ -> destination space,
index a90e5cc6f8c1e3463c458e87eb4f451dfdb43a3e..0a13dd642f3d9a3cb5d00ac857f2763cf4904ee5 100644 (file)
@@ -17,6 +17,7 @@
 #include "util.h"
 
 using namespace Eigen;
+using namespace std;
 
 DeconvolutionSharpenEffect::DeconvolutionSharpenEffect()
        : R(5),
@@ -37,7 +38,7 @@ DeconvolutionSharpenEffect::DeconvolutionSharpenEffect()
        register_float("noise", &noise);
 }
 
-std::string DeconvolutionSharpenEffect::output_fragment_shader()
+string DeconvolutionSharpenEffect::output_fragment_shader()
 {
        char buf[256];
        sprintf(buf, "#define R %u\n", R);
@@ -170,10 +171,10 @@ MatrixXf convolve(const MatrixXf &a, const MatrixXf &b)
                        int xa_max = xr;
 
                        // Now fit to the first demand.
-                       ya_min = std::max<int>(ya_min, 0);
-                       ya_max = std::min<int>(ya_max, a.rows() - 1);
-                       xa_min = std::max<int>(xa_min, 0);
-                       xa_max = std::min<int>(xa_max, a.cols() - 1);
+                       ya_min = max<int>(ya_min, 0);
+                       ya_max = min<int>(ya_max, a.rows() - 1);
+                       xa_min = max<int>(xa_min, 0);
+                       xa_max = min<int>(xa_max, a.cols() - 1);
 
                        assert(ya_max >= ya_min);
                        assert(xa_max >= xa_min);
@@ -220,10 +221,10 @@ MatrixXf central_convolve(const MatrixXf &a, const MatrixXf &b)
                        int xa_max = xr;
 
                        // Now fit to the first demand.
-                       ya_min = std::max<int>(ya_min, 0);
-                       ya_max = std::min<int>(ya_max, a.rows() - 1);
-                       xa_min = std::max<int>(xa_min, 0);
-                       xa_max = std::min<int>(xa_max, a.cols() - 1);
+                       ya_min = max<int>(ya_min, 0);
+                       ya_max = min<int>(ya_max, a.rows() - 1);
+                       xa_min = max<int>(xa_min, 0);
+                       xa_max = min<int>(xa_max, a.cols() - 1);
 
                        assert(ya_max >= ya_min);
                        assert(xa_max >= xa_min);
@@ -417,7 +418,7 @@ void DeconvolutionSharpenEffect::update_deconvolution_kernel()
        last_noise = noise;
 }
 
-void DeconvolutionSharpenEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void DeconvolutionSharpenEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index a202f8c4d017c60828dccbf7624572f19a069a0d..fb78bb76a4cadfe6b4609a1f4fcddaacc565bc23 100644 (file)
@@ -6,6 +6,8 @@
 #include "effect_chain.h"
 #include "util.h"
 
+using namespace std;
+
 DiffusionEffect::DiffusionEffect()
        : blur(new BlurEffect),
          overlay_matte(new OverlayMatteEffect)
@@ -27,7 +29,7 @@ void DiffusionEffect::rewrite_graph(EffectChain *graph, Node *self)
        self->disabled = true;
 }
 
-bool DiffusionEffect::set_float(const std::string &key, float value) {
+bool DiffusionEffect::set_float(const string &key, float value) {
        if (key == "blurred_mix_amount") {
                return overlay_matte->set_float(key, value);
        }
@@ -40,7 +42,7 @@ OverlayMatteEffect::OverlayMatteEffect()
        register_float("blurred_mix_amount", &blurred_mix_amount);
 }
 
-std::string OverlayMatteEffect::output_fragment_shader()
+string OverlayMatteEffect::output_fragment_shader()
 {
        return read_file("overlay_matte_effect.frag");
 }
index 4643d07180993fdd286e460eba758b08d949d9d3..62355b248fc406db1980e9ec76f9bde7afdd92ba 100644 (file)
@@ -7,6 +7,8 @@
 #include "init.h"
 #include "util.h"
 
+using namespace std;
+
 namespace {
 
 // A simple LCG (linear congruental generator) random generator.
@@ -39,14 +41,14 @@ DitherEffect::~DitherEffect()
        glDeleteTextures(1, &texnum);
 }
 
-std::string DitherEffect::output_fragment_shader()
+string DitherEffect::output_fragment_shader()
 {
        char buf[256];
        sprintf(buf, "#define NEED_EXPLICIT_ROUND %d\n", (movit_num_wrongly_rounded > 0));
        return buf + read_file("dither_effect.frag");
 }
 
-void DitherEffect::update_texture(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void DitherEffect::update_texture(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        float *dither_noise = new float[width * height];
        float dither_double_amplitude = 1.0f / (1 << num_bits);
@@ -54,8 +56,8 @@ void DitherEffect::update_texture(GLuint glsl_program_num, const std::string &pr
        // We don't need a strictly nonrepeating dither; reducing the resolution
        // to max 128x128 saves a lot of texture bandwidth, without causing any
        // noticeable harm to the dither's performance.
-       texture_width = std::min(width, 128);
-       texture_height = std::min(height, 128);
+       texture_width = min(width, 128);
+       texture_height = min(height, 128);
 
        // Using the resolution as a seed gives us a consistent dither from frame to frame.
        // It also gives a different dither for e.g. different aspect ratios, which _feels_
@@ -85,7 +87,7 @@ void DitherEffect::update_texture(GLuint glsl_program_num, const std::string &pr
        delete[] dither_noise;
 }
 
-void DitherEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void DitherEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index b17c0d62c6d524aa8909ad619c03f228f5b322d4..9cd611f8518ed3cd2a4d58c8dd2bb7a69ce0cfb0 100644 (file)
@@ -8,7 +8,9 @@
 #include "effect_util.h"
 #include "util.h"
 
-bool Effect::set_int(const std::string &key, int value)
+using namespace std;
+
+bool Effect::set_int(const string &key, int value)
 {
        if (params_int.count(key) == 0) {
                return false;
@@ -17,7 +19,7 @@ bool Effect::set_int(const std::string &key, int value)
        return true;
 }
 
-bool Effect::set_float(const std::string &key, float value)
+bool Effect::set_float(const string &key, float value)
 {
        if (params_float.count(key) == 0) {
                return false;
@@ -26,7 +28,7 @@ bool Effect::set_float(const std::string &key, float value)
        return true;
 }
 
-bool Effect::set_vec2(const std::string &key, const float *values)
+bool Effect::set_vec2(const string &key, const float *values)
 {
        if (params_vec2.count(key) == 0) {
                return false;
@@ -35,7 +37,7 @@ bool Effect::set_vec2(const std::string &key, const float *values)
        return true;
 }
 
-bool Effect::set_vec3(const std::string &key, const float *values)
+bool Effect::set_vec3(const string &key, const float *values)
 {
        if (params_vec3.count(key) == 0) {
                return false;
@@ -44,7 +46,7 @@ bool Effect::set_vec3(const std::string &key, const float *values)
        return true;
 }
 
-bool Effect::set_vec4(const std::string &key, const float *values)
+bool Effect::set_vec4(const string &key, const float *values)
 {
        if (params_vec4.count(key) == 0) {
                return false;
@@ -53,31 +55,31 @@ bool Effect::set_vec4(const std::string &key, const float *values)
        return true;
 }
 
-void Effect::register_int(const std::string &key, int *value)
+void Effect::register_int(const string &key, int *value)
 {
        assert(params_int.count(key) == 0);
        params_int[key] = value;
 }
 
-void Effect::register_float(const std::string &key, float *value)
+void Effect::register_float(const string &key, float *value)
 {
        assert(params_float.count(key) == 0);
        params_float[key] = value;
 }
 
-void Effect::register_vec2(const std::string &key, float *values)
+void Effect::register_vec2(const string &key, float *values)
 {
        assert(params_vec2.count(key) == 0);
        params_vec2[key] = values;
 }
 
-void Effect::register_vec3(const std::string &key, float *values)
+void Effect::register_vec3(const string &key, float *values)
 {
        assert(params_vec3.count(key) == 0);
        params_vec3[key] = values;
 }
 
-void Effect::register_vec4(const std::string &key, float *values)
+void Effect::register_vec4(const string &key, float *values)
 {
        assert(params_vec4.count(key) == 0);
        params_vec4[key] = values;
@@ -85,31 +87,31 @@ void Effect::register_vec4(const std::string &key, float *values)
 
 // Output convenience uniforms for each parameter.
 // These will be filled in per-frame.
-std::string Effect::output_convenience_uniforms() const
+string Effect::output_convenience_uniforms() const
 {
-       std::string output = "";
-       for (std::map<std::string, float*>::const_iterator it = params_float.begin();
+       string output = "";
+       for (map<string, float*>::const_iterator it = params_float.begin();
             it != params_float.end();
             ++it) {
                char buf[256];
                sprintf(buf, "uniform float PREFIX(%s);\n", it->first.c_str());
                output.append(buf);
        }
-       for (std::map<std::string, float*>::const_iterator it = params_vec2.begin();
+       for (map<string, float*>::const_iterator it = params_vec2.begin();
             it != params_vec2.end();
             ++it) {
                char buf[256];
                sprintf(buf, "uniform vec2 PREFIX(%s);\n", it->first.c_str());
                output.append(buf);
        }
-       for (std::map<std::string, float*>::const_iterator it = params_vec3.begin();
+       for (map<string, float*>::const_iterator it = params_vec3.begin();
             it != params_vec3.end();
             ++it) {
                char buf[256];
                sprintf(buf, "uniform vec3 PREFIX(%s);\n", it->first.c_str());
                output.append(buf);
        }
-       for (std::map<std::string, float*>::const_iterator it = params_vec4.begin();
+       for (map<string, float*>::const_iterator it = params_vec4.begin();
             it != params_vec4.end();
             ++it) {
                char buf[256];
@@ -119,24 +121,24 @@ std::string Effect::output_convenience_uniforms() const
        return output;
 }
 
-void Effect::set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num)
+void Effect::set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num)
 {
-       for (std::map<std::string, float*>::const_iterator it = params_float.begin();
+       for (map<string, float*>::const_iterator it = params_float.begin();
             it != params_float.end();
             ++it) {
                set_uniform_float(glsl_program_num, prefix, it->first, *it->second);
        }
-       for (std::map<std::string, float*>::const_iterator it = params_vec2.begin();
+       for (map<string, float*>::const_iterator it = params_vec2.begin();
             it != params_vec2.end();
             ++it) {
                set_uniform_vec2(glsl_program_num, prefix, it->first, it->second);
        }
-       for (std::map<std::string, float*>::const_iterator it = params_vec3.begin();
+       for (map<string, float*>::const_iterator it = params_vec3.begin();
             it != params_vec3.end();
             ++it) {
                set_uniform_vec3(glsl_program_num, prefix, it->first, it->second);
        }
-       for (std::map<std::string, float*>::const_iterator it = params_vec4.begin();
+       for (map<string, float*>::const_iterator it = params_vec4.begin();
             it != params_vec4.end();
             ++it) {
                set_uniform_vec4(glsl_program_num, prefix, it->first, it->second);
index cb807720b09de0620a09cac6a75fdfc95f507d6b..d80c4f82a28b33c39c983b38f02894ad514979e1 100644 (file)
@@ -26,6 +26,8 @@
 #include "resource_pool.h"
 #include "util.h"
 
+using namespace std;
+
 EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool)
        : aspect_nom(aspect_nom),
          aspect_denom(aspect_denom),
@@ -144,7 +146,7 @@ void EffectChain::insert_node_between(Node *sender, Node *middle, Node *receiver
        assert(middle->incoming_links.size() == middle->effect->num_inputs());
 }
 
-void EffectChain::find_all_nonlinear_inputs(Node *node, std::vector<Node *> *nonlinear_inputs)
+void EffectChain::find_all_nonlinear_inputs(Node *node, vector<Node *> *nonlinear_inputs)
 {
        if (node->output_gamma_curve == GAMMA_LINEAR &&
            node->effect->effect_type_id() != "GammaCompressionEffect") {
@@ -160,7 +162,7 @@ void EffectChain::find_all_nonlinear_inputs(Node *node, std::vector<Node *> *non
        }
 }
 
-Effect *EffectChain::add_effect(Effect *effect, const std::vector<Effect *> &inputs)
+Effect *EffectChain::add_effect(Effect *effect, const vector<Effect *> &inputs)
 {
        assert(!finalized);
        assert(inputs.size() == effect->num_inputs());
@@ -173,15 +175,15 @@ Effect *EffectChain::add_effect(Effect *effect, const std::vector<Effect *> &inp
 }
 
 // GLSL pre-1.30 doesn't support token pasting. Replace PREFIX(x) with <effect_id>_x.
-std::string replace_prefix(const std::string &text, const std::string &prefix)
+string replace_prefix(const string &text, const string &prefix)
 {
-       std::string output;
+       string output;
        size_t start = 0;
 
        while (start < text.size()) {
                size_t pos = text.find("PREFIX(", start);
-               if (pos == std::string::npos) {
-                       output.append(text.substr(start, std::string::npos));
+               if (pos == string::npos) {
+                       output.append(text.substr(start, string::npos));
                        break;
                }
 
@@ -214,44 +216,44 @@ std::string replace_prefix(const std::string &text, const std::string &prefix)
 }
 
 Phase *EffectChain::compile_glsl_program(
-       const std::vector<Node *> &inputs,
-       const std::vector<Node *> &effects)
+       const vector<Node *> &inputs,
+       const vector<Node *> &effects)
 {
        Phase *phase = new Phase;
        assert(!effects.empty());
 
        // Deduplicate the inputs.
-       std::vector<Node *> true_inputs = inputs;
-       std::sort(true_inputs.begin(), true_inputs.end());
-       true_inputs.erase(std::unique(true_inputs.begin(), true_inputs.end()), true_inputs.end());
+       vector<Node *> true_inputs = inputs;
+       sort(true_inputs.begin(), true_inputs.end());
+       true_inputs.erase(unique(true_inputs.begin(), true_inputs.end()), true_inputs.end());
 
        bool input_needs_mipmaps = false;
-       std::string frag_shader = read_file("header.frag");
+       string frag_shader = read_file("header.frag");
 
        // Create functions for all the texture inputs that we need.
        for (unsigned i = 0; i < true_inputs.size(); ++i) {
                Node *input = true_inputs[i];
                char effect_id[256];
                sprintf(effect_id, "in%u", i);
-               phase->effect_ids.insert(std::make_pair(input, effect_id));
+               phase->effect_ids.insert(make_pair(input, effect_id));
        
-               frag_shader += std::string("uniform sampler2D tex_") + effect_id + ";\n";
-               frag_shader += std::string("vec4 ") + effect_id + "(vec2 tc) {\n";
-               frag_shader += "\treturn texture2D(tex_" + std::string(effect_id) + ", tc);\n";
+               frag_shader += string("uniform sampler2D tex_") + effect_id + ";\n";
+               frag_shader += string("vec4 ") + effect_id + "(vec2 tc) {\n";
+               frag_shader += "\treturn texture2D(tex_" + string(effect_id) + ", tc);\n";
                frag_shader += "}\n";
                frag_shader += "\n";
        }
 
-       std::vector<Node *> sorted_effects = topological_sort(effects);
+       vector<Node *> sorted_effects = topological_sort(effects);
 
        for (unsigned i = 0; i < sorted_effects.size(); ++i) {
                Node *node = sorted_effects[i];
                char effect_id[256];
                sprintf(effect_id, "eff%u", i);
-               phase->effect_ids.insert(std::make_pair(node, effect_id));
+               phase->effect_ids.insert(make_pair(node, effect_id));
 
                if (node->incoming_links.size() == 1) {
-                       frag_shader += std::string("#define INPUT ") + phase->effect_ids[node->incoming_links[0]] + "\n";
+                       frag_shader += string("#define INPUT ") + phase->effect_ids[node->incoming_links[0]] + "\n";
                } else {
                        for (unsigned j = 0; j < node->incoming_links.size(); ++j) {
                                char buf[256];
@@ -261,7 +263,7 @@ Phase *EffectChain::compile_glsl_program(
                }
        
                frag_shader += "\n";
-               frag_shader += std::string("#define FUNCNAME ") + effect_id + "\n";
+               frag_shader += string("#define FUNCNAME ") + effect_id + "\n";
                frag_shader += replace_prefix(node->effect->output_convenience_uniforms(), effect_id);
                frag_shader += replace_prefix(node->effect->output_fragment_shader(), effect_id);
                frag_shader += "#undef PREFIX\n";
@@ -285,7 +287,7 @@ Phase *EffectChain::compile_glsl_program(
                        CHECK(node->effect->set_int("needs_mipmaps", input_needs_mipmaps));
                }
        }
-       frag_shader += std::string("#define INPUT ") + phase->effect_ids[sorted_effects.back()] + "\n";
+       frag_shader += string("#define INPUT ") + phase->effect_ids[sorted_effects.back()] + "\n";
        frag_shader.append(read_file("footer.frag"));
 
        phase->glsl_program_num = resource_pool->compile_glsl_program(read_file("vs.vert"), frag_shader);
@@ -309,22 +311,22 @@ void EffectChain::construct_glsl_programs(Node *output)
        // Which effects have already been completed?
        // We need to keep track of it, as an effect with multiple outputs
        // could otherwise be calculated multiple times.
-       std::set<Node *> completed_effects;
+       set<Node *> completed_effects;
 
        // Effects in the current phase, as well as inputs (outputs from other phases
        // that we depend on). Note that since we start iterating from the end,
        // the effect list will be in the reverse order.
-       std::vector<Node *> this_phase_inputs;
-       std::vector<Node *> this_phase_effects;
+       vector<Node *> this_phase_inputs;
+       vector<Node *> this_phase_effects;
 
        // Effects that we have yet to calculate, but that we know should
        // be in the current phase.
-       std::stack<Node *> effects_todo_this_phase;
+       stack<Node *> effects_todo_this_phase;
 
        // Effects that we have yet to calculate, but that come from other phases.
        // We delay these until we have this phase done in its entirety,
        // at which point we pick any of them and start a new phase from that.
-       std::stack<Node *> effects_todo_other_phases;
+       stack<Node *> effects_todo_other_phases;
 
        effects_todo_this_phase.push(output);
 
@@ -349,7 +351,7 @@ void EffectChain::construct_glsl_programs(Node *output)
                        completed_effects.insert(node);
 
                        // Find all the dependencies of this effect, and add them to the stack.
-                       std::vector<Node *> deps = node->incoming_links;
+                       vector<Node *> deps = node->incoming_links;
                        assert(node->effect->num_inputs() == deps.size());
                        for (unsigned i = 0; i < deps.size(); ++i) {
                                bool start_new_phase = false;
@@ -424,7 +426,7 @@ void EffectChain::construct_glsl_programs(Node *output)
 
        // Finally, since the phases are found from the output but must be executed
        // from the input(s), reverse them, too.
-       std::reverse(phases.begin(), phases.end());
+       reverse(phases.begin(), phases.end());
 }
 
 void EffectChain::output_dot(const char *filename)
@@ -443,10 +445,10 @@ void EffectChain::output_dot(const char *filename)
        fprintf(fp, "  output [shape=box label=\"(output)\"];\n");
        for (unsigned i = 0; i < nodes.size(); ++i) {
                // Find out which phase this event belongs to.
-               std::vector<int> in_phases;
+               vector<int> in_phases;
                for (unsigned j = 0; j < phases.size(); ++j) {
                        const Phase* p = phases[j];
-                       if (std::find(p->effects.begin(), p->effects.end(), nodes[i]) != p->effects.end()) {
+                       if (find(p->effects.begin(), p->effects.end(), nodes[i]) != p->effects.end()) {
                                in_phases.push_back(j);
                        }
                }
@@ -472,13 +474,13 @@ void EffectChain::output_dot(const char *filename)
                        char to_node_id[256];
                        snprintf(to_node_id, 256, "n%ld", (long)nodes[i]->outgoing_links[j]);
 
-                       std::vector<std::string> labels = get_labels_for_edge(nodes[i], nodes[i]->outgoing_links[j]);
+                       vector<string> labels = get_labels_for_edge(nodes[i], nodes[i]->outgoing_links[j]);
                        output_dot_edge(fp, from_node_id, to_node_id, labels);
                }
 
                if (nodes[i]->outgoing_links.empty() && !nodes[i]->disabled) {
                        // Output node.
-                       std::vector<std::string> labels = get_labels_for_edge(nodes[i], NULL);
+                       vector<string> labels = get_labels_for_edge(nodes[i], NULL);
                        output_dot_edge(fp, from_node_id, "output", labels);
                }
        }
@@ -487,9 +489,9 @@ void EffectChain::output_dot(const char *filename)
        fclose(fp);
 }
 
-std::vector<std::string> EffectChain::get_labels_for_edge(const Node *from, const Node *to)
+vector<string> EffectChain::get_labels_for_edge(const Node *from, const Node *to)
 {
-       std::vector<std::string> labels;
+       vector<string> labels;
 
        if (to != NULL && to->effect->needs_texture_bounce()) {
                labels.push_back("needs_bounce");
@@ -544,14 +546,14 @@ std::vector<std::string> EffectChain::get_labels_for_edge(const Node *from, cons
 }
 
 void EffectChain::output_dot_edge(FILE *fp,
-                                  const std::string &from_node_id,
-                                  const std::string &to_node_id,
-                                  const std::vector<std::string> &labels)
+                                  const string &from_node_id,
+                                  const string &to_node_id,
+                                  const vector<string> &labels)
 {
        if (labels.empty()) {
                fprintf(fp, "  %s -> %s;\n", from_node_id.c_str(), to_node_id.c_str());
        } else {
-               std::string label = labels[0];
+               string label = labels[0];
                for (unsigned k = 1; k < labels.size(); ++k) {
                        label += ", " + labels[k];
                }
@@ -724,10 +726,10 @@ void EffectChain::sort_all_nodes_topologically()
        nodes = topological_sort(nodes);
 }
 
-std::vector<Node *> EffectChain::topological_sort(const std::vector<Node *> &nodes)
+vector<Node *> EffectChain::topological_sort(const vector<Node *> &nodes)
 {
-       std::set<Node *> nodes_left_to_visit(nodes.begin(), nodes.end());
-       std::vector<Node *> sorted_list;
+       set<Node *> nodes_left_to_visit(nodes.begin(), nodes.end());
+       vector<Node *> sorted_list;
        for (unsigned i = 0; i < nodes.size(); ++i) {
                topological_sort_visit_node(nodes[i], &nodes_left_to_visit, &sorted_list);
        }
@@ -735,7 +737,7 @@ std::vector<Node *> EffectChain::topological_sort(const std::vector<Node *> &nod
        return sorted_list;
 }
 
-void EffectChain::topological_sort_visit_node(Node *node, std::set<Node *> *nodes_left_to_visit, std::vector<Node *> *sorted_list)
+void EffectChain::topological_sort_visit_node(Node *node, set<Node *> *nodes_left_to_visit, vector<Node *> *sorted_list)
 {
        if (nodes_left_to_visit->count(node) == 0) {
                return;
@@ -1204,7 +1206,7 @@ void EffectChain::fix_internal_gamma_by_asking_inputs(unsigned step)
                        }
 
                        // See if all inputs can give us linear gamma. If not, leave it.
-                       std::vector<Node *> nonlinear_inputs;
+                       vector<Node *> nonlinear_inputs;
                        find_all_nonlinear_inputs(node, &nonlinear_inputs);
                        assert(!nonlinear_inputs.empty());
 
@@ -1335,7 +1337,7 @@ void EffectChain::add_dither_if_needed()
 // multiple outputs right now).
 Node *EffectChain::find_output_node()
 {
-       std::vector<Node *> output_nodes;
+       vector<Node *> output_nodes;
        for (unsigned i = 0; i < nodes.size(); ++i) {
                Node *node = nodes[i];
                if (node->disabled) {
@@ -1459,11 +1461,11 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                check_error();
        }
 
-       std::set<Node *> generated_mipmaps;
+       set<Node *> generated_mipmaps;
 
        // We choose the simplest option of having one texture per output,
        // since otherwise this turns into an (albeit simple) register allocation problem.
-       std::map<Phase *, GLuint> output_textures;
+       map<Phase *, GLuint> output_textures;
 
        for (unsigned phase = 0; phase < phases.size(); ++phase) {
                // Find a texture for this phase.
@@ -1472,7 +1474,7 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                        find_output_size(phases[phase]);
 
                        GLuint tex_num = resource_pool->create_2d_texture(GL_RGBA16F_ARB, phases[phase]->output_width, phases[phase]->output_height);
-                       output_textures.insert(std::make_pair(phases[phase], tex_num));
+                       output_textures.insert(make_pair(phases[phase], tex_num));
                }
 
                glUseProgram(phases[phase]->glsl_program_num);
@@ -1501,7 +1503,7 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
                        check_error();
 
-                       std::string texture_name = std::string("tex_") + phases[phase]->effect_ids[input];
+                       string texture_name = string("tex_") + phases[phase]->effect_ids[input];
                        glUniform1i(glGetUniformLocation(phases[phase]->glsl_program_num, texture_name.c_str()), sampler);
                        check_error();
                }
@@ -1563,7 +1565,7 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                }
        }
 
-       for (std::map<Phase *, GLuint>::const_iterator texture_it = output_textures.begin();
+       for (map<Phase *, GLuint>::const_iterator texture_it = output_textures.begin();
             texture_it != output_textures.end();
             ++texture_it) {
                resource_pool->release_2d_texture(texture_it->second);
index c64c7b55311e25c81c333875015fa9e1ca6e3cc2..fed8b91b693f42ef6796307d3039d3d29d668663 100644 (file)
@@ -16,6 +16,8 @@
 #include "test_util.h"
 #include "util.h"
 
+using namespace std;
+
 TEST(EffectChainTest, EmptyChain) {
        float data[] = {
                0.0f, 0.25f, 0.3f,
@@ -32,8 +34,8 @@ TEST(EffectChainTest, EmptyChain) {
 class IdentityEffect : public Effect {
 public:
        IdentityEffect() {}
-       virtual std::string effect_type_id() const { return "IdentityEffect"; }
-       std::string output_fragment_shader() { return read_file("identity.frag"); }
+       virtual string effect_type_id() const { return "IdentityEffect"; }
+       string output_fragment_shader() { return read_file("identity.frag"); }
 };
 
 TEST(EffectChainTest, Identity) {
@@ -53,8 +55,8 @@ TEST(EffectChainTest, Identity) {
 class BouncingIdentityEffect : public Effect {
 public:
        BouncingIdentityEffect() {}
-       virtual std::string effect_type_id() const { return "IdentityEffect"; }
-       std::string output_fragment_shader() { return read_file("identity.frag"); }
+       virtual string effect_type_id() const { return "IdentityEffect"; }
+       string output_fragment_shader() { return read_file("identity.frag"); }
        bool needs_texture_bounce() const { return true; }
        AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
 };
@@ -93,8 +95,8 @@ TEST(MirrorTest, BasicTest) {
 class InvertEffect : public Effect {
 public:
        InvertEffect() {}
-       virtual std::string effect_type_id() const { return "InvertEffect"; }
-       std::string output_fragment_shader() { return read_file("invert_effect.frag"); }
+       virtual string effect_type_id() const { return "InvertEffect"; }
+       string output_fragment_shader() { return read_file("invert_effect.frag"); }
 
        // A real invert would actually care about its alpha,
        // but in this unit test, it only complicates things.
@@ -108,8 +110,8 @@ template<class T>
 class RewritingEffect : public Effect {
 public:
        RewritingEffect() : effect(new T()), replaced_node(NULL) {}
-       virtual std::string effect_type_id() const { return "RewritingEffect[" + effect->effect_type_id() + "]"; }
-       std::string output_fragment_shader() { EXPECT_TRUE(false); return read_file("identity.frag"); }
+       virtual string effect_type_id() const { return "RewritingEffect[" + effect->effect_type_id() + "]"; }
+       string output_fragment_shader() { EXPECT_TRUE(false); return read_file("identity.frag"); }
        virtual void rewrite_graph(EffectChain *graph, Node *self) {
                replaced_node = graph->add_node(effect);
                graph->replace_receiver(self, replaced_node);
@@ -202,7 +204,7 @@ public:
            : FlatInput(format, pixel_format, type, width, height),
              overridden_color_space(format.color_space),
              overridden_gamma_curve(format.gamma_curve) {}
-       virtual std::string effect_type_id() const { return "UnknownColorspaceInput"; }
+       virtual string effect_type_id() const { return "UnknownColorspaceInput"; }
 
        void set_color_space(Colorspace colorspace) {
                overridden_color_space = colorspace;
@@ -387,8 +389,8 @@ TEST(EffectChainTest, NoAlphaConversionsWhenPremultipliedAlphaNotNeeded) {
 class BlueInput : public Input {
 public:
        BlueInput() { register_int("needs_mipmaps", &needs_mipmaps); }
-       virtual std::string effect_type_id() const { return "IdentityEffect"; }
-       std::string output_fragment_shader() { return read_file("blue.frag"); }
+       virtual string effect_type_id() const { return "IdentityEffect"; }
+       string output_fragment_shader() { return read_file("blue.frag"); }
        virtual AlphaHandling alpha_handling() const { return OUTPUT_BLANK_ALPHA; }
        virtual void finalize() {}
        virtual bool can_output_linear_gamma() const { return true; }
@@ -406,8 +408,8 @@ private:
 class RewritingToBlueInput : public Input {
 public:
        RewritingToBlueInput() : blue_node(NULL) { register_int("needs_mipmaps", &needs_mipmaps); }
-       virtual std::string effect_type_id() const { return "RewritingToBlueInput"; }
-       std::string output_fragment_shader() { EXPECT_TRUE(false); return read_file("identity.frag"); }
+       virtual string effect_type_id() const { return "RewritingToBlueInput"; }
+       string output_fragment_shader() { EXPECT_TRUE(false); return read_file("identity.frag"); }
        virtual void rewrite_graph(EffectChain *graph, Node *self) {
                Node *blue_node = graph->add_node(new BlueInput());
                graph->replace_receiver(self, blue_node);
@@ -457,8 +459,8 @@ TEST(EffectChainTest, NoAlphaConversionsWithBlankAlpha) {
 class BlankAlphaPreservingEffect : public Effect {
 public:
        BlankAlphaPreservingEffect() {}
-       virtual std::string effect_type_id() const { return "BlankAlphaPreservingEffect"; }
-       std::string output_fragment_shader() { return read_file("identity.frag"); }
+       virtual string effect_type_id() const { return "BlankAlphaPreservingEffect"; }
+       string output_fragment_shader() { return read_file("identity.frag"); }
        virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
 };
 
@@ -517,9 +519,9 @@ class MipmapNeedingEffect : public Effect {
 public:
        MipmapNeedingEffect() {}
        virtual bool needs_mipmaps() const { return true; }
-       virtual std::string effect_type_id() const { return "MipmapNeedingEffect"; }
-       std::string output_fragment_shader() { return read_file("mipmap_needing_effect.frag"); }
-       void set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num)
+       virtual string effect_type_id() const { return "MipmapNeedingEffect"; }
+       string output_fragment_shader() { return read_file("mipmap_needing_effect.frag"); }
+       void set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num)
        {
                glActiveTexture(GL_TEXTURE0);
                check_error();
@@ -643,8 +645,8 @@ TEST(EffectChainTest, ResizeDownByFourThenUpByFour) {
 class AddEffect : public Effect {
 public:
        AddEffect() {}
-       virtual std::string effect_type_id() const { return "AddEffect"; }
-       std::string output_fragment_shader() { return read_file("add.frag"); }
+       virtual string effect_type_id() const { return "AddEffect"; }
+       string output_fragment_shader() { return read_file("add.frag"); }
        virtual unsigned num_inputs() const { return 2; }
        virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
 };
@@ -824,7 +826,7 @@ public:
                input_width = width;
                input_height = height;
        }
-       virtual std::string effect_type_id() const { return "SizeStoringEffect"; }
+       virtual string effect_type_id() const { return "SizeStoringEffect"; }
 
        int input_width, input_height;
 };
@@ -913,8 +915,8 @@ public:
                  height(height),
                  virtual_width(virtual_width),
                  virtual_height(virtual_height) {}
-       virtual std::string effect_type_id() const { return "VirtualResizeEffect"; }
-       std::string output_fragment_shader() { return read_file("identity.frag"); }
+       virtual string effect_type_id() const { return "VirtualResizeEffect"; }
+       string output_fragment_shader() { return read_file("identity.frag"); }
 
        virtual bool changes_output_size() const { return true; }
 
index e57a562f870da38f93a07243caf801fa11d48b58..f49b47707bde4920fbace424fca80113c979de59 100644 (file)
@@ -4,13 +4,15 @@
 #include <string>
 #include "util.h"
 
-GLint get_uniform_location(GLuint glsl_program_num, const std::string &prefix, const std::string &key)
+using namespace std;
+
+GLint get_uniform_location(GLuint glsl_program_num, const string &prefix, const string &key)
 {
-       std::string name = prefix + "_" + key;
+       string name = prefix + "_" + key;
        return glGetUniformLocation(glsl_program_num, name.c_str());
 }
 
-void set_uniform_int(GLuint glsl_program_num, const std::string &prefix, const std::string &key, int value)
+void set_uniform_int(GLuint glsl_program_num, const string &prefix, const string &key, int value)
 {
        GLint location = get_uniform_location(glsl_program_num, prefix, key);
        if (location == -1) {
@@ -21,7 +23,7 @@ void set_uniform_int(GLuint glsl_program_num, const std::string &prefix, const s
        check_error();
 }
 
-void set_uniform_float(GLuint glsl_program_num, const std::string &prefix, const std::string &key, float value)
+void set_uniform_float(GLuint glsl_program_num, const string &prefix, const string &key, float value)
 {
        GLint location = get_uniform_location(glsl_program_num, prefix, key);
        if (location == -1) {
@@ -32,7 +34,7 @@ void set_uniform_float(GLuint glsl_program_num, const std::string &prefix, const
        check_error();
 }
 
-void set_uniform_vec2(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values)
+void set_uniform_vec2(GLuint glsl_program_num, const string &prefix, const string &key, const float *values)
 {
        GLint location = get_uniform_location(glsl_program_num, prefix, key);
        if (location == -1) {
@@ -43,7 +45,7 @@ void set_uniform_vec2(GLuint glsl_program_num, const std::string &prefix, const
        check_error();
 }
 
-void set_uniform_vec3(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values)
+void set_uniform_vec3(GLuint glsl_program_num, const string &prefix, const string &key, const float *values)
 {
        GLint location = get_uniform_location(glsl_program_num, prefix, key);
        if (location == -1) {
@@ -54,7 +56,7 @@ void set_uniform_vec3(GLuint glsl_program_num, const std::string &prefix, const
        check_error();
 }
 
-void set_uniform_vec4(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values)
+void set_uniform_vec4(GLuint glsl_program_num, const string &prefix, const string &key, const float *values)
 {
        GLint location = get_uniform_location(glsl_program_num, prefix, key);
        if (location == -1) {
@@ -65,7 +67,7 @@ void set_uniform_vec4(GLuint glsl_program_num, const std::string &prefix, const
        check_error();
 }
 
-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_vec4_array(GLuint glsl_program_num, const string &prefix, const string &key, const float *values, size_t num_values)
 {
        GLint location = get_uniform_location(glsl_program_num, prefix, key);
        if (location == -1) {
@@ -76,7 +78,7 @@ void set_uniform_vec4_array(GLuint glsl_program_num, const std::string &prefix,
        check_error();
 }
 
-void set_uniform_mat3(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const Eigen::Matrix3d& matrix)
+void set_uniform_mat3(GLuint glsl_program_num, const string &prefix, const string &key, const Eigen::Matrix3d& matrix)
 {
        GLint location = get_uniform_location(glsl_program_num, prefix, key);
        if (location == -1) {
index a3de3792b380060f1c6effe112bfd5a1d0270344..b3c3cf6a32c553087ac8fb52c923347b5c8010ce 100644 (file)
@@ -4,6 +4,8 @@
 #include "effect_util.h"
 #include "util.h"
 
+using namespace std;
+
 FFTPassEffect::FFTPassEffect()
        : input_width(1280),
          input_height(720),
@@ -21,14 +23,14 @@ FFTPassEffect::~FFTPassEffect()
        glDeleteTextures(1, &tex);
 }
 
-std::string FFTPassEffect::output_fragment_shader()
+string FFTPassEffect::output_fragment_shader()
 {
        char buf[256];
        sprintf(buf, "#define DIRECTION_VERTICAL %d\n", (direction == VERTICAL));
        return buf + read_file("fft_pass_effect.frag");
 }
 
-void FFTPassEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void FFTPassEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index 0a8139224c2feb037fa177fa31f32dfcbcde627c..70cc10984cc2b2397f4ee109853cdf5bc0ccfc08 100644 (file)
@@ -7,6 +7,8 @@
 #include "resource_pool.h"
 #include "util.h"
 
+using namespace std;
+
 FlatInput::FlatInput(ImageFormat image_format, MovitPixelFormat pixel_format, GLenum type, unsigned width, unsigned height)
        : image_format(image_format),
           pixel_format(pixel_format),
@@ -64,7 +66,7 @@ void FlatInput::finalize()
        finalized = true;
 }
        
-void FlatInput::set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num)
+void FlatInput::set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num)
 {
        glActiveTexture(GL_TEXTURE0 + *sampler_num);
        check_error();
@@ -108,7 +110,7 @@ void FlatInput::set_gl_state(GLuint glsl_program_num, const std::string& prefix,
        ++*sampler_num;
 }
 
-std::string FlatInput::output_fragment_shader()
+string FlatInput::output_fragment_shader()
 {
        return read_file("flat_input.frag");
 }
index b1a16a6f33af1523dcbcd81eaccb77d31f583b0f..3d4fd12d39af9e869b064c2603b73796026fb5e8 100644 (file)
@@ -6,13 +6,15 @@
 #include "effect_util.h"
 #include "util.h"
 
+using namespace std;
+
 GammaCompressionEffect::GammaCompressionEffect()
        : destination_curve(GAMMA_LINEAR)
 {
        register_int("destination_curve", (int *)&destination_curve);
 }
 
-std::string GammaCompressionEffect::output_fragment_shader()
+string GammaCompressionEffect::output_fragment_shader()
 {
        if (destination_curve == GAMMA_LINEAR) {
                return read_file("identity.frag");
@@ -25,7 +27,7 @@ std::string GammaCompressionEffect::output_fragment_shader()
        assert(false);
 }
 
-void GammaCompressionEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void GammaCompressionEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index bfccaa04b925a3aacd6d359a8b9680a2d1899373..f51dc21c17dad084e98491227fffe35e3e4f474e 100644 (file)
@@ -5,13 +5,15 @@
 #include "gamma_expansion_effect.h"
 #include "util.h"
 
+using namespace std;
+
 GammaExpansionEffect::GammaExpansionEffect()
        : source_curve(GAMMA_LINEAR)
 {
        register_int("source_curve", (int *)&source_curve);
 }
 
-std::string GammaExpansionEffect::output_fragment_shader()
+string GammaExpansionEffect::output_fragment_shader()
 {
        if (source_curve == GAMMA_LINEAR) {
                return read_file("identity.frag");
@@ -24,7 +26,7 @@ std::string GammaExpansionEffect::output_fragment_shader()
        assert(false);
 }
 
-void GammaExpansionEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void GammaExpansionEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index 86a3d7f407cf73c14066a6a1e9cbe2bef09afcc5..2cc6d0101478ef508e8c86da729935cf5b03ce14 100644 (file)
@@ -7,6 +7,8 @@
 #include "mix_effect.h"
 #include "util.h"
 
+using namespace std;
+
 GlowEffect::GlowEffect()
        : blur(new BlurEffect),
          cutoff(new HighlightCutoffEffect),
@@ -35,7 +37,7 @@ void GlowEffect::rewrite_graph(EffectChain *graph, Node *self)
        self->disabled = true;
 }
 
-bool GlowEffect::set_float(const std::string &key, float value) {
+bool GlowEffect::set_float(const string &key, float value) {
        if (key == "blurred_mix_amount") {
                return mix->set_float("strength_second", value);
        }
@@ -51,7 +53,7 @@ HighlightCutoffEffect::HighlightCutoffEffect()
        register_float("cutoff", &cutoff);
 }
 
-std::string HighlightCutoffEffect::output_fragment_shader()
+string HighlightCutoffEffect::output_fragment_shader()
 {
        return read_file("highlight_cutoff_effect.frag");
 }
index aca85b9d404f152b8971230612c696dbc747a11e..df72832e7b63985b50deb266db289d2ade015ef5 100644 (file)
--- a/init.cpp
+++ b/init.cpp
@@ -7,6 +7,8 @@
 #include "init.h"
 #include "util.h"
 
+using namespace std;
+
 bool movit_initialized = false;
 MovitDebugLevel movit_debug_level = MOVIT_DEBUG_ON;
 float movit_texel_subpixel_precision;
@@ -16,7 +18,7 @@ int movit_num_wrongly_rounded;
 // The rules for objects with nontrivial constructors in static scope
 // are somewhat convoluted, and easy to mess up. We simply have a
 // pointer instead (and never care to clean it up).
-std::string *movit_data_directory = NULL;
+string *movit_data_directory = NULL;
 
 namespace {
 
@@ -114,7 +116,7 @@ void measure_texel_subpixel_precision()
        float biggest_jump = 0.0f;
        for (unsigned i = 1; i < width; ++i) {
                assert(out_data[i] >= out_data[i - 1]);
-               biggest_jump = std::max(biggest_jump, out_data[i] - out_data[i - 1]);
+               biggest_jump = max(biggest_jump, out_data[i] - out_data[i - 1]);
        }
 
        movit_texel_subpixel_precision = biggest_jump;
@@ -275,13 +277,13 @@ void check_extensions()
 
 }  // namespace
 
-void init_movit(const std::string& data_directory, MovitDebugLevel debug_level)
+void init_movit(const string& data_directory, MovitDebugLevel debug_level)
 {
        if (movit_initialized) {
                return;
        }
 
-       movit_data_directory = new std::string(data_directory);
+       movit_data_directory = new string(data_directory);
        movit_debug_level = debug_level;
 
        glewInit();
index f00da879dce630d6d2f0e95d176da455ce9fbbbd..5bc989aba08fbb5e2a5291cfcbf142469705f57f 100644 (file)
@@ -5,6 +5,8 @@
 #include "lift_gamma_gain_effect.h"
 #include "util.h"
 
+using namespace std;
+
 LiftGammaGainEffect::LiftGammaGainEffect()
        : lift(0.0f, 0.0f, 0.0f),
          gamma(1.0f, 1.0f, 1.0f),
@@ -15,12 +17,12 @@ LiftGammaGainEffect::LiftGammaGainEffect()
        register_vec3("gain", (float *)&gain);
 }
 
-std::string LiftGammaGainEffect::output_fragment_shader()
+string LiftGammaGainEffect::output_fragment_shader()
 {
        return read_file("lift_gamma_gain_effect.frag");
 }
 
-void LiftGammaGainEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void LiftGammaGainEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index 7c9875a8153a1fd5404784b1bedd2a65b86d22f3..2aa1fea4415fe8ae1ffa79b0da7c8bc1010c48fe 100644 (file)
@@ -1,11 +1,13 @@
 #include "mirror_effect.h"
 #include "util.h"
 
+using namespace std;
+
 MirrorEffect::MirrorEffect()
 {
 }
 
-std::string MirrorEffect::output_fragment_shader()
+string MirrorEffect::output_fragment_shader()
 {
        return read_file("mirror_effect.frag");
 }
index 0f80a8f784ee1f2ed1575e9b784594dd728c4647..6e279cbebaac173979738b9a56bab1fd4da9b26a 100644 (file)
@@ -1,6 +1,8 @@
 #include "mix_effect.h"
 #include "util.h"
 
+using namespace std;
+
 MixEffect::MixEffect()
        : strength_first(0.5f), strength_second(0.5f)
 {
@@ -8,7 +10,7 @@ MixEffect::MixEffect()
        register_float("strength_second", &strength_second);
 }
 
-std::string MixEffect::output_fragment_shader()
+string MixEffect::output_fragment_shader()
 {
        return read_file("mix_effect.frag");
 }
index f3610d3c5a194761ef6a30d1239e3cadf85da015..3e3581053697e7690973c379976492f51e44d143 100644 (file)
@@ -3,13 +3,15 @@
 #include "multiply_effect.h"
 #include "util.h"
 
+using namespace std;
+
 MultiplyEffect::MultiplyEffect()
        : factor(1.0f, 1.0f, 1.0f, 1.0f)
 {
        register_vec4("factor", (float *)&factor);
 }
 
-std::string MultiplyEffect::output_fragment_shader()
+string MultiplyEffect::output_fragment_shader()
 {
        return read_file("multiply_effect.frag");
 }
index 799c359739adbe9ecca559874d3c9a058ae29d20..09c16389cf39cece08c3c0fab88a0c839eb17592 100644 (file)
@@ -1,9 +1,11 @@
 #include "overlay_effect.h"
 #include "util.h"
 
+using namespace std;
+
 OverlayEffect::OverlayEffect() {}
 
-std::string OverlayEffect::output_fragment_shader()
+string OverlayEffect::output_fragment_shader()
 {
        return read_file("overlay_effect.frag");
 }
index 00d475ac2fb23995780920569ee09203abb91177..9d93aca26f141149df80889472c2b6237aefed6b 100644 (file)
@@ -5,6 +5,8 @@
 #include "padding_effect.h"
 #include "util.h"
 
+using namespace std;
+
 PaddingEffect::PaddingEffect()
        : border_color(0.0f, 0.0f, 0.0f, 0.0f),
          output_width(1280),
@@ -19,12 +21,12 @@ PaddingEffect::PaddingEffect()
        register_float("left", &left);
 }
 
-std::string PaddingEffect::output_fragment_shader()
+string PaddingEffect::output_fragment_shader()
 {
        return read_file("padding_effect.frag");
 }
 
-void PaddingEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void PaddingEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index c2ef531d3dee6b9fa272bebfe2f97086ce23126a..6c490f141bc1a87b9f86db44b90b5d64f75d0dd7 100644 (file)
@@ -13,6 +13,8 @@
 #include "resample_effect.h"
 #include "util.h"
 
+using namespace std;
+
 namespace {
 
 float sinc(float x)
@@ -155,7 +157,7 @@ void ResampleEffect::update_size()
        assert(ok);
 }
 
-bool ResampleEffect::set_float(const std::string &key, float value) {
+bool ResampleEffect::set_float(const string &key, float value) {
        if (key == "width") {
                output_width = value;
                update_size();
@@ -193,7 +195,7 @@ SingleResamplePassEffect::~SingleResamplePassEffect()
        glDeleteTextures(1, &texnum);
 }
 
-std::string SingleResamplePassEffect::output_fragment_shader()
+string SingleResamplePassEffect::output_fragment_shader()
 {
        char buf[256];
        sprintf(buf, "#define DIRECTION_VERTICAL %d\n", (direction == VERTICAL));
@@ -212,7 +214,7 @@ std::string SingleResamplePassEffect::output_fragment_shader()
 //
 // For horizontal scaling, we fill in the exact same texture;
 // the shader just interprets it differently.
-void SingleResamplePassEffect::update_texture(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void SingleResamplePassEffect::update_texture(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        unsigned src_size, dst_size;
        if (direction == SingleResamplePassEffect::HORIZONTAL) {
@@ -286,7 +288,7 @@ void SingleResamplePassEffect::update_texture(GLuint glsl_program_num, const std
        // Anyhow, in this case we clearly need to look at more source pixels
        // to compute the destination pixel, and how many depend on the scaling factor.
        // Thus, the kernel width will vary with how much we scale.
-       float radius_scaling_factor = std::min(float(dst_size) / float(src_size), 1.0f);
+       float radius_scaling_factor = min(float(dst_size) / float(src_size), 1.0f);
        int int_radius = lrintf(LANCZOS_RADIUS / radius_scaling_factor);
        int src_samples = int_radius * 2 + 1;
        float *weights = new float[dst_samples * src_samples * 2];
@@ -316,7 +318,7 @@ void SingleResamplePassEffect::update_texture(GLuint glsl_program_num, const std
        src_bilinear_samples = 0;
        for (unsigned y = 0; y < dst_samples; ++y) {
                unsigned num_samples_saved = combine_samples(weights + (y * src_samples) * 2, NULL, src_samples, UINT_MAX);
-               src_bilinear_samples = std::max<int>(src_bilinear_samples, src_samples - num_samples_saved);
+               src_bilinear_samples = max<int>(src_bilinear_samples, src_samples - num_samples_saved);
        }
 
        // Now that we know the right width, actually combine the samples.
@@ -348,7 +350,7 @@ void SingleResamplePassEffect::update_texture(GLuint glsl_program_num, const std
        delete[] bilinear_weights;
 }
 
-void SingleResamplePassEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void SingleResamplePassEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index 1141fbad571b3285331d39b787ce12f78debcf14..70efea0d78e36b3218d8a0686fd896df9cb1d15a 100644 (file)
@@ -1,6 +1,8 @@
 #include "resize_effect.h"
 #include "util.h"
 
+using namespace std;
+
 ResizeEffect::ResizeEffect()
        : width(1280), height(720)
 {
@@ -8,7 +10,7 @@ ResizeEffect::ResizeEffect()
        register_int("height", &height);
 }
 
-std::string ResizeEffect::output_fragment_shader()
+string ResizeEffect::output_fragment_shader()
 {
        return read_file("identity.frag");
 }
index 6eadd9069538a473a7e419f2b60a27f1df331743..b074247e8d772bc6f4b00bbb817f1363e15baaf0 100644 (file)
@@ -50,7 +50,7 @@ ResourcePool::~ResourcePool()
 void ResourcePool::delete_program(GLuint glsl_program_num)
 {
        bool found_program = false;
-       for (std::map<std::pair<std::string, std::string>, GLuint>::iterator program_it = programs.begin();
+       for (map<pair<string, string>, GLuint>::iterator program_it = programs.begin();
             program_it != programs.end();
             ++program_it) {
                if (program_it->second == glsl_program_num) {
@@ -62,7 +62,7 @@ void ResourcePool::delete_program(GLuint glsl_program_num)
        assert(found_program);
        glDeleteProgram(glsl_program_num);
 
-       std::map<GLuint, std::pair<GLuint, GLuint> >::iterator shader_it =
+       map<GLuint, pair<GLuint, GLuint> >::iterator shader_it =
                program_shaders.find(glsl_program_num);
        assert(shader_it != program_shaders.end());
 
index 6aafb74d2b5f543cfcd98f4cd0311e0b39ebfb00..840611eb51f958efb269e4ad29096c5625fa8cbb 100644 (file)
@@ -3,18 +3,20 @@
 #include "sandbox_effect.h"
 #include "util.h"
 
+using namespace std;
+
 SandboxEffect::SandboxEffect()
        : parm(0.0f)
 {
        register_float("parm", &parm);
 }
 
-std::string SandboxEffect::output_fragment_shader()
+string SandboxEffect::output_fragment_shader()
 {
        return read_file("sandbox_effect.frag");
 }
 
-void SandboxEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void SandboxEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index 3eff6e474e5fe368f0ca927eb1ae92368817ecb7..637da862ad297889fc2051644041e26304fbf2d0 100644 (file)
@@ -3,13 +3,15 @@
 #include "saturation_effect.h"
 #include "util.h"
 
+using namespace std;
+
 SaturationEffect::SaturationEffect()
        : saturation(1.0f)
 {
        register_float("saturation", &saturation);
 }
 
-std::string SaturationEffect::output_fragment_shader()
+string SaturationEffect::output_fragment_shader()
 {
        return read_file("saturation_effect.frag");
 }
index eaa5fc6809dc0f131dd0342b86efe8a44e4a40ce..be34583805df68a2da1cedc5e8212eb380bf8cdf 100644 (file)
@@ -11,6 +11,8 @@
 #include "test_util.h"
 #include "util.h"
 
+using namespace std;
+
 class Input;
 
 namespace {
@@ -32,7 +34,7 @@ void vertical_flip(T *data, unsigned width, unsigned height)
        for (unsigned y = 0; y < height / 2; ++y) {
                unsigned flip_y = height - y - 1;
                for (unsigned x = 0; x < width; ++x) {
-                       std::swap(data[y * width + x], data[flip_y * width + x]);
+                       swap(data[y * width + x], data[flip_y * width + x]);
                }
        }
 }
index 7c289253624b49a53ccf9f123ae87407238d71a8..115553b49f998ba0365e556c3a86a2d81df7aa94 100644 (file)
@@ -7,6 +7,8 @@
 #include "unsharp_mask_effect.h"
 #include "util.h"
 
+using namespace std;
+
 UnsharpMaskEffect::UnsharpMaskEffect()
        : blur(new BlurEffect),
          mix(new MixEffect)
@@ -30,7 +32,7 @@ void UnsharpMaskEffect::rewrite_graph(EffectChain *graph, Node *self)
        self->disabled = true;
 }
 
-bool UnsharpMaskEffect::set_float(const std::string &key, float value) {
+bool UnsharpMaskEffect::set_float(const string &key, float value) {
        if (key == "amount") {
                bool ok = mix->set_float("strength_first", 1.0f + value);
                return ok && mix->set_float("strength_second", -value);
index a1fac6da35473ed1a77d64b8ed39bc53a9024a09..6b1de53cc35b52af8094a65a97e442aba43f81f8 100644 (file)
--- a/util.cpp
+++ b/util.cpp
@@ -8,7 +8,9 @@
 #include "init.h"
 #include "util.h"
 
-extern std::string *movit_data_directory;
+using namespace std;
+
+extern string *movit_data_directory;
 
 void hsv2rgb(float h, float s, float v, float *r, float *g, float *b)
 {
@@ -66,9 +68,9 @@ void hsv2rgb_normalized(float h, float s, float v, float *r, float *g, float *b)
        }
 }
 
-std::string read_file(const std::string &filename)
+string read_file(const string &filename)
 {
-       const std::string full_pathname = *movit_data_directory + "/" + filename;
+       const string full_pathname = *movit_data_directory + "/" + filename;
 
        static char buf[131072];
        FILE *fp = fopen(full_pathname.c_str(), "r");
@@ -80,10 +82,10 @@ std::string read_file(const std::string &filename)
        int len = fread(buf, 1, sizeof(buf), fp);
        fclose(fp);
 
-       return std::string(buf, len);
+       return string(buf, len);
 }
 
-GLuint compile_shader(const std::string &shader_src, GLenum type)
+GLuint compile_shader(const string &shader_src, GLenum type)
 {
        GLuint obj = glCreateShader(type);
        const GLchar* source[] = { shader_src.data() };
@@ -116,7 +118,7 @@ void print_3x3_matrix(const Eigen::Matrix3d& m)
        printf("\n");
 }
 
-std::string output_glsl_mat3(const std::string &name, const Eigen::Matrix3d &m)
+string output_glsl_mat3(const string &name, const Eigen::Matrix3d &m)
 {
        char buf[1024];
        sprintf(buf,
index 0f5c688a3702d7f81efffd1696281851eecd5ce1..6a9a340a111cb7977ba0bc584bf380cf704eb160 100644 (file)
@@ -5,6 +5,8 @@
 #include "vignette_effect.h"
 #include "util.h"
 
+using namespace std;
+
 VignetteEffect::VignetteEffect()
        : center(0.5f, 0.5f),
          aspect_correction(1.0f, 1.0f),
@@ -16,7 +18,7 @@ VignetteEffect::VignetteEffect()
        register_float("inner_radius", (float *)&inner_radius);
 }
 
-std::string VignetteEffect::output_fragment_shader()
+string VignetteEffect::output_fragment_shader()
 {
        return read_file("vignette_effect.frag");
 }
@@ -30,7 +32,7 @@ void VignetteEffect::inform_input_size(unsigned input_num, unsigned width, unsig
        }
 }
 
-void VignetteEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void VignetteEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
index 2c99ca85c0b791379bd9e564ce2770df467e4664..53c49e4ffc919b4d8ec6bcb321787a4f53b08613 100644 (file)
@@ -10,6 +10,7 @@
 #include "white_balance_effect.h"
 
 using namespace Eigen;
+using namespace std;
 
 namespace {
 
@@ -103,12 +104,12 @@ WhiteBalanceEffect::WhiteBalanceEffect()
        register_float("output_color_temperature", &output_color_temperature);
 }
 
-std::string WhiteBalanceEffect::output_fragment_shader()
+string WhiteBalanceEffect::output_fragment_shader()
 {
        return read_file("white_balance_effect.frag");
 }
 
-void WhiteBalanceEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void WhiteBalanceEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Matrix3d rgb_to_xyz_matrix = ColorspaceConversionEffect::get_xyz_matrix(COLORSPACE_sRGB);
        Vector3d rgb(neutral_color.r, neutral_color.g, neutral_color.b);
index 4166da9752d35c78b8061a3ca24dabef198c6daf..6e73d3e2015e219e0fc7f1b7a3961515db96e146 100644 (file)
@@ -11,6 +11,7 @@
 #include "ycbcr_input.h"
 
 using namespace Eigen;
+using namespace std;
 
 namespace {
 
@@ -100,7 +101,7 @@ void YCbCrInput::finalize()
        finalized = true;
 }
        
-void YCbCrInput::set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num)
+void YCbCrInput::set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num)
 {
        for (unsigned channel = 0; channel < 3; ++channel) {
                glActiveTexture(GL_TEXTURE0 + *sampler_num + channel);
@@ -144,7 +145,7 @@ void YCbCrInput::set_gl_state(GLuint glsl_program_num, const std::string& prefix
        *sampler_num += 3;
 }
 
-std::string YCbCrInput::output_fragment_shader()
+string YCbCrInput::output_fragment_shader()
 {
        float coeff[3], offset[3], scale[3];
 
@@ -212,7 +213,7 @@ std::string YCbCrInput::output_fragment_shader()
        // Inverting the matrix gives us what we need to go from YCbCr back to RGB.
        Matrix3d ycbcr_to_rgb = rgb_to_ycbcr.inverse();
 
-       std::string frag_shader;
+       string frag_shader;
 
        frag_shader = output_glsl_mat3("PREFIX(inv_ycbcr_matrix)", ycbcr_to_rgb);