Beispiel #1
0
 def setMatrix(self, dimensions, values, floatEncoding='string'):
     integers = bitDepthIsInteger(self.getAttribute('outBitDepth'))
     values = Array(dimensions,
                    values,
                    integers,
                    floatEncoding=floatEncoding)
     self._array = values
     self.addElement(values)
Beispiel #2
0
    def setArray(self, dimension, values, floatEncoding='string'):
        dimensions = dimension
        dimensions.append(3)

        integers = bitDepthIsInteger(self.getAttribute('outBitDepth'))

        self._array = Array(dimensions,
                            values,
                            integers,
                            floatEncoding=floatEncoding)
        self.addElement(self._array)
Beispiel #3
0
    def readChild(self, element):
        child = None
        if element.tag == 'Array':
            child = Array()
            child.read(element)

            integers = bitDepthIsInteger(self.getAttribute('outBitDepth'))
            child.setValuesAreIntegers(integers)

            self._array = child
        return child
Beispiel #4
0
    def setArray(self, dimension, values, floatEncoding='string'):
        dimensions = [len(values) / dimension, dimension]

        integers = bitDepthIsInteger(self.getAttribute('outBitDepth'))
        rawHalfs = not (self.getAttribute('rawHalfs') in [None, False])

        self._array = Array(dimensions,
                            values,
                            rawHalfs=rawHalfs,
                            integers=integers,
                            floatEncoding=floatEncoding)
        self.addElement(self._array)
Beispiel #5
0
    def readChild(self, element):
        child = None
        if element.tag == 'Array':
            child = Array()
            child.read(element)

            integers = bitDepthIsInteger(self.getAttribute('outBitDepth'))
            child.setValuesAreIntegers(integers)

            self._array = child
        elif element.tag == 'IndexMap':
            child = IndexMap()
            child.read(element)
            self._indexMaps.append(child)
        return child
Beispiel #6
0
    def _createCachedProcess(self):
        channels = 1
        resolution = 65536
        cacheValues = [0.0] * resolution

        for i in range(resolution):
            # Figure out which half value corresponds to the specific 16 bit integer value
            sample = uint16ToHalf(i)

            # Apply the function to the sample value
            # Should take the channel as input, or process an RGB triple
            fvalue = self._processRaw(sample)

            # Store the values
            for c in range(channels):
                cacheIndex = i * channels + c
                cacheValues[cacheIndex] = fvalue
                #print( "%d, %d, %d: %f -> %f" % (i, c, lutValueIndex, sample, fvalue))

        dimensions = [len(cacheValues), channels]
        self._processCached = Array(dimensions, cacheValues)