// 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();
direction(HORIZONTAL),
width(1280),
height(720),
- uniform_samples(NULL)
+ uniform_samples(nullptr)
{
register_float("radius", &radius);
register_int("direction", (int *)&direction);
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;
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();
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);
}
}
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);
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);
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);
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);
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);
}
{
- 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);
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);
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;
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))) {
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);
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));
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();
clock_gettime(CLOCK_MONOTONIC, &start);
#else
struct timeval start, now;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
#endif
while (!quit) {
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
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),
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 {
}
FILE *fp = fopen(filename, "w");
- if (fp == NULL) {
+ if (fp == nullptr) {
perror(filename);
exit(1);
}
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);
}
}
{
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()) {
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));
}
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:
Effect *last_added_effect() {
if (nodes.empty()) {
- return NULL;
+ return nullptr;
} else {
return nodes.back()->effect;
}
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) {
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);
};
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;
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);
// 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) {
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);
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>();
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>();
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;
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;
BouncingIdentityEffect *bounce = new BouncingIdentityEffect();
- EffectChainTester tester(NULL, 2, 2);
+ EffectChainTester tester(nullptr, 2, 2);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
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
};
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
};
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;
// (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;
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);
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);
// 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;
}
}
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);
}
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);
};
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);
};
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);
};
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);
};
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);
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);
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
height(height),
pitch(width),
owns_texture(false),
- pixel_data(NULL),
+ pixel_data(nullptr),
fixup_swap_rb(false),
fixup_red_to_grayscale(false)
{
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;
};
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);
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
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;
};
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;
float out_data[width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
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;
// 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 {
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);
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);
// 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
// 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()) {
};
float out_data[4 * 4];
- EffectChainTester tester(NULL, 4, 4);
+ EffectChainTester tester(nullptr, 4, 4);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * 4];
- EffectChainTester tester(NULL, 4, 4);
+ EffectChainTester tester(nullptr, 4, 4);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * 2];
- EffectChainTester tester(NULL, 1, 2);
+ EffectChainTester tester(nullptr, 1, 2);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[3 * 3];
- EffectChainTester tester(NULL, 3, 3);
+ EffectChainTester tester(nullptr, 3, 3);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[5 * 2];
- EffectChainTester tester(NULL, 5, 2);
+ EffectChainTester tester(nullptr, 5, 2);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[1 * 1];
- EffectChainTester tester(NULL, 1, 1);
+ EffectChainTester tester(nullptr, 1, 1);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * 4];
- EffectChainTester tester(NULL, 1, 4);
+ EffectChainTester tester(nullptr, 1, 4);
ImageFormat format;
format.color_space = COLORSPACE_REC_601_625;
};
float out_data[4 * 4];
- EffectChainTester tester(NULL, 1, 4);
+ EffectChainTester tester(nullptr, 1, 4);
ImageFormat format;
format.color_space = COLORSPACE_REC_601_625;
};
float out_data[4 * 4];
- EffectChainTester tester(NULL, 4, 4);
+ EffectChainTester tester(nullptr, 4, 4);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * 2];
- EffectChainTester tester(NULL, 4, 2);
+ EffectChainTester tester(nullptr, 4, 2);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
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);
}
}
// OK, we can combine this and the next sample.
- if (dst != NULL) {
+ if (dst != nullptr) {
dst[j].weight = total_weight;
dst[j].pos = pos;
}
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;
// 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();
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;
// 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(
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);
}
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);
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);
}
}
}
}
- 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;
}
}
- 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;
};
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;
}
}
- 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;
};
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;
vao_freelist_max_length(vao_freelist_max_length),
texture_freelist_bytes(0)
{
- pthread_mutex_init(&lock, NULL);
+ pthread_mutex_init(&lock, nullptr);
}
ResourcePool::~ResourcePool()
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);
}
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);
}
}
// 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:
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();
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);
}
};
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());
};
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());
};
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());
};
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());
};
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());
};
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());
// 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();
}
{
CHECK(init_movit(".", MOVIT_DEBUG_OFF));
- if (data != NULL) {
+ if (data != nullptr) {
add_input(data, pixel_format, color_space, gamma_curve);
}
}
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)
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)
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)
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)
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
}
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;
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();
}
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
);
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);
}
return (void *)wglGetCurrentContext();
#else
void *ret = (void *)eglGetCurrentContext();
- if (ret != NULL) {
+ if (ret != nullptr) {
return ret;
}
return (void *)glXGetCurrentContext();
#include "defs.h"
#include "fp16.h"
-#define BUFFER_OFFSET(i) ((char *)NULL + (i))
+#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
namespace movit {
//
// 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,
// 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;
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;
}
}
// 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
ycbcr_format(ycbcr_format),
width(width),
height(height),
- resource_pool(NULL)
+ resource_pool(nullptr)
{
pbo = 0;
texture_num[0] = texture_num[1] = 0;
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);
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
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;
};
float out_data[width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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);
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) {
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
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;
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
(expanded_data[i * 3 + 2] << 20);
}
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
};
float out_data[4 * width * height];
- EffectChainTester tester(NULL, width, height);
+ EffectChainTester tester(nullptr, width, height);
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
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);