+ /* TODO: where does this magic value come from ? */
+ /* This used to be 1.3 / 8, but with random data and very small code */
+ /* block sizes, this is not enough. For example with */
+ /* bin/test_tile_encoder 1 256 256 32 32 8 0 reversible_with_precinct.j2k 4 4 3 0 0 1 16 16 */
+ /* TODO revise this to take into account the overhead linked to the */
+ /* number of packets and number of code blocks in packets */
+ l_tile_size = (OPJ_UINT32)(l_tile_size * 1.4 / 8);
+
+ /* Arbitrary amount to make the following work: */
+ /* bin/test_tile_encoder 1 256 256 17 16 8 0 reversible_no_precinct.j2k 4 4 3 0 0 1 */
+ l_tile_size += 500;