epeg 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (504) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/MANIFEST +5 -0
  4. data/TODO +1 -0
  5. data/epeg/.dockerignore +4 -0
  6. data/epeg/.gitignore +5 -0
  7. data/epeg/CMakeLists.txt +30 -0
  8. data/epeg/Dockerfile +23 -0
  9. data/epeg/Epeg.h +90 -0
  10. data/epeg/README.md +42 -0
  11. data/epeg/epeg_main.c +1642 -0
  12. data/epeg/epeg_private.h +85 -0
  13. data/epeg/example/.gitignore +1 -0
  14. data/epeg/example/CMakeLists.txt +20 -0
  15. data/epeg/example/example.jpg +0 -0
  16. data/epeg/example/rotatetest.c +29 -0
  17. data/epeg/example/scaletest.c +48 -0
  18. data/epeg/vendor/libjpeg-turbo-2.0.4/BUILDING.md +828 -0
  19. data/epeg/vendor/libjpeg-turbo-2.0.4/CMakeLists.txt +1420 -0
  20. data/epeg/vendor/libjpeg-turbo-2.0.4/ChangeLog.md +1494 -0
  21. data/epeg/vendor/libjpeg-turbo-2.0.4/LICENSE.md +132 -0
  22. data/epeg/vendor/libjpeg-turbo-2.0.4/README.ijg +277 -0
  23. data/epeg/vendor/libjpeg-turbo-2.0.4/README.md +356 -0
  24. data/epeg/vendor/libjpeg-turbo-2.0.4/cderror.h +137 -0
  25. data/epeg/vendor/libjpeg-turbo-2.0.4/cdjpeg.c +145 -0
  26. data/epeg/vendor/libjpeg-turbo-2.0.4/cdjpeg.h +157 -0
  27. data/epeg/vendor/libjpeg-turbo-2.0.4/change.log +315 -0
  28. data/epeg/vendor/libjpeg-turbo-2.0.4/cjpeg.1 +354 -0
  29. data/epeg/vendor/libjpeg-turbo-2.0.4/cjpeg.c +695 -0
  30. data/epeg/vendor/libjpeg-turbo-2.0.4/cmakescripts/BuildPackages.cmake +182 -0
  31. data/epeg/vendor/libjpeg-turbo-2.0.4/cmakescripts/GNUInstallDirs.cmake +416 -0
  32. data/epeg/vendor/libjpeg-turbo-2.0.4/cmakescripts/cmake_uninstall.cmake.in +24 -0
  33. data/epeg/vendor/libjpeg-turbo-2.0.4/cmakescripts/testclean.cmake +41 -0
  34. data/epeg/vendor/libjpeg-turbo-2.0.4/cmyk.h +61 -0
  35. data/epeg/vendor/libjpeg-turbo-2.0.4/coderules.txt +78 -0
  36. data/epeg/vendor/libjpeg-turbo-2.0.4/djpeg.1 +296 -0
  37. data/epeg/vendor/libjpeg-turbo-2.0.4/djpeg.c +822 -0
  38. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/annotated.html +104 -0
  39. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/bc_s.png +0 -0
  40. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/bdwn.png +0 -0
  41. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/classes.html +106 -0
  42. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/closed.png +0 -0
  43. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/doxygen-extra.css +3 -0
  44. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/doxygen.css +1184 -0
  45. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/doxygen.png +0 -0
  46. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/dynsections.js +97 -0
  47. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2blank.png +0 -0
  48. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2cl.png +0 -0
  49. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2doc.png +0 -0
  50. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2folderclosed.png +0 -0
  51. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2folderopen.png +0 -0
  52. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2lastnode.png +0 -0
  53. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2link.png +0 -0
  54. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2mlastnode.png +0 -0
  55. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2mnode.png +0 -0
  56. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2mo.png +0 -0
  57. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2node.png +0 -0
  58. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2ns.png +0 -0
  59. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2plastnode.png +0 -0
  60. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2pnode.png +0 -0
  61. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2splitbar.png +0 -0
  62. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/ftv2vertline.png +0 -0
  63. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/functions.html +134 -0
  64. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/functions_vars.html +134 -0
  65. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/group___turbo_j_p_e_g.html +2775 -0
  66. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/index.html +90 -0
  67. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/jquery.js +8 -0
  68. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/modules.html +95 -0
  69. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/nav_f.png +0 -0
  70. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/nav_g.png +0 -0
  71. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/nav_h.png +0 -0
  72. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/open.png +0 -0
  73. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_63.html +26 -0
  74. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_63.js +4 -0
  75. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_64.html +26 -0
  76. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_64.js +5 -0
  77. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_68.html +26 -0
  78. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_68.js +4 -0
  79. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_6e.html +26 -0
  80. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_6e.js +4 -0
  81. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_6f.html +26 -0
  82. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_6f.js +5 -0
  83. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_72.html +26 -0
  84. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_72.js +4 -0
  85. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_74.html +26 -0
  86. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_74.js +102 -0
  87. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_77.html +26 -0
  88. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_77.js +4 -0
  89. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_78.html +26 -0
  90. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_78.js +4 -0
  91. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_79.html +26 -0
  92. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/all_79.js +4 -0
  93. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/classes_74.html +26 -0
  94. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/classes_74.js +6 -0
  95. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/close.png +0 -0
  96. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/enums_74.html +26 -0
  97. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/enums_74.js +8 -0
  98. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/enumvalues_74.html +26 -0
  99. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/enumvalues_74.js +37 -0
  100. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/functions_74.html +26 -0
  101. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/functions_74.js +31 -0
  102. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/groups_74.html +26 -0
  103. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/groups_74.js +4 -0
  104. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/mag_sel.png +0 -0
  105. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/nomatches.html +12 -0
  106. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/search.css +271 -0
  107. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/search.js +809 -0
  108. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/search_l.png +0 -0
  109. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/search_m.png +0 -0
  110. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/search_r.png +0 -0
  111. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/typedefs_74.html +26 -0
  112. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/typedefs_74.js +5 -0
  113. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_63.html +26 -0
  114. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_63.js +4 -0
  115. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_64.html +26 -0
  116. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_64.js +5 -0
  117. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_68.html +26 -0
  118. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_68.js +4 -0
  119. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_6e.html +26 -0
  120. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_6e.js +4 -0
  121. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_6f.html +26 -0
  122. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_6f.js +5 -0
  123. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_72.html +26 -0
  124. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_72.js +4 -0
  125. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_74.html +26 -0
  126. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_74.js +10 -0
  127. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_77.html +26 -0
  128. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_77.js +4 -0
  129. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_78.html +26 -0
  130. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_78.js +4 -0
  131. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_79.html +26 -0
  132. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/search/variables_79.js +4 -0
  133. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/structtjregion.html +186 -0
  134. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/structtjscalingfactor.html +148 -0
  135. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/structtjtransform.html +212 -0
  136. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/sync_off.png +0 -0
  137. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/sync_on.png +0 -0
  138. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/tab_a.png +0 -0
  139. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/tab_b.png +0 -0
  140. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/tab_h.png +0 -0
  141. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/tab_s.png +0 -0
  142. data/epeg/vendor/libjpeg-turbo-2.0.4/doc/html/tabs.css +60 -0
  143. data/epeg/vendor/libjpeg-turbo-2.0.4/doxygen-extra.css +3 -0
  144. data/epeg/vendor/libjpeg-turbo-2.0.4/doxygen.config +16 -0
  145. data/epeg/vendor/libjpeg-turbo-2.0.4/example.txt +464 -0
  146. data/epeg/vendor/libjpeg-turbo-2.0.4/jaricom.c +157 -0
  147. data/epeg/vendor/libjpeg-turbo-2.0.4/java/CMakeLists.txt +88 -0
  148. data/epeg/vendor/libjpeg-turbo-2.0.4/java/MANIFEST.MF +2 -0
  149. data/epeg/vendor/libjpeg-turbo-2.0.4/java/README +52 -0
  150. data/epeg/vendor/libjpeg-turbo-2.0.4/java/TJBench.java +1021 -0
  151. data/epeg/vendor/libjpeg-turbo-2.0.4/java/TJExample.java +405 -0
  152. data/epeg/vendor/libjpeg-turbo-2.0.4/java/TJUnitTest.java +960 -0
  153. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/allclasses-frame.html +24 -0
  154. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/allclasses-noframe.html +24 -0
  155. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/constant-values.html +532 -0
  156. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/deprecated-list.html +252 -0
  157. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/help-doc.html +210 -0
  158. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/index-all.html +1029 -0
  159. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/index.html +71 -0
  160. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/TJ.html +1356 -0
  161. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html +926 -0
  162. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html +241 -0
  163. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html +1255 -0
  164. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/TJException.html +340 -0
  165. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html +343 -0
  166. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html +751 -0
  167. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html +421 -0
  168. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html +765 -0
  169. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/package-frame.html +31 -0
  170. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/package-summary.html +202 -0
  171. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/org/libjpegturbo/turbojpeg/package-tree.html +160 -0
  172. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/overview-tree.html +164 -0
  173. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/package-list +1 -0
  174. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/resources/background.gif +0 -0
  175. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/resources/tab.gif +0 -0
  176. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/resources/titlebar.gif +0 -0
  177. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/resources/titlebar_end.gif +0 -0
  178. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/script.js +30 -0
  179. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/serialized-form.html +176 -0
  180. data/epeg/vendor/libjpeg-turbo-2.0.4/java/doc/stylesheet.css +474 -0
  181. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJ.java +584 -0
  182. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJCompressor.java +677 -0
  183. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJCustomFilter.java +76 -0
  184. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJDecompressor.java +931 -0
  185. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJException.java +78 -0
  186. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJLoader-unix.java.in +59 -0
  187. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJLoader-win.java.in +35 -0
  188. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java +115 -0
  189. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJTransform.java +227 -0
  190. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJTransformer.java +163 -0
  191. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/YUVImage.java +445 -0
  192. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org_libjpegturbo_turbojpeg_TJ.h +129 -0
  193. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org_libjpegturbo_turbojpeg_TJCompressor.h +101 -0
  194. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org_libjpegturbo_turbojpeg_TJDecompressor.h +101 -0
  195. data/epeg/vendor/libjpeg-turbo-2.0.4/java/org_libjpegturbo_turbojpeg_TJTransformer.h +29 -0
  196. data/epeg/vendor/libjpeg-turbo-2.0.4/jcapimin.c +295 -0
  197. data/epeg/vendor/libjpeg-turbo-2.0.4/jcapistd.c +162 -0
  198. data/epeg/vendor/libjpeg-turbo-2.0.4/jcarith.c +932 -0
  199. data/epeg/vendor/libjpeg-turbo-2.0.4/jccoefct.c +449 -0
  200. data/epeg/vendor/libjpeg-turbo-2.0.4/jccolext.c +144 -0
  201. data/epeg/vendor/libjpeg-turbo-2.0.4/jccolor.c +710 -0
  202. data/epeg/vendor/libjpeg-turbo-2.0.4/jcdctmgr.c +721 -0
  203. data/epeg/vendor/libjpeg-turbo-2.0.4/jchuff.c +1096 -0
  204. data/epeg/vendor/libjpeg-turbo-2.0.4/jchuff.h +42 -0
  205. data/epeg/vendor/libjpeg-turbo-2.0.4/jcicc.c +105 -0
  206. data/epeg/vendor/libjpeg-turbo-2.0.4/jcinit.c +77 -0
  207. data/epeg/vendor/libjpeg-turbo-2.0.4/jcmainct.c +162 -0
  208. data/epeg/vendor/libjpeg-turbo-2.0.4/jcmarker.c +664 -0
  209. data/epeg/vendor/libjpeg-turbo-2.0.4/jcmaster.c +640 -0
  210. data/epeg/vendor/libjpeg-turbo-2.0.4/jcomapi.c +109 -0
  211. data/epeg/vendor/libjpeg-turbo-2.0.4/jconfig.h.in +73 -0
  212. data/epeg/vendor/libjpeg-turbo-2.0.4/jconfig.txt +143 -0
  213. data/epeg/vendor/libjpeg-turbo-2.0.4/jconfigint.h.in +31 -0
  214. data/epeg/vendor/libjpeg-turbo-2.0.4/jcparam.c +541 -0
  215. data/epeg/vendor/libjpeg-turbo-2.0.4/jcphuff.c +1105 -0
  216. data/epeg/vendor/libjpeg-turbo-2.0.4/jcprepct.c +351 -0
  217. data/epeg/vendor/libjpeg-turbo-2.0.4/jcsample.c +539 -0
  218. data/epeg/vendor/libjpeg-turbo-2.0.4/jcstest.c +126 -0
  219. data/epeg/vendor/libjpeg-turbo-2.0.4/jctrans.c +400 -0
  220. data/epeg/vendor/libjpeg-turbo-2.0.4/jdapimin.c +407 -0
  221. data/epeg/vendor/libjpeg-turbo-2.0.4/jdapistd.c +639 -0
  222. data/epeg/vendor/libjpeg-turbo-2.0.4/jdarith.c +773 -0
  223. data/epeg/vendor/libjpeg-turbo-2.0.4/jdatadst-tj.c +203 -0
  224. data/epeg/vendor/libjpeg-turbo-2.0.4/jdatadst.c +293 -0
  225. data/epeg/vendor/libjpeg-turbo-2.0.4/jdatasrc-tj.c +194 -0
  226. data/epeg/vendor/libjpeg-turbo-2.0.4/jdatasrc.c +295 -0
  227. data/epeg/vendor/libjpeg-turbo-2.0.4/jdcoefct.c +692 -0
  228. data/epeg/vendor/libjpeg-turbo-2.0.4/jdcoefct.h +82 -0
  229. data/epeg/vendor/libjpeg-turbo-2.0.4/jdcol565.c +384 -0
  230. data/epeg/vendor/libjpeg-turbo-2.0.4/jdcolext.c +143 -0
  231. data/epeg/vendor/libjpeg-turbo-2.0.4/jdcolor.c +883 -0
  232. data/epeg/vendor/libjpeg-turbo-2.0.4/jdct.h +208 -0
  233. data/epeg/vendor/libjpeg-turbo-2.0.4/jddctmgr.c +352 -0
  234. data/epeg/vendor/libjpeg-turbo-2.0.4/jdhuff.c +831 -0
  235. data/epeg/vendor/libjpeg-turbo-2.0.4/jdhuff.h +238 -0
  236. data/epeg/vendor/libjpeg-turbo-2.0.4/jdicc.c +171 -0
  237. data/epeg/vendor/libjpeg-turbo-2.0.4/jdinput.c +408 -0
  238. data/epeg/vendor/libjpeg-turbo-2.0.4/jdmainct.c +460 -0
  239. data/epeg/vendor/libjpeg-turbo-2.0.4/jdmainct.h +71 -0
  240. data/epeg/vendor/libjpeg-turbo-2.0.4/jdmarker.c +1377 -0
  241. data/epeg/vendor/libjpeg-turbo-2.0.4/jdmaster.c +737 -0
  242. data/epeg/vendor/libjpeg-turbo-2.0.4/jdmaster.h +28 -0
  243. data/epeg/vendor/libjpeg-turbo-2.0.4/jdmerge.c +617 -0
  244. data/epeg/vendor/libjpeg-turbo-2.0.4/jdmrg565.c +354 -0
  245. data/epeg/vendor/libjpeg-turbo-2.0.4/jdmrgext.c +184 -0
  246. data/epeg/vendor/libjpeg-turbo-2.0.4/jdphuff.c +687 -0
  247. data/epeg/vendor/libjpeg-turbo-2.0.4/jdpostct.c +294 -0
  248. data/epeg/vendor/libjpeg-turbo-2.0.4/jdsample.c +518 -0
  249. data/epeg/vendor/libjpeg-turbo-2.0.4/jdsample.h +50 -0
  250. data/epeg/vendor/libjpeg-turbo-2.0.4/jdtrans.c +155 -0
  251. data/epeg/vendor/libjpeg-turbo-2.0.4/jerror.c +251 -0
  252. data/epeg/vendor/libjpeg-turbo-2.0.4/jerror.h +316 -0
  253. data/epeg/vendor/libjpeg-turbo-2.0.4/jfdctflt.c +169 -0
  254. data/epeg/vendor/libjpeg-turbo-2.0.4/jfdctfst.c +227 -0
  255. data/epeg/vendor/libjpeg-turbo-2.0.4/jfdctint.c +288 -0
  256. data/epeg/vendor/libjpeg-turbo-2.0.4/jidctflt.c +240 -0
  257. data/epeg/vendor/libjpeg-turbo-2.0.4/jidctfst.c +371 -0
  258. data/epeg/vendor/libjpeg-turbo-2.0.4/jidctint.c +2627 -0
  259. data/epeg/vendor/libjpeg-turbo-2.0.4/jidctred.c +409 -0
  260. data/epeg/vendor/libjpeg-turbo-2.0.4/jinclude.h +88 -0
  261. data/epeg/vendor/libjpeg-turbo-2.0.4/jmemmgr.c +1179 -0
  262. data/epeg/vendor/libjpeg-turbo-2.0.4/jmemnobs.c +115 -0
  263. data/epeg/vendor/libjpeg-turbo-2.0.4/jmemsys.h +178 -0
  264. data/epeg/vendor/libjpeg-turbo-2.0.4/jmorecfg.h +421 -0
  265. data/epeg/vendor/libjpeg-turbo-2.0.4/jpeg_nbits_table.h +4098 -0
  266. data/epeg/vendor/libjpeg-turbo-2.0.4/jpegcomp.h +31 -0
  267. data/epeg/vendor/libjpeg-turbo-2.0.4/jpegint.h +368 -0
  268. data/epeg/vendor/libjpeg-turbo-2.0.4/jpeglib.h +1132 -0
  269. data/epeg/vendor/libjpeg-turbo-2.0.4/jpegtran.1 +295 -0
  270. data/epeg/vendor/libjpeg-turbo-2.0.4/jpegtran.c +601 -0
  271. data/epeg/vendor/libjpeg-turbo-2.0.4/jquant1.c +859 -0
  272. data/epeg/vendor/libjpeg-turbo-2.0.4/jquant2.c +1285 -0
  273. data/epeg/vendor/libjpeg-turbo-2.0.4/jsimd.h +117 -0
  274. data/epeg/vendor/libjpeg-turbo-2.0.4/jsimd_none.c +418 -0
  275. data/epeg/vendor/libjpeg-turbo-2.0.4/jsimddct.h +70 -0
  276. data/epeg/vendor/libjpeg-turbo-2.0.4/jstdhuff.c +143 -0
  277. data/epeg/vendor/libjpeg-turbo-2.0.4/jutils.c +133 -0
  278. data/epeg/vendor/libjpeg-turbo-2.0.4/jversion.h +52 -0
  279. data/epeg/vendor/libjpeg-turbo-2.0.4/libjpeg.map.in +11 -0
  280. data/epeg/vendor/libjpeg-turbo-2.0.4/libjpeg.txt +3144 -0
  281. data/epeg/vendor/libjpeg-turbo-2.0.4/md5/CMakeLists.txt +1 -0
  282. data/epeg/vendor/libjpeg-turbo-2.0.4/md5/md5.c +275 -0
  283. data/epeg/vendor/libjpeg-turbo-2.0.4/md5/md5.h +57 -0
  284. data/epeg/vendor/libjpeg-turbo-2.0.4/md5/md5cmp.c +59 -0
  285. data/epeg/vendor/libjpeg-turbo-2.0.4/md5/md5hl.c +125 -0
  286. data/epeg/vendor/libjpeg-turbo-2.0.4/rdbmp.c +689 -0
  287. data/epeg/vendor/libjpeg-turbo-2.0.4/rdcolmap.c +254 -0
  288. data/epeg/vendor/libjpeg-turbo-2.0.4/rdgif.c +39 -0
  289. data/epeg/vendor/libjpeg-turbo-2.0.4/rdjpgcom.1 +63 -0
  290. data/epeg/vendor/libjpeg-turbo-2.0.4/rdjpgcom.c +510 -0
  291. data/epeg/vendor/libjpeg-turbo-2.0.4/rdppm.c +766 -0
  292. data/epeg/vendor/libjpeg-turbo-2.0.4/rdrle.c +389 -0
  293. data/epeg/vendor/libjpeg-turbo-2.0.4/rdswitch.c +424 -0
  294. data/epeg/vendor/libjpeg-turbo-2.0.4/rdtarga.c +509 -0
  295. data/epeg/vendor/libjpeg-turbo-2.0.4/release/Distribution.xml.in +24 -0
  296. data/epeg/vendor/libjpeg-turbo-2.0.4/release/License.rtf +20 -0
  297. data/epeg/vendor/libjpeg-turbo-2.0.4/release/ReadMe.txt +5 -0
  298. data/epeg/vendor/libjpeg-turbo-2.0.4/release/Welcome.rtf +17 -0
  299. data/epeg/vendor/libjpeg-turbo-2.0.4/release/deb-control.in +31 -0
  300. data/epeg/vendor/libjpeg-turbo-2.0.4/release/installer.nsi.in +191 -0
  301. data/epeg/vendor/libjpeg-turbo-2.0.4/release/libjpeg.pc.in +10 -0
  302. data/epeg/vendor/libjpeg-turbo-2.0.4/release/libturbojpeg.pc.in +10 -0
  303. data/epeg/vendor/libjpeg-turbo-2.0.4/release/makecygwinpkg.in +66 -0
  304. data/epeg/vendor/libjpeg-turbo-2.0.4/release/makedpkg.in +115 -0
  305. data/epeg/vendor/libjpeg-turbo-2.0.4/release/makemacpkg.in +284 -0
  306. data/epeg/vendor/libjpeg-turbo-2.0.4/release/makerpm.in +30 -0
  307. data/epeg/vendor/libjpeg-turbo-2.0.4/release/makesrpm.in +48 -0
  308. data/epeg/vendor/libjpeg-turbo-2.0.4/release/maketarball.in +51 -0
  309. data/epeg/vendor/libjpeg-turbo-2.0.4/release/rpm.spec.in +221 -0
  310. data/epeg/vendor/libjpeg-turbo-2.0.4/release/uninstall.in +113 -0
  311. data/epeg/vendor/libjpeg-turbo-2.0.4/sharedlib/CMakeLists.txt +99 -0
  312. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/CMakeLists.txt +385 -0
  313. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/arm/jsimd.c +721 -0
  314. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/arm/jsimd_neon.S +2878 -0
  315. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/arm64/jsimd.c +798 -0
  316. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/arm64/jsimd_neon.S +3433 -0
  317. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/gas-preprocessor.in +1 -0
  318. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jccolext-avx2.asm +578 -0
  319. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jccolext-mmx.asm +476 -0
  320. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jccolext-sse2.asm +503 -0
  321. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jccolor-avx2.asm +121 -0
  322. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jccolor-mmx.asm +121 -0
  323. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jccolor-sse2.asm +120 -0
  324. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcgray-avx2.asm +113 -0
  325. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcgray-mmx.asm +113 -0
  326. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcgray-sse2.asm +112 -0
  327. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcgryext-avx2.asm +457 -0
  328. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcgryext-mmx.asm +355 -0
  329. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcgryext-sse2.asm +382 -0
  330. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jchuff-sse2.asm +424 -0
  331. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcphuff-sse2.asm +660 -0
  332. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcsample-avx2.asm +388 -0
  333. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcsample-mmx.asm +324 -0
  334. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jcsample-sse2.asm +351 -0
  335. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdcolext-avx2.asm +515 -0
  336. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdcolext-mmx.asm +404 -0
  337. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdcolext-sse2.asm +458 -0
  338. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdcolor-avx2.asm +118 -0
  339. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdcolor-mmx.asm +117 -0
  340. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdcolor-sse2.asm +117 -0
  341. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdmerge-avx2.asm +136 -0
  342. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdmerge-mmx.asm +123 -0
  343. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdmerge-sse2.asm +135 -0
  344. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdmrgext-avx2.asm +575 -0
  345. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdmrgext-mmx.asm +460 -0
  346. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdmrgext-sse2.asm +517 -0
  347. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdsample-avx2.asm +760 -0
  348. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdsample-mmx.asm +731 -0
  349. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jdsample-sse2.asm +724 -0
  350. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jfdctflt-3dn.asm +318 -0
  351. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jfdctflt-sse.asm +369 -0
  352. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jfdctfst-mmx.asm +395 -0
  353. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jfdctfst-sse2.asm +403 -0
  354. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jfdctint-avx2.asm +331 -0
  355. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jfdctint-mmx.asm +620 -0
  356. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jfdctint-sse2.asm +633 -0
  357. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctflt-3dn.asm +451 -0
  358. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctflt-sse.asm +571 -0
  359. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctflt-sse2.asm +497 -0
  360. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctfst-mmx.asm +499 -0
  361. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctfst-sse2.asm +501 -0
  362. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctint-avx2.asm +453 -0
  363. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctint-mmx.asm +851 -0
  364. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctint-sse2.asm +858 -0
  365. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctred-mmx.asm +704 -0
  366. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jidctred-sse2.asm +592 -0
  367. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jquant-3dn.asm +230 -0
  368. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jquant-mmx.asm +276 -0
  369. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jquant-sse.asm +208 -0
  370. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jquantf-sse2.asm +168 -0
  371. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jquanti-avx2.asm +188 -0
  372. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jquanti-sse2.asm +201 -0
  373. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jsimd.c +1253 -0
  374. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/i386/jsimdcpu.asm +135 -0
  375. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/jsimd.h +1083 -0
  376. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jccolext-mmi.c +483 -0
  377. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jccolor-mmi.c +148 -0
  378. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jcsample-mmi.c +100 -0
  379. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jcsample.h +28 -0
  380. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jdcolext-mmi.c +424 -0
  381. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jdcolor-mmi.c +139 -0
  382. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jdsample-mmi.c +245 -0
  383. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jfdctint-mmi.c +398 -0
  384. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jidctint-mmi.c +571 -0
  385. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jquanti-mmi.c +130 -0
  386. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jsimd.c +610 -0
  387. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/jsimd_mmi.h +57 -0
  388. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/loongson/loongson-mmintrin.h +1324 -0
  389. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/mips/jsimd.c +1123 -0
  390. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/mips/jsimd_dspr2.S +4479 -0
  391. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/mips/jsimd_dspr2_asm.h +292 -0
  392. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/nasm/jcolsamp.inc +135 -0
  393. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/nasm/jdct.inc +31 -0
  394. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/nasm/jpeg_nbits_table.inc +4097 -0
  395. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/nasm/jsimdcfg.inc +93 -0
  396. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/nasm/jsimdcfg.inc.h +131 -0
  397. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/nasm/jsimdext.inc +479 -0
  398. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jccolext-altivec.c +269 -0
  399. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jccolor-altivec.c +116 -0
  400. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jcgray-altivec.c +111 -0
  401. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jcgryext-altivec.c +228 -0
  402. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jcsample-altivec.c +159 -0
  403. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jcsample.h +28 -0
  404. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jdcolext-altivec.c +276 -0
  405. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jdcolor-altivec.c +106 -0
  406. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jdmerge-altivec.c +130 -0
  407. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jdmrgext-altivec.c +329 -0
  408. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jdsample-altivec.c +400 -0
  409. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jfdctfst-altivec.c +154 -0
  410. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jfdctint-altivec.c +258 -0
  411. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jidctfst-altivec.c +255 -0
  412. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jidctint-altivec.c +357 -0
  413. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jquanti-altivec.c +250 -0
  414. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jsimd.c +872 -0
  415. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/powerpc/jsimd_altivec.h +98 -0
  416. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jccolext-avx2.asm +558 -0
  417. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jccolext-sse2.asm +483 -0
  418. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jccolor-avx2.asm +121 -0
  419. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jccolor-sse2.asm +120 -0
  420. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jcgray-avx2.asm +113 -0
  421. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jcgray-sse2.asm +112 -0
  422. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jcgryext-avx2.asm +437 -0
  423. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jcgryext-sse2.asm +362 -0
  424. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jchuff-sse2.asm +346 -0
  425. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jcphuff-sse2.asm +637 -0
  426. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jcsample-avx2.asm +366 -0
  427. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jcsample-sse2.asm +329 -0
  428. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdcolext-avx2.asm +495 -0
  429. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdcolext-sse2.asm +438 -0
  430. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdcolor-avx2.asm +118 -0
  431. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdcolor-sse2.asm +117 -0
  432. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdmerge-avx2.asm +136 -0
  433. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdmerge-sse2.asm +135 -0
  434. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdmrgext-avx2.asm +593 -0
  435. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdmrgext-sse2.asm +535 -0
  436. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdsample-avx2.asm +695 -0
  437. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jdsample-sse2.asm +664 -0
  438. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jfdctflt-sse.asm +355 -0
  439. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jfdctfst-sse2.asm +389 -0
  440. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jfdctint-avx2.asm +320 -0
  441. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jfdctint-sse2.asm +619 -0
  442. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jidctflt-sse2.asm +481 -0
  443. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jidctfst-sse2.asm +490 -0
  444. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jidctint-avx2.asm +417 -0
  445. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jidctint-sse2.asm +846 -0
  446. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jidctred-sse2.asm +573 -0
  447. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jquantf-sse2.asm +154 -0
  448. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jquanti-avx2.asm +162 -0
  449. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jquanti-sse2.asm +187 -0
  450. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jsimd.c +1076 -0
  451. data/epeg/vendor/libjpeg-turbo-2.0.4/simd/x86_64/jsimdcpu.asm +86 -0
  452. data/epeg/vendor/libjpeg-turbo-2.0.4/structure.txt +904 -0
  453. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/nightshot_iso_100.bmp +0 -0
  454. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/nightshot_iso_100.txt +25 -0
  455. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/test.scan +5 -0
  456. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/test1.icc +0 -0
  457. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/test1.icc.txt +20 -0
  458. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/test2.icc +0 -0
  459. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/test2.icc.txt +20 -0
  460. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/testimgari.jpg +0 -0
  461. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/testimgint.jpg +0 -0
  462. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/testorig.jpg +0 -0
  463. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/testorig.ppm +4 -0
  464. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/testorig12.jpg +0 -0
  465. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/vgl_5674_0098.bmp +0 -0
  466. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/vgl_6434_0018a.bmp +0 -0
  467. data/epeg/vendor/libjpeg-turbo-2.0.4/testimages/vgl_6548_0026a.bmp +0 -0
  468. data/epeg/vendor/libjpeg-turbo-2.0.4/tjbench.c +1031 -0
  469. data/epeg/vendor/libjpeg-turbo-2.0.4/tjbenchtest.in +256 -0
  470. data/epeg/vendor/libjpeg-turbo-2.0.4/tjbenchtest.java.in +215 -0
  471. data/epeg/vendor/libjpeg-turbo-2.0.4/tjexample.c +396 -0
  472. data/epeg/vendor/libjpeg-turbo-2.0.4/tjexampletest.in +149 -0
  473. data/epeg/vendor/libjpeg-turbo-2.0.4/tjexampletest.java.in +151 -0
  474. data/epeg/vendor/libjpeg-turbo-2.0.4/tjunittest.c +931 -0
  475. data/epeg/vendor/libjpeg-turbo-2.0.4/tjutil.c +70 -0
  476. data/epeg/vendor/libjpeg-turbo-2.0.4/tjutil.h +47 -0
  477. data/epeg/vendor/libjpeg-turbo-2.0.4/transupp.c +1628 -0
  478. data/epeg/vendor/libjpeg-turbo-2.0.4/transupp.h +210 -0
  479. data/epeg/vendor/libjpeg-turbo-2.0.4/turbojpeg-jni.c +1246 -0
  480. data/epeg/vendor/libjpeg-turbo-2.0.4/turbojpeg-mapfile +65 -0
  481. data/epeg/vendor/libjpeg-turbo-2.0.4/turbojpeg-mapfile.jni +101 -0
  482. data/epeg/vendor/libjpeg-turbo-2.0.4/turbojpeg.c +2152 -0
  483. data/epeg/vendor/libjpeg-turbo-2.0.4/turbojpeg.h +1744 -0
  484. data/epeg/vendor/libjpeg-turbo-2.0.4/usage.txt +635 -0
  485. data/epeg/vendor/libjpeg-turbo-2.0.4/win/jconfig.h.in +34 -0
  486. data/epeg/vendor/libjpeg-turbo-2.0.4/win/jpeg62-memsrcdst.def +108 -0
  487. data/epeg/vendor/libjpeg-turbo-2.0.4/win/jpeg62.def +106 -0
  488. data/epeg/vendor/libjpeg-turbo-2.0.4/win/jpeg7-memsrcdst.def +110 -0
  489. data/epeg/vendor/libjpeg-turbo-2.0.4/win/jpeg7.def +108 -0
  490. data/epeg/vendor/libjpeg-turbo-2.0.4/win/jpeg8.def +111 -0
  491. data/epeg/vendor/libjpeg-turbo-2.0.4/wizard.txt +212 -0
  492. data/epeg/vendor/libjpeg-turbo-2.0.4/wrbmp.c +558 -0
  493. data/epeg/vendor/libjpeg-turbo-2.0.4/wrgif.c +413 -0
  494. data/epeg/vendor/libjpeg-turbo-2.0.4/wrjpgcom.1 +103 -0
  495. data/epeg/vendor/libjpeg-turbo-2.0.4/wrjpgcom.c +591 -0
  496. data/epeg/vendor/libjpeg-turbo-2.0.4/wrppm.c +365 -0
  497. data/epeg/vendor/libjpeg-turbo-2.0.4/wrrle.c +309 -0
  498. data/epeg/vendor/libjpeg-turbo-2.0.4/wrtarga.c +261 -0
  499. data/epeg.c +131 -0
  500. data/epeg.gemspec +18 -0
  501. data/extconf.rb +80 -0
  502. data/test.jpg +0 -0
  503. data/test.rb +42 -0
  504. metadata +546 -0
