From: Steinar H. Gunderson Date: Sun, 7 Oct 2012 10:54:32 +0000 (+0200) Subject: Move pixel_format out of the ImageFormat struct, since it is only relevant for FlatInput. X-Git-Tag: 1.0~357 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=3fbc6a0e7ecc008b0bdafcbc576b79c24117859e Move pixel_format out of the ImageFormat struct, since it is only relevant for FlatInput. --- diff --git a/flat_input.cpp b/flat_input.cpp index f8e36ca..56a9951 100644 --- a/flat_input.cpp +++ b/flat_input.cpp @@ -5,8 +5,9 @@ #include "util.h" #include "opengl.h" -FlatInput::FlatInput(ImageFormat image_format, unsigned width, unsigned height) +FlatInput::FlatInput(ImageFormat image_format, MovitPixelFormat pixel_format, unsigned width, unsigned height) : image_format(image_format), + pixel_format(pixel_format), needs_update(false), finalized(false), output_linear_gamma(false), @@ -28,19 +29,19 @@ void FlatInput::finalize() } else { internal_format = GL_RGBA8; } - if (image_format.pixel_format == FORMAT_RGB) { + if (pixel_format == FORMAT_RGB) { format = GL_RGB; bytes_per_pixel = 3; - } else if (image_format.pixel_format == FORMAT_RGBA) { + } else if (pixel_format == FORMAT_RGBA) { format = GL_RGBA; bytes_per_pixel = 4; - } else if (image_format.pixel_format == FORMAT_BGR) { + } else if (pixel_format == FORMAT_BGR) { format = GL_BGR; bytes_per_pixel = 3; - } else if (image_format.pixel_format == FORMAT_BGRA) { + } else if (pixel_format == FORMAT_BGRA) { format = GL_BGRA; bytes_per_pixel = 4; - } else if (image_format.pixel_format == FORMAT_GRAYSCALE) { + } else if (pixel_format == FORMAT_GRAYSCALE) { format = GL_LUMINANCE; bytes_per_pixel = 1; } else { diff --git a/flat_input.h b/flat_input.h index 69c1a6f..9266659 100644 --- a/flat_input.h +++ b/flat_input.h @@ -7,7 +7,7 @@ // comes from a single 2D array with chunky pixels. class FlatInput : public Input { public: - FlatInput(ImageFormat format, unsigned width, unsigned height); + FlatInput(ImageFormat format, MovitPixelFormat pixel_format, unsigned width, unsigned height); // Create the texture itself. We cannot do this in the constructor, // because we don't necessarily know all the settings (sRGB texture, @@ -56,6 +56,7 @@ public: private: ImageFormat image_format; + MovitPixelFormat pixel_format; GLenum format; GLuint pbo, texture_num; bool needs_update, finalized; diff --git a/image_format.h b/image_format.h index 2c65724..2f72317 100644 --- a/image_format.h +++ b/image_format.h @@ -23,7 +23,6 @@ enum YCbCrLumaCoefficients { }; struct ImageFormat { - MovitPixelFormat pixel_format; ColorSpace color_space; GammaCurve gamma_curve; }; diff --git a/main.cpp b/main.cpp index d9a116d..1fbb6a2 100644 --- a/main.cpp +++ b/main.cpp @@ -163,11 +163,10 @@ int main(int argc, char **argv) EffectChain chain(WIDTH, HEIGHT); ImageFormat inout_format; - inout_format.pixel_format = FORMAT_BGRA; inout_format.color_space = COLORSPACE_sRGB; inout_format.gamma_curve = GAMMA_sRGB; - FlatInput *input = new FlatInput(inout_format, WIDTH, HEIGHT); + FlatInput *input = new FlatInput(inout_format, FORMAT_BGRA, WIDTH, HEIGHT); chain.add_input(input); Effect *lift_gamma_gain_effect = chain.add_effect(new LiftGammaGainEffect()); Effect *saturation_effect = chain.add_effect(new SaturationEffect());