# ====================================================================================
#
#   ICOptions.txt
#
#   Note this file is hierarchical.  Options defined later in the file (or other files) 
#   override earlier settings.
#   There are a limited set of positive conditinals that can be used in if/endif pairs.
#   Any undefined conditional will evaluate to 0, and the block will be skipped.
#
# ====================================================================================


# ====================================================================================
#
# logging and debug options

# -------------------
# debug

# in a debug/profile build, break on asserts in the debugger
breakOnAsserts 1

if qProfile
	breakOnAsserts 0
endif

# in a debug/profile build, break on cr_loge in the debugger
breakOnLogs 0

# -------------------
# debug HUD

# output debug text to stdout, uses showDebugTextFilter for now
dumpDebugText 0

# show debug text to the screen in a hud
showDebugText 1

# this is an ordered list of the hud items to display
showDebugTextFilter "123456789FABCDE"

# -------------------
# logging

# show the options as they load (set to 1 here)
showLoadingOptions 0

# cleanup NSLog output (no timesteamp or process), just string
cleanNSLog 0

# in a debug build, print asserts (deprecated for imagecore)
printAsserts   1

# display running thread names to see where tasks are running
printTasks 0

# display verbose data about XMP metadata
verboseXMP   0

# turn on all imagecore logging output
verboseImagecore 1

# display the stages before and as they are run
printStages  0

# display the stage/bottleneck timings (detailed)
printTimings  0

# print large image buffer allocations for rendering as they occur
printImageBufferAllocs 0

# display the overall timers 
showTimers    0

# show prof output to the screen
doProfReport  0

# profile the rendering in CPU view
profileRender    0


# ====================================================================================
#
# optimaization options

# turn on SIMD optimizations
useVector      1

# ====================================================================================
#
# local corrections options


# Override the default cr_sdk_config before cr_sdk is initialized.
# Turn on to set the cr_sdk_config variable fUseLocalCorrectionsCache to false.
# Disables the local corrections cache entirely (to avoid memory footprint issues
# with lots of brush strokes).
disableLocalCorrectionsCache    0

# ====================================================================================
#
# general threading options

# limit thread count, 0 for default max numProcessors
limitThreads 0

# use 1 thread only or limitThreads
oneThread 0

# whether to use hyperthreading to determine thread count, HT shares 1 SIMD unit
hyperThread 0


# ====================================================================================
#
# JPEG options

# whether to use a thread pool on Jpeg/ACE
threadPool 1

# view the tasks running on the Jpeg/ACE thread pool
jpegViewTasks 0

# whether to use the passed tile thread (1) or the thread pool (0)
jpegUseTiledThread 1

# whether to use SIMD
jpegUseSIMD 1

# turn on fast jpeg read path
fastRead     1

# jpeg read/wrte buffer sizes (in KB)
jpegReadBufferSize  256
jpegWriteBufferSize 64

# whether to use Fiala-style clipping (smaller)
jpegUseClipping 1


# ====================================================================================
#
# VM options

# set the percent of memory to flush down to when we need to allocate a new tile
scratchVMLimitPercent        100

# set the percent of memory to flush down to when we're low on memory
scratchVMLimitPercentForced    30

# set the percentage of physical memory to use
percentMemory 50

# set the percentage to start purging tiles
percentLowMemory 90 

# limit max memory used for vm cache/block pool (in MB)
maxMemory    512

# vm tile size (in bytes), 0 for default >256K (266112), <256 (261888), =256(262144)
tileSize     262144

# specify a fixed block size (vm)
fixedBlockSizeX 0
fixedBlockSizeY 0


# ====================================================================================
#
# render options

# -------------------
# ACR pipe

# specify a fixed block size (pipe) 
pipeBlockSizeX  256
pipeBlockSizeY  256

# pipe buffer bytes (in KB), default 256K, one per processor
pipeBufferBytes 256

# pipe buffer multiplier, overrides existing tile size in most renders, multiplied 
# by render scale, 0 disables, default 384
pipeBufferMultiplier 384

# -------------------
# Imagecore CPU render 

