Files
rawTherapee/doc/API-C.html
Lawrence Lee 4c61b7d3c3 Squashed 'rtengine/libraw/' changes from 1ef70158d..12b0e5d60
12b0e5d60 Snapshot 202403
a4c9b1981 loop parameters in remove_trailing_spaces
e231b01a4 CR3-Qstep table: avoid wrong 64-bit code generation
21368133a 0.21.2 release
a6f212a4a tag type => tag size mapping fixed
41506ef73 cubic_spline: better handling of non-integer data
17294b5fd extra metadata check in arq_load_raw
47d9dd8e2 Better incorrect data handling in cubic_spline
3baa51068 skip invalid pattern in xtrans_interpolate
eaf63bf5f Check HL recovery coeffs before processing
a14574080 limit wavelet denoise minimum size
4e597e4e9 Merge pull request #594 from pinotree/path_max
086dcb9a6 raw-identify: use fallback if PATH_MAX not available
0e105f9f8 additional check against corrupted ljpeg layout
0c8b68e9f Disable color conversion for Canon 16-bit thumbnails
cd1abd695 docs/changelog: explained the case when no thumbnail is found in specific file
6fffd414b rename swapXX to libraw_swapXX to avoid name conflict
af78ae48a Check against corrupted LJPEG header in Canon sRAW decoder
ba780e600 Limit embedded color profile allocation/read size
122bf7c5b Wrong alloc result check for 16-bit bitmap thumbnail
e6dd2709e check pana_data/buffer offset before use
ae2dc5884 Check P1 quadrant linearization coeff[15] against zero
f2998bacc avoid integer overflow in buffer space check
443b7fb51 prevent buffer overrun in buffer_datastream::scanf_one
35a6d3615 ensure correct T.tlength for 16b bitmap thumbnails(2)
b69ea8be5 ensure correct T.tlength for 16b bitmap thumbnails
2b6eca897 Do not run sraw decoder on (crafted) bayer files
68808b57f better striped thumbnails handling
9ab70f6dc do not set shrink flag for 3/4 component images
32425dd96 allow more decoders for fuji-rotated RAWs
REVERT: 1ef70158d 0.21.2 release
REVERT: 62f042366 tag type => tag size mapping fixed
REVERT: ee087e3fe cubic_spline: better handling of non-integer data
REVERT: af755b991 extra metadata check in arq_load_raw
REVERT: 0fadd8819 Better incorrect data handling in cubic_spline
REVERT: d7fb66053 skip invalid pattern in xtrans_interpolate
REVERT: d059ed280 Check HL recovery coeffs before processing
REVERT: 104730519 limit wavelet denoise minimum size
REVERT: cae09838e raw-identify: use fallback if PATH_MAX not available
REVERT: d6c677608 additional check against corrupted ljpeg layout
REVERT: 1001a6ac1 Disable color conversion for Canon 16-bit thumbnails
REVERT: a5130b01b docs/changelog: explained the case when no thumbnail is found in specific file
REVERT: 600c0c63d rename swapXX to libraw_swapXX to avoid name conflict
REVERT: 299c8a11b Check against corrupted LJPEG header in Canon sRAW decoder
REVERT: ec8671ad9 Limit embedded color profile allocation/read size
REVERT: 5229d5942 Wrong alloc result check for 16-bit bitmap thumbnail
REVERT: b278b775f check pana_data/buffer offset before use
REVERT: 7f4b8d3af Check P1 quadrant linearization coeff[15] against zero
REVERT: e942a7db6 avoid integer overflow in buffer space check
REVERT: f6a57cfb8 prevent buffer overrun in buffer_datastream::scanf_one
REVERT: 3e62ed304 ensure correct T.tlength for 16b bitmap thumbnails(2)
REVERT: 8e52d81cd ensure correct T.tlength for 16b bitmap thumbnails
REVERT: 8e1af15e2 Do not run sraw decoder on (crafted) bayer files
REVERT: 0ace959c2 better striped thumbnails handling
REVERT: 477e0719f do not set shrink flag for 3/4 component images
REVERT: c8efae6c5 allow more decoders for fuji-rotated RAWs

git-subtree-dir: rtengine/libraw
git-subtree-split: 12b0e5d60c57bb795382fda8494fc45f683550b8
2024-04-13 22:44:59 -07:00

10 KiB

<html> <head> </head>

LibRaw: C API[back to Index]

LibRaw: C API

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 description of C++ API.

Contents

  1. Initialization and denitialization
  2. Returned values
  3. Data loading
  4. Parameters getters/setters
  5. Auxiliary Functions
  6. Data Postprocessing, Emulation of dcraw Behavior
  7. Writing to Output Files
  8. Writing processing results to memory buffer

Initialization and denitialization

libraw_data_t *libraw_init(unsigned int flags);
The function returns the pointer to the instance of libraw_data_t structure.
The resultant pointer should be passed as the first argument to all C API functions (except for libraw_strerror).
Returns NULL in case of error, pointer to the structure in all other cases.
void libraw_close(libraw_data_t *);
Closes libraw_data_t handler and deallocates all memory.

Returned values

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 C++ API return code is returned.

Data Loading from a File/Buffer

