LensSerious 0.1
Lens-correction mathematics as data, not as a library of callbacks
Loading...
Searching...
No Matches
lensserious_vendor.h
Go to the documentation of this file.
1/*
2 LensSerious — a maker's own correction tables, decoded into the library's generic knots.
3
4 Copyright (C) 2026 Aurélien PIERRE.
5 Ported from darktable's embedded-metadata lens correction (src/iop/lens.cc and
6 src/common/dng_opcode.c), Copyright (C) the darktable contributors.
7
8 License: GPL-3.0-or-later — NOT the library's usual LGPL. The decoders derive from
9 GPL-licensed darktable code whose copyright this project does not own, so this module
10 is a separate build target (`lensserious_vendor`) a consumer links only if the GPL
11 suits it. Nothing in the core library depends on anything here.
12*/
13
106#ifndef LENSSERIOUS_VENDOR_H
107#define LENSSERIOUS_VENDOR_H
108
109#include <stddef.h>
110#include <stdint.h>
111
112#include "lensserious.h"
113
114#ifdef __cplusplus
115extern "C" {
116#endif
117
128
133typedef struct ls_vendor_sony_t
134{
135 int nc;
136 int16_t distortion[16];
137 int16_t ca_r[16];
138 int16_t ca_b[16];
139 int16_t vignetting[16];
141
144typedef struct ls_vendor_fuji_t
145{
146 int nc;
147 float cropf;
150 float knots[11];
151 float distortion[11];
152 float ca_r[11];
153 float ca_b[11];
154 float vignetting[11];
156
160typedef struct ls_vendor_dng_t
161{
164 uint32_t warp_planes;
165 double warp_coeffs[3][6];
166 double warp_cx;
167 double warp_cy;
168 double vig_coeffs[5];
169 double vig_cx;
170 double vig_cy;
172
176{
178 float dist[4];
180 float ca[6];
182
196
207
211#define LS_VENDOR_EBADDATA (-1)
212
224int ls_vendor_axes(const ls_vendor_data_t *d);
225
249 int w, int h, ls_knots_t *knots, float *autoscale);
250
269int ls_vendor_parse_dng_opcodelist3(const uint8_t *blob, size_t len, ls_vendor_dng_t *out);
270
271#ifdef __cplusplus
272}
273#endif
274
275#endif /* LENSSERIOUS_VENDOR_H */
What this is, and what it deliberately is not.
struct ls_vendor_finetune_t ls_vendor_finetune_t
Per-axis strength blend, 1.0 = exactly as the maker measured. The vendors' own GUIs expose these as "...
struct ls_vendor_dng_t ls_vendor_dng_t
A DNG's OpcodeList3 corrections, parsed. Fill it with ls_vendor_parse_dng_opcodelist3() — or by hand,...
struct ls_vendor_fuji_t ls_vendor_fuji_t
Fujifilm maker-note tables, verbatim: explicit knot radii shared by the three corrections,...
int ls_vendor_parse_dng_opcodelist3(const uint8_t *blob, size_t len, ls_vendor_dng_t *out)
Parse a DNG OpcodeList3 payload: WarpRectilinear (1) and VignetteRadial (3).
int ls_vendor_axes(const ls_vendor_data_t *d)
Which correction axes this data carries.
ls_vendor_type_t
Which maker's format a ls_vendor_data_t holds. NONE == 0, so a zero-initialised struct safely means "...
@ LS_VENDOR_DNG
@ LS_VENDOR_OLYMPUS
@ LS_VENDOR_FUJI
@ LS_VENDOR_SONY
@ LS_VENDOR_NONE
int ls_vendor_resolve(const ls_vendor_data_t *d, const ls_vendor_finetune_t *ft, int w, int h, ls_knots_t *knots, float *autoscale)
The conversion: vendor tables in, generic knots out.
struct ls_vendor_data_t ls_vendor_data_t
One image's embedded correction data: the type tag and the matching member. A plain value — embed it ...
struct ls_vendor_sony_t ls_vendor_sony_t
Sony maker-note tables, verbatim: fixed-point int16 over nc evenly spaced radii, which the file leave...
struct ls_vendor_olympus_t ls_vendor_olympus_t
Olympus maker-note polynomials, verbatim. No vignetting: Olympus does not publish one,...
A lens correction the camera maker measured and wrote into the file, as knots.
One image's embedded correction data: the type tag and the matching member. A plain value — embed it ...
ls_vendor_dng_t dng
ls_vendor_fuji_t fuji
ls_vendor_sony_t sony
ls_vendor_type_t type
ls_vendor_olympus_t olympus
union ls_vendor_data_t::@1 u
A DNG's OpcodeList3 corrections, parsed. Fill it with ls_vendor_parse_dng_opcodelist3() — or by hand,...
double warp_coeffs[3][6]
Per-axis strength blend, 1.0 = exactly as the maker measured. The vendors' own GUIs expose these as "...
Fujifilm maker-note tables, verbatim: explicit knot radii shared by the three corrections,...
Olympus maker-note polynomials, verbatim. No vignetting: Olympus does not publish one,...
Sony maker-note tables, verbatim: fixed-point int16 over nc evenly spaced radii, which the file leave...