comparison layer/ColourScale.h @ 1137:4e7ed3252d80 spectrogram-minor-refactor

Re-implement dB^2 (log-power) spectrogram setting
author Chris Cannam
date Thu, 04 Aug 2016 11:26:11 +0100
parents ea5ae9dd10ba
children a34a2a25907c
comparison
equal deleted inserted replaced
1136:9ff838a64461 1137:4e7ed3252d80
33 */ 33 */
34 class ColourScale 34 class ColourScale
35 { 35 {
36 public: 36 public:
37 struct Parameters { 37 struct Parameters {
38 Parameters() : colourMap(0), scale(ColourScaleType::Linear), 38 Parameters() : colourMap(0), scaleType(ColourScaleType::Linear),
39 minValue(0.0), maxValue(1.0), 39 minValue(0.0), maxValue(1.0),
40 threshold(0.0), gain(1.0) { } 40 threshold(0.0), gain(1.0), multiple(1.0) { }
41 41
42 /** A colour map index as used by ColourMapper */ 42 /** A colour map index as used by ColourMapper */
43 int colourMap; 43 int colourMap;
44 44
45 /** Distribution for the scale */ 45 /** Distribution for the scale */
46 ColourScaleType scale; 46 ColourScaleType scaleType;
47 47
48 /** Minimum value in source range */ 48 /** Minimum value in source range */
49 double minValue; 49 double minValue;
50 50
51 /** Maximum value in source range. Must be > minValue */ 51 /** Maximum value in source range. Must be > minValue */
53 53
54 /** Threshold below which every value is mapped to background 54 /** Threshold below which every value is mapped to background
55 pixel 0 */ 55 pixel 0 */
56 double threshold; 56 double threshold;
57 57
58 /** Gain to apply before clamping and mapping */ 58 /** Gain to apply before thresholding, mapping, and clamping */
59 double gain; 59 double gain;
60
61 /** Multiple to apply after thresholding and mapping. In most
62 * cases the gain parameter is the one you want instead of
63 * this, but this can be used for example with Log scale to
64 * produce the log of some power of the original value,
65 * e.g. multiple = 2 gives log(x^2). */
66 double multiple;
60 }; 67 };
61 68
62 /** 69 /**
63 * Create a ColourScale with the given parameters. 70 * Create a ColourScale with the given parameters.
64 * 71 *