X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=test_util.cpp;h=f48ff7fffcc8bbd4cf6478b1aec5d12b22ae74f4;hp=59c0ef420a43e04b846fa55a946b927ddddba180;hb=ab89030be6f55cd1955b9e033c62c2e3c3ba2a2f;hpb=9651a4eaae012cdc49c1aa38197861e04f62e91e diff --git a/test_util.cpp b/test_util.cpp index 59c0ef4..f48ff7f 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -2,11 +2,11 @@ #include #include #include +#include +#include +#include #include "flat_input.h" -#include "glew.h" -#include "gtest/gtest.h" -#include "gtest/gtest-message.h" #include "init.h" #include "resource_pool.h" #include "test_util.h" @@ -14,6 +14,8 @@ using namespace std; +namespace movit { + class Input; namespace { @@ -47,7 +49,7 @@ EffectChainTester::EffectChainTester(const float *data, unsigned width, unsigned GLenum framebuffer_format) : chain(width, height, get_static_pool()), width(width), height(height), finalized(false) { - init_movit(".", MOVIT_DEBUG_OFF); + CHECK(init_movit(".", MOVIT_DEBUG_OFF)); if (data != NULL) { add_input(data, pixel_format, color_space, gamma_curve); @@ -57,7 +59,7 @@ EffectChainTester::EffectChainTester(const float *data, unsigned width, unsigned check_error(); glBindTexture(GL_TEXTURE_2D, texnum); check_error(); - glTexImage2D(GL_TEXTURE_2D, 0, framebuffer_format, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, framebuffer_format, width, height, 0, GL_RGBA, GL_FLOAT, NULL); check_error(); glGenFramebuffers(1, &fbo); @@ -83,25 +85,39 @@ EffectChainTester::~EffectChainTester() check_error(); } -Input *EffectChainTester::add_input(const float *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve) +Input *EffectChainTester::add_input(const float *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve, int input_width, int input_height) { ImageFormat format; format.color_space = color_space; format.gamma_curve = gamma_curve; - FlatInput *input = new FlatInput(format, pixel_format, GL_FLOAT, width, height); + if (input_width == -1) { + input_width = width; + } + if (input_height == -1) { + input_height = height; + } + + FlatInput *input = new FlatInput(format, pixel_format, GL_FLOAT, input_width, input_height); input->set_pixel_data(data); chain.add_input(input); return input; } -Input *EffectChainTester::add_input(const unsigned char *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve) +Input *EffectChainTester::add_input(const unsigned char *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve, int input_width, int input_height) { ImageFormat format; format.color_space = color_space; format.gamma_curve = gamma_curve; - FlatInput *input = new FlatInput(format, pixel_format, GL_UNSIGNED_BYTE, width, height); + if (input_width == -1) { + input_width = width; + } + if (input_height == -1) { + input_height = height; + } + + FlatInput *input = new FlatInput(format, pixel_format, GL_UNSIGNED_BYTE, input_width, input_height); input->set_pixel_data(data); chain.add_input(input); return input; @@ -244,3 +260,5 @@ void test_accuracy(const float *expected, const float *result, unsigned num_valu double rms = sqrt(squared_difference) / num_values; EXPECT_LT(rms, rms_limit); } + +} // namespace movit