Recent comments

Reply to: Shared library   13 years 3 months ago

Because LibRaw is so widely used, I agree that shared libs looks comfortable. I wanted to delay sharedlibs until LibRaw 1.0, but you're so impatient.

If you can provide patches for configure.ac/Makefile.am, these patches are welcome.

The only question is right shared library versioning.
LibRaw API/ABI does not change within major *stable* release (i.e. 0.12.0-Release and 0.12.5-Release have same API and same control structures layout).
API usually changes within Alpha development cycle (from Alpha1 to Beta1) and may change during Beta cycle (between Beta1 and .0-Release).
Is it better to have permanently incrementing library version (i.e. 0.14.Alpha1 ->so.5.0, Alpha2->so.6.0 and so), or version numbers should be incremented only for -Release libraries?

Reply to: Shared library   13 years 3 months ago

Shared libraries help distributors, even if the interface is constantly changing. Currently with static libraries, we have to keep rebuilding shotwell manually when we update libraw.

If you generated a shared library, we would make a binary package for this, e.g. libraw13 containing /usr/lib/libraw.so.13.0.0. Shotwell would be linked against this. If you release a new libraw with API changes, then we would make a new binary package libraw14 containing /usr/lib/libraw.so.14.0.0.

This is much the same as the statically linked case, but the advantages are:
- We can easily detect that shotwell is using the old libraw version as we would no longer be able to build libraw13. So we can automatically mark shotwell as needing a recompile.
- If you make a point release and don't change the major version number then no recompilation is required
- If we patch libraw then no recompilation of shotwell is required.

From a distributors point of view we don't mind how often you change the library version number (so if you don't want to make ABI guarantees then just keep increasing the version). libraw.so.999.0.0 is fine with us.

Reply to: Build of 0.13-beta3 on most recent Mac OSX 10.6   13 years 3 months ago

Yes, it was 0.13-beta problem, PACKAGE_REQUIRES was not set in configure.

The problem has fixed in 0.13-Release.

The 0.12 branch was not affected.

Reply to: About LibRaw   13 years 3 months ago

Could you please list these alternatives?

Reply to: About LibRaw   13 years 3 months ago

I don't think there is much point in the whole project if its not in Floating point. There are lots of good enough alternatives.

Reply to: Build of 0.13-beta3 on most recent Mac OSX 10.6   13 years 3 months ago

This issue will be fixed in coming 0.12.4 and 0.13.0-Release.

Thanks for report.

Reply to: Build of 0.13-beta3 on most recent Mac OSX 10.6   13 years 3 months ago

same here on Linux openSUSE, Ubuntu and maybe more.
If the LibRaw/libraw.pc.in:8 is never substituted from the configure/configure.ac then its maybe safe to remove that from LibRaw/libraw.pc.in .

LibRaw/libraw.pc.in:8
Requires: @PACKAGE_REQUIRES@

Reply to: LibRaw using CodeBlocks   13 years 3 months ago

Problem solved, Hurray !!!

And it was not so complicated. In case of anyone having the same problem :

- Download the win32 zip of LibRaw (available on this website)
- open the makefile.mingw present in the LibRaw root folder and add the option "-mno-cygwin" to the cflags (this was obvious...)
- rename the Makefile.mingw in Makefile
- compile LibRaw using cygwin and make

You will now have a libraw.a present in the lib folder of LibRaw. This library can be used with codeblocks. You'll probably need to add the ws2_32 lib just after the libraw lib or you'll get undefined references to ntohs4.

Regards

Reply to: Shared library   13 years 3 months ago

You're right.

But from *my* point of view, it is too early to go shared, because too many things will change in LibRaw in near future. We definitely will switch to .so, but not now.

So, if you wish to make .so package for Unix/Linux systems, you'll do it on your own risk.

Reply to: Shared library   13 years 3 months ago

I'll say it again: Look at the UNIX world and see how it's done. LibRaw is not so unique. Plenty of other software libraries have encountered these issues, and yet they distribute as shared libraries right from the start.

Believe it or not, it can work. What's more -- and I hope you take this to heart -- library versioning is not a problem you need to solve. It's been solved elsewhere. Please investigate before you go down that path.

Reply to: [patch] fix dcraw emulation binary   13 years 3 months ago

Sure, dcraw_emu appends .tiff or .ppm to existing image filename.

This is very useful if someone (e.g. me) uses both dcraw and dcraw_emu in parallel (for example, for results comparsion): one program does not overwrites results of another one.

Also, if you have both DSCF0001.ARW a DSCF0001.NEF (from Sony and Nikon, respectively), 'dcraw DSCF0001.*' will produce only one resulting file, while dcraw_emu will save both results in separate files.

