2
This file is part of darktable,
3
copyright (c) 2011 Jochen Schroeder
5
darktable is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
10
darktable is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with darktable. If not, see <http://www.gnu.org/licenses/>.
18
part of this file is based on nikon_curve.h from UFraw
19
Copyright 2004-2008 by Shawn Freeman, Udi Fuchs
23
#define CUBIC_SPLINE 0
25
#define MONOTONE_HERMITE 2
27
//Maximum resoltuion allowed due to space considerations.
28
#define MAX_RESOLUTION 65536
29
#define MAX_ANCHORS 20
34
#define CT_WARNING 104
35
#define CT_SET_ERROR 200
38
//////////////////////////////////////////////////////////////////////////////
39
//////////////////////////////////////////////////////////////////////////////
41
//////////////////////////////////////////////////////////////////////////////
42
//////////////////////////////////////////////////////////////////////////////
43
/**********************************************************
45
Structure for the curve data inside a NTC/NCV file.
46
***********************************************************/
56
unsigned int m_spline_type;
64
//Number of anchor points
65
unsigned char m_numAnchors;
67
//contains a list of anchors, 2 floats per each point, x-y format
69
CurveAnchorPoint m_anchors[MAX_ANCHORS];
75
//Number of samples to use for the curve.
76
unsigned int m_samplingRes;
77
unsigned int m_outputRes;
80
unsigned short int *m_Samples; // jo: changed to short int to save memory
84
/*********************************************
86
Samples from a spline curve constructed from
89
curve - Pointer to curve struct to hold the data.
90
sample - Pointer to sample struct to hold the data.
91
**********************************************/
92
int CurveDataSample(CurveData *curve, CurveSample *sample);
94
/***************************************************************
97
* convenience function for calculating the necessary parameters for
101
* n - length of data arrays
102
* x - x axis of the data array
103
* y - y axis of the data array
104
* type - type of interpolation currently either CUBIC or HERMITE
106
* ypp - pointer to array of parameters
107
*******************************************************************/
108
float *interpolate_set( int n, float x[], float y[], unsigned int type);
110
/***************************************************************
113
* convenience function for piecewise interpolation
116
* n - length of data arrays
117
* x - x axis of the data array
118
* xval - point where to interpolate
119
* y - y axis of the data array
120
* tangents - parameters calculated with interpolate_set
121
* type - type of interpolation currently either CUBIC or HERMITE
123
* yval - interpolated value at xval
124
*******************************************************************/
125
float interpolate_val( int n, float x[], float xval, float y[], float tangents[], unsigned int type);