Recent comments

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 3 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 3 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 3 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 3 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 3 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 3 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 3 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 3 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 3 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 3 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 3 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 3 months ago

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

Reply to: Usage Examples   13 years 3 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 3 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....

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

This is not bug, this is feature. So, no need to fix it

Reply to: [patch] fix build with lcms2   13 years 3 months ago

LibRaw 0.12 is updated too.

Reply to: [patch] fix build with lcms2   13 years 3 months ago

The github/master version is already fixed in another way:
configure checks will set $LIBS
and Makefile.am uses $(LIBS) instead of $(LCMS_LIBS)

This is commit URL: https://github.com/LibRaw/LibRaw/commit/73229a04fb2a44159df3baa8f812b473...

Reply to: link order   13 years 3 months ago

Thanks for report!

The problem was in Makefile.am, the new one is pushed to GitHub/master (i.e. 0.13-alpha branch)

It is only quick fix, the problem will be solved in more general way

Reply to: About LibRaw   13 years 3 months ago

For float data output we need to change entire processing pipeline to floating point.

There are no such plans for LibRaw team: we're open to contributions, but will not spend much own effort on postprocessing phase.

Reply to: About LibRaw   13 years 3 months ago

32bit float data output would be very beneficial.
Export of full scene referred linear data with no clipping from 14bit chips would be great.

We hacked dcraw about a bit to reverse the scaling that's done with full highlight retention to push superbrights back in to the >1 range and export as exr.

I can see a need for that kind of a feature.

Reply to: Usage Examples   13 years 3 months ago

Thanks for your answer.
i used the -fopenmp and compiled flawlessly.

I really appreciate your help.

Reply to: Usage Examples   13 years 3 months ago

You have compiled LibRaw with OpenMP support, but build your application without OpenMP.

You should add -fopenmp to gcc command line when building your app or rebuild LibRaw with ./configure --disable-openmp

Reply to: Usage Examples   13 years 3 months ago

Hi!
Thanks for the answer.

This is what i get from g++ (a little bit long, sorry about that):
-----
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ahd_interpolateEv.omp_fn.0':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4178: undefined reference to `GOMP_loop_dynamic_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `omp_get_thread_num'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4178: undefined reference to `GOMP_loop_dynamic_next'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4192: undefined reference to `GOMP_loop_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::ahd_interpolate()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:4166: undefined reference to `GOMP_parallel_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.1':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3861: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3861: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.2':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3883: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3883: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15ppg_interpolateEv.omp_fn.3':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3897: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3897: undefined reference to `omp_get_thread_num'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::ppg_interpolate()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3858: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3858: undefined reference to `GOMP_parallel_end'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3880: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3880: undefined reference to `GOMP_parallel_end'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3894: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3894: undefined reference to `GOMP_parallel_end'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `_ZN6LibRaw15wavelet_denoiseEv.omp_fn.4':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `omp_get_num_threads'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `omp_get_thread_num'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3319: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3326: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3334: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3343: undefined reference to `GOMP_barrier'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3355: undefined reference to `GOMP_barrier'
/usr/local/lib/libraw.a(lib_libraw_a-dcraw_common.o): In function `LibRaw::wavelet_denoise()':
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `GOMP_parallel_start'
.../Software/Libraries/LibRaw-0.12.1/internal/dcraw_common.cpp:3313: undefined reference to `GOMP_parallel_end'
collect2: ld returned 1 exit status
-----

I don't really know why the compiler looks for this file, because is not even in the /usr/local/lib or /usr/local/include directories.

I hope this could give you relevant information in order to point me in the right direction.

Thanks in advance!.

Pages