@@ -0,0 +1,1031 @@
1
+ /*
2
+ * Copyright (C)2009-2019 D. R. Commander. All Rights Reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions are met:
6
+ *
7
+ * - Redistributions of source code must retain the above copyright notice,
8
+ * this list of conditions and the following disclaimer.
9
+ * - Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ * - Neither the name of the libjpeg-turbo Project nor the names of its
13
+ * contributors may be used to endorse or promote products derived from this
14
+ * software without specific prior written permission.
15
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
17
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
+ * POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+
29
+ #include <stdio.h>
30
+ #include <stdlib.h>
31
+ #include <string.h>
32
+ #include <ctype.h>
33
+ #include <math.h>
34
+ #include <errno.h>
35
+ #include <limits.h>
36
+ #include <cdjpeg.h>
37
+ #include "./tjutil.h"
38
+ #include "./turbojpeg.h"
39
+
40
+
41
+ #define THROW(op, err) { \
42
+ printf("ERROR in line %d while %s:\n%s\n", __LINE__, op, err); \
43
+ retval = -1; goto bailout; \
44
+ }
45
+ #define THROW_UNIX(m) THROW(m, strerror(errno))
46
+
47
+ char tjErrorStr[JMSG_LENGTH_MAX] = "\0", tjErrorMsg[JMSG_LENGTH_MAX] = "\0";
48
+ int tjErrorLine = -1, tjErrorCode = -1;
49
+
50
+ #define THROW_TJG(m) { \
51
+ printf("ERROR in line %d while %s:\n%s\n", __LINE__, m, \
52
+ tjGetErrorStr2(NULL)); \
53
+ retval = -1; goto bailout; \
54
+ }
55
+
56
+ #define THROW_TJ(m) { \
57
+ int _tjErrorCode = tjGetErrorCode(handle); \
58
+ char *_tjErrorStr = tjGetErrorStr2(handle); \
59
+ \
60
+ if (!(flags & TJFLAG_STOPONWARNING) && _tjErrorCode == TJERR_WARNING) { \
61
+ if (strncmp(tjErrorStr, _tjErrorStr, JMSG_LENGTH_MAX) || \
62
+ strncmp(tjErrorMsg, m, JMSG_LENGTH_MAX) || \
63
+ tjErrorCode != _tjErrorCode || tjErrorLine != __LINE__) { \
64
+ strncpy(tjErrorStr, _tjErrorStr, JMSG_LENGTH_MAX - 1); \
65
+ strncpy(tjErrorMsg, m, JMSG_LENGTH_MAX - 1); \
66
+ tjErrorCode = _tjErrorCode; \
67
+ tjErrorLine = __LINE__; \
68
+ printf("WARNING in line %d while %s:\n%s\n", __LINE__, m, _tjErrorStr); \
69
+ } \
70
+ } else { \
71
+ printf("%s in line %d while %s:\n%s\n", \
72
+ _tjErrorCode == TJERR_WARNING ? "WARNING" : "ERROR", __LINE__, m, \
73
+ _tjErrorStr); \
74
+ retval = -1; goto bailout; \
75
+ } \
76
+ }
77
+
78
+ int flags = TJFLAG_NOREALLOC, compOnly = 0, decompOnly = 0, doYUV = 0,
79
+ quiet = 0, doTile = 0, pf = TJPF_BGR, yuvPad = 1, doWrite = 1;
80
+ char *ext = "ppm";
81
+ const char *pixFormatStr[TJ_NUMPF] = {
82
+ "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY", "", "", "", "", "CMYK"
83
+ };
84
+ const char *subNameLong[TJ_NUMSAMP] = {
85
+ "4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0", "4:1:1"
86
+ };
87
+ const char *csName[TJ_NUMCS] = {
88
+ "RGB", "YCbCr", "GRAY", "CMYK", "YCCK"
89
+ };
90
+ const char *subName[TJ_NUMSAMP] = {
91
+ "444", "422", "420", "GRAY", "440", "411"
92
+ };
93
+ tjscalingfactor *scalingFactors = NULL, sf = { 1, 1 };
94
+ int nsf = 0, xformOp = TJXOP_NONE, xformOpt = 0;
95
+ int (*customFilter) (short *, tjregion, tjregion, int, int, tjtransform *);
96
+ double benchTime = 5.0, warmup = 1.0;
97
+
98
+
99
+ static char *formatName(int subsamp, int cs, char *buf)
100
+ {
101
+ if (cs == TJCS_YCbCr)
102
+ return (char *)subNameLong[subsamp];
103
+ else if (cs == TJCS_YCCK || cs == TJCS_CMYK) {
104
+ snprintf(buf, 80, "%s %s", csName[cs], subNameLong[subsamp]);
105
+ return buf;
106
+ } else
107
+ return (char *)csName[cs];
108
+ }
109
+
110
+
111
+ static char *sigfig(double val, int figs, char *buf, int len)
112
+ {
113
+ char format[80];
114
+ int digitsAfterDecimal = figs - (int)ceil(log10(fabs(val)));
115
+
116
+ if (digitsAfterDecimal < 1)
117
+ snprintf(format, 80, "%%.0f");
118
+ else
119
+ snprintf(format, 80, "%%.%df", digitsAfterDecimal);
120
+ snprintf(buf, len, format, val);
121
+ return buf;
122
+ }
123
+
124
+
125
+ /* Custom DCT filter which produces a negative of the image */
126
+ static int dummyDCTFilter(short *coeffs, tjregion arrayRegion,
127
+ tjregion planeRegion, int componentIndex,
128
+ int transformIndex, tjtransform *transform)
129
+ {
130
+ int i;
131
+
132
+ for (i = 0; i < arrayRegion.w * arrayRegion.h; i++)
133
+ coeffs[i] = -coeffs[i];
134
+ return 0;
135
+ }
136
+
137
+
138
+ /* Decompression test */
139
+ static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
140
+ unsigned long *jpegSize, unsigned char *dstBuf, int w, int h,
141
+ int subsamp, int jpegQual, char *fileName, int tilew,
142
+ int tileh)
143
+ {
144
+ char tempStr[1024], sizeStr[24] = "\0", qualStr[13] = "\0", *ptr;
145
+ FILE *file = NULL;
146
+ tjhandle handle = NULL;
147
+ int row, col, iter = 0, dstBufAlloc = 0, retval = 0;
148
+ double elapsed, elapsedDecode;
149
+ int ps = tjPixelSize[pf];
150
+ int scaledw = TJSCALED(w, sf);
151
+ int scaledh = TJSCALED(h, sf);
152
+ int pitch = scaledw * ps;
153
+ int ntilesw = (w + tilew - 1) / tilew, ntilesh = (h + tileh - 1) / tileh;
154
+ unsigned char *dstPtr, *dstPtr2, *yuvBuf = NULL;
155
+
156
+ if (jpegQual > 0) {
157
+ snprintf(qualStr, 13, "_Q%d", jpegQual);
158
+ qualStr[12] = 0;
159
+ }
160
+
161
+ if ((handle = tjInitDecompress()) == NULL)
162
+ THROW_TJ("executing tjInitDecompress()");
163
+
164
+ if (dstBuf == NULL) {
165
+ if ((unsigned long long)pitch * (unsigned long long)scaledh >
166
+ (unsigned long long)((size_t)-1))
167
+ THROW("allocating destination buffer", "Image is too large");
168
+ if ((dstBuf = (unsigned char *)malloc((size_t)pitch * scaledh)) == NULL)
169
+ THROW_UNIX("allocating destination buffer");
170
+ dstBufAlloc = 1;
171
+ }
172
+ /* Set the destination buffer to gray so we know whether the decompressor
173
+ attempted to write to it */
174
+ memset(dstBuf, 127, (size_t)pitch * scaledh);
175
+
176
+ if (doYUV) {
177
+ int width = doTile ? tilew : scaledw;
178
+ int height = doTile ? tileh : scaledh;
179
+ unsigned long yuvSize = tjBufSizeYUV2(width, yuvPad, height, subsamp);
180
+
181
+ if (yuvSize == (unsigned long)-1)
182
+ THROW_TJ("allocating YUV buffer");
183
+ if ((yuvBuf = (unsigned char *)malloc(yuvSize)) == NULL)
184
+ THROW_UNIX("allocating YUV buffer");
185
+ memset(yuvBuf, 127, yuvSize);
186
+ }
187
+
188
+ /* Benchmark */
189
+ iter = -1;
190
+ elapsed = elapsedDecode = 0.;
191
+ while (1) {
192
+ int tile = 0;
193
+ double start = getTime();
194
+
195
+ for (row = 0, dstPtr = dstBuf; row < ntilesh;
196
+ row++, dstPtr += (size_t)pitch * tileh) {
197
+ for (col = 0, dstPtr2 = dstPtr; col < ntilesw;
198
+ col++, tile++, dstPtr2 += ps * tilew) {
199
+ int width = doTile ? min(tilew, w - col * tilew) : scaledw;
200
+ int height = doTile ? min(tileh, h - row * tileh) : scaledh;
201
+
202
+ if (doYUV) {
203
+ double startDecode;
204
+
205
+ if (tjDecompressToYUV2(handle, jpegBuf[tile], jpegSize[tile], yuvBuf,
206
+ width, yuvPad, height, flags) == -1)
207
+ THROW_TJ("executing tjDecompressToYUV2()");
208
+ startDecode = getTime();
209
+ if (tjDecodeYUV(handle, yuvBuf, yuvPad, subsamp, dstPtr2, width,
210
+ pitch, height, pf, flags) == -1)
211
+ THROW_TJ("executing tjDecodeYUV()");
212
+ if (iter >= 0) elapsedDecode += getTime() - startDecode;
213
+ } else if (tjDecompress2(handle, jpegBuf[tile], jpegSize[tile],
214
+ dstPtr2, width, pitch, height, pf,
215
+ flags) == -1)
216
+ THROW_TJ("executing tjDecompress2()");
217
+ }
218
+ }
219
+ elapsed += getTime() - start;
220
+ if (iter >= 0) {
221
+ iter++;
222
+ if (elapsed >= benchTime) break;
223
+ } else if (elapsed >= warmup) {
224
+ iter = 0;
225
+ elapsed = elapsedDecode = 0.;
226
+ }
227
+ }
228
+ if (doYUV) elapsed -= elapsedDecode;
229
+
230
+ if (tjDestroy(handle) == -1) THROW_TJ("executing tjDestroy()");
231
+ handle = NULL;
232
+
233
+ if (quiet) {
234
+ printf("%-6s%s",
235
+ sigfig((double)(w * h) / 1000000. * (double)iter / elapsed, 4,
236
+ tempStr, 1024),
237
+ quiet == 2 ? "\n" : " ");
238
+ if (doYUV)
239
+ printf("%s\n",
240
+ sigfig((double)(w * h) / 1000000. * (double)iter / elapsedDecode,
241
+ 4, tempStr, 1024));
242
+ else if (quiet != 2) printf("\n");
243
+ } else {
244
+ printf("%s --> Frame rate: %f fps\n",
245
+ doYUV ? "Decomp to YUV" : "Decompress ", (double)iter / elapsed);
246
+ printf(" Throughput: %f Megapixels/sec\n",
247
+ (double)(w * h) / 1000000. * (double)iter / elapsed);
248
+ if (doYUV) {
249
+ printf("YUV Decode --> Frame rate: %f fps\n",
250
+ (double)iter / elapsedDecode);
251
+ printf(" Throughput: %f Megapixels/sec\n",
252
+ (double)(w * h) / 1000000. * (double)iter / elapsedDecode);
253
+ }
254
+ }
255
+
256
+ if (!doWrite) goto bailout;
257
+
258
+ if (sf.num != 1 || sf.denom != 1)
259
+ snprintf(sizeStr, 24, "%d_%d", sf.num, sf.denom);
260
+ else if (tilew != w || tileh != h)
261
+ snprintf(sizeStr, 24, "%dx%d", tilew, tileh);
262
+ else snprintf(sizeStr, 24, "full");
263
+ if (decompOnly)
264
+ snprintf(tempStr, 1024, "%s_%s.%s", fileName, sizeStr, ext);
265
+ else
266
+ snprintf(tempStr, 1024, "%s_%s%s_%s.%s", fileName, subName[subsamp],
267
+ qualStr, sizeStr, ext);
268
+
269
+ if (tjSaveImage(tempStr, dstBuf, scaledw, 0, scaledh, pf, flags) == -1)
270
+ THROW_TJG("saving bitmap");
271
+ ptr = strrchr(tempStr, '.');
272
+ snprintf(ptr, 1024 - (ptr - tempStr), "-err.%s", ext);
273
+ if (srcBuf && sf.num == 1 && sf.denom == 1) {
274
+ if (!quiet) printf("Compression error written to %s.\n", tempStr);
275
+ if (subsamp == TJ_GRAYSCALE) {
276
+ unsigned long index, index2;
277
+
278
+ for (row = 0, index = 0; row < h; row++, index += pitch) {
279
+ for (col = 0, index2 = index; col < w; col++, index2 += ps) {
280
+ unsigned long rindex = index2 + tjRedOffset[pf];
281
+ unsigned long gindex = index2 + tjGreenOffset[pf];
282
+ unsigned long bindex = index2 + tjBlueOffset[pf];
283
+ int y = (int)((double)srcBuf[rindex] * 0.299 +
284
+ (double)srcBuf[gindex] * 0.587 +
285
+ (double)srcBuf[bindex] * 0.114 + 0.5);
286
+
287
+ if (y > 255) y = 255;
288
+ if (y < 0) y = 0;
289
+ dstBuf[rindex] = abs(dstBuf[rindex] - y);
290
+ dstBuf[gindex] = abs(dstBuf[gindex] - y);
291
+ dstBuf[bindex] = abs(dstBuf[bindex] - y);
292
+ }
293
+ }
294
+ } else {
295
+ for (row = 0; row < h; row++)
296
+ for (col = 0; col < w * ps; col++)
297
+ dstBuf[pitch * row + col] =
298
+ abs(dstBuf[pitch * row + col] - srcBuf[pitch * row + col]);
299
+ }
300
+ if (tjSaveImage(tempStr, dstBuf, w, 0, h, pf, flags) == -1)
301
+ THROW_TJG("saving bitmap");
302
+ }
303
+
304
+ bailout:
305
+ if (file) fclose(file);
306
+ if (handle) tjDestroy(handle);
307
+ if (dstBuf && dstBufAlloc) free(dstBuf);
308
+ if (yuvBuf) free(yuvBuf);
309
+ return retval;
310
+ }
311
+
312
+
313
+ static int fullTest(unsigned char *srcBuf, int w, int h, int subsamp,
314
+ int jpegQual, char *fileName)
315
+ {
316
+ char tempStr[1024], tempStr2[80];
317
+ FILE *file = NULL;
318
+ tjhandle handle = NULL;
319
+ unsigned char **jpegBuf = NULL, *yuvBuf = NULL, *tmpBuf = NULL, *srcPtr,
320
+ *srcPtr2;
321
+ double start, elapsed, elapsedEncode;
322
+ int totalJpegSize = 0, row, col, i, tilew = w, tileh = h, retval = 0;
323
+ int iter;
324
+ unsigned long *jpegSize = NULL, yuvSize = 0;
325
+ int ps = tjPixelSize[pf];
326
+ int ntilesw = 1, ntilesh = 1, pitch = w * ps;
327
+ const char *pfStr = pixFormatStr[pf];
328
+
329
+ if ((unsigned long long)pitch * (unsigned long long)h >
330
+ (unsigned long long)((size_t)-1))
331
+ THROW("allocating temporary image buffer", "Image is too large");
332
+ if ((tmpBuf = (unsigned char *)malloc((size_t)pitch * h)) == NULL)
333
+ THROW_UNIX("allocating temporary image buffer");
334
+
335
+ if (!quiet)
336
+ printf(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", pfStr,
337
+ (flags & TJFLAG_BOTTOMUP) ? "Bottom-up" : "Top-down",
338
+ subNameLong[subsamp], jpegQual);
339
+
340
+ for (tilew = doTile ? 8 : w, tileh = doTile ? 8 : h; ;
341
+ tilew *= 2, tileh *= 2) {
342
+ if (tilew > w) tilew = w;
343
+ if (tileh > h) tileh = h;
344
+ ntilesw = (w + tilew - 1) / tilew;
345
+ ntilesh = (h + tileh - 1) / tileh;
346
+
347
+ if ((jpegBuf = (unsigned char **)malloc(sizeof(unsigned char *) *
348
+ ntilesw * ntilesh)) == NULL)
349
+ THROW_UNIX("allocating JPEG tile array");
350
+ memset(jpegBuf, 0, sizeof(unsigned char *) * ntilesw * ntilesh);
351
+ if ((jpegSize = (unsigned long *)malloc(sizeof(unsigned long) *
352
+ ntilesw * ntilesh)) == NULL)
353
+ THROW_UNIX("allocating JPEG size array");
354
+ memset(jpegSize, 0, sizeof(unsigned long) * ntilesw * ntilesh);
355
+
356
+ if ((flags & TJFLAG_NOREALLOC) != 0)
357
+ for (i = 0; i < ntilesw * ntilesh; i++) {
358
+ if (tjBufSize(tilew, tileh, subsamp) > (unsigned long)INT_MAX)
359
+ THROW("getting buffer size", "Image is too large");
360
+ if ((jpegBuf[i] = (unsigned char *)
361
+ tjAlloc(tjBufSize(tilew, tileh, subsamp))) == NULL)
362
+ THROW_UNIX("allocating JPEG tiles");
363
+ }
364
+
365
+ /* Compression test */
366
+ if (quiet == 1)
367
+ printf("%-4s (%s) %-5s %-3d ", pfStr,
368
+ (flags & TJFLAG_BOTTOMUP) ? "BU" : "TD", subNameLong[subsamp],
369
+ jpegQual);
370
+ for (i = 0; i < h; i++)
371
+ memcpy(&tmpBuf[pitch * i], &srcBuf[w * ps * i], w * ps);
372
+ if ((handle = tjInitCompress()) == NULL)
373
+ THROW_TJ("executing tjInitCompress()");
374
+
375
+ if (doYUV) {
376
+ yuvSize = tjBufSizeYUV2(tilew, yuvPad, tileh, subsamp);
377
+ if (yuvSize == (unsigned long)-1)
378
+ THROW_TJ("allocating YUV buffer");
379
+ if ((yuvBuf = (unsigned char *)malloc(yuvSize)) == NULL)
380
+ THROW_UNIX("allocating YUV buffer");
381
+ memset(yuvBuf, 127, yuvSize);
382
+ }
383
+
384
+ /* Benchmark */
385
+ iter = -1;
386
+ elapsed = elapsedEncode = 0.;
387
+ while (1) {
388
+ int tile = 0;
389
+
390
+ totalJpegSize = 0;
391
+ start = getTime();
392
+ for (row = 0, srcPtr = srcBuf; row < ntilesh;
393
+ row++, srcPtr += pitch * tileh) {
394
+ for (col = 0, srcPtr2 = srcPtr; col < ntilesw;
395
+ col++, tile++, srcPtr2 += ps * tilew) {
396
+ int width = min(tilew, w - col * tilew);
397
+ int height = min(tileh, h - row * tileh);
398
+
399
+ if (doYUV) {
400
+ double startEncode = getTime();
401
+
402
+ if (tjEncodeYUV3(handle, srcPtr2, width, pitch, height, pf, yuvBuf,
403
+ yuvPad, subsamp, flags) == -1)
404
+ THROW_TJ("executing tjEncodeYUV3()");
405
+ if (iter >= 0) elapsedEncode += getTime() - startEncode;
406
+ if (tjCompressFromYUV(handle, yuvBuf, width, yuvPad, height,
407
+ subsamp, &jpegBuf[tile], &jpegSize[tile],
408
+ jpegQual, flags) == -1)
409
+ THROW_TJ("executing tjCompressFromYUV()");
410
+ } else {
411
+ if (tjCompress2(handle, srcPtr2, width, pitch, height, pf,
412
+ &jpegBuf[tile], &jpegSize[tile], subsamp, jpegQual,
413
+ flags) == -1)
414
+ THROW_TJ("executing tjCompress2()");
415
+ }
416
+ totalJpegSize += jpegSize[tile];
417
+ }
418
+ }
419
+ elapsed += getTime() - start;
420
+ if (iter >= 0) {
421
+ iter++;
422
+ if (elapsed >= benchTime) break;
423
+ } else if (elapsed >= warmup) {
424
+ iter = 0;
425
+ elapsed = elapsedEncode = 0.;
426
+ }
427
+ }
428
+ if (doYUV) elapsed -= elapsedEncode;
429
+
430
+ if (tjDestroy(handle) == -1) THROW_TJ("executing tjDestroy()");
431
+ handle = NULL;
432
+
433
+ if (quiet == 1) printf("%-5d %-5d ", tilew, tileh);
434
+ if (quiet) {
435
+ if (doYUV)
436
+ printf("%-6s%s",
437
+ sigfig((double)(w * h) / 1000000. *
438
+ (double)iter / elapsedEncode, 4, tempStr, 1024),
439
+ quiet == 2 ? "\n" : " ");
440
+ printf("%-6s%s",
441
+ sigfig((double)(w * h) / 1000000. * (double)iter / elapsed, 4,
442
+ tempStr, 1024),
443
+ quiet == 2 ? "\n" : " ");
444
+ printf("%-6s%s",
445
+ sigfig((double)(w * h * ps) / (double)totalJpegSize, 4, tempStr2,
446
+ 80),
447
+ quiet == 2 ? "\n" : " ");
448
+ } else {
449
+ printf("\n%s size: %d x %d\n", doTile ? "Tile" : "Image", tilew, tileh);
450
+ if (doYUV) {
451
+ printf("Encode YUV --> Frame rate: %f fps\n",
452
+ (double)iter / elapsedEncode);
453
+ printf(" Output image size: %lu bytes\n", yuvSize);
454
+ printf(" Compression ratio: %f:1\n",
455
+ (double)(w * h * ps) / (double)yuvSize);
456
+ printf(" Throughput: %f Megapixels/sec\n",
457
+ (double)(w * h) / 1000000. * (double)iter / elapsedEncode);
458
+ printf(" Output bit stream: %f Megabits/sec\n",
459
+ (double)yuvSize * 8. / 1000000. * (double)iter / elapsedEncode);
460
+ }
461
+ printf("%s --> Frame rate: %f fps\n",
462
+ doYUV ? "Comp from YUV" : "Compress ",
463
+ (double)iter / elapsed);
464
+ printf(" Output image size: %d bytes\n",
465
+ totalJpegSize);
466
+ printf(" Compression ratio: %f:1\n",
467
+ (double)(w * h * ps) / (double)totalJpegSize);
468
+ printf(" Throughput: %f Megapixels/sec\n",
469
+ (double)(w * h) / 1000000. * (double)iter / elapsed);
470
+ printf(" Output bit stream: %f Megabits/sec\n",
471
+ (double)totalJpegSize * 8. / 1000000. * (double)iter / elapsed);
472
+ }
473
+ if (tilew == w && tileh == h && doWrite) {
474
+ snprintf(tempStr, 1024, "%s_%s_Q%d.jpg", fileName, subName[subsamp],
475
+ jpegQual);
476
+ if ((file = fopen(tempStr, "wb")) == NULL)
477
+ THROW_UNIX("opening reference image");
478
+ if (fwrite(jpegBuf[0], jpegSize[0], 1, file) != 1)
479
+ THROW_UNIX("writing reference image");
480
+ fclose(file); file = NULL;
481
+ if (!quiet) printf("Reference image written to %s\n", tempStr);
482
+ }
483
+
484
+ /* Decompression test */
485
+ if (!compOnly) {
486
+ if (decomp(srcBuf, jpegBuf, jpegSize, tmpBuf, w, h, subsamp, jpegQual,
487
+ fileName, tilew, tileh) == -1)
488
+ goto bailout;
489
+ } else if (quiet == 1) printf("N/A\n");
490
+
491
+ for (i = 0; i < ntilesw * ntilesh; i++) {
492
+ if (jpegBuf[i]) tjFree(jpegBuf[i]);
493
+ jpegBuf[i] = NULL;
494
+ }
495
+ free(jpegBuf); jpegBuf = NULL;
496
+ free(jpegSize); jpegSize = NULL;
497
+ if (doYUV) {
498
+ free(yuvBuf); yuvBuf = NULL;
499
+ }
500
+
501
+ if (tilew == w && tileh == h) break;
502
+ }
503
+
504
+ bailout:
505
+ if (file) { fclose(file); file = NULL; }
506
+ if (jpegBuf) {
507
+ for (i = 0; i < ntilesw * ntilesh; i++) {
508
+ if (jpegBuf[i]) tjFree(jpegBuf[i]);
509
+ jpegBuf[i] = NULL;
510
+ }
511
+ free(jpegBuf); jpegBuf = NULL;
512
+ }
513
+ if (yuvBuf) { free(yuvBuf); yuvBuf = NULL; }
514
+ if (jpegSize) { free(jpegSize); jpegSize = NULL; }
515
+ if (tmpBuf) { free(tmpBuf); tmpBuf = NULL; }
516
+ if (handle) { tjDestroy(handle); handle = NULL; }
517
+ return retval;
518
+ }
519
+
520
+
521
+ static int decompTest(char *fileName)
522
+ {
523
+ FILE *file = NULL;
524
+ tjhandle handle = NULL;
525
+ unsigned char **jpegBuf = NULL, *srcBuf = NULL;
526
+ unsigned long *jpegSize = NULL, srcSize, totalJpegSize;
527
+ tjtransform *t = NULL;
528
+ double start, elapsed;
529
+ int ps = tjPixelSize[pf], tile, row, col, i, iter, retval = 0, decompsrc = 0;
530
+ char *temp = NULL, tempStr[80], tempStr2[80];
531
+ /* Original image */
532
+ int w = 0, h = 0, tilew, tileh, ntilesw = 1, ntilesh = 1, subsamp = -1,
533
+ cs = -1;
534
+ /* Transformed image */
535
+ int tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
536
+
537
+ if ((file = fopen(fileName, "rb")) == NULL)
538
+ THROW_UNIX("opening file");
539
+ if (fseek(file, 0, SEEK_END) < 0 ||
540
+ (srcSize = ftell(file)) == (unsigned long)-1)
541
+ THROW_UNIX("determining file size");
542
+ if ((srcBuf = (unsigned char *)malloc(srcSize)) == NULL)
543
+ THROW_UNIX("allocating memory");
544
+ if (fseek(file, 0, SEEK_SET) < 0)
545
+ THROW_UNIX("setting file position");
546
+ if (fread(srcBuf, srcSize, 1, file) < 1)
547
+ THROW_UNIX("reading JPEG data");
548
+ fclose(file); file = NULL;
549
+
550
+ temp = strrchr(fileName, '.');
551
+ if (temp != NULL) *temp = '\0';
552
+
553
+ if ((handle = tjInitTransform()) == NULL)
554
+ THROW_TJ("executing tjInitTransform()");
555
+ if (tjDecompressHeader3(handle, srcBuf, srcSize, &w, &h, &subsamp,
556
+ &cs) == -1)
557
+ THROW_TJ("executing tjDecompressHeader3()");
558
+ if (w < 1 || h < 1)
559
+ THROW("reading JPEG header", "Invalid image dimensions");
560
+ if (cs == TJCS_YCCK || cs == TJCS_CMYK) {
561
+ pf = TJPF_CMYK; ps = tjPixelSize[pf];
562
+ }
563
+
564
+ if (quiet == 1) {
565
+ printf("All performance values in Mpixels/sec\n\n");
566
+ printf("Bitmap JPEG JPEG %s %s Xform Comp Decomp ",
567
+ doTile ? "Tile " : "Image", doTile ? "Tile " : "Image");
568
+ if (doYUV) printf("Decode");
569
+ printf("\n");
570
+ printf("Format CS Subsamp Width Height Perf Ratio Perf ");
571
+ if (doYUV) printf("Perf");
572
+ printf("\n\n");
573
+ } else if (!quiet)
574
+ printf(">>>>> JPEG %s --> %s (%s) <<<<<\n",
575
+ formatName(subsamp, cs, tempStr), pixFormatStr[pf],
576
+ (flags & TJFLAG_BOTTOMUP) ? "Bottom-up" : "Top-down");
577
+
578
+ for (tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ;
579
+ tilew *= 2, tileh *= 2) {
580
+ if (tilew > w) tilew = w;
581
+ if (tileh > h) tileh = h;
582
+ ntilesw = (w + tilew - 1) / tilew;
583
+ ntilesh = (h + tileh - 1) / tileh;
584
+
585
+ if ((jpegBuf = (unsigned char **)malloc(sizeof(unsigned char *) *
586
+ ntilesw * ntilesh)) == NULL)
587
+ THROW_UNIX("allocating JPEG tile array");
588
+ memset(jpegBuf, 0, sizeof(unsigned char *) * ntilesw * ntilesh);
589
+ if ((jpegSize = (unsigned long *)malloc(sizeof(unsigned long) *
590
+ ntilesw * ntilesh)) == NULL)
591
+ THROW_UNIX("allocating JPEG size array");
592
+ memset(jpegSize, 0, sizeof(unsigned long) * ntilesw * ntilesh);
593
+
594
+ if ((flags & TJFLAG_NOREALLOC) != 0 &&
595
+ (doTile || xformOp != TJXOP_NONE || xformOpt != 0 || customFilter))
596
+ for (i = 0; i < ntilesw * ntilesh; i++) {
597
+ if (tjBufSize(tilew, tileh, subsamp) > (unsigned long)INT_MAX)
598
+ THROW("getting buffer size", "Image is too large");
599
+ if ((jpegBuf[i] = (unsigned char *)
600
+ tjAlloc(tjBufSize(tilew, tileh, subsamp))) == NULL)
601
+ THROW_UNIX("allocating JPEG tiles");
602
+ }
603
+
604
+ tw = w; th = h; ttilew = tilew; ttileh = tileh;
605
+ if (!quiet) {
606
+ printf("\n%s size: %d x %d", doTile ? "Tile" : "Image", ttilew, ttileh);
607
+ if (sf.num != 1 || sf.denom != 1)
608
+ printf(" --> %d x %d", TJSCALED(tw, sf), TJSCALED(th, sf));
609
+ printf("\n");
610
+ } else if (quiet == 1) {
611
+ printf("%-4s (%s) %-5s %-5s ", pixFormatStr[pf],
612
+ (flags & TJFLAG_BOTTOMUP) ? "BU" : "TD", csName[cs],
613
+ subNameLong[subsamp]);
614
+ printf("%-5d %-5d ", tilew, tileh);
615
+ }
616
+
617
+ tsubsamp = subsamp;
618
+ if (doTile || xformOp != TJXOP_NONE || xformOpt != 0 || customFilter) {
619
+ if ((t = (tjtransform *)malloc(sizeof(tjtransform) * ntilesw *
620
+ ntilesh)) == NULL)
621
+ THROW_UNIX("allocating image transform array");
622
+
623
+ if (xformOp == TJXOP_TRANSPOSE || xformOp == TJXOP_TRANSVERSE ||
624
+ xformOp == TJXOP_ROT90 || xformOp == TJXOP_ROT270) {
625
+ tw = h; th = w; ttilew = tileh; ttileh = tilew;
626
+ }
627
+
628
+ if (xformOpt & TJXOPT_GRAY) tsubsamp = TJ_GRAYSCALE;
629
+ if (xformOp == TJXOP_HFLIP || xformOp == TJXOP_ROT180)
630
+ tw = tw - (tw % tjMCUWidth[tsubsamp]);
631
+ if (xformOp == TJXOP_VFLIP || xformOp == TJXOP_ROT180)
632
+ th = th - (th % tjMCUHeight[tsubsamp]);
633
+ if (xformOp == TJXOP_TRANSVERSE || xformOp == TJXOP_ROT90)
634
+ tw = tw - (tw % tjMCUHeight[tsubsamp]);
635
+ if (xformOp == TJXOP_TRANSVERSE || xformOp == TJXOP_ROT270)
636
+ th = th - (th % tjMCUWidth[tsubsamp]);
637
+ tntilesw = (tw + ttilew - 1) / ttilew;
638
+ tntilesh = (th + ttileh - 1) / ttileh;
639
+
640
+ if (xformOp == TJXOP_TRANSPOSE || xformOp == TJXOP_TRANSVERSE ||
641
+ xformOp == TJXOP_ROT90 || xformOp == TJXOP_ROT270) {
642
+ if (tsubsamp == TJSAMP_422) tsubsamp = TJSAMP_440;
643
+ else if (tsubsamp == TJSAMP_440) tsubsamp = TJSAMP_422;
644
+ }
645
+
646
+ for (row = 0, tile = 0; row < tntilesh; row++) {
647
+ for (col = 0; col < tntilesw; col++, tile++) {
648
+ t[tile].r.w = min(ttilew, tw - col * ttilew);
649
+ t[tile].r.h = min(ttileh, th - row * ttileh);
650
+ t[tile].r.x = col * ttilew;
651
+ t[tile].r.y = row * ttileh;
652
+ t[tile].op = xformOp;
653
+ t[tile].options = xformOpt | TJXOPT_TRIM;
654
+ t[tile].customFilter = customFilter;
655
+ if (t[tile].options & TJXOPT_NOOUTPUT && jpegBuf[tile]) {
656
+ tjFree(jpegBuf[tile]); jpegBuf[tile] = NULL;
657
+ }
658
+ }
659
+ }
660
+
661
+ iter = -1;
662
+ elapsed = 0.;
663
+ while (1) {
664
+ start = getTime();
665
+ if (tjTransform(handle, srcBuf, srcSize, tntilesw * tntilesh, jpegBuf,
666
+ jpegSize, t, flags) == -1)
667
+ THROW_TJ("executing tjTransform()");
668
+ elapsed += getTime() - start;
669
+ if (iter >= 0) {
670
+ iter++;
671
+ if (elapsed >= benchTime) break;
672
+ } else if (elapsed >= warmup) {
673
+ iter = 0;
674
+ elapsed = 0.;
675
+ }
676
+ }
677
+
678
+ free(t); t = NULL;
679
+
680
+ for (tile = 0, totalJpegSize = 0; tile < tntilesw * tntilesh; tile++)
681
+ totalJpegSize += jpegSize[tile];
682
+
683
+ if (quiet) {
684
+ printf("%-6s%s%-6s%s",
685
+ sigfig((double)(w * h) / 1000000. / elapsed, 4, tempStr, 80),
686
+ quiet == 2 ? "\n" : " ",
687
+ sigfig((double)(w * h * ps) / (double)totalJpegSize, 4,
688
+ tempStr2, 80),
689
+ quiet == 2 ? "\n" : " ");
690
+ } else if (!quiet) {
691
+ printf("Transform --> Frame rate: %f fps\n",
692
+ 1.0 / elapsed);
693
+ printf(" Output image size: %lu bytes\n",
694
+ totalJpegSize);
695
+ printf(" Compression ratio: %f:1\n",
696
+ (double)(w * h * ps) / (double)totalJpegSize);
697
+ printf(" Throughput: %f Megapixels/sec\n",
698
+ (double)(w * h) / 1000000. / elapsed);
699
+ printf(" Output bit stream: %f Megabits/sec\n",
700
+ (double)totalJpegSize * 8. / 1000000. / elapsed);
701
+ }
702
+ } else {
703
+ if (quiet == 1) printf("N/A N/A ");
704
+ if (jpegBuf[0]) tjFree(jpegBuf[0]);
705
+ jpegBuf[0] = NULL;
706
+ decompsrc = 1;
707
+ }
708
+
709
+ if (w == tilew) ttilew = tw;
710
+ if (h == tileh) ttileh = th;
711
+ if (!(xformOpt & TJXOPT_NOOUTPUT)) {
712
+ if (decomp(NULL, decompsrc ? &srcBuf : jpegBuf,
713
+ decompsrc ? &srcSize : jpegSize, NULL, tw, th, tsubsamp, 0,
714
+ fileName, ttilew, ttileh) == -1)
715
+ goto bailout;
716
+ } else if (quiet == 1) printf("N/A\n");
717
+
718
+ for (i = 0; i < ntilesw * ntilesh; i++) {
719
+ if (jpegBuf[i]) tjFree(jpegBuf[i]);
720
+ jpegBuf[i] = NULL;
721
+ }
722
+ free(jpegBuf); jpegBuf = NULL;
723
+ if (jpegSize) { free(jpegSize); jpegSize = NULL; }
724
+
725
+ if (tilew == w && tileh == h) break;
726
+ }
727
+
728
+ bailout:
729
+ if (file) { fclose(file); file = NULL; }
730
+ if (jpegBuf) {
731
+ for (i = 0; i < ntilesw * ntilesh; i++) {
732
+ if (jpegBuf[i]) tjFree(jpegBuf[i]);
733
+ jpegBuf[i] = NULL;
734
+ }
735
+ free(jpegBuf); jpegBuf = NULL;
736
+ }
737
+ if (jpegSize) { free(jpegSize); jpegSize = NULL; }
738
+ if (srcBuf) { free(srcBuf); srcBuf = NULL; }
739
+ if (t) { free(t); t = NULL; }
740
+ if (handle) { tjDestroy(handle); handle = NULL; }
741
+ return retval;
742
+ }
743
+
744
+
745
+ static void usage(char *progName)
746
+ {
747
+ int i;
748
+
749
+ printf("USAGE: %s\n", progName);
750
+ printf(" <Inputfile (BMP|PPM)> <Quality> [options]\n\n");
751
+ printf(" %s\n", progName);
752
+ printf(" <Inputfile (JPG)> [options]\n\n");
753
+ printf("Options:\n\n");
754
+ printf("-alloc = Dynamically allocate JPEG image buffers\n");
755
+ printf("-bmp = Generate output images in Windows Bitmap format (default = PPM)\n");
756
+ printf("-bottomup = Test bottom-up compression/decompression\n");
757
+ printf("-tile = Test performance of the codec when the image is encoded as separate\n");
758
+ printf(" tiles of varying sizes.\n");
759
+ printf("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =\n");
760
+ printf(" Test the specified color conversion path in the codec (default = BGR)\n");
761
+ printf("-cmyk = Indirectly test YCCK JPEG compression/decompression (the source\n");
762
+ printf(" and destination bitmaps are still RGB. The conversion is done\n");
763
+ printf(" internally prior to compression or after decompression.)\n");
764
+ printf("-fastupsample = Use the fastest chrominance upsampling algorithm available in\n");
765
+ printf(" the underlying codec\n");
766
+ printf("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying\n");
767
+ printf(" codec\n");
768
+ printf("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the\n");
769
+ printf(" underlying codec\n");
770
+ printf("-progressive = Use progressive entropy coding in JPEG images generated by\n");
771
+ printf(" compression and transform operations.\n");
772
+ printf("-subsamp <s> = When testing JPEG compression, this option specifies the level\n");
773
+ printf(" of chrominance subsampling to use (<s> = 444, 422, 440, 420, 411, or\n");
774
+ printf(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in\n");
775
+ printf(" sequence.\n");
776
+ printf("-quiet = Output results in tabular rather than verbose format\n");
777
+ printf("-yuv = Test YUV encoding/decoding functions\n");
778
+ printf("-yuvpad <p> = If testing YUV encoding/decoding, this specifies the number of\n");
779
+ printf(" bytes to which each row of each plane in the intermediate YUV image is\n");
780
+ printf(" padded (default = 1)\n");
781
+ printf("-scale M/N = Scale down the width/height of the decompressed JPEG image by a\n");
782
+ printf(" factor of M/N (M/N = ");
783
+ for (i = 0; i < nsf; i++) {
784
+ printf("%d/%d", scalingFactors[i].num, scalingFactors[i].denom);
785
+ if (nsf == 2 && i != nsf - 1) printf(" or ");
786
+ else if (nsf > 2) {
787
+ if (i != nsf - 1) printf(", ");
788
+ if (i == nsf - 2) printf("or ");
789
+ }
790
+ if (i % 8 == 0 && i != 0) printf("\n ");
791
+ }
792
+ printf(")\n");
793
+ printf("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =\n");
794
+ printf(" Perform the corresponding lossless transform prior to\n");
795
+ printf(" decompression (these options are mutually exclusive)\n");
796
+ printf("-grayscale = Perform lossless grayscale conversion prior to decompression\n");
797
+ printf(" test (can be combined with the other transforms above)\n");
798
+ printf("-copynone = Do not copy any extra markers (including EXIF and ICC profile data)\n");
799
+ printf(" when transforming the image.\n");
800
+ printf("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)\n");
801
+ printf("-warmup <t> = Run each benchmark for <t> seconds (default = 1.0) prior to\n");
802
+ printf(" starting the timer, in order to prime the caches and thus improve the\n");
803
+ printf(" consistency of the results.\n");
804
+ printf("-componly = Stop after running compression tests. Do not test decompression.\n");
805
+ printf("-nowrite = Do not write reference or output images (improves consistency of\n");
806
+ printf(" performance measurements.)\n");
807
+ printf("-stoponwarning = Immediately discontinue the current\n");
808
+ printf(" compression/decompression/transform operation if the underlying codec\n");
809
+ printf(" throws a warning (non-fatal error)\n\n");
810
+ printf("NOTE: If the quality is specified as a range (e.g. 90-100), a separate\n");
811
+ printf("test will be performed for all quality values in the range.\n\n");
812
+ exit(1);
813
+ }
814
+
815
+
816
+ int main(int argc, char *argv[])
817
+ {
818
+ unsigned char *srcBuf = NULL;
819
+ int w = 0, h = 0, i, j, minQual = -1, maxQual = -1;
820
+ char *temp;
821
+ int minArg = 2, retval = 0, subsamp = -1;
822
+
823
+ if ((scalingFactors = tjGetScalingFactors(&nsf)) == NULL || nsf == 0)
824
+ THROW("executing tjGetScalingFactors()", tjGetErrorStr());
825
+
826
+ if (argc < minArg) usage(argv[0]);
827
+
828
+ temp = strrchr(argv[1], '.');
829
+ if (temp != NULL) {
830
+ if (!strcasecmp(temp, ".bmp")) ext = "bmp";
831
+ if (!strcasecmp(temp, ".jpg") || !strcasecmp(temp, ".jpeg"))
832
+ decompOnly = 1;
833
+ }
834
+
835
+ printf("\n");
836
+
837
+ if (!decompOnly) {
838
+ minArg = 3;
839
+ if (argc < minArg) usage(argv[0]);
840
+ if ((minQual = atoi(argv[2])) < 1 || minQual > 100) {
841
+ puts("ERROR: Quality must be between 1 and 100.");
842
+ exit(1);
843
+ }
844
+ if ((temp = strchr(argv[2], '-')) != NULL && strlen(temp) > 1 &&
845
+ sscanf(&temp[1], "%d", &maxQual) == 1 && maxQual > minQual &&
846
+ maxQual >= 1 && maxQual <= 100) {}
847
+ else maxQual = minQual;
848
+ }
849
+
850
+ if (argc > minArg) {
851
+ for (i = minArg; i < argc; i++) {
852
+ if (!strcasecmp(argv[i], "-tile")) {
853
+ doTile = 1; xformOpt |= TJXOPT_CROP;
854
+ } else if (!strcasecmp(argv[i], "-fastupsample")) {
855
+ printf("Using fast upsampling code\n\n");
856
+ flags |= TJFLAG_FASTUPSAMPLE;
857
+ } else if (!strcasecmp(argv[i], "-fastdct")) {
858
+ printf("Using fastest DCT/IDCT algorithm\n\n");
859
+ flags |= TJFLAG_FASTDCT;
860
+ } else if (!strcasecmp(argv[i], "-accuratedct")) {
861
+ printf("Using most accurate DCT/IDCT algorithm\n\n");
862
+ flags |= TJFLAG_ACCURATEDCT;
863
+ } else if (!strcasecmp(argv[i], "-progressive")) {
864
+ printf("Using progressive entropy coding\n\n");
865
+ flags |= TJFLAG_PROGRESSIVE;
866
+ } else if (!strcasecmp(argv[i], "-rgb"))
867
+ pf = TJPF_RGB;
868
+ else if (!strcasecmp(argv[i], "-rgbx"))
869
+ pf = TJPF_RGBX;
870
+ else if (!strcasecmp(argv[i], "-bgr"))
871
+ pf = TJPF_BGR;
872
+ else if (!strcasecmp(argv[i], "-bgrx"))
873
+ pf = TJPF_BGRX;
874
+ else if (!strcasecmp(argv[i], "-xbgr"))
875
+ pf = TJPF_XBGR;
876
+ else if (!strcasecmp(argv[i], "-xrgb"))
877
+ pf = TJPF_XRGB;
878
+ else if (!strcasecmp(argv[i], "-cmyk"))
879
+ pf = TJPF_CMYK;
880
+ else if (!strcasecmp(argv[i], "-bottomup"))
881
+ flags |= TJFLAG_BOTTOMUP;
882
+ else if (!strcasecmp(argv[i], "-quiet"))
883
+ quiet = 1;
884
+ else if (!strcasecmp(argv[i], "-qq"))
885
+ quiet = 2;
886
+ else if (!strcasecmp(argv[i], "-scale") && i < argc - 1) {
887
+ int temp1 = 0, temp2 = 0, match = 0;
888
+
889
+ if (sscanf(argv[++i], "%d/%d", &temp1, &temp2) == 2) {
890
+ for (j = 0; j < nsf; j++) {
891
+ if ((double)temp1 / (double)temp2 ==
892
+ (double)scalingFactors[j].num /
893
+ (double)scalingFactors[j].denom) {
894
+ sf = scalingFactors[j];
895
+ match = 1; break;
896
+ }
897
+ }
898
+ if (!match) usage(argv[0]);
899
+ } else usage(argv[0]);
900
+ } else if (!strcasecmp(argv[i], "-hflip"))
901
+ xformOp = TJXOP_HFLIP;
902
+ else if (!strcasecmp(argv[i], "-vflip"))
903
+ xformOp = TJXOP_VFLIP;
904
+ else if (!strcasecmp(argv[i], "-transpose"))
905
+ xformOp = TJXOP_TRANSPOSE;
906
+ else if (!strcasecmp(argv[i], "-transverse"))
907
+ xformOp = TJXOP_TRANSVERSE;
908
+ else if (!strcasecmp(argv[i], "-rot90"))
909
+ xformOp = TJXOP_ROT90;
910
+ else if (!strcasecmp(argv[i], "-rot180"))
911
+ xformOp = TJXOP_ROT180;
912
+ else if (!strcasecmp(argv[i], "-rot270"))
913
+ xformOp = TJXOP_ROT270;
914
+ else if (!strcasecmp(argv[i], "-grayscale"))
915
+ xformOpt |= TJXOPT_GRAY;
916
+ else if (!strcasecmp(argv[i], "-custom"))
917
+ customFilter = dummyDCTFilter;
918
+ else if (!strcasecmp(argv[i], "-nooutput"))
919
+ xformOpt |= TJXOPT_NOOUTPUT;
920
+ else if (!strcasecmp(argv[i], "-copynone"))
921
+ xformOpt |= TJXOPT_COPYNONE;
922
+ else if (!strcasecmp(argv[i], "-benchtime") && i < argc - 1) {
923
+ double tempd = atof(argv[++i]);
924
+
925
+ if (tempd > 0.0) benchTime = tempd;
926
+ else usage(argv[0]);
927
+ } else if (!strcasecmp(argv[i], "-warmup") && i < argc - 1) {
928
+ double tempd = atof(argv[++i]);
929
+
930
+ if (tempd >= 0.0) warmup = tempd;
931
+ else usage(argv[0]);
932
+ printf("Warmup time = %.1f seconds\n\n", warmup);
933
+ } else if (!strcasecmp(argv[i], "-alloc"))
934
+ flags &= (~TJFLAG_NOREALLOC);
935
+ else if (!strcasecmp(argv[i], "-bmp"))
936
+ ext = "bmp";
937
+ else if (!strcasecmp(argv[i], "-yuv")) {
938
+ printf("Testing YUV planar encoding/decoding\n\n");
939
+ doYUV = 1;
940
+ } else if (!strcasecmp(argv[i], "-yuvpad") && i < argc - 1) {
941
+ int tempi = atoi(argv[++i]);
942
+
943
+ if (tempi >= 1) yuvPad = tempi;
944
+ } else if (!strcasecmp(argv[i], "-subsamp") && i < argc - 1) {
945
+ i++;
946
+ if (toupper(argv[i][0]) == 'G') subsamp = TJSAMP_GRAY;
947
+ else {
948
+ int tempi = atoi(argv[i]);
949
+
950
+ switch (tempi) {
951
+ case 444: subsamp = TJSAMP_444; break;
952
+ case 422: subsamp = TJSAMP_422; break;
953
+ case 440: subsamp = TJSAMP_440; break;
954
+ case 420: subsamp = TJSAMP_420; break;
955
+ case 411: subsamp = TJSAMP_411; break;
956
+ }
957
+ }
958
+ } else if (!strcasecmp(argv[i], "-componly"))
959
+ compOnly = 1;
960
+ else if (!strcasecmp(argv[i], "-nowrite"))
961
+ doWrite = 0;
962
+ else if (!strcasecmp(argv[i], "-stoponwarning"))
963
+ flags |= TJFLAG_STOPONWARNING;
964
+ else usage(argv[0]);
965
+ }
966
+ }
967
+
968
+ if ((sf.num != 1 || sf.denom != 1) && doTile) {
969
+ printf("Disabling tiled compression/decompression tests, because those tests do not\n");
970
+ printf("work when scaled decompression is enabled.\n");
971
+ doTile = 0;
972
+ }
973
+
974
+ if ((flags & TJFLAG_NOREALLOC) == 0 && doTile) {
975
+ printf("Disabling tiled compression/decompression tests, because those tests do not\n");
976
+ printf("work when dynamic JPEG buffer allocation is enabled.\n\n");
977
+ doTile = 0;
978
+ }
979
+
980
+ if (!decompOnly) {
981
+ if ((srcBuf = tjLoadImage(argv[1], &w, 1, &h, &pf, flags)) == NULL)
982
+ THROW_TJG("loading bitmap");
983
+ temp = strrchr(argv[1], '.');
984
+ if (temp != NULL) *temp = '\0';
985
+ }
986
+
987
+ if (quiet == 1 && !decompOnly) {
988
+ printf("All performance values in Mpixels/sec\n\n");
989
+ printf("Bitmap JPEG JPEG %s %s ",
990
+ doTile ? "Tile " : "Image", doTile ? "Tile " : "Image");
991
+ if (doYUV) printf("Encode ");
992
+ printf("Comp Comp Decomp ");
993
+ if (doYUV) printf("Decode");
994
+ printf("\n");
995
+ printf("Format Subsamp Qual Width Height ");
996
+ if (doYUV) printf("Perf ");
997
+ printf("Perf Ratio Perf ");
998
+ if (doYUV) printf("Perf");
999
+ printf("\n\n");
1000
+ }
1001
+
1002
+ if (decompOnly) {
1003
+ decompTest(argv[1]);
1004
+ printf("\n");
1005
+ goto bailout;
1006
+ }
1007
+ if (subsamp >= 0 && subsamp < TJ_NUMSAMP) {
1008
+ for (i = maxQual; i >= minQual; i--)
1009
+ fullTest(srcBuf, w, h, subsamp, i, argv[1]);
1010
+ printf("\n");
1011
+ } else {
1012
+ if (pf != TJPF_CMYK) {
1013
+ for (i = maxQual; i >= minQual; i--)
1014
+ fullTest(srcBuf, w, h, TJSAMP_GRAY, i, argv[1]);
1015
+ printf("\n");
1016
+ }
1017
+ for (i = maxQual; i >= minQual; i--)
1018
+ fullTest(srcBuf, w, h, TJSAMP_420, i, argv[1]);
1019
+ printf("\n");
1020
+ for (i = maxQual; i >= minQual; i--)
1021
+ fullTest(srcBuf, w, h, TJSAMP_422, i, argv[1]);
1022
+ printf("\n");
1023
+ for (i = maxQual; i >= minQual; i--)
1024
+ fullTest(srcBuf, w, h, TJSAMP_444, i, argv[1]);
1025
+ printf("\n");
1026
+ }
1027
+
1028
+ bailout:
1029
+ if (srcBuf) tjFree(srcBuf);
1030
+ return retval;
1031
+ }