HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_FileFilterLUT.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: IMG_FileFilterLUT ( IMG Library, C++)
7  *
8  * COMMENTS:
9  *
10  * Applies a LUT and/or gamma to the scanlines.
11  */
12 #ifndef IMG_FILE_FILTER_LUT_H
13 #define IMG_FILE_FILTER_LUT_H
14 
15 #include <SYS/SYS_Types.h>
16 #include <UT/UT_BitArray.h>
17 #include <UT/UT_StringHolder.h>
18 #include <UT/UT_Array.h>
19 #include <UT/UT_UniquePtr.h>
20 #include <PXL/PXL_Fill.h>
21 #include <PXL/PXL_OCIO.h>
22 
23 #include "IMG_FileFilter.h"
24 #include "IMG_FileParms.h"
25 
26 class PXL_Raster;
27 class PXL_Lookup;
28 
30 {
31 public:
32  IMG_FileFilterLUT(IMG_File *file_to_filter);
33  ~IMG_FileFilterLUT() override;
34 
35  const char *className() const override { return "IMG_FileFilterLUT"; }
36 
37  void init(const IMG_FileParms &parms)
38  {
39  init(parms.lutFilename(),
40  parms.lutScope(),
41  parms.gamma(),
42  parms.gammaScope(),
43  parms.lutIsOCIO(),
44  parms.ocioDestSpace(),
45  parms.ocioLooks(),
46  parms.ocioView(),
47  parms.ocioForward(),
48  parms.ocioSourceDisplay(),
49  parms.ocioSourceView());
50  }
51  void init(const UT_StringHolder &lutname,
52  const UT_StringHolder &lut_scope,
53  fpreal gamma,
54  const UT_StringHolder &gamma_scope,
55  bool is_ocio,
56  const UT_StringHolder &ocio_colorspace,
57  const UT_StringHolder &ocio_looks,
58  const UT_StringHolder &ocio_view,
59  bool ocio_forward,
60  const UT_StringHolder &ocio_src_display,
61  const UT_StringHolder &ocio_src_view);
62 
63  const void *readPlaneScanline(int y, const IMG_Plane &pi) override;
64 
65  int writePlaneScanline(const void *data, int y,
66  const IMG_Plane &pi) override;
67 
68  void computeCommonData() override;
69 
70 private:
71  void applyGammaLUT(void *dest, const void *sdata,
72  const IMG_Plane &pi, bool dogamma, bool dolut);
73  void applyOCIO(int y,
74  void *dest,
75  const void *sdata,
76  const IMG_Plane &pi,
77  bool forward);
78  const PXL_OCIO::PHandle &ocioHandle(bool fwd) const
79  {
80  return fwd ? myOCIOHandleFwd : myOCIOHandleRev;
81  }
82  UT_UniquePtr<PXL_Lookup> myLookup;
83  UT_StringHolder myLUTScopeString;
84  UT_StringHolder myOCIOSource;
85  UT_StringHolder myOCIOSourceDisplay;
86  UT_StringHolder myOCIOSourceView;
87  UT_StringHolder myOCIODest;
88  UT_StringHolder myOCIOLooks;
89  UT_StringHolder myOCIOView;
90  PXL_OCIO::PHandle myOCIOHandleFwd;
91  PXL_OCIO::PHandle myOCIOHandleRev;
92  UT_BitArray myLUTScope;
93  bool myOCIOForward;
94  bool myIsOCIO;
95  bool myOCIONoOp;
96 
97  UT_StringHolder myGammaScopeString;
98  UT_BitArray myGammaScope;
99  fpreal myGamma;
100 
101  UT_Array<UT_UniquePtr<PXL_Raster>> myScanRaster;
102 
103  // We cache this so we can share the gamma table between
104  // invocations.
105  PXL_FillParms myFill;
106 };
107 
108 
109 #endif
const UT_StringHolder & ocioSourceView() const
const UT_StringHolder & ocioLooks() const
const UT_StringHolder & lutScope() const
fpreal gamma() const
const UT_StringHolder & ocioView() const
GLint y
Definition: glcorearb.h:103
Describes the format and layout of a single plane in an image The plane specifies the format and name...
Definition: IMG_Plane.h:48
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
#define IMG_API
Definition: IMG_API.h:10
const UT_StringHolder & ocioDestSpace() const
const UT_StringHolder & gammaScope() const
void computeCommonData() override
const UT_StringHolder & ocioSourceDisplay() const
const UT_StringHolder & lutFilename() const
fpreal64 fpreal
Definition: SYS_Types.h:277
void init(const IMG_FileParms &parms)
File options for manipulating image data on load or save. This class allows you to modify the incomin...
Definition: IMG_FileParms.h:38
bool ocioForward() const
bool lutIsOCIO() const
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: Math.h:119
const char * className() const override
Definition: format.h:895