diff --git a/main.c b/main.c index dcb1a75..1830e34 100644 --- a/main.c +++ b/main.c @@ -15,6 +15,7 @@ #include #include "ini.h" #include "bayer.h" +#include "quickdebayer.h" enum io_method { IO_METHOD_READ, @@ -370,12 +371,14 @@ process_image(const int *p, int size) method = DC1394_BAYER_METHOD_SIMPLE; // method = DC1394_BAYER_METHOD_VNG is slightly sharper but takes 10 seconds; pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, current_width, current_height); + pixels = gdk_pixbuf_get_pixels(pixbuf); + dc1394_bayer_decoding_8bit((const uint8_t *) p, pixels, current_width, current_height, filter, method); } else { - pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, current_width / 2, current_height / 2); + pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, current_width / 6, current_height / 6); + pixels = gdk_pixbuf_get_pixels(pixbuf); + quick_debayer_bggr8((const uint8_t *)p, pixels, current_width, current_height, 3); } - pixels = gdk_pixbuf_get_pixels(pixbuf); - dc1394_bayer_decoding_8bit((const uint8_t *) p, pixels, current_width, current_height, filter, method); if (current_rotate == 0) { pixbufrot = pixbuf; } else if (current_rotate == 90) { diff --git a/meson.build b/meson.build index a57d70c..bc5fed4 100644 --- a/meson.build +++ b/meson.build @@ -4,7 +4,7 @@ gtkdep = dependency('gtk+-3.0') cc = meson.get_compiler('c') libm = cc.find_library('m', required: false) -executable('megapixels', 'main.c', 'ini.c', 'bayer.c', dependencies : [gtkdep, libm], install : true) +executable('megapixels', 'main.c', 'ini.c', 'bayer.c', 'quickdebayer.c', dependencies : [gtkdep, libm], install : true) install_data(['camera.glade', 'camera.css'], install_dir : get_option('datadir') / 'megapixels/ui') diff --git a/quickdebayer.c b/quickdebayer.c new file mode 100644 index 0000000..a97977f --- /dev/null +++ b/quickdebayer.c @@ -0,0 +1,29 @@ +#include "quickdebayer.h" + +// Fast but bad debayer method that scales and rotates by skipping source pixels and +// doesn't interpolate any values at all + +void +quick_debayer_bggr8(const uint8_t *source, uint8_t *destination, int width, int height, int skip) +{ + int byteskip = 2 * skip; + int input_size = width * height; + int i; + int j=0; + int row_left = width; + + // B G + // G R + for(i=0;i + +void quick_debayer_bggr8(const uint8_t *source, uint8_t *destination, int width, int height, int skip); +