# this is the level of the preview render (-1 for off, for pixel doubling set to 1)
renderPreviewLevel    2

# this is the level of the draft render (-1 for off, for pixel doubling set to 0)
renderDraftLevel      1

# this is the level of the final render (-1 for off)
renderFinalLevel      0

# Target framerate for Preview render displays in the CPU View, 
# for example during slider adjustments. When the framerate 
# exceeds 4x this value an automatic Preview resolution increase 
# will occur if the qImagecoreCPUViewAutoPreviewResolutionIncrease 
# compile time flag was enabled in the build.
#
# NOTE: There is currently no guarantee that after increasing 
#       the Preview resolution the framerate will remain above 
#       the requested minimum.

targetCPUViewMinimumPreviewFramerate 15

# -------------------
# proxy DNG options

# limited by device GPUs, was 2304
proxyDNGSize 2048

# 0 means use proxyDNGSize^2
proxyDNGCount 0

if qImagecoreObsolete

	# Used in ic_import only.

	# The threshold is used to avoid generating proxies when they wouldn't save enough 
	# relative to the original.  A threshold of zero represents no threshold.
	proxyDNGJPEGThreshold 0
	proxyDNGNonJPEGThreshold 0

endif

# -------------------
# Current process version and set it to the desired process version.

currentProcessVersion 2012

if qPSX
    currentProcessVersion 2013
endif

# -------------------
# lens and camera profile options

# Enable or disable lens profile use in parameter used with ICImageView renders for 
# debugging or testing purposes.  If enabling, it will use whatever is set in the 
# apiLensProfileEnable parameter for render.  If disabling, it will override that 
# parameter to 0.
# Shipping builds should always set enableLensProfiles to 1.

enableLensProfiles 1

# Enable use of camera profile in parameter used with ICImageView renders for debugging 
# or testing purposes.  If disabling, the default camera profile for the negative will 
# be used since it's not possible to completely disable use. Note that the default may 
# vary depending on what profiles are available on the device.
# Shipping builds should always set it to 1.

enableCameraProfiles 1

# -------------------
# gpu

# turn on gpu view
gpuView 1

# flags to control gpu compute
# 0 = kComputeRequest_Disable,
# 1 = kComputeRequest_Automatic,
# 2 = kComputeRequest_EnableIfPossible

gpuCompute 0

# -------------------
# Color space to render for display
# Only supported with gpuView 0
# 0 = sRGB
# 1 = DisplayP3
# 2 = Automatic, either sRGB or DisplayP3, based on the device.

displayRenderColorSpace 2

# Support a low-resolution cpu-based tile render to help
# display a higher (if not highest) quality version of an image faster. 
# 0 for false. 1 for true.
# Default value is 1.
#allowDualReferenceImageLevels 1

# Optionally set GPU screen preview size by specifying the "minimum long side".
# This value should be a power of 2 (e.g., 512, 1024, ...) and will be IGNORED if it isn't.
#previewMinLongSidePixelsGPU 512

# Optionally set Host (CPU) screen preview size by specifying the "minimum long side".
# This value should be a power of 2 (e.g., 512, 1024, ...) and will be IGNORED if it isn't.
#previewMinLongSidePixelsHost 256

# GPU 2
# Optionally specify maximum tile side for GPU pyramid
# Larger value will make updates slower on screen while doing interactive editing
# Smaller values will increase the overhead for managing tiles for visibility, version update etc.
# This value should be a power of 2 (e.g., 512, 1024, ...) and will be IGNORED if it isn't.

# maxTileSideGPUPyramid 512

# Number of pyramid levels to add to fast quality level of GPU 2 display when two quality levels
# (best and fast) are in use.  The sum will be capped by the maximum pyramid level allowed.
addPyramidLevelsToFastQuality 0

# -------------------
# Bit depth per channel or component to render for display
# Use 8-, 16-bit 32-bit only.
# 0 makes it dependent on the color space.
# This option value is checked in ic_init, but not applied by the imagecore lib.
# The ic_test app uses this option to configure tests of specific render bit-depths.
# All ic_render ("CPU View")" are 8-bit unless using DisplayP3, which are 16-bit.
displayRenderBitDepth 0

