epeg 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,931 @@
1
+ /*
2
+ * Copyright (C)2011-2015, 2018 D. R. Commander. All Rights Reserved.
3
+ * Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * - Redistributions of source code must retain the above copyright notice,
9
+ * this list of conditions and the following disclaimer.
10
+ * - Redistributions in binary form must reproduce the above copyright notice,
11
+ * this list of conditions and the following disclaimer in the documentation
12
+ * and/or other materials provided with the distribution.
13
+ * - Neither the name of the libjpeg-turbo Project nor the names of its
14
+ * contributors may be used to endorse or promote products derived from this
15
+ * software without specific prior written permission.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
18
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
21
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
+ * POSSIBILITY OF SUCH DAMAGE.
28
+ */
29
+
30
+ package org.libjpegturbo.turbojpeg;
31
+
32
+ import java.awt.image.*;
33
+ import java.nio.*;
34
+ import java.io.*;
35
+
36
+ /**
37
+ * TurboJPEG decompressor
38
+ */
39
+ public class TJDecompressor implements Closeable {
40
+
41
+ private static final String NO_ASSOC_ERROR =
42
+ "No JPEG image is associated with this instance";
43
+
44
+ /**
45
+ * Create a TurboJPEG decompresssor instance.
46
+ */
47
+ public TJDecompressor() throws TJException {
48
+ init();
49
+ }
50
+
51
+ /**
52
+ * Create a TurboJPEG decompressor instance and associate the JPEG source
53
+ * image stored in <code>jpegImage</code> with the newly created instance.
54
+ *
55
+ * @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
56
+ * be the length of the array.) This buffer is not modified.
57
+ */
58
+ public TJDecompressor(byte[] jpegImage) throws TJException {
59
+ init();
60
+ setSourceImage(jpegImage, jpegImage.length);
61
+ }
62
+
63
+ /**
64
+ * Create a TurboJPEG decompressor instance and associate the JPEG source
65
+ * image of length <code>imageSize</code> bytes stored in
66
+ * <code>jpegImage</code> with the newly created instance.
67
+ *
68
+ * @param jpegImage JPEG image buffer. This buffer is not modified.
69
+ *
70
+ * @param imageSize size of the JPEG image (in bytes)
71
+ */
72
+ public TJDecompressor(byte[] jpegImage, int imageSize) throws TJException {
73
+ init();
74
+ setSourceImage(jpegImage, imageSize);
75
+ }
76
+
77
+ /**
78
+ * Create a TurboJPEG decompressor instance and associate the YUV planar
79
+ * source image stored in <code>yuvImage</code> with the newly created
80
+ * instance.
81
+ *
82
+ * @param yuvImage {@link YUVImage} instance containing a YUV planar
83
+ * image to be decoded. This image is not modified.
84
+ */
85
+ @SuppressWarnings("checkstyle:HiddenField")
86
+ public TJDecompressor(YUVImage yuvImage) throws TJException {
87
+ init();
88
+ setSourceImage(yuvImage);
89
+ }
90
+
91
+ /**
92
+ * Associate the JPEG image of length <code>imageSize</code> bytes stored in
93
+ * <code>jpegImage</code> with this decompressor instance. This image will
94
+ * be used as the source image for subsequent decompress operations.
95
+ *
96
+ * @param jpegImage JPEG image buffer. This buffer is not modified.
97
+ *
98
+ * @param imageSize size of the JPEG image (in bytes)
99
+ */
100
+ public void setSourceImage(byte[] jpegImage, int imageSize)
101
+ throws TJException {
102
+ if (jpegImage == null || imageSize < 1)
103
+ throw new IllegalArgumentException("Invalid argument in setSourceImage()");
104
+ jpegBuf = jpegImage;
105
+ jpegBufSize = imageSize;
106
+ decompressHeader(jpegBuf, jpegBufSize);
107
+ yuvImage = null;
108
+ }
109
+
110
+ /**
111
+ * @deprecated Use {@link #setSourceImage(byte[], int)} instead.
112
+ */
113
+ @SuppressWarnings("checkstyle:JavadocMethod")
114
+ @Deprecated
115
+ public void setJPEGImage(byte[] jpegImage, int imageSize)
116
+ throws TJException {
117
+ setSourceImage(jpegImage, imageSize);
118
+ }
119
+
120
+ /**
121
+ * Associate the specified YUV planar source image with this decompressor
122
+ * instance. Subsequent decompress operations will decode this image into an
123
+ * RGB or grayscale destination image.
124
+ *
125
+ * @param srcImage {@link YUVImage} instance containing a YUV planar image to
126
+ * be decoded. This image is not modified.
127
+ */
128
+ public void setSourceImage(YUVImage srcImage) {
129
+ if (srcImage == null)
130
+ throw new IllegalArgumentException("Invalid argument in setSourceImage()");
131
+ yuvImage = srcImage;
132
+ jpegBuf = null;
133
+ jpegBufSize = 0;
134
+ }
135
+
136
+
137
+ /**
138
+ * Returns the width of the source image (JPEG or YUV) associated with this
139
+ * decompressor instance.
140
+ *
141
+ * @return the width of the source image (JPEG or YUV) associated with this
142
+ * decompressor instance.
143
+ */
144
+ public int getWidth() {
145
+ if (yuvImage != null)
146
+ return yuvImage.getWidth();
147
+ if (jpegWidth < 1)
148
+ throw new IllegalStateException(NO_ASSOC_ERROR);
149
+ return jpegWidth;
150
+ }
151
+
152
+ /**
153
+ * Returns the height of the source image (JPEG or YUV) associated with this
154
+ * decompressor instance.
155
+ *
156
+ * @return the height of the source image (JPEG or YUV) associated with this
157
+ * decompressor instance.
158
+ */
159
+ public int getHeight() {
160
+ if (yuvImage != null)
161
+ return yuvImage.getHeight();
162
+ if (jpegHeight < 1)
163
+ throw new IllegalStateException(NO_ASSOC_ERROR);
164
+ return jpegHeight;
165
+ }
166
+
167
+ /**
168
+ * Returns the level of chrominance subsampling used in the source image
169
+ * (JPEG or YUV) associated with this decompressor instance. See
170
+ * {@link TJ#SAMP_444 TJ.SAMP_*}.
171
+ *
172
+ * @return the level of chrominance subsampling used in the source image
173
+ * (JPEG or YUV) associated with this decompressor instance.
174
+ */
175
+ public int getSubsamp() {
176
+ if (yuvImage != null)
177
+ return yuvImage.getSubsamp();
178
+ if (jpegSubsamp < 0)
179
+ throw new IllegalStateException(NO_ASSOC_ERROR);
180
+ if (jpegSubsamp >= TJ.NUMSAMP)
181
+ throw new IllegalStateException("JPEG header information is invalid");
182
+ return jpegSubsamp;
183
+ }
184
+
185
+ /**
186
+ * Returns the colorspace used in the source image (JPEG or YUV) associated
187
+ * with this decompressor instance. See {@link TJ#CS_RGB TJ.CS_*}. If the
188
+ * source image is YUV, then this always returns {@link TJ#CS_YCbCr}.
189
+ *
190
+ * @return the colorspace used in the source image (JPEG or YUV) associated
191
+ * with this decompressor instance.
192
+ */
193
+ public int getColorspace() {
194
+ if (yuvImage != null)
195
+ return TJ.CS_YCbCr;
196
+ if (jpegColorspace < 0)
197
+ throw new IllegalStateException(NO_ASSOC_ERROR);
198
+ if (jpegColorspace >= TJ.NUMCS)
199
+ throw new IllegalStateException("JPEG header information is invalid");
200
+ return jpegColorspace;
201
+ }
202
+
203
+ /**
204
+ * Returns the JPEG image buffer associated with this decompressor instance.
205
+ *
206
+ * @return the JPEG image buffer associated with this decompressor instance.
207
+ */
208
+ public byte[] getJPEGBuf() {
209
+ if (jpegBuf == null)
210
+ throw new IllegalStateException(NO_ASSOC_ERROR);
211
+ return jpegBuf;
212
+ }
213
+
214
+ /**
215
+ * Returns the size of the JPEG image (in bytes) associated with this
216
+ * decompressor instance.
217
+ *
218
+ * @return the size of the JPEG image (in bytes) associated with this
219
+ * decompressor instance.
220
+ */
221
+ public int getJPEGSize() {
222
+ if (jpegBufSize < 1)
223
+ throw new IllegalStateException(NO_ASSOC_ERROR);
224
+ return jpegBufSize;
225
+ }
226
+
227
+ /**
228
+ * Returns the width of the largest scaled-down image that the TurboJPEG
229
+ * decompressor can generate without exceeding the desired image width and
230
+ * height.
231
+ *
232
+ * @param desiredWidth desired width (in pixels) of the decompressed image.
233
+ * Setting this to 0 is the same as setting it to the width of the JPEG image
234
+ * (in other words, the width will not be considered when determining the
235
+ * scaled image size.)
236
+ *
237
+ * @param desiredHeight desired height (in pixels) of the decompressed image.
238
+ * Setting this to 0 is the same as setting it to the height of the JPEG
239
+ * image (in other words, the height will not be considered when determining
240
+ * the scaled image size.)
241
+ *
242
+ * @return the width of the largest scaled-down image that the TurboJPEG
243
+ * decompressor can generate without exceeding the desired image width and
244
+ * height.
245
+ */
246
+ public int getScaledWidth(int desiredWidth, int desiredHeight) {
247
+ if (jpegWidth < 1 || jpegHeight < 1)
248
+ throw new IllegalStateException(NO_ASSOC_ERROR);
249
+ if (desiredWidth < 0 || desiredHeight < 0)
250
+ throw new IllegalArgumentException("Invalid argument in getScaledWidth()");
251
+ TJScalingFactor[] sf = TJ.getScalingFactors();
252
+ if (desiredWidth == 0)
253
+ desiredWidth = jpegWidth;
254
+ if (desiredHeight == 0)
255
+ desiredHeight = jpegHeight;
256
+ int scaledWidth = jpegWidth, scaledHeight = jpegHeight;
257
+ for (int i = 0; i < sf.length; i++) {
258
+ scaledWidth = sf[i].getScaled(jpegWidth);
259
+ scaledHeight = sf[i].getScaled(jpegHeight);
260
+ if (scaledWidth <= desiredWidth && scaledHeight <= desiredHeight)
261
+ break;
262
+ }
263
+ if (scaledWidth > desiredWidth || scaledHeight > desiredHeight)
264
+ throw new IllegalArgumentException("Could not scale down to desired image dimensions");
265
+ return scaledWidth;
266
+ }
267
+
268
+ /**
269
+ * Returns the height of the largest scaled-down image that the TurboJPEG
270
+ * decompressor can generate without exceeding the desired image width and
271
+ * height.
272
+ *
273
+ * @param desiredWidth desired width (in pixels) of the decompressed image.
274
+ * Setting this to 0 is the same as setting it to the width of the JPEG image
275
+ * (in other words, the width will not be considered when determining the
276
+ * scaled image size.)
277
+ *
278
+ * @param desiredHeight desired height (in pixels) of the decompressed image.
279
+ * Setting this to 0 is the same as setting it to the height of the JPEG
280
+ * image (in other words, the height will not be considered when determining
281
+ * the scaled image size.)
282
+ *
283
+ * @return the height of the largest scaled-down image that the TurboJPEG
284
+ * decompressor can generate without exceeding the desired image width and
285
+ * height.
286
+ */
287
+ public int getScaledHeight(int desiredWidth, int desiredHeight) {
288
+ if (jpegWidth < 1 || jpegHeight < 1)
289
+ throw new IllegalStateException(NO_ASSOC_ERROR);
290
+ if (desiredWidth < 0 || desiredHeight < 0)
291
+ throw new IllegalArgumentException("Invalid argument in getScaledHeight()");
292
+ TJScalingFactor[] sf = TJ.getScalingFactors();
293
+ if (desiredWidth == 0)
294
+ desiredWidth = jpegWidth;
295
+ if (desiredHeight == 0)
296
+ desiredHeight = jpegHeight;
297
+ int scaledWidth = jpegWidth, scaledHeight = jpegHeight;
298
+ for (int i = 0; i < sf.length; i++) {
299
+ scaledWidth = sf[i].getScaled(jpegWidth);
300
+ scaledHeight = sf[i].getScaled(jpegHeight);
301
+ if (scaledWidth <= desiredWidth && scaledHeight <= desiredHeight)
302
+ break;
303
+ }
304
+ if (scaledWidth > desiredWidth || scaledHeight > desiredHeight)
305
+ throw new IllegalArgumentException("Could not scale down to desired image dimensions");
306
+ return scaledHeight;
307
+ }
308
+
309
+ /**
310
+ * Decompress the JPEG source image or decode the YUV source image associated
311
+ * with this decompressor instance and output a grayscale, RGB, or CMYK image
312
+ * to the given destination buffer.
313
+ * <p>
314
+ * NOTE: The output image is fully recoverable if this method throws a
315
+ * non-fatal {@link TJException} (unless
316
+ * {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
317
+ *
318
+ * @param dstBuf buffer that will receive the decompressed/decoded image.
319
+ * If the source image is a JPEG image, then this buffer should normally be
320
+ * <code>pitch * scaledHeight</code> bytes in size, where
321
+ * <code>scaledHeight</code> can be determined by calling <code>
322
+ * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
323
+ * </code> with one of the scaling factors returned from {@link
324
+ * TJ#getScalingFactors} or by calling {@link #getScaledHeight}. If the
325
+ * source image is a YUV image, then this buffer should normally be
326
+ * <code>pitch * height</code> bytes in size, where <code>height</code> is
327
+ * the height of the YUV image. However, the buffer may also be larger than
328
+ * the dimensions of the source image, in which case the <code>x</code>,
329
+ * <code>y</code>, and <code>pitch</code> parameters can be used to specify
330
+ * the region into which the source image should be decompressed/decoded.
331
+ *
332
+ * @param x x offset (in pixels) of the region in the destination image into
333
+ * which the source image should be decompressed/decoded
334
+ *
335
+ * @param y y offset (in pixels) of the region in the destination image into
336
+ * which the source image should be decompressed/decoded
337
+ *
338
+ * @param desiredWidth If the source image is a JPEG image, then this
339
+ * specifies the desired width (in pixels) of the decompressed image (or
340
+ * image region.) If the desired destination image dimensions are different
341
+ * than the source image dimensions, then TurboJPEG will use scaling in the
342
+ * JPEG decompressor to generate the largest possible image that will fit
343
+ * within the desired dimensions. Setting this to 0 is the same as setting
344
+ * it to the width of the JPEG image (in other words, the width will not be
345
+ * considered when determining the scaled image size.) This parameter is
346
+ * ignored if the source image is a YUV image.
347
+ *
348
+ * @param pitch bytes per line of the destination image. Normally, this
349
+ * should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
350
+ * the destination image is unpadded, but you can use this to, for instance,
351
+ * pad each line of the destination image to a 4-byte boundary or to
352
+ * decompress/decode the source image into a region of a larger image. NOTE:
353
+ * if the source image is a JPEG image, then <code>scaledWidth</code> can be
354
+ * determined by calling <code>
355
+ * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
356
+ * </code> or by calling {@link #getScaledWidth}. If the source image is a
357
+ * YUV image, then <code>scaledWidth</code> is the width of the YUV image.
358
+ * Setting this parameter to 0 is the equivalent of setting it to
359
+ * <code>scaledWidth * TJ.pixelSize(pixelFormat)</code>.
360
+ *
361
+ * @param desiredHeight If the source image is a JPEG image, then this
362
+ * specifies the desired height (in pixels) of the decompressed image (or
363
+ * image region.) If the desired destination image dimensions are different
364
+ * than the source image dimensions, then TurboJPEG will use scaling in the
365
+ * JPEG decompressor to generate the largest possible image that will fit
366
+ * within the desired dimensions. Setting this to 0 is the same as setting
367
+ * it to the height of the JPEG image (in other words, the height will not be
368
+ * considered when determining the scaled image size.) This parameter is
369
+ * ignored if the source image is a YUV image.
370
+ *
371
+ * @param pixelFormat pixel format of the decompressed/decoded image (one of
372
+ * {@link TJ#PF_RGB TJ.PF_*})
373
+ *
374
+ * @param flags the bitwise OR of one or more of
375
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
376
+ */
377
+ public void decompress(byte[] dstBuf, int x, int y, int desiredWidth,
378
+ int pitch, int desiredHeight, int pixelFormat,
379
+ int flags) throws TJException {
380
+ if (jpegBuf == null && yuvImage == null)
381
+ throw new IllegalStateException(NO_ASSOC_ERROR);
382
+ if (dstBuf == null || x < 0 || y < 0 || pitch < 0 ||
383
+ (yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) ||
384
+ pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
385
+ throw new IllegalArgumentException("Invalid argument in decompress()");
386
+ if (yuvImage != null)
387
+ decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(),
388
+ yuvImage.getStrides(), yuvImage.getSubsamp(), dstBuf, x, y,
389
+ yuvImage.getWidth(), pitch, yuvImage.getHeight(), pixelFormat,
390
+ flags);
391
+ else {
392
+ if (x > 0 || y > 0)
393
+ decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch,
394
+ desiredHeight, pixelFormat, flags);
395
+ else
396
+ decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch,
397
+ desiredHeight, pixelFormat, flags);
398
+ }
399
+ }
400
+
401
+ /**
402
+ * @deprecated Use
403
+ * {@link #decompress(byte[], int, int, int, int, int, int, int)} instead.
404
+ */
405
+ @SuppressWarnings("checkstyle:JavadocMethod")
406
+ @Deprecated
407
+ public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
408
+ int desiredHeight, int pixelFormat, int flags)
409
+ throws TJException {
410
+ decompress(dstBuf, 0, 0, desiredWidth, pitch, desiredHeight, pixelFormat,
411
+ flags);
412
+ }
413
+
414
+ /**
415
+ * Decompress the JPEG source image associated with this decompressor
416
+ * instance and return a buffer containing the decompressed image.
417
+ *
418
+ * @param desiredWidth see
419
+ * {@link #decompress(byte[], int, int, int, int, int, int, int)}
420
+ * for description
421
+ *
422
+ * @param pitch see
423
+ * {@link #decompress(byte[], int, int, int, int, int, int, int)}
424
+ * for description
425
+ *
426
+ * @param desiredHeight see
427
+ * {@link #decompress(byte[], int, int, int, int, int, int, int)}
428
+ * for description
429
+ *
430
+ * @param pixelFormat pixel format of the decompressed image (one of
431
+ * {@link TJ#PF_RGB TJ.PF_*})
432
+ *
433
+ * @param flags the bitwise OR of one or more of
434
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
435
+ *
436
+ * @return a buffer containing the decompressed image.
437
+ */
438
+ public byte[] decompress(int desiredWidth, int pitch, int desiredHeight,
439
+ int pixelFormat, int flags) throws TJException {
440
+ if (pitch < 0 ||
441
+ (yuvImage == null && (desiredWidth < 0 || desiredHeight < 0)) ||
442
+ pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
443
+ throw new IllegalArgumentException("Invalid argument in decompress()");
444
+ int pixelSize = TJ.getPixelSize(pixelFormat);
445
+ int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
446
+ int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
447
+ if (pitch == 0)
448
+ pitch = scaledWidth * pixelSize;
449
+ byte[] buf = new byte[pitch * scaledHeight];
450
+ decompress(buf, desiredWidth, pitch, desiredHeight, pixelFormat, flags);
451
+ return buf;
452
+ }
453
+
454
+ /**
455
+ * Decompress the JPEG source image associated with this decompressor
456
+ * instance into a YUV planar image and store it in the given
457
+ * <code>YUVImage</code> instance. This method performs JPEG decompression
458
+ * but leaves out the color conversion step, so a planar YUV image is
459
+ * generated instead of an RGB or grayscale image. This method cannot be
460
+ * used to decompress JPEG source images with the CMYK or YCCK colorspace.
461
+ * <p>
462
+ * NOTE: The YUV planar output image is fully recoverable if this method
463
+ * throws a non-fatal {@link TJException} (unless
464
+ * {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
465
+ *
466
+ * @param dstImage {@link YUVImage} instance that will receive the YUV planar
467
+ * image. The level of subsampling specified in this <code>YUVImage</code>
468
+ * instance must match that of the JPEG image, and the width and height
469
+ * specified in the <code>YUVImage</code> instance must match one of the
470
+ * scaled image sizes that TurboJPEG is capable of generating from the JPEG
471
+ * source image.
472
+ *
473
+ * @param flags the bitwise OR of one or more of
474
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
475
+ */
476
+ public void decompressToYUV(YUVImage dstImage, int flags)
477
+ throws TJException {
478
+ if (jpegBuf == null)
479
+ throw new IllegalStateException(NO_ASSOC_ERROR);
480
+ if (dstImage == null || flags < 0)
481
+ throw new IllegalArgumentException("Invalid argument in decompressToYUV()");
482
+ int scaledWidth = getScaledWidth(dstImage.getWidth(),
483
+ dstImage.getHeight());
484
+ int scaledHeight = getScaledHeight(dstImage.getWidth(),
485
+ dstImage.getHeight());
486
+ if (scaledWidth != dstImage.getWidth() ||
487
+ scaledHeight != dstImage.getHeight())
488
+ throw new IllegalArgumentException("YUVImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating.");
489
+ if (jpegSubsamp != dstImage.getSubsamp())
490
+ throw new IllegalArgumentException("YUVImage subsampling level does not match that of the JPEG image");
491
+
492
+ decompressToYUV(jpegBuf, jpegBufSize, dstImage.getPlanes(),
493
+ dstImage.getOffsets(), dstImage.getWidth(),
494
+ dstImage.getStrides(), dstImage.getHeight(), flags);
495
+ }
496
+
497
+ /**
498
+ * @deprecated Use {@link #decompressToYUV(YUVImage, int)} instead.
499
+ */
500
+ @SuppressWarnings("checkstyle:JavadocMethod")
501
+ @Deprecated
502
+ public void decompressToYUV(byte[] dstBuf, int flags) throws TJException {
503
+ YUVImage dstYUVImage = new YUVImage(dstBuf, jpegWidth, 4, jpegHeight,
504
+ jpegSubsamp);
505
+ decompressToYUV(dstYUVImage, flags);
506
+ }
507
+
508
+ /**
509
+ * Decompress the JPEG source image associated with this decompressor
510
+ * instance into a set of Y, U (Cb), and V (Cr) image planes and return a
511
+ * <code>YUVImage</code> instance containing the decompressed image planes.
512
+ * This method performs JPEG decompression but leaves out the color
513
+ * conversion step, so a planar YUV image is generated instead of an RGB or
514
+ * grayscale image. This method cannot be used to decompress JPEG source
515
+ * images with the CMYK or YCCK colorspace.
516
+ *
517
+ * @param desiredWidth desired width (in pixels) of the YUV image. If the
518
+ * desired image dimensions are different than the dimensions of the JPEG
519
+ * image being decompressed, then TurboJPEG will use scaling in the JPEG
520
+ * decompressor to generate the largest possible image that will fit within
521
+ * the desired dimensions. Setting this to 0 is the same as setting it to
522
+ * the width of the JPEG image (in other words, the width will not be
523
+ * considered when determining the scaled image size.)
524
+ *
525
+ * @param strides an array of integers, each specifying the number of bytes
526
+ * per line in the corresponding plane of the output image. Setting the
527
+ * stride for any plane to 0 is the same as setting it to the scaled
528
+ * component width of the plane. If <tt>strides</tt> is NULL, then the
529
+ * strides for all planes will be set to their respective scaled component
530
+ * widths. You can adjust the strides in order to add an arbitrary amount of
531
+ * line padding to each plane.
532
+ *
533
+ * @param desiredHeight desired height (in pixels) of the YUV image. If the
534
+ * desired image dimensions are different than the dimensions of the JPEG
535
+ * image being decompressed, then TurboJPEG will use scaling in the JPEG
536
+ * decompressor to generate the largest possible image that will fit within
537
+ * the desired dimensions. Setting this to 0 is the same as setting it to
538
+ * the height of the JPEG image (in other words, the height will not be
539
+ * considered when determining the scaled image size.)
540
+ *
541
+ * @param flags the bitwise OR of one or more of
542
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
543
+ *
544
+ * @return a YUV planar image.
545
+ */
546
+ public YUVImage decompressToYUV(int desiredWidth, int[] strides,
547
+ int desiredHeight,
548
+ int flags) throws TJException {
549
+ if (flags < 0)
550
+ throw new IllegalArgumentException("Invalid argument in decompressToYUV()");
551
+ if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
552
+ throw new IllegalStateException(NO_ASSOC_ERROR);
553
+ if (jpegSubsamp >= TJ.NUMSAMP)
554
+ throw new IllegalStateException("JPEG header information is invalid");
555
+ if (yuvImage != null)
556
+ throw new IllegalStateException("Source image is the wrong type");
557
+
558
+ int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
559
+ int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
560
+ YUVImage dstYUVImage = new YUVImage(scaledWidth, null, scaledHeight,
561
+ jpegSubsamp);
562
+ decompressToYUV(dstYUVImage, flags);
563
+ return dstYUVImage;
564
+ }
565
+
566
+ /**
567
+ * Decompress the JPEG source image associated with this decompressor
568
+ * instance into a unified YUV planar image buffer and return a
569
+ * <code>YUVImage</code> instance containing the decompressed image. This
570
+ * method performs JPEG decompression but leaves out the color conversion
571
+ * step, so a planar YUV image is generated instead of an RGB or grayscale
572
+ * image. This method cannot be used to decompress JPEG source images with
573
+ * the CMYK or YCCK colorspace.
574
+ *
575
+ * @param desiredWidth desired width (in pixels) of the YUV image. If the
576
+ * desired image dimensions are different than the dimensions of the JPEG
577
+ * image being decompressed, then TurboJPEG will use scaling in the JPEG
578
+ * decompressor to generate the largest possible image that will fit within
579
+ * the desired dimensions. Setting this to 0 is the same as setting it to
580
+ * the width of the JPEG image (in other words, the width will not be
581
+ * considered when determining the scaled image size.)
582
+ *
583
+ * @param pad the width of each line in each plane of the YUV image will be
584
+ * padded to the nearest multiple of this number of bytes (must be a power of
585
+ * 2.)
586
+ *
587
+ * @param desiredHeight desired height (in pixels) of the YUV image. If the
588
+ * desired image dimensions are different than the dimensions of the JPEG
589
+ * image being decompressed, then TurboJPEG will use scaling in the JPEG
590
+ * decompressor to generate the largest possible image that will fit within
591
+ * the desired dimensions. Setting this to 0 is the same as setting it to
592
+ * the height of the JPEG image (in other words, the height will not be
593
+ * considered when determining the scaled image size.)
594
+ *
595
+ * @param flags the bitwise OR of one or more of
596
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
597
+ *
598
+ * @return a YUV planar image.
599
+ */
600
+ public YUVImage decompressToYUV(int desiredWidth, int pad, int desiredHeight,
601
+ int flags) throws TJException {
602
+ if (flags < 0)
603
+ throw new IllegalArgumentException("Invalid argument in decompressToYUV()");
604
+ if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
605
+ throw new IllegalStateException(NO_ASSOC_ERROR);
606
+ if (jpegSubsamp >= TJ.NUMSAMP)
607
+ throw new IllegalStateException("JPEG header information is invalid");
608
+ if (yuvImage != null)
609
+ throw new IllegalStateException("Source image is the wrong type");
610
+
611
+ int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
612
+ int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
613
+ YUVImage dstYUVImage = new YUVImage(scaledWidth, pad, scaledHeight,
614
+ jpegSubsamp);
615
+ decompressToYUV(dstYUVImage, flags);
616
+ return dstYUVImage;
617
+ }
618
+
619
+ /**
620
+ * @deprecated Use {@link #decompressToYUV(int, int, int, int)} instead.
621
+ */
622
+ @SuppressWarnings("checkstyle:JavadocMethod")
623
+ @Deprecated
624
+ public byte[] decompressToYUV(int flags) throws TJException {
625
+ YUVImage dstYUVImage = new YUVImage(jpegWidth, 4, jpegHeight, jpegSubsamp);
626
+ decompressToYUV(dstYUVImage, flags);
627
+ return dstYUVImage.getBuf();
628
+ }
629
+
630
+ /**
631
+ * Decompress the JPEG source image or decode the YUV source image associated
632
+ * with this decompressor instance and output a grayscale, RGB, or CMYK image
633
+ * to the given destination buffer.
634
+ * <p>
635
+ * NOTE: The output image is fully recoverable if this method throws a
636
+ * non-fatal {@link TJException} (unless
637
+ * {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
638
+ *
639
+ * @param dstBuf buffer that will receive the decompressed/decoded image.
640
+ * If the source image is a JPEG image, then this buffer should normally be
641
+ * <code>stride * scaledHeight</code> pixels in size, where
642
+ * <code>scaledHeight</code> can be determined by calling <code>
643
+ * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
644
+ * </code> with one of the scaling factors returned from {@link
645
+ * TJ#getScalingFactors} or by calling {@link #getScaledHeight}. If the
646
+ * source image is a YUV image, then this buffer should normally be
647
+ * <code>stride * height</code> pixels in size, where <code>height</code> is
648
+ * the height of the YUV image. However, the buffer may also be larger than
649
+ * the dimensions of the JPEG image, in which case the <code>x</code>,
650
+ * <code>y</code>, and <code>stride</code> parameters can be used to specify
651
+ * the region into which the source image should be decompressed.
652
+ *
653
+ * @param x x offset (in pixels) of the region in the destination image into
654
+ * which the source image should be decompressed/decoded
655
+ *
656
+ * @param y y offset (in pixels) of the region in the destination image into
657
+ * which the source image should be decompressed/decoded
658
+ *
659
+ * @param desiredWidth If the source image is a JPEG image, then this
660
+ * specifies the desired width (in pixels) of the decompressed image (or
661
+ * image region.) If the desired destination image dimensions are different
662
+ * than the source image dimensions, then TurboJPEG will use scaling in the
663
+ * JPEG decompressor to generate the largest possible image that will fit
664
+ * within the desired dimensions. Setting this to 0 is the same as setting
665
+ * it to the width of the JPEG image (in other words, the width will not be
666
+ * considered when determining the scaled image size.) This parameter is
667
+ * ignored if the source image is a YUV image.
668
+ *
669
+ * @param stride pixels per line of the destination image. Normally, this
670
+ * should be set to <code>scaledWidth</code>, but you can use this to, for
671
+ * instance, decompress the JPEG image into a region of a larger image.
672
+ * NOTE: if the source image is a JPEG image, then <code>scaledWidth</code>
673
+ * can be determined by calling <code>
674
+ * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
675
+ * </code> or by calling {@link #getScaledWidth}. If the source image is a
676
+ * YUV image, then <code>scaledWidth</code> is the width of the YUV image.
677
+ * Setting this parameter to 0 is the equivalent of setting it to
678
+ * <code>scaledWidth</code>.
679
+ *
680
+ * @param desiredHeight If the source image is a JPEG image, then this
681
+ * specifies the desired height (in pixels) of the decompressed image (or
682
+ * image region.) If the desired destination image dimensions are different
683
+ * than the source image dimensions, then TurboJPEG will use scaling in the
684
+ * JPEG decompressor to generate the largest possible image that will fit
685
+ * within the desired dimensions. Setting this to 0 is the same as setting
686
+ * it to the height of the JPEG image (in other words, the height will not be
687
+ * considered when determining the scaled image size.) This parameter is
688
+ * ignored if the source image is a YUV image.
689
+ *
690
+ * @param pixelFormat pixel format of the decompressed image (one of
691
+ * {@link TJ#PF_RGB TJ.PF_*})
692
+ *
693
+ * @param flags the bitwise OR of one or more of
694
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
695
+ */
696
+ public void decompress(int[] dstBuf, int x, int y, int desiredWidth,
697
+ int stride, int desiredHeight, int pixelFormat,
698
+ int flags) throws TJException {
699
+ if (jpegBuf == null && yuvImage == null)
700
+ throw new IllegalStateException(NO_ASSOC_ERROR);
701
+ if (dstBuf == null || x < 0 || y < 0 || stride < 0 ||
702
+ (yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) ||
703
+ pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
704
+ throw new IllegalArgumentException("Invalid argument in decompress()");
705
+ if (yuvImage != null)
706
+ decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(),
707
+ yuvImage.getStrides(), yuvImage.getSubsamp(), dstBuf, x, y,
708
+ yuvImage.getWidth(), stride, yuvImage.getHeight(), pixelFormat,
709
+ flags);
710
+ else
711
+ decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, stride,
712
+ desiredHeight, pixelFormat, flags);
713
+ }
714
+
715
+ /**
716
+ * Decompress the JPEG source image or decode the YUV source image associated
717
+ * with this decompressor instance and output a decompressed/decoded image to
718
+ * the given <code>BufferedImage</code> instance.
719
+ * <p>
720
+ * NOTE: The output image is fully recoverable if this method throws a
721
+ * non-fatal {@link TJException} (unless
722
+ * {@link TJ#FLAG_STOPONWARNING TJ.FLAG_STOPONWARNING} is specified.)
723
+ *
724
+ * @param dstImage a <code>BufferedImage</code> instance that will receive
725
+ * the decompressed/decoded image. If the source image is a JPEG image, then
726
+ * the width and height of the <code>BufferedImage</code> instance must match
727
+ * one of the scaled image sizes that TurboJPEG is capable of generating from
728
+ * the JPEG image. If the source image is a YUV image, then the width and
729
+ * height of the <code>BufferedImage</code> instance must match the width and
730
+ * height of the YUV image.
731
+ *
732
+ * @param flags the bitwise OR of one or more of
733
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
734
+ */
735
+ public void decompress(BufferedImage dstImage, int flags)
736
+ throws TJException {
737
+ if (dstImage == null || flags < 0)
738
+ throw new IllegalArgumentException("Invalid argument in decompress()");
739
+ int desiredWidth = dstImage.getWidth();
740
+ int desiredHeight = dstImage.getHeight();
741
+ int scaledWidth, scaledHeight;
742
+
743
+ if (yuvImage != null) {
744
+ if (desiredWidth != yuvImage.getWidth() ||
745
+ desiredHeight != yuvImage.getHeight())
746
+ throw new IllegalArgumentException("BufferedImage dimensions do not match the dimensions of the source image.");
747
+ scaledWidth = yuvImage.getWidth();
748
+ scaledHeight = yuvImage.getHeight();
749
+ } else {
750
+ scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
751
+ scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
752
+ if (scaledWidth != desiredWidth || scaledHeight != desiredHeight)
753
+ throw new IllegalArgumentException("BufferedImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating.");
754
+ }
755
+ int pixelFormat; boolean intPixels = false;
756
+ if (byteOrder == null)
757
+ byteOrder = ByteOrder.nativeOrder();
758
+ switch (dstImage.getType()) {
759
+ case BufferedImage.TYPE_3BYTE_BGR:
760
+ pixelFormat = TJ.PF_BGR; break;
761
+ case BufferedImage.TYPE_4BYTE_ABGR:
762
+ case BufferedImage.TYPE_4BYTE_ABGR_PRE:
763
+ pixelFormat = TJ.PF_XBGR; break;
764
+ case BufferedImage.TYPE_BYTE_GRAY:
765
+ pixelFormat = TJ.PF_GRAY; break;
766
+ case BufferedImage.TYPE_INT_BGR:
767
+ if (byteOrder == ByteOrder.BIG_ENDIAN)
768
+ pixelFormat = TJ.PF_XBGR;
769
+ else
770
+ pixelFormat = TJ.PF_RGBX;
771
+ intPixels = true; break;
772
+ case BufferedImage.TYPE_INT_RGB:
773
+ if (byteOrder == ByteOrder.BIG_ENDIAN)
774
+ pixelFormat = TJ.PF_XRGB;
775
+ else
776
+ pixelFormat = TJ.PF_BGRX;
777
+ intPixels = true; break;
778
+ case BufferedImage.TYPE_INT_ARGB:
779
+ case BufferedImage.TYPE_INT_ARGB_PRE:
780
+ if (byteOrder == ByteOrder.BIG_ENDIAN)
781
+ pixelFormat = TJ.PF_ARGB;
782
+ else
783
+ pixelFormat = TJ.PF_BGRA;
784
+ intPixels = true; break;
785
+ default:
786
+ throw new IllegalArgumentException("Unsupported BufferedImage format");
787
+ }
788
+ WritableRaster wr = dstImage.getRaster();
789
+ if (intPixels) {
790
+ SinglePixelPackedSampleModel sm =
791
+ (SinglePixelPackedSampleModel)dstImage.getSampleModel();
792
+ int stride = sm.getScanlineStride();
793
+ DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
794
+ int[] buf = db.getData();
795
+ if (yuvImage != null)
796
+ decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(),
797
+ yuvImage.getStrides(), yuvImage.getSubsamp(), buf, 0, 0,
798
+ yuvImage.getWidth(), stride, yuvImage.getHeight(),
799
+ pixelFormat, flags);
800
+ else {
801
+ if (jpegBuf == null)
802
+ throw new IllegalStateException(NO_ASSOC_ERROR);
803
+ decompress(jpegBuf, jpegBufSize, buf, 0, 0, scaledWidth, stride,
804
+ scaledHeight, pixelFormat, flags);
805
+ }
806
+ } else {
807
+ ComponentSampleModel sm =
808
+ (ComponentSampleModel)dstImage.getSampleModel();
809
+ int pixelSize = sm.getPixelStride();
810
+ if (pixelSize != TJ.getPixelSize(pixelFormat))
811
+ throw new IllegalArgumentException("Inconsistency between pixel format and pixel size in BufferedImage");
812
+ int pitch = sm.getScanlineStride();
813
+ DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
814
+ byte[] buf = db.getData();
815
+ decompress(buf, 0, 0, scaledWidth, pitch, scaledHeight, pixelFormat,
816
+ flags);
817
+ }
818
+ }
819
+
820
+ /**
821
+ * Decompress the JPEG source image or decode the YUV source image associated
822
+ * with this decompressor instance and return a <code>BufferedImage</code>
823
+ * instance containing the decompressed/decoded image.
824
+ *
825
+ * @param desiredWidth see
826
+ * {@link #decompress(byte[], int, int, int, int, int, int, int)} for
827
+ * description
828
+ *
829
+ * @param desiredHeight see
830
+ * {@link #decompress(byte[], int, int, int, int, int, int, int)} for
831
+ * description
832
+ *
833
+ * @param bufferedImageType the image type of the <code>BufferedImage</code>
834
+ * instance that will be created (for instance,
835
+ * <code>BufferedImage.TYPE_INT_RGB</code>)
836
+ *
837
+ * @param flags the bitwise OR of one or more of
838
+ * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*}
839
+ *
840
+ * @return a <code>BufferedImage</code> instance containing the
841
+ * decompressed/decoded image.
842
+ */
843
+ public BufferedImage decompress(int desiredWidth, int desiredHeight,
844
+ int bufferedImageType, int flags)
845
+ throws TJException {
846
+ if ((yuvImage == null && (desiredWidth < 0 || desiredHeight < 0)) ||
847
+ flags < 0)
848
+ throw new IllegalArgumentException("Invalid argument in decompress()");
849
+ int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
850
+ int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
851
+ BufferedImage img = new BufferedImage(scaledWidth, scaledHeight,
852
+ bufferedImageType);
853
+ decompress(img, flags);
854
+ return img;
855
+ }
856
+
857
+ /**
858
+ * Free the native structures associated with this decompressor instance.
859
+ */
860
+ @Override
861
+ public void close() throws TJException {
862
+ if (handle != 0)
863
+ destroy();
864
+ }
865
+
866
+ @SuppressWarnings("checkstyle:DesignForExtension")
867
+ @Override
868
+ protected void finalize() throws Throwable {
869
+ try {
870
+ close();
871
+ } catch (TJException e) {
872
+ } finally {
873
+ super.finalize();
874
+ }
875
+ };
876
+
877
+ private native void init() throws TJException;
878
+
879
+ private native void destroy() throws TJException;
880
+
881
+ private native void decompressHeader(byte[] srcBuf, int size)
882
+ throws TJException;
883
+
884
+ @Deprecated
885
+ private native void decompress(byte[] srcBuf, int size, byte[] dstBuf,
886
+ int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)
887
+ throws TJException;
888
+
889
+ private native void decompress(byte[] srcBuf, int size, byte[] dstBuf, int x,
890
+ int y, int desiredWidth, int pitch, int desiredHeight, int pixelFormat,
891
+ int flags) throws TJException;
892
+
893
+ @Deprecated
894
+ private native void decompress(byte[] srcBuf, int size, int[] dstBuf,
895
+ int desiredWidth, int stride, int desiredHeight, int pixelFormat,
896
+ int flags) throws TJException;
897
+
898
+ private native void decompress(byte[] srcBuf, int size, int[] dstBuf, int x,
899
+ int y, int desiredWidth, int stride, int desiredHeight, int pixelFormat,
900
+ int flags) throws TJException;
901
+
902
+ @Deprecated
903
+ private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf,
904
+ int flags) throws TJException;
905
+
906
+ private native void decompressToYUV(byte[] srcBuf, int size,
907
+ byte[][] dstPlanes, int[] dstOffsets, int desiredWidth, int[] dstStrides,
908
+ int desiredheight, int flags) throws TJException;
909
+
910
+ private native void decodeYUV(byte[][] srcPlanes, int[] srcOffsets,
911
+ int[] srcStrides, int subsamp, byte[] dstBuf, int x, int y, int width,
912
+ int pitch, int height, int pixelFormat, int flags) throws TJException;
913
+
914
+ private native void decodeYUV(byte[][] srcPlanes, int[] srcOffsets,
915
+ int[] srcStrides, int subsamp, int[] dstBuf, int x, int y, int width,
916
+ int stride, int height, int pixelFormat, int flags) throws TJException;
917
+
918
+ static {
919
+ TJLoader.load();
920
+ }
921
+
922
+ protected long handle = 0;
923
+ protected byte[] jpegBuf = null;
924
+ protected int jpegBufSize = 0;
925
+ protected YUVImage yuvImage = null;
926
+ protected int jpegWidth = 0;
927
+ protected int jpegHeight = 0;
928
+ protected int jpegSubsamp = -1;
929
+ protected int jpegColorspace = -1;
930
+ private ByteOrder byteOrder = null;
931
+ }