[Kde-imaging] Re: Gettings a segfault with libkdcraw?

Timothee Groleau tg at timotheegroleau.com
Fri Jul 17 20:06:23 CEST 2009


Hi Gilles, 

Many thanks for your reply and advice, I tried RGBA instead of RGB32 but I had 
the same problem. I eventually managed to get rid of the segfault by changing 
the line
*img = QImage(width, height, QImage::Format_RGB32);
to
img = new QImage(width, height, QImage::Format_RGB32);

So err, this is where I hate being a newbie on this, now the QImage is on the 
heap rather than on the stack, but why does that matter?

Anyway, so my test program runs now, but the resulting jpeg is still 
dark/washed out. just like what dcraw was giving me. So i figured kphotoalbum 
must be doing something else and indeed, the code I took from it is actually 
never executed because a preview is extracted first using the method 
loadDcrawPreview (duh! I can't believe I didn't see that).

So only today do I realize that my raws contain a full size low quality jpeg 
for preview. I was under the wrong assumption that there was only a thumbnail-
size preview. No wonder I could see an image "as what the D60 was showing me".


> Note : libkdcraw as a method to get QImage directly... No need to
> re-invent the wheel

Which method is that? I don't see see any method to convert a QByteArray to a 
QImage in the libkdcraw headers. Only the methods to get the previews seem to 
be able to return a QImage.

Well, thanks again!
Tim.




On 17 July 2009 pm 14:23:39 Gilles Caulier wrote:
> Sound like you init your QImage as RGB, and you fill it in RGBA...
> crash must appear in loop which fill pixels data...
>
> All the rest  is fine.
>
>
> Gilles Caulier
>
> 2009/7/17  <kde at timotheegroleau.com>:
> > Hello there,
> >
> > My name is Tim, I'm a kphotoalbum user and wannabe dev (please bear with
> > me), and I'm trying to use likdcraw build myself a batch conversion
> > utility for my Nikon D60 raws.
> >
> > Although I have some (very rusted) c++ background, I have never developed
> > on linux before so I'm just getting started. I volunteered help to
> > kphotoalbum before but so far, erm, I haven't had time to do anything at
> > all :( .
> >
> > Anyway, I made a one-file test program with code taken from kphotoalbum
> > (see attached  timtest.cpp) which I managed to compile, but which gives
> > me a segfault with  the following output (in the method decodeRAWImage of
> > KDcraw). =============================
> > processing
> > <unknown program name>(8027)/ KDcrawIface::KDcraw::loadFromDcraw: LibRaw:
> > dcraw emulation:  ("-H 0", "-w", "-q 0", "-o 1", "DSC_6323.NEF")
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Reading metadata  pass  0  of  2
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Reading metadata  pass  1  of  2
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Reading RAW data  pass  0  of  2
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Reading RAW data  pass  1  of  2
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Scaling colors  pass  0  of  2
> > Scaling with darkness 0, saturation 4095, and
> > multipliers 1.429688 1.000000 1.933594 1.000000
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Scaling colors  pass  1  of  2
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Pre-interpolating  pass  0  of  2
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Pre-interpolating  pass  1  of  2
> > Bilinear interpolation...
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Interpolating  pass  0  of  3
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Interpolating  pass  1  of  3
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Interpolating  pass  2  of  3
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Converting to RGB  pass  0  of  2
> > Converting to sRGB colorspace...
> > <unknown program name>(8027)/ KDcrawIface::KDcrawPriv::progressCallback:
> > LibRaw progress:  Converting to RGB  pass  1  of  2
> > <unknown program name>(8027)/ KDcrawIface::KDcraw::loadFromDcraw: LibRaw:
> > data info: width= 3900  height= 2613  rgbmax= 255
> > Segmentation fault
> > =============================
> > How can I troubleshoot this and move on?
> >
> > For info on my system, I'm on gentoo, with qt 4.5.2, likdcraw 4.2.4-r1
> > (that's the gentoo version, the header file
> > /usr/include/libkdcraw/version.h shows kdcraw_version[] = "0.4.2")
> >
> > I've uploaded the raw file at the following url, for reference:
> > http://timotheegroleau.com/tmp/DSC_6323.NEF
> >
> > kphotoalbum and the kipi raw exporter have no problem handling this file
> > btw,
> >
> > Maybe to extend on what I am trying to do: I'm making my own utility
> > using code taken from kphotoalbum, because kphotoalbum manages to show me
> > my raws with the color as per what my Nikon D60 was showing me on its
> > LCD. I tried using command line dcraw, and using the raw export in the
> > kipi plugins, but in both cases, no matter what parameters I try to
> > change, I am always getting images which are either too dark or with
> > washed out colors. kphotoalbum shows me the pics just like I want them
> > (the color, exposure, and white balance match the embedded thumbnail
> > created by the camera), out of the box. I looked at the code and it seems
> > to just use all the default settings of libkdcraw. So this is why I'm
> > trying to use it in the same way to see if I would get the same results.
> > If there is another way to manage that, I'd be very happy to hear about
> > it. In particular, if the kipi raw converter plugin could give the same
> > result as kphotoalbum gives me, I'd much rather use that.
> >
> > Any advice is much appreciated, many thanks in advance.
> > Tim.
> >
> >
> > _______________________________________________
> > Kde-imaging mailing list
> > Kde-imaging at kde.org
> > https://mail.kde.org/mailman/listinfo/kde-imaging
>
> _______________________________________________
> Kde-imaging mailing list
> Kde-imaging at kde.org
> https://mail.kde.org/mailman/listinfo/kde-imaging




More information about the Kde-imaging mailing list