AWS Thinkbox Discussion Forums

Draft 1.2.0 Beta 1 (revision #56290)

Draft 1.2 beta 1 has been released with the Deadline 7 beta.

[size=150]INSTALLATION INFORMATION[/size]
This version of Draft will not work with Deadline 6 or earlier. The installers for Deadline 7 include Draft 1.2.0 Beta 1, but you can also (re)install Draft from the attached .zip archives.

To update Draft, all you should need to do is extract the attached Draft .zip file into the root of your Deadline Repository. It will propagate to the slaves when needed. Expand Samples.zip and ocio-configs.zip into the unzipped Draft folder.

If you are using Draft 1.1 or earlier, you will need an updated Draft license.

[size=150]What’s New:[/size]

Compatability

  • Updated Windows builds for compatibility with Deadline 7’s installer (updated from VC90 to VC100 runtime library).
  • Updated Python compatability to 2.7.6.
  • Scripts written for previous versions of Draft should still work fine with Draft 1.2.

OpenColorIO

  • Use config.ocio and ColorSpaces / Roles to create OCIO color processors for color correcting images.
  • Create OCIO color processors directly from your favourite LUT files… see opencolorio.org/FAQ.html for the full list of LUT formats supported.

ASC CDL

  • A fully standard-compliant implementation of ASC CDL LUTs. (The clamping steps in OCIO’s ASC CDL implementation is not currently standard-compliant.)

Unicode

  • Draft now supports unicode filenames and text annotations!
  • Note: We need to modify the DraftParamParser.py library so that unicode strings aren’t mangled in the Deadline/Draft boundary, but once they’re in, Draft handles them properly.

Licensing Improvements

  • Draft Licences are now more flexible! Most Draft features require only that a license be present. Actual checkout of licenses now happens only while videos are being encoded or decoded.
  • “Lost connection to license server” no longer pops up dialog boxes on Windows.

[size=85]Draft_Deadline7_1_2_0_56290_beta1.zip - removed
(37.59 MiB) Downloaded 2 times[/size]
ocio-configs.zip (20.2 MB)
Samples.zip (77.1 KB)

[size=150]NEW in Draft 1.2.0 beta 1[/size]

[size=150]LUT Class[/size]

The following new methods have been added to Draft.LUT:

[size=150]Static Functions[/size]
CreateASCCDL
Type: Static
Description: Return a new linear-to-ASC-CDL LUT.
Arguments:
[list]slope – three float values greater than or equal to 0 indicating the slope correction for the R, G, B channels. For example: [1.2, 0, 3.4].
offset – three float values indicating the offset correction for the R, G, B channels. For example: [-0.6, 0.2, 0].
power – three float values strictly greater than 0 indicating the power correction for the R, G, B channels. For example: [1.1, 2, 3].
saturation – a float value greater than or equal to 0 indicating the saturation to apply. Defaults to 1.
Usage:

asccdlLUT = Draft.LUT.CreateASCCDL( [1.2, 0, 3.4], [-0.6, 0.2, 0], [1.1, 2, 3], 1 )

Note: Draft does not compute the inverse of an ASC CDL LUT, and so calling Inverse() on one will throw a runtime error.[/list:u]

SetOCIOConfig
Type: Static
Description: Initialize OCIO to use the config.ocio file specified by path. If no path is supplied, Draft checks the OCIO environment variable, then configurations distributed with Draft, and finally searches PATH for a directory containing a config.ocio file…
Arguments:
[list]path – path/to/config.ocio (optional)
Usage:

Draft.LUT.SetOCIOConfig( '//path/to/some/config.ocio' )
[/code][/list:u]

[b]ClearOCIOCaches[/b]
Type: Static
Description: Flush OCIO's cached contents of LUTs on disk, intermediate results, etc.
Arguments:  (none)
Usage:
[list][code]
Draft.LUT.ClearOCIOCaches()

Note: Calling this is normally not necessary.[/list:u]

CreateOCIOProcessor
Type: Static
Description: Return a new OCIO LUT for converting images from colorSpaceIn to colorSpaceOut. (Note: Can also use role alias names from config.ocio.)
Arguments:
[list]colorSpaceIn – the colorspace the input images will be in.
colorSpaceOut – the desired colorspace for the processed images.
Usage:

ocioLUT = Draft.LUT.CreateOCIOProcessor( 'linear', 'Cineon' ) [/list:u]

CreateOCIOProcessorFromFile
Type: Static
Description: Return a new OCIO LUT based on the specified file.
Arguments:
[list]filename – name of the LUT file (including the path, either absolute, or relative to the search paths in config.ocio)…
Usage:

ocioLUT = Draft.LUT.CreateOCIOProcessorFromFile( '//path/to/some/LUTfile.ext' )

Note: For a list of supported LUT file types, see: opencolorio.org/FAQ.html#what-lu … -supported.[/list:u]

A sample script that reads an ASC CDL from file (not using OCIO):

[code]# Sample script that applies an ASC CDL LUT to a bunch of frames, which are then encoded to a quicktime.

import Draft
import sys # To access commmand line arguments. Deadline sends script parameters as command line arguments.
from DraftParamParser import * # Functions to process command line arguments for Draft.

from CDLReader import * # ****** Functions to read ASC CDL from file and return a Draft.LUT

The argument name/types we’re expecting from the command line arguments or Deadline.

expectedTypes = dict()
expectedTypes[‘inFile’] = ‘’
expectedTypes[‘outFile’] = ‘’
expectedTypes[‘frameList’] = ‘’
#expectedTypes[‘asccdl’] = ‘’ # ****** uncomment this line if you want the asccdl parameter to be mandatory rather than optional

Parse the command line arguments.

params = ParseCommandLine( expectedTypes, sys.argv ) # params now contains a dictionary of the parameters initialized to values from the command line arguments.
inFilePattern = params[‘inFile’] # The pattern that the input files follow, for example frame_name_###.ext, where ### represents a three digit frame number.
frames = FrameRangeToFrames( params[‘frameList’] ) # Get a list of the individual frames we are to process

lut = GetASCCDLFromParams( params ) # ****** Get the ASC CDL, if a parameter named ‘asccdl’ is in the parameter list

Initialize the video encoder.

encoder = Draft.VideoEncoder( params[‘outFile’] )

Process each of the frames in the list of frames (including the first, which hasn’t yet been added to the encoder).

progressCounter = 0;
for currFrame in frames:
# Read in the frame.
currFile = ReplaceFilenameHashesWithNumber( inFilePattern, currFrame )
frame = Draft.Image.ReadFromFile( currFile )

if lut != None:
	lut.Apply( frame )	# ****** apply the ASC CDL LUT to the frame

# Add the frame to the encoder.
encoder.EncodeNextFrame( frame )

progressCounter = progressCounter + 1
progress = progressCounter * 100 / len( frames )
print( "Progress: %i%%" % progress )

Finalize and save the resulting video.

encoder.FinalizeEncoding()[/code]

The CDL reader library:[code]import Draft
import xml.etree.ElementTree as ET

def ReadASCCDL( filename, allowHardFail=True ):
‘’‘Read an xml-formatted ASC CDL file, extract the slope, offset, power and
saturation, and return a Draft ASC CDL LUT.
Parameters:
filename: name of the ASC CDL file.
allowHardFail (optional): whether to raise an exception (default), or
warn and continue, if there are any problems with the ASC CDL file.
Returns: a Draft.LUT object, or None
‘’’
asccdllut = None
try:
tree = ET.parse( filename )

	colorCorrectionNode = tree.find( 'ColorDecision' ).find( 'ColorCorrection' )
	SOPNode = colorCorrectionNode.find( 'SOPNode' )
	slope = SOPNode.find( 'Slope' ).text.split()
	offset = SOPNode.find( 'Offset' ).text.split()
	power = SOPNode.find( 'Power' ).text.split()
	saturation = colorCorrectionNode.find( 'SatNode' ).find( 'Saturation' ).text
	
	for i in range(0,3): 
		slope[i]=float(slope[i])
		offset[i]=float(offset[i])
		power[i]=float(power[i])
	
	saturation = float(saturation)
	
	asccdllut = Draft.LUT.CreateASCCDL(slope, offset, power, saturation)
except Exception as e:
	if allowHardFail:
		raise e
	else:
		print "WARNING:  unable to process requested ASC CDL file, continuing without one.  Error message: ", e

return asccdllut

def GetASCCDLFromParams( params, paramName=‘asccdl’, allowHardFail=True ):
‘’’ Check the parameter dictionary to see if an ASC CDL file has been
specified. If it has, attempt to read the file.
Parameters:
params: dictionary of parameters, one of which may contain the
filename of an ASC CDL LUT file.
paramName (optional): name of the parameter in params to look for,
defaults to ‘asccdl’.
allowHardFail (optional): whether to raise an exception (default), or
warn and continue, if there are any problems with the ASC CDL file.
Note: if the parameter is not in the dictionary, no exception is
raised.
Returns: a Draft.LUT object, or None
‘’’
asccdllut = None
if paramName in params:
asccdllut = ReadASCCDL( params[paramName], allowHardFail)
return asccdllut[/code]

I’ve attached both scripts for your ease of use.
basic_apply_cdl.zip (1.04 KB)
CDLReader.zip (940 Bytes)

Privacy | Site terms | Cookie preferences