int blockSizeSearch (fileName, targetPSNR, startBlockSizeIdx)) |
01. | blockSizes[14] = { 4x4, 5x4, ..., 12x12 } |
02. | currentBlockSizeIdx= = startBlockSizeIdx |
03. | direction = 0 |
04. | do |
05. | execute astcenc with blockSizes[currentBlockSizeIdx] and fileName |
06. | obtain PSNR from astcenc |
07. | if (direction == 0) |
08. | direction = (PSNR≥targetPSNR)? 1:-1 |
09. | if (direction ==1) |
10. | if (PSNR<targetPSNR) |
11. | currentBlockSizeIdx -= 1 |
12. | break |
13. | if (currentBlockSizeIdx == 13) |
14. | break |
15. | if (direction == -1) |
16. | if (PSNR≥targetPSNR || currentBlockSizeIdx == 0) |
17. | break |
18. | currentBlockSizeIdx += direction |
19. | while (true) |
20. | return currentBlockSizeIdx |