Reply to: [patch] fix dcraw emulation binary   13 years 4 months ago

Just to ensure I didn't get anything wrong: dcraw_emu appends to the output filename, rather than changing the extension, ie 'foo.nef' becomes 'foo.nef.tiff'; this is clearly not what the user expects, and there is no way to specify the resulting filename.

The patch I propose addresses the unexpected behaviour, also bringing it inline with DCRAW's behaviour. I see no good reasons for keeping the unexpected behaviour, and I was careful to use bounded copies etc.

I was thinking this patch should go into the libraw 0.13 stream, no? If not, for what reasons?

Thanks, Daniel

Reply to: Shared library   13 years 4 months ago

Again, if I have software-1 compiled with 0.12 and then install software-2 which requires 0.13, I need to rebuild software-1. For many users this is unacceptable too.

There is a very good solution: shared library versioning. It works well for near-stable products/libraries, not for new versions every 2-4 weeks (current LibRaw).

When LibRaw becomes more stable in terms of API, we'll definitely switch to shared libraries with versioning.

Reply to: Shared library   13 years 4 months ago

This is an old, old debate that goes back to when shared libraries were first developed. Your examples are fine, but consider the common case of wanting to take advantage of the bugs fixed in 0.12.3. Users of 0.12.2 need to rebuild all software that depends on libraw. For many users, this is unacceptable.

One common way to deal with the API/ABI problem is to say that the API won't change for a given release number, say, 0.12. In 0.13, the API might change (or it might not). Software writers can deal with this as they like.

I would encourage you to examine how other open-source projects deal with this problem. Almost all open-source libraries out there with unstable APIs release their software as shared libraries.

Some people would say there is no such thing as a stable API; even mature libraries, like GTK, are still undergoing revision.

Finally, note that packaging libraw into a .so does *not* force everyone to use it as such. Application writers may statically link in the .o's if they want.

Reply to: Usage Examples   13 years 4 months ago

Thanks for the answer.

I didn't know that the raw data can come compressed from the camera, thanks for the tip. Just curious, can you tell me which kind of compression can be found usually? deflate?, other?...

I want the data unpacked, so i will reuse the unprocessed_raw sample as you suggest, using the P1.colors=1.

I'm sorry for all the questions, i really value your help.

Reply to: Shared library   13 years 4 months ago

But another problem raise:

- imagine someone installed, say, Program1 0.AA.BB with LibRaw 0.11 (shared)
- then he/she wants to try, say, Program2. Progam 2 requires LibRaw 0.13-Beta (shared) because it uses exposure correction feature.

So, user SHOULD rebuild/reinstall Program1 with LibRaw 0.13. But he wanted only to play 5 minutes with Program2, nothing more.....

The shared library are very good idea if
- API/ABI is very stable (but frozen API stops development of new features)
- API is made via non-virtual function calls instead of direct access to parameters structure. This way produces zillions of getters/setters with no idea behind. Also, it is harder to make C++ derived classes, because virtual methods table is fixed too, so no way to add/change function calls.
- there are good .SO/DLL version management, so each program uses own version of LibRaw.so/dll. But this broke the idea of quick 'security/bug fixes'.

You may be *stable* (in terms of API/ABI) but it will slow progress because programmer will need to do tricks (to stabilize APIs and so) instead of doing things.

I hope, after verisions 0.14 or 0.17 LibRaw will be stabilized: we need plugin registration interface, so all extensions will run with stable internals. But not now.

Reply to: Usage Examples   13 years 4 months ago

Please describe, what kind of data do you want:

- compressed (as in file)
- or unpacked ?

If you wand 'file' data (compressed by lossless jpeg or so), you need to position to data offset and read the data manually (and unpack them)

If you want unpacked data (huffman decoded or so), just use unprocessed_raw sample as your base.

Reply to: Usage Examples   13 years 4 months ago

Thanks for the "dirty trick" info.
I will add the P1.colors=1 to my code and try again.

About your first suggestion, you mention three steps:
1) Call LibRaw::open_file()
2) Position to libraw_internal_data.unpacker_data.data_offset
3) Read libraw_internal_data.unpacker_data.data_size bytes

So i try to code you suggestion:

int main(int i, char *img[])
{
  i=1;
  int tempimg, row, col;
 
// step one: Open file
  LibRaw RawProcessor;
  tempimg = RawProcessor.open_file(img[i]);
#define RAW RawProcessor.libraw_internal_data.unpacker_data
 
// step two: positioning libraw_internal_data.unpacker_data.data_offset
  tmpimg = RawProcessor.unpack();
 
/* how to position it in data.offset?... */
 
// step three: Read libraw_internal_data.unpacker_data.data_size
  for(row=0;row<RAW.data_size.iheight;row++)
    for(col=0;col<RAW.data_size.iwidth;col++)
      RAW[row*RAW.data_size.iwidth+col][0] = RAW[row*RAW.data_size.iwidth+col][RawProcessor.COLOR(row,col)];
 
// mode coding, not finished yet...
 
  RawProcessor.recycle();
  return 0;
}

