summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-05 14:39:38 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-05 14:39:38 +0200
commitcd88e2b92cf7ae6e43c3a1baf97048ddd72f8e49 (patch)
treed79a8225e5c3d959b7a422e5df0c8229bce05b36
parentsplit aux into aux and interpolation (diff)
downloadblueshift-cd88e2b92cf7ae6e43c3a1baf97048ddd72f8e49.tar.gz
blueshift-cd88e2b92cf7ae6e43c3a1baf97048ddd72f8e49.tar.bz2
blueshift-cd88e2b92cf7ae6e43c3a1baf97048ddd72f8e49.tar.xz
add interpolate_function
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--info/blueshift.texinfo13
-rw-r--r--src/interpolation.py19
2 files changed, 31 insertions, 1 deletions
diff --git a/info/blueshift.texinfo b/info/blueshift.texinfo
index 8433a6b..ac2ab8c 100644
--- a/info/blueshift.texinfo
+++ b/info/blueshift.texinfo
@@ -1537,7 +1537,8 @@ by invoking them.
@section Interpolation
ICC profiles and curves that have beens turned
-into functions with @code{functionise} have lower
+into functions with @code{functionise}, or curves
+read from the current adjustments, have lower
input resolution that the input they receive;
to compensate for this, nearest-neighbour
interpolation is used. If you want to better
@@ -1574,6 +1575,16 @@ is the same for the original curves and the
scaled up curves. It is recommended to
use the order: red, green and blue.
+However, often these lookup tables are
+oftern turned in to functions. To interpolate
+a function, you can use the function
+@code{interpolate_function}, it takes
+two arguments: the function that applies
+adjustments from a lookup table, and
+a function that interpolates a lookup
+table trio. It returns a function that
+applies the interpolated lookup table.
+
@node Configuration examples
diff --git a/src/interpolation.py b/src/interpolation.py
index f5acba3..9039c11 100644
--- a/src/interpolation.py
+++ b/src/interpolation.py
@@ -17,6 +17,7 @@
# This module contains interpolation functions.
+from aux import *
from curve import *
@@ -188,3 +189,21 @@ def eliminate_halos(r, g, b, R, G, B):
# and replace the local partition with the linear interpolation.
large[X1 : X2 + 1] = linear[ci][X1 : X2 + 1]
+
+def interpolate_function(function, interpolator):
+ '''
+ Interpolate a function that applies adjustments from a lookup table
+
+ @param function:()→void The function that applies the adjustments
+ @param interpolator:(list<float>{3})?→[list<float>{3}] Function that interpolates lookup tables
+ @return :()→void `function` interpolated
+ '''
+ if interpolator is None:
+ return function
+ stored = store()
+ start_over()
+ function()
+ rc = functionise(interpolator(*store()))
+ restore(stored)
+ return rc
+