bittests.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. #2!/usr/bin/python
  2. import yatest.common
  3. import hashlib
  4. import shutil
  5. import re
  6. import glob
  7. import os
  8. # Based heavily on Makefile.am from upstream
  9. # Helper routines
  10. _TJ_ROOT = "contrib/libs/libjpeg-turbo/"
  11. _TESTIMAGES_ROOT = "contrib/libs/libjpeg-turbo/testimages/"
  12. _TESTIMAGES_RE = re.compile(r'^\$\(srcdir\)/testimages/(.*)$')
  13. _TESTORIG = "testorig.jpg"
  14. def cp_testimage(name, newname):
  15. shutil.copyfile(yatest.common.source_path(_TESTIMAGES_ROOT + name), newname)
  16. def run(command):
  17. command = command.split()
  18. ut = ""
  19. command[0] = yatest.common.binary_path(_TJ_ROOT + ut + command[0] + "/" + command[0])
  20. for i in range(1, len(command)):
  21. m = _TESTIMAGES_RE.match(command[i])
  22. if m:
  23. name = m.group(1)
  24. if name == "$(TESTORIG)":
  25. name = _TESTORIG
  26. command[i] = yatest.common.source_path(_TESTIMAGES_ROOT + name)
  27. yatest.common.execute(command)
  28. def md5cmp(hexdigest, filename):
  29. with open(filename, 'rb') as f:
  30. assert(hexdigest == hashlib.md5(f.read()).hexdigest())
  31. def rm_f(patterns):
  32. for pattern in patterns.split():
  33. for fn in glob.glob(pattern):
  34. if "/" in fn:
  35. raise Exception("/ seems supsicious in a file name to remove")
  36. os.unlink(fn)
  37. # Makefile.am mimic
  38. MD5_JPEG_RGB_ISLOW = "768e970dd57b340ff1b83c9d3d47c77b"
  39. MD5_PPM_RGB_ISLOW = "00a257f5393fef8821f2b88ac7421291"
  40. MD5_BMP_RGB_ISLOW_565 = "f07d2e75073e4bb10f6c6f4d36e2e3be"
  41. MD5_BMP_RGB_ISLOW_565D = "4cfa0928ef3e6bb626d7728c924cfda4"
  42. MD5_JPEG_422_IFAST_OPT = "2540287b79d913f91665e660303ab2c8"
  43. MD5_PPM_422_IFAST = "35bd6b3f833bad23de82acea847129fa"
  44. MD5_PPM_422M_IFAST = "8dbc65323d62cca7c91ba02dd1cfa81d"
  45. MD5_BMP_422M_IFAST_565 = "3294bd4d9a1f2b3d08ea6020d0db7065"
  46. MD5_BMP_422M_IFAST_565D = "da98c9c7b6039511be4a79a878a9abc1"
  47. MD5_JPEG_420_IFAST_Q100_PROG = "990cbe0329c882420a2094da7e5adade"
  48. MD5_PPM_420_Q100_IFAST = "5a732542015c278ff43635e473a8a294"
  49. MD5_PPM_420M_Q100_IFAST = "ff692ee9323a3b424894862557c092f1"
  50. MD5_JPEG_GRAY_ISLOW = "72b51f894b8f4a10b3ee3066770aa38d"
  51. MD5_PPM_GRAY_ISLOW = "8d3596c56eace32f205deccc229aa5ed"
  52. MD5_PPM_GRAY_ISLOW_RGB = "116424ac07b79e5e801f00508eab48ec"
  53. MD5_BMP_GRAY_ISLOW_565 = "12f78118e56a2f48b966f792fedf23cc"
  54. MD5_BMP_GRAY_ISLOW_565D = "bdbbd616441a24354c98553df5dc82db"
  55. MD5_JPEG_420S_IFAST_OPT = "388708217ac46273ca33086b22827ed8"
  56. # See README.md for more details on why this next bit is necessary.
  57. MD5_JPEG_3x2_FLOAT_PROG_SSE = "343e3f8caf8af5986ebaf0bdc13b5c71"
  58. MD5_PPM_3x2_FLOAT_SSE = "1a75f36e5904d6fc3a85a43da9ad89bb"
  59. MD5_JPEG_3x2_FLOAT_PROG_32BIT = "9bca803d2042bd1eb03819e2bf92b3e5"
  60. MD5_PPM_3x2_FLOAT_32BIT = "f6bfab038438ed8f5522fbd33595dcdc"
  61. MD5_PPM_3x2_FLOAT_64BIT = "0e917a34193ef976b679a6b069b1be26"
  62. MD5_JPEG_3x2_IFAST_PROG = "1ee5d2c1a77f2da495f993c8c7cceca5"
  63. MD5_PPM_3x2_IFAST = "fd283664b3b49127984af0a7f118fccd"
  64. MD5_JPEG_420_ISLOW_ARI = "e986fb0a637a8d833d96e8a6d6d84ea1"
  65. MD5_JPEG_444_ISLOW_PROGARI = "0a8f1c8f66e113c3cf635df0a475a617"
  66. MD5_PPM_420M_IFAST_ARI = "72b59a99bcf1de24c5b27d151bde2437"
  67. MD5_JPEG_420_ISLOW = "9a68f56bc76e466aa7e52f415d0f4a5f"
  68. MD5_PPM_420M_ISLOW_2_1 = "9f9de8c0612f8d06869b960b05abf9c9"
  69. MD5_PPM_420M_ISLOW_15_8 = "b6875bc070720b899566cc06459b63b7"
  70. MD5_PPM_420M_ISLOW_13_8 = "bc3452573c8152f6ae552939ee19f82f"
  71. MD5_PPM_420M_ISLOW_11_8 = "d8cc73c0aaacd4556569b59437ba00a5"
  72. MD5_PPM_420M_ISLOW_9_8 = "d25e61bc7eac0002f5b393aa223747b6"
  73. MD5_PPM_420M_ISLOW_7_8 = "ddb564b7c74a09494016d6cd7502a946"
  74. MD5_PPM_420M_ISLOW_3_4 = "8ed8e68808c3fbc4ea764fc9d2968646"
  75. MD5_PPM_420M_ISLOW_5_8 = "a3363274999da2366a024efae6d16c9b"
  76. MD5_PPM_420M_ISLOW_1_2 = "e692a315cea26b988c8e8b29a5dbcd81"
  77. MD5_PPM_420M_ISLOW_3_8 = "79eca9175652ced755155c90e785a996"
  78. MD5_PPM_420M_ISLOW_1_4 = "79cd778f8bf1a117690052cacdd54eca"
  79. MD5_PPM_420M_ISLOW_1_8 = "391b3d4aca640c8567d6f8745eb2142f"
  80. MD5_BMP_420_ISLOW_256 = "4980185e3776e89bd931736e1cddeee6"
  81. MD5_BMP_420_ISLOW_565 = "bf9d13e16c4923b92e1faa604d7922cb"
  82. MD5_BMP_420_ISLOW_565D = "6bde71526acc44bcff76f696df8638d2"
  83. MD5_BMP_420M_ISLOW_565 = "8dc0185245353cfa32ad97027342216f"
  84. MD5_BMP_420M_ISLOW_565D = "ce034037d212bc403330df6f915c161b"
  85. MD5_PPM_420_ISLOW_SKIP15_31 = "c4c65c1e43d7275cd50328a61e6534f0"
  86. MD5_PPM_420_ISLOW_ARI_SKIP16_139 = "087c6b123db16ac00cb88c5b590bb74a"
  87. MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = "26eb36ccc7d1f0cb80cdabb0ac8b5d99"
  88. MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 = "886c6775af22370257122f8b16207e6d"
  89. MD5_PPM_444_ISLOW_SKIP1_6 = "5606f86874cf26b8fcee1117a0a436a6"
  90. MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = "db87dc7ce26bcdc7a6b56239ce2b9d6c"
  91. MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 = "cb57b32bd6d03e35432362f7bf184b6d"
  92. MD5_JPEG_CROP = "b4197f377e621c4e9b1d20471432610d"
  93. def test_bittest():
  94. # These tests are carefully crafted to provide full coverage of as many of the
  95. # underlying algorithms as possible (including all of the SIMD-accelerated
  96. # ones.)
  97. # CC: null SAMP: fullsize FDCT: islow ENT: huff
  98. run("cjpeg -rgb -dct int -outfile testout_rgb_islow.jpg $(srcdir)/testimages/testorig.ppm")
  99. md5cmp(MD5_JPEG_RGB_ISLOW, "testout_rgb_islow.jpg")
  100. # CC: null SAMP: fullsize IDCT: islow ENT: huff
  101. run("djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg")
  102. md5cmp(MD5_PPM_RGB_ISLOW, "testout_rgb_islow.ppm")
  103. rm_f("testout_rgb_islow.ppm")
  104. #if WITH_12BIT
  105. # rm_f("testout_rgb_islow.jpg")
  106. #else
  107. # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff
  108. run("djpeg -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg")
  109. md5cmp(MD5_BMP_RGB_ISLOW_565, "testout_rgb_islow_565.bmp")
  110. rm_f("testout_rgb_islow_565.bmp")
  111. # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
  112. run("djpeg -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg")
  113. md5cmp(MD5_BMP_RGB_ISLOW_565D, "testout_rgb_islow_565D.bmp")
  114. rm_f("testout_rgb_islow_565D.bmp testout_rgb_islow.jpg")
  115. #endif
  116. # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff
  117. run("cjpeg -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm")
  118. md5cmp(MD5_JPEG_422_IFAST_OPT, "testout_422_ifast_opt.jpg")
  119. # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff
  120. run("djpeg -dct fast -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg")
  121. md5cmp(MD5_PPM_422_IFAST, "testout_422_ifast.ppm")
  122. rm_f("testout_422_ifast.ppm")
  123. # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff
  124. run("djpeg -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg")
  125. md5cmp(MD5_PPM_422M_IFAST, "testout_422m_ifast.ppm")
  126. rm_f("testout_422m_ifast.ppm")
  127. #if WITH_12BIT
  128. # rm_f("testout_422_ifast_opt.jpg")
  129. #else
  130. # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff
  131. run("djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg")
  132. md5cmp(MD5_BMP_422M_IFAST_565, "testout_422m_ifast_565.bmp")
  133. rm_f("testout_422m_ifast_565.bmp")
  134. # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff
  135. run("djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg")
  136. md5cmp(MD5_BMP_422M_IFAST_565D, "testout_422m_ifast_565D.bmp")
  137. rm_f("testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg")
  138. #endif
  139. # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff
  140. run("cjpeg -sample 2x2 -quality 100 -dct fast -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm")
  141. md5cmp(MD5_JPEG_420_IFAST_Q100_PROG, "testout_420_q100_ifast_prog.jpg")
  142. # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff
  143. run("djpeg -dct fast -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg")
  144. md5cmp(MD5_PPM_420_Q100_IFAST, "testout_420_q100_ifast.ppm")
  145. rm_f("testout_420_q100_ifast.ppm")
  146. # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff
  147. run("djpeg -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg")
  148. md5cmp(MD5_PPM_420M_Q100_IFAST, "testout_420m_q100_ifast.ppm")
  149. rm_f("testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg")
  150. # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff
  151. run("cjpeg -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm")
  152. md5cmp(MD5_JPEG_GRAY_ISLOW, "testout_gray_islow.jpg")
  153. # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff
  154. run("djpeg -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg")
  155. md5cmp(MD5_PPM_GRAY_ISLOW, "testout_gray_islow.ppm")
  156. rm_f("testout_gray_islow.ppm")
  157. # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff
  158. run("djpeg -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg")
  159. md5cmp(MD5_PPM_GRAY_ISLOW_RGB, "testout_gray_islow_rgb.ppm")
  160. rm_f("testout_gray_islow_rgb.ppm")
  161. #if WITH_12BIT
  162. # rm_f("testout_gray_islow.jpg")
  163. #else
  164. # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff
  165. run("djpeg -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg")
  166. md5cmp(MD5_BMP_GRAY_ISLOW_565, "testout_gray_islow_565.bmp")
  167. rm_f("testout_gray_islow_565.bmp")
  168. # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
  169. run("djpeg -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg")
  170. md5cmp(MD5_BMP_GRAY_ISLOW_565D, "testout_gray_islow_565D.bmp")
  171. rm_f("testout_gray_islow_565D.bmp testout_gray_islow.jpg")
  172. #endif
  173. # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow
  174. # ENT: 2-pass huff
  175. run("cjpeg -sample 2x2 -smooth 1 -dct int -opt -outfile testout_420s_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm")
  176. md5cmp(MD5_JPEG_420S_IFAST_OPT, "testout_420s_ifast_opt.jpg")
  177. rm_f("testout_420s_ifast_opt.jpg")
  178. # The output of the floating point tests is not validated by default, because
  179. # the output differs depending on the type of floating point math used, and
  180. # this is only deterministic if the DCT/IDCT are implemented using SIMD
  181. # instructions on a particular platform. Pass one of the following on the make
  182. # command line to validate the floating point tests against one of the expected
  183. # results:
  184. #
  185. # FLOATTEST=sse validate against the expected results from the libjpeg-turbo
  186. # SSE SIMD extensions
  187. # FLOATTEST=32bit validate against the expected results from the C code
  188. # when running on a 32-bit FPU (or when SSE is being used for
  189. # floating point math, which is generally the default with
  190. # x86-64 compilers)
  191. # FLOATTEST=64bit validate against the exepected results from the C code
  192. # when running on a 64-bit FPU
  193. # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff
  194. # run("cjpeg -sample 3x2 -dct float -prog -outfile testout_3x2_float_prog.jpg $(srcdir)/testimages/testorig.ppm")
  195. # if [ "${FLOATTEST}" = "sse" ]; then \
  196. # md5cmp(MD5_JPEG_3x2_FLOAT_PROG_SSE, "testout_3x2_float_prog.jpg"); \
  197. # elif [ "${FLOATTEST}" = "32bit" -o "${FLOATTEST}" = "64bit" ]; then \
  198. # md5cmp(MD5_JPEG_3x2_FLOAT_PROG_32BIT, "testout_3x2_float_prog.jpg"); \
  199. # fi
  200. # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff
  201. # run("djpeg -dct float -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg")
  202. # if [ "${FLOATTEST}" = "sse" ]; then \
  203. # md5cmp(MD5_PPM_3x2_FLOAT_SSE, "testout_3x2_float.ppm"); \
  204. # elif [ "${FLOATTEST}" = "32bit" ]; then \
  205. # md5cmp(MD5_PPM_3x2_FLOAT_32BIT, "testout_3x2_float.ppm"); \
  206. # elif [ "${FLOATTEST}" = "64bit" ]; then \
  207. # md5cmp(MD5_PPM_3x2_FLOAT_64BIT, "testout_3x2_float.ppm"); \
  208. # fi
  209. # rm_f("testout_3x2_float.ppm testout_3x2_float_prog.jpg")
  210. # CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff
  211. run("cjpeg -sample 3x2 -dct fast -prog -outfile testout_3x2_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm")
  212. md5cmp(MD5_JPEG_3x2_IFAST_PROG, "testout_3x2_ifast_prog.jpg")
  213. # CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff
  214. run("djpeg -dct fast -outfile testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg")
  215. md5cmp(MD5_PPM_3x2_IFAST, "testout_3x2_ifast.ppm")
  216. rm_f("testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg")
  217. #if WITH_ARITH_ENC
  218. # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith
  219. run("cjpeg -dct int -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testorig.ppm")
  220. md5cmp(MD5_JPEG_420_ISLOW_ARI, "testout_420_islow_ari.jpg")
  221. rm_f("testout_420_islow_ari.jpg")
  222. run("jpegtran -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testimgint.jpg")
  223. md5cmp(MD5_JPEG_420_ISLOW_ARI, "testout_420_islow_ari.jpg")
  224. rm_f("testout_420_islow_ari.jpg")
  225. # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith
  226. run("cjpeg -sample 1x1 -dct int -prog -arithmetic -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm")
  227. md5cmp(MD5_JPEG_444_ISLOW_PROGARI, "testout_444_islow_progari.jpg")
  228. rm_f("testout_444_islow_progari.jpg")
  229. #endif
  230. #if WITH_ARITH_DEC
  231. # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith
  232. run("djpeg -fast -ppm -outfile testout_420m_ifast_ari.ppm $(srcdir)/testimages/testimgari.jpg")
  233. md5cmp(MD5_PPM_420M_IFAST_ARI, "testout_420m_ifast_ari.ppm")
  234. rm_f("testout_420m_ifast_ari.ppm")
  235. run("jpegtran -outfile testout_420_islow.jpg $(srcdir)/testimages/testimgari.jpg")
  236. md5cmp(MD5_JPEG_420_ISLOW, "testout_420_islow.jpg")
  237. rm_f("testout_420_islow.jpg")
  238. #endif
  239. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff
  240. run("djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/$(TESTORIG)")
  241. md5cmp(MD5_PPM_420M_ISLOW_2_1, "testout_420m_islow_2_1.ppm")
  242. rm_f("testout_420m_islow_2_1.ppm")
  243. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff
  244. run("djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/$(TESTORIG)")
  245. md5cmp(MD5_PPM_420M_ISLOW_15_8, "testout_420m_islow_15_8.ppm")
  246. rm_f("testout_420m_islow_15_8.ppm")
  247. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff
  248. run("djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/$(TESTORIG)")
  249. md5cmp(MD5_PPM_420M_ISLOW_13_8, "testout_420m_islow_13_8.ppm")
  250. rm_f("testout_420m_islow_13_8.ppm")
  251. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff
  252. run("djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/$(TESTORIG)")
  253. md5cmp(MD5_PPM_420M_ISLOW_11_8, "testout_420m_islow_11_8.ppm")
  254. rm_f("testout_420m_islow_11_8.ppm")
  255. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff
  256. run("djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/$(TESTORIG)")
  257. md5cmp(MD5_PPM_420M_ISLOW_9_8, "testout_420m_islow_9_8.ppm")
  258. rm_f("testout_420m_islow_9_8.ppm")
  259. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow ENT: huff
  260. run("djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/$(TESTORIG)")
  261. md5cmp(MD5_PPM_420M_ISLOW_7_8, "testout_420m_islow_7_8.ppm")
  262. rm_f("testout_420m_islow_7_8.ppm")
  263. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow ENT: huff
  264. run("djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/$(TESTORIG)")
  265. md5cmp(MD5_PPM_420M_ISLOW_3_4, "testout_420m_islow_3_4.ppm")
  266. rm_f("testout_420m_islow_3_4.ppm")
  267. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow ENT: huff
  268. run("djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/$(TESTORIG)")
  269. md5cmp(MD5_PPM_420M_ISLOW_5_8, "testout_420m_islow_5_8.ppm")
  270. rm_f("testout_420m_islow_5_8.ppm")
  271. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow ENT: huff
  272. run("djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/$(TESTORIG)")
  273. md5cmp(MD5_PPM_420M_ISLOW_1_2, "testout_420m_islow_1_2.ppm")
  274. rm_f("testout_420m_islow_1_2.ppm")
  275. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow ENT: huff
  276. run("djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/$(TESTORIG)")
  277. md5cmp(MD5_PPM_420M_ISLOW_3_8, "testout_420m_islow_3_8.ppm")
  278. rm_f("testout_420m_islow_3_8.ppm")
  279. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow ENT: huff
  280. run("djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/$(TESTORIG)")
  281. md5cmp(MD5_PPM_420M_ISLOW_1_4, "testout_420m_islow_1_4.ppm")
  282. rm_f("testout_420m_islow_1_4.ppm")
  283. # CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow ENT: huff
  284. run("djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/$(TESTORIG)")
  285. md5cmp(MD5_PPM_420M_ISLOW_1_8, "testout_420m_islow_1_8.ppm")
  286. rm_f("testout_420m_islow_1_8.ppm")
  287. #if WITH_12BIT
  288. #else
  289. # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
  290. run("djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/$(TESTORIG)")
  291. md5cmp(MD5_BMP_420_ISLOW_256, "testout_420_islow_256.bmp")
  292. rm_f("testout_420_islow_256.bmp")
  293. # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff
  294. run("djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/$(TESTORIG)")
  295. md5cmp(MD5_BMP_420_ISLOW_565, "testout_420_islow_565.bmp")
  296. rm_f("testout_420_islow_565.bmp")
  297. # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
  298. run("djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG)")
  299. md5cmp(MD5_BMP_420_ISLOW_565D, "testout_420_islow_565D.bmp")
  300. rm_f("testout_420_islow_565D.bmp")
  301. # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff
  302. run("djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/$(TESTORIG)")
  303. md5cmp(MD5_BMP_420M_ISLOW_565, "testout_420m_islow_565.bmp")
  304. rm_f("testout_420m_islow_565.bmp")
  305. # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff
  306. run("djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG)")
  307. md5cmp(MD5_BMP_420M_ISLOW_565D, "testout_420m_islow_565D.bmp")
  308. rm_f("testout_420m_islow_565D.bmp")
  309. #endif
  310. # Partial decode tests. These tests are designed to cover all of the possible
  311. # code paths in jpeg_skip_scanlines().
  312. # Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff
  313. run("djpeg -dct int -skip 15,31 -ppm -outfile testout_420_islow_skip15,31.ppm $(srcdir)/testimages/$(TESTORIG)")
  314. md5cmp(MD5_PPM_420_ISLOW_SKIP15_31, "testout_420_islow_skip15,31.ppm")
  315. rm_f("testout_420_islow_skip15,31.ppm")
  316. # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith
  317. #if WITH_ARITH_DEC
  318. run("djpeg -dct int -skip 16,139 -ppm -outfile testout_420_islow_ari_skip16,139.ppm $(srcdir)/testimages/testimgari.jpg")
  319. md5cmp(MD5_PPM_420_ISLOW_ARI_SKIP16_139, "testout_420_islow_ari_skip16,139.ppm")
  320. rm_f("testout_420_islow_ari_skip16,139.ppm")
  321. #endif
  322. # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff
  323. run("cjpeg -dct int -prog -outfile testout_420_islow_prog.jpg $(srcdir)/testimages/testorig.ppm")
  324. run("djpeg -dct int -crop 62x62+71+71 -ppm -outfile testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg")
  325. md5cmp(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71, "testout_420_islow_prog_crop62x62,71,71.ppm")
  326. rm_f("testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg")
  327. # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith
  328. #if WITH_ARITH_DEC
  329. run("djpeg -dct int -crop 53x53+4+4 -ppm -outfile testout_420_islow_ari_crop53x53,4,4.ppm $(srcdir)/testimages/testimgari.jpg")
  330. md5cmp(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4, "testout_420_islow_ari_crop53x53,4,4.ppm")
  331. rm_f("testout_420_islow_ari_crop53x53,4,4.ppm")
  332. #endif
  333. # Context rows: No Intra-iMCU row: Yes ENT: huff
  334. run("cjpeg -dct int -sample 1x1 -outfile testout_444_islow.jpg $(srcdir)/testimages/testorig.ppm")
  335. run("djpeg -dct int -skip 1,6 -ppm -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg")
  336. md5cmp(MD5_PPM_444_ISLOW_SKIP1_6, "testout_444_islow_skip1,6.ppm")
  337. rm_f("testout_444_islow_skip1,6.ppm testout_444_islow.jpg")
  338. # Context rows: No Intra-iMCU row: No ENT: prog huff
  339. run("cjpeg -dct int -prog -sample 1x1 -outfile testout_444_islow_prog.jpg $(srcdir)/testimages/testorig.ppm")
  340. run("djpeg -dct int -crop 98x98+13+13 -ppm -outfile testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg")
  341. md5cmp(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13, "testout_444_islow_prog_crop98x98,13,13.ppm")
  342. rm_f("testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg")
  343. # Context rows: No Intra-iMCU row: No ENT: arith
  344. #if WITH_ARITH_ENC
  345. run("cjpeg -dct int -arithmetic -sample 1x1 -outfile testout_444_islow_ari.jpg $(srcdir)/testimages/testorig.ppm")
  346. #if WITH_ARITH_DEC
  347. run("djpeg -dct int -crop 37x37+0+0 -ppm -outfile testout_444_islow_ari_crop37x37,0,0.ppm testout_444_islow_ari.jpg")
  348. md5cmp(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0, "testout_444_islow_ari_crop37x37,0,0.ppm")
  349. rm_f("testout_444_islow_ari_crop37x37,0,0.ppm")
  350. #endif
  351. rm_f("testout_444_islow_ari.jpg")
  352. #endif
  353. run("jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/$(TESTORIG)")
  354. md5cmp(MD5_JPEG_CROP, "testout_crop.jpg")
  355. rm_f("testout_crop.jpg")