- Who May Be Interested in This Project
- Goals and Objectives
- LibRaw Support Principles
- Implemented Improvements of dcraw
- Planned Improvements
Who May Be Interested in This Project
The proposed project and the software products generated within this project are intended for
- Developers of RAW converters, including current and new developments
- Those willing to write their own graphic interface for RAW file processing
- Developers and enthusiasts creating their own primary and auxiliary data processing algorithms,
- Interpolation (de-Bayer),
- Noise reduction
- White balance
- Correction of aberrations and distortions
- Color conversions (e.g., creation, editing and application of camera profiles )
- RAW data analysis
- Comparison of cameras and lenses
- and so on...
Among the few existing implementations of RAW converters, those based on the dcraw utility by Dave Coffin are the most used. It is hard to find a more or less popular camera that is not supported by this utility; while the implementation of RAW data extraction in dcraw is of a very high quality.
However, developers and enthusiasts who use or are going to use dcraw for fulfilling the above-listed and similar objectives encounter a number of difficulties. First, the author of dcraw refuses to turn his product into a handy library, yet permitting anybody else to do so. Besides, dcraw contains a number of questionable features which may hinder its use without modifications, as well as instances of distortions in the photographic sense of it. As a result, once every several months, virtually all developers, part of them listed on the dcraw Web site, independently convert each subsequent release of the software into the library.
As for enthusiasts, the "entry cost" of verifying their own ideas and implementing their own algorithms is often unreasonably high: they have to either use the dcraw command line, thus being forced to use the unavoidable early processing stages, or understand the source code and maintain their own library based on it.
Thus, the inconveniences of dcraw make the developers' community quite small and halt further evolution and improvement of RAW format converters.
Goals and Objectives
We are going to create LibRaw in order to "get a library based on dcraw, only better". Thus:
- To "librarize" dcraw, i.e., to develop a stable and consistent API suitable for other applications (RAW converters, data analyzers, panorama stitchers, etc.).
- To divide processing into independent parts (groups of API calls)
- Reading, decoding, and unpacking of RAW data: this is the main functionality of LibRaw
- Data conversions: interpolation, white balance, etc.
- File output of the processing results.
- To improve the procedures of RAW data retrieval and decoding (see below for details)
- To supply other developers with a "framework" (freeware and open-source), e.g., for experimenting with their own methods of RAW data processing (interpolation, noise reduction, white balance, etc.; some directions of the possible efforts are listed above), so that they could create their own GUI programs and interfaces without developing the entire RAW converter.
- To ensure easy modification for code synchronization with dcraw releases.
LibRaw Support Principles
- To reproduce the functionality of dcraw using its source code as the basis for our work; to achieve binary identity of results generated by dcraw and by LibRaw-based utilities, provided the same processing settings are used.
- To support new cameras ASAP, faster than most commercial software.
- To monitor future improvements in dcraw (support of new cameras, error correction, use of better algorithms) and import them from dcraw to LibRaw.
Implemented Improvements of dcraw
As of the time of writing, additional improvements to the dcraw source code have been introduced into LibRaw:
- All global variables have been removed (while linking the thread-safe version, static variables of functions have been removed as well).
- Thread safety. An example of its use in the multithreaded model is included into the library distribution package.
- Data extracted from a RAW file is already somewhat structured: geometry is separated from color data. This work has not yet been completed; it will be continued simultaneously with the work on improvement of EXIF processing.
- Retrieval of RAW data and thumbnail can be performed in two or three API calls with a very simple program interface.
- Work with color information: color data (white balance coefficients, tone curve, etc.) has flags referencing the source of this information: retrieved from RAW data, calculated from the image itself, or taken from the code as constants.
- ICC profile is extracted (for those RAW files that contain it).
- The image itself and the thumbnail can be retrieved by successive calls, without reopening the file or relaunching the library.
- The required amount of RAM is somewhat lower.
- Work with masked pixels and black subtraction:: it is possible to turn off all data filtering and black level subtraction.
- Processing of the black frame: data read from the black frame (or two black frames, for cameras that have two) is accessible from the calling application (this may be necessary, e.g., for suppression of certain artifacts, including banding).
- Processing the extremes of the value range: minimum values (often referred to as black point) and
maximum values (saturation point).
- The black point is not subtracted from the data at the unpacking stage, in contrast to the implementation found in dcraw: the calling application may have its own plans, e.g., channel-wise subtraction of the minimum.
- The maximum values are calculated on per-channel basis. Calculation of the maximum values for a given camera sample at a specified sensitivity (converter calibration) is to be done in the application that calls LibRaw.
The dcraw code needs significant modifications and additions:
- Single-pass unpacking of RAW files containing several image variants/planes: for applicable cameras (Fuji cameras, cameras with 4-shot/16-shot modes), several planes of the same image will be extracted.
- Processing of the EXIF/Makernote data: retrieval of large data amounts, including
- Extraction of the maximum possible amount of color data (white balance settings, profile, tone curve, contrast settings, etc.)
- Color data generalization: reduction of color data from different cameras "to a common denominator" in order to facilitate color processing (without loss of quality)
- Extraction of camera data (firmware version, serial number)
- Extraction of photographic data (lens used, focusing distance, focus points and their coordinates, etc.)
At the same time, we are not planning any modifications or extensions of the dcraw data processing code (de-Bayer, color conversions, etc.); all of this is up to the calling application. Standard processing modes included in dcraw will be preserved for an indefinite time in the set of dcraw-emulating API calls, with the exception of LCMS and libjpeg support, as well as certain processing stages of minor importance.