Author: post
Date: 2009-09-21 18:17:18 +0200 (Mon, 21 Sep 2009)
New Revision: 2639
Modified:
trunk/plugins/demosaic/demosaic.c
Log:
Fix junk pixels on bottom/left corner in fast demosaic mode.
Modified: trunk/plugins/demosaic/demosaic.c
===================================================================
--- trunk/plugins/demosaic/demosaic.c 2009-09-21 16:16:09 UTC (rev 2638)
+++ trunk/plugins/demosaic/demosaic.c 2009-09-21 16:17:18 UTC (rev 2639)
@@ -522,9 +522,11 @@
dest = GET_PIXEL(t->output, 0, row);
guint first = FC(row, 0);
guint second = FC(row, 1);
- gint col_end = t->output->w - 2;
+ gint col_end = t->output->w & 0xfffe;
- if (first == 1) { // Green first
+ /* Green first or second?*/
+ if (first == 1) {
+ /* Green first, then red or blue */
for(col=0 ; col < col_end; col += 2)
{
dest[1] = dest[1+ops]= *src;
@@ -539,6 +541,12 @@
dest += ops;
src++;
}
+ /* If uneven pixel width, copy last pixel */
+ if (t->output->w & 1) {
+ dest[0] = dest[-ops];
+ dest[1] = dest[-ops+1];
+ dest[2] = dest[-ops+2];
+ }
} else {
for(col=0 ; col < col_end; col += 2)
{
@@ -553,7 +561,17 @@
dest += ops;
src++;
}
+ /* If uneven pixel width, copy last pixel */
+ if (t->output->w & 1) {
+ dest[0] = dest[-ops];
+ dest[1] = dest[-ops+1];
+ dest[2] = dest[-ops+2];
+ }
}
+ /* Duplicate last line */
+ if (t->end_y == t->output->h - 1) {
+ memcpy(GET_PIXEL(t->output, 0, t->end_y),
GET_PIXEL(t->output, 0, t->end_y - 1), t->output->rowstride * 2);
+ }
}
g_thread_exit(NULL);
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit