Ejemplo n.º 1
0
    def test_export_3dl(self):
        """ Test 3dl export

        """
        outlutfile = os.path.join(self.tmp_dir, "CineonToLin_export.3dl")
        lut_to_lut(self.lut1d, "3D", "3dl", outlutfile)
        # test wrong float range
        self.failUnlessRaises(PresetException,
                              lut_to_lut,
                              self.lut3d,
                              "3D",
                              "3dl",
                              outlutfile,
                              input_range=[0.0, 1.0])
        # test wrong type
        self.failUnlessRaises(ThreeDLHelperException,
                              lut_to_lut,
                              self.lut3d,
                              "2D",
                              "3dl",
                              outlutfile,
                              input_range=[0.0, 1.0])

        # test wrong extension
        self.failUnlessRaises(LUTException,
                              lut_to_lut,
                              self.lut3d,
                              "3D",
                              "csp",
                              outlutfile,
                              input_range=[0.0, 1.0])
Ejemplo n.º 2
0
    def test_export_cc_json(self):
        """ Test cc / json export

        """
        for form, ext, excep in [('json', '.json', JsonHelperException),
                                 ('clcc', '.cc', CLCCHelperException)]:
            outlutfile = os.path.join(self.tmp_dir, "CineonToLin_export" + ext)
            lut_to_lut(self.lut1d, "3D", form, outlutfile)
            # test wrong type
            self.failUnlessRaises(excep, lut_to_lut, self.lut3d, "2D", form,
                                  outlutfile)
Ejemplo n.º 3
0
    def test_export_cc_json(self):
        """ Test cc / json export

        """
        for form, ext, excep in [('json', '.json', JsonHelperException),
                                 ('clcc', '.cc', CLCCHelperException)]:
            outlutfile = os.path.join(self.tmp_dir, "CineonToLin_export" + ext)
            lut_to_lut(self.lut1d, "3D", form, outlutfile)
            # test wrong type
            self.failUnlessRaises(excep, lut_to_lut, self.lut3d,
                                  "2D", form, outlutfile)
Ejemplo n.º 4
0
    def test_convert_from_preset(self):
        """Read a preset file and write a LUT

        """
        preset = presets.read_preset(self.sample_preset)
        outlutfile = os.path.join(self.tmp_dir, 'test_preset.cube')
        lut_to_lut(self.lut3d, preset=preset, outlutfile=outlutfile)
        proc = create_ocio_processor(outlutfile, interpolation=INTERP_LINEAR)
        proc.applyRGB([0, 0, 0])
        proc.applyRGB([1, 1, 1])
        if DISPLAY:
            import plot_that_lut
            plot_that_lut.plot_that_lut(outlutfile)
Ejemplo n.º 5
0
    def test_export_ascii(self):
        """ Test ascii export

        """
        outlutfile = os.path.join(self.tmp_dir, "CineonToLin_export.lut")
        # test 1D/2D export
        lut_to_lut(self.lut1d, "1D", "lut", outlutfile)
        lut_to_lut(self.lut1d, "2D", "lut", outlutfile)
        # test wrong type
        self.failUnlessRaises(AsciiHelperException, lut_to_lut, self.lut3d,
                              "3D", "lut", outlutfile)
        # test wrong out bit depth
        # (default output range is [0, 1023], out bit depth must be 10
        self.failUnlessRaises(AsciiHelperException, lut_to_lut, self.lut1d,
                              "1D", "lut", outlutfile, out_bit_depth=12)
Ejemplo n.º 6
0
    def test_export_3dl(self):
        """ Test 3dl export

        """
        outlutfile = os.path.join(self.tmp_dir, "CineonToLin_export.3dl")
        lut_to_lut(self.lut1d, "3D", "3dl", outlutfile)
        # test wrong float range
        self.failUnlessRaises(PresetException, lut_to_lut, self.lut3d,
                              "3D", "3dl", outlutfile, input_range=[0.0, 1.0])
        # test wrong type
        self.failUnlessRaises(ThreeDLHelperException, lut_to_lut, self.lut3d,
                              "2D", "3dl", outlutfile, input_range=[0.0, 1.0])

        # test wrong extension
        self.failUnlessRaises(LUTException, lut_to_lut, self.lut3d,
                              "3D", "csp", outlutfile, input_range=[0.0, 1.0])
Ejemplo n.º 7
0
    def test_export_csp_cube(self):
        """ Test CSP / Cube export

        """
        for form in ['csp', 'cube']:
            # test 1D/2D export
            outlutfile = os.path.join(self.tmp_dir,
                                      "CineonToLin_export." + form)
            lut_to_lut(self.lut3d, "1D", form, outlutfile, smooth_size=15)
            # test 3D export
            outlutfile = os.path.join(self.tmp_dir,
                                      "saturation_export." + form)
            lut_to_lut(self.lut3d, "3D", form, outlutfile)
            # test wrong int range
            self.failUnlessRaises(PresetException, lut_to_lut, self.lut3d,
                                  "3D", form, outlutfile,
                                  output_range=[0, 1024])
Ejemplo n.º 8
0
    def test_export_ascii(self):
        """ Test ascii export

        """
        outlutfile = os.path.join(self.tmp_dir, "CineonToLin_export.lut")
        # test 1D/2D export
        lut_to_lut(self.lut1d, "1D", "lut", outlutfile)
        lut_to_lut(self.lut1d, "2D", "lut", outlutfile)
        # test wrong type
        self.failUnlessRaises(AsciiHelperException, lut_to_lut, self.lut3d,
                              "3D", "lut", outlutfile)
        # test wrong out bit depth
        # (default output range is [0, 1023], out bit depth must be 10
        self.failUnlessRaises(AsciiHelperException,
                              lut_to_lut,
                              self.lut1d,
                              "1D",
                              "lut",
                              outlutfile,
                              out_bit_depth=12)
Ejemplo n.º 9
0
    def test_export_csp_cube(self):
        """ Test CSP / Cube export

        """
        for form in ['csp', 'cube']:
            # test 1D/2D export
            outlutfile = os.path.join(self.tmp_dir,
                                      "CineonToLin_export." + form)
            lut_to_lut(self.lut3d, "1D", form, outlutfile, smooth_size=15)
            # test 3D export
            outlutfile = os.path.join(self.tmp_dir,
                                      "saturation_export." + form)
            lut_to_lut(self.lut3d, "3D", form, outlutfile)
            # test wrong int range
            self.failUnlessRaises(PresetException,
                                  lut_to_lut,
                                  self.lut3d,
                                  "3D",
                                  form,
                                  outlutfile,
                                  output_range=[0, 1024])
Ejemplo n.º 10
0
    def test_concatenate_luts(self):
        """ Test concatenation

        """
        # contact in a 2D LUT
        lut_to_lut([self.lut1d, self.lut3d], "2D", "lut", self.tmp_dir)
        # concat in a 3D LUT
        outlutfile = os.path.join(self.tmp_dir, "concat.csp")
        lut_to_lut([self.lut3d, self.lut3d, self.lut1d], "3D", "csp",
                   outlutfile)
        lut_to_lut(outlutfile, "2D", "lut", self.tmp_dir)
Ejemplo n.º 11
0
    def test_concatenate_luts(self):
        """ Test concatenation

        """
        # contact in a 2D LUT
        lut_to_lut([self.lut1d, self.lut3d], "2D", "lut", self.tmp_dir)
        # concat in a 3D LUT
        outlutfile = os.path.join(self.tmp_dir, "concat.csp")
        lut_to_lut([self.lut3d, self.lut3d, self.lut1d],
                   "3D", "csp", outlutfile)
        lut_to_lut(outlutfile, "2D", "lut", self.tmp_dir)
Ejemplo n.º 12
0
    def test_export_spi(self):
        """ Test spi export

        """
        outlutfile = os.path.join(self.tmp_dir, "CineonToLin_export.spi1d")
        # test 1D/2D export
        lut_to_lut(self.lut1d, "1D", "spi", outlutfile, inverse=True)
        lut_to_lut(self.lut1d, "2D", "spi", outlutfile)
        # test wrong int range
        self.failUnlessRaises(PresetException, lut_to_lut, self.lut1d,
                              "1D", "spi", outlutfile, output_range=[0, 1024])
        # test 3D export with wrong ext
        self.failUnlessRaises(LUTException, lut_to_lut, self.lut3d, "3D",
                              "spi", outlutfile)
        # test 3D export
        outlutfile = os.path.join(self.tmp_dir, "saturation_export.spi3d")
        lut_to_lut(self.lut3d, "3D", "spi", outlutfile)
Ejemplo n.º 13
0
    def test_export_spi(self):
        """ Test spi export

        """
        outlutfile = os.path.join(self.tmp_dir, "CineonToLin_export.spi1d")
        # test 1D/2D export
        lut_to_lut(self.lut1d, "1D", "spi", outlutfile, inverse=True)
        lut_to_lut(self.lut1d, "2D", "spi", outlutfile)
        # test wrong int range
        self.failUnlessRaises(PresetException,
                              lut_to_lut,
                              self.lut1d,
                              "1D",
                              "spi",
                              outlutfile,
                              output_range=[0, 1024])
        # test 3D export with wrong ext
        self.failUnlessRaises(LUTException, lut_to_lut, self.lut3d, "3D",
                              "spi", outlutfile)
        # test 3D export
        outlutfile = os.path.join(self.tmp_dir, "saturation_export.spi3d")
        lut_to_lut(self.lut3d, "3D", "spi", outlutfile)