func computeLgBlock(params *encoderParams) int {
	var lgblock int = params.lgblock
	if params.quality == fastOnePassCompressionQuality || params.quality == fastTwoPassCompressionQuality {
		lgblock = int(params.lgwin)
	} else if params.quality < minQualityForBlockSplit {
		lgblock = 14
	} else if lgblock == 0 {
		lgblock = 16
		if params.quality >= 9 && params.lgwin > uint(lgblock) {
			lgblock = brotli_min_int(18, int(params.lgwin))
		}
	} else {
		lgblock = brotli_min_int(maxInputBlockBits, brotli_max_int(minInputBlockBits, lgblock))
	}
	return lgblock
}
/* Returns optimized lg_block value.
package brotli
const fastOnePassCompressionQuality = 0
const fastTwoPassCompressionQuality = 1
const zopflificationQuality = 10
const hqZopflificationQuality = 11
const maxQualityForStaticEntropyCodes = 2
const minQualityForBlockSplit = 4
const minQualityForNonzeroDistanceParams = 4
const minQualityForOptimizeHistograms = 4
const minQualityForExtensiveReferenceSearch = 5
const minQualityForContextModeling = 5
const minQualityForHqContextModeling = 7
const minQualityForHqBlockSplitting = 10
const maxNumDelayedSymbols = 0x2FFF
func maxHashTableSize(quality int) uint {
	if quality == fastOnePassCompressionQuality {
		return 1 << 15
	} else {
		return 1 << 17
	}
}
const maxZopfliLenQuality10 = 150
const maxZopfliLenQuality11 = 325
const longCopyQuickStep = 16384
func maxZopfliLen(params *encoderParams) uint {
	if params.quality <= 10 {
		return maxZopfliLenQuality10
	} else {
		return maxZopfliLenQuality11
	}
}
func maxZopfliCandidates(params *encoderParams) uint {
	if params.quality <= 10 {
		return 1
	} else {
		return 5
	}
}
func sanitizeParams(params *encoderParams) {
	params.quality = brotli_min_int(maxQuality, brotli_max_int(minQuality, params.quality))
	if params.quality <= maxQualityForStaticEntropyCodes {
		params.large_window = false
	}
	if params.lgwin < minWindowBits {
		params.lgwin = minWindowBits
	} else {
		var max_lgwin int
		if params.large_window {
			max_lgwin = largeMaxWindowBits
		} else {
			max_lgwin = maxWindowBits
		}
		if params.lgwin > uint(max_lgwin) {
			params.lgwin = uint(max_lgwin)
		}
	}
}