]> git.sesse.net Git - movit/commitdiff
Use nullptr everywhere, now that we have C++11.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 15 Nov 2017 19:45:41 +0000 (20:45 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 15 Nov 2017 19:45:41 +0000 (20:45 +0100)
31 files changed:
blur_effect.cpp
blur_effect.h
deconvolution_sharpen_effect.cpp
deinterlace_effect_test.cpp
demo.cpp
effect_chain.cpp
effect_chain.h
effect_chain_test.cpp
fft_convolution_effect_test.cpp
fft_input.cpp
flat_input.cpp
flat_input_test.cpp
gtest_sdl_main.cpp
init.cpp
padding_effect_test.cpp
resample_effect.cpp
resample_effect.h
resample_effect_test.cpp
resource_pool.cpp
slice_effect_test.cpp
test_util.cpp
test_util.h
util.cpp
util.h
ycbcr.cpp
ycbcr.h
ycbcr_422interleaved_input.cpp
ycbcr_422interleaved_input_test.cpp
ycbcr_conversion_effect_test.cpp
ycbcr_input.cpp
ycbcr_input_test.cpp

index 6c1fd3af6ddcab1495e8d0ae53f2635630f07b50..d2178d873706244707a096e5e17b93317a7620f4 100644 (file)
@@ -22,7 +22,7 @@ BlurEffect::BlurEffect()
        // The first blur pass will forward resolution information to us.
        hpass = new SingleBlurPassEffect(this);
        CHECK(hpass->set_int("direction", SingleBlurPassEffect::HORIZONTAL));
-       vpass = new SingleBlurPassEffect(NULL);
+       vpass = new SingleBlurPassEffect(nullptr);
        CHECK(vpass->set_int("direction", SingleBlurPassEffect::VERTICAL));
 
        update_radius();
@@ -111,7 +111,7 @@ SingleBlurPassEffect::SingleBlurPassEffect(BlurEffect *parent)
          direction(HORIZONTAL),
          width(1280),
          height(720),
-         uniform_samples(NULL)
+         uniform_samples(nullptr)
 {
        register_float("radius", &radius);
        register_int("direction", (int *)&direction);
@@ -209,7 +209,7 @@ void SingleBlurPassEffect::set_gl_state(GLuint glsl_program_num, const string &p
 
                float pos1 = base_pos / (float)size;
                float pos, total_weight;
-               combine_two_samples(w1, w2, pos1, 1.0 / (float)size, size, num_subtexels, inv_num_subtexels, &pos, &total_weight, NULL);
+               combine_two_samples(w1, w2, pos1, 1.0 / (float)size, size, num_subtexels, inv_num_subtexels, &pos, &total_weight, nullptr);
 
                uniform_samples[2 * i + 0] = pos;
                uniform_samples[2 * i + 1] = total_weight;
index 8ad3da92dc27bb0f164184b04c042de569714038..69bd663cd27b9b518497a35998d06a6a5260d93e 100644 (file)
@@ -63,7 +63,7 @@ private:
 
 class SingleBlurPassEffect : public Effect {
 public:
-       // If parent is non-NULL, calls to inform_input_size will be forwarded
+       // If parent is non-nullptr, calls to inform_input_size will be forwarded
        // so that it can make reasonable decisions for both blur passes.
        SingleBlurPassEffect(BlurEffect *parent);
        virtual ~SingleBlurPassEffect();
@@ -77,7 +77,7 @@ public:
        virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
 
        virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height) {
-               if (parent != NULL) {
+               if (parent != nullptr) {
                        parent->inform_input_size(input_num, width, height);
                }
        }
index 2db15dc1bc98af9b3e340551028b99b29574321e..37a55e922f8d643f3c0398efe611de1b59dc5779 100644 (file)
@@ -32,7 +32,7 @@ DeconvolutionSharpenEffect::DeconvolutionSharpenEffect()
          last_gaussian_radius(-1.0f),
          last_correlation(-1.0f),
          last_noise(-1.0f),
-         uniform_samples(NULL)
+         uniform_samples(nullptr)
 {
        register_int("matrix_size", &R);
        register_float("circle_radius", &circle_radius);
index d2045eb478cd976d08f080f10fdce54637fc7de6..f880f0fc2629cb131e2f68cab97185fccdd13882 100644 (file)
@@ -33,7 +33,7 @@ TEST(DeinterlaceTest, ConstantColor) {
                0.3f, 0.3f,
        };
        float out_data[12];
-       EffectChainTester tester(NULL, 2, 6);
+       EffectChainTester tester(nullptr, 2, 6);
        Effect *input1 = tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, 2, 3);
        Effect *input2 = tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, 2, 3);
        Effect *input3 = tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, 2, 3);
@@ -79,7 +79,7 @@ TEST(DeinterlaceTest, VerticalInterpolation) {
        fill(neg_blowout_data, neg_blowout_data + width * height, -100.0f);
        fill(pos_blowout_data, pos_blowout_data + width * height,  100.0f);
 
-       EffectChainTester tester(NULL, width, height * 2);
+       EffectChainTester tester(nullptr, width, height * 2);
        Effect *input1 = tester.add_input(neg_blowout_data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
        Effect *input2 = tester.add_input(neg_blowout_data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
        Effect *input3 = tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
@@ -131,7 +131,7 @@ TEST(DeinterlaceTest, DiagonalInterpolation) {
        fill(neg_blowout_data, neg_blowout_data + width * height, -100.0f);
        fill(pos_blowout_data, pos_blowout_data + width * height,  100.0f);
 
-       EffectChainTester tester(NULL, width, height * 2);
+       EffectChainTester tester(nullptr, width, height * 2);
        Effect *input1 = tester.add_input(neg_blowout_data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
        Effect *input2 = tester.add_input(neg_blowout_data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
        Effect *input3 = tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
@@ -172,7 +172,7 @@ TEST(DeinterlaceTest, FlickerBox) {
        float out_data[width * height * 2];
 
        {
-               EffectChainTester tester(NULL, width, height * 2);
+               EffectChainTester tester(nullptr, width, height * 2);
                Effect *white_input = tester.add_input(white_data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
                Effect *black_input = tester.add_input(black_data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
                Effect *deinterlace_effect = tester.get_chain()->add_effect(new DeinterlaceEffect(), white_input, black_input, white_input, black_input, white_input);
@@ -184,7 +184,7 @@ TEST(DeinterlaceTest, FlickerBox) {
        }
 
        {
-               EffectChainTester tester(NULL, width, height * 2);
+               EffectChainTester tester(nullptr, width, height * 2);
                Effect *white_input = tester.add_input(white_data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
                Effect *black_input = tester.add_input(black_data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, height);
                Effect *deinterlace_effect = tester.get_chain()->add_effect(new DeinterlaceEffect(), white_input, black_input, white_input, black_input, white_input);
@@ -217,7 +217,7 @@ void BM_DeinterlaceEffect_Gray(benchmark::State &state)
                field5[i] = rand();
        }
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
        Effect *input1 = tester.add_input(field1, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, field_height);
        Effect *input2 = tester.add_input(field2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, field_height);
        Effect *input3 = tester.add_input(field3, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, width, field_height);
index dd04c84314160ccdec170672ae8244092efaa2ac..53a5d721a56d5bbd16115498d00e0b5f9d30be13 100644 (file)
--- a/demo.cpp
+++ b/demo.cpp
@@ -111,13 +111,13 @@ void mouse(int x, int y)
 unsigned char *load_image(const char *filename, unsigned *w, unsigned *h)
 {
        SDL_Surface *img = IMG_Load(filename);
-       if (img == NULL) {
+       if (img == nullptr) {
                fprintf(stderr, "Load of '%s' failed\n", filename);
                exit(1);
        }
 
        SDL_PixelFormat rgba_fmt;
-       rgba_fmt.palette = NULL;
+       rgba_fmt.palette = nullptr;
        rgba_fmt.BitsPerPixel = 32;
        rgba_fmt.BytesPerPixel = 8;
        rgba_fmt.Rloss = rgba_fmt.Gloss = rgba_fmt.Bloss = rgba_fmt.Aloss = 0;
@@ -151,7 +151,7 @@ unsigned char *load_image(const char *filename, unsigned *w, unsigned *h)
 void write_png(const char *filename, unsigned char *screenbuf)
 {
        FILE *fp = fopen(filename, "wb");
-       png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+       png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, NULL, NULL);
        png_infop info_ptr = png_create_info_struct(png_ptr);
        
        if (setjmp(png_jmpbuf(png_ptr))) {
@@ -169,7 +169,7 @@ void write_png(const char *filename, unsigned char *screenbuf)
 
        png_init_io(png_ptr, fp);
        png_set_rows(png_ptr, info_ptr, row_pointers);
-       png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_BGR, NULL);
+       png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_BGR, nullptr);
        png_destroy_write_struct(&png_ptr, &info_ptr);
        fclose(fp);
 
@@ -200,10 +200,10 @@ int main(int argc, char **argv)
                WIDTH, HEIGHT,
                SDL_WINDOW_OPENGL);
        SDL_GLContext context = SDL_GL_CreateContext(window);
-       assert(context != NULL);
+       assert(context != nullptr);
 #else
        SDL_SetVideoMode(WIDTH, HEIGHT, 0, SDL_OPENGL);
-       SDL_WM_SetCaption("OpenGL window", NULL);
+       SDL_WM_SetCaption("OpenGL window", nullptr);
 #endif
 
        CHECK(init_movit(".", MOVIT_DEBUG_ON));
@@ -243,7 +243,7 @@ int main(int argc, char **argv)
        GLuint pbo;
        glGenBuffers(1, &pbo);
        glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, pbo);
-       glBufferData(GL_PIXEL_PACK_BUFFER_ARB, WIDTH * HEIGHT * 4, NULL, GL_STREAM_READ);
+       glBufferData(GL_PIXEL_PACK_BUFFER_ARB, WIDTH * HEIGHT * 4, nullptr, GL_STREAM_READ);
 
        init_hsv_resources();
        check_error();
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
        clock_gettime(CLOCK_MONOTONIC, &start);
 #else
        struct timeval start, now;
-       gettimeofday(&start, NULL);
+       gettimeofday(&start, nullptr);
 #endif
 
        while (!quit) {
@@ -334,7 +334,7 @@ int main(int argc, char **argv)
                double elapsed = now.tv_sec - start.tv_sec +
                        1e-9 * (now.tv_nsec - start.tv_nsec);
 #else
-               gettimeofday(&now, NULL);
+               gettimeofday(&now, nullptr);
                double elapsed = now.tv_sec - start.tv_sec +
                        1e-6 * (now.tv_usec - start.tv_usec);
 #endif
index a9d9e1e2c437da605bc2997b20f824ce6ca64ee6..0c46768fd5d7db4470430556ee9b3ea7342b4b3c 100644 (file)
@@ -49,8 +49,8 @@ EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *res
          aspect_denom(aspect_denom),
          output_color_rgba(false),
          num_output_color_ycbcr(0),
-         dither_effect(NULL),
-         ycbcr_conversion_effect_node(NULL),
+         dither_effect(nullptr),
+         ycbcr_conversion_effect_node(nullptr),
          intermediate_format(GL_RGBA16F),
          intermediate_transformation(NO_FRAMEBUFFER_TRANSFORMATION),
          num_dither_bits(0),
@@ -58,7 +58,7 @@ EffectChain::EffectChain(float aspect_nom, float aspect_denom, ResourcePool *res
          finalized(false),
          resource_pool(resource_pool),
          do_phase_timing(false) {
-       if (resource_pool == NULL) {
+       if (resource_pool == nullptr) {
                this->resource_pool = new ResourcePool();
                owns_resource_pool = true;
        } else {
@@ -781,7 +781,7 @@ void EffectChain::output_dot(const char *filename)
        }
 
        FILE *fp = fopen(filename, "w");
-       if (fp == NULL) {
+       if (fp == nullptr) {
                perror(filename);
                exit(1);
        }
@@ -825,7 +825,7 @@ void EffectChain::output_dot(const char *filename)
 
                if (nodes[i]->outgoing_links.empty() && !nodes[i]->disabled) {
                        // Output node.
-                       vector<string> labels = get_labels_for_edge(nodes[i], NULL);
+                       vector<string> labels = get_labels_for_edge(nodes[i], nullptr);
                        output_dot_edge(fp, from_node_id, "output", labels);
                }
        }
@@ -838,7 +838,7 @@ vector<string> EffectChain::get_labels_for_edge(const Node *from, const Node *to
 {
        vector<string> labels;
 
-       if (to != NULL && to->effect->needs_texture_bounce()) {
+       if (to != nullptr && to->effect->needs_texture_bounce()) {
                labels.push_back("needs_bounce");
        }
        if (from->effect->changes_output_size()) {
@@ -1880,7 +1880,7 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                        GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
                        assert(status == GL_FRAMEBUFFER_COMPLETE);
                        glViewport(x, y, width, height);
-                       if (dither_effect != NULL) {
+                       if (dither_effect != nullptr) {
                                CHECK(dither_effect->set_int("output_width", width));
                                CHECK(dither_effect->set_int("output_height", height));
                        }
index c292b38b4a0b85642d8d5b7970117a5ae64b11c3..54cf0e5d88869aec8e7e8e812bb0f4a44ec6797e 100644 (file)
@@ -216,11 +216,11 @@ class EffectChain {
 public:
        // Aspect: e.g. 16.0f, 9.0f for 16:9.
        // resource_pool is a pointer to a ResourcePool with which to share shaders
-       // and other resources (see resource_pool.h). If NULL (the default),
+       // and other resources (see resource_pool.h). If nullptr (the default),
        // will create its own that is not shared with anything else. Does not take
        // ownership of the passed-in ResourcePool, but will naturally take ownership
        // of its own internal one if created.
-       EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool = NULL);
+       EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool = nullptr);
        ~EffectChain();
 
        // User API:
@@ -391,7 +391,7 @@ public:
 
        Effect *last_added_effect() {
                if (nodes.empty()) {
-                       return NULL;
+                       return nullptr;
                } else {
                        return nodes.back()->effect;
                }       
index 97b90ed5d331386cbef60725725c8a5d9a49e09b..120087615f03106b65dfa7d33eff28d899d79cc4 100644 (file)
@@ -136,7 +136,7 @@ public:
 template<class T>
 class RewritingEffect : public Effect {
 public:
-       RewritingEffect() : effect(new T()), replaced_node(NULL) {}
+       RewritingEffect() : effect(new T()), replaced_node(nullptr) {}
        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) {
@@ -188,7 +188,7 @@ TEST(EffectChainTest, RewritingWorksAndTexturesAreAskedForsRGB) {
                0.0000f, 0.0000f, 0.0000f, 1.0000f
        };
        float out_data[4 * 4];
-       EffectChainTester tester(NULL, 1, 4);
+       EffectChainTester tester(nullptr, 1, 4);
        tester.add_input(data, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_sRGB);
        RewritingEffect<InvertEffect> *effect = new RewritingEffect<InvertEffect>();
        tester.get_chain()->add_effect(effect);
@@ -262,7 +262,7 @@ TEST(EffectChainTest, HandlesInputChangingColorspace) {
        };
        float out_data[size];
 
-       EffectChainTester tester(NULL, 4, 1, FORMAT_GRAYSCALE);
+       EffectChainTester tester(nullptr, 4, 1, FORMAT_GRAYSCALE);
 
        // First say that we have sRGB, linear input.
        ImageFormat format;
@@ -352,7 +352,7 @@ TEST(EffectChainTest, IdentityThroughGPUsRGBConversions) {
                expected_data[i] = i / 255.0;
        };
        float out_data[256];
-       EffectChainTester tester(NULL, 256, 1);
+       EffectChainTester tester(nullptr, 256, 1);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_sRGB);
        tester.get_chain()->add_effect(new IdentityEffect());
        tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_sRGB);
@@ -438,7 +438,7 @@ private:
 // which outputs blank alpha.
 class RewritingToBlueInput : public Input {
 public:
-       RewritingToBlueInput() : blue_node(NULL) { register_int("needs_mipmaps", &needs_mipmaps); }
+       RewritingToBlueInput() : blue_node(nullptr) { register_int("needs_mipmaps", &needs_mipmaps); }
        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) {
@@ -474,7 +474,7 @@ TEST(EffectChainTest, NoAlphaConversionsWithBlankAlpha) {
                0.0f, 0.0f, 1.0f, 1.0f,
        };
        float out_data[4 * size];
-       EffectChainTester tester(NULL, size, 1);
+       EffectChainTester tester(nullptr, size, 1);
        RewritingToBlueInput *input = new RewritingToBlueInput();
        tester.get_chain()->add_input(input);
        tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
@@ -503,7 +503,7 @@ TEST(EffectChainTest, NoAlphaConversionsWithBlankAlphaPreservingEffect) {
                0.0f, 0.0f, 1.0f, 1.0f,
        };
        float out_data[4 * size];
-       EffectChainTester tester(NULL, size, 1);
+       EffectChainTester tester(nullptr, size, 1);
        tester.get_chain()->add_input(new BlueInput());
        tester.get_chain()->add_effect(new BlankAlphaPreservingEffect());
        RewritingEffect<MirrorEffect> *effect = new RewritingEffect<MirrorEffect>();
@@ -529,7 +529,7 @@ TEST(EffectChainTest, AlphaConversionsWithNonBlankAlphaPreservingEffect) {
                0.0f, 0.0f, 1.0f, 1.0f,
        };
        float out_data[4 * size];
-       EffectChainTester tester(NULL, size, 1);
+       EffectChainTester tester(nullptr, size, 1);
        tester.get_chain()->add_input(new BlueInput());
        tester.get_chain()->add_effect(new IdentityEffect());  // Not BlankAlphaPreservingEffect.
        RewritingEffect<MirrorEffect> *effect = new RewritingEffect<MirrorEffect>();
@@ -684,7 +684,7 @@ TEST(EffectChainTest, MipmapsWithNonMipmapCapableInput) {
                0.25f,    0.25f,    0.25f,    0.25f,
        };
        float out_data[4 * 16];
-       EffectChainTester tester(NULL, 4, 16, FORMAT_GRAYSCALE);
+       EffectChainTester tester(nullptr, 4, 16, FORMAT_GRAYSCALE);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -796,7 +796,7 @@ TEST(EffectChainTest, DiamondGraph) {
        MultiplyEffect *mul_two = new MultiplyEffect();
        ASSERT_TRUE(mul_two->set_vec4("factor", two));
 
-       EffectChainTester tester(NULL, 2, 2);
+       EffectChainTester tester(nullptr, 2, 2);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -847,7 +847,7 @@ TEST(EffectChainTest, DiamondGraphWithOneInputUsedInTwoPhases) {
        
        BouncingIdentityEffect *bounce = new BouncingIdentityEffect();
 
-       EffectChainTester tester(NULL, 2, 2);
+       EffectChainTester tester(nullptr, 2, 2);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -877,7 +877,7 @@ TEST(EffectChainTest, EffectUsedTwiceOnlyGetsOneGammaConversion) {
        };
        float out_data[2 * 2];
        
-       EffectChainTester tester(NULL, 2, 2);
+       EffectChainTester tester(nullptr, 2, 2);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_sRGB);
 
        // MirrorEffect does not get linear light, so the conversions will be
@@ -910,7 +910,7 @@ TEST(EffectChainTest, EffectUsedTwiceOnlyGetsOneColorspaceConversion) {
        };
        float out_data[2 * 2];
        
-       EffectChainTester tester(NULL, 2, 2);
+       EffectChainTester tester(nullptr, 2, 2);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_REC_601_625, GAMMA_LINEAR);
 
        // MirrorEffect does not get linear light, so the conversions will be
@@ -954,7 +954,7 @@ TEST(EffectChainTest, SameInputsGiveSameOutputs) {
        };
        float out_data[4 * 3];
        
-       EffectChainTester tester(NULL, 4, 3);  // Note non-square aspect.
+       EffectChainTester tester(nullptr, 4, 3);  // Note non-square aspect.
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -999,7 +999,7 @@ TEST(EffectChainTest, AspectRatioConversion) {
        // (keep the height, round the width 9.333 to 9). 
        float out_data[9 * 7];
        
-       EffectChainTester tester(NULL, 4, 3);
+       EffectChainTester tester(nullptr, 4, 3);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -1044,7 +1044,7 @@ TEST(EffectChainTest, FirstPhaseWithNoTextureCoordinates) {
        FlatInput *input = new FlatInput(format, FORMAT_GRAYSCALE, GL_FLOAT, 1, size);
 
        input->set_pixel_data(data);
-       EffectChainTester tester(NULL, 1, size);
+       EffectChainTester tester(nullptr, 1, size);
        tester.get_chain()->add_input(new BlueInput());
        Effect *phase1_end = tester.get_chain()->add_effect(new BouncingIdentityEffect());
        tester.get_chain()->add_input(input);
@@ -1224,7 +1224,7 @@ TEST(EffectChainTest, IdentityWithOwnPool) {
        check_error();
        glBindTexture(GL_TEXTURE_2D, texnum);
        check_error();
-       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_FLOAT, NULL);
+       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_FLOAT, nullptr);
        check_error();
 
        glGenFramebuffers(1, &fbo);
@@ -1282,7 +1282,7 @@ TEST(EffectChainTest, StringStreamLocalesWork) {
        // setlocale() behind-the-scenes, and that might corrupt the returned
        // pointer, so we need to take our own copy of it here.
        char *saved_locale = setlocale(LC_ALL, "nb_NO.UTF_8");
-       if (saved_locale == NULL) {
+       if (saved_locale == nullptr) {
                // The locale wasn't available.
                return;
        }
index 9d395f2e20faf568a4459f8ff0ac22f3d291494c..d1c1626b861670b36d7a52913e0171d71ab7cbf3 100644 (file)
@@ -29,7 +29,7 @@ TEST(FFTConvolutionEffectTest, Identity) {
                }
                kernel[0] = 1.0f;
 
-               EffectChainTester tester(NULL, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+               EffectChainTester tester(nullptr, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
                tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, size, size);
 
                FFTConvolutionEffect *fft_effect = new FFTConvolutionEffect(size, size, convolve_size, convolve_size);
@@ -64,7 +64,7 @@ TEST(FFTConvolutionEffectTest, Constant) {
        }
        kernel[0] = f;
 
-       EffectChainTester tester(NULL, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, size, size);
 
        FFTConvolutionEffect *fft_effect = new FFTConvolutionEffect(size, size, convolve_size, convolve_size);
@@ -98,7 +98,7 @@ TEST(FFTConvolutionEffectTest, MoveRight) {
        };
        float out_data[size * size];
 
-       EffectChainTester tester(NULL, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, size, size);
 
        FFTConvolutionEffect *fft_effect = new FFTConvolutionEffect(size, size, convolve_size, convolve_size);
@@ -131,7 +131,7 @@ TEST(FFTConvolutionEffectTest, MoveDown) {
        };
        float out_data[size * size];
 
-       EffectChainTester tester(NULL, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, size, size);
 
        FFTConvolutionEffect *fft_effect = new FFTConvolutionEffect(size, size, convolve_size, convolve_size);
@@ -164,7 +164,7 @@ TEST(FFTConvolutionEffectTest, MergeWithLeft) {
        };
        float out_data[size * size];
 
-       EffectChainTester tester(NULL, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, size, size);
 
        FFTConvolutionEffect *fft_effect = new FFTConvolutionEffect(size, size, convolve_size, convolve_size);
@@ -197,7 +197,7 @@ TEST(FFTConvolutionEffectTest, NegativeCoefficients) {
        };
        float out_data[size * size];
 
-       EffectChainTester tester(NULL, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, size, size);
 
        FFTConvolutionEffect *fft_effect = new FFTConvolutionEffect(size, size, convolve_width, convolve_height);
index f9339df24779fab2cb37fb00baba51e88f613d4b..bbc4a5fd4ff44a32d291654c3ff615a4866d9801 100644 (file)
@@ -19,7 +19,7 @@ FFTInput::FFTInput(unsigned width, unsigned height)
          fft_height(height),
          convolve_width(width),
          convolve_height(height),
-         pixel_data(NULL)
+         pixel_data(nullptr)
 {
        register_int("fft_width", &fft_width);
        register_int("fft_height", &fft_height);
@@ -39,7 +39,7 @@ void FFTInput::set_gl_state(GLuint glsl_program_num, const string& prefix, unsig
        check_error();
 
        if (texture_num == 0) {
-               assert(pixel_data != NULL);
+               assert(pixel_data != nullptr);
 
                // Do the FFT. Our FFTs should typically be small enough and
                // the data changed often enough that FFTW_ESTIMATE should be
index 8f24d86f9347b408b8edb2a9f24c677155b35591..29165db773793781931a70807b1598bfc5b65daf 100644 (file)
@@ -22,7 +22,7 @@ FlatInput::FlatInput(ImageFormat image_format, MovitPixelFormat pixel_format_in,
          height(height),
          pitch(width),
          owns_texture(false),
-         pixel_data(NULL),
+         pixel_data(nullptr),
          fixup_swap_rb(false),
          fixup_red_to_grayscale(false)
 {
@@ -66,7 +66,7 @@ void FlatInput::set_gl_state(GLuint glsl_program_num, const string& prefix, unsi
        glActiveTexture(GL_TEXTURE0 + *sampler_num);
        check_error();
 
-       if (texture_num == 0 && (pbo != 0 || pixel_data != NULL)) {
+       if (texture_num == 0 && (pbo != 0 || pixel_data != nullptr)) {
                // Translate the input format to OpenGL's enums.
                GLint internal_format;
                GLenum format;
index 2fb807e945d18f1ad3bcc26eb4b28c6d7b05db6a..f01bab82bee0392ed781525b6770d617bf196922 100644 (file)
@@ -109,7 +109,7 @@ TEST(FlatInput, AlphaIsNotModifiedBySRGBConversion) {
        };
        float out_data[4 * size];
 
-        EffectChainTester tester(NULL, 1, size);
+        EffectChainTester tester(nullptr, 1, size);
         tester.add_input(data, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_sRGB);
        tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR);
 
@@ -185,7 +185,7 @@ TEST(FlatInput, Pitch) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -212,7 +212,7 @@ TEST(FlatInput, UpdatedData) {
        };
        float out_data[width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -252,7 +252,7 @@ TEST(FlatInput, PBO) {
        glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, width * height * sizeof(float), data, GL_STREAM_DRAW);
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -287,7 +287,7 @@ TEST(FlatInput, ExternalTexture) {
        };
        float out_data[4 * size];
 
-       EffectChainTester tester(NULL, 1, size, FORMAT_RGB, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, 1, size, FORMAT_RGB, COLORSPACE_sRGB, GAMMA_LINEAR);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -326,7 +326,7 @@ TEST(FlatInput, NoData) {
 
        float out_data[width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
index 70fed134b2ad4b134787c8d26c8875b2ea95ac89..e3051ad3518a86c8c48055d00ed5b694644e32de 100644 (file)
@@ -47,10 +47,10 @@ int main(int argc, char **argv) {
                32, 32,
                SDL_WINDOW_OPENGL);
        SDL_GLContext context = SDL_GL_CreateContext(window);
-       assert(context != NULL);
+       assert(context != nullptr);
 #else
        SDL_SetVideoMode(32, 32, 0, SDL_OPENGL);
-       SDL_WM_SetCaption("OpenGL window for unit test", NULL);
+       SDL_WM_SetCaption("OpenGL window for unit test", nullptr);
 #endif
 
        int err;
index 7f2f5ccf124e668bf3aaa3789be195003c3482fb..44dd7231011d6edccd6988291dee26ff0f49f291 100644 (file)
--- a/init.cpp
+++ b/init.cpp
@@ -22,7 +22,7 @@ MovitShaderModel movit_shader_model;
 // 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).
-string *movit_data_directory = NULL;
+string *movit_data_directory = nullptr;
 
 namespace {
 
@@ -38,7 +38,7 @@ void measure_texel_subpixel_precision()
        check_error();
        glBindTexture(GL_TEXTURE_2D, dst_texnum);
        check_error();
-       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, 1, 0, GL_RGBA, GL_FLOAT, NULL);
+       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, 1, 0, GL_RGBA, GL_FLOAT, nullptr);
        check_error();
 
        glGenFramebuffers(1, &fbo);
@@ -166,7 +166,7 @@ void measure_roundoff_problems()
        check_error();
        glBindTexture(GL_TEXTURE_2D, dst_texnum);
        check_error();
-       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
        check_error();
 
        glGenFramebuffers(1, &fbo);
@@ -329,7 +329,7 @@ double get_glsl_version()
 
        // Skip past the first period.
        char *ptr = strchr(glsl_version_str, '.');
-       assert(ptr != NULL);
+       assert(ptr != nullptr);
        ++ptr;
 
        // Now cut the string off at the next period or space, whatever comes first
@@ -381,7 +381,7 @@ bool init_movit(const string& data_directory, MovitDebugLevel debug_level)
        // You can turn this on if you want detailed debug messages from the driver.
        // You should probably also ask for a debug context (see gtest_sdl_main.cpp),
        // or you might not get much data back.
-       // glDebugMessageCallbackARB(callback, NULL);
+       // glDebugMessageCallbackARB(callback, nullptr);
        // glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);
 
        if (!check_extensions()) {
index 86ce9e9d8feb2b82f8f7c1bf929ac0b8f31e6c87..5fa0e42a77235bae2777476bbe34f928ef62408e 100644 (file)
@@ -26,7 +26,7 @@ TEST(PaddingEffectTest, SimpleCenter) {
        };
        float out_data[4 * 4];
 
-        EffectChainTester tester(NULL, 4, 4);
+        EffectChainTester tester(nullptr, 4, 4);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -59,7 +59,7 @@ TEST(PaddingEffectTest, WhiteBorderColor) {
        };
        float out_data[4 * 4];
 
-        EffectChainTester tester(NULL, 4, 4);
+        EffectChainTester tester(nullptr, 4, 4);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -92,7 +92,7 @@ TEST(PaddingEffectTest, BorderColorIsInLinearGamma) {
        };
        float out_data[4 * 2];
 
-        EffectChainTester tester(NULL, 1, 2);
+        EffectChainTester tester(nullptr, 1, 2);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -126,7 +126,7 @@ TEST(PaddingEffectTest, DifferentXAndYOffset) {
        };
        float out_data[3 * 3];
 
-        EffectChainTester tester(NULL, 3, 3);
+        EffectChainTester tester(nullptr, 3, 3);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -156,7 +156,7 @@ TEST(PaddingEffectTest, NonIntegerOffset) {
        };
        float out_data[5 * 2];
 
-        EffectChainTester tester(NULL, 5, 2);
+        EffectChainTester tester(nullptr, 5, 2);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -186,7 +186,7 @@ TEST(PaddingEffectTest, Crop) {
        };
        float out_data[1 * 1];
 
-        EffectChainTester tester(NULL, 1, 1);
+        EffectChainTester tester(nullptr, 1, 1);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -219,7 +219,7 @@ TEST(PaddingEffectTest, AlphaIsCorrectEvenWithNonLinearInputsAndOutputs) {
        };
        float out_data[4 * 4];
 
-       EffectChainTester tester(NULL, 1, 4);
+       EffectChainTester tester(nullptr, 1, 4);
 
        ImageFormat format;
        format.color_space = COLORSPACE_REC_601_625;
@@ -255,7 +255,7 @@ TEST(PaddingEffectTest, RedBorder) {  // Not black nor white, but still a satura
        };
        float out_data[4 * 4];
 
-       EffectChainTester tester(NULL, 1, 4);
+       EffectChainTester tester(nullptr, 1, 4);
 
        ImageFormat format;
        format.color_space = COLORSPACE_REC_601_625;
@@ -291,7 +291,7 @@ TEST(PaddingEffectTest, BorderOffsetTopAndBottom) {
        };
        float out_data[4 * 4];
 
-        EffectChainTester tester(NULL, 4, 4);
+        EffectChainTester tester(nullptr, 4, 4);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -324,7 +324,7 @@ TEST(PaddingEffectTest, BorderOffsetLeftAndRight) {
        };
        float out_data[4 * 2];
 
-        EffectChainTester tester(NULL, 4, 2);
+        EffectChainTester tester(nullptr, 4, 2);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
index 453a83832f7cb5d905a11b49951ac63a6f14cc12..0a050cf4ae720352641042ac2dc81ad043decc36 100644 (file)
@@ -129,7 +129,7 @@ unsigned combine_samples(const Tap<float> *src, Tap<DestFloat> *dst, float num_s
 
        for (unsigned i = 0, j = 0; i < num_src_samples; ++i, ++j) {
                // Copy the sample directly; it will be overwritten later if we can combine.
-               if (dst != NULL) {
+               if (dst != nullptr) {
                        dst[j].weight = convert_float<float, DestFloat>(src[i].weight);
                        dst[j].pos = convert_float<float, DestFloat>(src[i].pos);
                }
@@ -169,7 +169,7 @@ unsigned combine_samples(const Tap<float> *src, Tap<DestFloat> *dst, float num_s
                }
 
                // OK, we can combine this and the next sample.
-               if (dst != NULL) {
+               if (dst != nullptr) {
                        dst[j].weight = total_weight;
                        dst[j].pos = pos;
                }
@@ -215,13 +215,13 @@ unsigned combine_many_samples(const Tap<float> *weights, unsigned src_size, unsi
 
        unsigned max_samples_saved = UINT_MAX;
        for (unsigned y = 0; y < dst_samples && max_samples_saved > 0; ++y) {
-               unsigned num_samples_saved = combine_samples<DestFloat>(weights + y * src_samples, NULL, num_subtexels, inv_num_subtexels, src_samples, max_samples_saved, pos1_pos2_diff, inv_pos1_pos2_diff);
+               unsigned num_samples_saved = combine_samples<DestFloat>(weights + y * src_samples, nullptr, num_subtexels, inv_num_subtexels, src_samples, max_samples_saved, pos1_pos2_diff, inv_pos1_pos2_diff);
                max_samples_saved = min(max_samples_saved, num_samples_saved);
        }
 
        // Now that we know the right width, actually combine the samples.
        unsigned src_bilinear_samples = src_samples - max_samples_saved;
-       if (*bilinear_weights != NULL) delete[] *bilinear_weights;
+       if (*bilinear_weights != nullptr) delete[] *bilinear_weights;
        *bilinear_weights = new Tap<DestFloat>[dst_samples * src_bilinear_samples];
        for (unsigned y = 0; y < dst_samples; ++y) {
                Tap<DestFloat> *bilinear_weights_ptr = *bilinear_weights + y * src_bilinear_samples;
@@ -314,7 +314,7 @@ ResampleEffect::ResampleEffect()
        // The first blur pass will forward resolution information to us.
        hpass = new SingleResamplePassEffect(this);
        CHECK(hpass->set_int("direction", SingleResamplePassEffect::HORIZONTAL));
-       vpass = new SingleResamplePassEffect(NULL);
+       vpass = new SingleResamplePassEffect(nullptr);
        CHECK(vpass->set_int("direction", SingleResamplePassEffect::VERTICAL));
 
        update_size();
@@ -537,8 +537,8 @@ void SingleResamplePassEffect::update_texture(GLuint glsl_program_num, const str
 
        GLenum type, internal_format;
        void *pixels;
-       assert((weights.bilinear_weights_fp16 == NULL) != (weights.bilinear_weights_fp32 == NULL));
-       if (weights.bilinear_weights_fp32 != NULL) {
+       assert((weights.bilinear_weights_fp16 == nullptr) != (weights.bilinear_weights_fp32 == NULL));
+       if (weights.bilinear_weights_fp32 != nullptr) {
                type = GL_FLOAT;
                internal_format = GL_RG32F;
                pixels = weights.bilinear_weights_fp32;
@@ -670,9 +670,9 @@ ScalingWeights calculate_scaling_weights(unsigned src_size, unsigned dst_size, f
        // Our tolerance level for total error is a bit higher than the one for invididual
        // samples, since one would assume overall errors in the shape don't matter as much.
        const float max_error = 2.0f / (255.0f * 255.0f);
-       Tap<fp16_int_t> *bilinear_weights_fp16 = NULL;
+       Tap<fp16_int_t> *bilinear_weights_fp16 = nullptr;
        int src_bilinear_samples = combine_many_samples(weights, src_size, src_samples, dst_samples, &bilinear_weights_fp16);
-       Tap<float> *bilinear_weights_fp32 = NULL;
+       Tap<float> *bilinear_weights_fp32 = nullptr;
        double max_sum_sq_error_fp16 = 0.0;
        for (unsigned y = 0; y < dst_samples; ++y) {
                double sum_sq_error_fp16 = compute_sum_sq_error(
@@ -687,7 +687,7 @@ ScalingWeights calculate_scaling_weights(unsigned src_size, unsigned dst_size, f
 
        if (max_sum_sq_error_fp16 > max_error) {
                delete[] bilinear_weights_fp16;
-               bilinear_weights_fp16 = NULL;
+               bilinear_weights_fp16 = nullptr;
                src_bilinear_samples = combine_many_samples(weights, src_size, src_samples, dst_samples, &bilinear_weights_fp32);
        }
 
index ceae920aa71c98a0799a8423f173bc9e13c25876..a8e37e4083dac02a849e9e75a09ee43873d89d05 100644 (file)
@@ -87,7 +87,7 @@ private:
 
 class SingleResamplePassEffect : public Effect {
 public:
-       // If parent is non-NULL, calls to inform_input_size will be forwarded,
+       // If parent is non-nullptr, calls to inform_input_size will be forwarded,
        // so that it can inform both passes about the right input and output
        // resolutions.
        SingleResamplePassEffect(ResampleEffect *parent);
@@ -102,7 +102,7 @@ public:
 
        virtual void inform_added(EffectChain *chain) { this->chain = chain; }
        virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height) {
-               if (parent != NULL) {
+               if (parent != nullptr) {
                        parent->inform_input_size(input_num, width, height);
                }
        }
index 02d9d74d1102ace6a956331bac2280f8a368060f..9678aa015cadfff872f0a17950f8c1f537e7c36b 100644 (file)
@@ -70,7 +70,7 @@ TEST(ResampleEffectTest, UpscaleByTwoGetsCorrectPixelCenters) {
                }
        }
 
-       EffectChainTester tester(NULL, size * 2, size * 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, size * 2, size * 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -112,7 +112,7 @@ TEST(ResampleEffectTest, DownscaleByTwoGetsCorrectPixelCenters) {
                }
        }
 
-       EffectChainTester tester(NULL, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -142,7 +142,7 @@ TEST(ResampleEffectTest, UpscaleByThreeGetsCorrectPixelCenters) {
        };
        float out_data[size * size * 9];
 
-       EffectChainTester tester(NULL, size * 3, size * 3, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, size * 3, size * 3, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -187,7 +187,7 @@ TEST(ResampleEffectTest, HeavyResampleGetsSumRight) {
                }
        }
 
-       EffectChainTester tester(NULL, dwidth, dheight, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA32F);
+       EffectChainTester tester(nullptr, dwidth, dheight, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA32F);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -317,7 +317,7 @@ TEST(ResampleEffectTest, ReadHalfPixelFromLeftAndScale) {
        };
        float out_data[dst_width * 1];
 
-       EffectChainTester tester(NULL, dst_width, 1, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, dst_width, 1, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
index b9adda7c337221ebbfc7764e9a93b69192e1ac95..10ab7886a549f692493cf9b8c558c46ff328d1be 100644 (file)
@@ -26,7 +26,7 @@ ResourcePool::ResourcePool(size_t program_freelist_max_length,
          vao_freelist_max_length(vao_freelist_max_length),
          texture_freelist_bytes(0)
 {
-       pthread_mutex_init(&lock, NULL);
+       pthread_mutex_init(&lock, nullptr);
 }
 
 ResourcePool::~ResourcePool()
@@ -182,7 +182,7 @@ GLuint ResourcePool::link_program(GLuint vs_obj,
        glGetProgramiv(glsl_program_num, GL_LINK_STATUS, &success);
        if (success == GL_FALSE) {
                GLchar error_log[1024] = {0};
-               glGetProgramInfoLog(glsl_program_num, 1024, NULL, error_log);
+               glGetProgramInfoLog(glsl_program_num, 1024, nullptr, error_log);
                fprintf(stderr, "Error linking program: %s\n", error_log);
                exit(1);
        }
@@ -252,7 +252,7 @@ GLuint ResourcePool::link_compute_program(GLuint cs_obj)
        glGetProgramiv(glsl_program_num, GL_LINK_STATUS, &success);
        if (success == GL_FALSE) {
                GLchar error_log[1024] = {0};
-               glGetProgramInfoLog(glsl_program_num, 1024, NULL, error_log);
+               glGetProgramInfoLog(glsl_program_num, 1024, nullptr, error_log);
                fprintf(stderr, "Error linking program: %s\n", error_log);
                exit(1);
        }
@@ -336,7 +336,7 @@ GLuint ResourcePool::create_2d_texture(GLint internal_format, GLsizei width, GLs
        }
 
        // Find any reasonable format given the internal format; OpenGL validates it
-       // even though we give NULL as pointer.
+       // even though we give nullptr as pointer.
        GLenum format;
        switch (internal_format) {
        case GL_RGBA32F_ARB:
@@ -420,7 +420,7 @@ GLuint ResourcePool::create_2d_texture(GLint internal_format, GLsizei width, GLs
        check_error();
        glBindTexture(GL_TEXTURE_2D, texture_num);
        check_error();
-       glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, type, NULL);
+       glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, type, nullptr);
        check_error();
        glBindTexture(GL_TEXTURE_2D, 0);
        check_error();
@@ -710,7 +710,7 @@ void ResourcePool::output_debug_shader(const string &shader_src, const string &s
                char filename[256];
                sprintf(filename, "chain-%03d.%s", compiled_shader_num++, suffix.c_str());
                FILE *fp = fopen(filename, "w");
-               if (fp == NULL) {
+               if (fp == nullptr) {
                        perror(filename);
                        exit(1);
                }
index 477c7a72543c378071c13b77233f64b26b8f0f8b..163561e7a769b47c1e10342fc1eb973f2e988d4e 100644 (file)
@@ -26,7 +26,7 @@ TEST(SliceEffectTest, Identity) {
        };
        float out_data[output_size * size];
 
-       EffectChainTester tester(NULL, output_size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, output_size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, size, size);
 
        Effect *slice_effect = tester.get_chain()->add_effect(new SliceEffect());
@@ -49,7 +49,7 @@ TEST(SliceEffectTest, HorizontalOverlap) {
        };
        float out_data[9 * 2];
 
-       EffectChainTester tester(NULL, 9, 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, 9, 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, 5, 2);
 
        Effect *slice_effect = tester.get_chain()->add_effect(new SliceEffect());
@@ -72,7 +72,7 @@ TEST(SliceEffectTest, HorizontalDiscard) {
        };
        float out_data[4 * 2];
 
-       EffectChainTester tester(NULL, 4, 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, 4, 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, 6, 2);
 
        Effect *slice_effect = tester.get_chain()->add_effect(new SliceEffect());
@@ -95,7 +95,7 @@ TEST(SliceEffectTest, HorizontalOverlapWithOffset) {
        };
        float out_data[9 * 2];
 
-       EffectChainTester tester(NULL, 9, 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, 9, 2, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, 5, 2);
 
        Effect *slice_effect = tester.get_chain()->add_effect(new SliceEffect());
@@ -126,7 +126,7 @@ TEST(SliceEffectTest, VerticalOverlapSlicesFromTop) {
        };
        float out_data[2 * 6];
 
-       EffectChainTester tester(NULL, 2, 6, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, 2, 6, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, 2, 3);
 
        Effect *slice_effect = tester.get_chain()->add_effect(new SliceEffect());
@@ -156,7 +156,7 @@ TEST(SliceEffectTest, VerticalOverlapOffsetsFromTop) {
        };
        float out_data[2 * 6];
 
-       EffectChainTester tester(NULL, 2, 6, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(nullptr, 2, 6, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, 2, 3);
 
        Effect *slice_effect = tester.get_chain()->add_effect(new SliceEffect());
index 65dbe8a716210267432893b5783b0a3a7501bb79..1a69b0ca0fb28b5023f2c5785ac82b87e3e7d8fb 100644 (file)
@@ -23,7 +23,7 @@ namespace {
 // Not thread-safe, but this isn't a big problem for testing.
 ResourcePool *get_static_pool()
 {
-       static ResourcePool *resource_pool = NULL;
+       static ResourcePool *resource_pool = nullptr;
        if (!resource_pool) {
                resource_pool = new ResourcePool();
        }
@@ -56,7 +56,7 @@ EffectChainTester::EffectChainTester(const float *data, unsigned width, unsigned
 {
        CHECK(init_movit(".", MOVIT_DEBUG_OFF));
 
-       if (data != NULL) {
+       if (data != nullptr) {
                add_input(data, pixel_format, color_space, gamma_curve);
        }
 }
@@ -105,17 +105,17 @@ Input *EffectChainTester::add_input(const unsigned char *data, MovitPixelFormat
 
 void EffectChainTester::run(float *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<float>(out_data, NULL, NULL, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
+       internal_run<float>(out_data, nullptr, NULL, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
 }
 
 void EffectChainTester::run(float *out_data, float *out_data2, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<float>(out_data, out_data2, NULL, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
+       internal_run<float>(out_data, out_data2, nullptr, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
 }
 
 void EffectChainTester::run(float *out_data, float *out_data2, float *out_data3, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<float>(out_data, out_data2, out_data3, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
+       internal_run<float>(out_data, out_data2, out_data3, nullptr, GL_FLOAT, format, color_space, gamma_curve, alpha_format);
 }
 
 void EffectChainTester::run(float *out_data, float *out_data2, float *out_data3, float *out_data4, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
@@ -125,17 +125,17 @@ void EffectChainTester::run(float *out_data, float *out_data2, float *out_data3,
 
 void EffectChainTester::run(unsigned char *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<unsigned char>(out_data, NULL, NULL, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
+       internal_run<unsigned char>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
 }
 
 void EffectChainTester::run(unsigned char *out_data, unsigned char *out_data2, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<unsigned char>(out_data, out_data2, NULL, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
+       internal_run<unsigned char>(out_data, out_data2, nullptr, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
 }
 
 void EffectChainTester::run(unsigned char *out_data, unsigned char *out_data2, unsigned char *out_data3, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<unsigned char>(out_data, out_data2, out_data3, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
+       internal_run<unsigned char>(out_data, out_data2, out_data3, nullptr, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format);
 }
 
 void EffectChainTester::run(unsigned char *out_data, unsigned char *out_data2, unsigned char *out_data3, unsigned char *out_data4, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
@@ -145,29 +145,29 @@ void EffectChainTester::run(unsigned char *out_data, unsigned char *out_data2, u
 
 void EffectChainTester::run(uint16_t *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<uint16_t>(out_data, NULL, NULL, NULL, GL_UNSIGNED_SHORT, format, color_space, gamma_curve, alpha_format);
+       internal_run<uint16_t>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_SHORT, format, color_space, gamma_curve, alpha_format);
 }
 
 void EffectChainTester::run_10_10_10_2(uint32_t *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<uint32_t>(out_data, NULL, NULL, NULL, GL_UNSIGNED_INT_2_10_10_10_REV, format, color_space, gamma_curve, alpha_format);
+       internal_run<uint32_t>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_INT_2_10_10_10_REV, format, color_space, gamma_curve, alpha_format);
 }
 
 #ifdef HAVE_BENCHMARK
 
 void EffectChainTester::benchmark(benchmark::State &state, float *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<float>(out_data, NULL, NULL, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
+       internal_run<float>(out_data, nullptr, NULL, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
 }
 
 void EffectChainTester::benchmark(benchmark::State &state, float *out_data, float *out_data2, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<float>(out_data, out_data2, NULL, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
+       internal_run<float>(out_data, out_data2, nullptr, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
 }
 
 void EffectChainTester::benchmark(benchmark::State &state, float *out_data, float *out_data2, float *out_data3, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<float>(out_data, out_data2, out_data3, NULL, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
+       internal_run<float>(out_data, out_data2, out_data3, nullptr, GL_FLOAT, format, color_space, gamma_curve, alpha_format, &state);
 }
 
 void EffectChainTester::benchmark(benchmark::State &state, float *out_data, float *out_data2, float *out_data3, float *out_data4, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
@@ -177,17 +177,17 @@ void EffectChainTester::benchmark(benchmark::State &state, float *out_data, floa
 
 void EffectChainTester::benchmark(benchmark::State &state, unsigned char *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<unsigned char>(out_data, NULL, NULL, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
+       internal_run<unsigned char>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
 }
 
 void EffectChainTester::benchmark(benchmark::State &state, unsigned char *out_data, unsigned char *out_data2, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<unsigned char>(out_data, out_data2, NULL, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
+       internal_run<unsigned char>(out_data, out_data2, nullptr, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
 }
 
 void EffectChainTester::benchmark(benchmark::State &state, unsigned char *out_data, unsigned char *out_data2, unsigned char *out_data3, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<unsigned char>(out_data, out_data2, out_data3, NULL, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
+       internal_run<unsigned char>(out_data, out_data2, out_data3, nullptr, GL_UNSIGNED_BYTE, format, color_space, gamma_curve, alpha_format, &state);
 }
 
 void EffectChainTester::benchmark(benchmark::State &state, unsigned char *out_data, unsigned char *out_data2, unsigned char *out_data3, unsigned char *out_data4, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
@@ -197,12 +197,12 @@ void EffectChainTester::benchmark(benchmark::State &state, unsigned char *out_da
 
 void EffectChainTester::benchmark(benchmark::State &state, uint16_t *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<uint16_t>(out_data, NULL, NULL, NULL, GL_UNSIGNED_SHORT, format, color_space, gamma_curve, alpha_format, &state);
+       internal_run<uint16_t>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_SHORT, format, color_space, gamma_curve, alpha_format, &state);
 }
 
 void EffectChainTester::benchmark_10_10_10_2(benchmark::State &state, uint32_t *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format)
 {
-       internal_run<uint32_t>(out_data, NULL, NULL, NULL, GL_UNSIGNED_INT_2_10_10_10_REV, format, color_space, gamma_curve, alpha_format, &state);
+       internal_run<uint32_t>(out_data, nullptr, NULL, NULL, GL_UNSIGNED_INT_2_10_10_10_REV, format, color_space, gamma_curve, alpha_format, &state);
 }
 
 #endif
@@ -233,11 +233,11 @@ void EffectChainTester::internal_run(T *out_data, T *out_data2, T *out_data3, T
        }
 
        unsigned num_outputs;
-       if (out_data4 != NULL) {
+       if (out_data4 != nullptr) {
                num_outputs = 4;
-       } else if (out_data3 != NULL) {
+       } else if (out_data3 != nullptr) {
                num_outputs = 3;
-       } else if (out_data2 != NULL) {
+       } else if (out_data2 != nullptr) {
                num_outputs = 2;
        } else {
                num_outputs = 1;
@@ -250,7 +250,7 @@ void EffectChainTester::internal_run(T *out_data, T *out_data2, T *out_data3, T
        for (unsigned i = 0; i < num_outputs; ++i) {
                glBindTexture(GL_TEXTURE_2D, texnum[i]);
                check_error();
-               glTexImage2D(GL_TEXTURE_2D, 0, framebuffer_format, width, height, 0, GL_RGBA, type, NULL);
+               glTexImage2D(GL_TEXTURE_2D, 0, framebuffer_format, width, height, 0, GL_RGBA, type, nullptr);
                check_error();
        }
 
index b619aede1cd0d092ba131ff175890b978ad825ec..a5124bda164dfaf0b7926c95459c34d3325af213 100644 (file)
@@ -58,7 +58,7 @@ private:
        template<class T>
        void internal_run(T *out_data, T *out_data2, T *out_data3, T *out_data4, GLenum internal_format, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format = OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED
 #ifdef HAVE_BENCHMARK
-               , benchmark::State *state = NULL
+               , benchmark::State *state = nullptr
 #endif
 );
 
index 401664424fe2149cb97c4f9718d341f1f8dfa812..2f6e6947b28029b9830e1d9aee78e595580a249b 100644 (file)
--- a/util.cpp
+++ b/util.cpp
@@ -89,7 +89,7 @@ string read_file(const string &filename)
        const string full_pathname = *movit_data_directory + "/" + filename;
 
        FILE *fp = fopen(full_pathname.c_str(), "r");
-       if (fp == NULL) {
+       if (fp == nullptr) {
                perror(full_pathname.c_str());
                exit(1);
        }
@@ -294,7 +294,7 @@ void *get_gl_context_identifier()
        return (void *)wglGetCurrentContext();
 #else
        void *ret = (void *)eglGetCurrentContext();
-       if (ret != NULL) {
+       if (ret != nullptr) {
                return ret;
        }
        return (void *)glXGetCurrentContext();
diff --git a/util.h b/util.h
index feefea5fa9f1fa1b992570b69791ed7e308cdce8..5e8cc6d721da56616728bbffdafd599baefc5554 100644 (file)
--- a/util.h
+++ b/util.h
@@ -11,7 +11,7 @@
 #include "defs.h"
 #include "fp16.h"
 
-#define BUFFER_OFFSET(i) ((char *)NULL + (i))
+#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
 
 namespace movit {
 
@@ -65,7 +65,7 @@ enum CombineRoundingBehavior {
 //
 // Note that since the GPU might have limited precision in its linear
 // interpolation, the effective weights might be different from the ones you
-// asked for. sum_sq_error, if not NULL, will contain the sum of the
+// asked for. sum_sq_error, if not nullptr, will contain the sum of the
 // (estimated) squared errors of the two weights.
 //
 // The answer, in "offset", comes as a normalized coordinate,
@@ -109,7 +109,7 @@ void combine_two_samples(float w1, float w2, float pos1, float pos1_pos2_diff, f
        // If z had infinite precision, this would simply reduce to w = w1 + w2.
        *total_weight = from_fp32<DestFloat>((w1 + z * (w2 - w1)) / (z * z + (1 - z) * (1 - z)));
 
-       if (sum_sq_error != NULL) {
+       if (sum_sq_error != nullptr) {
                float err1 = to_fp32(*total_weight) * (1 - z) - w1;
                float err2 = to_fp32(*total_weight) * z - w2;
                *sum_sq_error = err1 * err1 + err2 * err2;
index 8c4f7801d33c2efb1ad6c43dac73f3d5d87a30d0..59b7eed4eff496d31a653b0814ece809a148b3f4 100644 (file)
--- a/ycbcr.cpp
+++ b/ycbcr.cpp
@@ -148,10 +148,10 @@ void compute_ycbcr_matrix(YCbCrFormat ycbcr_format, float* offset, Matrix3d* ycb
                offset[1] /= scale;
                offset[2] /= scale;
                *ycbcr_to_rgb *= scale;
-               if (scale_factor != NULL) {
+               if (scale_factor != nullptr) {
                        *scale_factor = scale;
                }
-       } else if (scale_factor != NULL) {
+       } else if (scale_factor != nullptr) {
                *scale_factor = 1.0;
        }
 }
diff --git a/ycbcr.h b/ycbcr.h
index 1c55c3976f579255f0c8115fee16f9fb14d8d64f..207be4e98a81963aae12a86f18ff9aa8e5a9000a 100644 (file)
--- a/ycbcr.h
+++ b/ycbcr.h
@@ -82,7 +82,7 @@ float compute_chroma_offset(float pos, unsigned subsampling_factor, unsigned res
 // we support storing it in 16-bit formats, which incurs extra scaling factors.
 // You can get that scaling factor in <scale> if you want.
 void compute_ycbcr_matrix(YCbCrFormat ycbcr_format, float *offset, Eigen::Matrix3d *ycbcr_to_rgb,
-                          GLenum type = GL_UNSIGNED_BYTE, double *scale_factor = NULL);
+                          GLenum type = GL_UNSIGNED_BYTE, double *scale_factor = nullptr);
 
 }  // namespace movit
 
index c345f8d805ae83a69923c21f01ff601b616341a1..6546c87bd1217d7de1d221b0dedc9f4abda18ee7 100644 (file)
@@ -21,7 +21,7 @@ YCbCr422InterleavedInput::YCbCr422InterleavedInput(const ImageFormat &image_form
          ycbcr_format(ycbcr_format),
          width(width),
          height(height),
-         resource_pool(NULL)
+         resource_pool(nullptr)
 {
        pbo = 0;
        texture_num[0] = texture_num[1] = 0;
@@ -35,7 +35,7 @@ YCbCr422InterleavedInput::YCbCr422InterleavedInput(const ImageFormat &image_form
        pitches[CHANNEL_LUMA] = width;
        pitches[CHANNEL_CHROMA] = width / ycbcr_format.chroma_subsampling_x;
 
-       pixel_data = NULL;
+       pixel_data = nullptr;
 
        register_uniform_sampler2d("tex_y", &uniform_tex_y);
        register_uniform_sampler2d("tex_cbcr", &uniform_tex_cbcr);
index 9a56fb1621285eecc89932a9f1dc94c4da8c98d5..668793ae7f6dd2e60aba5a6eb3844edfbf8ed5b4 100644 (file)
@@ -36,7 +36,7 @@ TEST(YCbCr422InterleavedInputTest, Simple422) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -82,7 +82,7 @@ TEST(YCbCr422InterleavedInputTest, LumaLinearInterpolation) {
        };
        float out_data[out_width * height];
 
-       EffectChainTester tester(NULL, out_width, height);
+       EffectChainTester tester(nullptr, out_width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -143,7 +143,7 @@ TEST(YCbCr422InterleavedInputTest, DifferentCbAndCrPositioning) {
        };
        float out_data[width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -202,7 +202,7 @@ TEST(YCbCr422InterleavedInputTest, PBO) {
        glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, width * height * 2, uyvy, GL_STREAM_DRAW);
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
index 6bac55624307df2718927f536b4c019377c0fccf..3eec271bcf82758d03340fc8af6629112d815b98 100644 (file)
@@ -40,7 +40,7 @@ TEST(YCbCrConversionEffectTest, BasicInOut) {
 
        unsigned char out_data[width * height * 4];
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -96,7 +96,7 @@ TEST(YCbCrConversionEffectTest, ClampToValidRange) {
 
        unsigned char out_data[width * height * 4];
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -152,7 +152,7 @@ TEST(YCbCrConversionEffectTest, LimitedRangeToFullRange) {
 
        unsigned char out_data[width * height * 4];
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -209,7 +209,7 @@ TEST(YCbCrConversionEffectTest, PlanarOutput) {
 
        unsigned char out_y[width * height], out_cb[width * height], out_cr[width * height];
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -279,7 +279,7 @@ TEST(YCbCrConversionEffectTest, SplitLumaAndChroma) {
 
        unsigned char out_y[width * height * 4], out_cbcr[width * height * 4];
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -343,7 +343,7 @@ TEST(YCbCrConversionEffectTest, OutputChunkyAndRGBA) {
        unsigned char out_ycbcr[width * height * 4];
        unsigned char out_rgba[width * height * 4];
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -417,7 +417,7 @@ TEST(YCbCrConversionEffectTest, MultipleOutputsAndRGBA) {
        unsigned char out_cbcr[width * height * 4];
        unsigned char out_rgba[width * height * 4];
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -483,7 +483,7 @@ TEST(YCbCrConversionEffectTest, ChangeOutputFormat) {
 
        unsigned char out_y[width * height], out_cb[width * height], out_cr[width * height];
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -545,7 +545,7 @@ TEST(YCbCrConversionEffectTest, TenBitOutput) {
                127, 960, 471, 3,
        };
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGB10_A2);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGB10_A2);
        tester.add_input(data, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_sRGB);
 
        ImageFormat format;
@@ -598,7 +598,7 @@ TEST(YCbCrConversionEffectTest, TenBitOutputInSixteen) {
                127, 960, 471, 65535,
        };
 
-       EffectChainTester tester(NULL, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA16);
+       EffectChainTester tester(nullptr, width, height, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA16);
        tester.add_input(data, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_sRGB);
 
        ImageFormat format;
index e7b53bb8c60ee7e537969fa22378f555de3ac52e..47f58cca75efded051a633726d1381951cf0a4f7 100644 (file)
@@ -28,7 +28,7 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format,
          type(type),
          width(width),
          height(height),
-         resource_pool(NULL)
+         resource_pool(nullptr)
 {
        pbos[0] = pbos[1] = pbos[2] = 0;
        texture_num[0] = texture_num[1] = texture_num[2] = 0;
@@ -36,7 +36,7 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format,
        set_width(width);
        set_height(height);
 
-       pixel_data[0] = pixel_data[1] = pixel_data[2] = NULL;
+       pixel_data[0] = pixel_data[1] = pixel_data[2] = nullptr;
        owns_texture[0] = owns_texture[1] = owns_texture[2] = false;
 
        register_uniform_sampler2d("tex_y", &uniform_tex_y);
@@ -87,7 +87,7 @@ void YCbCrInput::set_gl_state(GLuint glsl_program_num, const string& prefix, uns
                glActiveTexture(GL_TEXTURE0 + *sampler_num + channel);
                check_error();
 
-               if (texture_num[channel] == 0 && (pbos[channel] != 0 || pixel_data[channel] != NULL)) {
+               if (texture_num[channel] == 0 && (pbos[channel] != 0 || pixel_data[channel] != nullptr)) {
                        GLenum format, internal_format;
                        if (channel == 0 && ycbcr_input_splitting == YCBCR_INPUT_INTERLEAVED) {
                                if (type == GL_UNSIGNED_INT_2_10_10_10_REV) {
index 92ef33bc9592aa64fd3ef70fc79a1646a7fe39ea..adfdeb95ca46c898d8bd0b75c1c1cf87d7675415 100644 (file)
@@ -41,7 +41,7 @@ TEST(YCbCrInputTest, Simple444) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -92,7 +92,7 @@ TEST(YCbCrInputTest, Interleaved444) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -145,7 +145,7 @@ TEST(YCbCrInputTest, FullRangeRec601) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -199,7 +199,7 @@ TEST(YCbCrInputTest, Rec709) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -255,7 +255,7 @@ TEST(YCbCrInputTest, Rec2020) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -310,7 +310,7 @@ TEST(YCbCrInputTest, ChangeFormat) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -391,7 +391,7 @@ TEST(YCbCrInputTest, Subsampling420) {
        };
        float out_data[width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -453,7 +453,7 @@ TEST(YCbCrInputTest, Subsampling420WithNonCenteredSamples) {
        };
        float out_data[width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -523,7 +523,7 @@ TEST(YCbCrInputTest, DifferentCbAndCrPositioning) {
        };
        float out_data[width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -581,7 +581,7 @@ TEST(YCbCrInputTest, PBO) {
        glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, width * height * 3, data, GL_STREAM_DRAW);
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -638,7 +638,7 @@ TEST(YCbCrInputTest, CombinedCbAndCr) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -691,7 +691,7 @@ TEST(YCbCrInputTest, ExternalTexture) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -849,7 +849,7 @@ TEST(YCbCrInputTest, NoData) {
 
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -906,7 +906,7 @@ TEST(YCbCrInputTest, TenBitInterleaved) {
                        (expanded_data[i * 3 + 2] << 20);
        }
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -969,7 +969,7 @@ TEST(YCbCrInputTest, TenBitPlanar) {
        };
        float out_data[4 * width * height];
 
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
 
        ImageFormat format;
        format.color_space = COLORSPACE_sRGB;
@@ -1119,7 +1119,7 @@ TEST(EffectChainTest, MipmapGenerationWorks) {
        format.gamma_curve = GAMMA_sRGB;
 
        float out_data[width * height * 4];
-       EffectChainTester tester(NULL, width, height);
+       EffectChainTester tester(nullptr, width, height);
        YCbCrInput *input = new YCbCrInput(format, ycbcr_format, width, height, YCBCR_INPUT_INTERLEAVED);
        input->set_pixel_data(0, ycbcr_data);
        tester.get_chain()->add_input(input);