summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-01-27 22:50:01 +0000
committerCarl Hetherington <cth@carlh.net>2014-01-27 22:50:01 +0000
commit04b4d9f08ee30eb4dc4e62cddc4b332c69d18ac0 (patch)
treeacdc02ea849b4b6553e073f3cce2574ee59c2403 /src
parent95de247288c5abfd35347d8ad5fe4d5317eb2252 (diff)
Remove LUT parent class.
Diffstat (limited to 'src')
-rw-r--r--src/gamma_lut.cc8
-rw-r--r--src/gamma_lut.h27
-rw-r--r--src/lut.h63
-rw-r--r--src/lut_cache.h1
-rw-r--r--src/mono_picture_frame.cc3
-rw-r--r--src/rgb_xyz.cc8
-rw-r--r--src/rgb_xyz.h6
-rw-r--r--src/stereo_picture_frame.cc1
-rw-r--r--src/wscript1
9 files changed, 38 insertions, 80 deletions
diff --git a/src/gamma_lut.cc b/src/gamma_lut.cc
index b994aacc..4d61e60c 100644
--- a/src/gamma_lut.cc
+++ b/src/gamma_lut.cc
@@ -25,10 +25,12 @@ using namespace dcp;
LUTCache<GammaLUT> GammaLUT::cache;
-GammaLUT::GammaLUT (int bits, float gamma)
- : LUT (bits, gamma)
+GammaLUT::GammaLUT (int bit_depth, float gamma)
+ : _bit_depth (bit_depth)
+ , _gamma (gamma)
{
- int const bit_length = pow (2, bits);
+ _lut = new float[int(std::pow(2.0f, _bit_depth))];
+ int const bit_length = pow (2, _bit_depth);
for (int i = 0; i < bit_length; ++i) {
_lut[i] = pow(float(i) / (bit_length - 1), gamma);
}
diff --git a/src/gamma_lut.h b/src/gamma_lut.h
index 31615afd..3fefdfd2 100644
--- a/src/gamma_lut.h
+++ b/src/gamma_lut.h
@@ -20,16 +20,37 @@
#ifndef LIBDCP_GAMMA_LUT_H
#define LIBDCP_GAMMA_LUT_H
-#include "lut.h"
#include "lut_cache.h"
namespace dcp {
-class GammaLUT : public LUT
+class GammaLUT
{
public:
- GammaLUT (int bit_length, float gamma);
+ GammaLUT (int bit_depth, float gamma);
+
+ ~GammaLUT () {
+ delete[] _lut;
+ }
+
+ float const * lut () const {
+ return _lut;
+ }
+
+ int bit_depth () const {
+ return _bit_depth;
+ }
+
+ float gamma () const {
+ return _gamma;
+ }
+
static LUTCache<GammaLUT> cache;
+
+private:
+ float* _lut;
+ int _bit_depth;
+ float _gamma;
};
}
diff --git a/src/lut.h b/src/lut.h
deleted file mode 100644
index 154541a7..00000000
--- a/src/lut.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef LIBDCP_LUT_H
-#define LIBDCP_LUT_H
-
-#include <boost/utility.hpp>
-#include <cmath>
-
-namespace dcp {
-
-class LUT : boost::noncopyable
-{
-public:
- LUT(int bit_depth, float gamma)
- : _lut(0)
- , _bit_depth (bit_depth)
- , _gamma (gamma)
- {
- _lut = new float[int(std::pow(2.0f, _bit_depth))];
- }
-
- virtual ~LUT() {
- delete[] _lut;
- }
-
- float const * lut() const {
- return _lut;
- }
-
- int bit_depth () const {
- return _bit_depth;
- }
-
- float gamma () const {
- return _gamma;
- }
-
-protected:
- float* _lut;
- int _bit_depth;
- float _gamma;
-};
-
-}
-
-#endif
diff --git a/src/lut_cache.h b/src/lut_cache.h
index d1968579..e2287775 100644
--- a/src/lut_cache.h
+++ b/src/lut_cache.h
@@ -22,6 +22,7 @@
#include <list>
#include <boost/shared_ptr.hpp>
+#include <boost/noncopyable.hpp>
template<class T>
class LUTCache : public boost::noncopyable
diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc
index 9fa13d88..6c2609ee 100644
--- a/src/mono_picture_frame.cc
+++ b/src/mono_picture_frame.cc
@@ -24,9 +24,8 @@
#include "mono_picture_frame.h"
#include "exceptions.h"
#include "argb_frame.h"
-#include "lut.h"
-#include "util.h"
#include "gamma_lut.h"
+#include "util.h"
#include "rgb_xyz.h"
#include "KM_fileio.h"
#include "AS_DCP.h"
diff --git a/src/rgb_xyz.cc b/src/rgb_xyz.cc
index 9cf12e4c..92997441 100644
--- a/src/rgb_xyz.cc
+++ b/src/rgb_xyz.cc
@@ -40,8 +40,8 @@ using namespace dcp;
shared_ptr<ARGBFrame>
dcp::xyz_to_rgb (
boost::shared_ptr<const XYZFrame> xyz_frame,
- boost::shared_ptr<const LUT> lut_in,
- boost::shared_ptr<const LUT> lut_out
+ boost::shared_ptr<const GammaLUT> lut_in,
+ boost::shared_ptr<const GammaLUT> lut_out
)
{
int const max_colour = pow (2, lut_out->bit_depth()) - 1;
@@ -108,8 +108,8 @@ dcp::xyz_to_rgb (
shared_ptr<dcp::XYZFrame>
dcp::rgb_to_xyz (
boost::shared_ptr<const Image> rgb,
- boost::shared_ptr<const LUT> lut_in,
- boost::shared_ptr<const LUT> lut_out,
+ boost::shared_ptr<const GammaLUT> lut_in,
+ boost::shared_ptr<const GammaLUT> lut_out,
double const colour_matrix[3][3]
)
{
diff --git a/src/rgb_xyz.h b/src/rgb_xyz.h
index 6b0f1842..28e09230 100644
--- a/src/rgb_xyz.h
+++ b/src/rgb_xyz.h
@@ -23,15 +23,15 @@ namespace dcp {
class ARGBFrame;
class XYZFrame;
-class LUT;
+class GammaLUT;
class Image;
extern boost::shared_ptr<ARGBFrame> xyz_to_rgb (
- boost::shared_ptr<const XYZFrame>, boost::shared_ptr<const LUT>, boost::shared_ptr<const LUT>
+ boost::shared_ptr<const XYZFrame>, boost::shared_ptr<const GammaLUT>, boost::shared_ptr<const GammaLUT>
);
extern boost::shared_ptr<XYZFrame> rgb_to_xyz (
- boost::shared_ptr<const Image>, boost::shared_ptr<const LUT>, boost::shared_ptr<const LUT>, double const colour_matrix[3][3]
+ boost::shared_ptr<const Image>, boost::shared_ptr<const GammaLUT>, boost::shared_ptr<const GammaLUT>, double const colour_matrix[3][3]
);
}
diff --git a/src/stereo_picture_frame.cc b/src/stereo_picture_frame.cc
index f894281e..780ac362 100644
--- a/src/stereo_picture_frame.cc
+++ b/src/stereo_picture_frame.cc
@@ -20,7 +20,6 @@
#include "stereo_picture_frame.h"
#include "exceptions.h"
#include "argb_frame.h"
-#include "lut.h"
#include "util.h"
#include "gamma_lut.h"
#include "rgb_xyz.h"
diff --git a/src/wscript b/src/wscript
index 9ad37fc5..80cfecf1 100644
--- a/src/wscript
+++ b/src/wscript
@@ -75,7 +75,6 @@ def build(bld):
image.h
kdm.h
key.h
- lut.h
lut_cache.h
metadata.h
mono_picture_mxf.h