int libraw_open_file(libraw_data_t*, const char *)
int libraw_open_file_ex(libraw_data_t*, const char *,INT64 bigfile_size)
WIN32: int libraw_open_wfile(libraw_data_t*, const wchar_t *)
WIN32: int libraw_open_wfile_ex(libraw_data_t*, const wchar_t *,INT64 bigfile_size)
See LibRaw::open_file()
int libraw_open_buffer(libraw_data_t*, void *buffer, size_t bufsize)
See LibRaw::open_buffer()
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)
See LibRaw::open_bayer()
int libraw_unpack(libraw_data_t*);
See LibRaw::unpack()
int libraw_unpack_thumb(libraw_data_t*);
See LibRaw::unpack_thumb()
int libraw_unpack_thumb_ex(libraw_data_t*,int);
See LibRaw::unpack_thumb_ex()

Parameters setters/getters

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.

  • int libraw_get_raw_height(libraw_data_t *lr);
  • int libraw_get_raw_width(libraw_data_t *lr);
  • int libraw_get_iheight(libraw_data_t *lr);
  • int libraw_get_iwidth(libraw_data_t *lr);
  • float libraw_get_cam_mul(libraw_data_t *lr,int index);
  • float libraw_get_pre_mul(libraw_data_t *lr,int index);
  • float libraw_get_rgb_cam(libraw_data_t *lr,int index1, int index2);
  • libraw_iparams_t *libraw_get_iparams(libraw_data_t *lr);
  • libraw_lensinfo_t *libraw_get_lensinfo(libraw_data_t *lr);
  • libraw_imgother_t *libraw_get_imgother(libraw_data_t *lr);
  • int libraw_get_color_maximum(libraw_data_t *lr);
  • void libraw_set_user_mul(libraw_data_t *lr,int index, float val);
  • void libraw_set_demosaic(libraw_data_t *lr,int value);
  • void libraw_set_adjust_maximum_thr(libraw_data_t *lr,float value);
  • void libraw_set_output_color(libraw_data_t *lr,int value);
  • void libraw_set_output_bps(libraw_data_t *lr,int value);
  • void libraw_set_gamma(libraw_data_t *lr,int index, float value);
  • void libraw_set_no_auto_bright(libraw_data_t *lr,int value);
  • void libraw_set_bright(libraw_data_t *lr,float value);
  • void libraw_set_highlight(libraw_data_t *lr,int value);
  • void libraw_set_fbdd_noiserd(libraw_data_t *lr,int value);
  • int libraw_adjust_to_raw_inset_crop(libraw_data_t *lr, unsigned mask, float maxcrop);

Auxiliary Functions

const char* libraw_version()
See LibRaw::version()
int libraw_versionNumber()
See LibRaw::versionNumber()
See LibRaw::versionNumber()
bool LIBRAW_CHECK_VERSION(major,minor,patch)
See LIBRAW_CHECK_VERSION
unsigned libraw_capabilities()
See LibRaw::capabilities()
int libraw_cameraCount()
See LibRaw::cameraCount()
const char* libraw_cameraList()
See LibRaw::cameraList()
int libraw_get_decoder_info(libraw_data_t*,libraw_decoder_info_t *);
See LibRaw::get_decoder_info()
const char* libraw_unpack_function_name(libraw_data_t*);
See LibRaw::unpack_function_name()
int libraw_COLOR(libraw_data_t*,int row,int col);
See LibRaw::COLOR()
void libraw_subtract_black(libraw_data_t*);
See LibRaw::subtract_black()
void libraw_recycle_datastream(libraw_data_t*);
See LibRaw::recycle_datastream()
void libraw_recycle(libraw_data_t*);
See LibRaw::recycle()
const char *libraw_strerror(int errorcode);
See LibRaw::strerror
const char *libraw_strprogress(enum LibRaw_progress);
See LibRaw::strprogress
void libraw_set_dataerror_handler(libraw_data_t*,data_callback func, void *);
See LibRaw::set_dataerror_handler()
void libraw_set_progress_handler(libraw_data_t*,progress_callback func, void *);
See LibRaw::set_progress_handler()

Data Postprocessing, Emulation of dcraw Behavior

Setting of Parameters

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:

 libraw_data_t *ptr = libraw_init(0);
 ptr->params.output_tiff = 1; //  output to TIFF
    

Fields of this structure are described in the documentation to libraw_output_params_t. For notes on their use, see API notes.

Emulation of dcraw Behavior

int libraw_raw2image(libraw_data_t*);
See LibRaw::raw2image
int libraw_free_image(libraw_data_t*);
See LibRaw::free_image
int libraw_adjust_sizes_info_only(libraw_data_t*);
See LibRaw::adjust_sizes_info_only()
int libraw_dcraw_process(libraw_data_t* lr);
See LibRaw::dcraw_process()

Writing to Output Files

int libraw_dcraw_ppm_tiff_writer(libraw_data_t* lr,const char *filename);
See LibRaw::dcraw_ppm_tiff_writer()
int libraw_dcraw_thumb_writer(libraw_data_t* lr,const char *fname);
See LibRaw::dcraw_thumb_writer()

Writing processing results to memory buffer

libraw_processed_image_t *libraw_dcraw_make_mem_image(libraw_data_t* lr,int * errcode)
See LibRaw::dcraw_make_mem_image()
libraw_processed_image_t *libraw_dcraw_make_mem_thumb(libraw_data_t* lr,int * errcode)
See LibRaw::dcraw_make_mem_thumb()
void libraw_dcraw_clear_mem(libraw_processed_image_t *);
See LibRaw::dcraw_clear_mem()

[back to Index]

</html>