Merge commit '638ecc4cde79b0296f2e04f683ca4cb881c28f36' as 'rtengine/libraw'

This commit is contained in:
Lawrence Lee
2023-11-12 11:49:00 -08:00
213 changed files with 77043 additions and 0 deletions

View File

@@ -0,0 +1,187 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body>
<p>LibRaw: C API<a href="index.html">[back to Index]</a></p>
<h1>LibRaw: C API</h1>
<p>LibRaw C API is a wrapper around C++ API; therefore, virtually all
documentation to C API functions is represented by a set of hyperlinks to
the corresponding places in the <a href="API-CXX.html">description of C++
API</a>.</p>
<p>Contents</p>
<ol>
<li><a href="#init">Initialization and de</a><a href="#init">nitialization</a></li>
<li><a href="#return">Returned values</a></li>
<li><a href="#dataload">Data loading</a></li>
<li><a href="#setters">Parameters getters/setters</a></li>
<li><a href="#utility">Auxiliary Functions</a></li>
<li><a href="#dcrawemu">Data Postprocessing, Emulation of dcraw Behavior</a>
<ul>
<li><a href="#dcrawparams">Setting of Parameters</a></li>
<li><a href="#emu">Emulation of dcraw Behavior</a></li>
</ul>
</li>
<li><a href="#write">Writing to Output Files</a></li>
<li><a href="#memwrite">Writing processing results to memory buffer</a></li>
</ol>
<p><a name="init"></a></p>
<h2>Initialization and denitialization</h2>
<dl>
<dt>libraw_data_t *libraw_init(unsigned int flags);</dt>
<dd> The function returns the pointer to the <a href="#API-datastruct.html#libraw_data_t">instance
of libraw_data_t structure</a>.<br>
The resultant pointer should be passed as the first argument to all C
API functions (except for libraw_strerror). <br>
Returns NULL in case of error, pointer to the structure in all other
cases. </dd>
<dt>void libraw_close(libraw_data_t *);</dt>
<dd> Closes libraw_data_t handler and deallocates all memory. </dd>
</dl>
<p><a name="return"></a></p>
<h2>Returned values</h2>
<p>Functions of C API return EINVAL (see errno.h) if the null pointer was
passed to them as the first argument. In all other cases, the <a href="API-CXX.html#return">C++
API return code</a> is returned.</p>
<p><a name="dataload"></a></p>
<h2>Data Loading from a File/Buffer</h2>
<dl>
<dt>int libraw_open_file(libraw_data_t*, const char *)</dt>
<dt>int libraw_open_file_ex(libraw_data_t*, const char *,INT64
bigfile_size)</dt>
<dt>WIN32: int libraw_open_wfile(libraw_data_t*, const wchar_t *)</dt>
<dt>WIN32: int libraw_open_wfile_ex(libraw_data_t*, const wchar_t *,INT64
bigfile_size)</dt>
<dd>See <a href="API-CXX.html#open_file">LibRaw::open_file()</a></dd>
<dt>int libraw_open_buffer(libraw_data_t*, void *buffer, size_t bufsize)</dt>
<dd>See <a href="API-CXX.html#open_buffer">LibRaw::open_buffer()</a></dd>
<dt>int libraw_open_bayer(libraw_data_t *lr, unsigned char *data, unsigned
datalen, ushort _raw_width, ushort _raw_height, ushort _left_margin,
ushort _top_margin, ushort _right_margin, ushort _bottom_margin,
unsigned char procflags, unsigned char bayer_battern, unsigned
unused_bits, unsigned otherflags, unsigned black_level)</dt>
<dd>See <a href="API-CXX.html#open_bayer">LibRaw::open_bayer()</a></dd>
<dt>int libraw_unpack(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#unpack">LibRaw::unpack()</a></dd>
<dt>int libraw_unpack_thumb(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#unpack_thumb">LibRaw::unpack_thumb()</a></dd>
<dt>int libraw_unpack_thumb_ex(libraw_data_t*,int);</dt>
<dd>See <a href="API-CXX.html#unpack_thumb_ex">LibRaw::unpack_thumb_ex()</a></dd>
</dl>
<p><a name="setters"></a></p>
<h2>Parameters setters/getters</h2>
<p>These functions provides interface to imgdata.params, .sizes and .color
fields which works regardless of LibRaw versions used when building
calling app and the library itself.</p>
<ul>
<li>int libraw_get_raw_height(libraw_data_t *lr); </li>
<li>int libraw_get_raw_width(libraw_data_t *lr); </li>
<li>int libraw_get_iheight(libraw_data_t *lr); </li>
<li>int libraw_get_iwidth(libraw_data_t *lr); </li>
<li>float libraw_get_cam_mul(libraw_data_t *lr,int index); </li>
<li>float libraw_get_pre_mul(libraw_data_t *lr,int index); </li>
<li>float libraw_get_rgb_cam(libraw_data_t *lr,int index1, int index2);</li>
<li>libraw_iparams_t *libraw_get_iparams(libraw_data_t *lr);</li>
<li>libraw_lensinfo_t *libraw_get_lensinfo(libraw_data_t *lr);</li>
<li>libraw_imgother_t *libraw_get_imgother(libraw_data_t *lr);</li>
<li>int libraw_get_color_maximum(libraw_data_t *lr); </li>
<li>void libraw_set_user_mul(libraw_data_t *lr,int index, float val);</li>
<li>void libraw_set_demosaic(libraw_data_t *lr,int value); </li>
<li>void libraw_set_adjust_maximum_thr(libraw_data_t *lr,float value); </li>
<li>void libraw_set_output_color(libraw_data_t *lr,int value); </li>
<li>void libraw_set_output_bps(libraw_data_t *lr,int value);</li>
<li>void libraw_set_gamma(libraw_data_t *lr,int index, float value);</li>
<li>void libraw_set_no_auto_bright(libraw_data_t *lr,int value);</li>
<li>void libraw_set_bright(libraw_data_t *lr,float value);</li>
<li>void libraw_set_highlight(libraw_data_t *lr,int value);</li>
<li>void libraw_set_fbdd_noiserd(libraw_data_t *lr,int value);</li>
</ul>
<p><a name="utility"></a></p>
<h2>Auxiliary Functions</h2>
<dl>
<dt>const char* libraw_version()</dt>
<dd>See <a href="API-CXX.html#version">LibRaw::version()</a></dd>
<dt>int libraw_versionNumber()</dt>
<dt>See <a href="API-CXX.html#versionNumber">LibRaw::versionNumber()</a><br>
</dt>
<dd>See <a href="API-CXX.html#versionNumber">LibRaw::versionNumber()</a></dd>
<dt>bool LIBRAW_CHECK_VERSION(major,minor,patch)</dt>
<dd>See <a href="API-CXX.html#LIBRAW_CHECK_VERSION">LIBRAW_CHECK_VERSION</a></dd>
<dt>unsigned libraw_capabilities()</dt>
<dd>See <a href="API-CXX.html#capabilities">LibRaw::capabilities()</a></dd>
<dt>int libraw_cameraCount()</dt>
<dd>See <a href="API-CXX.html#cameraCount">LibRaw::cameraCount()</a></dd>
<dt>const char* libraw_cameraList()</dt>
<dd>See <a href="API-CXX.html#cameraList">LibRaw::cameraList()</a></dd>
<dt>int libraw_get_decoder_info(libraw_data_t*,libraw_decoder_info_t *);</dt>
<dd>See <a href="API-CXX.html#get_decoder_info">LibRaw::get_decoder_info()</a></dd>
<dt>const char* libraw_unpack_function_name(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#unpack_function_name">LibRaw::unpack_function_name()</a></dd>
<dt>int libraw_COLOR(libraw_data_t*,int row,int col);</dt>
<dd>See <a href="API-CXX.html#COLOR">LibRaw::COLOR()</a></dd>
<dt>void libraw_subtract_black(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#add_subtract_black">LibRaw::subtract_black()</a></dd>
<dt>void libraw_recycle_datastream(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#recycle_datastream">LibRaw::recycle_datastream()</a></dd>
<dt>void libraw_recycle(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#recycle">LibRaw::recycle()</a></dd>
<dt>const char *libraw_strerror(int errorcode);</dt>
<dd>See <a href="API-CXX.html#libraw_strerror">LibRaw::strerror</a></dd>
<dt>const char *libraw_strprogress(enum LibRaw_progress);</dt>
<dd>See <a href="API-CXX.html#strprogress">LibRaw::strprogress</a></dd>
<dt>void libraw_set_dataerror_handler(libraw_data_t*,data_callback func,
void *);</dt>
<dd>See <a href="API-CXX.html#dataerror">LibRaw::set_dataerror_handler()</a></dd>
<dt>void libraw_set_progress_handler(libraw_data_t*,progress_callback
func, void *);</dt>
<dd>See <a href="API-CXX.html#progress">LibRaw::set_progress_handler()</a></dd>
</dl>
<p><a name="dcrawemu"></a></p>
<h2>Data Postprocessing, Emulation of dcraw Behavior</h2>
<p><a name="dcrawparams"></a></p>
<h3>Setting of Parameters</h3>
<p>The postprocessing parameters for the calls described below are set, just
as for C++ API, via setting of fields in the libraw_output_params_t
structure:</p>
<pre> libraw_data_t *ptr = libraw_init(0);
ptr-&gt;params.output_tiff = 1; // output to TIFF
</pre>
<p>Fields of this structure are described in the <a href="API-datastruct.html#libraw_output_params_t">documentation
to libraw_output_params_t</a>. For notes on their use, see <a href="API-notes.html">API
notes</a>.</p>
<p><a name="emu"></a></p>
<h3>Emulation of dcraw Behavior</h3>
<dl>
<dt>int libraw_raw2image(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#raw2image">LibRaw::raw2image</a></dd>
<dt>int libraw_free_image(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#free_image">LibRaw::free_image</a></dd>
<dt>int libraw_adjust_sizes_info_only(libraw_data_t*);</dt>
<dd>See <a href="API-CXX.html#adjust_sizes_info_only">LibRaw::adjust_sizes_info_only()</a></dd>
<dt>int libraw_dcraw_process(libraw_data_t* lr);</dt>
<dd>See <a href="API-CXX.html#dcraw_process">LibRaw::dcraw_process()</a></dd>
</dl>
<h2>Writing to Output Files</h2>
<dl>
<dt>int libraw_dcraw_ppm_tiff_writer(libraw_data_t* lr,const char
*filename);</dt>
<dd>See <a href="API-CXX.html#dcraw_ppm_tiff_writer">LibRaw::dcraw_ppm_tiff_writer()</a></dd>
<dt>int libraw_dcraw_thumb_writer(libraw_data_t* lr,const char *fname);</dt>
<dd>See <a href="API-CXX.html#dcraw_thumb_writer">LibRaw::dcraw_thumb_writer()</a></dd>
</dl>
<h2>Writing processing results to memory buffer</h2>
<dl>
<dt>libraw_processed_image_t *libraw_dcraw_make_mem_image(libraw_data_t*
lr,int * errcode)</dt>
<dd>See <a href="API-CXX.html#dcraw_make_mem_image">LibRaw::dcraw_make_mem_image()</a></dd>
<dt>libraw_processed_image_t *libraw_dcraw_make_mem_thumb(libraw_data_t*
lr,int * errcode)</dt>
<dd>See <a href="API-CXX.html#dcraw_make_mem_thumb">LibRaw::dcraw_make_mem_thumb()</a></dd>
<dt>void libraw_dcraw_clear_mem(libraw_processed_image_t *);</dt>
<dd>See <a href="API-CXX.html#dcraw_clear_mem">LibRaw::dcraw_clear_mem()</a></dd>
<dd><br>
</dd>
</dl>
<p><a href="index.html">[back to Index]</a></p>
</body>
</html>

View File

@@ -0,0 +1,881 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body>
<p>LibRaw C++ API<a href="index.html">[back to Index]</a></p>
<h1>LibRaw C++ API</h1>
<p>Contents</p>
<ol>
<li><a href="#LibRaw">LibRaw Objects</a></li>
<li><a href="#return">Returned values</a></li>
<li><a href="#dataload">Methods Loading Data from a File</a>
<ul>
<li><a href="#open_datastream">int
LibRaw::open_datastream(LibRaw_abstract_datastream *stream)</a></li>
<li><a href="#open_file">int LibRaw::open_file(const char
*rawfile[,INT64 bigfile_size])</a></li>
<li><a href="#open_buffer">int LibRaw::open_buffer(void *buffer,
size_t bufsize)</a></li>
<li><a href="#open_bayer">int LibRaw::open_bayer(...)</a></li>
<li><a href="#unpack">int LibRaw::unpack(void)</a></li>
<li><a href="#unpack_thumb">int LibRaw::unpack_thumb(void)</a></li>
<li><a href="#unpack_thumb_ex">int LibRaw::unpack_thumb_ex(int)</a></li>
</ul>
</li>
<li><a href="#utility">Auxiliary Functions</a>
<ul>
<li>Library version info
<ul>
<li><a href="#version">const char* LibRaw::version()</a></li>
<li><a href="#versionNumber">int LibRaw::versionNumber()</a></li>
<li><a href="#LIBRAW_CHECK_VERSION">bool
LIBRAW_CHECK_VERSION(major,minor,patch)</a></li>
</ul>
</li>
<li>List of supported cameras
<ul>
<li><a href="#cameraCount">int LibRaw::cameraCount()</a></li>
<li><a href="#cameraList">const char** LibRaw::cameraList()</a></li>
</ul>
</li>
<li><a href="#set_rawspeed_camerafile">int
LibRaw::set_rawspeed_camerafile(char *path_to_cameras_xml)</a></li>
<li><a href="#get_decoder_info">int
LibRaw::get_decoder_info(libraw_decoder_info_t *)</a></li>
<li><a href="#unpack_function_name">const char*
LibRaw::unpack_function_name()</a></li>
<li><a href="#COLOR">int LibRaw::COLOR()</a></li>
<li><a href="#error_count">int LibRaw::error_count()</a></li>
<li><a href="#setCancelFlag">void LibRaw::setCancelFlag()</a></li>
<li><a href="#clearCancelFlag">void LibRaw::clearCancelFlag()</a></li>
<li><a href="#subtract_black">int LibRaw::subtract_black()</a></li>
<li><a href="#adjust_to_raw_inset_crop">int
LibRaw::adjust_to_raw_inset_crop()</a></li>
<li><a href="#floatingpoint">Support for Floating Point data</a></li>
<li><a href="#ycc">Support for YCC formats</a></li>
<li><a href="#recycle">void LibRaw::recycle_datastream(void)</a></li>
<li><a href="#recycle">void LibRaw::recycle(void)</a></li>
<li><a href="#%7ELibRaw">LibRaw::~LibRaw()</a></li>
<li><a href="#strprogress">const char* LibRaw::strprogress(enum
LibRaw_progress code)</a></li>
<li><a href="#libraw_strerror">const char* LibRaw::strerror(int
errorcode)</a></li>
<li><a href="#callbacks">Setting Error Notification Functions and
other callbacks</a>
<ul>
<li><a href="#progress">User callback for progress
indication/interruption</a></li>
<li><a href="#exif">User callback for exif/makernotes parser
routines</a></li>
<li><a href="#dataerror">File Read Error Notifier</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#dcrawemu">Data Postprocessing: Emulation of dcraw Behavior</a>
<ul>
<li><a href="#dcraw_params">Parameter Setting</a></li>
<li><a href="#raw2image">int LibRaw::raw2image</a></li>
<li><a href="#free_image">void LibRaw::free_image</a></li>
<li><a href="#adjust_sizes_info_only">int
LibRaw::adjust_sizes_info_only(void)</a></li>
<li><a href="#dcraw_process">int LibRaw::dcraw_process(void)</a></li>
</ul>
</li>
<li><a href="#dcrawrite">Data Output to Files: Emulation of dcraw Behavior</a>
<ul>
<li><a href="#dcraw_ppm_tiff_writer">int
LibRaw::dcraw_ppm_tiff_writer(const char *outfile)</a></li>
<li><a href="#dcraw_thumb_writer">int LibRaw::dcraw_thumb_writer(const
char *thumbfile)</a></li>
</ul>
</li>
<li><a href="#memwrite">Copying unpacked data into memory buffer</a>
<ul>
<li><a href="#get_mem_image_format">void get_mem_image_format(int
*widthp, int *heightp, int *colorsp, int *bpp)</a></li>
<li><a href="#copy_mem_image">int LibRaw::copy_mem_image(void* scan0,
int stride, int bgr)</a></li>
<li><a href="#dcraw_make_mem_image">libraw_processed_image_t
*dcraw_make_mem_image(int *errorcode)</a></li>
<li><a href="#dcraw_make_mem_thumb">libraw_processed_image_t
*dcraw_make_mem_thumb(int *errorcode)</a></li>
<li><a href="#dcraw_clear_mem">void
LibRaw::dcraw_clear_mem(libraw_processed_image_t *)</a></li>
</ul>
</li>
<li><a href="#datastream">Input layer abstraction</a>
<ul>
<li><a href="LibRaw_abstract_datastream">class
LibRaw_abstract_datastream - abstract RAW read interface</a><a href="#datastream_methods">LibRaw_abstract_datastream
class methods</a>
<ul>
<li><a href="#datastream_methods_utility">Object verification</a></li>
<li><a href="#datastream_methods_read">Stream read and positioning</a></li>
<li><a href="#datastream_methods_other">Other methods</a></li>
</ul>
</li>
<li><a href="#datastream_derived">Derived input classes included in
LibRaw</a>
<ul>
<li><a href="#file_datastream">class LibRaw_file_datastream - file
input interface</a></li>
<li><a href="#bigfile_datastream">class LibRaw_file_datastream -
file input interface for large files</a></li>
<li><a href="#buffer_datastream">class LibRaw_buffer_datastream -
input from memory buffer</a></li>
</ul>
</li>
<li><a href="#own_datastreams">Own datastream derived classes</a>
<ul>
<li><a href="#substream">substream field: secondary input stream</a></li>
</ul>
</li>
</ul>
</li>
</ol>
<p><a name="LibRaw"></a></p>
<h2>LibRaw Objects</h2>
<p>The main LibRaw object (class) is created either without parameters or
with flags determining the object behavior.</p>
<pre>#include "libraw/libraw.h"<br>...<br><br> LibRaw ImageProcessor(unsigned int flags=0);<br>...<br> </pre>
<p>Flags (several flags are combined via operator |, i.e., bitwise OR):</p>
<ul>
<li><strong>LIBRAW_OPTIONS_NO_DATAERR_CALLBACK</strong>: do not set the
standard <a href="#callbacks">file read error handler</a> (standard
handler outputs the error report in stderr).</li>
</ul>
<p>Three groups of methods are used for image processing</p>
<ul>
<li><a href="#dataload">Data loading from the RAW file</a></li>
<li><a href="#dcrawemu">Postprocessing functions emulating the dcraw
behavior</a></li>
<li><a href="#dcrawrite">File output functions emulating the dcraw
behavior</a>.</li>
</ul>
<p>The results of processing are placed in the imgdata field of type <a href="API-datastruct.html">libraw_data_t</a>;
the same data set contains fields that control the postprocessing and
output.</p>
<p><a name="return"></a></p>
<h2>Returned Values</h2>
<p>All LibRaw API functions return an integer number in accordance with the
<a href="API-notes.html#errors">return code convention</a>. Please read
the descriptions of <a href="API-notes.html#errors">this convention</a>
and <a href="#callbacks">LibRaw behavior in cases of fatal errors</a>.</p>
<p><a name="dataload"></a></p>
<h2>Methods Loading Data from a File</h2>
<p><a name="open_datastream"></a></p>
<h3>int LibRaw::open_datastream(LibRaw_abstract_datastream *stream)</h3>
<p>Opens a datastream with RAW data, reads metadata (EXIF) from it, and
fills the following structures:</p>
<ul>
<li>imgdata.idata (<a href="API-datastruct.html#libraw_iparams_t">libraw_iparams_t</a>),</li>
<li>imgdata.sizes (<a href="API-datastruct.html#libraw_image_sizes_t">libraw_image_sizes_t</a>),</li>
<li>imgdata.color (<a href="API-datastruct.html#libraw_colordata_t">libraw_colordata_t</a>),</li>
<li>imgdata.other (<a href="API-datastruct.html#libraw_imgother_t">libraw_imgother_t</a>),
and</li>
<li>imgdata.thumbnail (<a href="API-datastruct.html#libraw_thumbnail_t">libraw_thumbnail_t</a>).</li>
</ul>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">return
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p>Before file opening, <a href="#recycle">recycle()</a> is always called;
hence, if several images are processed in the batch mode, there is no need
to call recycle() at the end of each processing cycle.</p>
<p><strong>Input data</strong>: pointer to object, derived from <a href="#datastream">LibRaw_abstract_datastream</a>
class. This object should be initialized and ready to read. This object
should be destroyed in calling application after use.</p>
<p><a name="open_file"></a></p>
<h3>int LibRaw::open_file(const char *filename[,INT64 bigfile_size])</h3>
<h3>Win32 only: int LibRaw::open_file(const wchar_t *filename[,INT64
bigfile_size])</h3>
<p>Creates an <a href="#file_datastream">LibRaw_file_datastream</a> object,
calls <a href="#open_datastream">open_datastream()</a>. If succeed, sets
internal flag which signals to destroy internal datastream object on <a href="#recycle">recycle()</a>.
On failure, just created file_datastream destroyed immediately.</p>
<p>Second optional parameter <strong>bigfile_size</strong> controls
background I/O interface used for file operations. For files smaller than
bigfile_size the <a href="#file_datastream">LibRaw_file_datastream</a>
will be used and the <a href="#bigfile_datastream">LibRaw_bigfile_datastream</a>
otherwise.</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">return
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="open_buffer"></a></p>
<h3>int LibRaw::open_buffer(void *buffer, size_t bufsize)</h3>
<p>Created an <a href="#buffer_datastream">LibRaw_buffer_datastream</a>
object, calls <a href="#open_datastream">open_datastream()</a>. If
succeed, sets internal flag which signals to destroy internal datastream
object on <a href="#recycle">recycle()</a>. On failure, just created
file_datastream destroyed immediately.</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">return
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="open_bayer"></a></p>
<h3>int LibRaw::open_bayer(unsigned char *data, unsigned datalen, ushort
_raw_width, ushort _raw_height, ushort _left_margin, ushort _top_margin,
ushort _right_margin, ushort _bottom_margin, unsigned char procflags,
unsigned char bayer_pattern, unsigned unused_bits, unsigned otherflags,
unsigned black_level)</h3>
<p>Parameters: </p>
<ul>
<li>data, datalen - buffer passed </li>
<li>_raw_width/_raw_height/*margin - image size and margins </li>
<li> procflags:
<ul>
<li>for 10-bit format:
<ul>
<li>1: "4 pixels in 5 bytes" packing is used </li>
<li>0: "6 pixels in 8 bytes" packing is used </li>
</ul>
</li>
<li>for 16-bit format:
<ul>
<li>1: Big-endian data </li>
</ul>
</li>
</ul>
</li>
<li>bayer_pattern: one of LIBRAW_OPENBAYER_RGGB,LIBRAW_OPENBAYER_BGGR,
LIBRAW_OPENBAYER_GRBG,LIBRAW_OPENBAYER_GBRG </li>
<li>unused_bits: count of upper zero bits </li>
<li>otherflags:
<ul>
<li>Bit 1 - filter (average neighbors) for pixels with values of zero
</li>
<li>Bits 2-4 - the orientation of the image (0=do not rotate, 3=180,
5=90CCW, 6=90CW) </li>
</ul>
</li>
<li>black_level: file black level (it also may be specified via
imgdata.params) </li>
</ul>
See samples/openbayer_sample.cpp for usage sample (note, this sample is
'sample only', suited for Kodak KAI-0340 sensor, you'll need change
open_bayer() params for your data).
<p><a name="unpack"></a></p>
<h3>int LibRaw::unpack(void)</h3>
<p>Unpacks the RAW files of the image, calculates the black level (not for
all formats). The results are placed in imgdata.image.</p>
<p>Data reading is sometimes (not frequently) affected by settings made in
imgdata.params (<a href="API-datastruct.html#libraw_output_params_t">libraw_output_params_t</a>);
see <a href="API-notes.html">API notes</a> for details.</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">return
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="unpack_thumb"></a><a name="unpack_thumb_ex"></a></p>
<h3>int LibRaw::unpack_thumb(void)</h3>
<h3>int LibRaw::unpack_thumb_ex(int i)</h3>
<p></p>
<p>unpack_thumb(): reads (or unpacks) the default (largest) image preview
(thumbnail), placing the result into the imgdata.thumbnail.thumb buffer.</p>
<p>unpack_thumb_ex(int i): reads i-th thumbnail (thumbnails list is
available in imgdata.thumbs_list structure).</p>
<p> JPEG previews are placed into this buffer without any changes (with the
header etc.). Other preview formats are placed into the buffer in the form
of the unpacked bitmap image (three components, 8 bits per component).<br>
The thumbnail format is written to the imgdata.thumbnail.tformat field;
for the possible values, see <a href="API-datastruct.html#LibRaw_thumbnail_formats">description
of constants and data structures</a>.</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">return
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<h3></h3>
<p></p>
<p><a name="utility"></a></p>
<h2>Auxiliary Functions</h2>
<h3>Library version check</h3>
<p><a name="version"></a></p>
<h4>const char* LibRaw::version()</h4>
<p>Returns string representation of LibRaw version in
MAJOR.MINOR.PATCH-Status format (i.e. 0.6.0-Alpha2 or 0.6.1-Release).</p>
<p><a name="versionNumber"></a></p>
<h4>int LibRaw::versionNumber()</h4>
<p>Returns integer representation of LibRaw version. During LibRaw
development, the version number is always increase .</p>
<p><a name="LIBRAW_CHECK_VERSION"></a></p>
<h4>bool LIBRAW_CHECK_VERSION(major,minor,patch)</h4>
<p>Macro for version check in caller applications. Returns 'true' if current
library version is greater or equal to set in macro parameters. This macro
executes at runtime (not at compile time) and may be used for checking
version of dynamically loaded LibRaw (from DLL/shared library).</p>
<h3>List of supported RAW formats (cameras)</h3>
<p><a name="cameraCount"></a></p>
<h4>int LibRaw::cameraCount()</h4>
<p>Returns count of cameras supported.</p>
<p><a name="cameraList"></a></p>
<h4>const char** LibRaw::cameraList()</h4>
<p>Returns list of supported cameras. Latest item of list is set to NULL
(for easy printing).</p>
<p><a name="#set_rawspeed_camerafile"></a></p>
<h4>int LibRaw::set_rawspeed_camerafile(char *path_to_cameras_xml)</h4>
<p>(Only if LibRaw was built with RawSpeed support).</p>
<p>Loads XML file with RawSpeed camera description data (cameras.xml)
specified by path_to_cameras_xml. Returns 0 on success, nonzero on error.
<a name="get_decoder_info"></a></p>
<h4>int LibRaw::get_decoder_info(libraw_decoder_info_t *)</h4>
<p>The function fills <a href="API-datastruct.html#libraw_decoder_info_t">libraw_decoder_info_t</a>
structure by passed pointer with current raw decoder data.</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">return
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="unpack_function_name"></a></p>
<h3>const char* LibRaw::unpack_function_name()</h3>
<p>Returns function name of file unpacking function. Intended only for
LibRaw test suite designers to use in test coverage evaluation.</p>
<p><a name="setCancelFlag"></a></p>
<h4>void LibRaw::setCancelFlag()</h4>
<p>This call sets internal fast cancel flags. If set, current Raw decoder
will be terminated ASAP. This call is useful if you need to cancel all
LibRaw decoders in multithreaded program (e.g. for fast program
termination or just for cancel current processing).</p>
<p><a name="clearCancelFlag"></a></p>
<h4>void LibRaw::clearCancelFlag()</h4>
<p>This call clears internal fast cancel flags, so (early) terminated LibRaw
decoder may work again.</p>
<p><a name="COLOR"></a></p>
<h4>int LibRaw::COLOR(int row, int col)</h4>
<p>This call returns pixel color (color component number) in bayer pattern at
row,col. The returned value is in 0..3 range for 4-component Bayer (RGBG2,
CMYG and so on) and in 0..2 range for 3-color data.</p>
<p>Color indexes returned could be used as index in imgdata.idata.cdesc
string to get color 'name'.</p>
<p><a name="error_count"></a></p>
<h4>int LibRaw::error_count()</h4>
<p>This call returns count of non-fatal data errors (out of range, etc)
occurred in unpack() stage.</p>
<p><a name="subtract_black"></a></p>
<h4>int LibRaw::subtract_black()</h4>
<p>This call will subtract black level values from RAW data (for suitable
RAW data). <a href="API-datastruct.html#libraw_colordata_t">colordata.data_maximum</a>
and <strong>colordata.maximum</strong> and black level data (<a href="API-datastruct.html#libraw_colordata_t">colordata.black</a>
and colordata.cblack) will be adjusted too.</p>
<p>This call should be used if you postprocess RAW data by your own code.
LibRaw <a href="#dcrawemu">postprocessing functions</a> will call <strong>subtract_black()</strong>
by oneself.</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">return
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<a name="adjust_to_raw_inset_crop"></a>
<h4>int LibRaw::adjust_to_raw_inset_crop(unsigned mask, float maxcrop =
0.55f)</h4>
<p> Promotes imgdata.sizes.raw_inset_crops[] values to imgdata.sizes.*margin
and imgdata.sizes.width/height fields</p>
<p> Parameters<br>
mask: </p>
<ul>
<li>if bit 1 is set: prefer raw_inset_crops[1] </li>
<li>if bit 0 is set: prefer raw_inset_crops[0] </li>
</ul>
<p>maxcrop: limits crop to not less than (original width/height)*maxcrop; if
raw_inset_crops[i] data results in tighter crop, than this item is
ignored. </p>
<p>return value: index in raw_inset_crops[] used increased by one, so </p>
<ul>
<li>0: no changes made </li>
<li>1: [0]th data used </li>
<li>2: [1]th data used </li>
</ul>
<p>Note: this call SHOULD be used after LibRaw::unpack(), otherwise black
level calculation from masked area may be fooled resulting in wrong black
levels. </p>
<p><a name="floatingpoint"></a></p>
<h4>Support for floating point data</h4>
<p>Libraw can read floating point DNG files (no other RAW formats may use
floating point) with or without conversion to integer data. Floating point
values are stored in imgdata.rawdata buffers:</p>
<ul>
<li><span style="font-family: monospace;">float * float_image</span> (if
not NULL) points to floating point bayer data</li>
<li><span style="font-family: monospace;">float (*float3_image)[3]</span>
(if not NULL) points to floating point 3-channel buffer</li>
<li><span style="font-family: monospace;">float (*float4_image)[4]</span>
(if not NULL) points to floating point 4-channel buffer</li>
</ul>
<p>Function calls for floating point support:</p>
<ul>
<li><span style="font-family: monospace;">int LibRaw::is_floating_point();
</span>function will return 1 if file contains floating point data</li>
<li><span style="font-family: monospace;">int LibRaw::have_fpdata();</span>
function will return 1 if FP data has read (decoded) into memory and not
converted to integer data</li>
<li>int LibRaw::convertFloatToInt(float dmin=4096.f, float dmax=32767.f,
float dtarget = 16383.f) converts floating point data to integer. If
data maximum is out of dmin..dmax range, than data scaled to set maximum
to dtarget</li>
</ul>
<p><a name="ycc"></a></p>
<h4>Support for YCC formats (Canon sRAW/mRAW and Nikon Small NEF)</h4>
<pre> int LibRaw::is_sraw();<br> int LibRaw::is_nikon_sraw();<br> int LibRaw::sraw_midpoint()</pre>
<ul>
<li>is_sraw() call returns nonzero if current image is YCC-based.</li>
<li>is_nikon_sraw() call returns nonzero for Nikon Small NEF files</li>
<li>sraw_midpoint() call returns neutral (gray) point for color channels</li>
</ul>
<p><a name="recycle_datastream"></a></p>
<h4>void LibRaw::set_dng_host(void* p)</h4>
<p>If LibRaw is compiled with Adobe DNG SDK support and you wish to use this
support:</p>
<ul>
<li>you need to create own dng_host object</li>
<li>and pass it to LibRaw object using this function</li>
</ul>
<h4>void LibRaw::recycle_datastream(void)</h4>
<p>This call closes input datastream with associated data buffer and
unblocks opened file. <a name="recycle"></a></p>
<h3>void LibRaw::recycle(void)</h3>
<p>Frees the allocated data of LibRaw instance, enabling one to process the
next file using the same processor. Repeated calls of recycle() are quite
possible and do not conflict with anything.</p>
<p><a name="~LibRaw"></a></p>
<h3>LibRaw::~LibRaw()</h3>
<p>Destructor, which consists in calling recycle().</p>
<p><a name="strprogress"></a></p>
<h3>const char* LibRaw::strprogress(enum LibRaw_progress code)</h3>
<p>Converts progress stage code to description string (in English).</p>
<p><a name="libraw_strerror"></a></p>
<h3>const char* LibRaw::strerror(int errorcode)</h3>
<p>Analog of strerror(3) function: outputs the text descriptions of LibRaw
error codes (in English).</p>
<p><a name="callbacks"></a></p>
<h3>Setting Error Notification Functions</h3>
<p>In process of RAW conversion LibRaw can call user-setted callback. This
callback can be used for:</p>
<ul>
<li>Dynamic status update (progress bar and so on).</li>
<li>Cancel of processing (for example, user pressed Cancel button).</li>
</ul>
<p>Also, work of the library may cause two types of exceptional situations
that require notification of the calling application:</p>
<ul>
<li>Memory shortage</li>
<li>Data read error.</li>
</ul>
<p>An application may set its own callbacks that will be called in the cases
mentioned above to notify the user (or the calling program).</p>
<p><a name="progress"></a></p>
<h4>Progress indication/processing termination</h4>
<pre> typedef int (*progress_callback)(void *callback_data,enum LibRaw_progress stage, int iteration, int expected);<br> void LibRaw::set_progress_handler(progress_callback func,void *callback_data);<br> </pre>
<p>LibRaw user can set own callback which will be called 10-50 times during
RAW postprocessing by dcraw_process().</p>
<p>This callback may terminate current image processing by returning of
non-zero value. In such case all processing will be cancelled immediately
and all resources will be returned to system by recycle() call. Current
call of dcraw_process() will return error code
LIBRAW_CANCELLED_BY_CALLBACK.</p>
<p>Callback parameters:</p>
<dl>
<dt>void *callback_data</dt>
<dd>void*-pointer, passed as 2nd argument to set_progress_handler(). This
pointer should be used to pass additional data to callback (i.e. thread
local data and so on).</dd>
<dt>enum LibRaw_progress stage</dt>
<dd>Current processing stage. This number can be converted to string by
call to <a href="#strprogress">LibRaw::strprogress</a>. Not all
processing stages are covered by callback calls.</dd>
<dt>int iteration</dt>
<dd>Iteration number within current stage (from 0 to expected-1).</dd>
<dt>int expected</dt>
<dd>Expected number of iterations on current stage.</dd>
</dl>
<p>Callback should return value of: <strong>0</strong> for continue
processing and <strong>non-zero</strong> for immediate cancel of
processing.</p>
<p>&nbsp;</p>
<p>If LibRaw compiled with OpenMP support, iteration parameter may not
always increase within one stage. Out of order callback calls are
possible.</p>
<p>Callback code sample:</p>
<pre>int my_progress_callback(void *data,enum LibRaw_progress p,int iteration, int expected)<br>{<br> char *passed_string = (char *data);<br> printf("Callback: %s pass %d of %d, data passed: %s\n",libraw_strprogress(p),iteration,expected,passed_string);<br> if(timeout || key_pressed )<br> return 1; // cancel processing immediately<br> else<br> return 0; // can continue<br>}</pre>
<p><a name="exif"></a></p>
<h4>User-specified exif tag parser callback</h4>
<pre> typedef void (*exif_parser_callback) (void *context, int tag, int type, int len,unsigned int ord, void *ifp);<br> void LibRaw::set_exifparser_handler( exif_parser_callback cb,void *context);<br> </pre>
<p>Callback to be called on each parsed EXIF/Makernotes tag with parameters:</p>
<ul>
<li>context - pointer to context passed to set_exifparser_handler();</li>
<li>tag - EXIF/Makernotes tag value</li>
<li>type - TIFF(EXIF) tag type</li>
<li>len - tag length</li>
<li>ord - byte order (II or MM)</li>
<li>void *ifp - pointer to LibRaw_abstract_datastream, positioned to tag
data</li>
</ul>
<p><a name="dataerror"></a></p>
<h4>File Read Error Notifier</h4>
<pre> typedef void (*data_callback)(void *callback_data,const char *file, const int offset);<br> void LibRaw::set_dataerror_handler(data_callback func, void *callback_data); <br> </pre>
<p>The user can define his or her own function to be called in the case of
error in the input data. It is a void function receiving two parameters:</p>
<ul>
<li><strong>void *callback_data</strong> - void*-pointer, passed as 2nd
argument to set_progress_handler(). This pointer should be used to pass
additional data to callback (i.e. thread local data and so on).</li>
<li><strong>file</strong> is the name of the RAW file whose processing
evoked the file read error. This name <strong>can be NULL</strong> if
underlying data input layer does not know the name. So, if calling
application sets own callback, this callback should work with NULL file
name.</li>
<li><strong>offset</strong> is -1 at end-of-file (if LibRaw expects more
data) or a positive number equal to the file position (bytes from file
beginning) where the unpacking error occurred.</li>
</ul>
<p>The callback function is intended for information purposes: it notifies
the user or the program code that processing is impossible.</p>
<p>If the user does not set his or her own handler, the standard one (output
of error message in stderr) will be used.</p>
<p>One can set the null handler by passing NULL to set_dataerror_handler;
then no notifier function will be called. The same effect can be achieved
by creating a LibRaw object with the LIBRAW_OPTIONS_NO_DATAERR_CALLBACK
flag in the constructor.</p>
<p>In the case of error in the input data, processing of the current file is
terminated and a notifier is called; all allocated resources are freed,
and <a href="#recycle">recycle()</a> is performed. The current call will
return LIBRAW_IO_ERROR. <br>
At an attempt to continue data processing, all subsequent calls will
return LIBRAW_OUT_OF_ORDER_CALL. Processing of a new file may be started
in the usual way, by calling LibRaw::open_file().</p>
<p><a name="dcrawemu"></a></p>
<h2>Data Postprocessing: Emulation of dcraw Behavior</h2>
<p>Instead of writing one's own Bayer pattern postprocessing, one can use
the dcraw functions, which are called after the calls of open_file() +
unpack() /+ unpack_thumb()/</p>
<p><a name="dcraw_params"></a></p>
<h3>Parameter Setting</h3>
<p>Virtually all parameters that can be set through the dcraw command line
are specified by assigning values to fields of the <strong>LibRaw::imgdata.params</strong>
structure. The type of this structure is <strong>libraw_output_params_t</strong>;
all fields are listed and described in sufficient detail in the <a href="API-datastruct.html#libraw_output_params_t">description
of data structures</a>.</p>
<p><a name="raw2image"></a></p>
<h3>int LibRaw::raw2image</h3>
<p>This function allocates buffer for postprocessing (imgdata.image) and
fills it with data layout compatible with LibRaw 0.13/0.14 and below. If
the buffer is already allocated, it will be free()ed and allocated again.</p>
<p>This function should be called only if your code do postprocessing stage.
If you use LibRaw's postprocessing calls (see below) you don't need to
call raw2image().</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">return
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="free_image"></a></p>
<h3>void LibRaw::free_image</h3>
<p>This function releases the imgdata.image buffer allocated by raw2image();</p>
<p>This method should be called if current postprocessing results are not
needed by the program (e.g. already copied somewhere), but new
postprocessing calls (with another settings) are possible, so it is to
early to call <a href="#recycle">recycle()</a>.</p>
<p><a name="adjust_sizes_info_only"></a></p>
<h3>int LibRaw::adjust_sizes_info_only(void)</h3>
<p>The function calculates the correct size of the output image
(imgdata.sizes.iwidth and imgdata.sizes.iheight) for the following cases:</p>
<ul>
<li>Files from Fuji cameras (with a 45-degree rotation)</li>
<li>Files from cameras with non-square pixels</li>
<li>Images shot by a rotated camera.</li>
</ul>
<p>In the aforementioned cases, the function changes the fields of the image
output size; note that this change cannot be repeated again.</p>
<p><a name="dcraw_process"></a></p>
<h3>int LibRaw::dcraw_process(void)</h3>
<p>The function emulates the postprocessing capabilities available in <strong>dcraw</strong>.<br>
Called after calling LibRaw::unpack();</p>
<p>The entire functionality of dcraw (set via the field values in <a href="API-datastruct.html#libraw_output_params_t">imgdata.params</a>)
is supported, except for</p>
<ul>
<li>Dark frame subtraction</li>
<li>Work with bad pixels.</li>
</ul>
<p>The function is intended solely for demonstration and testing purposes;
it is assumed that its source code will be used in most real applications
as the reference material concerning the order of RAW data processing.</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">error
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="dcrawrite"></a></p>
<h2>Data Output to Files: Emulation of dcraw Behavior</h2>
<p>In spite of the abundance of libraries for file output in any formats,
LibRaw includes calls that emulate the file output provided by dcraw. This
is done primarily for easier verification of library work: the resultant
files must be binary identical.</p>
<p><a name="dcraw_ppm_tiff_writer"></a></p>
<h3>int LibRaw::dcraw_ppm_tiff_writer(const char *outfile)</h3>
<p>The function outputs the postprocessing results to a file in the PPM/PGM
or TIFF format (the format is set via imgdata.params.output_tiff). The
results are binary identical to those provided by dcraw.</p>
<p>If "-" is passed as outfile, the function will write to standard output
(stdout).</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">error
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="dcraw_thumb_writer"></a></p>
<h3>int LibRaw::dcraw_thumb_writer(const char *thumbfile)</h3>
<p>Writes the thumbnail to a file in the PPM format for bitmap thumbnails
and in the JPEG format for JPEG thumbnails, i.e., in the format completely
identical to the results provided by dcraw.</p>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">error
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="memwrite"></a></p>
<h2>Copying unpacked data into memory buffer</h2>
<p>There is several function calls for store unpacked data into memory
buffer (after using dcraw_process() and so on):</p>
<ul>
<li><strong>get_mem_image_format</strong> - get resulting bitmap size and
bit depth.</li>
<li><strong>copy_mem_image</strong> - copy postprocessed data into some
memory buffer with different color order and line stride.</li>
<li><strong>dcraw_make_mem_image</strong> - store processed image data
into allocated buffer;</li>
<li><strong>dcraw_make_mem_thumb</strong> - store extracted thumbnail into
buffer as JPEG-file image (for most cameras) or as RGB-bitmap.</li>
</ul>
<p>For usage primer see samples/mem_image.c sample.</p>
<p>&nbsp;</p>
<p><a name="get_mem_image_format"></a></p>
<h3>void get_mem_image_format(int *widthp, int *heightp, int *colorsp, int
*bpp) const - return processing bitmap size</h3>
<p>This function returns size of postprocessed image:</p>
<ul>
<li>Image width is returned in *widthp;</li>
<li>Bitmap height is returned in *heightp;</li>
<li>Image color count is returned in *colorsp;</li>
<li>Bits per pixel (8 or 16) is returned in *bpp;</li>
</ul>
<p><a name="copy_mem_image"></a></p>
<h3>int LibRaw::copy_mem_image(void* scan0, int stride, int bgr) - copies
postprocessed bitmap data into buffer</h3>
<p>Function parameters:</p>
<ul>
<li>void *scan0 - pointer to buffer to copy data to. The buffer should be
at least stride*image_height bytes;</li>
<li>int stride - stride of each other image line (row) in bytes. Usually
image_width*(bit_per_pixel/8)*image_colors, but may be more if you wish
to align image rows to, for example, 8 or 16 or 32 bytes to make CPU
more happy.</li>
<li>int bgr - pixel copy order. RGB if bgr==0 and BGR otherwise.</li>
</ul>
<p>The function returns an integer number in accordance with the <a href="API-notes.html#errors">error
code convention</a>: positive if any system call has returned an error,
negative (from the <a href="API-datastruct.html#LibRaw_errors">LibRaw
error list</a>) if there has been an error situation within LibRaw.</p>
<p><a name="dcraw_make_mem_image"></a></p>
<h3>libraw_processed_image_t *dcraw_make_mem_image(int *errorcode=NULL) -
store unpacked and processed image into memory buffer as RGB-bitmap</h3>
<p>This function allocates memory buffer and stores unpacked-preprocessed
image into this buffer. Function returns allocated structure <a href="API-datastruct.html#libraw_processed_image_t">libraw_processed_image_t</a>
with filled fields. Always returns data as RGB bitmap (i.e. <strong>type</strong>
field is equal to LIBRAW_IMAGE_BITMAP).</p>
<p>dcraw_process() should be called before dcraw_make_mem_image();</p>
<p>Returns NULL in case of an error. If caller has passed not-NULL value as
errorcode parameter, than *errorcode will be set to error code according
to <a href="API-notes.html#errors">error code convention</a>.</p>
<p><strong>NOTE!</strong> Memory, allocated for return value will not be
fried at destructor or <strong>LibRaw::recycle</strong> calls. Caller of
dcraw_make_mem_image should free this memory by call to <a href="#dcraw_clear_mem">LibRaw::dcraw_clear_mem()</a>.</p>
<p><a name="dcraw_make_mem_thumb"></a></p>
<h3>libraw_processed_image_t *dcraw_make_mem_thumb(int *errorcode=NULL) -
store unpacked thumbnail into memory buffer</h3>
<p>This function allocates memory buffer and stores thumbnail data in it.
Function returns allocated structure <a href="API-datastruct.html#libraw_processed_image_t">libraw_processed_image_t</a>
with filled fields. For most RAW images allocated structure will contains
JPEG image (i.e. <strong>type</strong> field is equal to
LIBRAW_IMAGE_JPEG). For some cameras with RGB-bitmap thumbnail (Kodak
SLRs) returned structure contains RGB bitmap (<strong>type</strong> field
is equal to LIBRAW_IMAGE_JPEG, see structure description for details).</p>
<p>unpack_thumb() should be called before dcraw_make_mem_thumb();</p>
<p>Returns NULL in case of an error. If caller has passed not-NULL value as
errorcode parameter, than *errorcode will be set to error code according
to <20> <a href="API-notes.html#errors">error code convention</a>.</p>
<p><strong>NOTE!</strong> Memory, allocated for return value will not be
fried at destructor or <strong>LibRaw::recycle</strong> calls. Caller of
dcraw_make_mem_image should free this memory by call to <a href="#dcraw_clear_mem">LibRaw::dcraw_clear_mem()</a>.</p>
<h3>void LibRaw::dcraw_clear_mem(libraw_processed_image_t *)</h3>
<p>This function will free the memory allocated by <strong>dcraw_make_mem_image</strong>
or <strong>dcraw_make_mem_thumb</strong>.</p>
<p>This is static class member, so call syntax should be
LibRaw::dcraw_clear_mem(...).</p>
<p>This call translates directly to free() system function, but it is better
to use dcraw_clear_mem because LibRaw (DLL) may be compiled with memory
manager other than in calling application.</p>
<p><a name="datastream"></a></p>
<h2>Input layer abstraction</h2>
<p><a name="LibRaw_abstract_datastream"></a></p>
<h3>class LibRaw_abstract_datastream - abstract RAW read interface</h3>
<p>LibRaw reads RAW-data by calling (virtual) methods of C++ object derived
from <strong>LibRaw_abstract_datastream</strong>. This C++ class does not
implement any read, but defines interface to be called. Call to base class
methods always results in error.</p>
<p><a name="datastream_methods"></a></p>
<h4>LibRaw_abstract_datastream class methods</h4>
<p><a name="datastream_methods_utility"></a></p>
<h5>Object verification</h5>
<dl>
<dt><strong> virtual int valid()</strong></dt>
<dd>Checks input datastream validity. Returns 1 on valid stream and 0 if
datastream was created on non-valid input parameters (wrong filename for
file stream and so on).</dd>
</dl>
<p><a name="datastream_methods_read"></a></p>
<h5>Stream read and positioning</h5>
<p>This group of methods implements file object (FILE*) semantics.</p>
<dl>
<dt><strong>virtual int read(void * ptr,size_t size, size_t nmemb)</strong></dt>
<dd>Similar to fread(ptr,size,nmemb,file).</dd>
<dt><strong>virtual int seek(off_t o, int whence)</strong></dt>
<dd>Similar to fseek(file,o,whence).</dd>
<dt><strong>virtual int tell(</strong></dt>
<dd>Similar to ftell(file).</dd>
<dt><strong>virtual int get_char()</strong></dt>
<dd>Similar to getc(file)/fgetc(file).</dd>
<dt><strong>virtual char* gets(char *s, int n)</strong></dt>
<dd>Similar to fgets(s,n,file).</dd>
<dt><strong>virtual int eof()</strong></dt>
<dd>Similar to feof(file).</dd>
<dt><strong>virtual int scanf_one(const char *fmt, void *val)</strong></dt>
<dd>Simplified variant of fscanf(file,fmt,val): format string is always
contains one argument to read. So, variable args call is not needed and
only one pointer to data passed.</dd>
<dt><strong> virtual int jpeg_src(void * p);</strong></dt>
<dd>Initializes read structures in j_decompress_ptr object passed as *p.
This object is used by libjpeg for JPEG data reading from datastream.
<p>Returns -1 on error and 0 on success.</p>
</dd>
<dt><strong> virtual void * make_jas_stream();</strong></dt>
<dd>Creates LibJasper input stream (for JPEG2000 decoding).
<p>returns NULL on error or data pointer on success.</p>
</dd>
</dl>
<p><a name="datastream_methods_other"></a></p>
<h5>Other methods</h5>
<p>This group of methods includes several supplementary calls. These calls
are used to temporary switch to another data stream (file and/or memory
buffer).</p>
<dl>
<dt><strong>virtual const char* fname()</strong></dt>
<dd>Returns name of opened file if datastream object knows it (for
example, <strong>LibRaw_file_datastream</strong> used). Filename used
in:
<ul>
<li>error notification callbacks;</li>
<li>generation of filename of JPEG-file with metadata when needed
(i.e. cameras with 'Diag RAW hack').</li>
</ul>
</dd>
<dt><strong>virtual int subfile_open(const char *fn)</strong></dt>
<dd>This call temporary switches input to file <strong>fn</strong>.
Returns 0 on success and error code on error.<br>
The function used to read metadata from external JPEG file (on cameras
with "Diag RAW hack"). <br>
This call is not implemented for <a href="#buffer_datastream">LibRaw_buffer_datastream</a>,
so external JPEG processing is not possible when buffer datastream used.
<br>
This function should be implemented in real input class, base class call
always return error. <br>
Working implementation sample can be found in <a href="#file_datastream">LibRaw_file_datastream</a>
implementation in <strong>libraw/libraw_datastream.h</strong> file.</dd>
<dt><strong> virtual void subfile_close()</strong></dt>
<dd>This call switches input stream from temporary open file back to main
data stream.</dd>
<dt><strong> virtual int tempbuffer_open(void *buf, size_t size)</strong></dt>
<dd>This call temporary switches input to <a href="#buffer_datastream">LibRaw_buffer_datastream</a>
object, created from <strong>buf</strong>.<br>
This method is needed for Sony encrypted metadata parser.
<p>This call implemented in base class (<strong>LibRaw_abstract_datastream</strong>),
there is no need to reimplement in in derived classes.<br>
Possible activity of temporary datastream requires very accurate
programming when implementing datastreams derived from base <strong>LibRaw_abstract_datastream</strong>.
See <a href="#substream">below</a> for more details.</p>
</dd>
<dt><strong> virtual void tempbuffer_close()</strong></dt>
<dd>This call switch input back from temporary datastream to main stream.
This call implemented in base <strong>LibRaw_abstract_datastream</strong>
class.</dd>
</dl>
<p><a name="datastream_derived"></a></p>
<h3>Derived input classes included in LibRaw</h3>
<p>There is three "standard" input classes in LibRaw distribution:</p>
<ul>
<li><a href="#file_datastream">LibRaw_file_datastream</a> implements input
from file (in filesystem).</li>
<li><a href="#bigfile_datastream">LibRaw_bigfile_datastream</a> slower
I/O, but files larger than 2Gb are supported.</li>
<li><a href="#buffer_datastream">LibRaw_buffer_datastream</a> implements
input from memory buffer.</li>
</ul>
<p>LibRaw C++ interface users can implement their own input classes and use
them via <a href="#open_datastream">LibRaw::open_datastream</a> call.
Requirements and implementation specifics are described below.</p>
<p><a name="file_datastream"></a></p>
<h4>class LibRaw_file_datastream - file input interface</h4>
<p>This class implements input from file.</p>
<p><strong>Class methods:</strong></p>
<dl>
<dt><strong> LibRaw_file_datastream(const char *fname) </strong></dt>
<dd>This constructor creates <strong>LibRaw_file_datastream</strong>
object from file <strong>fname</strong>.<br>
Unfortunately, C++ constructor cannot return an error. So if bad
filename passed (e.g. nonexistent file) object is created as non-valid
(valid() call returns zero).</dd>
</dl>
<p>All other class methods are <a href="#datastream_methods">described
above</a>.<br>
This class implements all possible methods, including fname() and
subfile_open().</p>
<p><a name="bigfile_datastream"></a></p>
<h4>class LibRaw_bigfile_datastream - file input interface</h4>
<p>This class implements input from file.</p>
<p><strong>Class methods:</strong></p>
<dl>
<dt><strong> LibRaw_bigfile_datastream(const char *fname) </strong></dt>
<dd>This constructor creates <strong>LibRaw_bigfile_datastream</strong>
object from file <strong>fname</strong>.<br>
Unfortunately, C++ constructor cannot return an error. So if bad
filename passed (e.g. nonexistent file) object is created as non-valid
(valid() call returns zero).</dd>
</dl>
<p>The difference between <strong>file</strong> and <strong>bigfile</strong>
datastreams are obvious from class name: bigfile one supports large files
(more than 2Gb) on all supported systems. File one uses streambuf
interface which is limited to 2Gb on many systems.</p>
<p>All other class methods are <a href="#datastream_methods">described
above</a>.<br>
This class implements all possible methods, including fname() and
subfile_open().</p>
<p><a name="buffer_datastream"></a></p>
<h4>class LibRaw_buffer_datastream - memory buffer input interface</h4>
<p>This class implements input from memory buffer.</p>
<p><strong>Class methods:</strong></p>
<dl>
<dt><strong> LibRaw_buffer_datastream(void *buffer, size_t bsize)</strong></dt>
<dd>This constructor creates datastream object from <strong>buffer</strong>
with size <strong>bsize</strong>.<br>
It is not possibly to verify the pointer passed, so buffer address is
checked against 0 and -1 only.</dd>
</dl>
<p>All other class methods are <a href="#datastream_methods">described
above</a>.<br>
This class does not implement fname() and subfile_open() calls, so
external JPEG metadata parsing is not possible.</p>
<p><a name="own_datastreams"></a></p>
<h3>Own datastream derived classes</h3>
<p>To create own read interface LibRaw user should implement C++ class
derived from <strong>LibRaw_abstract_datastream</strong> with all read
methods.<br>
LibRaw standard implementations may be used as reference. See <strong>libraw/libraw_datastream.h</strong>
file for details (all standard LibRaw input classes are implemented using
inline functions only).</p>
<p><a name="substream"></a></p>
<p><a href="index.html">[back to Index]</a></p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,305 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body>
<p>LibRaw: General Notes on API<a href="index.html">[back to Index]</a></p>
<h1>LibRaw: General Notes on API</h1>
<h2>Contents</h2>
<ol>
<li><a href="#versions">LibRaw editions</a></li>
<li><a href="#errors">Error Code Conventions and Error Handling</a></li>
<li><a href="#warnings">Nonstandard Situations That Are Not Errors</a></li>
<li><a href="#io">Input Layer Abstraction</a></li>
<li><a href="threads">Thread Safety</a></li>
<li><a href="#CXX">The Use of C++</a></li>
<li><a href="#imgdata_params">Parameters of the LibRaw::imgdata.params
Structure Affecting the Behavior of open_file/unpack/unpack_thumb</a></li>
<li><a href="#memory">Memory Usage</a>
<ol>
<li><a href="#stack">Stack Usage</a></li>
<li><a href="#memmgr">Dynamic Memory Management</a></li>
<li><a href="#memuse">Dynamic Memory Usage</a>
<ol>
<li><a href="#memraw">Memory Buffer for the RAW Image</a></li>
<li><a href="#memimage">Memory for the Postprocessed Image</a></li>
<li><a href="#memthumb">Memory for the Decoded Thumbnail</a></li>
<li><a href="#memraw">Memory for RAW Unpacking</a></li>
<li><a href="#mempostproces">Memory for Postprocessing</a></li>
<li><a href="#memwrite">Memory for File Writing</a></li>
<li><a href="#memunpack">Unpacking into memory buffer</a></li>
</ol>
</li>
</ol>
</li>
<li><a href="#incompat">Incompatibilities with dcraw</a>
<ol>
<li><a href="#incompat_max">Automatic maximum search/brightness
adjustment</a></li>
<li><a href="#incompat_kodak">Processing of Thumbnails from Kodak
cameras</a></li>
</ol>
</li>
</ol>
<p><a name="versions"></a></p>
<h2>LibRaw Versions</h2>
<p>Since version 0.9, there is only one LibRaw variants. Older versions have
three separate editions (normal, -Lite and -Commercial versions).</p>
<p><a name="errors"></a></p>
<h2>Error Code Conventions and Error Handling</h2>
<p>The following conventions concern the returned errors:</p>
<ol>
<li>All functions that can return an error code have integer type of
return data.</li>
<li>If there is no error, the return value is 0 (LIBRAW_SUCCESS).</li>
<li>If an error has happened in a system call, the return value is errno
(a positive number), which can be analyzed using strerror() or similar
means.</li>
<li>All LibRaw's own error codes are negative; each of these errors
belongs to one of two types:
<dl>
<dt><strong>Non-fatal errors</strong></dt>
<dd>Non-fatal errors do not forbid execution of other functions in the
processing succession (e.g., <a href="API-CXX.html#unpack_thumb">unpack_thumb()</a>
can easily return the code corresponding to "preview is absent" but
this does not prevent further call of <a href="API-CXX.html#unpack">unpack()</a>.</dd>
<dt><strong>Fatal errors</strong></dt>
<dd>In the case of fatal errors (memory shortage, input data error,
data unpacking failure), the current stage of processing is
terminated and all allocated resources are freed.<br>
If an attempt to continue processing is made, all subsequent API
calls will return the LIBRAW_OUT_OF_ORDER_CALL error.<br>
At the same time, the LibRaw instance in which a fatal error has
occurred can process the next RAW files in the usual way (by calling
<a href="API-CXX.html#open_file">open_file()</a> (or other input
methods), then <a href="API-CXX.html#unpack">unpack()</a>, etc.).</dd>
</dl>
</li>
<li>The macro LIBRAW_FATAL_ERROR(error code) checks if an error is fatal
or not.</li>
<li>The error codes are <a href="API-datastruct.html#errors">listed and
deciphered here</a>.</li>
</ol>
<p><a name="warnings"></a></p>
<h2>Nonstandard Situations That Are Not Errors</h2>
<p>If the program has encountered a nonstandard situation that does not
prevent retrieval of some data from a file, it sends a signal by setting
the corresponding bit in <a href="API-datastruct.html#libraw_data_t">imgdata.process_warnings</a>.
The possible types of warnings are <a href="API-datastruct.html#warnings">listed
and deciphered here</a>.</p>
<p><a name="io"></a></p>
<h2>Input Layer Abstraction</h2>
<p>LibRaw uses objects derived from <a href="API-CXX.html#datastream">LibRaw_abstract_datastream</a>
for data input. Semantics of these objects is similar to 'file with
arbitrary seek' object: both read and seek operations are used.</p>
<p>Some RAW formats requires temporary switch to another data stream created
on top on memory buffer for metadata read. Methods for doing so are
implemented in base class <a href="API-CXX.html#datastream">LibRaw_abstract_datastream</a>
by internal data field <strong>substream</strong>. Look into source code
of <a href="API-CXX.html#file_datastream">LibRaw_file_datastream</a>
class in <strong>libraw/libraw_datastream.h</strong> file for more
details. <br>
When implementing own datastream classes, you need to take <strong>substream</strong>
into account and pass control to methods of this field if it is active
(not NULL).</p>
<p>If datastream implementation knows name of input file, it should provide
fname() call. This name will be used in <a href="API-CXX.html#callbacks">error
callbacks</a> and in guessing name of JPEG file with metadata (for RAW
files with external metadata).</p>
<p>For external metadata support input class should implement <strong>subfile_open()/subfile_close()</strong>
methods. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <br>
Sample of these methods implementation may be found in <a href="API-CXX.html#file_datastream">LibRaw_file_datastream</a>
class (look into <strong>libraw/libraw_datastream.h</strong> file for
details).</p>
<p><a name="threads"></a></p>
<h2>Thread safety</h2>
<p>Thread safety is ensured if a LibRaw object is created and used within
one thread. At the same time, the number of threads (each with its own
LibRaw object) is not limited in any way (except by memory requirements).</p>
<p>If a LibRaw object is created in one execution thread and used in
another, external synchronization is necessary.</p>
<p>There is two libraries under Unix environment (Linux/FreeBSD/MacOS):
libraw_r.a (thread-safe) and libraw.a (single-threaded, slightly faster).</p>
<p>Thread-safe library version stores intermediate unpacker data into LibRaw
class data. So, several copies of LibRaw, working in parallel, is
possible.</p>
<p>Not thread-safe library uses global variable for intermediate data store
which is faster but not reenterant. This non-thread-safe library still may
be used in multi-threaded apps, but only if exactly one LibRaw class copy
exists in program.</p>
<p>Windows version is similar to multi-threaded Unix one.</p>
<p><a name="CXX"></a></p>
<h2>The Use of C++</h2>
<p>Exception situations within LibRaw are handled using the C++ exception
mechanism. All exceptions are caught inside the library functions and
should not penetrate outside.</p>
<p>Memory is allocated/freed using functions malloc(calloc)/free rather than
new/delete.</p>
<p>If C API is used, references to C++ calls new/delete still remain, and so
linking with libstdc++(Unix)/....(Windows) is necessary.</p>
<p><a name="imgdata_params"></a></p>
<h2>Parameters of the LibRaw::imgdata.params Structure Affecting the
Behavior of open_file/unpack/unpack_thumb</h2>
<p>Most data fields of structure LibRaw::imgdata.params affect only <a href="API-CXX.html#dcrawemu">data
postprocessing</a>, but there are some exceptions, which have been
inherited by the current version of LibRaw from/ dcraw source texts (these
dependences will be gradually removed).</p>
<dl>
<dt><strong>imgdata.params.use_camera_matrix and
imgdata.params.use_camera_wb</strong></dt>
<dd>These fields affect loading of RAW data for cameras with a color
matrix.<br>
<strong>Attention!</strong> If parameter <strong>imgdata.params.use_camera_matrix</strong>
is not set by the user, it is copied from <strong>imgdata.params.use_camera_wb</strong>
at the stage of file opening.</dd>
<dt><strong>imgdata.params.user_flip</strong></dt>
<dd>If this parameter is greater than or equal to zero, assignment <code>imgdata.sizes.flip
= imgdata.params.user_flip</code> is performed at the <a href="API-CXX.html#open_file">open_file()</a>
stage.</dd>
<dt><strong>imgdata.params.shot_select</strong></dt>
<dd>This parameter makes it possible to select the number of the extracted
image for data formats in which storage of several RAW images in one
data file is possible.</dd>
<dt><strong>imgdata.params.half_size</strong></dt>
<dd>Affects RAW data loading for Phase One and Sinar backs. Also, it this
parameter is set then image bitmap will be reduced by half in each
dimension. In later case, all 4 components of bitmap will be filled
during data extraction phase.</dd>
<dt><strong>imgdata.params.threshold, imgdata.params.aber</strong></dt>
<dd>If these parameters used, then half-sized bitmap will be used for data
unpacking. See above for details.</dd>
<dt><strong>imgdata.params.use_camera_wb</strong></dt>
<dd>Affects loading of white balance matrix for Leaf backs.</dd>
</dl>
<p><a name="memory"></a></p>
<h2>Memory Usage</h2>
<p><a name="stack"></a></p>
<h3>Stack Usage</h3>
<p>An instance of the LibRaw class has its own size about <strong>800 Kb</strong>;
if constructions like <code>LibRaw imageProcessor;</code> are used, this
memory is stack-allocated.</p>
<p>Methods of class LibRaw (and C API calls) may allocate up to 130-140 Kb
of data on the stack (to place auto variables) during their work.</p>
<p>Thus, the work of one LibRaw instance may require about <strong>1MB</strong>
of stack memory. This is not a problem for most contemporary
architectures. However, when working in a multithreaded environment, one
should not forget to allocate a sufficient amount of memory for the thread
stack.</p>
<p>In the case of dynamic allocation (<code>LibRaw *iProcessor = new LibRaw;</code>),
the requirements to stack memory will decrease by ~800 Kb, which is the
size of a class instance). If <a href="API-C.html">C API</a> is used, the
LibRaw instance is allocated dynamically.</p>
<p><a name="memmgr"></a></p>
<h3>Dynamic Memory Management</h3>
<p>LibRaw keeps record of all allocated dynamic memory blocks; in the case
of an exceptional situation (fatal error), they are all freed. The code
for keeping this record is fairly primitive and not designed to consider
allocation of many blocks (in the normal situation, allocation takes place
from 2 to 6 times during file processing); this fact should be taken into
account by developers trying to add new methods to LibRaw.</p>
<p><a name="memuse"></a></p>
<h3>Dynamic Memory Usage</h3>
<p>LibRaw uses dynamic memory</p>
<ul>
<li>for the decoded image;</li>
<li>for the decoded thumbnail;</li>
<li>for the postprocessed image;</li>
<li>for the ICC profile retrieved from the RAW file (if available);</li>
<li>for temporary data at the stage of RAW file unpacking;</li>
<li>for temporary data at the stage of postprocessing and result output;</li>
<li>for reading of the RAW source file (only under Win32).</li>
</ul>
<p><a name="memraw"></a></p>
<h4>Memory buffer for the RAW image</h4>
<p>Decoded RAW data are stored:</p>
<ul>
<li>one 16-bit value per pixel for "bayer" images. The masked pixels
(black or dark or masked frame) are stored with image data.</li>
<li>Free or four 16-bit values for full-color images (Foveon, Linear DNG,
Canon sRAW etc.).</li>
<li>one,three, or four 32-bit floating point values per pixel for
floating-point data.</li>
</ul>
<p>The buffer for RAW data is allocated by <a href="API-CXX.html#unpack">unpack()</a>
call and freed upon calling <a href="API-CXX.html#recycle">recycle()</a>.</p>
<p><a name="memimage"></a></p>
<h4>Memory for the Postprocessed Image</h4>
<p>On postprocessing stage each pixel contains four 16-bit values, one for
each possible color channel (some sensors are actually 4-color).</p>
<p>The buffer for the decoded image is allocated upon calling <a href="API-CXX.html#raw2image">raw2image()</a>
or <a href="API-CXX.html#dcraw_process">dcraw_process()</a></p>
<p>The buffer freed upon calling <a href="API-CXX.html#recycle">recycle()</a>
or <a href="API-CXX.html#free_image">free_image()</a> calls.</p>
<p><a name="memthumb"></a></p>
<h4>Memory for the Decoded Thumbnail</h4>
<p>Memory for the thumbmail is allocated upon calling <a href="API-CXX.html#unpack_thumb">unpack_thumb()</a>
and freed upon calling <a href="API-CXX.html#recycle">recycle()</a>. The
size of the allocated buffer is precisely adjusted to the thumbnail size,
i.e., up to several Mb.</p>
<p><a name="memprofile"></a></p>
<p><a name="memraw"></a></p>
<h4>Memory for RAW Unpacking</h4>
<p>Memory for temporary buffer needed during RAW data unpacking may be
allocated during the work of <a href="API-CXX.html#unpack">unpack()</a>
and freed before completion of this function. The sizes of the allocated
buffers are small, up to tens of Kb.</p>
<p><a name="mempostproces"></a></p>
<h4>Memory for Postprocessing</h4>
<p>During image postprocessing (inherited from dcraw), memory for the
histogram (128 Kb) is allocated. This memory is allocated upon calling <a
href="API-CXX.html#dcraw_process">dcraw_process()</a> and freed upon
calling <a href="API-CXX.html#recycle">recycle()</a>.</p>
<p>In addition, during the work of <a href="API-CXX.html#dcraw_process">dcraw_process()</a>
and during the usage of some available possibilities, like</p>
<ul>
<li>rotation of images from FUJI cameras;</li>
<li>correction of chromatic aberrations;</li>
<li>image size changes (including correction of non-square pixels);</li>
<li>highlight recovery;</li>
</ul>
<p>a temporary buffer with the size equal to the size of the resultant image
(6-8 bytes per pixel for various processing stages) will be allocated. As
soon as the intermediate substage of processing is completed, the buffer
with the previous copy of the image will be freed.<br>
If postprocessing is not used, then temporary buffers are not allocated.</p>
<p><a name="memwrite"></a></p>
<h4>Memory for File Writing</h4>
<p>Upon calling <a href="API-CXX.html#dcraw_ppm_tiff_writer">dcraw_ppm_tiff_writer()</a>,
memory for a single row of the output image is allocated. The allocated
memory is freed before the end of this call.</p>
<p><a name="memunpack"></a></p>
<h4>Unpacking into memory buffer</h4>
<p>Functions <a href="API-CXX.html#dcraw_make_mem_image">dcraw_make_mem_image()</a>
<a href="API-CXX.html#dcraw_make_mem_thumb">dcraw_make_mem_thumb()</a>
(and complementary calls in C-API) allocates memory for entire output
datasets (full RGB bitmap and thumbnail, respectively).To free allocated
memory use <a href="API-CXX.html#dcraw_clear_mem">dcraw_clear_mem()</a>
function.</p>
<p><a name="incompat"></a></p>
<h2>Incompatibilities with dcraw</h2>
<p><a name="incompat_max"></a></p>
<h3>Automatic maximum search/brightness adjustment</h3>
<p>Many camera formats really use less data range, than possible by format
nature (bit count). If data maximum estimated incorrectly (too low) this
may resuls in colored highlights ('pink clouds') because of data cut at
wrong level.</p>
<p>To prevent this, LibRaw uses real data maximum from current file if this
maximum is larger than format maximum multiplied by
imdata.params.adjust_maximum_thr value (default is 0.75).</p>
<p>To turn off this feature (and repeat dcraw.c pink clouds) set
imdata.params.adjust_maximum_thr to 0.0</p>
<p><a name="incompat_kodak"></a></p>
<h3>Processing of Thumbnails from Kodak cameras</h3>
<p>In some Kodak cameras, the preview (thumbnail) is stored in the form of
uncorrected image. During its extraction using <strong>dcraw -e</strong>,
the white balance, color conversion, and other settings are the same as
those used for extraction of the main RAW data (including defect removal
and dark frame subtraction, which is erroneous, since the image size is
different). <br>
In LibRaw::unpack_thumb() calls, the white balance taken from the camera
("as shot") is used and no settings from imgdata.params are considered.</p>
<p>For all other cameras, thumbnails are extracted "as is," without any
color conversions, both in dcraw and in LibRaw.</p>
<p><a href="index.html">[back to Index]</a></p>
</body>

View File

@@ -0,0 +1,66 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Overview of LibRaw API (C++)</title>
</head>
<body>
<a href=index.html>[back to Index]</a>
<h1>Overview of LibRaw API (C++)</h1>
<h2>General Remarks</h2>
<ol>
<li>The entire processing is carried out by an instance of the LibRaw class, which is an image processor.</li>
<li>One image processor can simultaneously process only one data source file, but consecutive processing of any number of files
is possible.</li>
<li>There may be several simultaneously working image processors in a software program (e.g., in different threads), although one
should remember that each image processor may require much memory.</li>
<li>Reading of source data from the RAW file requires virtually no customization (see <a
href="API-notes.html">API Notes</a> for exceptions to this rule).</li>
<li>All data extracted from the RAW file are accessible through data fields of the image processor (LibRaw class instance).</li>
<li>Although LibRaw <b>is not intended for RAW data postprocessing</b>, the library includes calls that enable complete
emulation of the <b>dcraw</b> utility.
<li>All customization for the processing is performed via data fields of the LibRaw class.</li>
</ol>
<h2>Brief Demonstration</h2>
<p>
The example below contains no error processing for the sake of brevity.
</p>
<pre>
#include "libraw/libraw.h"
int process_image(char *file)
{
// Let us create an image processor
LibRaw iProcessor;
// Open the file and read the metadata
iProcessor.open_file(file);
// The metadata are accessible through <a href="API-datastruct.html">data fields of the class</a>
printf("Image size: %d x %d\n",iProcessor.imgdata.sizes.width,iProcessor.imgdata.sizes.height);
// Let us unpack the image
iProcessor.unpack();
// Convert from imgdata.rawdata to imgdata.image:
iProcessor.raw2image();
// And let us print its dump; the data are accessible through <a href="API-datastruct.html">data fields of the class</a>
for(i = 0;i lt; iProcessor.imgdata.sizes.iwidth * iProcessor.imgdata.sizes.iheight; i++)
printf("i=%d R=%d G=%d B=%d G2=%d\n",
i,
iProcessor.imgdata.image[i][0],
iProcessor.imgdata.image[i][1],
iProcessor.imgdata.image[i][2],
iProcessor.imgdata.image[i][3]
);
// Finally, let us free the image processor for work with the next image
iProcessor.recycle();
}
</pre>
<a href=index.html>[back to Index]</a>
</body>
</html>

View File

@@ -0,0 +1,124 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>LibRaw Compilation and Installation</title>
</head>
<body> <a href="index.html">[back to Index]</a>
<h1>LibRaw Compilation and Installation</h1>
<p>LibRaw is distributed in the form of source codes. For further use, they
should be compiled (and, if desired, placed into system folders with
libraries and include-files).</p>
<a name="unix"></a>
<h2>Unix Systems (FreeBSD, Linux, Mac OS X)</h2>
<p> To build the library, you will need a working C++ compiler (gcc 3+ and
clang 2+ are OK) and the make utility. </p>
<p>Additional libraries (optional):</p>
<ul>
<li>zlib (used to decode deflated DNGs)</li>
<li>libjasper (used to decode RED files)</li>
<li>libjpeg8 (used to decode lossy DNGs and several old Kodak cameras)</li>
</ul>
<p> LibRaw has been tested on 32- and 64-bit Unix systems working on x86-
(and AMD64-) compatible processors. Building and work on other
architectures have not been tested. </p>
<h3>Compilation of Library and Examples</h3>
<p> Unpack the downloaded distribution package.</p>
<pre> tar xzvf LibRaw-X.YY.tar.gz
</pre>
<p>For GitHub downloads (clones), perform ./configure script generation via</p>
<pre> autoreconf --install</pre>
<p>Go to LibRaw directory and run <b>./configure</b> and <b>make</b>: </p>
<pre>cd LibRaw-X.YY
./configure # with optional args
make
</pre>
<p>As a result, you will compile</p>
<ul>
<li>Library libraw.a in the lib/ folder</li>
<li><a href="Samples-LibRaw.html">Examples</a> in the bin/ folder (source
codes of examples are in the samples/ folder).</li>
</ul>
<p>In the current version, only static libraries are built:</p>
<ul>
<li>libraw.a: non-thread-safe version</li>
<li>libraw_r.a: thread-safe</li>
</ul>
<h3>Build parameters</h3>
<p> ./configure script have some non-standard parameters: </p>
<dl>
<dt> --enable-openmp<br>
--disable-openmp </dt>
<dd> Enable/disable OpenMP support if compiler supports it. OpenMP is
enabled by default. </dd>
<dt> --enable-lcms<br>
--disable-lcms </dt>
<dd> Enable/disable LCMS color engine support. If enabled, ./configure
will try to find lcms library. Both LCMS-1.x and LCMS-2.x are supported
LCMS support is enabled by default </dd>
<dt> --enable-examples<br>
--disable-examples </dt>
<dd> Enables/disables examples compilation and installation. Enabled by
default </dd>
</dl>
<h3>Installation and Usage</h3>
<p>To install the library, run</p>
<pre> sudo make install
</pre>
<p> It will place the libraries in <b>/usr/local/lib</b>, the include-files
in <b>/usr/local/include</b> (subfolder of libraw) and LibRaw samples to
<b>/usr/local/bin</b>. You can override installation path by using
./configure script. <br>
To use LibRaw, add the following parameters to the compiler call (when
building your own projects): </p>
<ul>
<li>Path to include-files: -I/usr/local/include</li>
<li>Path to libraries: -L/usr/local/lib</li>
<li>Library: -lraw (ordinary version) or -lraw_r (thread-safe version).</li>
</ul>
<h2>Windows: Building under Cygwin</h2>
<p> Building and installation are completely similar to <a href="#unix">building
and installation under Unix systems</a>. </p>
<h2>Windows: Native Building</h2>
<p> Building under Windows has three steps: </p>
<ul>
<li>Unpack the distribution package (if you have got no tar+gzip, take the
LibRaw distribution package in the .ZIP format) and go to folder
LibRaw-X.YYY. </li>
<li>Set the environment parameters so that the compiler/linker would find
the libraries and include-files. For Visual C++, this is done by running
<b>vcvars32.bat</b>. </li>
<li> Run<br>
<b>nmake -f Makefile.msvc</b><br>
</li>
</ul>
<p>You may need to edit Makefile.msvc to provide libjpeg/zlib/libjasper
paths to INCLUDE/LIB.</p>
<p> If all paths are set correctly and the include-files/libraries have been
found, then the following will be compiled:</p>
<ul>
<li>Library libraw_static.lib in folder lib</li>
<li>Dynamic library bin/libraw.dll and linking library for it
lib/libraw.lib</li>
<li>Examples in folder bin/.</li>
</ul>
<p>Only the thread-safe library is built under Win32, but it can be used
with non-threaded applications as well. All examples are linked with the
dynamic library (DLL); if static linking is necessary, one should link
applications with library libraw_static.lib and set the preprocessor
option /DLIBRAW_NODLL during compilation. </p>
<p> Windows-version compiles without LCMS support for now. </p>
<p> During building of DLL, all public functions are exported; further, the
exported subset may be reduced. </p>
<p> Unfortunately, paths to include/ libraries depend on the way Visual C
(or other compiler) is installed; therefore, it is impossible to specify
some standard paths in Makefile.msvc. </p>
<h2>Windows Installation</h2>
<p> No installation under Windows is supported. It is assumed that all DLLs
will be supplied together with the software using them (and this software
will perform the installation). Accordingly, in building of programs using
LibRaw, the paths to libraries, DLLs, and include-files should be
specified manually. </p>
<a href="index.html">[back to Index]</a>
</body>
</html>

View File

@@ -0,0 +1,213 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body>
<p>LibRaw: Usage Examples<a href="index.html">[back to Index]</a></p>
<h1>LibRaw: Usage Examples</h1>
<h2>Overview of Examples in the Distribution Package (samples/*)</h2>
<p>The LibRaw package contains several examples illustrating the use of this
library. Their source codes are located in the samples/ folder, and after
library build they will be in the bin/ folder:</p>
<ul>
<li><strong>raw-identify</strong> The only LibRaw call it uses is <a href="API-CXX.html#open_file">open_file()</a>;
further code prints the values of the fields of the imgdata structure. <strong><br>
</strong><strong>raw-identify -v</strong> provides extensive dump of
metadata/<br>
Command line key <strong>-u</strong> shows unpacking function name,
while <strong>-u -f</strong> prints function name and masked are sizes.<br>
<strong>raw-identify -w </strong>will print white balance tables stored
in RAW file.</li>
<li><strong>simple_dcraw</strong> A simple "emulation" of dcraw
reproducing the behavior of <strong>dcraw [-e] [-v] [-T]</strong>.&nbsp;
A simplified version of this example is <a href="#code">considered
below</a>. <br>
<strong>-B</strong> command-line switch turns on use of <a href="API-CXX.html#open_buffer">open_buffer()
API call</a> used via mmap() of input file (Unix only).</li>
<li><strong>dcraw_half</strong> Demonstrates the use of <a href="API-C.html">C
API</a>. The example emulates the behavior of <strong>dcraw -h</strong>
(no other control parameters can be specified in this example). </li>
<li><strong>dcraw_emu</strong> Almost complete emulation of dcraw (except for
keys -D -d -E -i -v -e, which are considered in other usage examples).
Of most interest is processing of command line keys (copied from dcraw).
<br>
<p>This sample supports additional command-line parameters absent in
original dcraw:</p>
<dl>
<dt><strong>-mmap</strong></dt>
<dd>Use <a href="API-CXX.html#open_buffer">open_buffer()</a>
interface. Buffer prepared by mmap() call. This option not supported
under Win32.</dd>
<dt><strong>-meme</strong></dt>
<dd>Use <a href="API-CXX.html#open_buffer">open_buffer()</a>
interface. Buffer prepared by malloc()+read() calls.</dd>
<dt><strong>-c float-value</strong></dt>
<dd>This key sets <strong>params.adjust_maximum_thr</strong>
parameter.<br>
Use -c 0 to completely disable automatic maximum calculation. <br>
Default value: 0.75</dd>
<dt><strong>-timing</strong></dt>
<dd>Turns on detailed timing print.</dd>
<dt><strong>-G</strong></dt>
<dd>Turns on "green_matching" mode to suppress color mazes on cameras
with different green channels.</dd>
<dt><strong>-B x y w h</strong></dt>
<dd>Crops output to rectangle with width w, height h and x,y
coordinates of left upper corner. All coordinates applied before any
image rotation.</dd>
<dt><strong>-F</strong></dt>
<dd>Will use FILE I/O (bigfile_datastream) instead on standard
LibRaw_file_datastream.</dd>
<dt><strong>-dcbi N</strong></dt>
<dd>Sets number of additional DCB-demosaic iterations (option valid
only for -q 4, i.e. for DCB demosaic).</dd>
<dt><strong>-dcbe</strong></dt>
<dd>Turns on DCB color enhance mode (only for DCB demosaic, -q 4).</dd>
<dt><strong>-aexpo e p</strong></dt>
<dd>Turns on exposure correction. e is exposure shift in linear scale
from 0.25 (darken 2 stops) to 8.0 (lighten 3 stops). p is highlights
preservation amount from 0.0 (no preservation, full clipping) to 1.0
(full preservation, S-like curve in highlights).</dd>
<dt><strong>-apentax4shot</strong></dt>
<dd>Will merge 4 frames from Pentax 4-shot RAWs</dd>
<dt><strong>-apentax4shotorder abce</strong></dt>
<dd>Order of frames in pentax 4-shot files (default is 3102)</dd>
<dt><strong>-mmap</strong></dt>
<dd>Use mmap + memory IO instead of file IO (unix only)</dd>
<dt><strong>-disars</strong></dt>
<dd>Disable RawSpeed library (if compiled with this library)</dd>
<dt><strong>-doutputflags N</strong></dt>
<dd>set imgdata.params.output_flags to N</dd>
<dt><strong>-disinterp</strong></dt>
<dd>Do not run interpolation step</dd>
<dt><strong>-dsrawrgb1</strong></dt>
<dd>Disable YCbCr to RGB conversion for sRAW (Cb/Cr interpolation
enabled)</dd>
<dt><strong>-dsrawrgb2</strong></dt>
<dd>Disable YCbCr to RGB conversion for sRAW (Cb/Cr interpolation
disabled)</dd>
</dl>
</li>
<li><strong>half_mt</strong> Emulation of <strong>dcraw -h</strong>. It
"understands" the following keys: -a (automatic white balance over the
entire image), -w (white balance of the camera), -T (output in the tiff
format), and -J n (number of parallel threads launched for image
processing).<br>
On multiprocessor/multicore computers, the speed gain is notable in the
case of mass processing. On a Win32 machine, the example is assembled
from the initial file half_mt_win32.c, since work with threads under
Windows is fundamentally different and it it easier to copy simple
source codes than write one complex code.</li>
<li><strong>mem_image</strong> This sample uses <a href="API-CXX.html#dcraw_make_mem_image">dcraw_make_mem_image</a>
and <a href="API-CXX.html#dcraw_make_mem_thumb">dcraw_make_mem_thumb</a>
calls, than writes data in PPM format. </li>
<li><strong>unprocessed_raw</strong> This sample extracts (mostly)
unaltered RAW data including masked pixels data (on supported cameras).
If black frame exists and black frame extraction is supported for given
format, masked pixels data is added to resulting .TIFF file. Command
line options: <strong>-q</strong> - be quiet, <strong>-A</strong> -
autoscale data (integer multiplier), <strong>-g</strong>
gamma-correction (gamma 2.2) for data (instead of precise linear one), <strong>-B</strong>
turns on black level subtraction</li>
<li><strong>4channnels</strong> - splits RAW-file into four separate
16-bit grayscale TIFFs (per RAW channel).<br>
Command line switches:
<ul>
<li><strong>-s N</strong> selects N-th image from RAW with multiple
images</li>
<li><strong>-g</strong> gamma correction (gamma 2.2)</li>
<li><strong>-A</strong> values autoscale by auto-calculated integer
factor</li>
<li><strong>-B</strong> turn off black subtraction</li>
<li><strong>-N</strong> no RAW curve</li>
</ul>
</li>
<li><strong>multirender_test</strong> - very simple example of multiple
rendering on one file without reopen.</li>
<li><strong>postprocessing_benchmark</strong> - will print timings of RAW
processing steps</li>
</ul>
<h2>Example of docmode</h2>
<p>Below we consider the samples/simple_dcraw.cpp example, which emulates
the behavior of <strong>dcraw [-e][-v][-t]</strong>. To save space, let
us assume that keys -t -v are always specified (to avoid comments on
command line parsing) and there is always one parameter (name of file),
which is the only one and always passed to the program.</p>
<pre>int main(int ac, char *av[])
{
int i, ret, verbose=0, output_thumbs=0;
char outfn[1024],thumbfn[1024];
// Creation of image processing object
LibRaw RawProcessor;
// The date in TIFF is written in the local format; let us specify the timezone for compatibility with dcraw
putenv ((char*)"TZ=UTC");
// Let us define variables for convenient access to fields of RawProcessor
#define P1 RawProcessor.imgdata.idata
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other
#define OUT RawProcessor.imgdata.params
OUT.output_tiff = 1; // Let us output TIFF
// Let us open the file
if( (ret = RawProcessor.open_file(av[1])) != LIBRAW_SUCCESS)
{
fprintf(stderr,"Cannot open %s: %s\n",av[i],libraw_strerror(ret));
// recycle() is needed only if we want to free the resources right now.
// If we process files in a cycle, the next open_file()
// will also call recycle(). If a fatal error has happened, it means that recycle()
// has already been called (repeated call will not cause any harm either).
RawProcessor.recycle();
goto end;
}
// Let us unpack the image
if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
{
fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
if(LIBRAW_FATAL_ERROR(ret))
goto end;
// if there has been a non-fatal error, we will try to continue
}
// Let us unpack the thumbnail
if( (ret = RawProcessor.unpack_thumb() ) != LIBRAW_SUCCESS)
{
// error processing is completely similar to the previous case
fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
if(LIBRAW_FATAL_ERROR(ret))
goto end;
}
else // We have successfully unpacked the thumbnail, now let us write it to a file
{
snprintf(thumbfn,sizeof(thumbfn),"%s.%s",av[i],T.tformat == LIBRAW_THUMBNAIL_JPEG ? "thumb.jpg" : "thumb.ppm");
if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_thumb_writer(thumbfn)))
{
fprintf(stderr,"Cannot write %s: %s\n",thumbfn,libraw_strerror(ret));
// in the case of fatal error, we should terminate processing of the current file
if(LIBRAW_FATAL_ERROR(ret))
goto end;
}
}
// Data unpacking
ret = RawProcessor.dcraw_process();
if(LIBRAW_SUCCESS != ret ) // error at the previous step
{
fprintf(stderr,"Cannot do postprocessing on %s: %s\n",av[i],libraw_strerror(ret));
if(LIBRAW_FATAL_ERROR(ret))
goto end;
}
else // Successful document processing
{
snprintf(outfn,sizeof(outfn),"%s.%s", av[i], "tiff");
if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
fprintf(stderr,"Cannot write %s: error %d\n",outfn,ret);
}
// we don't evoke recycle() or call the destructor; C++ will do everything for us
return 0;
end:
// got here after an error
return 1;
}
</pre>
<p><a href="index.html">[back to Index]</a></p>
</body>
</html>

View File

@@ -0,0 +1,65 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body>
<p>Purpose and Objectives<a href="index.html">[back to Index]</a></p>
<h1>LibRaw Project Goals and Objectives</h1>
<h2>Who May Be Interested in This Project</h2>
<p>The proposed project and the software products generated within this project are intended for:</p>
<ul>
<li>Developers of RAW converters, including current and new developments</li>
<li>Developers of applications that need access to decoded RAW data (for pre-processing, stitching, stacking, color profiling, etc.)</li>
<li>Those willing to write their own graphic interface for RAW file processing</li>
<li>Developers and enthusiasts creating their own primary and auxiliary data processing algorithms, including
<ul>
<li>Interpolation (demosaic),</li>
<li>Noise reduction</li>
<li>White balance</li>
<li>Correction of aberrations and distortions</li>
<li>RAW data analysis</li>
<li>Comparison of cameras and lenses</li>
<li>and so on...</li>
</ul>
</li>
</ul>
<h2>Some History</h2>
<p>The LibRaw project started in 2008. At that time <a href="https://www.cybercom.net/%7Edcoffin/dcraw/">dcraw</a> was very popular as a method of accessing RAW data. It was hard to find a more or less popular camera that was not supported by this utility; while the implementation of RAW data extraction in <strong>dcraw</strong> was of a very high quality.</p>
<p>However, developers and enthusiasts were experiencing a number of difficulties when using <strong>dcraw</strong>. First, the author of <strong>dcraw</strong> refused to turn his product into a handy library. Besides, <strong>dcraw</strong> contains a number of questionable features that 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, with each new release of <strong>dcraw</strong>, virtually all developers, part of them listed on the <a
href="https://www.cybercom.net/%7Edcoffin/dcraw/">dcraw Web site</a>, were to check the differences, figure out the patches, and apply those patches to their dcraw-based code and libraries.</p>
<p>As for enthusiasts, the "entry cost" of verifying their own ideas and implementing their own algorithms in such an environment 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.</p>
<p>Thus, the inconveniences of <strong>dcraw</strong> make the developers' community quite small and halt further evolution and improvement of RAW format converters.</p>
<p>Our project started with the idea to <em>get a library based on dcraw, only better</em>. Today we are well past that initial goal, not in the least because <strong>dcraw</strong> is not actively supported since 2015, and the latest release was published nearly 2 years ago, in May 2016. Since then several distinctly different RAW formats (introduced by Fujifilm, Nikon, Pentax, Samsung, Sigma, Sony) emerged, none of which is supported by <strong>dcraw</strong>. Additionally, we see it necessary to extract more metadata to help better interpretation of RAW data and to add flexibility to the RAW conversion process.</p>
<h2>Goals and Objectives</h2>
<p>We are maintaining LibRaw as a library providing access to decoded raw data and metadata useful for correct interpretation of the said data. Thus:</p>
<ol>
<li>To keep on adding RAW decoding for new and previously unsupported cameras</li>
<li>To continue the development of a stable and consistent API suitable for other applications (RAW converters, data analyzers, panorama stitchers, etc.)</li>
<li>To have RAW processing as separate independent parts (groups of API calls)
<ul>
<li>Reading, decoding, and unpacking of RAW data: <em><strong>this is the main functionality of LibRaw</strong></em></li>
<li>Data conversions: interpolation, white balance, etc.: <em><strong>this part of LibRaw is frozen: we ported dcraw functionality, but expect that library users will create own postprocessing code.</strong></em></li>
<li>File output of the processing results. <em><strong>This part is very primitive, only tiff and ppm output is supported.</strong></em></li>
</ul>
</li>
</ol>
<p style="margin-left:.5in;">The latter two groups of functions are maintained to provide some postprocessing/saving ability from scratch, without writing own code. We do not have any plans to extend/improve this code.</p>
<ol>
<li value="4">To improve the procedures of RAW data retrieval and decoding.</li>
<li>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 <a>listed above</a>), so that they could create their own GUI programs and interfaces without developing the entire RAW converter.</li>
</ol>
<h2>LibRaw Release Schedule</h2>
<ol>
<li><strong>Production releases</strong> will be published at intervals of 1-1.5 years. Production releases will be maintained through bugfixes. New cameras will not be added to production releases, but only to snapshots and non-stable/beta releases.<em> Patch </em>(bugfix) releases of production releases should provide API/ABI consistency (so, version 0.21.5 should be binary compatible with 0.21.0).</li>
<li><strong>Snapshots</strong> are planned to be released every 2-3 quarters. Snapshots will include support for new cameras, stable and tested in our own applications. API calls and internal routines may be changed. No binary compatibility maintained, to upgrade to newer snapshot one need to recompile application that uses it.</li>
<li><strong>Non-stable/beta releases</strong> with new features, like initial support for some new RAW format that needs extensive testing by the community.&nbsp; No exact schedule, to be published as needed.</li>
</ol>
<h2>How You Can Help/Participate</h2>
<p><strong>We welcome any help</strong>, however:</p>
<ol>
<li>If you are submitting any core functionality extensions/improvements, that is, something that has to do with the decoding of RAW and/or metadata, that would be highly valuable and we will maintain your submission on our own, if necessary; you don<6F>t need to be committed.</li>
<li>If your contribution adds to post-processing, please be committed to supporting and maintaining such a contribution. Our previous experience with such contributions has been less than positive, exactly because of the lack of maintenance on the part of the contributors. We are unable to maintain such contributions on our own, because our primary goal is to maintain RAW and metadata decoding.</li>
</ol>
<p><a href="index.html">[back to Index]</a></p>
</body>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>LibRaw: better dcraw (library)</title>
</head>
<body>
<h1>LibRaw: RAW image decoding/processing library</h1>
<p>LibRaw is a library for reading RAW files from digital photo cameras (CRW/CR2, NEF, RAF, DNG, MOS, KDC, DCR, etc.; virtually all RAW formats are supported). It pays special attention to correct retrieval of data required for subsequent RAW conversion.</p>
<p>The library is intended for embedding in RAW converters, data analyzers, and other programs using RAW files as the initial data.</p>
<p> Contents </p>
<ol>
<li><a href="#copyright">Copyright</a></li>
<li><a href="Why-LibRaw.html">Purpose and Objectives</a></li>
<li><a href="API-overview.html">Overview of LibRaw API (C++)</a></li>
<li><a href="Install-LibRaw.html">Compilation and Installation</a></li>
<li><a href="API-datastruct.html">Data Structures, Error Codes, and Constants</a> </li>
<li><a href="API-CXX.html">C++ API</a> </li>
<li><a href="API-C.html">C API</a></li>
<li><a href="API-notes.html">Notes on API (error code conventions, memory usage)</a></li>
<li><a href="Samples-LibRaw.html">Examples</a> </li>
</ol>
<a name="copyright"></a>
<h2>Copyright</h2>
<p> LibRaw library, Copyright (C) 2008-2021 LibRaw LLC (info@libraw.org)<br>
The library includes source code from<br>
<i>dcraw.c, Dave Coffin's raw photo decoder<br>
Copyright 1997-2016 by Dave Coffin, dcoffin a cybercom o net<br>
</i> </p>
<p> LibRaw is distributed for free under two different licenses: </p>
<ul>
<li><a href="http://www.gnu.org/licenses/lgpl-2.1.html">GNU Lesser General Public License, version 2.1</a></li>
<li><a href="http://www.opensource.org/licenses/cddl1.txt">COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0</a></li>
</ul>
You may use one of these licensing modes and switch between them.
<p></p>
</body>
</html>