def _validate_codeblock_size(self, cparams):
if cparams.cblockw_init != <NUM_LIT:0> and cparams.cblockh_init != <NUM_LIT:0>:<EOL><INDENT>width = cparams.cblockw_init<EOL>height = cparams.cblockh_init<EOL>if height * width > <NUM_LIT> or height < <NUM_LIT:4> or width < <NUM_LIT:4>:<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>msg = msg.format(height=height, width=width,<EOL>area=height * width)<EOL>raise IOError(msg)<EOL><DEDENT>if ((math.log(height, <NUM_LIT:2>) != math.floor(math.log(height, <NUM_LIT:2>)) or<EOL>math.log(width, <NUM_LIT:2>) != math.floor(math.log(width, <NUM_LIT:2>)))):<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>msg = msg.format(height=height, width=width)<EOL>raise IOError(msg)<EOL><DEDENT><DEDENT>
Code block dimensions must satisfy certain restrictions.

They must both be a power of 2 and the total area defined by the width
and height cannot be either too great or too small for the codec.