Hello!
This is a patch to add support for interlaced stereo modes. Horizontal
interlacing is used by the Zalman 3D monitors. Not sure about what uses the
vertical and checkerboard modes, but I've seen them discussed, so there's
probably something out there. I decided to implement support for that too
while I was at it.
Patch is against the released source for 1.1, for some reason git and svn seem
out of date.
diff -r -u geeqie-1.1/src/pixbuf-renderer.c geeqie-1.1.patched/src/pixbuf-renderer.c
--- geeqie-1.1/src/pixbuf-renderer.c 2012-08-12 22:13:41.000000000 +0200
+++ geeqie-1.1.patched/src/pixbuf-renderer.c 2013-01-04 14:03:24.668298867 +0100
@@ -2367,8 +2367,102 @@
}
}
}
-
-void pr_create_anaglyph(guint mode, GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h)
+
+static void pr_create_horiz_interlaced(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h)
+{
+ gint srs, drs;
+ guchar *s_pix, *d_pix;
+ guchar *sp, *dp;
+ guchar *spi, *dpi;
+ gint i, j;
+
+ srs = gdk_pixbuf_get_rowstride(right);
+ s_pix = gdk_pixbuf_get_pixels(right);
+ spi = s_pix + (x * COLOR_BYTES);
+
+ drs = gdk_pixbuf_get_rowstride(pixbuf);
+ d_pix = gdk_pixbuf_get_pixels(pixbuf);
+ dpi = d_pix + x * COLOR_BYTES;
+
+ gint min_stride = srs <= drs ? srs : drs;
+
+ for (i = y; i < y + h; i+=2)
+ {
+ sp = spi + (i * srs);
+ dp = dpi + (i * drs);
+ memcpy(dp, sp, min_stride);
+ }
+}
+
+static void pr_create_vert_interlaced(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h)
+{
+ gint srs, drs;
+ guchar *s_pix, *d_pix;
+ guchar *sp, *dp;
+ guchar *spi, *dpi;
+ gint i, j;
+
+ srs = gdk_pixbuf_get_rowstride(right);
+ s_pix = gdk_pixbuf_get_pixels(right);
+ spi = s_pix + (x * COLOR_BYTES);
+
+ drs = gdk_pixbuf_get_rowstride(pixbuf);
+ d_pix = gdk_pixbuf_get_pixels(pixbuf);
+ dpi = d_pix + x * COLOR_BYTES;
+
+ gint min_stride = srs <= drs ? srs : drs;
+
+ for (i = y; i < y + h; i++)
+ {
+ sp = spi + (i * srs);
+ dp = dpi + (i * drs);
+ for( j = 0; j < w; j++ )
+ {
+ if ( j % 2 )
+ memcpy(dp, sp, COLOR_BYTES);
+
+ dp += COLOR_BYTES;
+ sp += COLOR_BYTES;
+ }
+ }
+}
+
+static void pr_create_checkerboard(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h)
+{
+ gint srs, drs;
+ guchar *s_pix, *d_pix;
+ guchar *sp, *dp;
+ guchar *spi, *dpi;
+ gint i, j;
+
+ srs = gdk_pixbuf_get_rowstride(right);
+ s_pix = gdk_pixbuf_get_pixels(right);
+ spi = s_pix + (x * COLOR_BYTES);
+
+ drs = gdk_pixbuf_get_rowstride(pixbuf);
+ d_pix = gdk_pixbuf_get_pixels(pixbuf);
+ dpi = d_pix + x * COLOR_BYTES;
+
+ gint min_stride = srs <= drs ? srs : drs;
+
+ for (i = y; i < y + h; i++)
+ {
+ sp = spi + (i * srs);
+ dp = dpi + (i * drs);
+ for( j = 0; j < w; j++ )
+ {
+ if ( (i % 2) == (j % 2) )
+ {
+ memcpy(dp, sp, COLOR_BYTES);
+ }
+
+ dp += COLOR_BYTES;
+ sp += COLOR_BYTES;
+ }
+ }
+}
+
+void pr_create_stereo(guint mode, GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h)
{
if (mode & PR_STEREO_ANAGLYPH_RC)
pr_create_anaglyph_RC(pixbuf, right, x, y, w, h);
@@ -2376,6 +2470,13 @@
pr_create_anaglyph_gray(pixbuf, right, x, y, w, h);
else if (mode & PR_STEREO_ANAGLYPH_DB)
pr_create_anaglyph_dubois(pixbuf, right, x, y, w, h);
+ else if (mode & PR_STEREO_HORIZ_INTER)
+ pr_create_horiz_interlaced(pixbuf, right, x, y, w, h);
+ else if (mode & PR_STEREO_VERT_INTER)
+ pr_create_vert_interlaced(pixbuf, right, x, y, w, h);
+ else if (mode & PR_STEREO_CHECKERBOARD)
+ pr_create_checkerboard(pixbuf, right, x, y, w, h);
+
}
/*
diff -r -u geeqie-1.1/src/pixbuf-renderer.h geeqie-1.1.patched/src/pixbuf-renderer.h
--- geeqie-1.1/src/pixbuf-renderer.h 2012-08-12 22:13:41.000000000 +0200
+++ geeqie-1.1.patched/src/pixbuf-renderer.h 2013-01-04 12:56:53.818454521 +0100
@@ -367,6 +367,6 @@
GList *pr_source_tile_compute_region(PixbufRenderer *pr, gint x, gint y, gint w, gint h, gboolean request);
-void pr_create_anaglyph(guint mode, GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h);
+void pr_create_stereo(guint mode, GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h);
#endif
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
diff -r -u geeqie-1.1/src/preferences.c geeqie-1.1.patched/src/preferences.c
--- geeqie-1.1/src/preferences.c 2012-08-12 22:13:41.000000000 +0200
+++ geeqie-1.1.patched/src/preferences.c 2013-01-02 21:58:10.755905492 +0100
@@ -305,14 +305,14 @@
options->metadata.confirm_on_dir_change = c_options->metadata.confirm_on_dir_change;
options->metadata.keywords_case_sensitive = c_options->metadata.keywords_case_sensitive;
options->metadata.write_orientation = c_options->metadata.write_orientation;
- options->stereo.mode = (c_options->stereo.mode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH | PR_STEREO_HALF)) |
+ options->stereo.mode = (c_options->stereo.mode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH | PR_STEREO_HALF | PR_STEREO_HORIZ_INTER | PR_STEREO_VERT_INTER | PR_STEREO_CHECKERBOARD)) |
(c_options->stereo.tmp.mirror_right ? PR_STEREO_MIRROR_RIGHT : 0) |
(c_options->stereo.tmp.flip_right ? PR_STEREO_FLIP_RIGHT : 0) |
(c_options->stereo.tmp.mirror_left ? PR_STEREO_MIRROR_LEFT : 0) |
(c_options->stereo.tmp.flip_left ? PR_STEREO_FLIP_LEFT : 0) |
(c_options->stereo.tmp.swap ? PR_STEREO_SWAP : 0) |
(c_options->stereo.tmp.temp_disable ? PR_STEREO_TEMP_DISABLE : 0);
- options->stereo.fsmode = (c_options->stereo.fsmode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH | PR_STEREO_HALF)) |
+ options->stereo.fsmode = (c_options->stereo.fsmode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH | PR_STEREO_HALF | PR_STEREO_HORIZ_INTER | PR_STEREO_VERT_INTER | PR_STEREO_CHECKERBOARD)) |
(c_options->stereo.tmp.fs_mirror_right ? PR_STEREO_MIRROR_RIGHT : 0) |
(c_options->stereo.tmp.fs_flip_right ? PR_STEREO_FLIP_RIGHT : 0) |
(c_options->stereo.tmp.fs_mirror_left ? PR_STEREO_MIRROR_LEFT : 0) |
@@ -581,6 +581,15 @@
*option = PR_STEREO_VERT | PR_STEREO_HALF;
break;
case 8:
+ *option = PR_STEREO_HORIZ_INTER;
+ break;
+ case 9:
+ *option = PR_STEREO_VERT_INTER;
+ break;
+ case 10:
+ *option = PR_STEREO_CHECKERBOARD;
+ break;
+ case 11:
*option = PR_STEREO_FIXED;
break;
}
@@ -622,11 +631,19 @@
current = 6;
if (option & PR_STEREO_HALF) current = 7;
}
-
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Horizontally Interlaced"));
+ if (option & PR_STEREO_HORIZ_INTER) current = 8;
+
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Vertically Interlaced"));
+ if (option & PR_STEREO_VERT_INTER) current = 9;
+
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Checkerboard"));
+ if (option & PR_STEREO_CHECKERBOARD) current = 10;
+
if (add_fixed)
{
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Fixed position"));
- if (option & PR_STEREO_FIXED) current = 8;
+ if (option & PR_STEREO_FIXED) current = 11;
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current);
diff -r -u geeqie-1.1/src/renderer-tiles.c geeqie-1.1.patched/src/renderer-tiles.c
--- geeqie-1.1/src/renderer-tiles.c 2012-08-12 22:13:41.000000000 +0200
+++ geeqie-1.1.patched/src/renderer-tiles.c 2013-01-04 13:47:57.083436017 +0100
@@ -1407,7 +1407,8 @@
scale_x, scale_y,
(fast) ? GDK_INTERP_NEAREST : pr->zoom_quality,
it->x + pb_x, it->y + pb_y);
- if (rt->stereo_mode & PR_STEREO_ANAGLYPH &&
+ if ( (rt->stereo_mode & PR_STEREO_ANAGLYPH || rt->stereo_mode & PR_STEREO_HORIZ_INTER || rt->stereo_mode & PR_STEREO_VERT_INTER || rt->stereo_mode & PR_STEREO_CHECKERBOARD ) &&
+
(pr->stereo_pixbuf_offset_right > 0 || pr->stereo_pixbuf_offset_left > 0))
{
GdkPixbuf *right_pb = rt_get_spare_tile(rt);
@@ -1418,7 +1419,7 @@
scale_x, scale_y,
(fast) ? GDK_INTERP_NEAREST : pr->zoom_quality,
it->x + pb_x, it->y + pb_y);
- pr_create_anaglyph(rt->stereo_mode, it->pixbuf, right_pb, pb_x, pb_y, pb_w, pb_h);
+ pr_create_stereo(rt->stereo_mode, it->pixbuf, right_pb, pb_x, pb_y, pb_w, pb_h);
/* do not care about freeing spare_tile, it will be reused */
}
rt_tile_apply_orientation(rt, orientation, &it->pixbuf, pb_x, pb_y, pb_w, pb_h);
diff -r -u geeqie-1.1/src/typedefs.h geeqie-1.1.patched/src/typedefs.h
--- geeqie-1.1/src/typedefs.h 2012-08-12 22:13:41.000000000 +0200
+++ geeqie-1.1.patched/src/typedefs.h 2013-01-02 20:09:32.548567907 +0100
@@ -208,7 +208,10 @@
PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
PR_STEREO_SWAP = 1 << 12, /* swap left and right buffers */
PR_STEREO_TEMP_DISABLE = 1 << 13, /* temporarily disable stereo mode if source image is not stereo */
- PR_STEREO_HALF = 1 << 14
+ PR_STEREO_HALF = 1 << 14,
+ PR_STEREO_HORIZ_INTER = 1 << 15, /* horizontal interlacing */
+ PR_STEREO_VERT_INTER = 1 << 16, /* vertical interlacing */
+ PR_STEREO_CHECKERBOARD = 1 << 17 /* checkerboard */
} PixbufRendererStereoMode;
typedef enum {
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel