laag-libjpeg-turbo 1.5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (444) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +57 -0
  3. data/LICENSE.txt +139 -0
  4. data/README.org +34 -0
  5. data/ext/laag/libjpeg-turbo/extconf.rb +16 -0
  6. data/laag-libjpeg-turbo.gemspec +20 -0
  7. data/lib/laag/libjpeg-turbo.rb +29 -0
  8. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/.gitignore +14 -0
  9. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/.travis.yml +131 -0
  10. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/BUILDING.md +964 -0
  11. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/CMakeLists.txt +962 -0
  12. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/ChangeLog.md +1151 -0
  13. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/LICENSE.md +139 -0
  14. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/Makefile.am +794 -0
  15. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/README.ijg +279 -0
  16. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/README.md +341 -0
  17. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/acinclude.m4 +287 -0
  18. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/appveyor.yml +57 -0
  19. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/bmp.c +341 -0
  20. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/bmp.h +42 -0
  21. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/cderror.h +136 -0
  22. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/cdjpeg.c +144 -0
  23. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/cdjpeg.h +153 -0
  24. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/change.log +315 -0
  25. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/ci/keys.enc +0 -0
  26. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/cjpeg.1 +351 -0
  27. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/cjpeg.c +644 -0
  28. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/cmakescripts/cmake_uninstall.cmake.in +24 -0
  29. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/cmakescripts/testclean.cmake +39 -0
  30. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/coderules.txt +78 -0
  31. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/configure.ac +616 -0
  32. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/djpeg.1 +293 -0
  33. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/djpeg.c +782 -0
  34. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/annotated.html +104 -0
  35. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/bc_s.png +0 -0
  36. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/bdwn.png +0 -0
  37. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/classes.html +106 -0
  38. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/closed.png +0 -0
  39. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/doxygen-extra.css +3 -0
  40. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/doxygen.css +1184 -0
  41. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/doxygen.png +0 -0
  42. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/dynsections.js +97 -0
  43. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2blank.png +0 -0
  44. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2cl.png +0 -0
  45. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2doc.png +0 -0
  46. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2folderclosed.png +0 -0
  47. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2folderopen.png +0 -0
  48. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2lastnode.png +0 -0
  49. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2link.png +0 -0
  50. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2mlastnode.png +0 -0
  51. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2mnode.png +0 -0
  52. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2mo.png +0 -0
  53. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2node.png +0 -0
  54. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2ns.png +0 -0
  55. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2plastnode.png +0 -0
  56. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2pnode.png +0 -0
  57. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2splitbar.png +0 -0
  58. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/ftv2vertline.png +0 -0
  59. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/functions.html +134 -0
  60. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/functions_vars.html +134 -0
  61. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/group___turbo_j_p_e_g.html +2446 -0
  62. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/index.html +90 -0
  63. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/jquery.js +8 -0
  64. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/modules.html +95 -0
  65. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/nav_f.png +0 -0
  66. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/nav_g.png +0 -0
  67. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/nav_h.png +0 -0
  68. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/open.png +0 -0
  69. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_63.html +26 -0
  70. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_63.js +4 -0
  71. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_64.html +26 -0
  72. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_64.js +5 -0
  73. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_68.html +26 -0
  74. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_68.js +4 -0
  75. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_6e.html +26 -0
  76. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_6e.js +4 -0
  77. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_6f.html +26 -0
  78. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_6f.js +5 -0
  79. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_72.html +26 -0
  80. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_72.js +4 -0
  81. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_74.html +26 -0
  82. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_74.js +89 -0
  83. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_77.html +26 -0
  84. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_77.js +4 -0
  85. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_78.html +26 -0
  86. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_78.js +4 -0
  87. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_79.html +26 -0
  88. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/all_79.js +4 -0
  89. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/classes_74.html +26 -0
  90. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/classes_74.js +6 -0
  91. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/close.png +0 -0
  92. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/enums_74.html +26 -0
  93. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/enums_74.js +7 -0
  94. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/enumvalues_74.html +26 -0
  95. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/enumvalues_74.js +34 -0
  96. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/functions_74.html +26 -0
  97. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/functions_74.js +28 -0
  98. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/groups_74.html +26 -0
  99. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/groups_74.js +4 -0
  100. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/mag_sel.png +0 -0
  101. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/nomatches.html +12 -0
  102. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/search.css +271 -0
  103. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/search.js +809 -0
  104. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/search_l.png +0 -0
  105. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/search_m.png +0 -0
  106. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/search_r.png +0 -0
  107. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/typedefs_74.html +26 -0
  108. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/typedefs_74.js +5 -0
  109. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_63.html +26 -0
  110. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_63.js +4 -0
  111. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_64.html +26 -0
  112. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_64.js +5 -0
  113. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_68.html +26 -0
  114. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_68.js +4 -0
  115. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_6e.html +26 -0
  116. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_6e.js +4 -0
  117. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_6f.html +26 -0
  118. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_6f.js +5 -0
  119. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_72.html +26 -0
  120. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_72.js +4 -0
  121. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_74.html +26 -0
  122. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_74.js +9 -0
  123. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_77.html +26 -0
  124. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_77.js +4 -0
  125. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_78.html +26 -0
  126. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_78.js +4 -0
  127. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_79.html +26 -0
  128. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/search/variables_79.js +4 -0
  129. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/structtjregion.html +186 -0
  130. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/structtjscalingfactor.html +148 -0
  131. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/structtjtransform.html +212 -0
  132. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/sync_off.png +0 -0
  133. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/sync_on.png +0 -0
  134. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/tab_a.png +0 -0
  135. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/tab_b.png +0 -0
  136. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/tab_h.png +0 -0
  137. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/tab_s.png +0 -0
  138. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doc/html/tabs.css +60 -0
  139. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doxygen-extra.css +3 -0
  140. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/doxygen.config +16 -0
  141. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/example.c +433 -0
  142. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jaricom.c +156 -0
  143. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/CMakeLists.txt +57 -0
  144. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/MANIFEST.MF +2 -0
  145. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/Makefile.am +75 -0
  146. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/README +52 -0
  147. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/TJBench.java +926 -0
  148. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/TJExample.java +362 -0
  149. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/TJUnitTest.java +959 -0
  150. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/allclasses-frame.html +24 -0
  151. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/allclasses-noframe.html +24 -0
  152. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/constant-values.html +479 -0
  153. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/deprecated-list.html +248 -0
  154. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/help-doc.html +206 -0
  155. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/index-all.html +980 -0
  156. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/index.html +70 -0
  157. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/TJ.html +1254 -0
  158. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html +922 -0
  159. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html +237 -0
  160. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html +1235 -0
  161. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/TJException.html +287 -0
  162. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html +333 -0
  163. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html +706 -0
  164. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html +417 -0
  165. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html +761 -0
  166. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/package-frame.html +31 -0
  167. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/package-summary.html +198 -0
  168. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/org/libjpegturbo/turbojpeg/package-tree.html +156 -0
  169. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/overview-tree.html +160 -0
  170. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/package-list +1 -0
  171. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/resources/background.gif +0 -0
  172. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/resources/tab.gif +0 -0
  173. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/resources/titlebar.gif +0 -0
  174. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/resources/titlebar_end.gif +0 -0
  175. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/serialized-form.html +159 -0
  176. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/doc/stylesheet.css +474 -0
  177. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJ.java +513 -0
  178. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJCompressor.java +658 -0
  179. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJCustomFilter.java +76 -0
  180. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJDecompressor.java +909 -0
  181. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJException.java +53 -0
  182. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJLoader.java.in +35 -0
  183. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl +59 -0
  184. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java +104 -0
  185. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJTransform.java +208 -0
  186. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/TJTransformer.java +163 -0
  187. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org/libjpegturbo/turbojpeg/YUVImage.java +443 -0
  188. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org_libjpegturbo_turbojpeg_TJ.h +129 -0
  189. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org_libjpegturbo_turbojpeg_TJCompressor.h +101 -0
  190. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org_libjpegturbo_turbojpeg_TJDecompressor.h +101 -0
  191. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/java/org_libjpegturbo_turbojpeg_TJTransformer.h +29 -0
  192. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcapimin.c +295 -0
  193. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcapistd.c +162 -0
  194. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcarith.c +928 -0
  195. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jccoefct.c +449 -0
  196. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jccolext.c +148 -0
  197. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jccolor.c +719 -0
  198. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcdctmgr.c +721 -0
  199. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jchuff.c +1091 -0
  200. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jchuff.h +43 -0
  201. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcinit.c +77 -0
  202. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcmainct.c +162 -0
  203. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcmarker.c +665 -0
  204. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcmaster.c +639 -0
  205. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcomapi.c +109 -0
  206. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jconfig.h.in +73 -0
  207. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jconfig.txt +143 -0
  208. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jconfigint.h.in +17 -0
  209. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcparam.c +542 -0
  210. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcphuff.c +834 -0
  211. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcprepct.c +357 -0
  212. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcsample.c +539 -0
  213. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jcstest.c +126 -0
  214. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jctrans.c +402 -0
  215. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdapimin.c +407 -0
  216. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdapistd.c +637 -0
  217. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdarith.c +769 -0
  218. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdatadst-tj.c +202 -0
  219. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdatadst.c +293 -0
  220. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdatasrc-tj.c +191 -0
  221. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdatasrc.c +295 -0
  222. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdcoefct.c +693 -0
  223. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdcoefct.h +82 -0
  224. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdcol565.c +384 -0
  225. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdcolext.c +143 -0
  226. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdcolor.c +897 -0
  227. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdct.h +208 -0
  228. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jddctmgr.c +352 -0
  229. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdhuff.c +822 -0
  230. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdhuff.h +234 -0
  231. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdinput.c +405 -0
  232. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdmainct.c +456 -0
  233. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdmainct.h +71 -0
  234. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdmarker.c +1377 -0
  235. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdmaster.c +736 -0
  236. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdmaster.h +28 -0
  237. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdmerge.c +627 -0
  238. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdmrg565.c +356 -0
  239. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdmrgext.c +186 -0
  240. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdphuff.c +674 -0
  241. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdpostct.c +290 -0
  242. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdsample.c +517 -0
  243. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdsample.h +50 -0
  244. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jdtrans.c +155 -0
  245. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jerror.c +251 -0
  246. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jerror.h +317 -0
  247. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jfdctflt.c +169 -0
  248. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jfdctfst.c +227 -0
  249. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jfdctint.c +286 -0
  250. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jidctflt.c +240 -0
  251. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jidctfst.c +371 -0
  252. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jidctint.c +2627 -0
  253. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jidctred.c +403 -0
  254. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jinclude.h +84 -0
  255. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jmemmgr.c +1183 -0
  256. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jmemnobs.c +115 -0
  257. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jmemsys.h +178 -0
  258. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jmorecfg.h +421 -0
  259. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jpeg_nbits_table.h +4098 -0
  260. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jpegcomp.h +31 -0
  261. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jpegint.h +368 -0
  262. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jpeglib.h +1122 -0
  263. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jpegtran.1 +290 -0
  264. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jpegtran.c +551 -0
  265. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jquant1.c +857 -0
  266. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jquant2.c +1282 -0
  267. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jsimd.h +93 -0
  268. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jsimd_none.c +404 -0
  269. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jsimddct.h +74 -0
  270. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jstdhuff.c +135 -0
  271. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jutils.c +133 -0
  272. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/jversion.h +49 -0
  273. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/libjpeg.map.in +11 -0
  274. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/libjpeg.txt +3104 -0
  275. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/md5/CMakeLists.txt +1 -0
  276. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/md5/Makefile.am +4 -0
  277. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/md5/md5.c +340 -0
  278. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/md5/md5.h +49 -0
  279. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/md5/md5cmp.c +60 -0
  280. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/md5/md5hl.c +114 -0
  281. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdbmp.c +483 -0
  282. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdcolmap.c +254 -0
  283. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdgif.c +39 -0
  284. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdjpgcom.1 +63 -0
  285. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdjpgcom.c +510 -0
  286. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdppm.c +471 -0
  287. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdrle.c +389 -0
  288. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdswitch.c +424 -0
  289. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/rdtarga.c +503 -0
  290. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/Distribution.xml +24 -0
  291. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/License.rtf +20 -0
  292. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/ReadMe.txt +5 -0
  293. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/Welcome.rtf +17 -0
  294. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/deb-control.tmpl +31 -0
  295. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/libjpeg-turbo.nsi.in +162 -0
  296. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/libjpeg-turbo.spec.in +164 -0
  297. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/libjpeg.pc.in +10 -0
  298. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/libturbojpeg.pc.in +10 -0
  299. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/makecygwinpkg.in +42 -0
  300. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/makedpkg.in +82 -0
  301. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/makemacpkg.in +470 -0
  302. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/release/uninstall.in +112 -0
  303. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/sharedlib/CMakeLists.txt +73 -0
  304. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/CMakeLists.txt +81 -0
  305. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/Makefile.am +102 -0
  306. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jccolext-altivec.c +267 -0
  307. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jccolext-mmx.asm +476 -0
  308. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jccolext-sse2-64.asm +486 -0
  309. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jccolext-sse2.asm +503 -0
  310. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jccolor-altivec.c +104 -0
  311. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jccolor-mmx.asm +122 -0
  312. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jccolor-sse2-64.asm +121 -0
  313. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jccolor-sse2.asm +121 -0
  314. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcgray-altivec.c +99 -0
  315. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcgray-mmx.asm +115 -0
  316. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcgray-sse2-64.asm +114 -0
  317. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcgray-sse2.asm +114 -0
  318. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcgryext-altivec.c +227 -0
  319. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcgryext-mmx.asm +356 -0
  320. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcgryext-sse2-64.asm +365 -0
  321. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcgryext-sse2.asm +384 -0
  322. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jchuff-sse2-64.asm +360 -0
  323. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jchuff-sse2.asm +426 -0
  324. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcolsamp.inc +104 -0
  325. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcsample-altivec.c +158 -0
  326. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcsample-mmx.asm +323 -0
  327. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcsample-sse2-64.asm +329 -0
  328. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcsample-sse2.asm +350 -0
  329. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jcsample.h +28 -0
  330. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdcolext-altivec.c +274 -0
  331. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdcolext-mmx.asm +404 -0
  332. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdcolext-sse2-64.asm +440 -0
  333. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdcolext-sse2.asm +459 -0
  334. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdcolor-altivec.c +96 -0
  335. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdcolor-mmx.asm +119 -0
  336. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdcolor-sse2-64.asm +119 -0
  337. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdcolor-sse2.asm +119 -0
  338. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdct.inc +27 -0
  339. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdmerge-altivec.c +108 -0
  340. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdmerge-mmx.asm +125 -0
  341. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdmerge-sse2-64.asm +125 -0
  342. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdmerge-sse2.asm +125 -0
  343. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdmrgext-altivec.c +323 -0
  344. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdmrgext-mmx.asm +463 -0
  345. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdmrgext-sse2-64.asm +537 -0
  346. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdmrgext-sse2.asm +518 -0
  347. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdsample-altivec.c +392 -0
  348. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdsample-mmx.asm +736 -0
  349. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdsample-sse2-64.asm +670 -0
  350. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jdsample-sse2.asm +728 -0
  351. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctflt-3dn.asm +319 -0
  352. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctflt-sse-64.asm +357 -0
  353. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctflt-sse.asm +369 -0
  354. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctfst-altivec.c +156 -0
  355. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctfst-mmx.asm +396 -0
  356. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctfst-sse2-64.asm +391 -0
  357. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctfst-sse2.asm +403 -0
  358. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctint-altivec.c +262 -0
  359. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctint-mmx.asm +621 -0
  360. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctint-sse2-64.asm +621 -0
  361. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jfdctint-sse2.asm +633 -0
  362. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctflt-3dn.asm +451 -0
  363. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctflt-sse.asm +571 -0
  364. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctflt-sse2-64.asm +482 -0
  365. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctflt-sse2.asm +497 -0
  366. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctfst-altivec.c +257 -0
  367. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctfst-mmx.asm +499 -0
  368. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctfst-sse2-64.asm +491 -0
  369. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctfst-sse2.asm +501 -0
  370. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctint-altivec.c +359 -0
  371. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctint-mmx.asm +851 -0
  372. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctint-sse2-64.asm +847 -0
  373. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctint-sse2.asm +858 -0
  374. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctred-mmx.asm +705 -0
  375. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctred-sse2-64.asm +575 -0
  376. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jidctred-sse2.asm +593 -0
  377. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jpeg_nbits_table.inc +4097 -0
  378. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jquant-3dn.asm +232 -0
  379. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jquant-mmx.asm +273 -0
  380. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jquant-sse.asm +210 -0
  381. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jquantf-sse2-64.asm +157 -0
  382. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jquantf-sse2.asm +170 -0
  383. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jquanti-altivec.c +252 -0
  384. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jquanti-sse2-64.asm +186 -0
  385. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jquanti-sse2.asm +199 -0
  386. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd.h +871 -0
  387. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_altivec.h +99 -0
  388. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_arm.c +728 -0
  389. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_arm64.c +803 -0
  390. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_arm64_neon.S +3425 -0
  391. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_arm_neon.S +2878 -0
  392. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_i386.c +1091 -0
  393. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_mips.c +1140 -0
  394. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_mips_dspr2.S +4486 -0
  395. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_mips_dspr2_asm.h +283 -0
  396. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_powerpc.c +852 -0
  397. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimd_x86_64.c +887 -0
  398. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimdcfg.inc.h +130 -0
  399. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimdcpu.asm +104 -0
  400. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/jsimdext.inc +375 -0
  401. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/simd/nasm_lt.sh +60 -0
  402. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/structure.txt +904 -0
  403. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/nightshot_iso_100.bmp +0 -0
  404. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/nightshot_iso_100.txt +25 -0
  405. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/testimgari.jpg +0 -0
  406. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/testimgint.jpg +0 -0
  407. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/testorig.jpg +0 -0
  408. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/testorig.ppm +4 -0
  409. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/testorig12.jpg +0 -0
  410. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/vgl_5674_0098.bmp +0 -0
  411. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/vgl_6434_0018a.bmp +0 -0
  412. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/testimages/vgl_6548_0026a.bmp +0 -0
  413. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/tjbench.c +1010 -0
  414. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/tjbenchtest.in +252 -0
  415. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/tjbenchtest.java.in +207 -0
  416. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/tjexampletest.in +150 -0
  417. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/tjunittest.c +734 -0
  418. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/tjutil.c +66 -0
  419. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/tjutil.h +47 -0
  420. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/transupp.c +1626 -0
  421. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/transupp.h +207 -0
  422. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/turbojpeg-jni.c +1166 -0
  423. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/turbojpeg-mapfile +56 -0
  424. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/turbojpeg-mapfile.jni +92 -0
  425. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/turbojpeg.c +2175 -0
  426. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/turbojpeg.h +1545 -0
  427. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/usage.txt +635 -0
  428. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/win/jconfig.h.in +51 -0
  429. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/win/jconfigint.h.in +13 -0
  430. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/win/jpeg62-memsrcdst.def +106 -0
  431. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/win/jpeg62.def +104 -0
  432. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/win/jpeg7-memsrcdst.def +108 -0
  433. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/win/jpeg7.def +106 -0
  434. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/win/jpeg8.def +109 -0
  435. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/win/jsimdcfg.inc +94 -0
  436. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/wizard.txt +211 -0
  437. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/wrbmp.c +494 -0
  438. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/wrgif.c +413 -0
  439. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/wrjpgcom.1 +103 -0
  440. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/wrjpgcom.c +592 -0
  441. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/wrppm.c +280 -0
  442. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/wrrle.c +308 -0
  443. data/vendor/github.com/libjpeg-turbo/libjpeg-turbo/wrtarga.c +261 -0
  444. metadata +509 -0
@@ -0,0 +1,1183 @@
1
+ /*
2
+ * jmemmgr.c
3
+ *
4
+ * This file was part of the Independent JPEG Group's software:
5
+ * Copyright (C) 1991-1997, Thomas G. Lane.
6
+ * libjpeg-turbo Modifications:
7
+ * Copyright (C) 2016, D. R. Commander.
8
+ * For conditions of distribution and use, see the accompanying README.ijg
9
+ * file.
10
+ *
11
+ * This file contains the JPEG system-independent memory management
12
+ * routines. This code is usable across a wide variety of machines; most
13
+ * of the system dependencies have been isolated in a separate file.
14
+ * The major functions provided here are:
15
+ * * pool-based allocation and freeing of memory;
16
+ * * policy decisions about how to divide available memory among the
17
+ * virtual arrays;
18
+ * * control logic for swapping virtual arrays between main memory and
19
+ * backing storage.
20
+ * The separate system-dependent file provides the actual backing-storage
21
+ * access code, and it contains the policy decision about how much total
22
+ * main memory to use.
23
+ * This file is system-dependent in the sense that some of its functions
24
+ * are unnecessary in some systems. For example, if there is enough virtual
25
+ * memory so that backing storage will never be used, much of the virtual
26
+ * array control logic could be removed. (Of course, if you have that much
27
+ * memory then you shouldn't care about a little bit of unused code...)
28
+ */
29
+
30
+ #define JPEG_INTERNALS
31
+ #define AM_MEMORY_MANAGER /* we define jvirt_Xarray_control structs */
32
+ #include "jinclude.h"
33
+ #include "jpeglib.h"
34
+ #include "jmemsys.h" /* import the system-dependent declarations */
35
+ #ifndef _WIN32
36
+ #include <stdint.h>
37
+ #endif
38
+ #include <limits.h>
39
+
40
+ #ifndef NO_GETENV
41
+ #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare getenv() */
42
+ extern char *getenv (const char *name);
43
+ #endif
44
+ #endif
45
+
46
+
47
+ LOCAL(size_t)
48
+ round_up_pow2 (size_t a, size_t b)
49
+ /* a rounded up to the next multiple of b, i.e. ceil(a/b)*b */
50
+ /* Assumes a >= 0, b > 0, and b is a power of 2 */
51
+ {
52
+ return ((a + b - 1) & (~(b - 1)));
53
+ }
54
+
55
+
56
+ /*
57
+ * Some important notes:
58
+ * The allocation routines provided here must never return NULL.
59
+ * They should exit to error_exit if unsuccessful.
60
+ *
61
+ * It's not a good idea to try to merge the sarray and barray routines,
62
+ * even though they are textually almost the same, because samples are
63
+ * usually stored as bytes while coefficients are shorts or ints. Thus,
64
+ * in machines where byte pointers have a different representation from
65
+ * word pointers, the resulting machine code could not be the same.
66
+ */
67
+
68
+
69
+ /*
70
+ * Many machines require storage alignment: longs must start on 4-byte
71
+ * boundaries, doubles on 8-byte boundaries, etc. On such machines, malloc()
72
+ * always returns pointers that are multiples of the worst-case alignment
73
+ * requirement, and we had better do so too.
74
+ * There isn't any really portable way to determine the worst-case alignment
75
+ * requirement. This module assumes that the alignment requirement is
76
+ * multiples of ALIGN_SIZE.
77
+ * By default, we define ALIGN_SIZE as sizeof(double). This is necessary on
78
+ * some workstations (where doubles really do need 8-byte alignment) and will
79
+ * work fine on nearly everything. If your machine has lesser alignment needs,
80
+ * you can save a few bytes by making ALIGN_SIZE smaller.
81
+ * The only place I know of where this will NOT work is certain Macintosh
82
+ * 680x0 compilers that define double as a 10-byte IEEE extended float.
83
+ * Doing 10-byte alignment is counterproductive because longwords won't be
84
+ * aligned well. Put "#define ALIGN_SIZE 4" in jconfig.h if you have
85
+ * such a compiler.
86
+ */
87
+
88
+ #ifndef ALIGN_SIZE /* so can override from jconfig.h */
89
+ #ifndef WITH_SIMD
90
+ #define ALIGN_SIZE sizeof(double)
91
+ #else
92
+ #define ALIGN_SIZE 16 /* Most SIMD implementations require this */
93
+ #endif
94
+ #endif
95
+
96
+ /*
97
+ * We allocate objects from "pools", where each pool is gotten with a single
98
+ * request to jpeg_get_small() or jpeg_get_large(). There is no per-object
99
+ * overhead within a pool, except for alignment padding. Each pool has a
100
+ * header with a link to the next pool of the same class.
101
+ * Small and large pool headers are identical.
102
+ */
103
+
104
+ typedef struct small_pool_struct *small_pool_ptr;
105
+
106
+ typedef struct small_pool_struct {
107
+ small_pool_ptr next; /* next in list of pools */
108
+ size_t bytes_used; /* how many bytes already used within pool */
109
+ size_t bytes_left; /* bytes still available in this pool */
110
+ } small_pool_hdr;
111
+
112
+ typedef struct large_pool_struct *large_pool_ptr;
113
+
114
+ typedef struct large_pool_struct {
115
+ large_pool_ptr next; /* next in list of pools */
116
+ size_t bytes_used; /* how many bytes already used within pool */
117
+ size_t bytes_left; /* bytes still available in this pool */
118
+ } large_pool_hdr;
119
+
120
+ /*
121
+ * Here is the full definition of a memory manager object.
122
+ */
123
+
124
+ typedef struct {
125
+ struct jpeg_memory_mgr pub; /* public fields */
126
+
127
+ /* Each pool identifier (lifetime class) names a linked list of pools. */
128
+ small_pool_ptr small_list[JPOOL_NUMPOOLS];
129
+ large_pool_ptr large_list[JPOOL_NUMPOOLS];
130
+
131
+ /* Since we only have one lifetime class of virtual arrays, only one
132
+ * linked list is necessary (for each datatype). Note that the virtual
133
+ * array control blocks being linked together are actually stored somewhere
134
+ * in the small-pool list.
135
+ */
136
+ jvirt_sarray_ptr virt_sarray_list;
137
+ jvirt_barray_ptr virt_barray_list;
138
+
139
+ /* This counts total space obtained from jpeg_get_small/large */
140
+ size_t total_space_allocated;
141
+
142
+ /* alloc_sarray and alloc_barray set this value for use by virtual
143
+ * array routines.
144
+ */
145
+ JDIMENSION last_rowsperchunk; /* from most recent alloc_sarray/barray */
146
+ } my_memory_mgr;
147
+
148
+ typedef my_memory_mgr *my_mem_ptr;
149
+
150
+
151
+ /*
152
+ * The control blocks for virtual arrays.
153
+ * Note that these blocks are allocated in the "small" pool area.
154
+ * System-dependent info for the associated backing store (if any) is hidden
155
+ * inside the backing_store_info struct.
156
+ */
157
+
158
+ struct jvirt_sarray_control {
159
+ JSAMPARRAY mem_buffer; /* => the in-memory buffer */
160
+ JDIMENSION rows_in_array; /* total virtual array height */
161
+ JDIMENSION samplesperrow; /* width of array (and of memory buffer) */
162
+ JDIMENSION maxaccess; /* max rows accessed by access_virt_sarray */
163
+ JDIMENSION rows_in_mem; /* height of memory buffer */
164
+ JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */
165
+ JDIMENSION cur_start_row; /* first logical row # in the buffer */
166
+ JDIMENSION first_undef_row; /* row # of first uninitialized row */
167
+ boolean pre_zero; /* pre-zero mode requested? */
168
+ boolean dirty; /* do current buffer contents need written? */
169
+ boolean b_s_open; /* is backing-store data valid? */
170
+ jvirt_sarray_ptr next; /* link to next virtual sarray control block */
171
+ backing_store_info b_s_info; /* System-dependent control info */
172
+ };
173
+
174
+ struct jvirt_barray_control {
175
+ JBLOCKARRAY mem_buffer; /* => the in-memory buffer */
176
+ JDIMENSION rows_in_array; /* total virtual array height */
177
+ JDIMENSION blocksperrow; /* width of array (and of memory buffer) */
178
+ JDIMENSION maxaccess; /* max rows accessed by access_virt_barray */
179
+ JDIMENSION rows_in_mem; /* height of memory buffer */
180
+ JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */
181
+ JDIMENSION cur_start_row; /* first logical row # in the buffer */
182
+ JDIMENSION first_undef_row; /* row # of first uninitialized row */
183
+ boolean pre_zero; /* pre-zero mode requested? */
184
+ boolean dirty; /* do current buffer contents need written? */
185
+ boolean b_s_open; /* is backing-store data valid? */
186
+ jvirt_barray_ptr next; /* link to next virtual barray control block */
187
+ backing_store_info b_s_info; /* System-dependent control info */
188
+ };
189
+
190
+
191
+ #ifdef MEM_STATS /* optional extra stuff for statistics */
192
+
193
+ LOCAL(void)
194
+ print_mem_stats (j_common_ptr cinfo, int pool_id)
195
+ {
196
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
197
+ small_pool_ptr shdr_ptr;
198
+ large_pool_ptr lhdr_ptr;
199
+
200
+ /* Since this is only a debugging stub, we can cheat a little by using
201
+ * fprintf directly rather than going through the trace message code.
202
+ * This is helpful because message parm array can't handle longs.
203
+ */
204
+ fprintf(stderr, "Freeing pool %d, total space = %ld\n",
205
+ pool_id, mem->total_space_allocated);
206
+
207
+ for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL;
208
+ lhdr_ptr = lhdr_ptr->next) {
209
+ fprintf(stderr, " Large chunk used %ld\n",
210
+ (long) lhdr_ptr->bytes_used);
211
+ }
212
+
213
+ for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL;
214
+ shdr_ptr = shdr_ptr->next) {
215
+ fprintf(stderr, " Small chunk used %ld free %ld\n",
216
+ (long) shdr_ptr->bytes_used,
217
+ (long) shdr_ptr->bytes_left);
218
+ }
219
+ }
220
+
221
+ #endif /* MEM_STATS */
222
+
223
+
224
+ LOCAL(void)
225
+ out_of_memory (j_common_ptr cinfo, int which)
226
+ /* Report an out-of-memory error and stop execution */
227
+ /* If we compiled MEM_STATS support, report alloc requests before dying */
228
+ {
229
+ #ifdef MEM_STATS
230
+ cinfo->err->trace_level = 2; /* force self_destruct to report stats */
231
+ #endif
232
+ ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, which);
233
+ }
234
+
235
+
236
+ /*
237
+ * Allocation of "small" objects.
238
+ *
239
+ * For these, we use pooled storage. When a new pool must be created,
240
+ * we try to get enough space for the current request plus a "slop" factor,
241
+ * where the slop will be the amount of leftover space in the new pool.
242
+ * The speed vs. space tradeoff is largely determined by the slop values.
243
+ * A different slop value is provided for each pool class (lifetime),
244
+ * and we also distinguish the first pool of a class from later ones.
245
+ * NOTE: the values given work fairly well on both 16- and 32-bit-int
246
+ * machines, but may be too small if longs are 64 bits or more.
247
+ *
248
+ * Since we do not know what alignment malloc() gives us, we have to
249
+ * allocate ALIGN_SIZE-1 extra space per pool to have room for alignment
250
+ * adjustment.
251
+ */
252
+
253
+ static const size_t first_pool_slop[JPOOL_NUMPOOLS] =
254
+ {
255
+ 1600, /* first PERMANENT pool */
256
+ 16000 /* first IMAGE pool */
257
+ };
258
+
259
+ static const size_t extra_pool_slop[JPOOL_NUMPOOLS] =
260
+ {
261
+ 0, /* additional PERMANENT pools */
262
+ 5000 /* additional IMAGE pools */
263
+ };
264
+
265
+ #define MIN_SLOP 50 /* greater than 0 to avoid futile looping */
266
+
267
+
268
+ METHODDEF(void *)
269
+ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
270
+ /* Allocate a "small" object */
271
+ {
272
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
273
+ small_pool_ptr hdr_ptr, prev_hdr_ptr;
274
+ char *data_ptr;
275
+ size_t min_request, slop;
276
+
277
+ /*
278
+ * Round up the requested size to a multiple of ALIGN_SIZE in order
279
+ * to assure alignment for the next object allocated in the same pool
280
+ * and so that algorithms can straddle outside the proper area up
281
+ * to the next alignment.
282
+ */
283
+ if (sizeofobject > MAX_ALLOC_CHUNK) {
284
+ /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
285
+ is close to SIZE_MAX. */
286
+ out_of_memory(cinfo, 7);
287
+ }
288
+ sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
289
+
290
+ /* Check for unsatisfiable request (do now to ensure no overflow below) */
291
+ if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
292
+ MAX_ALLOC_CHUNK)
293
+ out_of_memory(cinfo, 1); /* request exceeds malloc's ability */
294
+
295
+ /* See if space is available in any existing pool */
296
+ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
297
+ ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
298
+ prev_hdr_ptr = NULL;
299
+ hdr_ptr = mem->small_list[pool_id];
300
+ while (hdr_ptr != NULL) {
301
+ if (hdr_ptr->bytes_left >= sizeofobject)
302
+ break; /* found pool with enough space */
303
+ prev_hdr_ptr = hdr_ptr;
304
+ hdr_ptr = hdr_ptr->next;
305
+ }
306
+
307
+ /* Time to make a new pool? */
308
+ if (hdr_ptr == NULL) {
309
+ /* min_request is what we need now, slop is what will be leftover */
310
+ min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
311
+ if (prev_hdr_ptr == NULL) /* first pool in class? */
312
+ slop = first_pool_slop[pool_id];
313
+ else
314
+ slop = extra_pool_slop[pool_id];
315
+ /* Don't ask for more than MAX_ALLOC_CHUNK */
316
+ if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request))
317
+ slop = (size_t) (MAX_ALLOC_CHUNK-min_request);
318
+ /* Try to get space, if fail reduce slop and try again */
319
+ for (;;) {
320
+ hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop);
321
+ if (hdr_ptr != NULL)
322
+ break;
323
+ slop /= 2;
324
+ if (slop < MIN_SLOP) /* give up when it gets real small */
325
+ out_of_memory(cinfo, 2); /* jpeg_get_small failed */
326
+ }
327
+ mem->total_space_allocated += min_request + slop;
328
+ /* Success, initialize the new pool header and add to end of list */
329
+ hdr_ptr->next = NULL;
330
+ hdr_ptr->bytes_used = 0;
331
+ hdr_ptr->bytes_left = sizeofobject + slop;
332
+ if (prev_hdr_ptr == NULL) /* first pool in class? */
333
+ mem->small_list[pool_id] = hdr_ptr;
334
+ else
335
+ prev_hdr_ptr->next = hdr_ptr;
336
+ }
337
+
338
+ /* OK, allocate the object from the current pool */
339
+ data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */
340
+ data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
341
+ if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
342
+ data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
343
+ data_ptr += hdr_ptr->bytes_used; /* point to place for object */
344
+ hdr_ptr->bytes_used += sizeofobject;
345
+ hdr_ptr->bytes_left -= sizeofobject;
346
+
347
+ return (void *) data_ptr;
348
+ }
349
+
350
+
351
+ /*
352
+ * Allocation of "large" objects.
353
+ *
354
+ * The external semantics of these are the same as "small" objects. However,
355
+ * the pool management heuristics are quite different. We assume that each
356
+ * request is large enough that it may as well be passed directly to
357
+ * jpeg_get_large; the pool management just links everything together
358
+ * so that we can free it all on demand.
359
+ * Note: the major use of "large" objects is in JSAMPARRAY and JBLOCKARRAY
360
+ * structures. The routines that create these structures (see below)
361
+ * deliberately bunch rows together to ensure a large request size.
362
+ */
363
+
364
+ METHODDEF(void *)
365
+ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
366
+ /* Allocate a "large" object */
367
+ {
368
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
369
+ large_pool_ptr hdr_ptr;
370
+ char *data_ptr;
371
+
372
+ /*
373
+ * Round up the requested size to a multiple of ALIGN_SIZE so that
374
+ * algorithms can straddle outside the proper area up to the next
375
+ * alignment.
376
+ */
377
+ if (sizeofobject > MAX_ALLOC_CHUNK) {
378
+ /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
379
+ is close to SIZE_MAX. */
380
+ out_of_memory(cinfo, 8);
381
+ }
382
+ sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
383
+
384
+ /* Check for unsatisfiable request (do now to ensure no overflow below) */
385
+ if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
386
+ MAX_ALLOC_CHUNK)
387
+ out_of_memory(cinfo, 3); /* request exceeds malloc's ability */
388
+
389
+ /* Always make a new pool */
390
+ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
391
+ ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
392
+
393
+ hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject +
394
+ sizeof(large_pool_hdr) +
395
+ ALIGN_SIZE - 1);
396
+ if (hdr_ptr == NULL)
397
+ out_of_memory(cinfo, 4); /* jpeg_get_large failed */
398
+ mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
399
+ ALIGN_SIZE - 1;
400
+
401
+ /* Success, initialize the new pool header and add to list */
402
+ hdr_ptr->next = mem->large_list[pool_id];
403
+ /* We maintain space counts in each pool header for statistical purposes,
404
+ * even though they are not needed for allocation.
405
+ */
406
+ hdr_ptr->bytes_used = sizeofobject;
407
+ hdr_ptr->bytes_left = 0;
408
+ mem->large_list[pool_id] = hdr_ptr;
409
+
410
+ data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */
411
+ data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
412
+ if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
413
+ data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
414
+
415
+ return (void *) data_ptr;
416
+ }
417
+
418
+
419
+ /*
420
+ * Creation of 2-D sample arrays.
421
+ *
422
+ * To minimize allocation overhead and to allow I/O of large contiguous
423
+ * blocks, we allocate the sample rows in groups of as many rows as possible
424
+ * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request.
425
+ * NB: the virtual array control routines, later in this file, know about
426
+ * this chunking of rows. The rowsperchunk value is left in the mem manager
427
+ * object so that it can be saved away if this sarray is the workspace for
428
+ * a virtual array.
429
+ *
430
+ * Since we are often upsampling with a factor 2, we align the size (not
431
+ * the start) to 2 * ALIGN_SIZE so that the upsampling routines don't have
432
+ * to be as careful about size.
433
+ */
434
+
435
+ METHODDEF(JSAMPARRAY)
436
+ alloc_sarray (j_common_ptr cinfo, int pool_id,
437
+ JDIMENSION samplesperrow, JDIMENSION numrows)
438
+ /* Allocate a 2-D sample array */
439
+ {
440
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
441
+ JSAMPARRAY result;
442
+ JSAMPROW workspace;
443
+ JDIMENSION rowsperchunk, currow, i;
444
+ long ltemp;
445
+
446
+ /* Make sure each row is properly aligned */
447
+ if ((ALIGN_SIZE % sizeof(JSAMPLE)) != 0)
448
+ out_of_memory(cinfo, 5); /* safety check */
449
+
450
+ if (samplesperrow > MAX_ALLOC_CHUNK) {
451
+ /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
452
+ is close to SIZE_MAX. */
453
+ out_of_memory(cinfo, 9);
454
+ }
455
+ samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
456
+ sizeof(JSAMPLE));
457
+
458
+ /* Calculate max # of rows allowed in one allocation chunk */
459
+ ltemp = (MAX_ALLOC_CHUNK-sizeof(large_pool_hdr)) /
460
+ ((long) samplesperrow * sizeof(JSAMPLE));
461
+ if (ltemp <= 0)
462
+ ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
463
+ if (ltemp < (long) numrows)
464
+ rowsperchunk = (JDIMENSION) ltemp;
465
+ else
466
+ rowsperchunk = numrows;
467
+ mem->last_rowsperchunk = rowsperchunk;
468
+
469
+ /* Get space for row pointers (small object) */
470
+ result = (JSAMPARRAY) alloc_small(cinfo, pool_id,
471
+ (size_t) (numrows * sizeof(JSAMPROW)));
472
+
473
+ /* Get the rows themselves (large objects) */
474
+ currow = 0;
475
+ while (currow < numrows) {
476
+ rowsperchunk = MIN(rowsperchunk, numrows - currow);
477
+ workspace = (JSAMPROW) alloc_large(cinfo, pool_id,
478
+ (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow
479
+ * sizeof(JSAMPLE)));
480
+ for (i = rowsperchunk; i > 0; i--) {
481
+ result[currow++] = workspace;
482
+ workspace += samplesperrow;
483
+ }
484
+ }
485
+
486
+ return result;
487
+ }
488
+
489
+
490
+ /*
491
+ * Creation of 2-D coefficient-block arrays.
492
+ * This is essentially the same as the code for sample arrays, above.
493
+ */
494
+
495
+ METHODDEF(JBLOCKARRAY)
496
+ alloc_barray (j_common_ptr cinfo, int pool_id,
497
+ JDIMENSION blocksperrow, JDIMENSION numrows)
498
+ /* Allocate a 2-D coefficient-block array */
499
+ {
500
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
501
+ JBLOCKARRAY result;
502
+ JBLOCKROW workspace;
503
+ JDIMENSION rowsperchunk, currow, i;
504
+ long ltemp;
505
+
506
+ /* Make sure each row is properly aligned */
507
+ if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0)
508
+ out_of_memory(cinfo, 6); /* safety check */
509
+
510
+ /* Calculate max # of rows allowed in one allocation chunk */
511
+ ltemp = (MAX_ALLOC_CHUNK-sizeof(large_pool_hdr)) /
512
+ ((long) blocksperrow * sizeof(JBLOCK));
513
+ if (ltemp <= 0)
514
+ ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
515
+ if (ltemp < (long) numrows)
516
+ rowsperchunk = (JDIMENSION) ltemp;
517
+ else
518
+ rowsperchunk = numrows;
519
+ mem->last_rowsperchunk = rowsperchunk;
520
+
521
+ /* Get space for row pointers (small object) */
522
+ result = (JBLOCKARRAY) alloc_small(cinfo, pool_id,
523
+ (size_t) (numrows * sizeof(JBLOCKROW)));
524
+
525
+ /* Get the rows themselves (large objects) */
526
+ currow = 0;
527
+ while (currow < numrows) {
528
+ rowsperchunk = MIN(rowsperchunk, numrows - currow);
529
+ workspace = (JBLOCKROW) alloc_large(cinfo, pool_id,
530
+ (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow
531
+ * sizeof(JBLOCK)));
532
+ for (i = rowsperchunk; i > 0; i--) {
533
+ result[currow++] = workspace;
534
+ workspace += blocksperrow;
535
+ }
536
+ }
537
+
538
+ return result;
539
+ }
540
+
541
+
542
+ /*
543
+ * About virtual array management:
544
+ *
545
+ * The above "normal" array routines are only used to allocate strip buffers
546
+ * (as wide as the image, but just a few rows high). Full-image-sized buffers
547
+ * are handled as "virtual" arrays. The array is still accessed a strip at a
548
+ * time, but the memory manager must save the whole array for repeated
549
+ * accesses. The intended implementation is that there is a strip buffer in
550
+ * memory (as high as is possible given the desired memory limit), plus a
551
+ * backing file that holds the rest of the array.
552
+ *
553
+ * The request_virt_array routines are told the total size of the image and
554
+ * the maximum number of rows that will be accessed at once. The in-memory
555
+ * buffer must be at least as large as the maxaccess value.
556
+ *
557
+ * The request routines create control blocks but not the in-memory buffers.
558
+ * That is postponed until realize_virt_arrays is called. At that time the
559
+ * total amount of space needed is known (approximately, anyway), so free
560
+ * memory can be divided up fairly.
561
+ *
562
+ * The access_virt_array routines are responsible for making a specific strip
563
+ * area accessible (after reading or writing the backing file, if necessary).
564
+ * Note that the access routines are told whether the caller intends to modify
565
+ * the accessed strip; during a read-only pass this saves having to rewrite
566
+ * data to disk. The access routines are also responsible for pre-zeroing
567
+ * any newly accessed rows, if pre-zeroing was requested.
568
+ *
569
+ * In current usage, the access requests are usually for nonoverlapping
570
+ * strips; that is, successive access start_row numbers differ by exactly
571
+ * num_rows = maxaccess. This means we can get good performance with simple
572
+ * buffer dump/reload logic, by making the in-memory buffer be a multiple
573
+ * of the access height; then there will never be accesses across bufferload
574
+ * boundaries. The code will still work with overlapping access requests,
575
+ * but it doesn't handle bufferload overlaps very efficiently.
576
+ */
577
+
578
+
579
+ METHODDEF(jvirt_sarray_ptr)
580
+ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
581
+ JDIMENSION samplesperrow, JDIMENSION numrows,
582
+ JDIMENSION maxaccess)
583
+ /* Request a virtual 2-D sample array */
584
+ {
585
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
586
+ jvirt_sarray_ptr result;
587
+
588
+ /* Only IMAGE-lifetime virtual arrays are currently supported */
589
+ if (pool_id != JPOOL_IMAGE)
590
+ ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
591
+
592
+ /* get control block */
593
+ result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id,
594
+ sizeof(struct jvirt_sarray_control));
595
+
596
+ result->mem_buffer = NULL; /* marks array not yet realized */
597
+ result->rows_in_array = numrows;
598
+ result->samplesperrow = samplesperrow;
599
+ result->maxaccess = maxaccess;
600
+ result->pre_zero = pre_zero;
601
+ result->b_s_open = FALSE; /* no associated backing-store object */
602
+ result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
603
+ mem->virt_sarray_list = result;
604
+
605
+ return result;
606
+ }
607
+
608
+
609
+ METHODDEF(jvirt_barray_ptr)
610
+ request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
611
+ JDIMENSION blocksperrow, JDIMENSION numrows,
612
+ JDIMENSION maxaccess)
613
+ /* Request a virtual 2-D coefficient-block array */
614
+ {
615
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
616
+ jvirt_barray_ptr result;
617
+
618
+ /* Only IMAGE-lifetime virtual arrays are currently supported */
619
+ if (pool_id != JPOOL_IMAGE)
620
+ ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
621
+
622
+ /* get control block */
623
+ result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id,
624
+ sizeof(struct jvirt_barray_control));
625
+
626
+ result->mem_buffer = NULL; /* marks array not yet realized */
627
+ result->rows_in_array = numrows;
628
+ result->blocksperrow = blocksperrow;
629
+ result->maxaccess = maxaccess;
630
+ result->pre_zero = pre_zero;
631
+ result->b_s_open = FALSE; /* no associated backing-store object */
632
+ result->next = mem->virt_barray_list; /* add to list of virtual arrays */
633
+ mem->virt_barray_list = result;
634
+
635
+ return result;
636
+ }
637
+
638
+
639
+ METHODDEF(void)
640
+ realize_virt_arrays (j_common_ptr cinfo)
641
+ /* Allocate the in-memory buffers for any unrealized virtual arrays */
642
+ {
643
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
644
+ size_t space_per_minheight, maximum_space, avail_mem;
645
+ size_t minheights, max_minheights;
646
+ jvirt_sarray_ptr sptr;
647
+ jvirt_barray_ptr bptr;
648
+
649
+ /* Compute the minimum space needed (maxaccess rows in each buffer)
650
+ * and the maximum space needed (full image height in each buffer).
651
+ * These may be of use to the system-dependent jpeg_mem_available routine.
652
+ */
653
+ space_per_minheight = 0;
654
+ maximum_space = 0;
655
+ for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
656
+ if (sptr->mem_buffer == NULL) { /* if not realized yet */
657
+ size_t new_space = (long) sptr->rows_in_array *
658
+ (long) sptr->samplesperrow * sizeof(JSAMPLE);
659
+
660
+ space_per_minheight += (long) sptr->maxaccess *
661
+ (long) sptr->samplesperrow * sizeof(JSAMPLE);
662
+ if (SIZE_MAX - maximum_space < new_space)
663
+ out_of_memory(cinfo, 10);
664
+ maximum_space += new_space;
665
+ }
666
+ }
667
+ for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
668
+ if (bptr->mem_buffer == NULL) { /* if not realized yet */
669
+ size_t new_space = (long) bptr->rows_in_array *
670
+ (long) bptr->blocksperrow * sizeof(JBLOCK);
671
+
672
+ space_per_minheight += (long) bptr->maxaccess *
673
+ (long) bptr->blocksperrow * sizeof(JBLOCK);
674
+ if (SIZE_MAX - maximum_space < new_space)
675
+ out_of_memory(cinfo, 11);
676
+ maximum_space += new_space;
677
+ }
678
+ }
679
+
680
+ if (space_per_minheight <= 0)
681
+ return; /* no unrealized arrays, no work */
682
+
683
+ /* Determine amount of memory to actually use; this is system-dependent. */
684
+ avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
685
+ mem->total_space_allocated);
686
+
687
+ /* If the maximum space needed is available, make all the buffers full
688
+ * height; otherwise parcel it out with the same number of minheights
689
+ * in each buffer.
690
+ */
691
+ if (avail_mem >= maximum_space)
692
+ max_minheights = 1000000000L;
693
+ else {
694
+ max_minheights = avail_mem / space_per_minheight;
695
+ /* If there doesn't seem to be enough space, try to get the minimum
696
+ * anyway. This allows a "stub" implementation of jpeg_mem_available().
697
+ */
698
+ if (max_minheights <= 0)
699
+ max_minheights = 1;
700
+ }
701
+
702
+ /* Allocate the in-memory buffers and initialize backing store as needed. */
703
+
704
+ for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
705
+ if (sptr->mem_buffer == NULL) { /* if not realized yet */
706
+ minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
707
+ if (minheights <= max_minheights) {
708
+ /* This buffer fits in memory */
709
+ sptr->rows_in_mem = sptr->rows_in_array;
710
+ } else {
711
+ /* It doesn't fit in memory, create backing store. */
712
+ sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess);
713
+ jpeg_open_backing_store(cinfo, & sptr->b_s_info,
714
+ (long) sptr->rows_in_array *
715
+ (long) sptr->samplesperrow *
716
+ (long) sizeof(JSAMPLE));
717
+ sptr->b_s_open = TRUE;
718
+ }
719
+ sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
720
+ sptr->samplesperrow, sptr->rows_in_mem);
721
+ sptr->rowsperchunk = mem->last_rowsperchunk;
722
+ sptr->cur_start_row = 0;
723
+ sptr->first_undef_row = 0;
724
+ sptr->dirty = FALSE;
725
+ }
726
+ }
727
+
728
+ for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
729
+ if (bptr->mem_buffer == NULL) { /* if not realized yet */
730
+ minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
731
+ if (minheights <= max_minheights) {
732
+ /* This buffer fits in memory */
733
+ bptr->rows_in_mem = bptr->rows_in_array;
734
+ } else {
735
+ /* It doesn't fit in memory, create backing store. */
736
+ bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess);
737
+ jpeg_open_backing_store(cinfo, & bptr->b_s_info,
738
+ (long) bptr->rows_in_array *
739
+ (long) bptr->blocksperrow *
740
+ (long) sizeof(JBLOCK));
741
+ bptr->b_s_open = TRUE;
742
+ }
743
+ bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
744
+ bptr->blocksperrow, bptr->rows_in_mem);
745
+ bptr->rowsperchunk = mem->last_rowsperchunk;
746
+ bptr->cur_start_row = 0;
747
+ bptr->first_undef_row = 0;
748
+ bptr->dirty = FALSE;
749
+ }
750
+ }
751
+ }
752
+
753
+
754
+ LOCAL(void)
755
+ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
756
+ /* Do backing store read or write of a virtual sample array */
757
+ {
758
+ long bytesperrow, file_offset, byte_count, rows, thisrow, i;
759
+
760
+ bytesperrow = (long) ptr->samplesperrow * sizeof(JSAMPLE);
761
+ file_offset = ptr->cur_start_row * bytesperrow;
762
+ /* Loop to read or write each allocation chunk in mem_buffer */
763
+ for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
764
+ /* One chunk, but check for short chunk at end of buffer */
765
+ rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);
766
+ /* Transfer no more than is currently defined */
767
+ thisrow = (long) ptr->cur_start_row + i;
768
+ rows = MIN(rows, (long) ptr->first_undef_row - thisrow);
769
+ /* Transfer no more than fits in file */
770
+ rows = MIN(rows, (long) ptr->rows_in_array - thisrow);
771
+ if (rows <= 0) /* this chunk might be past end of file! */
772
+ break;
773
+ byte_count = rows * bytesperrow;
774
+ if (writing)
775
+ (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,
776
+ (void *) ptr->mem_buffer[i],
777
+ file_offset, byte_count);
778
+ else
779
+ (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,
780
+ (void *) ptr->mem_buffer[i],
781
+ file_offset, byte_count);
782
+ file_offset += byte_count;
783
+ }
784
+ }
785
+
786
+
787
+ LOCAL(void)
788
+ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
789
+ /* Do backing store read or write of a virtual coefficient-block array */
790
+ {
791
+ long bytesperrow, file_offset, byte_count, rows, thisrow, i;
792
+
793
+ bytesperrow = (long) ptr->blocksperrow * sizeof(JBLOCK);
794
+ file_offset = ptr->cur_start_row * bytesperrow;
795
+ /* Loop to read or write each allocation chunk in mem_buffer */
796
+ for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
797
+ /* One chunk, but check for short chunk at end of buffer */
798
+ rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);
799
+ /* Transfer no more than is currently defined */
800
+ thisrow = (long) ptr->cur_start_row + i;
801
+ rows = MIN(rows, (long) ptr->first_undef_row - thisrow);
802
+ /* Transfer no more than fits in file */
803
+ rows = MIN(rows, (long) ptr->rows_in_array - thisrow);
804
+ if (rows <= 0) /* this chunk might be past end of file! */
805
+ break;
806
+ byte_count = rows * bytesperrow;
807
+ if (writing)
808
+ (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,
809
+ (void *) ptr->mem_buffer[i],
810
+ file_offset, byte_count);
811
+ else
812
+ (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,
813
+ (void *) ptr->mem_buffer[i],
814
+ file_offset, byte_count);
815
+ file_offset += byte_count;
816
+ }
817
+ }
818
+
819
+
820
+ METHODDEF(JSAMPARRAY)
821
+ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
822
+ JDIMENSION start_row, JDIMENSION num_rows,
823
+ boolean writable)
824
+ /* Access the part of a virtual sample array starting at start_row */
825
+ /* and extending for num_rows rows. writable is true if */
826
+ /* caller intends to modify the accessed area. */
827
+ {
828
+ JDIMENSION end_row = start_row + num_rows;
829
+ JDIMENSION undef_row;
830
+
831
+ /* debugging check */
832
+ if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
833
+ ptr->mem_buffer == NULL)
834
+ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
835
+
836
+ /* Make the desired part of the virtual array accessible */
837
+ if (start_row < ptr->cur_start_row ||
838
+ end_row > ptr->cur_start_row+ptr->rows_in_mem) {
839
+ if (! ptr->b_s_open)
840
+ ERREXIT(cinfo, JERR_VIRTUAL_BUG);
841
+ /* Flush old buffer contents if necessary */
842
+ if (ptr->dirty) {
843
+ do_sarray_io(cinfo, ptr, TRUE);
844
+ ptr->dirty = FALSE;
845
+ }
846
+ /* Decide what part of virtual array to access.
847
+ * Algorithm: if target address > current window, assume forward scan,
848
+ * load starting at target address. If target address < current window,
849
+ * assume backward scan, load so that target area is top of window.
850
+ * Note that when switching from forward write to forward read, will have
851
+ * start_row = 0, so the limiting case applies and we load from 0 anyway.
852
+ */
853
+ if (start_row > ptr->cur_start_row) {
854
+ ptr->cur_start_row = start_row;
855
+ } else {
856
+ /* use long arithmetic here to avoid overflow & unsigned problems */
857
+ long ltemp;
858
+
859
+ ltemp = (long) end_row - (long) ptr->rows_in_mem;
860
+ if (ltemp < 0)
861
+ ltemp = 0; /* don't fall off front end of file */
862
+ ptr->cur_start_row = (JDIMENSION) ltemp;
863
+ }
864
+ /* Read in the selected part of the array.
865
+ * During the initial write pass, we will do no actual read
866
+ * because the selected part is all undefined.
867
+ */
868
+ do_sarray_io(cinfo, ptr, FALSE);
869
+ }
870
+ /* Ensure the accessed part of the array is defined; prezero if needed.
871
+ * To improve locality of access, we only prezero the part of the array
872
+ * that the caller is about to access, not the entire in-memory array.
873
+ */
874
+ if (ptr->first_undef_row < end_row) {
875
+ if (ptr->first_undef_row < start_row) {
876
+ if (writable) /* writer skipped over a section of array */
877
+ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
878
+ undef_row = start_row; /* but reader is allowed to read ahead */
879
+ } else {
880
+ undef_row = ptr->first_undef_row;
881
+ }
882
+ if (writable)
883
+ ptr->first_undef_row = end_row;
884
+ if (ptr->pre_zero) {
885
+ size_t bytesperrow = (size_t) ptr->samplesperrow * sizeof(JSAMPLE);
886
+ undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
887
+ end_row -= ptr->cur_start_row;
888
+ while (undef_row < end_row) {
889
+ jzero_far((void *) ptr->mem_buffer[undef_row], bytesperrow);
890
+ undef_row++;
891
+ }
892
+ } else {
893
+ if (! writable) /* reader looking at undefined data */
894
+ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
895
+ }
896
+ }
897
+ /* Flag the buffer dirty if caller will write in it */
898
+ if (writable)
899
+ ptr->dirty = TRUE;
900
+ /* Return address of proper part of the buffer */
901
+ return ptr->mem_buffer + (start_row - ptr->cur_start_row);
902
+ }
903
+
904
+
905
+ METHODDEF(JBLOCKARRAY)
906
+ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
907
+ JDIMENSION start_row, JDIMENSION num_rows,
908
+ boolean writable)
909
+ /* Access the part of a virtual block array starting at start_row */
910
+ /* and extending for num_rows rows. writable is true if */
911
+ /* caller intends to modify the accessed area. */
912
+ {
913
+ JDIMENSION end_row = start_row + num_rows;
914
+ JDIMENSION undef_row;
915
+
916
+ /* debugging check */
917
+ if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
918
+ ptr->mem_buffer == NULL)
919
+ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
920
+
921
+ /* Make the desired part of the virtual array accessible */
922
+ if (start_row < ptr->cur_start_row ||
923
+ end_row > ptr->cur_start_row+ptr->rows_in_mem) {
924
+ if (! ptr->b_s_open)
925
+ ERREXIT(cinfo, JERR_VIRTUAL_BUG);
926
+ /* Flush old buffer contents if necessary */
927
+ if (ptr->dirty) {
928
+ do_barray_io(cinfo, ptr, TRUE);
929
+ ptr->dirty = FALSE;
930
+ }
931
+ /* Decide what part of virtual array to access.
932
+ * Algorithm: if target address > current window, assume forward scan,
933
+ * load starting at target address. If target address < current window,
934
+ * assume backward scan, load so that target area is top of window.
935
+ * Note that when switching from forward write to forward read, will have
936
+ * start_row = 0, so the limiting case applies and we load from 0 anyway.
937
+ */
938
+ if (start_row > ptr->cur_start_row) {
939
+ ptr->cur_start_row = start_row;
940
+ } else {
941
+ /* use long arithmetic here to avoid overflow & unsigned problems */
942
+ long ltemp;
943
+
944
+ ltemp = (long) end_row - (long) ptr->rows_in_mem;
945
+ if (ltemp < 0)
946
+ ltemp = 0; /* don't fall off front end of file */
947
+ ptr->cur_start_row = (JDIMENSION) ltemp;
948
+ }
949
+ /* Read in the selected part of the array.
950
+ * During the initial write pass, we will do no actual read
951
+ * because the selected part is all undefined.
952
+ */
953
+ do_barray_io(cinfo, ptr, FALSE);
954
+ }
955
+ /* Ensure the accessed part of the array is defined; prezero if needed.
956
+ * To improve locality of access, we only prezero the part of the array
957
+ * that the caller is about to access, not the entire in-memory array.
958
+ */
959
+ if (ptr->first_undef_row < end_row) {
960
+ if (ptr->first_undef_row < start_row) {
961
+ if (writable) /* writer skipped over a section of array */
962
+ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
963
+ undef_row = start_row; /* but reader is allowed to read ahead */
964
+ } else {
965
+ undef_row = ptr->first_undef_row;
966
+ }
967
+ if (writable)
968
+ ptr->first_undef_row = end_row;
969
+ if (ptr->pre_zero) {
970
+ size_t bytesperrow = (size_t) ptr->blocksperrow * sizeof(JBLOCK);
971
+ undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
972
+ end_row -= ptr->cur_start_row;
973
+ while (undef_row < end_row) {
974
+ jzero_far((void *) ptr->mem_buffer[undef_row], bytesperrow);
975
+ undef_row++;
976
+ }
977
+ } else {
978
+ if (! writable) /* reader looking at undefined data */
979
+ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
980
+ }
981
+ }
982
+ /* Flag the buffer dirty if caller will write in it */
983
+ if (writable)
984
+ ptr->dirty = TRUE;
985
+ /* Return address of proper part of the buffer */
986
+ return ptr->mem_buffer + (start_row - ptr->cur_start_row);
987
+ }
988
+
989
+
990
+ /*
991
+ * Release all objects belonging to a specified pool.
992
+ */
993
+
994
+ METHODDEF(void)
995
+ free_pool (j_common_ptr cinfo, int pool_id)
996
+ {
997
+ my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
998
+ small_pool_ptr shdr_ptr;
999
+ large_pool_ptr lhdr_ptr;
1000
+ size_t space_freed;
1001
+
1002
+ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
1003
+ ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
1004
+
1005
+ #ifdef MEM_STATS
1006
+ if (cinfo->err->trace_level > 1)
1007
+ print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
1008
+ #endif
1009
+
1010
+ /* If freeing IMAGE pool, close any virtual arrays first */
1011
+ if (pool_id == JPOOL_IMAGE) {
1012
+ jvirt_sarray_ptr sptr;
1013
+ jvirt_barray_ptr bptr;
1014
+
1015
+ for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
1016
+ if (sptr->b_s_open) { /* there may be no backing store */
1017
+ sptr->b_s_open = FALSE; /* prevent recursive close if error */
1018
+ (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info);
1019
+ }
1020
+ }
1021
+ mem->virt_sarray_list = NULL;
1022
+ for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
1023
+ if (bptr->b_s_open) { /* there may be no backing store */
1024
+ bptr->b_s_open = FALSE; /* prevent recursive close if error */
1025
+ (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info);
1026
+ }
1027
+ }
1028
+ mem->virt_barray_list = NULL;
1029
+ }
1030
+
1031
+ /* Release large objects */
1032
+ lhdr_ptr = mem->large_list[pool_id];
1033
+ mem->large_list[pool_id] = NULL;
1034
+
1035
+ while (lhdr_ptr != NULL) {
1036
+ large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
1037
+ space_freed = lhdr_ptr->bytes_used +
1038
+ lhdr_ptr->bytes_left +
1039
+ sizeof(large_pool_hdr);
1040
+ jpeg_free_large(cinfo, (void *) lhdr_ptr, space_freed);
1041
+ mem->total_space_allocated -= space_freed;
1042
+ lhdr_ptr = next_lhdr_ptr;
1043
+ }
1044
+
1045
+ /* Release small objects */
1046
+ shdr_ptr = mem->small_list[pool_id];
1047
+ mem->small_list[pool_id] = NULL;
1048
+
1049
+ while (shdr_ptr != NULL) {
1050
+ small_pool_ptr next_shdr_ptr = shdr_ptr->next;
1051
+ space_freed = shdr_ptr->bytes_used +
1052
+ shdr_ptr->bytes_left +
1053
+ sizeof(small_pool_hdr);
1054
+ jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed);
1055
+ mem->total_space_allocated -= space_freed;
1056
+ shdr_ptr = next_shdr_ptr;
1057
+ }
1058
+ }
1059
+
1060
+
1061
+ /*
1062
+ * Close up shop entirely.
1063
+ * Note that this cannot be called unless cinfo->mem is non-NULL.
1064
+ */
1065
+
1066
+ METHODDEF(void)
1067
+ self_destruct (j_common_ptr cinfo)
1068
+ {
1069
+ int pool;
1070
+
1071
+ /* Close all backing store, release all memory.
1072
+ * Releasing pools in reverse order might help avoid fragmentation
1073
+ * with some (brain-damaged) malloc libraries.
1074
+ */
1075
+ for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
1076
+ free_pool(cinfo, pool);
1077
+ }
1078
+
1079
+ /* Release the memory manager control block too. */
1080
+ jpeg_free_small(cinfo, (void *) cinfo->mem, sizeof(my_memory_mgr));
1081
+ cinfo->mem = NULL; /* ensures I will be called only once */
1082
+
1083
+ jpeg_mem_term(cinfo); /* system-dependent cleanup */
1084
+ }
1085
+
1086
+
1087
+ /*
1088
+ * Memory manager initialization.
1089
+ * When this is called, only the error manager pointer is valid in cinfo!
1090
+ */
1091
+
1092
+ GLOBAL(void)
1093
+ jinit_memory_mgr (j_common_ptr cinfo)
1094
+ {
1095
+ my_mem_ptr mem;
1096
+ long max_to_use;
1097
+ int pool;
1098
+ size_t test_mac;
1099
+
1100
+ cinfo->mem = NULL; /* for safety if init fails */
1101
+
1102
+ /* Check for configuration errors.
1103
+ * sizeof(ALIGN_TYPE) should be a power of 2; otherwise, it probably
1104
+ * doesn't reflect any real hardware alignment requirement.
1105
+ * The test is a little tricky: for X>0, X and X-1 have no one-bits
1106
+ * in common if and only if X is a power of 2, ie has only one one-bit.
1107
+ * Some compilers may give an "unreachable code" warning here; ignore it.
1108
+ */
1109
+ if ((ALIGN_SIZE & (ALIGN_SIZE-1)) != 0)
1110
+ ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
1111
+ /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
1112
+ * a multiple of ALIGN_SIZE.
1113
+ * Again, an "unreachable code" warning may be ignored here.
1114
+ * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
1115
+ */
1116
+ test_mac = (size_t) MAX_ALLOC_CHUNK;
1117
+ if ((long) test_mac != MAX_ALLOC_CHUNK ||
1118
+ (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
1119
+ ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
1120
+
1121
+ max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
1122
+
1123
+ /* Attempt to allocate memory manager's control block */
1124
+ mem = (my_mem_ptr) jpeg_get_small(cinfo, sizeof(my_memory_mgr));
1125
+
1126
+ if (mem == NULL) {
1127
+ jpeg_mem_term(cinfo); /* system-dependent cleanup */
1128
+ ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0);
1129
+ }
1130
+
1131
+ /* OK, fill in the method pointers */
1132
+ mem->pub.alloc_small = alloc_small;
1133
+ mem->pub.alloc_large = alloc_large;
1134
+ mem->pub.alloc_sarray = alloc_sarray;
1135
+ mem->pub.alloc_barray = alloc_barray;
1136
+ mem->pub.request_virt_sarray = request_virt_sarray;
1137
+ mem->pub.request_virt_barray = request_virt_barray;
1138
+ mem->pub.realize_virt_arrays = realize_virt_arrays;
1139
+ mem->pub.access_virt_sarray = access_virt_sarray;
1140
+ mem->pub.access_virt_barray = access_virt_barray;
1141
+ mem->pub.free_pool = free_pool;
1142
+ mem->pub.self_destruct = self_destruct;
1143
+
1144
+ /* Make MAX_ALLOC_CHUNK accessible to other modules */
1145
+ mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
1146
+
1147
+ /* Initialize working state */
1148
+ mem->pub.max_memory_to_use = max_to_use;
1149
+
1150
+ for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
1151
+ mem->small_list[pool] = NULL;
1152
+ mem->large_list[pool] = NULL;
1153
+ }
1154
+ mem->virt_sarray_list = NULL;
1155
+ mem->virt_barray_list = NULL;
1156
+
1157
+ mem->total_space_allocated = sizeof(my_memory_mgr);
1158
+
1159
+ /* Declare ourselves open for business */
1160
+ cinfo->mem = & mem->pub;
1161
+
1162
+ /* Check for an environment variable JPEGMEM; if found, override the
1163
+ * default max_memory setting from jpeg_mem_init. Note that the
1164
+ * surrounding application may again override this value.
1165
+ * If your system doesn't support getenv(), define NO_GETENV to disable
1166
+ * this feature.
1167
+ */
1168
+ #ifndef NO_GETENV
1169
+ { char *memenv;
1170
+
1171
+ if ((memenv = getenv("JPEGMEM")) != NULL) {
1172
+ char ch = 'x';
1173
+
1174
+ if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
1175
+ if (ch == 'm' || ch == 'M')
1176
+ max_to_use *= 1000L;
1177
+ mem->pub.max_memory_to_use = max_to_use * 1000L;
1178
+ }
1179
+ }
1180
+ }
1181
+ #endif
1182
+
1183
+ }