# Skips alpha channel (RGB vs RGBX) when creating an image-buffer to display on screen.
# Currently only suppored using displayRenderBitDepth 16 or 32 and gpuView 0
displayRenderNoAlpha 0

# ====================================================================================
#
# resource options

# Scan application's bundle directory for camera or lens profiles
# Turn this on if application is deploying profiles in the bundle
# directory so that CameraRaw will scan and cache profile data.
addAppDirForProfiles 0


# ====================================================================================
#
# optimaization test options - these should be moved to ICOptions_Test once the test is
# removed from imagecore initialization for non-shipping builds.

# test the SIMD layer, can run this on SSE/Neon platforms
testSIMD       0

# generate the tests for the SIMD layer, paste into glue layer
testSIMDGenerate       0

# ====================================================================================
#
# platform override options (qiPhone, qiPhoneSimulator, qMacOS)
#   see default above for descriptions of vars

if qiPhone
	percentMemory 20
	maxMemory     512
endif

if qAndroid
	percentMemory 20
	maxMemory     512
endif

if qMacOS
	percentMemory 30
	maxMemory     2560
endif

if qWinOS
	
	if q64Bit
	percentMemory 30
	maxMemory     2560
	endif
	
	if !q64Bit
	percentMemory 30
	maxMemory     512
	endif
	
endif

if qLinux
	addAppDirForProfiles 1

	percentMemory 30
	maxMemory     2560
endif

# this works well with winphones with 1GB or 2GB RAM when we have set the App as higher memory limit typed.
# see http://msdn.microsoft.com/en-US/library/windowsphone/develop/jj681682(v=vs.105).aspx
#if we need to support 512MB phones, then this might cause out-of-memory while opening larger images
# we can however reduce the memory for such devices, if needed
if qWinPhone
	percentMemory 20
	maxMemory     512 
endif


if qiPhone
	# device options (start with d)
    if diPad
        if diPad1
            
        endif
        if !diPad1
            
        endif
    endif

    if diPhone
        if diPhone4

        endif

    endif

    if diPod
        if diPod4

        endif

    endif

endif

# -------------------
# force the simulator to emulate a given platform
if qiPhoneSimulator
	
	if diPad3
		limitThreads		2
		maxMemory			204
	endif
	
	if diPad2
		limitThreads		2
		maxMemory			102
	endif

	if diPhone3
		oneThread			1
		maxMemory		    51
	endif
	
	if diPhone4
		limitThreads		2
		maxMemory			102
	endif
	
endif

# -------------------
# force the simulator to emulate a given platform
#  only has 1 actual thread, max of 880MB memory
#  max out the memory to run faster
if qAndroidSimulator
	maxMemory			512
    percentMemory       50
endif

# -------------------
# can override settings for the ship build 
if qShip
   
endif

# can override settings for the profile build
if qTest
    # can do negation of conditionals (effectively an else block)
    if !qiPhoneSimulator

    endif

endif

# -------------------

# test out ACR settings vs. IC on iOS
# ACR
# vm
if 0
    tileSize            266112
    fixedBlockSizeX         0   # will determine based on width/height of image and tileSize cutoff
    fixedBlockSizeY         0
endif

# render
if 0
    pipeBufferBytes         0     # will use 400
    pipeBlockSizeX          0     # will use 512
    pipeBlockSizeY          0
    pipeBufferMultiplier    384
endif

# IC
#vm
if 1
    # vm - 20x block size
    tileSize			 1314720  # +4K of slop, 5 channel max
    fixedBlockSizeX         256
    fixedBlockSizeY         256
endif

# render
if 1
    # overide defaults, speeds up renders and loads by 39MP (40s -> 25s), 18MP (19s -> 10s)
    # render - allow denoise to run with tile of 256x256 @5000 (34s) or 128x128 @3000 (60s) for 18MP image
    #  denoise runs much faster with 6000, wichita w/o denoise uses 2200
    pipeBufferBytes         6000  
    pipeBlockSizeX          256
    pipeBlockSizeY          256
    pipeBufferMultiplier    0

endif

# ====================================================================================