Am i in the right direction or i'm completely lost?...

Really appreciate any comments you can give me.

Reply to: Shared library   13 years 4 months ago

That's fine, I understand that when the API/ABI changes this isn't so simple. But that doesn't mean each version can't be a shared library (i.e. libraw.so). That way if a user upgrades from 0.12.2 to 0.12.3, they get all the benefits of bug fixes without having to recompile all the software that uses libraw.

Reply to: Usage Examples   13 years 4 months ago

To turn on pretty printing of code use
<code>
.... your code here
</code>

Also, to pass through antispam filter and captcha, it is better to register on this site once...

Reply to: Usage Examples   13 years 4 months ago
Sorry for bad formatting, I'll install plugin for right code display, but not today.

The 'dirty trick' in unprocessed_raw.cpp is P1.colors=1; This is instruction to dump only first component for the internal tiff writer.

The result is larger than source RAW because:

  • The source RAW is compressed, while resulting .tiff is uncompressed
  • The source RAW has 12 or 14 (or, may be, 10) bits per pixel, while resulting .tiff is stored in 16-bit per pixel format.
Reply to: Usage Examples   13 years 4 months ago

Thanks for your answer.

Obviously my cleaning wasn't good, i ran the unprocessed_raw with a raw image file of 11.2MB and the result was a .tiff file with 18.4MB, so i have check my code. Here is the small routine (without validations) that i did:
---

int main(int i, char *rawimg[])
  {
// Initialization
  LibRaw RawProcessor;
  RawProcessor.imgdata.params.document_mode = 2;
  RawProcessor.imgdata.params.output_bps = 16;
  RawProcessor.imgdata.params.output_tiff = 1;
  RawProcessor.imgdata.params.user_flip = 0;
  RawProcessor.imgdata.params.no_auto_bright = 1;
  RawProcessor.imgdata.params.filtering_mode = (LibRaw_filtering)(LIBRAW_FILTERING_DEFAULT);
 
// Opening file and unpack
  int tmpimg;
  i = 1;
  tmpimg = RawProcessor.open_file(rawimg[i]);
  tmpimg = RawProcessor.unpack();
 
// extracting raw image data
  int row, col;
  char rawfn[1024];
  for(row=0;row<RawProcessor.imgdata.sizes.iheight;row++)
    for(col=0;col<RawProcessor.imgdata.sizes.iwidth;col++)
      RawProcessor.imgdata.image[row*RawProcessor.imgdata.sizes.iwidth+col][0]= 
      RawProcessor.imgdata.image[row*RawProcessor.imgdata.sizes.iwidth+col]
      [RawProcessor.COLOR(row,col)];
 
// formating and saving image data
  snprintf(rawfn,sizeof(rawfn),"%s.tiff",rawimg[i]);
  tmpimg = RawProcessor.dcraw_ppm_tiff_writer(rawfn);
 
// cleaning image processor
  RawProcessor.recycle();
 
  return 0;
}

---

If the unprocessed_raw extract only the raw data, without process anything, why the resultant file is bigger that the original?.

According with your suggestion, how can i do the step two (position to libraw_internal_data.unpacker_data.data_offset), and the step three (Read libraw_internal_data.unpacker_data.data_size bytes)?

For the step three, i assume can be done using a "for" structure, but if you can show a basic example code for your suggestion it will be really helpful for me, because i'm not an expert.

Thank you for your time and help.

Reply to: Usage Examples   13 years 4 months ago

If you use unchanged unprocessed_raw sample, what size has the result?

Reply to: Usage Examples   13 years 4 months ago

I took the unprocessed_raw.cpp, clean it a little bit the code and processed a 11MB image raw file, but the resultant have 55MB, so i assume that there is a post-processing when saving the file in .tiff format.

I basically want to extract the raw image data, without metadata, read it, make a little processing and then save it in a new file.

In order to do that, your suggestion looks what i need to do, but can you please give a reference code about how to implement it?. I'm not asking for an elaborate coding, only a few lines in order to follow the idea.

I'm not c++ expert, so if the question is basic or simple, i'm sorry.

Reply to: Shared library   13 years 4 months ago

Unfortunately, LibRaw is binary incompatible between major versions (i.e. 0.13 vs 0.12), so binary upgrade is really not possible.

Compatibility is ensured only within stable versions of one release (0.12.3 should be compatible with 0.12.99).

This is other side of active development....

Pages