Update of /cvsroot/ufraw/ufraw In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11676
Modified Files: dcraw_api.cc dcraw_api.h ufraw_preview.c ufraw_ufraw.c Log Message: Fix bug #378: Properly support the FUJIFILM X-Trans sensors. Thanks goes to Frank Markesteijn for the patch. Index: dcraw_api.h =================================================================== RCS file: /cvsroot/ufraw/ufraw/dcraw_api.h,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- dcraw_api.h 26 Jul 2014 03:30:09 -0000 1.51 +++ dcraw_api.h 25 Aug 2014 11:30:17 -0000 1.52 @@ -30,7 +30,8 @@ typedef struct { void *dcraw; FILE *ifp; - int width, height, colors, fourColorFilters, filters, raw_color; + int width, height, colors, fourColorFilters, raw_color; + unsigned filters; int top_margin, left_margin, flip, shrink; double pixel_aspect; dcraw_image_data raw; Index: ufraw_preview.c =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v retrieving revision 1.374 retrieving revision 1.375 diff -u -d -r1.374 -r1.375 --- ufraw_preview.c 26 Jul 2014 03:30:10 -0000 1.374 +++ ufraw_preview.c 25 Aug 2014 11:30:17 -0000 1.375 @@ -4423,7 +4423,7 @@ combo = GTK_COMBO_BOX(uf_combo_box_new_text()); if (data->UF->HaveFilters) { if (data->UF->IsXTrans) { - uf_combo_box_append_text(combo, _("X-Trans interpolation"), + uf_combo_box_append_text(combo, _("X-Trans interpolation (slow!)"), (void*)xtrans_interpolation); } else if (data->UF->colors == 4) { uf_combo_box_append_text(combo, _("VNG four color interpolation"), Index: ufraw_ufraw.c =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v retrieving revision 1.278 retrieving revision 1.279 diff -u -d -r1.278 -r1.279 --- ufraw_ufraw.c 15 May 2014 03:30:30 -0000 1.278 +++ ufraw_ufraw.c 25 Aug 2014 11:30:17 -0000 1.279 @@ -1132,7 +1132,7 @@ scale = 2; /* Wanted size is smaller than raw size (size is after a raw->shrink) * (assuming there are filters). */ - } else if (uf->conf->size > 0 && uf->HaveFilters) { + } else if (uf->conf->size > 0 && uf->HaveFilters && !uf->IsXTrans) { int cropHeight = uf->conf->CropY2 - uf->conf->CropY1; int cropWidth = uf->conf->CropX2 - uf->conf->CropX1; int cropSize = MAX(cropHeight, cropWidth); Index: dcraw_api.cc =================================================================== RCS file: /cvsroot/ufraw/ufraw/dcraw_api.cc,v retrieving revision 1.95 retrieving revision 1.96 diff -u -d -r1.95 -r1.96 --- dcraw_api.cc 17 Jan 2014 13:30:14 -0000 1.95 +++ dcraw_api.cc 25 Aug 2014 11:30:17 -0000 1.96 @@ -152,7 +152,7 @@ d->cblack[6 + c] -= i; d->black += i; h->black = d->black; - h->shrink = d->shrink = (h->filters != 0); + h->shrink = d->shrink = (h->filters == 1 || h->filters > 1000); h->pixel_aspect = d->pixel_aspect; /* copied from dcraw's main() */ switch ((d->flip + 3600) % 360) { @@ -231,7 +231,10 @@ h->raw.colors = d->colors; h->fourColorFilters = d->filters; if (d->filters || d->colors == 1) { - d->raw_image = (ushort *) g_malloc((d->raw_height + 7) * d->raw_width * 2); + if (d->colors == 1 || d->filters == 1 || d->filters > 1000) + d->raw_image = (ushort *) g_malloc((d->raw_height + 7) * d->raw_width * 2); + else + d->raw_image = (ushort *) g_malloc(sizeof(dcraw_image_type) * (d->raw_height + 7) * d->raw_width); } else { h->raw.image = d->image = g_new0(dcraw_image_type, d->iheight * d->iwidth + d->meta_length); @@ -251,6 +254,9 @@ d->meta_data = (char *)(d->image + d->iheight * d->iwidth); d->crop_masked_pixels(); g_free(d->raw_image); + + if (d->filters > 1 && d->filters <= 1000) + lin_interpolate_INDI(d->image, d->filters, d->width, d->height, d->colors, d, h); } if (!--d->data_error) d->lastStatus = DCRAW_ERROR; if (d->zero_is_bad) d->remove_zeroes(); @@ -473,7 +479,7 @@ /* hh->raw.image is shrunk in half if there are filters. * If scale is odd we need to "unshrink" it using the info in * hh->fourColorFilters before scaling it. */ - if (hh->filters != 0 && scale % 2 == 1) { + if ((hh->filters == 1 || hh->filters > 1000) && scale % 2 == 1) { fujiWidth = hh->fuji_width / scale; f->image = (dcraw_image_type *) g_realloc(f->image, h * w * sizeof(dcraw_image_type)); @@ -495,7 +501,7 @@ g_free(fseq); } } else { - if (hh->filters != 0) scale /= 2; + if (hh->filters == 1 || hh->filters > 1000) scale /= 2; fujiWidth = ((hh->fuji_width + hh->shrink) >> hh->shrink) / scale; f->image = (dcraw_image_type *)g_realloc( f->image, h * w * sizeof(dcraw_image_type)); @@ -745,12 +751,15 @@ if (interpolation == dcraw_ppg_interpolation && h->colors > 3) interpolation = dcraw_vng_interpolation; f4 = h->fourColorFilters; - for (r = 0; r < h->height; r++) - for (c = 0; c < h->width; c++) { - int cc = fcol_INDI(f4, r, c, h->top_margin, h->left_margin, h->xtrans); - f->image[r * f->width + c][fcol_INDI(ff, r, c, h->top_margin, h->left_margin, h->xtrans)] = - h->raw.image[r / 2 * h->raw.width + c / 2][cc]; - } + if (h->filters == 1 || h->filters > 1000) { + for (r = 0; r < h->height; r++) + for (c = 0; c < h->width; c++) { + int cc = fcol_INDI(f4, r, c, h->top_margin, h->left_margin, h->xtrans); + f->image[r * f->width + c][fcol_INDI(ff, r, c, h->top_margin, h->left_margin, h->xtrans)] = + h->raw.image[r / 2 * h->raw.width + c / 2][cc]; + } + } else + memcpy(f->image, h->raw.image, h->height * h->width * sizeof(dcraw_image_type)); int smoothPasses = 1; if (interpolation == dcraw_bilinear_interpolation) lin_interpolate_INDI(f->image, ff, f->width, f->height, cl, d, h); ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ ufraw-cvs mailing list ufraw-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ufraw-cvs