@patleeman/pi-boy 0.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 (1361) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +189 -0
  3. package/index.ts +1 -0
  4. package/mgba-bridge/build.sh +31 -0
  5. package/mgba-bridge/src/main.c +740 -0
  6. package/mgba-bridge/vendor/mgba/.clang-format +34 -0
  7. package/mgba-bridge/vendor/mgba/.gitlab-ci.yml +267 -0
  8. package/mgba-bridge/vendor/mgba/CHANGES +2094 -0
  9. package/mgba-bridge/vendor/mgba/CMakeLists.txt +1373 -0
  10. package/mgba-bridge/vendor/mgba/CMakePresets.json +21 -0
  11. package/mgba-bridge/vendor/mgba/CONTRIBUTING.md +196 -0
  12. package/mgba-bridge/vendor/mgba/LICENSE +373 -0
  13. package/mgba-bridge/vendor/mgba/Makefile +1 -0
  14. package/mgba-bridge/vendor/mgba/Makefile.libretro +490 -0
  15. package/mgba-bridge/vendor/mgba/PORTING.md +21 -0
  16. package/mgba-bridge/vendor/mgba/README.md +270 -0
  17. package/mgba-bridge/vendor/mgba/README_DE.md +255 -0
  18. package/mgba-bridge/vendor/mgba/README_ES.md +255 -0
  19. package/mgba-bridge/vendor/mgba/README_JP.md +268 -0
  20. package/mgba-bridge/vendor/mgba/README_ZH_CN.md +268 -0
  21. package/mgba-bridge/vendor/mgba/Tupfile +3 -0
  22. package/mgba-bridge/vendor/mgba/include/mgba/core/bitmap-cache.h +64 -0
  23. package/mgba-bridge/vendor/mgba/include/mgba/core/cache-set.h +38 -0
  24. package/mgba-bridge/vendor/mgba/include/mgba/core/cheats.h +130 -0
  25. package/mgba-bridge/vendor/mgba/include/mgba/core/config.h +118 -0
  26. package/mgba-bridge/vendor/mgba/include/mgba/core/core.h +232 -0
  27. package/mgba-bridge/vendor/mgba/include/mgba/core/cpu.h +40 -0
  28. package/mgba-bridge/vendor/mgba/include/mgba/core/directories.h +42 -0
  29. package/mgba-bridge/vendor/mgba/include/mgba/core/input.h +91 -0
  30. package/mgba-bridge/vendor/mgba/include/mgba/core/interface.h +199 -0
  31. package/mgba-bridge/vendor/mgba/include/mgba/core/library.h +62 -0
  32. package/mgba-bridge/vendor/mgba/include/mgba/core/lockstep.h +77 -0
  33. package/mgba-bridge/vendor/mgba/include/mgba/core/log.h +88 -0
  34. package/mgba-bridge/vendor/mgba/include/mgba/core/map-cache.h +82 -0
  35. package/mgba-bridge/vendor/mgba/include/mgba/core/mem-search.h +62 -0
  36. package/mgba-bridge/vendor/mgba/include/mgba/core/rewind.h +47 -0
  37. package/mgba-bridge/vendor/mgba/include/mgba/core/scripting.h +65 -0
  38. package/mgba-bridge/vendor/mgba/include/mgba/core/serialize.h +61 -0
  39. package/mgba-bridge/vendor/mgba/include/mgba/core/sync.h +44 -0
  40. package/mgba-bridge/vendor/mgba/include/mgba/core/thread.h +135 -0
  41. package/mgba-bridge/vendor/mgba/include/mgba/core/tile-cache.h +63 -0
  42. package/mgba-bridge/vendor/mgba/include/mgba/core/timing.h +55 -0
  43. package/mgba-bridge/vendor/mgba/include/mgba/core/version.h +27 -0
  44. package/mgba-bridge/vendor/mgba/include/mgba/debugger/debugger.h +267 -0
  45. package/mgba-bridge/vendor/mgba/include/mgba/feature/commandline.h +71 -0
  46. package/mgba-bridge/vendor/mgba/include/mgba/feature/proxy-backend.h +83 -0
  47. package/mgba-bridge/vendor/mgba/include/mgba/feature/thread-proxy.h +41 -0
  48. package/mgba-bridge/vendor/mgba/include/mgba/feature/updater.h +51 -0
  49. package/mgba-bridge/vendor/mgba/include/mgba/feature/video-backend.h +81 -0
  50. package/mgba-bridge/vendor/mgba/include/mgba/feature/video-logger.h +145 -0
  51. package/mgba-bridge/vendor/mgba/include/mgba/gb/core.h +21 -0
  52. package/mgba-bridge/vendor/mgba/include/mgba/gb/interface.h +112 -0
  53. package/mgba-bridge/vendor/mgba/include/mgba/gba/core.h +21 -0
  54. package/mgba-bridge/vendor/mgba/include/mgba/gba/interface.h +168 -0
  55. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/arm.h +217 -0
  56. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/debugger/cli-debugger.h +18 -0
  57. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/debugger/debugger.h +52 -0
  58. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/debugger/memory-debugger.h +20 -0
  59. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/decoder-inlines.h +37 -0
  60. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/decoder.h +231 -0
  61. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/emitter-arm.h +336 -0
  62. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/emitter-inlines.h +32 -0
  63. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/emitter-thumb.h +113 -0
  64. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/isa-arm.h +22 -0
  65. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/isa-inlines.h +186 -0
  66. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/isa-thumb.h +20 -0
  67. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/macros.h +18 -0
  68. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/access-logger.h +57 -0
  69. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/cli-debugger.h +108 -0
  70. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/cli-el-backend.h +21 -0
  71. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/gdb-stub.h +62 -0
  72. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/parser.h +81 -0
  73. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/stack-trace.h +32 -0
  74. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/symbols.h +29 -0
  75. package/mgba-bridge/vendor/mgba/include/mgba/internal/defines.h +31 -0
  76. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/audio.h +257 -0
  77. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/cheats.h +26 -0
  78. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/debugger/cli.h +28 -0
  79. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/debugger/debugger.h +20 -0
  80. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/debugger/symbols.h +19 -0
  81. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/gb.h +202 -0
  82. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/input.h +31 -0
  83. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/io.h +127 -0
  84. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/mbc.h +72 -0
  85. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/memory.h +385 -0
  86. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/overrides.h +21 -0
  87. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/renderers/cache-set.h +23 -0
  88. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/renderers/proxy.h +29 -0
  89. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/renderers/software.h +72 -0
  90. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/serialize.h +536 -0
  91. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/sio/lockstep.h +49 -0
  92. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/sio/printer.h +74 -0
  93. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/sio.h +52 -0
  94. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/timer.h +45 -0
  95. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/video.h +201 -0
  96. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/audio.h +291 -0
  97. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/bios.h +73 -0
  98. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cart/ereader.h +127 -0
  99. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cart/gpio.h +110 -0
  100. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cart/matrix.h +35 -0
  101. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cart/unlicensed.h +77 -0
  102. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cheats.h +175 -0
  103. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/debugger/cli.h +30 -0
  104. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/dma.h +73 -0
  105. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/gba.h +194 -0
  106. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/input.h +34 -0
  107. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/io.h +190 -0
  108. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/memory.h +184 -0
  109. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/overrides.h +21 -0
  110. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/cache-set.h +22 -0
  111. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/common.h +27 -0
  112. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/gl.h +218 -0
  113. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/proxy.h +29 -0
  114. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/video-software.h +160 -0
  115. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/savedata.h +130 -0
  116. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/serialize.h +496 -0
  117. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sharkport.h +27 -0
  118. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sio/dolphin.h +41 -0
  119. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sio/gbp.h +38 -0
  120. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sio/lockstep.h +95 -0
  121. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sio.h +98 -0
  122. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/timer.h +36 -0
  123. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/video.h +251 -0
  124. package/mgba-bridge/vendor/mgba/include/mgba/internal/script/lua.h +12 -0
  125. package/mgba-bridge/vendor/mgba/include/mgba/internal/script/socket.h +31 -0
  126. package/mgba-bridge/vendor/mgba/include/mgba/internal/script/types.h +20 -0
  127. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/debugger/cli-debugger.h +18 -0
  128. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/debugger/debugger.h +43 -0
  129. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/debugger/memory-debugger.h +20 -0
  130. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/decoder.h +113 -0
  131. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/emitter-sm83.h +528 -0
  132. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/isa-sm83.h +20 -0
  133. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/sm83.h +174 -0
  134. package/mgba-bridge/vendor/mgba/include/mgba/script/base.h +28 -0
  135. package/mgba-bridge/vendor/mgba/include/mgba/script/canvas.h +24 -0
  136. package/mgba-bridge/vendor/mgba/include/mgba/script/console.h +51 -0
  137. package/mgba-bridge/vendor/mgba/include/mgba/script/context.h +126 -0
  138. package/mgba-bridge/vendor/mgba/include/mgba/script/input.h +272 -0
  139. package/mgba-bridge/vendor/mgba/include/mgba/script/macros.h +680 -0
  140. package/mgba-bridge/vendor/mgba/include/mgba/script/storage.h +28 -0
  141. package/mgba-bridge/vendor/mgba/include/mgba/script/types.h +400 -0
  142. package/mgba-bridge/vendor/mgba/include/mgba/script.h +18 -0
  143. package/mgba-bridge/vendor/mgba/include/mgba-util/audio-buffer.h +34 -0
  144. package/mgba-bridge/vendor/mgba/include/mgba-util/audio-resampler.h +42 -0
  145. package/mgba-bridge/vendor/mgba/include/mgba-util/circle-buffer.h +39 -0
  146. package/mgba-bridge/vendor/mgba/include/mgba-util/common.h +352 -0
  147. package/mgba-bridge/vendor/mgba/include/mgba-util/configuration.h +50 -0
  148. package/mgba-bridge/vendor/mgba/include/mgba-util/convolve.h +33 -0
  149. package/mgba-bridge/vendor/mgba/include/mgba-util/crc32.h +26 -0
  150. package/mgba-bridge/vendor/mgba/include/mgba-util/dllexports.h +19 -0
  151. package/mgba-bridge/vendor/mgba/include/mgba-util/elf-read.h +45 -0
  152. package/mgba-bridge/vendor/mgba/include/mgba-util/formatting.h +36 -0
  153. package/mgba-bridge/vendor/mgba/include/mgba-util/geometry.h +31 -0
  154. package/mgba-bridge/vendor/mgba/include/mgba-util/gui/file-select.h +21 -0
  155. package/mgba-bridge/vendor/mgba/include/mgba-util/gui/font-metrics.h +15 -0
  156. package/mgba-bridge/vendor/mgba/include/mgba-util/gui/font.h +149 -0
  157. package/mgba-bridge/vendor/mgba/include/mgba-util/gui/menu.h +126 -0
  158. package/mgba-bridge/vendor/mgba/include/mgba-util/gui.h +136 -0
  159. package/mgba-bridge/vendor/mgba/include/mgba-util/hash.h +17 -0
  160. package/mgba-bridge/vendor/mgba/include/mgba-util/image/export.h +20 -0
  161. package/mgba-bridge/vendor/mgba/include/mgba-util/image/png-io.h +54 -0
  162. package/mgba-bridge/vendor/mgba/include/mgba-util/image.h +442 -0
  163. package/mgba-bridge/vendor/mgba/include/mgba-util/interpolator.h +51 -0
  164. package/mgba-bridge/vendor/mgba/include/mgba-util/macros.h +92 -0
  165. package/mgba-bridge/vendor/mgba/include/mgba-util/math.h +145 -0
  166. package/mgba-bridge/vendor/mgba/include/mgba-util/md5.h +34 -0
  167. package/mgba-bridge/vendor/mgba/include/mgba-util/memory.h +18 -0
  168. package/mgba-bridge/vendor/mgba/include/mgba-util/patch/fast.h +38 -0
  169. package/mgba-bridge/vendor/mgba/include/mgba-util/patch/ips.h +19 -0
  170. package/mgba-bridge/vendor/mgba/include/mgba-util/patch/ups.h +19 -0
  171. package/mgba-bridge/vendor/mgba/include/mgba-util/patch.h +26 -0
  172. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/3ds/3ds-vfs.h +17 -0
  173. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/3ds/threading.h +88 -0
  174. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/posix/threading.h +125 -0
  175. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/psp2/sce-vfs.h +18 -0
  176. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/psp2/threading.h +161 -0
  177. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/switch/threading.h +88 -0
  178. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/windows/getopt.h +609 -0
  179. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/windows/threading.h +106 -0
  180. package/mgba-bridge/vendor/mgba/include/mgba-util/ring-fifo.h +30 -0
  181. package/mgba-bridge/vendor/mgba/include/mgba-util/sfo.h +30 -0
  182. package/mgba-bridge/vendor/mgba/include/mgba-util/sha1.h +33 -0
  183. package/mgba-bridge/vendor/mgba/include/mgba-util/socket.h +542 -0
  184. package/mgba-bridge/vendor/mgba/include/mgba-util/string.h +55 -0
  185. package/mgba-bridge/vendor/mgba/include/mgba-util/table.h +93 -0
  186. package/mgba-bridge/vendor/mgba/include/mgba-util/text-codec.h +36 -0
  187. package/mgba-bridge/vendor/mgba/include/mgba-util/threading.h +123 -0
  188. package/mgba-bridge/vendor/mgba/include/mgba-util/vector.h +128 -0
  189. package/mgba-bridge/vendor/mgba/include/mgba-util/vfs.h +125 -0
  190. package/mgba-bridge/vendor/mgba/intl/activate.py +70 -0
  191. package/mgba-bridge/vendor/mgba/intl/core_option_regex.py +95 -0
  192. package/mgba-bridge/vendor/mgba/intl/core_option_translation.py +633 -0
  193. package/mgba-bridge/vendor/mgba/intl/crowdin.yaml +13 -0
  194. package/mgba-bridge/vendor/mgba/intl/crowdin_prep.py +30 -0
  195. package/mgba-bridge/vendor/mgba/intl/crowdin_source_upload.py +93 -0
  196. package/mgba-bridge/vendor/mgba/intl/crowdin_translate.py +39 -0
  197. package/mgba-bridge/vendor/mgba/intl/crowdin_translation_download.py +93 -0
  198. package/mgba-bridge/vendor/mgba/intl/download_workflow.py +16 -0
  199. package/mgba-bridge/vendor/mgba/intl/initial_sync.py +125 -0
  200. package/mgba-bridge/vendor/mgba/intl/remove_initial_cycle.py +30 -0
  201. package/mgba-bridge/vendor/mgba/intl/upload_workflow.py +15 -0
  202. package/mgba-bridge/vendor/mgba/intl/v1_to_v2_converter.py +483 -0
  203. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_arm64-v8a +96 -0
  204. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_armeabi +96 -0
  205. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_armeabi-v7a +96 -0
  206. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_mips +96 -0
  207. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_mips64 +96 -0
  208. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_x86 +96 -0
  209. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_x86_64 +96 -0
  210. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.common +156 -0
  211. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.linux-portable_x86 +96 -0
  212. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.linux-portable_x86_64 +96 -0
  213. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.linux_x86 +96 -0
  214. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.linux_x86_64 +96 -0
  215. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.mingw_x86 +96 -0
  216. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.mingw_x86_64 +96 -0
  217. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.osx_x86 +96 -0
  218. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.osx_x86_64 +96 -0
  219. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.rules +45 -0
  220. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.vita_arm +96 -0
  221. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.wii_ppc +96 -0
  222. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.windows_x86 +96 -0
  223. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.windows_x86_64 +96 -0
  224. package/mgba-bridge/vendor/mgba/libretro-build/include/libz/zconf.h +511 -0
  225. package/mgba-bridge/vendor/mgba/libretro-build/jni/Android.mk +23 -0
  226. package/mgba-bridge/vendor/mgba/libretro-build/jni/Application.mk +2 -0
  227. package/mgba-bridge/vendor/mgba/libretro-build/link.T +5 -0
  228. package/mgba-bridge/vendor/mgba/link.T +4 -0
  229. package/mgba-bridge/vendor/mgba/opt/libgba/mgba.c +94 -0
  230. package/mgba-bridge/vendor/mgba/opt/libgba/mgba.h +46 -0
  231. package/mgba-bridge/vendor/mgba/src/arm/CMakeLists.txt +19 -0
  232. package/mgba-bridge/vendor/mgba/src/arm/arm.c +264 -0
  233. package/mgba-bridge/vendor/mgba/src/arm/debugger/cli-debugger.c +187 -0
  234. package/mgba-bridge/vendor/mgba/src/arm/debugger/debugger.c +588 -0
  235. package/mgba-bridge/vendor/mgba/src/arm/debugger/memory-debugger.c +158 -0
  236. package/mgba-bridge/vendor/mgba/src/arm/decoder-arm.c +466 -0
  237. package/mgba-bridge/vendor/mgba/src/arm/decoder-thumb.c +344 -0
  238. package/mgba-bridge/vendor/mgba/src/arm/decoder.c +601 -0
  239. package/mgba-bridge/vendor/mgba/src/arm/isa-arm.c +784 -0
  240. package/mgba-bridge/vendor/mgba/src/arm/isa-thumb.c +417 -0
  241. package/mgba-bridge/vendor/mgba/src/core/CMakeLists.txt +47 -0
  242. package/mgba-bridge/vendor/mgba/src/core/bitmap-cache.c +187 -0
  243. package/mgba-bridge/vendor/mgba/src/core/cache-set.c +83 -0
  244. package/mgba-bridge/vendor/mgba/src/core/cheats.c +807 -0
  245. package/mgba-bridge/vendor/mgba/src/core/config.c +548 -0
  246. package/mgba-bridge/vendor/mgba/src/core/core-serialize.c +585 -0
  247. package/mgba-bridge/vendor/mgba/src/core/core.c +539 -0
  248. package/mgba-bridge/vendor/mgba/src/core/directories.c +196 -0
  249. package/mgba-bridge/vendor/mgba/src/core/flags.h.in +204 -0
  250. package/mgba-bridge/vendor/mgba/src/core/input.c +677 -0
  251. package/mgba-bridge/vendor/mgba/src/core/interface.c +154 -0
  252. package/mgba-bridge/vendor/mgba/src/core/library.c +584 -0
  253. package/mgba-bridge/vendor/mgba/src/core/lockstep.c +43 -0
  254. package/mgba-bridge/vendor/mgba/src/core/log.c +294 -0
  255. package/mgba-bridge/vendor/mgba/src/core/map-cache.c +219 -0
  256. package/mgba-bridge/vendor/mgba/src/core/mem-search.c +342 -0
  257. package/mgba-bridge/vendor/mgba/src/core/rewind.c +186 -0
  258. package/mgba-bridge/vendor/mgba/src/core/scripting.c +1481 -0
  259. package/mgba-bridge/vendor/mgba/src/core/sync.c +121 -0
  260. package/mgba-bridge/vendor/mgba/src/core/thread.c +726 -0
  261. package/mgba-bridge/vendor/mgba/src/core/tile-cache.c +283 -0
  262. package/mgba-bridge/vendor/mgba/src/core/timing.c +137 -0
  263. package/mgba-bridge/vendor/mgba/src/core/version.c.in +14 -0
  264. package/mgba-bridge/vendor/mgba/src/debugger/CMakeLists.txt +30 -0
  265. package/mgba-bridge/vendor/mgba/src/debugger/access-logger.c +592 -0
  266. package/mgba-bridge/vendor/mgba/src/debugger/cli-debugger-scripting.c +137 -0
  267. package/mgba-bridge/vendor/mgba/src/debugger/cli-debugger.c +1482 -0
  268. package/mgba-bridge/vendor/mgba/src/debugger/cli-el-backend.c +248 -0
  269. package/mgba-bridge/vendor/mgba/src/debugger/debugger.c +327 -0
  270. package/mgba-bridge/vendor/mgba/src/debugger/gdb-stub.c +918 -0
  271. package/mgba-bridge/vendor/mgba/src/debugger/parser.c +902 -0
  272. package/mgba-bridge/vendor/mgba/src/debugger/stack-trace.c +133 -0
  273. package/mgba-bridge/vendor/mgba/src/debugger/symbols.c +109 -0
  274. package/mgba-bridge/vendor/mgba/src/feature/CMakeLists.txt +24 -0
  275. package/mgba-bridge/vendor/mgba/src/feature/commandline.c +404 -0
  276. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-common.h +95 -0
  277. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-decoder.c +204 -0
  278. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-decoder.h +45 -0
  279. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-encoder.c +960 -0
  280. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-encoder.h +91 -0
  281. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-scale.c +36 -0
  282. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-scale.h +21 -0
  283. package/mgba-bridge/vendor/mgba/src/feature/gui/cheats.c +195 -0
  284. package/mgba-bridge/vendor/mgba/src/feature/gui/cheats.h +18 -0
  285. package/mgba-bridge/vendor/mgba/src/feature/gui/gui-config.c +438 -0
  286. package/mgba-bridge/vendor/mgba/src/feature/gui/gui-config.h +19 -0
  287. package/mgba-bridge/vendor/mgba/src/feature/gui/gui-runner.c +853 -0
  288. package/mgba-bridge/vendor/mgba/src/feature/gui/gui-runner.h +114 -0
  289. package/mgba-bridge/vendor/mgba/src/feature/gui/remap.c +88 -0
  290. package/mgba-bridge/vendor/mgba/src/feature/gui/remap.h +27 -0
  291. package/mgba-bridge/vendor/mgba/src/feature/proxy-backend.c +286 -0
  292. package/mgba-bridge/vendor/mgba/src/feature/thread-proxy.c +213 -0
  293. package/mgba-bridge/vendor/mgba/src/feature/updater.c +227 -0
  294. package/mgba-bridge/vendor/mgba/src/feature/video-backend.c +45 -0
  295. package/mgba-bridge/vendor/mgba/src/feature/video-logger.c +1092 -0
  296. package/mgba-bridge/vendor/mgba/src/gb/CMakeLists.txt +53 -0
  297. package/mgba-bridge/vendor/mgba/src/gb/audio.c +1149 -0
  298. package/mgba-bridge/vendor/mgba/src/gb/cheats.c +190 -0
  299. package/mgba-bridge/vendor/mgba/src/gb/core.c +1539 -0
  300. package/mgba-bridge/vendor/mgba/src/gb/debugger/cli.c +115 -0
  301. package/mgba-bridge/vendor/mgba/src/gb/debugger/debugger.c +46 -0
  302. package/mgba-bridge/vendor/mgba/src/gb/debugger/symbols.c +61 -0
  303. package/mgba-bridge/vendor/mgba/src/gb/extra/proxy.c +328 -0
  304. package/mgba-bridge/vendor/mgba/src/gb/gb.c +1261 -0
  305. package/mgba-bridge/vendor/mgba/src/gb/input.c +29 -0
  306. package/mgba-bridge/vendor/mgba/src/gb/io.c +735 -0
  307. package/mgba-bridge/vendor/mgba/src/gb/mbc/huc-3.c +218 -0
  308. package/mgba-bridge/vendor/mgba/src/gb/mbc/licensed.c +84 -0
  309. package/mgba-bridge/vendor/mgba/src/gb/mbc/mbc-private.h +66 -0
  310. package/mgba-bridge/vendor/mgba/src/gb/mbc/mbc.c +583 -0
  311. package/mgba-bridge/vendor/mgba/src/gb/mbc/pocket-cam.c +142 -0
  312. package/mgba-bridge/vendor/mgba/src/gb/mbc/tama5.c +433 -0
  313. package/mgba-bridge/vendor/mgba/src/gb/mbc/unlicensed.c +601 -0
  314. package/mgba-bridge/vendor/mgba/src/gb/mbc.c +650 -0
  315. package/mgba-bridge/vendor/mgba/src/gb/memory.c +1079 -0
  316. package/mgba-bridge/vendor/mgba/src/gb/overrides.c +939 -0
  317. package/mgba-bridge/vendor/mgba/src/gb/renderers/cache-set.c +129 -0
  318. package/mgba-bridge/vendor/mgba/src/gb/renderers/software.c +1169 -0
  319. package/mgba-bridge/vendor/mgba/src/gb/serialize.c +310 -0
  320. package/mgba-bridge/vendor/mgba/src/gb/sio/lockstep.c +284 -0
  321. package/mgba-bridge/vendor/mgba/src/gb/sio/printer.c +237 -0
  322. package/mgba-bridge/vendor/mgba/src/gb/sio.c +106 -0
  323. package/mgba-bridge/vendor/mgba/src/gb/timer.c +150 -0
  324. package/mgba-bridge/vendor/mgba/src/gb/video.c +1216 -0
  325. package/mgba-bridge/vendor/mgba/src/gba/CMakeLists.txt +62 -0
  326. package/mgba-bridge/vendor/mgba/src/gba/audio.c +555 -0
  327. package/mgba-bridge/vendor/mgba/src/gba/bios.c +981 -0
  328. package/mgba-bridge/vendor/mgba/src/gba/cart/ereader.c +1639 -0
  329. package/mgba-bridge/vendor/mgba/src/gba/cart/gpio.c +584 -0
  330. package/mgba-bridge/vendor/mgba/src/gba/cart/matrix.c +134 -0
  331. package/mgba-bridge/vendor/mgba/src/gba/cart/unlicensed.c +255 -0
  332. package/mgba-bridge/vendor/mgba/src/gba/cart/vfame.c +320 -0
  333. package/mgba-bridge/vendor/mgba/src/gba/cheats/codebreaker.c +323 -0
  334. package/mgba-bridge/vendor/mgba/src/gba/cheats/gameshark.c +318 -0
  335. package/mgba-bridge/vendor/mgba/src/gba/cheats/gameshark.h +32 -0
  336. package/mgba-bridge/vendor/mgba/src/gba/cheats/parv3.c +442 -0
  337. package/mgba-bridge/vendor/mgba/src/gba/cheats/parv3.h +21 -0
  338. package/mgba-bridge/vendor/mgba/src/gba/cheats.c +386 -0
  339. package/mgba-bridge/vendor/mgba/src/gba/core.c +1822 -0
  340. package/mgba-bridge/vendor/mgba/src/gba/debugger/cli.c +116 -0
  341. package/mgba-bridge/vendor/mgba/src/gba/dma.c +363 -0
  342. package/mgba-bridge/vendor/mgba/src/gba/extra/battlechip.c +171 -0
  343. package/mgba-bridge/vendor/mgba/src/gba/extra/proxy.c +408 -0
  344. package/mgba-bridge/vendor/mgba/src/gba/gba.c +1095 -0
  345. package/mgba-bridge/vendor/mgba/src/gba/hle-bios-src.s +400 -0
  346. package/mgba-bridge/vendor/mgba/src/gba/hle-bios.c +103 -0
  347. package/mgba-bridge/vendor/mgba/src/gba/hle-bios.h +17 -0
  348. package/mgba-bridge/vendor/mgba/src/gba/hle-bios.make +18 -0
  349. package/mgba-bridge/vendor/mgba/src/gba/input.c +31 -0
  350. package/mgba-bridge/vendor/mgba/src/gba/io.c +1085 -0
  351. package/mgba-bridge/vendor/mgba/src/gba/memory.c +1974 -0
  352. package/mgba-bridge/vendor/mgba/src/gba/overrides.c +435 -0
  353. package/mgba-bridge/vendor/mgba/src/gba/renderers/cache-set.c +219 -0
  354. package/mgba-bridge/vendor/mgba/src/gba/renderers/common.c +59 -0
  355. package/mgba-bridge/vendor/mgba/src/gba/renderers/gl.c +2137 -0
  356. package/mgba-bridge/vendor/mgba/src/gba/renderers/software-bg.c +228 -0
  357. package/mgba-bridge/vendor/mgba/src/gba/renderers/software-mode0.c +576 -0
  358. package/mgba-bridge/vendor/mgba/src/gba/renderers/software-obj.c +431 -0
  359. package/mgba-bridge/vendor/mgba/src/gba/renderers/software-private.h +283 -0
  360. package/mgba-bridge/vendor/mgba/src/gba/renderers/video-software.c +1117 -0
  361. package/mgba-bridge/vendor/mgba/src/gba/savedata.c +792 -0
  362. package/mgba-bridge/vendor/mgba/src/gba/serialize.c +242 -0
  363. package/mgba-bridge/vendor/mgba/src/gba/sharkport.c +389 -0
  364. package/mgba-bridge/vendor/mgba/src/gba/sio/dolphin.c +217 -0
  365. package/mgba-bridge/vendor/mgba/src/gba/sio/gbp.c +150 -0
  366. package/mgba-bridge/vendor/mgba/src/gba/sio/lockstep.c +1063 -0
  367. package/mgba-bridge/vendor/mgba/src/gba/sio.c +493 -0
  368. package/mgba-bridge/vendor/mgba/src/gba/timer.c +153 -0
  369. package/mgba-bridge/vendor/mgba/src/gba/video.c +470 -0
  370. package/mgba-bridge/vendor/mgba/src/platform/cmake/DMGOverrides.cmake.in +6 -0
  371. package/mgba-bridge/vendor/mgba/src/platform/cmake/DebugStrip.cmake +12 -0
  372. package/mgba-bridge/vendor/mgba/src/platform/cmake/ExportDirectory.cmake +7 -0
  373. package/mgba-bridge/vendor/mgba/src/platform/cmake/FindFeature.cmake +88 -0
  374. package/mgba-bridge/vendor/mgba/src/platform/cmake/FindFunction.cmake +14 -0
  375. package/mgba-bridge/vendor/mgba/src/platform/cmake/FindSDL2.cmake +164 -0
  376. package/mgba-bridge/vendor/mgba/src/platform/cmake/Findepoxy.cmake +10 -0
  377. package/mgba-bridge/vendor/mgba/src/platform/cmake/devkitPro.cmake +44 -0
  378. package/mgba-bridge/vendor/mgba/src/platform/example/client-server/client.c +160 -0
  379. package/mgba-bridge/vendor/mgba/src/platform/example/client-server/server.c +168 -0
  380. package/mgba-bridge/vendor/mgba/src/platform/headless-main.c +379 -0
  381. package/mgba-bridge/vendor/mgba/src/platform/libretro/libretro.c +2611 -0
  382. package/mgba-bridge/vendor/mgba/src/platform/libretro/libretro.h +7846 -0
  383. package/mgba-bridge/vendor/mgba/src/platform/libretro/libretro_core_options.h +721 -0
  384. package/mgba-bridge/vendor/mgba/src/platform/libretro/libretro_core_options_intl.h +17798 -0
  385. package/mgba-bridge/vendor/mgba/src/platform/libretro/memory.c +22 -0
  386. package/mgba-bridge/vendor/mgba/src/platform/libretro/retro_inline.h +39 -0
  387. package/mgba-bridge/vendor/mgba/src/platform/opengl/gl.c +304 -0
  388. package/mgba-bridge/vendor/mgba/src/platform/opengl/gl.h +40 -0
  389. package/mgba-bridge/vendor/mgba/src/platform/opengl/gles2.c +1230 -0
  390. package/mgba-bridge/vendor/mgba/src/platform/opengl/gles2.h +117 -0
  391. package/mgba-bridge/vendor/mgba/src/platform/posix/memory.c +37 -0
  392. package/mgba-bridge/vendor/mgba/src/script/CMakeLists.txt +38 -0
  393. package/mgba-bridge/vendor/mgba/src/script/canvas.c +292 -0
  394. package/mgba-bridge/vendor/mgba/src/script/console.c +141 -0
  395. package/mgba-bridge/vendor/mgba/src/script/context.c +492 -0
  396. package/mgba-bridge/vendor/mgba/src/script/engines/lua.c +1617 -0
  397. package/mgba-bridge/vendor/mgba/src/script/image.c +338 -0
  398. package/mgba-bridge/vendor/mgba/src/script/input.c +612 -0
  399. package/mgba-bridge/vendor/mgba/src/script/socket.c +284 -0
  400. package/mgba-bridge/vendor/mgba/src/script/stdlib.c +306 -0
  401. package/mgba-bridge/vendor/mgba/src/script/storage.c +557 -0
  402. package/mgba-bridge/vendor/mgba/src/script/test.h +29 -0
  403. package/mgba-bridge/vendor/mgba/src/script/types.c +1886 -0
  404. package/mgba-bridge/vendor/mgba/src/sm83/CMakeLists.txt +16 -0
  405. package/mgba-bridge/vendor/mgba/src/sm83/debugger/cli-debugger.c +110 -0
  406. package/mgba-bridge/vendor/mgba/src/sm83/debugger/debugger.c +266 -0
  407. package/mgba-bridge/vendor/mgba/src/sm83/debugger/memory-debugger.c +84 -0
  408. package/mgba-bridge/vendor/mgba/src/sm83/decoder.c +608 -0
  409. package/mgba-bridge/vendor/mgba/src/sm83/isa-sm83.c +817 -0
  410. package/mgba-bridge/vendor/mgba/src/sm83/sm83.c +199 -0
  411. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/.clang-format +92 -0
  412. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/CMakeLists.txt +18 -0
  413. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/LICENSE +19 -0
  414. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/README.md +152 -0
  415. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/discord_register.h +26 -0
  416. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/discord_rpc.h +87 -0
  417. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/LICENSE +24 -0
  418. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/README.md +41 -0
  419. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/condition_variable +549 -0
  420. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/mutex +474 -0
  421. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/shared_mutex +497 -0
  422. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/thread +410 -0
  423. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/allocators.h +271 -0
  424. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/document.h +2573 -0
  425. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/encodedstream.h +299 -0
  426. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/encodings.h +716 -0
  427. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/error/en.h +74 -0
  428. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/error/error.h +155 -0
  429. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/filereadstream.h +99 -0
  430. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/filewritestream.h +104 -0
  431. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/fwd.h +151 -0
  432. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/biginteger.h +290 -0
  433. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/diyfp.h +258 -0
  434. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/dtoa.h +245 -0
  435. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/ieee754.h +78 -0
  436. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/itoa.h +304 -0
  437. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/meta.h +181 -0
  438. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/pow10.h +55 -0
  439. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/regex.h +701 -0
  440. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/stack.h +230 -0
  441. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/strfunc.h +55 -0
  442. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/strtod.h +269 -0
  443. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/swap.h +46 -0
  444. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/istreamwrapper.h +115 -0
  445. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/license.txt +57 -0
  446. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/memorybuffer.h +70 -0
  447. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/memorystream.h +71 -0
  448. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/msinttypes/inttypes.h +316 -0
  449. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/msinttypes/stdint.h +300 -0
  450. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/ostreamwrapper.h +81 -0
  451. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/pointer.h +1358 -0
  452. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/prettywriter.h +255 -0
  453. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/rapidjson.h +615 -0
  454. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/reader.h +1879 -0
  455. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/schema.h +2006 -0
  456. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/stream.h +179 -0
  457. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/stringbuffer.h +117 -0
  458. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/writer.h +610 -0
  459. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/CMakeLists.txt +90 -0
  460. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/backoff.h +40 -0
  461. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/connection.h +19 -0
  462. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/connection_unix.cpp +125 -0
  463. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/connection_win.cpp +128 -0
  464. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/discord_register_linux.cpp +102 -0
  465. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/discord_register_osx.m +80 -0
  466. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/discord_register_win.cpp +185 -0
  467. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/discord_rpc.cpp +504 -0
  468. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/dllmain.cpp +8 -0
  469. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/msg_queue.h +36 -0
  470. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/rpc_connection.cpp +137 -0
  471. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/rpc_connection.h +59 -0
  472. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/serialization.cpp +245 -0
  473. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/serialization.h +215 -0
  474. package/mgba-bridge/vendor/mgba/src/third-party/inih/LICENSE.txt +27 -0
  475. package/mgba-bridge/vendor/mgba/src/third-party/inih/README.md +157 -0
  476. package/mgba-bridge/vendor/mgba/src/third-party/inih/ini.c +288 -0
  477. package/mgba-bridge/vendor/mgba/src/third-party/inih/ini.h +148 -0
  478. package/mgba-bridge/vendor/mgba/src/third-party/libpng/ANNOUNCE +47 -0
  479. package/mgba-bridge/vendor/mgba/src/third-party/libpng/AUTHORS +45 -0
  480. package/mgba-bridge/vendor/mgba/src/third-party/libpng/CHANGES +6109 -0
  481. package/mgba-bridge/vendor/mgba/src/third-party/libpng/CMakeLists.txt +931 -0
  482. package/mgba-bridge/vendor/mgba/src/third-party/libpng/INSTALL +465 -0
  483. package/mgba-bridge/vendor/mgba/src/third-party/libpng/LICENSE +134 -0
  484. package/mgba-bridge/vendor/mgba/src/third-party/libpng/Makefile.am +393 -0
  485. package/mgba-bridge/vendor/mgba/src/third-party/libpng/Makefile.in +2428 -0
  486. package/mgba-bridge/vendor/mgba/src/third-party/libpng/README +183 -0
  487. package/mgba-bridge/vendor/mgba/src/third-party/libpng/TODO +23 -0
  488. package/mgba-bridge/vendor/mgba/src/third-party/libpng/TRADEMARK +8 -0
  489. package/mgba-bridge/vendor/mgba/src/third-party/libpng/aclocal.m4 +1196 -0
  490. package/mgba-bridge/vendor/mgba/src/third-party/libpng/arm/arm_init.c +136 -0
  491. package/mgba-bridge/vendor/mgba/src/third-party/libpng/arm/filter_neon.S +253 -0
  492. package/mgba-bridge/vendor/mgba/src/third-party/libpng/arm/filter_neon_intrinsics.c +402 -0
  493. package/mgba-bridge/vendor/mgba/src/third-party/libpng/arm/palette_neon_intrinsics.c +149 -0
  494. package/mgba-bridge/vendor/mgba/src/third-party/libpng/autogen.sh +225 -0
  495. package/mgba-bridge/vendor/mgba/src/third-party/libpng/compile +348 -0
  496. package/mgba-bridge/vendor/mgba/src/third-party/libpng/config.guess +1476 -0
  497. package/mgba-bridge/vendor/mgba/src/third-party/libpng/config.h.in +126 -0
  498. package/mgba-bridge/vendor/mgba/src/third-party/libpng/config.sub +1801 -0
  499. package/mgba-bridge/vendor/mgba/src/third-party/libpng/configure +16116 -0
  500. package/mgba-bridge/vendor/mgba/src/third-party/libpng/configure.ac +532 -0
  501. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/README.txt +5 -0
  502. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/arm-neon/README +83 -0
  503. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/arm-neon/android-ndk.c +39 -0
  504. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/arm-neon/linux-auxv.c +120 -0
  505. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/arm-neon/linux.c +161 -0
  506. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/README +49 -0
  507. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/pngcp.dfa +57 -0
  508. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/read.dfa +58 -0
  509. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/s_read.dfa +35 -0
  510. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/s_write.dfa +33 -0
  511. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/simple.dfa +36 -0
  512. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/write.dfa +45 -0
  513. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/README.txt +24 -0
  514. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/iccfrompng.c +185 -0
  515. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/pngpixel.c +371 -0
  516. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/pngtopng.c +98 -0
  517. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/simpleover.c +648 -0
  518. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/COPYING +340 -0
  519. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/LICENSE +50 -0
  520. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/Makefile.mingw32 +131 -0
  521. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/Makefile.sgi +105 -0
  522. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/Makefile.unx +134 -0
  523. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/Makefile.w32 +114 -0
  524. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/README +186 -0
  525. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/makevms.com +132 -0
  526. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readpng.c +323 -0
  527. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readpng.h +88 -0
  528. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readpng2.c +521 -0
  529. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readpng2.h +116 -0
  530. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readppm.c +188 -0
  531. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/rpng-win.c +735 -0
  532. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/rpng-x.c +911 -0
  533. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/rpng2-win.c +1261 -0
  534. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/rpng2-x.c +2143 -0
  535. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/toucan.png +0 -0
  536. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/wpng.c +865 -0
  537. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/writepng.c +401 -0
  538. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/writepng.h +133 -0
  539. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/fakepng.c +65 -0
  540. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/gentests.sh +102 -0
  541. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/makepng.c +1941 -0
  542. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngimage.c +1712 -0
  543. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngstest-errors.h +165 -0
  544. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngstest.c +3828 -0
  545. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngunknown.c +1294 -0
  546. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngvalid.c +12230 -0
  547. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/readpng.c +115 -0
  548. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/tarith.c +999 -0
  549. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/timepng.c +608 -0
  550. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/mips-msa/README +83 -0
  551. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/mips-msa/linux.c +64 -0
  552. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/Dockerfile +25 -0
  553. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/README.txt +37 -0
  554. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/build.sh +51 -0
  555. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/libpng_read_fuzzer.cc +190 -0
  556. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/libpng_read_fuzzer.options +2 -0
  557. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/png.dict +39 -0
  558. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/README +5 -0
  559. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/decoder/README +10 -0
  560. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/decoder/makefile +151 -0
  561. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/decoder/pngusr.dfa +40 -0
  562. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/decoder/pngusr.h +23 -0
  563. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/encoder/README +10 -0
  564. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/encoder/makefile +150 -0
  565. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/encoder/pngusr.dfa +39 -0
  566. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/encoder/pngusr.h +23 -0
  567. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/preader/README +15 -0
  568. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/preader/makefile +166 -0
  569. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/preader/pngusr.dfa +40 -0
  570. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/preader/pngusr.h +23 -0
  571. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/CHANGES.txt +13 -0
  572. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/CMakeLists.txt +24 -0
  573. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/LICENSE.txt +22 -0
  574. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/Makefile +62 -0
  575. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/README.txt +120 -0
  576. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/makevms.com +92 -0
  577. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/png2pnm.bat +41 -0
  578. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/png2pnm.c +427 -0
  579. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/png2pnm.sh +42 -0
  580. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pngminus.bat +4 -0
  581. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pngminus.sh +5 -0
  582. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pnm2png.bat +41 -0
  583. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pnm2png.c +620 -0
  584. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pnm2png.sh +42 -0
  585. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/README +107 -0
  586. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/bad_interlace_conversions.txt +9 -0
  587. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g01.png +0 -0
  588. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g02.png +0 -0
  589. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g04.png +0 -0
  590. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g08.png +0 -0
  591. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g16.png +0 -0
  592. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn2c08.png +0 -0
  593. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn2c16.png +0 -0
  594. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn3p01.png +0 -0
  595. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn3p02.png +0 -0
  596. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn3p04.png +0 -0
  597. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn3p08.png +0 -0
  598. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn4a08.png +0 -0
  599. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn4a16.png +0 -0
  600. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn6a08.png +0 -0
  601. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn6a16.png +0 -0
  602. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn0g01.png +0 -0
  603. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn0g02.png +0 -0
  604. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn0g04.png +0 -0
  605. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn2c16.png +0 -0
  606. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn3p08.png +0 -0
  607. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbgn2c16.png +0 -0
  608. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbgn3p08.png +0 -0
  609. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbrn2c08.png +0 -0
  610. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbwn0g16.png +0 -0
  611. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbwn3p08.png +0 -0
  612. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbyn3p08.png +0 -0
  613. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftp0n0g08.png +0 -0
  614. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftp0n2c08.png +0 -0
  615. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftp0n3p08.png +0 -0
  616. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftp1n3p08.png +0 -0
  617. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn0g08.png +0 -0
  618. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn0g16.png +0 -0
  619. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn2c08.png +0 -0
  620. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn2c16.png +0 -0
  621. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn3p08.png +0 -0
  622. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn4a08.png +0 -0
  623. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn4a16.png +0 -0
  624. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn6a08.png +0 -0
  625. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn6a16.png +0 -0
  626. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbbn2c16.png +0 -0
  627. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbbn3p08.png +0 -0
  628. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbgn2c16.png +0 -0
  629. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbgn3p08.png +0 -0
  630. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbrn2c08.png +0 -0
  631. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbwn0g16.png +0 -0
  632. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbwn3p08.png +0 -0
  633. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbyn3p08.png +0 -0
  634. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftp0n0g08.png +0 -0
  635. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftp0n2c08.png +0 -0
  636. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftp0n3p08.png +0 -0
  637. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftp1n3p08.png +0 -0
  638. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/README +2 -0
  639. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn0g01.png +0 -0
  640. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn0g02.png +0 -0
  641. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn0g04.png +0 -0
  642. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn3p01.png +0 -0
  643. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn3p02.png +0 -0
  644. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn3p04.png +0 -0
  645. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/iftbbn0g01.png +0 -0
  646. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/iftbbn0g02.png +0 -0
  647. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/iftbbn0g04.png +0 -0
  648. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/powerpc-vsx/README +81 -0
  649. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/powerpc-vsx/linux.c +57 -0
  650. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/powerpc-vsx/linux_aux.c +34 -0
  651. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/bad_iCCP.png +0 -0
  652. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/badadler.png +0 -0
  653. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/badcrc.png +0 -0
  654. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/empty_ancillary_chunks.png +0 -0
  655. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_IDAT.png +0 -0
  656. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_bKGD_chunk.png +0 -0
  657. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_cHRM_chunk.png +0 -0
  658. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_eXIf_chunk.png +0 -0
  659. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_gAMA_chunk.png +0 -0
  660. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_hIST_chunk.png +0 -0
  661. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_iCCP_chunk.png +0 -0
  662. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_iTXt_chunk.png +0 -0
  663. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_juNK_unsafe_to_copy.png +0 -0
  664. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_juNk_safe_to_copy.png +0 -0
  665. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_pCAL_chunk.png +0 -0
  666. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_pHYs_chunk.png +0 -0
  667. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_sCAL_chunk.png +0 -0
  668. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_sPLT_chunk.png +0 -0
  669. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_sRGB_chunk.png +0 -0
  670. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_sTER_chunk.png +0 -0
  671. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_tEXt_chunk.png +0 -0
  672. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_tIME_chunk.png +0 -0
  673. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_zTXt_chunk.png +0 -0
  674. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-1.8-tRNS.png +0 -0
  675. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-1.8.png +0 -0
  676. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-linear-tRNS.png +0 -0
  677. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-linear.png +0 -0
  678. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-sRGB-tRNS.png +0 -0
  679. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-sRGB.png +0 -0
  680. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-tRNS.png +0 -0
  681. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1.png +0 -0
  682. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-1.8-tRNS.png +0 -0
  683. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-1.8.png +0 -0
  684. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-linear-tRNS.png +0 -0
  685. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-linear.png +0 -0
  686. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-sRGB-tRNS.png +0 -0
  687. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-sRGB.png +0 -0
  688. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-tRNS.png +0 -0
  689. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16.png +0 -0
  690. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-1.8-tRNS.png +0 -0
  691. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-1.8.png +0 -0
  692. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-linear-tRNS.png +0 -0
  693. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-linear.png +0 -0
  694. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-sRGB-tRNS.png +0 -0
  695. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-sRGB.png +0 -0
  696. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-tRNS.png +0 -0
  697. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2.png +0 -0
  698. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-1.8-tRNS.png +0 -0
  699. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-1.8.png +0 -0
  700. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-linear-tRNS.png +0 -0
  701. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-linear.png +0 -0
  702. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-sRGB-tRNS.png +0 -0
  703. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-sRGB.png +0 -0
  704. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-tRNS.png +0 -0
  705. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4.png +0 -0
  706. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-1.8-tRNS.png +0 -0
  707. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-1.8.png +0 -0
  708. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-linear-tRNS.png +0 -0
  709. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-linear.png +0 -0
  710. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-sRGB-tRNS.png +0 -0
  711. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-sRGB.png +0 -0
  712. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-tRNS.png +0 -0
  713. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8.png +0 -0
  714. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-16-1.8.png +0 -0
  715. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-16-linear.png +0 -0
  716. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-16-sRGB.png +0 -0
  717. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-16.png +0 -0
  718. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-8-1.8.png +0 -0
  719. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-8-linear.png +0 -0
  720. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-8-sRGB.png +0 -0
  721. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-8.png +0 -0
  722. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/makepngs.sh +94 -0
  723. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-1.8-tRNS.png +0 -0
  724. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-1.8.png +0 -0
  725. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-linear-tRNS.png +0 -0
  726. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-linear.png +0 -0
  727. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-sRGB-tRNS.png +0 -0
  728. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-sRGB.png +0 -0
  729. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-tRNS.png +0 -0
  730. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1.png +0 -0
  731. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-1.8-tRNS.png +0 -0
  732. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-1.8.png +0 -0
  733. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-linear-tRNS.png +0 -0
  734. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-linear.png +0 -0
  735. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-sRGB-tRNS.png +0 -0
  736. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-sRGB.png +0 -0
  737. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-tRNS.png +0 -0
  738. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2.png +0 -0
  739. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-1.8-tRNS.png +0 -0
  740. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-1.8.png +0 -0
  741. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-linear-tRNS.png +0 -0
  742. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-linear.png +0 -0
  743. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-sRGB-tRNS.png +0 -0
  744. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-sRGB.png +0 -0
  745. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-tRNS.png +0 -0
  746. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4.png +0 -0
  747. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-1.8-tRNS.png +0 -0
  748. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-1.8.png +0 -0
  749. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-linear-tRNS.png +0 -0
  750. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-linear.png +0 -0
  751. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-sRGB-tRNS.png +0 -0
  752. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-sRGB.png +0 -0
  753. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-tRNS.png +0 -0
  754. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8.png +0 -0
  755. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-1.8-tRNS.png +0 -0
  756. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-1.8.png +0 -0
  757. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-linear-tRNS.png +0 -0
  758. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-linear.png +0 -0
  759. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-sRGB-tRNS.png +0 -0
  760. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-sRGB.png +0 -0
  761. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-tRNS.png +0 -0
  762. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16.png +0 -0
  763. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-1.8-tRNS.png +0 -0
  764. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-1.8.png +0 -0
  765. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-linear-tRNS.png +0 -0
  766. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-linear.png +0 -0
  767. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-sRGB-tRNS.png +0 -0
  768. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-sRGB.png +0 -0
  769. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-tRNS.png +0 -0
  770. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8.png +0 -0
  771. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-16-1.8.png +0 -0
  772. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-16-linear.png +0 -0
  773. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-16-sRGB.png +0 -0
  774. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-16.png +0 -0
  775. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-8-1.8.png +0 -0
  776. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-8-linear.png +0 -0
  777. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-8-sRGB.png +0 -0
  778. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-8.png +0 -0
  779. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/README.txt +27 -0
  780. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/checksum-icc.c +102 -0
  781. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/chkfmt +144 -0
  782. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/cvtcolor.c +188 -0
  783. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/genpng.c +881 -0
  784. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/intgamma.sh +110 -0
  785. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/makesRGB.c +430 -0
  786. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/png-fix-itxt.c +164 -0
  787. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/pngcp.c +2453 -0
  788. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/pngfix.c +4049 -0
  789. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/reindent +25 -0
  790. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/sRGB.h +48 -0
  791. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/PngFile.c +454 -0
  792. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/PngFile.h +30 -0
  793. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/README.txt +61 -0
  794. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.c +978 -0
  795. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.dsp +147 -0
  796. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.dsw +29 -0
  797. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.ico +0 -0
  798. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.png +0 -0
  799. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.rc +152 -0
  800. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/cexcept.h +248 -0
  801. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/resource.h +23 -0
  802. package/mgba-bridge/vendor/mgba/src/third-party/libpng/depcomp +791 -0
  803. package/mgba-bridge/vendor/mgba/src/third-party/libpng/example.c +1040 -0
  804. package/mgba-bridge/vendor/mgba/src/third-party/libpng/install-sh +518 -0
  805. package/mgba-bridge/vendor/mgba/src/third-party/libpng/intel/filter_sse2_intrinsics.c +391 -0
  806. package/mgba-bridge/vendor/mgba/src/third-party/libpng/intel/intel_init.c +52 -0
  807. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpng-config.in +127 -0
  808. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpng-manual.txt +5409 -0
  809. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpng.3 +6052 -0
  810. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpng.pc.in +12 -0
  811. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpngpf.3 +24 -0
  812. package/mgba-bridge/vendor/mgba/src/third-party/libpng/ltmain.sh +11147 -0
  813. package/mgba-bridge/vendor/mgba/src/third-party/libpng/mips/filter_msa_intrinsics.c +808 -0
  814. package/mgba-bridge/vendor/mgba/src/third-party/libpng/mips/mips_init.c +130 -0
  815. package/mgba-bridge/vendor/mgba/src/third-party/libpng/missing +215 -0
  816. package/mgba-bridge/vendor/mgba/src/third-party/libpng/png.5 +84 -0
  817. package/mgba-bridge/vendor/mgba/src/third-party/libpng/png.c +4607 -0
  818. package/mgba-bridge/vendor/mgba/src/third-party/libpng/png.h +3247 -0
  819. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngbar.jpg +0 -0
  820. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngbar.png +0 -0
  821. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngconf.h +623 -0
  822. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngdebug.h +153 -0
  823. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngerror.c +963 -0
  824. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngget.c +1249 -0
  825. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pnginfo.h +267 -0
  826. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngmem.c +284 -0
  827. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngnow.png +0 -0
  828. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngpread.c +1096 -0
  829. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngpriv.h +2152 -0
  830. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngread.c +4225 -0
  831. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngrio.c +120 -0
  832. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngrtran.c +5044 -0
  833. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngrutil.c +4681 -0
  834. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngset.c +1802 -0
  835. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngstruct.h +489 -0
  836. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngtest.c +2158 -0
  837. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngtest.png +0 -0
  838. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngtrans.c +864 -0
  839. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngusr.dfa +14 -0
  840. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngwio.c +168 -0
  841. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngwrite.c +2395 -0
  842. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngwtran.c +575 -0
  843. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngwutil.c +2781 -0
  844. package/mgba-bridge/vendor/mgba/src/third-party/libpng/powerpc/filter_vsx_intrinsics.c +768 -0
  845. package/mgba-bridge/vendor/mgba/src/third-party/libpng/powerpc/powerpc_init.c +126 -0
  846. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/libpng.tgt +383 -0
  847. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/libpng.wpj +112 -0
  848. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/pngconfig.mak +160 -0
  849. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/pngstest.tgt +219 -0
  850. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/pngtest.tgt +179 -0
  851. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/pngvalid.tgt +210 -0
  852. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/PRJ0041.mak +21 -0
  853. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/README.txt +58 -0
  854. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/README_zlib.txt +44 -0
  855. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/libpng.sln +60 -0
  856. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/libpng.vcproj +419 -0
  857. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/pngtest.vcproj +267 -0
  858. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/zlib.vcproj +391 -0
  859. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/libpng/libpng.vcxproj +234 -0
  860. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pnglibconf/pnglibconf.vcxproj +61 -0
  861. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pngstest/pngstest.vcxproj +219 -0
  862. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pngtest/pngtest.vcxproj +220 -0
  863. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pngunknown/pngunknown.vcxproj +219 -0
  864. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pngvalid/pngvalid.vcxproj +219 -0
  865. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/vstudio.sln +109 -0
  866. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/zlib/zlib.vcxproj +175 -0
  867. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/zlib.props +57 -0
  868. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/README.txt +79 -0
  869. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/SCOPTIONS.ppc +7 -0
  870. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/checksym.awk +173 -0
  871. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/descrip.mms +52 -0
  872. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/dfn.awk +203 -0
  873. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/genchk.cmake.in +37 -0
  874. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/genout.cmake.in +93 -0
  875. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/gensrc.cmake.in +138 -0
  876. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/intprefix.c +22 -0
  877. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/libpng-config-body.in +96 -0
  878. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/libpng-config-head.in +24 -0
  879. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/libpng.pc.in +10 -0
  880. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/libtool.m4 +8369 -0
  881. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/ltoptions.m4 +437 -0
  882. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/ltsugar.m4 +124 -0
  883. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/ltversion.m4 +23 -0
  884. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/lt~obsolete.m4 +99 -0
  885. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/macro.lst +3 -0
  886. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.32sunu +244 -0
  887. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.64sunu +244 -0
  888. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.acorn +57 -0
  889. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.aix +116 -0
  890. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.amiga +58 -0
  891. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.atari +71 -0
  892. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.bc32 +158 -0
  893. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.beos +222 -0
  894. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.cegcc +116 -0
  895. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.clang +87 -0
  896. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.clang-asan +87 -0
  897. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.darwin +225 -0
  898. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.dec +210 -0
  899. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.dj2 +72 -0
  900. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.freebsd +69 -0
  901. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.gcc +87 -0
  902. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.gcc-asan +87 -0
  903. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.hp64 +231 -0
  904. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.hpgcc +234 -0
  905. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.hpux +229 -0
  906. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.ibmc +90 -0
  907. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.intel +115 -0
  908. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.linux +246 -0
  909. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.linux-opt +265 -0
  910. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.mips +103 -0
  911. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.msys +202 -0
  912. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.netbsd +55 -0
  913. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.openbsd +86 -0
  914. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.sco +226 -0
  915. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.sggcc +236 -0
  916. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.sgi +237 -0
  917. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.so9 +247 -0
  918. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.solaris +243 -0
  919. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.std +134 -0
  920. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.sunos +115 -0
  921. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.vcwin32 +113 -0
  922. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makevms.com +142 -0
  923. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/options.awk +898 -0
  924. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/pnglibconf.dfa +920 -0
  925. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/pnglibconf.h.prebuilt +219 -0
  926. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/pnglibconf.mak +55 -0
  927. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/pngwin.rc +112 -0
  928. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/prefix.c +24 -0
  929. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/smakefile.ppc +34 -0
  930. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/sym.c +15 -0
  931. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/symbols.c +58 -0
  932. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/symbols.def +255 -0
  933. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/test.cmake.in +31 -0
  934. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/vers.c +19 -0
  935. package/mgba-bridge/vendor/mgba/src/third-party/libpng/test-driver +148 -0
  936. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7z.h +202 -0
  937. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zAlloc.c +80 -0
  938. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zAlloc.h +19 -0
  939. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zArcIn.c +1771 -0
  940. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zBuf.c +36 -0
  941. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zBuf.h +35 -0
  942. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zBuf2.c +52 -0
  943. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zCrc.c +128 -0
  944. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zCrc.h +25 -0
  945. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zCrcOpt.c +115 -0
  946. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zDec.c +591 -0
  947. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zFile.c +286 -0
  948. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zFile.h +83 -0
  949. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zStream.c +176 -0
  950. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zTypes.h +375 -0
  951. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zVersion.h +27 -0
  952. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zVersion.rc +55 -0
  953. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Aes.c +306 -0
  954. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Aes.h +38 -0
  955. package/mgba-bridge/vendor/mgba/src/third-party/lzma/AesOpt.c +184 -0
  956. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Alloc.c +455 -0
  957. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Alloc.h +51 -0
  958. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bcj2.c +257 -0
  959. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bcj2.h +146 -0
  960. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bcj2Enc.c +311 -0
  961. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bra.c +230 -0
  962. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bra.h +64 -0
  963. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bra86.c +82 -0
  964. package/mgba-bridge/vendor/mgba/src/third-party/lzma/BraIA64.c +53 -0
  965. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Compiler.h +33 -0
  966. package/mgba-bridge/vendor/mgba/src/third-party/lzma/CpuArch.c +218 -0
  967. package/mgba-bridge/vendor/mgba/src/third-party/lzma/CpuArch.h +336 -0
  968. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Delta.c +64 -0
  969. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Delta.h +19 -0
  970. package/mgba-bridge/vendor/mgba/src/third-party/lzma/DllSecur.c +108 -0
  971. package/mgba-bridge/vendor/mgba/src/third-party/lzma/DllSecur.h +20 -0
  972. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzFind.c +1127 -0
  973. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzFind.h +121 -0
  974. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzFindMt.c +853 -0
  975. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzFindMt.h +101 -0
  976. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzHash.h +57 -0
  977. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2Dec.c +488 -0
  978. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2Dec.h +120 -0
  979. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2DecMt.c +1082 -0
  980. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2DecMt.h +79 -0
  981. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2Enc.c +803 -0
  982. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2Enc.h +55 -0
  983. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma86.h +111 -0
  984. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma86Dec.c +54 -0
  985. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma86Enc.c +106 -0
  986. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaDec.c +1185 -0
  987. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaDec.h +234 -0
  988. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaEnc.c +2976 -0
  989. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaEnc.h +76 -0
  990. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaLib.c +40 -0
  991. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaLib.h +131 -0
  992. package/mgba-bridge/vendor/mgba/src/third-party/lzma/MtCoder.c +601 -0
  993. package/mgba-bridge/vendor/mgba/src/third-party/lzma/MtCoder.h +141 -0
  994. package/mgba-bridge/vendor/mgba/src/third-party/lzma/MtDec.c +1138 -0
  995. package/mgba-bridge/vendor/mgba/src/third-party/lzma/MtDec.h +201 -0
  996. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd.h +85 -0
  997. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd7.c +712 -0
  998. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd7.h +142 -0
  999. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd7Dec.c +191 -0
  1000. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd7Enc.c +187 -0
  1001. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Precomp.h +10 -0
  1002. package/mgba-bridge/vendor/mgba/src/third-party/lzma/RotateDefs.h +30 -0
  1003. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Sha256.c +248 -0
  1004. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Sha256.h +26 -0
  1005. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Sort.c +141 -0
  1006. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Sort.h +18 -0
  1007. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Threads.c +95 -0
  1008. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Threads.h +68 -0
  1009. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/7z.dsp +241 -0
  1010. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/7z.dsw +29 -0
  1011. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/7zMain.c +686 -0
  1012. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/Precomp.c +4 -0
  1013. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/Precomp.h +10 -0
  1014. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/makefile +40 -0
  1015. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/makefile.gcc +75 -0
  1016. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/LzmaUtil.c +258 -0
  1017. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/LzmaUtil.dsp +168 -0
  1018. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/LzmaUtil.dsw +29 -0
  1019. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/makefile +28 -0
  1020. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/makefile.gcc +44 -0
  1021. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/LzmaLib.def +4 -0
  1022. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/LzmaLib.dsp +178 -0
  1023. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/LzmaLib.dsw +29 -0
  1024. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/LzmaLibExports.c +14 -0
  1025. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/makefile +34 -0
  1026. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/resource.rc +3 -0
  1027. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/Precomp.c +4 -0
  1028. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/Precomp.h +10 -0
  1029. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/SfxSetup.c +640 -0
  1030. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/SfxSetup.dsp +231 -0
  1031. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/SfxSetup.dsw +29 -0
  1032. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/makefile +37 -0
  1033. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/makefile_con +38 -0
  1034. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/resource.rc +5 -0
  1035. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/setup.ico +0 -0
  1036. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Xz.c +90 -0
  1037. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Xz.h +460 -0
  1038. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzCrc64.c +86 -0
  1039. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzCrc64.h +26 -0
  1040. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzCrc64Opt.c +69 -0
  1041. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzDec.c +2766 -0
  1042. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzEnc.c +1329 -0
  1043. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzEnc.h +60 -0
  1044. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzIn.c +319 -0
  1045. package/mgba-bridge/vendor/mgba/src/third-party/zlib/CMakeLists.txt +249 -0
  1046. package/mgba-bridge/vendor/mgba/src/third-party/zlib/ChangeLog +1578 -0
  1047. package/mgba-bridge/vendor/mgba/src/third-party/zlib/FAQ +368 -0
  1048. package/mgba-bridge/vendor/mgba/src/third-party/zlib/INDEX +68 -0
  1049. package/mgba-bridge/vendor/mgba/src/third-party/zlib/Makefile +5 -0
  1050. package/mgba-bridge/vendor/mgba/src/third-party/zlib/Makefile.in +408 -0
  1051. package/mgba-bridge/vendor/mgba/src/third-party/zlib/README +118 -0
  1052. package/mgba-bridge/vendor/mgba/src/third-party/zlib/adler32.c +186 -0
  1053. package/mgba-bridge/vendor/mgba/src/third-party/zlib/amiga/Makefile.pup +69 -0
  1054. package/mgba-bridge/vendor/mgba/src/third-party/zlib/amiga/Makefile.sas +68 -0
  1055. package/mgba-bridge/vendor/mgba/src/third-party/zlib/compress.c +86 -0
  1056. package/mgba-bridge/vendor/mgba/src/third-party/zlib/configure +927 -0
  1057. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/README.contrib +57 -0
  1058. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/buffer_demo.adb +106 -0
  1059. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/mtest.adb +156 -0
  1060. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/read.adb +156 -0
  1061. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/readme.txt +65 -0
  1062. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/test.adb +463 -0
  1063. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib-streams.adb +225 -0
  1064. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib-streams.ads +114 -0
  1065. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib-thin.adb +141 -0
  1066. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib-thin.ads +450 -0
  1067. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib.adb +701 -0
  1068. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib.ads +328 -0
  1069. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib.gpr +20 -0
  1070. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/Makefile +8 -0
  1071. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/README +4 -0
  1072. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/blast.c +466 -0
  1073. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/blast.h +83 -0
  1074. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/test.pk +0 -0
  1075. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/test.txt +1 -0
  1076. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/delphi/ZLib.pas +557 -0
  1077. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/delphi/ZLibConst.pas +11 -0
  1078. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/delphi/readme.txt +76 -0
  1079. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/delphi/zlibd32.mak +99 -0
  1080. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs +58 -0
  1081. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +202 -0
  1082. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs +83 -0
  1083. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/CodecBase.cs +198 -0
  1084. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/Deflater.cs +106 -0
  1085. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/DotZLib.cs +288 -0
  1086. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj +141 -0
  1087. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/GZipStream.cs +301 -0
  1088. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/Inflater.cs +105 -0
  1089. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +274 -0
  1090. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib.build +33 -0
  1091. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib.chm +0 -0
  1092. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib.sln +21 -0
  1093. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/LICENSE_1_0.txt +23 -0
  1094. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/readme.txt +58 -0
  1095. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/gcc_gvmat64/gvmat64.S +574 -0
  1096. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/README +1 -0
  1097. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/infback9.c +615 -0
  1098. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/infback9.h +37 -0
  1099. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/inffix9.h +107 -0
  1100. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/inflate9.h +47 -0
  1101. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/inftree9.c +324 -0
  1102. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/inftree9.h +61 -0
  1103. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream/test.cpp +24 -0
  1104. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream/zfstream.cpp +329 -0
  1105. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream/zfstream.h +128 -0
  1106. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream2/zstream.h +307 -0
  1107. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream2/zstream_test.cpp +25 -0
  1108. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/README +35 -0
  1109. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/TODO +17 -0
  1110. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/test.cc +50 -0
  1111. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/zfstream.cc +479 -0
  1112. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/zfstream.h +466 -0
  1113. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/Makefile +29 -0
  1114. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/Makefile.am +45 -0
  1115. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/MiniZip64_Changes.txt +6 -0
  1116. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/MiniZip64_info.txt +74 -0
  1117. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/configure.ac +32 -0
  1118. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/crypt.h +132 -0
  1119. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/ioapi.c +257 -0
  1120. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/ioapi.h +210 -0
  1121. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/iowin32.c +462 -0
  1122. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/iowin32.h +28 -0
  1123. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/make_vms.com +25 -0
  1124. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/miniunz.c +659 -0
  1125. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/miniunzip.1 +63 -0
  1126. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/minizip.1 +46 -0
  1127. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/minizip.c +521 -0
  1128. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/minizip.pc.in +12 -0
  1129. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/mztools.c +291 -0
  1130. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/mztools.h +37 -0
  1131. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/unzip.c +2128 -0
  1132. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/unzip.h +437 -0
  1133. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/zip.c +2007 -0
  1134. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/zip.h +367 -0
  1135. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/pascal/example.pas +599 -0
  1136. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/pascal/readme.txt +76 -0
  1137. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/pascal/zlibd32.mak +99 -0
  1138. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/pascal/zlibpas.pas +276 -0
  1139. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/Makefile +42 -0
  1140. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/README +63 -0
  1141. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/puff.c +840 -0
  1142. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/puff.h +35 -0
  1143. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/pufftest.c +165 -0
  1144. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/zeros.raw +0 -0
  1145. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/testzlib/testzlib.c +275 -0
  1146. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/testzlib/testzlib.txt +10 -0
  1147. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/untgz/Makefile +14 -0
  1148. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/untgz/Makefile.msc +17 -0
  1149. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/untgz/untgz.c +674 -0
  1150. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/readme.txt +78 -0
  1151. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/miniunz.vcxproj +310 -0
  1152. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters +22 -0
  1153. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/minizip.vcxproj +307 -0
  1154. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters +22 -0
  1155. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/testzlib.vcxproj +420 -0
  1156. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters +58 -0
  1157. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj +310 -0
  1158. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters +22 -0
  1159. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlib.rc +32 -0
  1160. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibstat.vcxproj +473 -0
  1161. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters +77 -0
  1162. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibvc.def +158 -0
  1163. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibvc.sln +135 -0
  1164. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibvc.vcxproj +657 -0
  1165. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters +118 -0
  1166. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/miniunz.vcxproj +314 -0
  1167. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/minizip.vcxproj +311 -0
  1168. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/testzlib.vcxproj +426 -0
  1169. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj +314 -0
  1170. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlib.rc +32 -0
  1171. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlibstat.vcxproj +464 -0
  1172. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlibvc.def +158 -0
  1173. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlibvc.sln +117 -0
  1174. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlibvc.vcxproj +688 -0
  1175. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/miniunz.vcxproj +316 -0
  1176. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/minizip.vcxproj +313 -0
  1177. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/testzlib.vcxproj +430 -0
  1178. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj +316 -0
  1179. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlib.rc +32 -0
  1180. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlibstat.vcxproj +467 -0
  1181. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlibvc.def +158 -0
  1182. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlibvc.sln +119 -0
  1183. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlibvc.vcxproj +692 -0
  1184. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/miniunz.vcxproj +316 -0
  1185. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/minizip.vcxproj +313 -0
  1186. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/testzlib.vcxproj +430 -0
  1187. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj +316 -0
  1188. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlib.rc +32 -0
  1189. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlibstat.vcxproj +467 -0
  1190. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlibvc.def +158 -0
  1191. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlibvc.sln +119 -0
  1192. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlibvc.vcxproj +692 -0
  1193. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/miniunz.vcproj +565 -0
  1194. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/minizip.vcproj +562 -0
  1195. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/testzlib.vcproj +852 -0
  1196. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/testzlibdll.vcproj +565 -0
  1197. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlib.rc +32 -0
  1198. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlibstat.vcproj +835 -0
  1199. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlibvc.def +158 -0
  1200. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlibvc.sln +144 -0
  1201. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlibvc.vcproj +1156 -0
  1202. package/mgba-bridge/vendor/mgba/src/third-party/zlib/crc32.c +1116 -0
  1203. package/mgba-bridge/vendor/mgba/src/third-party/zlib/crc32.h +9446 -0
  1204. package/mgba-bridge/vendor/mgba/src/third-party/zlib/deflate.c +2211 -0
  1205. package/mgba-bridge/vendor/mgba/src/third-party/zlib/deflate.h +346 -0
  1206. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/algorithm.txt +209 -0
  1207. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/crc-doc.1.0.pdf +0 -0
  1208. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/rfc1950.txt +619 -0
  1209. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/rfc1951.txt +955 -0
  1210. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/rfc1952.txt +675 -0
  1211. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/txtvsbin.txt +107 -0
  1212. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/README.examples +54 -0
  1213. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/enough.c +597 -0
  1214. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/fitblk.c +233 -0
  1215. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gun.c +702 -0
  1216. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gzappend.c +504 -0
  1217. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gzjoin.c +449 -0
  1218. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gzlog.c +1061 -0
  1219. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gzlog.h +91 -0
  1220. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gznorm.c +470 -0
  1221. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/zlib_how.html +545 -0
  1222. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/zpipe.c +205 -0
  1223. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/zran.c +479 -0
  1224. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/zran.h +40 -0
  1225. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzclose.c +25 -0
  1226. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzguts.h +219 -0
  1227. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzlib.c +639 -0
  1228. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzread.c +652 -0
  1229. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzwrite.c +677 -0
  1230. package/mgba-bridge/vendor/mgba/src/third-party/zlib/infback.c +641 -0
  1231. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inffast.c +323 -0
  1232. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inffast.h +11 -0
  1233. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inffixed.h +94 -0
  1234. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inflate.c +1592 -0
  1235. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inflate.h +126 -0
  1236. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inftrees.c +304 -0
  1237. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inftrees.h +62 -0
  1238. package/mgba-bridge/vendor/mgba/src/third-party/zlib/make_vms.com +867 -0
  1239. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.bor +115 -0
  1240. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.dj2 +104 -0
  1241. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.emx +69 -0
  1242. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.msc +112 -0
  1243. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.tc +100 -0
  1244. package/mgba-bridge/vendor/mgba/src/third-party/zlib/nintendods/Makefile +126 -0
  1245. package/mgba-bridge/vendor/mgba/src/third-party/zlib/nintendods/README +5 -0
  1246. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/Makefile.emx +69 -0
  1247. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/Makefile.riscos +151 -0
  1248. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/README +3 -0
  1249. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/descrip.mms +48 -0
  1250. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/os2/Makefile.os2 +136 -0
  1251. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/os2/zlib.def +51 -0
  1252. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/visual-basic.txt +160 -0
  1253. package/mgba-bridge/vendor/mgba/src/third-party/zlib/os400/README400 +48 -0
  1254. package/mgba-bridge/vendor/mgba/src/third-party/zlib/os400/bndsrc +119 -0
  1255. package/mgba-bridge/vendor/mgba/src/third-party/zlib/os400/make.sh +366 -0
  1256. package/mgba-bridge/vendor/mgba/src/third-party/zlib/os400/zlib.inc +527 -0
  1257. package/mgba-bridge/vendor/mgba/src/third-party/zlib/qnx/package.qpg +141 -0
  1258. package/mgba-bridge/vendor/mgba/src/third-party/zlib/treebuild.xml +116 -0
  1259. package/mgba-bridge/vendor/mgba/src/third-party/zlib/trees.c +1182 -0
  1260. package/mgba-bridge/vendor/mgba/src/third-party/zlib/trees.h +128 -0
  1261. package/mgba-bridge/vendor/mgba/src/third-party/zlib/uncompr.c +93 -0
  1262. package/mgba-bridge/vendor/mgba/src/third-party/zlib/watcom/watcom_f.mak +43 -0
  1263. package/mgba-bridge/vendor/mgba/src/third-party/zlib/watcom/watcom_l.mak +43 -0
  1264. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/DLL_FAQ.txt +397 -0
  1265. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/Makefile.bor +109 -0
  1266. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/Makefile.gcc +177 -0
  1267. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/Makefile.msc +159 -0
  1268. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/README-WIN32.txt +103 -0
  1269. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/VisualC.txt +3 -0
  1270. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/zlib.def +97 -0
  1271. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/zlib1.rc +40 -0
  1272. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zconf.h +534 -0
  1273. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zconf.h.cmakein +536 -0
  1274. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zconf.h.in +534 -0
  1275. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.3 +149 -0
  1276. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.3.pdf +0 -0
  1277. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.h +1935 -0
  1278. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.map +100 -0
  1279. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.pc.cmakein +13 -0
  1280. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.pc.in +13 -0
  1281. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib2ansi +152 -0
  1282. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zutil.c +325 -0
  1283. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zutil.h +274 -0
  1284. package/mgba-bridge/vendor/mgba/src/tools/docgen.c +541 -0
  1285. package/mgba-bridge/vendor/mgba/src/tools/font-sdf.c +136 -0
  1286. package/mgba-bridge/vendor/mgba/src/tools/updater-main.c +377 -0
  1287. package/mgba-bridge/vendor/mgba/src/util/CMakeLists.txt +68 -0
  1288. package/mgba-bridge/vendor/mgba/src/util/audio-buffer.c +62 -0
  1289. package/mgba-bridge/vendor/mgba/src/util/audio-resampler.c +109 -0
  1290. package/mgba-bridge/vendor/mgba/src/util/circle-buffer.c +274 -0
  1291. package/mgba-bridge/vendor/mgba/src/util/configuration.c +233 -0
  1292. package/mgba-bridge/vendor/mgba/src/util/convolve.c +182 -0
  1293. package/mgba-bridge/vendor/mgba/src/util/crc32.c +138 -0
  1294. package/mgba-bridge/vendor/mgba/src/util/elf-read.c +128 -0
  1295. package/mgba-bridge/vendor/mgba/src/util/formatting.c +87 -0
  1296. package/mgba-bridge/vendor/mgba/src/util/gbk-table.c +129 -0
  1297. package/mgba-bridge/vendor/mgba/src/util/geometry.c +94 -0
  1298. package/mgba-bridge/vendor/mgba/src/util/gui/file-select.c +236 -0
  1299. package/mgba-bridge/vendor/mgba/src/util/gui/font-metrics.c +199 -0
  1300. package/mgba-bridge/vendor/mgba/src/util/gui/font.c +169 -0
  1301. package/mgba-bridge/vendor/mgba/src/util/gui/menu.c +412 -0
  1302. package/mgba-bridge/vendor/mgba/src/util/gui.c +81 -0
  1303. package/mgba-bridge/vendor/mgba/src/util/hash.c +108 -0
  1304. package/mgba-bridge/vendor/mgba/src/util/image/export.c +81 -0
  1305. package/mgba-bridge/vendor/mgba/src/util/image/font.c +274 -0
  1306. package/mgba-bridge/vendor/mgba/src/util/image/png-io.c +730 -0
  1307. package/mgba-bridge/vendor/mgba/src/util/image.c +1109 -0
  1308. package/mgba-bridge/vendor/mgba/src/util/interpolator.c +116 -0
  1309. package/mgba-bridge/vendor/mgba/src/util/md5.c +228 -0
  1310. package/mgba-bridge/vendor/mgba/src/util/memory.c +15 -0
  1311. package/mgba-bridge/vendor/mgba/src/util/patch-fast.c +130 -0
  1312. package/mgba-bridge/vendor/mgba/src/util/patch-ips.c +93 -0
  1313. package/mgba-bridge/vendor/mgba/src/util/patch-ups.c +254 -0
  1314. package/mgba-bridge/vendor/mgba/src/util/patch.c +25 -0
  1315. package/mgba-bridge/vendor/mgba/src/util/ring-fifo.c +104 -0
  1316. package/mgba-bridge/vendor/mgba/src/util/sfo.c +229 -0
  1317. package/mgba-bridge/vendor/mgba/src/util/sha1.c +258 -0
  1318. package/mgba-bridge/vendor/mgba/src/util/string.c +652 -0
  1319. package/mgba-bridge/vendor/mgba/src/util/table.c +682 -0
  1320. package/mgba-bridge/vendor/mgba/src/util/text-codec.c +197 -0
  1321. package/mgba-bridge/vendor/mgba/src/util/vector.c +18 -0
  1322. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-devlist.c +104 -0
  1323. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-dirent.c +173 -0
  1324. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-fd.c +282 -0
  1325. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-fifo.c +102 -0
  1326. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-file.c +159 -0
  1327. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-lzma.c +404 -0
  1328. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-mem.c +331 -0
  1329. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-zip.c +804 -0
  1330. package/mgba-bridge/vendor/mgba/src/util/vfs.c +320 -0
  1331. package/mgba-bridge/vendor/mgba/tools/deploy-mac.py +178 -0
  1332. package/mgba-bridge/vendor/mgba/tools/deploy-win.sh +27 -0
  1333. package/mgba-bridge/vendor/mgba/tools/dlls.gdb +3 -0
  1334. package/mgba-bridge/vendor/mgba/tools/make-dotcode.py +154 -0
  1335. package/mgba-bridge/vendor/mgba/tools/perf.py +230 -0
  1336. package/mgba-bridge/vendor/mgba/tools/sanitize-deb.sh +74 -0
  1337. package/mgba-bridge/vendor/mgba/tools/snes-tile.py +94 -0
  1338. package/mgba-bridge/vendor/mgba/version.cmake +62 -0
  1339. package/package.json +47 -0
  1340. package/src/audio-output.ts +387 -0
  1341. package/src/config.ts +114 -0
  1342. package/src/constants.ts +37 -0
  1343. package/src/extension.ts +570 -0
  1344. package/src/gameboy-mgba.ts +133 -0
  1345. package/src/gameboy-types.ts +24 -0
  1346. package/src/gameboy.ts +33 -0
  1347. package/src/index.ts +1 -0
  1348. package/src/mgba/bridge-bin.ts +66 -0
  1349. package/src/mgba/bridge.ts +145 -0
  1350. package/src/mgba/protocol.ts +30 -0
  1351. package/src/mgba/stdio.ts +74 -0
  1352. package/src/notify.ts +12 -0
  1353. package/src/pi-boy-component.ts +372 -0
  1354. package/src/render/ansi.ts +239 -0
  1355. package/src/render/kitty.ts +154 -0
  1356. package/src/roms.ts +163 -0
  1357. package/src/runtime.ts +36 -0
  1358. package/src/save-state.ts +94 -0
  1359. package/src/terminal.ts +18 -0
  1360. package/tsconfig.json +11 -0
  1361. package/types/shims.d.ts +121 -0
@@ -0,0 +1,3828 @@
1
+ /*-
2
+ * pngstest.c
3
+ *
4
+ * Last changed in libpng 1.6.31 [July 27, 2017]
5
+ * Copyright (c) 2013-2017 John Cunningham Bowler
6
+ *
7
+ * This code is released under the libpng license.
8
+ * For conditions of distribution and use, see the disclaimer
9
+ * and license in png.h
10
+ *
11
+ * Test for the PNG 'simplified' APIs.
12
+ */
13
+ #define _ISOC90_SOURCE 1
14
+ #define MALLOC_CHECK_ 2/*glibc facility: turn on debugging*/
15
+
16
+ #include <stddef.h>
17
+ #include <stdlib.h>
18
+ #include <string.h>
19
+ #include <stdio.h>
20
+ #include <errno.h>
21
+ #include <ctype.h>
22
+ #include <math.h>
23
+
24
+ #if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
25
+ # include <config.h>
26
+ #endif
27
+
28
+ /* Define the following to use this test against your installed libpng, rather
29
+ * than the one being built here:
30
+ */
31
+ #ifdef PNG_FREESTANDING_TESTS
32
+ # include <png.h>
33
+ #else
34
+ # include "../../png.h"
35
+ #endif
36
+
37
+ /* 1.6.1 added support for the configure test harness, which uses 77 to indicate
38
+ * a skipped test, in earlier versions we need to succeed on a skipped test, so:
39
+ */
40
+ #if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
41
+ # define SKIP 77
42
+ #else
43
+ # define SKIP 0
44
+ #endif
45
+
46
+ #ifdef PNG_SIMPLIFIED_READ_SUPPORTED /* Else nothing can be done */
47
+ #include "../tools/sRGB.h"
48
+
49
+ /* KNOWN ISSUES
50
+ *
51
+ * These defines switch on alternate algorithms for format conversions to match
52
+ * the current libpng implementation; they are set to allow pngstest to pass
53
+ * even though libpng is producing answers that are not as correct as they
54
+ * should be.
55
+ */
56
+ #define ALLOW_UNUSED_GPC 0
57
+ /* If true include unused static GPC functions and declare an external array
58
+ * of them to hide the fact that they are unused. This is for development
59
+ * use while testing the correct function to use to take into account libpng
60
+ * misbehavior, such as using a simple power law to correct sRGB to linear.
61
+ */
62
+
63
+ /* The following is to support direct compilation of this file as C++ */
64
+ #ifdef __cplusplus
65
+ # define voidcast(type, value) static_cast<type>(value)
66
+ # define aligncastconst(type, value) \
67
+ static_cast<type>(static_cast<const void*>(value))
68
+ #else
69
+ # define voidcast(type, value) (value)
70
+ # define aligncastconst(type, value) ((const void*)(value))
71
+ #endif /* __cplusplus */
72
+
73
+ /* During parallel runs of pngstest each temporary file needs a unique name,
74
+ * this is used to permit uniqueness using a command line argument which can be
75
+ * up to 22 characters long.
76
+ */
77
+ static char tmpf[23] = "TMP";
78
+
79
+ /* Generate random bytes. This uses a boring repeatable algorithm and it
80
+ * is implemented here so that it gives the same set of numbers on every
81
+ * architecture. It's a linear congruential generator (Knuth or Sedgewick
82
+ * "Algorithms") but it comes from the 'feedback taps' table in Horowitz and
83
+ * Hill, "The Art of Electronics".
84
+ */
85
+ static void
86
+ make_random_bytes(png_uint_32* seed, void* pv, size_t size)
87
+ {
88
+ png_uint_32 u0 = seed[0], u1 = seed[1];
89
+ png_bytep bytes = voidcast(png_bytep, pv);
90
+
91
+ /* There are thirty three bits, the next bit in the sequence is bit-33 XOR
92
+ * bit-20. The top 1 bit is in u1, the bottom 32 are in u0.
93
+ */
94
+ size_t i;
95
+ for (i=0; i<size; ++i)
96
+ {
97
+ /* First generate 8 new bits then shift them in at the end. */
98
+ png_uint_32 u = ((u0 >> (20-8)) ^ ((u1 << 7) | (u0 >> (32-7)))) & 0xff;
99
+ u1 <<= 8;
100
+ u1 |= u0 >> 24;
101
+ u0 <<= 8;
102
+ u0 |= u;
103
+ *bytes++ = (png_byte)u;
104
+ }
105
+
106
+ seed[0] = u0;
107
+ seed[1] = u1;
108
+ }
109
+
110
+ static png_uint_32 color_seed[2];
111
+
112
+ static void
113
+ reseed(void)
114
+ {
115
+ color_seed[0] = 0x12345678U;
116
+ color_seed[1] = 0x9abcdefU;
117
+ }
118
+
119
+ static void
120
+ random_color(png_colorp color)
121
+ {
122
+ make_random_bytes(color_seed, color, sizeof *color);
123
+ }
124
+
125
+ /* Math support - neither Cygwin nor Visual Studio have C99 support and we need
126
+ * a predictable rounding function, so make one here:
127
+ */
128
+ static double
129
+ closestinteger(double x)
130
+ {
131
+ return floor(x + .5);
132
+ }
133
+
134
+ /* Cast support: remove GCC whines. */
135
+ static png_byte
136
+ u8d(double d)
137
+ {
138
+ d = closestinteger(d);
139
+ return (png_byte)d;
140
+ }
141
+
142
+ static png_uint_16
143
+ u16d(double d)
144
+ {
145
+ d = closestinteger(d);
146
+ return (png_uint_16)d;
147
+ }
148
+
149
+ /* sRGB support: use exact calculations rounded to the nearest int, see the
150
+ * fesetround() call in main(). sRGB_to_d optimizes the 8 to 16-bit conversion.
151
+ */
152
+ static double sRGB_to_d[256];
153
+ static double g22_to_d[256];
154
+
155
+ static void
156
+ init_sRGB_to_d(void)
157
+ {
158
+ int i;
159
+
160
+ sRGB_to_d[0] = 0;
161
+ for (i=1; i<255; ++i)
162
+ sRGB_to_d[i] = linear_from_sRGB(i/255.);
163
+ sRGB_to_d[255] = 1;
164
+
165
+ g22_to_d[0] = 0;
166
+ for (i=1; i<255; ++i)
167
+ g22_to_d[i] = pow(i/255., 1/.45455);
168
+ g22_to_d[255] = 1;
169
+ }
170
+
171
+ static png_byte
172
+ sRGB(double linear /*range 0.0 .. 1.0*/)
173
+ {
174
+ return u8d(255 * sRGB_from_linear(linear));
175
+ }
176
+
177
+ static png_byte
178
+ isRGB(int fixed_linear)
179
+ {
180
+ return sRGB(fixed_linear / 65535.);
181
+ }
182
+
183
+ #if 0 /* not used */
184
+ static png_byte
185
+ unpremultiply(int component, int alpha)
186
+ {
187
+ if (alpha <= component)
188
+ return 255; /* Arbitrary, but consistent with the libpng code */
189
+
190
+ else if (alpha >= 65535)
191
+ return isRGB(component);
192
+
193
+ else
194
+ return sRGB((double)component / alpha);
195
+ }
196
+ #endif
197
+
198
+ static png_uint_16
199
+ ilinear(int fixed_srgb)
200
+ {
201
+ return u16d(65535 * sRGB_to_d[fixed_srgb]);
202
+ }
203
+
204
+ static png_uint_16
205
+ ilineara(int fixed_srgb, int alpha)
206
+ {
207
+ return u16d((257 * alpha) * sRGB_to_d[fixed_srgb]);
208
+ }
209
+
210
+ static png_uint_16
211
+ ilinear_g22(int fixed_srgb)
212
+ {
213
+ return u16d(65535 * g22_to_d[fixed_srgb]);
214
+ }
215
+
216
+ #if ALLOW_UNUSED_GPC
217
+ static png_uint_16
218
+ ilineara_g22(int fixed_srgb, int alpha)
219
+ {
220
+ return u16d((257 * alpha) * g22_to_d[fixed_srgb]);
221
+ }
222
+ #endif
223
+
224
+ static double
225
+ YfromRGBint(int ir, int ig, int ib)
226
+ {
227
+ double r = ir;
228
+ double g = ig;
229
+ double b = ib;
230
+ return YfromRGB(r, g, b);
231
+ }
232
+
233
+ #if 0 /* unused */
234
+ /* The error that results from using a 2.2 power law in place of the correct
235
+ * sRGB transform, given an 8-bit value which might be either sRGB or power-law.
236
+ */
237
+ static int
238
+ power_law_error8(int value)
239
+ {
240
+ if (value > 0 && value < 255)
241
+ {
242
+ double vd = value / 255.;
243
+ double e = fabs(
244
+ pow(sRGB_to_d[value], 1/2.2) - sRGB_from_linear(pow(vd, 2.2)));
245
+
246
+ /* Always allow an extra 1 here for rounding errors */
247
+ e = 1+floor(255 * e);
248
+ return (int)e;
249
+ }
250
+
251
+ return 0;
252
+ }
253
+
254
+ static int error_in_sRGB_roundtrip = 56; /* by experiment */
255
+ static int
256
+ power_law_error16(int value)
257
+ {
258
+ if (value > 0 && value < 65535)
259
+ {
260
+ /* Round trip the value through an 8-bit representation but using
261
+ * non-matching to/from conversions.
262
+ */
263
+ double vd = value / 65535.;
264
+ double e = fabs(
265
+ pow(sRGB_from_linear(vd), 2.2) - linear_from_sRGB(pow(vd, 1/2.2)));
266
+
267
+ /* Always allow an extra 1 here for rounding errors */
268
+ e = error_in_sRGB_roundtrip+floor(65535 * e);
269
+ return (int)e;
270
+ }
271
+
272
+ return 0;
273
+ }
274
+
275
+ static int
276
+ compare_8bit(int v1, int v2, int error_limit, int multiple_algorithms)
277
+ {
278
+ int e = abs(v1-v2);
279
+ int ev1, ev2;
280
+
281
+ if (e <= error_limit)
282
+ return 1;
283
+
284
+ if (!multiple_algorithms)
285
+ return 0;
286
+
287
+ ev1 = power_law_error8(v1);
288
+ if (e <= ev1)
289
+ return 1;
290
+
291
+ ev2 = power_law_error8(v2);
292
+ if (e <= ev2)
293
+ return 1;
294
+
295
+ return 0;
296
+ }
297
+
298
+ static int
299
+ compare_16bit(int v1, int v2, int error_limit, int multiple_algorithms)
300
+ {
301
+ int e = abs(v1-v2);
302
+ int ev1, ev2;
303
+
304
+ if (e <= error_limit)
305
+ return 1;
306
+
307
+ /* "multiple_algorithms" in this case means that a color-map has been
308
+ * involved somewhere, so we can deduce that the values were forced to 8-bit
309
+ * (like the via_linear case for 8-bit.)
310
+ */
311
+ if (!multiple_algorithms)
312
+ return 0;
313
+
314
+ ev1 = power_law_error16(v1);
315
+ if (e <= ev1)
316
+ return 1;
317
+
318
+ ev2 = power_law_error16(v2);
319
+ if (e <= ev2)
320
+ return 1;
321
+
322
+ return 0;
323
+ }
324
+ #endif /* unused */
325
+
326
+ #define USE_FILE 1 /* else memory */
327
+ #define USE_STDIO 2 /* else use file name */
328
+ #define STRICT 4 /* fail on warnings too */
329
+ #define VERBOSE 8
330
+ #define KEEP_TMPFILES 16 /* else delete temporary files */
331
+ #define KEEP_GOING 32
332
+ #define ACCUMULATE 64
333
+ #define FAST_WRITE 128
334
+ #define sRGB_16BIT 256
335
+ #define NO_RESEED 512 /* do not reseed on each new file */
336
+ #define GBG_ERROR 1024 /* do not ignore the gamma+background_rgb_to_gray
337
+ * libpng warning. */
338
+
339
+ static void
340
+ print_opts(png_uint_32 opts)
341
+ {
342
+ if (opts & USE_FILE)
343
+ printf(" --file");
344
+ if (opts & USE_STDIO)
345
+ printf(" --stdio");
346
+ if (!(opts & STRICT))
347
+ printf(" --nostrict");
348
+ if (opts & VERBOSE)
349
+ printf(" --verbose");
350
+ if (opts & KEEP_TMPFILES)
351
+ printf(" --preserve");
352
+ if (opts & KEEP_GOING)
353
+ printf(" --keep-going");
354
+ if (opts & ACCUMULATE)
355
+ printf(" --accumulate");
356
+ if (!(opts & FAST_WRITE)) /* --fast is currently the default */
357
+ printf(" --slow");
358
+ if (opts & sRGB_16BIT)
359
+ printf(" --sRGB-16bit");
360
+ if (opts & NO_RESEED)
361
+ printf(" --noreseed");
362
+ #if PNG_LIBPNG_VER < 10700 /* else on by default */
363
+ if (opts & GBG_ERROR)
364
+ printf(" --fault-gbg-warning");
365
+ #endif
366
+ }
367
+
368
+ #define FORMAT_NO_CHANGE 0x80000000 /* additional flag */
369
+
370
+ /* A name table for all the formats - defines the format of the '+' arguments to
371
+ * pngstest.
372
+ */
373
+ #define FORMAT_COUNT 64
374
+ #define FORMAT_MASK 0x3f
375
+ static const char * const format_names[FORMAT_COUNT] =
376
+ {
377
+ "sRGB-gray",
378
+ "sRGB-gray+alpha",
379
+ "sRGB-rgb",
380
+ "sRGB-rgb+alpha",
381
+ "linear-gray",
382
+ "linear-gray+alpha",
383
+ "linear-rgb",
384
+ "linear-rgb+alpha",
385
+
386
+ "color-mapped-sRGB-gray",
387
+ "color-mapped-sRGB-gray+alpha",
388
+ "color-mapped-sRGB-rgb",
389
+ "color-mapped-sRGB-rgb+alpha",
390
+ "color-mapped-linear-gray",
391
+ "color-mapped-linear-gray+alpha",
392
+ "color-mapped-linear-rgb",
393
+ "color-mapped-linear-rgb+alpha",
394
+
395
+ "sRGB-gray",
396
+ "sRGB-gray+alpha",
397
+ "sRGB-bgr",
398
+ "sRGB-bgr+alpha",
399
+ "linear-gray",
400
+ "linear-gray+alpha",
401
+ "linear-bgr",
402
+ "linear-bgr+alpha",
403
+
404
+ "color-mapped-sRGB-gray",
405
+ "color-mapped-sRGB-gray+alpha",
406
+ "color-mapped-sRGB-bgr",
407
+ "color-mapped-sRGB-bgr+alpha",
408
+ "color-mapped-linear-gray",
409
+ "color-mapped-linear-gray+alpha",
410
+ "color-mapped-linear-bgr",
411
+ "color-mapped-linear-bgr+alpha",
412
+
413
+ "sRGB-gray",
414
+ "alpha+sRGB-gray",
415
+ "sRGB-rgb",
416
+ "alpha+sRGB-rgb",
417
+ "linear-gray",
418
+ "alpha+linear-gray",
419
+ "linear-rgb",
420
+ "alpha+linear-rgb",
421
+
422
+ "color-mapped-sRGB-gray",
423
+ "color-mapped-alpha+sRGB-gray",
424
+ "color-mapped-sRGB-rgb",
425
+ "color-mapped-alpha+sRGB-rgb",
426
+ "color-mapped-linear-gray",
427
+ "color-mapped-alpha+linear-gray",
428
+ "color-mapped-linear-rgb",
429
+ "color-mapped-alpha+linear-rgb",
430
+
431
+ "sRGB-gray",
432
+ "alpha+sRGB-gray",
433
+ "sRGB-bgr",
434
+ "alpha+sRGB-bgr",
435
+ "linear-gray",
436
+ "alpha+linear-gray",
437
+ "linear-bgr",
438
+ "alpha+linear-bgr",
439
+
440
+ "color-mapped-sRGB-gray",
441
+ "color-mapped-alpha+sRGB-gray",
442
+ "color-mapped-sRGB-bgr",
443
+ "color-mapped-alpha+sRGB-bgr",
444
+ "color-mapped-linear-gray",
445
+ "color-mapped-alpha+linear-gray",
446
+ "color-mapped-linear-bgr",
447
+ "color-mapped-alpha+linear-bgr",
448
+ };
449
+
450
+ /* Decode an argument to a format number. */
451
+ static png_uint_32
452
+ formatof(const char *arg)
453
+ {
454
+ char *ep;
455
+ unsigned long format = strtoul(arg, &ep, 0);
456
+
457
+ if (ep > arg && *ep == 0 && format < FORMAT_COUNT)
458
+ return (png_uint_32)format;
459
+
460
+ else for (format=0; format < FORMAT_COUNT; ++format)
461
+ {
462
+ if (strcmp(format_names[format], arg) == 0)
463
+ return (png_uint_32)format;
464
+ }
465
+
466
+ fprintf(stderr, "pngstest: format name '%s' invalid\n", arg);
467
+ return FORMAT_COUNT;
468
+ }
469
+
470
+ /* Bitset/test functions for formats */
471
+ #define FORMAT_SET_COUNT (FORMAT_COUNT / 32)
472
+ typedef struct
473
+ {
474
+ png_uint_32 bits[FORMAT_SET_COUNT];
475
+ }
476
+ format_list;
477
+
478
+ static void format_init(format_list *pf)
479
+ {
480
+ int i;
481
+ for (i=0; i<FORMAT_SET_COUNT; ++i)
482
+ pf->bits[i] = 0; /* All off */
483
+ }
484
+
485
+ #if 0 /* currently unused */
486
+ static void format_clear(format_list *pf)
487
+ {
488
+ int i;
489
+ for (i=0; i<FORMAT_SET_COUNT; ++i)
490
+ pf->bits[i] = 0;
491
+ }
492
+ #endif
493
+
494
+ static int format_is_initial(format_list *pf)
495
+ {
496
+ int i;
497
+ for (i=0; i<FORMAT_SET_COUNT; ++i)
498
+ if (pf->bits[i] != 0)
499
+ return 0;
500
+
501
+ return 1;
502
+ }
503
+
504
+ static int format_set(format_list *pf, png_uint_32 format)
505
+ {
506
+ if (format < FORMAT_COUNT)
507
+ return pf->bits[format >> 5] |= ((png_uint_32)1) << (format & 31);
508
+
509
+ return 0;
510
+ }
511
+
512
+ #if 0 /* currently unused */
513
+ static int format_unset(format_list *pf, png_uint_32 format)
514
+ {
515
+ if (format < FORMAT_COUNT)
516
+ return pf->bits[format >> 5] &= ~((png_uint_32)1) << (format & 31);
517
+
518
+ return 0;
519
+ }
520
+ #endif
521
+
522
+ static int format_isset(format_list *pf, png_uint_32 format)
523
+ {
524
+ return format < FORMAT_COUNT &&
525
+ (pf->bits[format >> 5] & (((png_uint_32)1) << (format & 31))) != 0;
526
+ }
527
+
528
+ static void format_default(format_list *pf, int redundant)
529
+ {
530
+ if (redundant)
531
+ {
532
+ int i;
533
+
534
+ /* set everything, including flags that are pointless */
535
+ for (i=0; i<FORMAT_SET_COUNT; ++i)
536
+ pf->bits[i] = ~(png_uint_32)0;
537
+ }
538
+
539
+ else
540
+ {
541
+ png_uint_32 f;
542
+
543
+ for (f=0; f<FORMAT_COUNT; ++f)
544
+ {
545
+ /* Eliminate redundant and unsupported settings. */
546
+ # ifdef PNG_FORMAT_BGR_SUPPORTED
547
+ /* BGR is meaningless if no color: */
548
+ if ((f & PNG_FORMAT_FLAG_COLOR) == 0 &&
549
+ (f & PNG_FORMAT_FLAG_BGR) != 0)
550
+ # else
551
+ if ((f & 0x10U/*HACK: fixed value*/) != 0)
552
+ # endif
553
+ continue;
554
+
555
+ /* AFIRST is meaningless if no alpha: */
556
+ # ifdef PNG_FORMAT_AFIRST_SUPPORTED
557
+ if ((f & PNG_FORMAT_FLAG_ALPHA) == 0 &&
558
+ (f & PNG_FORMAT_FLAG_AFIRST) != 0)
559
+ # else
560
+ if ((f & 0x20U/*HACK: fixed value*/) != 0)
561
+ # endif
562
+ continue;
563
+
564
+ format_set(pf, f);
565
+ }
566
+ }
567
+ }
568
+
569
+ /* THE Image STRUCTURE */
570
+ /* The super-class of a png_image, contains the decoded image plus the input
571
+ * data necessary to re-read the file with a different format.
572
+ */
573
+ typedef struct
574
+ {
575
+ png_image image;
576
+ png_uint_32 opts;
577
+ const char *file_name;
578
+ int stride_extra;
579
+ FILE *input_file;
580
+ png_voidp input_memory;
581
+ size_t input_memory_size;
582
+ png_bytep buffer;
583
+ ptrdiff_t stride;
584
+ size_t bufsize;
585
+ size_t allocsize;
586
+ char tmpfile_name[32];
587
+ png_uint_16 colormap[256*4];
588
+ }
589
+ Image;
590
+
591
+ /* Initializer: also sets the permitted error limit for 16-bit operations. */
592
+ static void
593
+ newimage(Image *image)
594
+ {
595
+ memset(image, 0, sizeof *image);
596
+ }
597
+
598
+ /* Reset the image to be read again - only needs to rewind the FILE* at present.
599
+ */
600
+ static void
601
+ resetimage(Image *image)
602
+ {
603
+ if (image->input_file != NULL)
604
+ rewind(image->input_file);
605
+ }
606
+
607
+ /* Free the image buffer; the buffer is re-used on a re-read, this is just for
608
+ * cleanup.
609
+ */
610
+ static void
611
+ freebuffer(Image *image)
612
+ {
613
+ if (image->buffer) free(image->buffer);
614
+ image->buffer = NULL;
615
+ image->bufsize = 0;
616
+ image->allocsize = 0;
617
+ }
618
+
619
+ /* Delete function; cleans out all the allocated data and the temporary file in
620
+ * the image.
621
+ */
622
+ static void
623
+ freeimage(Image *image)
624
+ {
625
+ freebuffer(image);
626
+ png_image_free(&image->image);
627
+
628
+ if (image->input_file != NULL)
629
+ {
630
+ fclose(image->input_file);
631
+ image->input_file = NULL;
632
+ }
633
+
634
+ if (image->input_memory != NULL)
635
+ {
636
+ free(image->input_memory);
637
+ image->input_memory = NULL;
638
+ image->input_memory_size = 0;
639
+ }
640
+
641
+ if (image->tmpfile_name[0] != 0 && (image->opts & KEEP_TMPFILES) == 0)
642
+ {
643
+ (void)remove(image->tmpfile_name);
644
+ image->tmpfile_name[0] = 0;
645
+ }
646
+ }
647
+
648
+ /* This is actually a re-initializer; allows an image structure to be re-used by
649
+ * freeing everything that relates to an old image.
650
+ */
651
+ static void initimage(Image *image, png_uint_32 opts, const char *file_name,
652
+ int stride_extra)
653
+ {
654
+ freeimage(image);
655
+ memset(&image->image, 0, sizeof image->image);
656
+ image->opts = opts;
657
+ image->file_name = file_name;
658
+ image->stride_extra = stride_extra;
659
+ }
660
+
661
+ /* Make sure the image buffer is big enough; allows re-use of the buffer if the
662
+ * image is re-read.
663
+ */
664
+ #define BUFFER_INIT8 73
665
+ static void
666
+ allocbuffer(Image *image)
667
+ {
668
+ size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
669
+
670
+ if (size+32 > image->bufsize)
671
+ {
672
+ freebuffer(image);
673
+ image->buffer = voidcast(png_bytep, malloc(size+32));
674
+ if (image->buffer == NULL)
675
+ {
676
+ fflush(stdout);
677
+ fprintf(stderr,
678
+ "simpletest: out of memory allocating %lu(+32) byte buffer\n",
679
+ (unsigned long)size);
680
+ exit(1);
681
+ }
682
+ image->bufsize = size+32;
683
+ }
684
+
685
+ memset(image->buffer, 95, image->bufsize);
686
+ memset(image->buffer+16, BUFFER_INIT8, size);
687
+ image->allocsize = size;
688
+ }
689
+
690
+ /* Make sure 16 bytes match the given byte. */
691
+ static int
692
+ check16(png_const_bytep bp, int b)
693
+ {
694
+ int i = 16;
695
+
696
+ do
697
+ if (*bp != b) return 1;
698
+ while (--i);
699
+
700
+ return 0;
701
+ }
702
+
703
+ /* Check for overwrite in the image buffer. */
704
+ static void
705
+ checkbuffer(Image *image, const char *arg)
706
+ {
707
+ if (check16(image->buffer, 95))
708
+ {
709
+ fflush(stdout);
710
+ fprintf(stderr, "%s: overwrite at start of image buffer\n", arg);
711
+ exit(1);
712
+ }
713
+
714
+ if (check16(image->buffer+16+image->allocsize, 95))
715
+ {
716
+ fflush(stdout);
717
+ fprintf(stderr, "%s: overwrite at end of image buffer\n", arg);
718
+ exit(1);
719
+ }
720
+ }
721
+
722
+ /* ERROR HANDLING */
723
+ /* Log a terminal error, also frees the libpng part of the image if necessary.
724
+ */
725
+ static int
726
+ logerror(Image *image, const char *a1, const char *a2, const char *a3)
727
+ {
728
+ fflush(stdout);
729
+ if (image->image.warning_or_error)
730
+ fprintf(stderr, "%s%s%s: %s\n", a1, a2, a3, image->image.message);
731
+
732
+ else
733
+ fprintf(stderr, "%s%s%s\n", a1, a2, a3);
734
+
735
+ if (image->image.opaque != NULL)
736
+ {
737
+ fprintf(stderr, "%s: image opaque pointer non-NULL on error\n",
738
+ image->file_name);
739
+ png_image_free(&image->image);
740
+ }
741
+
742
+ return 0;
743
+ }
744
+
745
+ /* Log an error and close a file (just a utility to do both things in one
746
+ * function call.)
747
+ */
748
+ static int
749
+ logclose(Image *image, FILE *f, const char *name, const char *operation)
750
+ {
751
+ int e = errno;
752
+
753
+ fclose(f);
754
+ return logerror(image, name, operation, strerror(e));
755
+ }
756
+
757
+ /* Make sure the png_image has been freed - validates that libpng is doing what
758
+ * the spec says and freeing the image.
759
+ */
760
+ static int
761
+ checkopaque(Image *image)
762
+ {
763
+ if (image->image.opaque != NULL)
764
+ {
765
+ png_image_free(&image->image);
766
+ return logerror(image, image->file_name, ": opaque not NULL", "");
767
+ }
768
+
769
+ /* Separate out the gamma+background_rgb_to_gray warning because it may
770
+ * produce opaque component errors:
771
+ */
772
+ else if (image->image.warning_or_error != 0 &&
773
+ (strcmp(image->image.message,
774
+ "libpng does not support gamma+background+rgb_to_gray") == 0 ?
775
+ (image->opts & GBG_ERROR) != 0 : (image->opts & STRICT) != 0))
776
+ return logerror(image, image->file_name, (image->opts & GBG_ERROR) != 0 ?
777
+ " --fault-gbg-warning" : " --strict", "");
778
+
779
+ else
780
+ return 1;
781
+ }
782
+
783
+ /* IMAGE COMPARISON/CHECKING */
784
+ /* Compare the pixels of two images, which should be the same but aren't. The
785
+ * images must have been checked for a size match.
786
+ */
787
+ typedef struct
788
+ {
789
+ /* The components, for grayscale images the gray value is in 'g' and if alpha
790
+ * is not present 'a' is set to 255 or 65535 according to format.
791
+ */
792
+ int r, g, b, a;
793
+ } Pixel;
794
+
795
+ typedef struct
796
+ {
797
+ /* The background as the original sRGB 8-bit value converted to the final
798
+ * integer format and as a double precision linear value in the range 0..1
799
+ * for with partially transparent pixels.
800
+ */
801
+ int ir, ig, ib;
802
+ double dr, dg, db; /* linear r,g,b scaled to 0..1 */
803
+ } Background;
804
+
805
+ /* Basic image formats; control the data but not the layout thereof. */
806
+ #define BASE_FORMATS\
807
+ (PNG_FORMAT_FLAG_ALPHA|PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_LINEAR)
808
+
809
+ /* Read a Pixel from a buffer. The code below stores the correct routine for
810
+ * the format in a function pointer, these are the routines:
811
+ */
812
+ static void
813
+ gp_g8(Pixel *p, png_const_voidp pb)
814
+ {
815
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
816
+
817
+ p->r = p->g = p->b = pp[0];
818
+ p->a = 255;
819
+ }
820
+
821
+ static void
822
+ gp_ga8(Pixel *p, png_const_voidp pb)
823
+ {
824
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
825
+
826
+ p->r = p->g = p->b = pp[0];
827
+ p->a = pp[1];
828
+ }
829
+
830
+ #ifdef PNG_FORMAT_AFIRST_SUPPORTED
831
+ static void
832
+ gp_ag8(Pixel *p, png_const_voidp pb)
833
+ {
834
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
835
+
836
+ p->r = p->g = p->b = pp[1];
837
+ p->a = pp[0];
838
+ }
839
+ #endif
840
+
841
+ static void
842
+ gp_rgb8(Pixel *p, png_const_voidp pb)
843
+ {
844
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
845
+
846
+ p->r = pp[0];
847
+ p->g = pp[1];
848
+ p->b = pp[2];
849
+ p->a = 255;
850
+ }
851
+
852
+ #ifdef PNG_FORMAT_BGR_SUPPORTED
853
+ static void
854
+ gp_bgr8(Pixel *p, png_const_voidp pb)
855
+ {
856
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
857
+
858
+ p->r = pp[2];
859
+ p->g = pp[1];
860
+ p->b = pp[0];
861
+ p->a = 255;
862
+ }
863
+ #endif
864
+
865
+ static void
866
+ gp_rgba8(Pixel *p, png_const_voidp pb)
867
+ {
868
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
869
+
870
+ p->r = pp[0];
871
+ p->g = pp[1];
872
+ p->b = pp[2];
873
+ p->a = pp[3];
874
+ }
875
+
876
+ #ifdef PNG_FORMAT_BGR_SUPPORTED
877
+ static void
878
+ gp_bgra8(Pixel *p, png_const_voidp pb)
879
+ {
880
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
881
+
882
+ p->r = pp[2];
883
+ p->g = pp[1];
884
+ p->b = pp[0];
885
+ p->a = pp[3];
886
+ }
887
+ #endif
888
+
889
+ #ifdef PNG_FORMAT_AFIRST_SUPPORTED
890
+ static void
891
+ gp_argb8(Pixel *p, png_const_voidp pb)
892
+ {
893
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
894
+
895
+ p->r = pp[1];
896
+ p->g = pp[2];
897
+ p->b = pp[3];
898
+ p->a = pp[0];
899
+ }
900
+ #endif
901
+
902
+ #if defined(PNG_FORMAT_AFIRST_SUPPORTED) && defined(PNG_FORMAT_BGR_SUPPORTED)
903
+ static void
904
+ gp_abgr8(Pixel *p, png_const_voidp pb)
905
+ {
906
+ png_const_bytep pp = voidcast(png_const_bytep, pb);
907
+
908
+ p->r = pp[3];
909
+ p->g = pp[2];
910
+ p->b = pp[1];
911
+ p->a = pp[0];
912
+ }
913
+ #endif
914
+
915
+ static void
916
+ gp_g16(Pixel *p, png_const_voidp pb)
917
+ {
918
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
919
+
920
+ p->r = p->g = p->b = pp[0];
921
+ p->a = 65535;
922
+ }
923
+
924
+ static void
925
+ gp_ga16(Pixel *p, png_const_voidp pb)
926
+ {
927
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
928
+
929
+ p->r = p->g = p->b = pp[0];
930
+ p->a = pp[1];
931
+ }
932
+
933
+ #ifdef PNG_FORMAT_AFIRST_SUPPORTED
934
+ static void
935
+ gp_ag16(Pixel *p, png_const_voidp pb)
936
+ {
937
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
938
+
939
+ p->r = p->g = p->b = pp[1];
940
+ p->a = pp[0];
941
+ }
942
+ #endif
943
+
944
+ static void
945
+ gp_rgb16(Pixel *p, png_const_voidp pb)
946
+ {
947
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
948
+
949
+ p->r = pp[0];
950
+ p->g = pp[1];
951
+ p->b = pp[2];
952
+ p->a = 65535;
953
+ }
954
+
955
+ #ifdef PNG_FORMAT_BGR_SUPPORTED
956
+ static void
957
+ gp_bgr16(Pixel *p, png_const_voidp pb)
958
+ {
959
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
960
+
961
+ p->r = pp[2];
962
+ p->g = pp[1];
963
+ p->b = pp[0];
964
+ p->a = 65535;
965
+ }
966
+ #endif
967
+
968
+ static void
969
+ gp_rgba16(Pixel *p, png_const_voidp pb)
970
+ {
971
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
972
+
973
+ p->r = pp[0];
974
+ p->g = pp[1];
975
+ p->b = pp[2];
976
+ p->a = pp[3];
977
+ }
978
+
979
+ #ifdef PNG_FORMAT_BGR_SUPPORTED
980
+ static void
981
+ gp_bgra16(Pixel *p, png_const_voidp pb)
982
+ {
983
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
984
+
985
+ p->r = pp[2];
986
+ p->g = pp[1];
987
+ p->b = pp[0];
988
+ p->a = pp[3];
989
+ }
990
+ #endif
991
+
992
+ #ifdef PNG_FORMAT_AFIRST_SUPPORTED
993
+ static void
994
+ gp_argb16(Pixel *p, png_const_voidp pb)
995
+ {
996
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
997
+
998
+ p->r = pp[1];
999
+ p->g = pp[2];
1000
+ p->b = pp[3];
1001
+ p->a = pp[0];
1002
+ }
1003
+ #endif
1004
+
1005
+ #if defined(PNG_FORMAT_AFIRST_SUPPORTED) && defined(PNG_FORMAT_BGR_SUPPORTED)
1006
+ static void
1007
+ gp_abgr16(Pixel *p, png_const_voidp pb)
1008
+ {
1009
+ png_const_uint_16p pp = voidcast(png_const_uint_16p, pb);
1010
+
1011
+ p->r = pp[3];
1012
+ p->g = pp[2];
1013
+ p->b = pp[1];
1014
+ p->a = pp[0];
1015
+ }
1016
+ #endif
1017
+
1018
+ /* Given a format, return the correct one of the above functions. */
1019
+ static void (*
1020
+ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
1021
+ {
1022
+ /* The color-map flag is irrelevant here - the caller of the function
1023
+ * returned must either pass the buffer or, for a color-mapped image, the
1024
+ * correct entry in the color-map.
1025
+ */
1026
+ if (format & PNG_FORMAT_FLAG_LINEAR)
1027
+ {
1028
+ if (format & PNG_FORMAT_FLAG_COLOR)
1029
+ {
1030
+ # ifdef PNG_FORMAT_BGR_SUPPORTED
1031
+ if (format & PNG_FORMAT_FLAG_BGR)
1032
+ {
1033
+ if (format & PNG_FORMAT_FLAG_ALPHA)
1034
+ {
1035
+ # ifdef PNG_FORMAT_AFIRST_SUPPORTED
1036
+ if (format & PNG_FORMAT_FLAG_AFIRST)
1037
+ return gp_abgr16;
1038
+
1039
+ else
1040
+ # endif
1041
+ return gp_bgra16;
1042
+ }
1043
+
1044
+ else
1045
+ return gp_bgr16;
1046
+ }
1047
+
1048
+ else
1049
+ # endif
1050
+ {
1051
+ if (format & PNG_FORMAT_FLAG_ALPHA)
1052
+ {
1053
+ # ifdef PNG_FORMAT_AFIRST_SUPPORTED
1054
+ if (format & PNG_FORMAT_FLAG_AFIRST)
1055
+ return gp_argb16;
1056
+
1057
+ else
1058
+ # endif
1059
+ return gp_rgba16;
1060
+ }
1061
+
1062
+ else
1063
+ return gp_rgb16;
1064
+ }
1065
+ }
1066
+
1067
+ else
1068
+ {
1069
+ if (format & PNG_FORMAT_FLAG_ALPHA)
1070
+ {
1071
+ # ifdef PNG_FORMAT_AFIRST_SUPPORTED
1072
+ if (format & PNG_FORMAT_FLAG_AFIRST)
1073
+ return gp_ag16;
1074
+
1075
+ else
1076
+ # endif
1077
+ return gp_ga16;
1078
+ }
1079
+
1080
+ else
1081
+ return gp_g16;
1082
+ }
1083
+ }
1084
+
1085
+ else
1086
+ {
1087
+ if (format & PNG_FORMAT_FLAG_COLOR)
1088
+ {
1089
+ # ifdef PNG_FORMAT_BGR_SUPPORTED
1090
+ if (format & PNG_FORMAT_FLAG_BGR)
1091
+ {
1092
+ if (format & PNG_FORMAT_FLAG_ALPHA)
1093
+ {
1094
+ # ifdef PNG_FORMAT_AFIRST_SUPPORTED
1095
+ if (format & PNG_FORMAT_FLAG_AFIRST)
1096
+ return gp_abgr8;
1097
+
1098
+ else
1099
+ # endif
1100
+ return gp_bgra8;
1101
+ }
1102
+
1103
+ else
1104
+ return gp_bgr8;
1105
+ }
1106
+
1107
+ else
1108
+ # endif
1109
+ {
1110
+ if (format & PNG_FORMAT_FLAG_ALPHA)
1111
+ {
1112
+ # ifdef PNG_FORMAT_AFIRST_SUPPORTED
1113
+ if (format & PNG_FORMAT_FLAG_AFIRST)
1114
+ return gp_argb8;
1115
+
1116
+ else
1117
+ # endif
1118
+ return gp_rgba8;
1119
+ }
1120
+
1121
+ else
1122
+ return gp_rgb8;
1123
+ }
1124
+ }
1125
+
1126
+ else
1127
+ {
1128
+ if (format & PNG_FORMAT_FLAG_ALPHA)
1129
+ {
1130
+ # ifdef PNG_FORMAT_AFIRST_SUPPORTED
1131
+ if (format & PNG_FORMAT_FLAG_AFIRST)
1132
+ return gp_ag8;
1133
+
1134
+ else
1135
+ # endif
1136
+ return gp_ga8;
1137
+ }
1138
+
1139
+ else
1140
+ return gp_g8;
1141
+ }
1142
+ }
1143
+ }
1144
+
1145
+ /* Conversion between pixel formats. The code above effectively eliminates the
1146
+ * component ordering changes leaving three basic changes:
1147
+ *
1148
+ * 1) Remove an alpha channel by pre-multiplication or compositing on a
1149
+ * background color. (Adding an alpha channel is a no-op.)
1150
+ *
1151
+ * 2) Remove color by mapping to grayscale. (Grayscale to color is a no-op.)
1152
+ *
1153
+ * 3) Convert between 8-bit and 16-bit components. (Both directtions are
1154
+ * relevant.)
1155
+ *
1156
+ * This gives the following base format conversion matrix:
1157
+ *
1158
+ * OUT: ----- 8-bit ----- ----- 16-bit -----
1159
+ * IN G GA RGB RGBA G GA RGB RGBA
1160
+ * 8 G . . . . lin lin lin lin
1161
+ * 8 GA bckg . bckc . pre' pre pre' pre
1162
+ * 8 RGB g8 g8 . . glin glin lin lin
1163
+ * 8 RGBA g8b g8 bckc . gpr' gpre pre' pre
1164
+ * 16 G sRGB sRGB sRGB sRGB . . . .
1165
+ * 16 GA b16g unpg b16c unpc A . A .
1166
+ * 16 RGB sG sG sRGB sRGB g16 g16 . .
1167
+ * 16 RGBA gb16 sGp cb16 sCp g16 g16' A .
1168
+ *
1169
+ * 8-bit to 8-bit:
1170
+ * bckg: composite on gray background
1171
+ * bckc: composite on color background
1172
+ * g8: convert sRGB components to sRGB grayscale
1173
+ * g8b: convert sRGB components to grayscale and composite on gray background
1174
+ *
1175
+ * 8-bit to 16-bit:
1176
+ * lin: make sRGB components linear, alpha := 65535
1177
+ * pre: make sRGB components linear and premultiply by alpha (scale alpha)
1178
+ * pre': as 'pre' but alpha := 65535
1179
+ * glin: make sRGB components linear, convert to grayscale, alpha := 65535
1180
+ * gpre: make sRGB components grayscale and linear and premultiply by alpha
1181
+ * gpr': as 'gpre' but alpha := 65535
1182
+ *
1183
+ * 16-bit to 8-bit:
1184
+ * sRGB: convert linear components to sRGB, alpha := 255
1185
+ * unpg: unpremultiply gray component and convert to sRGB (scale alpha)
1186
+ * unpc: unpremultiply color components and convert to sRGB (scale alpha)
1187
+ * b16g: composite linear onto gray background and convert the result to sRGB
1188
+ * b16c: composite linear onto color background and convert the result to sRGB
1189
+ * sG: convert linear RGB to sRGB grayscale
1190
+ * sGp: unpremultiply RGB then convert to sRGB grayscale
1191
+ * sCp: unpremultiply RGB then convert to sRGB
1192
+ * gb16: composite linear onto background and convert to sRGB grayscale
1193
+ * (order doesn't matter, the composite and grayscale operations permute)
1194
+ * cb16: composite linear onto background and convert to sRGB
1195
+ *
1196
+ * 16-bit to 16-bit:
1197
+ * A: set alpha to 65535
1198
+ * g16: convert linear RGB to linear grayscale (alpha := 65535)
1199
+ * g16': as 'g16' but alpha is unchanged
1200
+ */
1201
+ /* Simple copy: */
1202
+ static void
1203
+ gpc_noop(Pixel *out, const Pixel *in, const Background *back)
1204
+ {
1205
+ (void)back;
1206
+ out->r = in->r;
1207
+ out->g = in->g;
1208
+ out->b = in->b;
1209
+ out->a = in->a;
1210
+ }
1211
+
1212
+ #if ALLOW_UNUSED_GPC
1213
+ static void
1214
+ gpc_nop8(Pixel *out, const Pixel *in, const Background *back)
1215
+ {
1216
+ (void)back;
1217
+ if (in->a == 0)
1218
+ out->r = out->g = out->b = 255;
1219
+
1220
+ else
1221
+ {
1222
+ out->r = in->r;
1223
+ out->g = in->g;
1224
+ out->b = in->b;
1225
+ }
1226
+
1227
+ out->a = in->a;
1228
+ }
1229
+ #endif
1230
+
1231
+ #if ALLOW_UNUSED_GPC
1232
+ static void
1233
+ gpc_nop6(Pixel *out, const Pixel *in, const Background *back)
1234
+ {
1235
+ (void)back;
1236
+ if (in->a == 0)
1237
+ out->r = out->g = out->b = 65535;
1238
+
1239
+ else
1240
+ {
1241
+ out->r = in->r;
1242
+ out->g = in->g;
1243
+ out->b = in->b;
1244
+ }
1245
+
1246
+ out->a = in->a;
1247
+ }
1248
+ #endif
1249
+
1250
+ /* 8-bit to 8-bit conversions */
1251
+ /* bckg: composite on gray background */
1252
+ static void
1253
+ gpc_bckg(Pixel *out, const Pixel *in, const Background *back)
1254
+ {
1255
+ if (in->a <= 0)
1256
+ out->r = out->g = out->b = back->ig;
1257
+
1258
+ else if (in->a >= 255)
1259
+ out->r = out->g = out->b = in->g;
1260
+
1261
+ else
1262
+ {
1263
+ double a = in->a / 255.;
1264
+
1265
+ out->r = out->g = out->b = sRGB(sRGB_to_d[in->g] * a + back->dg * (1-a));
1266
+ }
1267
+
1268
+ out->a = 255;
1269
+ }
1270
+
1271
+ /* bckc: composite on color background */
1272
+ static void
1273
+ gpc_bckc(Pixel *out, const Pixel *in, const Background *back)
1274
+ {
1275
+ if (in->a <= 0)
1276
+ {
1277
+ out->r = back->ir;
1278
+ out->g = back->ig;
1279
+ out->b = back->ib;
1280
+ }
1281
+
1282
+ else if (in->a >= 255)
1283
+ {
1284
+ out->r = in->r;
1285
+ out->g = in->g;
1286
+ out->b = in->b;
1287
+ }
1288
+
1289
+ else
1290
+ {
1291
+ double a = in->a / 255.;
1292
+
1293
+ out->r = sRGB(sRGB_to_d[in->r] * a + back->dr * (1-a));
1294
+ out->g = sRGB(sRGB_to_d[in->g] * a + back->dg * (1-a));
1295
+ out->b = sRGB(sRGB_to_d[in->b] * a + back->db * (1-a));
1296
+ }
1297
+
1298
+ out->a = 255;
1299
+ }
1300
+
1301
+ /* g8: convert sRGB components to sRGB grayscale */
1302
+ static void
1303
+ gpc_g8(Pixel *out, const Pixel *in, const Background *back)
1304
+ {
1305
+ (void)back;
1306
+
1307
+ if (in->r == in->g && in->g == in->b)
1308
+ out->r = out->g = out->b = in->g;
1309
+
1310
+ else
1311
+ out->r = out->g = out->b =
1312
+ sRGB(YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1313
+
1314
+ out->a = in->a;
1315
+ }
1316
+
1317
+ /* g8b: convert sRGB components to grayscale and composite on gray background */
1318
+ static void
1319
+ gpc_g8b(Pixel *out, const Pixel *in, const Background *back)
1320
+ {
1321
+ if (in->a <= 0)
1322
+ out->r = out->g = out->b = back->ig;
1323
+
1324
+ else if (in->a >= 255)
1325
+ {
1326
+ if (in->r == in->g && in->g == in->b)
1327
+ out->r = out->g = out->b = in->g;
1328
+
1329
+ else
1330
+ out->r = out->g = out->b = sRGB(YfromRGB(
1331
+ sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1332
+ }
1333
+
1334
+ else
1335
+ {
1336
+ double a = in->a/255.;
1337
+
1338
+ out->r = out->g = out->b = sRGB(a * YfromRGB(sRGB_to_d[in->r],
1339
+ sRGB_to_d[in->g], sRGB_to_d[in->b]) + back->dg * (1-a));
1340
+ }
1341
+
1342
+ out->a = 255;
1343
+ }
1344
+
1345
+ /* 8-bit to 16-bit conversions */
1346
+ /* lin: make sRGB components linear, alpha := 65535 */
1347
+ static void
1348
+ gpc_lin(Pixel *out, const Pixel *in, const Background *back)
1349
+ {
1350
+ (void)back;
1351
+
1352
+ out->r = ilinear(in->r);
1353
+
1354
+ if (in->g == in->r)
1355
+ {
1356
+ out->g = out->r;
1357
+
1358
+ if (in->b == in->r)
1359
+ out->b = out->r;
1360
+
1361
+ else
1362
+ out->b = ilinear(in->b);
1363
+ }
1364
+
1365
+ else
1366
+ {
1367
+ out->g = ilinear(in->g);
1368
+
1369
+ if (in->b == in->r)
1370
+ out->b = out->r;
1371
+
1372
+ else if (in->b == in->g)
1373
+ out->b = out->g;
1374
+
1375
+ else
1376
+ out->b = ilinear(in->b);
1377
+ }
1378
+
1379
+ out->a = 65535;
1380
+ }
1381
+
1382
+ /* pre: make sRGB components linear and premultiply by alpha (scale alpha) */
1383
+ static void
1384
+ gpc_pre(Pixel *out, const Pixel *in, const Background *back)
1385
+ {
1386
+ (void)back;
1387
+
1388
+ out->r = ilineara(in->r, in->a);
1389
+
1390
+ if (in->g == in->r)
1391
+ {
1392
+ out->g = out->r;
1393
+
1394
+ if (in->b == in->r)
1395
+ out->b = out->r;
1396
+
1397
+ else
1398
+ out->b = ilineara(in->b, in->a);
1399
+ }
1400
+
1401
+ else
1402
+ {
1403
+ out->g = ilineara(in->g, in->a);
1404
+
1405
+ if (in->b == in->r)
1406
+ out->b = out->r;
1407
+
1408
+ else if (in->b == in->g)
1409
+ out->b = out->g;
1410
+
1411
+ else
1412
+ out->b = ilineara(in->b, in->a);
1413
+ }
1414
+
1415
+ out->a = in->a * 257;
1416
+ }
1417
+
1418
+ /* pre': as 'pre' but alpha := 65535 */
1419
+ static void
1420
+ gpc_preq(Pixel *out, const Pixel *in, const Background *back)
1421
+ {
1422
+ (void)back;
1423
+
1424
+ out->r = ilineara(in->r, in->a);
1425
+
1426
+ if (in->g == in->r)
1427
+ {
1428
+ out->g = out->r;
1429
+
1430
+ if (in->b == in->r)
1431
+ out->b = out->r;
1432
+
1433
+ else
1434
+ out->b = ilineara(in->b, in->a);
1435
+ }
1436
+
1437
+ else
1438
+ {
1439
+ out->g = ilineara(in->g, in->a);
1440
+
1441
+ if (in->b == in->r)
1442
+ out->b = out->r;
1443
+
1444
+ else if (in->b == in->g)
1445
+ out->b = out->g;
1446
+
1447
+ else
1448
+ out->b = ilineara(in->b, in->a);
1449
+ }
1450
+
1451
+ out->a = 65535;
1452
+ }
1453
+
1454
+ /* glin: make sRGB components linear, convert to grayscale, alpha := 65535 */
1455
+ static void
1456
+ gpc_glin(Pixel *out, const Pixel *in, const Background *back)
1457
+ {
1458
+ (void)back;
1459
+
1460
+ if (in->r == in->g && in->g == in->b)
1461
+ out->r = out->g = out->b = ilinear(in->g);
1462
+
1463
+ else
1464
+ out->r = out->g = out->b = u16d(65535 *
1465
+ YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1466
+
1467
+ out->a = 65535;
1468
+ }
1469
+
1470
+ /* gpre: make sRGB components grayscale and linear and premultiply by alpha */
1471
+ static void
1472
+ gpc_gpre(Pixel *out, const Pixel *in, const Background *back)
1473
+ {
1474
+ (void)back;
1475
+
1476
+ if (in->r == in->g && in->g == in->b)
1477
+ out->r = out->g = out->b = ilineara(in->g, in->a);
1478
+
1479
+ else
1480
+ out->r = out->g = out->b = u16d(in->a * 257 *
1481
+ YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1482
+
1483
+ out->a = 257 * in->a;
1484
+ }
1485
+
1486
+ /* gpr': as 'gpre' but alpha := 65535 */
1487
+ static void
1488
+ gpc_gprq(Pixel *out, const Pixel *in, const Background *back)
1489
+ {
1490
+ (void)back;
1491
+
1492
+ if (in->r == in->g && in->g == in->b)
1493
+ out->r = out->g = out->b = ilineara(in->g, in->a);
1494
+
1495
+ else
1496
+ out->r = out->g = out->b = u16d(in->a * 257 *
1497
+ YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1498
+
1499
+ out->a = 65535;
1500
+ }
1501
+
1502
+ /* 8-bit to 16-bit conversions for gAMA 45455 encoded values */
1503
+ /* Lin: make gAMA 45455 components linear, alpha := 65535 */
1504
+ static void
1505
+ gpc_Lin(Pixel *out, const Pixel *in, const Background *back)
1506
+ {
1507
+ (void)back;
1508
+
1509
+ out->r = ilinear_g22(in->r);
1510
+
1511
+ if (in->g == in->r)
1512
+ {
1513
+ out->g = out->r;
1514
+
1515
+ if (in->b == in->r)
1516
+ out->b = out->r;
1517
+
1518
+ else
1519
+ out->b = ilinear_g22(in->b);
1520
+ }
1521
+
1522
+ else
1523
+ {
1524
+ out->g = ilinear_g22(in->g);
1525
+
1526
+ if (in->b == in->r)
1527
+ out->b = out->r;
1528
+
1529
+ else if (in->b == in->g)
1530
+ out->b = out->g;
1531
+
1532
+ else
1533
+ out->b = ilinear_g22(in->b);
1534
+ }
1535
+
1536
+ out->a = 65535;
1537
+ }
1538
+
1539
+ #if ALLOW_UNUSED_GPC
1540
+ /* Pre: make gAMA 45455 components linear and premultiply by alpha (scale alpha)
1541
+ */
1542
+ static void
1543
+ gpc_Pre(Pixel *out, const Pixel *in, const Background *back)
1544
+ {
1545
+ (void)back;
1546
+
1547
+ out->r = ilineara_g22(in->r, in->a);
1548
+
1549
+ if (in->g == in->r)
1550
+ {
1551
+ out->g = out->r;
1552
+
1553
+ if (in->b == in->r)
1554
+ out->b = out->r;
1555
+
1556
+ else
1557
+ out->b = ilineara_g22(in->b, in->a);
1558
+ }
1559
+
1560
+ else
1561
+ {
1562
+ out->g = ilineara_g22(in->g, in->a);
1563
+
1564
+ if (in->b == in->r)
1565
+ out->b = out->r;
1566
+
1567
+ else if (in->b == in->g)
1568
+ out->b = out->g;
1569
+
1570
+ else
1571
+ out->b = ilineara_g22(in->b, in->a);
1572
+ }
1573
+
1574
+ out->a = in->a * 257;
1575
+ }
1576
+ #endif
1577
+
1578
+ #if ALLOW_UNUSED_GPC
1579
+ /* Pre': as 'Pre' but alpha := 65535 */
1580
+ static void
1581
+ gpc_Preq(Pixel *out, const Pixel *in, const Background *back)
1582
+ {
1583
+ (void)back;
1584
+
1585
+ out->r = ilineara_g22(in->r, in->a);
1586
+
1587
+ if (in->g == in->r)
1588
+ {
1589
+ out->g = out->r;
1590
+
1591
+ if (in->b == in->r)
1592
+ out->b = out->r;
1593
+
1594
+ else
1595
+ out->b = ilineara_g22(in->b, in->a);
1596
+ }
1597
+
1598
+ else
1599
+ {
1600
+ out->g = ilineara_g22(in->g, in->a);
1601
+
1602
+ if (in->b == in->r)
1603
+ out->b = out->r;
1604
+
1605
+ else if (in->b == in->g)
1606
+ out->b = out->g;
1607
+
1608
+ else
1609
+ out->b = ilineara_g22(in->b, in->a);
1610
+ }
1611
+
1612
+ out->a = 65535;
1613
+ }
1614
+ #endif
1615
+
1616
+ #if ALLOW_UNUSED_GPC
1617
+ /* Glin: make gAMA 45455 components linear, convert to grayscale, alpha := 65535
1618
+ */
1619
+ static void
1620
+ gpc_Glin(Pixel *out, const Pixel *in, const Background *back)
1621
+ {
1622
+ (void)back;
1623
+
1624
+ if (in->r == in->g && in->g == in->b)
1625
+ out->r = out->g = out->b = ilinear_g22(in->g);
1626
+
1627
+ else
1628
+ out->r = out->g = out->b = u16d(65535 *
1629
+ YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1630
+
1631
+ out->a = 65535;
1632
+ }
1633
+ #endif
1634
+
1635
+ #if ALLOW_UNUSED_GPC
1636
+ /* Gpre: make gAMA 45455 components grayscale and linear and premultiply by
1637
+ * alpha.
1638
+ */
1639
+ static void
1640
+ gpc_Gpre(Pixel *out, const Pixel *in, const Background *back)
1641
+ {
1642
+ (void)back;
1643
+
1644
+ if (in->r == in->g && in->g == in->b)
1645
+ out->r = out->g = out->b = ilineara_g22(in->g, in->a);
1646
+
1647
+ else
1648
+ out->r = out->g = out->b = u16d(in->a * 257 *
1649
+ YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1650
+
1651
+ out->a = 257 * in->a;
1652
+ }
1653
+ #endif
1654
+
1655
+ #if ALLOW_UNUSED_GPC
1656
+ /* Gpr': as 'Gpre' but alpha := 65535 */
1657
+ static void
1658
+ gpc_Gprq(Pixel *out, const Pixel *in, const Background *back)
1659
+ {
1660
+ (void)back;
1661
+
1662
+ if (in->r == in->g && in->g == in->b)
1663
+ out->r = out->g = out->b = ilineara_g22(in->g, in->a);
1664
+
1665
+ else
1666
+ out->r = out->g = out->b = u16d(in->a * 257 *
1667
+ YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1668
+
1669
+ out->a = 65535;
1670
+ }
1671
+ #endif
1672
+
1673
+ /* 16-bit to 8-bit conversions */
1674
+ /* sRGB: convert linear components to sRGB, alpha := 255 */
1675
+ static void
1676
+ gpc_sRGB(Pixel *out, const Pixel *in, const Background *back)
1677
+ {
1678
+ (void)back;
1679
+
1680
+ out->r = isRGB(in->r);
1681
+
1682
+ if (in->g == in->r)
1683
+ {
1684
+ out->g = out->r;
1685
+
1686
+ if (in->b == in->r)
1687
+ out->b = out->r;
1688
+
1689
+ else
1690
+ out->b = isRGB(in->b);
1691
+ }
1692
+
1693
+ else
1694
+ {
1695
+ out->g = isRGB(in->g);
1696
+
1697
+ if (in->b == in->r)
1698
+ out->b = out->r;
1699
+
1700
+ else if (in->b == in->g)
1701
+ out->b = out->g;
1702
+
1703
+ else
1704
+ out->b = isRGB(in->b);
1705
+ }
1706
+
1707
+ out->a = 255;
1708
+ }
1709
+
1710
+ /* unpg: unpremultiply gray component and convert to sRGB (scale alpha) */
1711
+ static void
1712
+ gpc_unpg(Pixel *out, const Pixel *in, const Background *back)
1713
+ {
1714
+ (void)back;
1715
+
1716
+ if (in->a <= 128)
1717
+ {
1718
+ out->r = out->g = out->b = 255;
1719
+ out->a = 0;
1720
+ }
1721
+
1722
+ else
1723
+ {
1724
+ out->r = out->g = out->b = sRGB((double)in->g / in->a);
1725
+ out->a = u8d(in->a / 257.);
1726
+ }
1727
+ }
1728
+
1729
+ /* unpc: unpremultiply color components and convert to sRGB (scale alpha) */
1730
+ static void
1731
+ gpc_unpc(Pixel *out, const Pixel *in, const Background *back)
1732
+ {
1733
+ (void)back;
1734
+
1735
+ if (in->a <= 128)
1736
+ {
1737
+ out->r = out->g = out->b = 255;
1738
+ out->a = 0;
1739
+ }
1740
+
1741
+ else
1742
+ {
1743
+ out->r = sRGB((double)in->r / in->a);
1744
+ out->g = sRGB((double)in->g / in->a);
1745
+ out->b = sRGB((double)in->b / in->a);
1746
+ out->a = u8d(in->a / 257.);
1747
+ }
1748
+ }
1749
+
1750
+ /* b16g: composite linear onto gray background and convert the result to sRGB */
1751
+ static void
1752
+ gpc_b16g(Pixel *out, const Pixel *in, const Background *back)
1753
+ {
1754
+ if (in->a <= 0)
1755
+ out->r = out->g = out->b = back->ig;
1756
+
1757
+ else
1758
+ {
1759
+ double a = in->a/65535.;
1760
+ double a1 = 1-a;
1761
+
1762
+ a /= 65535;
1763
+ out->r = out->g = out->b = sRGB(in->g * a + back->dg * a1);
1764
+ }
1765
+
1766
+ out->a = 255;
1767
+ }
1768
+
1769
+ /* b16c: composite linear onto color background and convert the result to sRGB*/
1770
+ static void
1771
+ gpc_b16c(Pixel *out, const Pixel *in, const Background *back)
1772
+ {
1773
+ if (in->a <= 0)
1774
+ {
1775
+ out->r = back->ir;
1776
+ out->g = back->ig;
1777
+ out->b = back->ib;
1778
+ }
1779
+
1780
+ else
1781
+ {
1782
+ double a = in->a/65535.;
1783
+ double a1 = 1-a;
1784
+
1785
+ a /= 65535;
1786
+ out->r = sRGB(in->r * a + back->dr * a1);
1787
+ out->g = sRGB(in->g * a + back->dg * a1);
1788
+ out->b = sRGB(in->b * a + back->db * a1);
1789
+ }
1790
+
1791
+ out->a = 255;
1792
+ }
1793
+
1794
+ /* sG: convert linear RGB to sRGB grayscale */
1795
+ static void
1796
+ gpc_sG(Pixel *out, const Pixel *in, const Background *back)
1797
+ {
1798
+ (void)back;
1799
+
1800
+ out->r = out->g = out->b = sRGB(YfromRGBint(in->r, in->g, in->b)/65535);
1801
+ out->a = 255;
1802
+ }
1803
+
1804
+ /* sGp: unpremultiply RGB then convert to sRGB grayscale */
1805
+ static void
1806
+ gpc_sGp(Pixel *out, const Pixel *in, const Background *back)
1807
+ {
1808
+ (void)back;
1809
+
1810
+ if (in->a <= 128)
1811
+ {
1812
+ out->r = out->g = out->b = 255;
1813
+ out->a = 0;
1814
+ }
1815
+
1816
+ else
1817
+ {
1818
+ out->r = out->g = out->b = sRGB(YfromRGBint(in->r, in->g, in->b)/in->a);
1819
+ out->a = u8d(in->a / 257.);
1820
+ }
1821
+ }
1822
+
1823
+ /* sCp: unpremultiply RGB then convert to sRGB */
1824
+ static void
1825
+ gpc_sCp(Pixel *out, const Pixel *in, const Background *back)
1826
+ {
1827
+ (void)back;
1828
+
1829
+ if (in->a <= 128)
1830
+ {
1831
+ out->r = out->g = out->b = 255;
1832
+ out->a = 0;
1833
+ }
1834
+
1835
+ else
1836
+ {
1837
+ out->r = sRGB((double)in->r / in->a);
1838
+ out->g = sRGB((double)in->g / in->a);
1839
+ out->b = sRGB((double)in->b / in->a);
1840
+ out->a = u8d(in->a / 257.);
1841
+ }
1842
+ }
1843
+
1844
+ /* gb16: composite linear onto background and convert to sRGB grayscale */
1845
+ /* (order doesn't matter, the composite and grayscale operations permute) */
1846
+ static void
1847
+ gpc_gb16(Pixel *out, const Pixel *in, const Background *back)
1848
+ {
1849
+ if (in->a <= 0)
1850
+ out->r = out->g = out->b = back->ig;
1851
+
1852
+ else if (in->a >= 65535)
1853
+ out->r = out->g = out->b = isRGB(in->g);
1854
+
1855
+ else
1856
+ {
1857
+ double a = in->a / 65535.;
1858
+ double a1 = 1-a;
1859
+
1860
+ a /= 65535;
1861
+ out->r = out->g = out->b = sRGB(in->g * a + back->dg * a1);
1862
+ }
1863
+
1864
+ out->a = 255;
1865
+ }
1866
+
1867
+ /* cb16: composite linear onto background and convert to sRGB */
1868
+ static void
1869
+ gpc_cb16(Pixel *out, const Pixel *in, const Background *back)
1870
+ {
1871
+ if (in->a <= 0)
1872
+ {
1873
+ out->r = back->ir;
1874
+ out->g = back->ig;
1875
+ out->b = back->ib;
1876
+ }
1877
+
1878
+ else if (in->a >= 65535)
1879
+ {
1880
+ out->r = isRGB(in->r);
1881
+ out->g = isRGB(in->g);
1882
+ out->b = isRGB(in->b);
1883
+ }
1884
+
1885
+ else
1886
+ {
1887
+ double a = in->a / 65535.;
1888
+ double a1 = 1-a;
1889
+
1890
+ a /= 65535;
1891
+ out->r = sRGB(in->r * a + back->dr * a1);
1892
+ out->g = sRGB(in->g * a + back->dg * a1);
1893
+ out->b = sRGB(in->b * a + back->db * a1);
1894
+ }
1895
+
1896
+ out->a = 255;
1897
+ }
1898
+
1899
+ /* 16-bit to 16-bit conversions */
1900
+ /* A: set alpha to 65535 */
1901
+ static void
1902
+ gpc_A(Pixel *out, const Pixel *in, const Background *back)
1903
+ {
1904
+ (void)back;
1905
+ out->r = in->r;
1906
+ out->g = in->g;
1907
+ out->b = in->b;
1908
+ out->a = 65535;
1909
+ }
1910
+
1911
+ /* g16: convert linear RGB to linear grayscale (alpha := 65535) */
1912
+ static void
1913
+ gpc_g16(Pixel *out, const Pixel *in, const Background *back)
1914
+ {
1915
+ (void)back;
1916
+ out->r = out->g = out->b = u16d(YfromRGBint(in->r, in->g, in->b));
1917
+ out->a = 65535;
1918
+ }
1919
+
1920
+ /* g16': as 'g16' but alpha is unchanged */
1921
+ static void
1922
+ gpc_g16q(Pixel *out, const Pixel *in, const Background *back)
1923
+ {
1924
+ (void)back;
1925
+ out->r = out->g = out->b = u16d(YfromRGBint(in->r, in->g, in->b));
1926
+ out->a = in->a;
1927
+ }
1928
+
1929
+ #if ALLOW_UNUSED_GPC
1930
+ /* Unused functions (to hide them from GCC unused function warnings) */
1931
+ void (* const gpc_unused[])
1932
+ (Pixel *out, const Pixel *in, const Background *back) =
1933
+ {
1934
+ gpc_Pre, gpc_Preq, gpc_Glin, gpc_Gpre, gpc_Gprq, gpc_nop8, gpc_nop6
1935
+ };
1936
+ #endif
1937
+
1938
+ /* OUT: ----- 8-bit ----- ----- 16-bit -----
1939
+ * IN G GA RGB RGBA G GA RGB RGBA
1940
+ * 8 G . . . . lin lin lin lin
1941
+ * 8 GA bckg . bckc . pre' pre pre' pre
1942
+ * 8 RGB g8 g8 . . glin glin lin lin
1943
+ * 8 RGBA g8b g8 bckc . gpr' gpre pre' pre
1944
+ * 16 G sRGB sRGB sRGB sRGB . . . .
1945
+ * 16 GA b16g unpg b16c unpc A . A .
1946
+ * 16 RGB sG sG sRGB sRGB g16 g16 . .
1947
+ * 16 RGBA gb16 sGp cb16 sCp g16 g16' A .
1948
+ *
1949
+ * The matrix is held in an array indexed thus:
1950
+ *
1951
+ * gpc_fn[out_format & BASE_FORMATS][in_format & BASE_FORMATS];
1952
+ */
1953
+ /* This will produce a compile time error if the FORMAT_FLAG values don't
1954
+ * match the above matrix!
1955
+ */
1956
+ #if PNG_FORMAT_FLAG_ALPHA == 1 && PNG_FORMAT_FLAG_COLOR == 2 &&\
1957
+ PNG_FORMAT_FLAG_LINEAR == 4
1958
+ static void (* const gpc_fn[8/*in*/][8/*out*/])
1959
+ (Pixel *out, const Pixel *in, const Background *back) =
1960
+ {
1961
+ /*out: G-8 GA-8 RGB-8 RGBA-8 G-16 GA-16 RGB-16 RGBA-16 */
1962
+ {gpc_noop,gpc_noop,gpc_noop,gpc_noop, gpc_Lin, gpc_Lin, gpc_Lin, gpc_Lin },
1963
+ {gpc_bckg,gpc_noop,gpc_bckc,gpc_noop, gpc_preq,gpc_pre, gpc_preq,gpc_pre },
1964
+ {gpc_g8, gpc_g8, gpc_noop,gpc_noop, gpc_glin,gpc_glin,gpc_lin, gpc_lin },
1965
+ {gpc_g8b, gpc_g8, gpc_bckc,gpc_noop, gpc_gprq,gpc_gpre,gpc_preq,gpc_pre },
1966
+ {gpc_sRGB,gpc_sRGB,gpc_sRGB,gpc_sRGB, gpc_noop,gpc_noop,gpc_noop,gpc_noop},
1967
+ {gpc_b16g,gpc_unpg,gpc_b16c,gpc_unpc, gpc_A, gpc_noop,gpc_A, gpc_noop},
1968
+ {gpc_sG, gpc_sG, gpc_sRGB,gpc_sRGB, gpc_g16, gpc_g16, gpc_noop,gpc_noop},
1969
+ {gpc_gb16,gpc_sGp, gpc_cb16,gpc_sCp, gpc_g16, gpc_g16q,gpc_A, gpc_noop}
1970
+ };
1971
+
1972
+ /* The array is repeated for the cases where both the input and output are color
1973
+ * mapped because then different algorithms are used.
1974
+ */
1975
+ static void (* const gpc_fn_colormapped[8/*in*/][8/*out*/])
1976
+ (Pixel *out, const Pixel *in, const Background *back) =
1977
+ {
1978
+ /*out: G-8 GA-8 RGB-8 RGBA-8 G-16 GA-16 RGB-16 RGBA-16 */
1979
+ {gpc_noop,gpc_noop,gpc_noop,gpc_noop, gpc_lin, gpc_lin, gpc_lin, gpc_lin },
1980
+ {gpc_bckg,gpc_noop,gpc_bckc,gpc_noop, gpc_preq,gpc_pre, gpc_preq,gpc_pre },
1981
+ {gpc_g8, gpc_g8, gpc_noop,gpc_noop, gpc_glin,gpc_glin,gpc_lin, gpc_lin },
1982
+ {gpc_g8b, gpc_g8, gpc_bckc,gpc_noop, gpc_gprq,gpc_gpre,gpc_preq,gpc_pre },
1983
+ {gpc_sRGB,gpc_sRGB,gpc_sRGB,gpc_sRGB, gpc_noop,gpc_noop,gpc_noop,gpc_noop},
1984
+ {gpc_b16g,gpc_unpg,gpc_b16c,gpc_unpc, gpc_A, gpc_noop,gpc_A, gpc_noop},
1985
+ {gpc_sG, gpc_sG, gpc_sRGB,gpc_sRGB, gpc_g16, gpc_g16, gpc_noop,gpc_noop},
1986
+ {gpc_gb16,gpc_sGp, gpc_cb16,gpc_sCp, gpc_g16, gpc_g16q,gpc_A, gpc_noop}
1987
+ };
1988
+
1989
+ /* The error arrays record the error in the same matrix; 64 entries, however
1990
+ * the different algorithms used in libpng for colormap and direct conversions
1991
+ * mean that four separate matrices are used (for each combination of
1992
+ * colormapped and direct.)
1993
+ *
1994
+ * In some cases the conversion between sRGB formats goes via a linear
1995
+ * intermediate; an sRGB to linear conversion (as above) is followed by a simple
1996
+ * linear to sRGB step with no other conversions. This is done by a separate
1997
+ * error array from an arbitrary 'in' format to one of the four basic outputs
1998
+ * (since final output is always sRGB not colormapped).
1999
+ *
2000
+ * These arrays may be modified if the --accumulate flag is set during the run;
2001
+ * then instead of logging errors they are simply added in.
2002
+ *
2003
+ * The three entries are currently for transparent, partially transparent and
2004
+ * opaque input pixel values. Notice that alpha should be exact in each case.
2005
+ *
2006
+ * Errors in alpha should only occur when converting from a direct format
2007
+ * to a colormapped format, when alpha is effectively smashed (so large
2008
+ * errors can occur.) There should be no error in the '0' and 'opaque'
2009
+ * values. The fourth entry in the array is used for the alpha error (and it
2010
+ * should always be zero for the 'via linear' case since this is never color
2011
+ * mapped.)
2012
+ *
2013
+ * Mapping to a colormap smashes the colors, it is necessary to have separate
2014
+ * values for these cases because they are much larger; it is very much
2015
+ * impossible to obtain a reasonable result, these are held in
2016
+ * gpc_error_to_colormap.
2017
+ */
2018
+ #if PNG_FORMAT_FLAG_COLORMAP == 8 /* extra check also required */
2019
+ # include "pngstest-errors.h" /* machine generated */
2020
+ #endif /* COLORMAP flag check */
2021
+ #endif /* flag checks */
2022
+
2023
+ typedef struct
2024
+ {
2025
+ /* Basic pixel information: */
2026
+ Image* in_image; /* Input image */
2027
+ const Image* out_image; /* Output image */
2028
+
2029
+ /* 'background' is the value passed to the gpc_ routines, it may be NULL if
2030
+ * it should not be used (*this* program has an error if it crashes as a
2031
+ * result!)
2032
+ */
2033
+ Background background_color;
2034
+ const Background* background;
2035
+
2036
+ /* Precalculated values: */
2037
+ int in_opaque; /* Value of input alpha that is opaque */
2038
+ int is_palette; /* Sample values come from the palette */
2039
+ int accumulate; /* Accumulate component errors (don't log) */
2040
+ int output_8bit; /* Output is 8-bit (else 16-bit) */
2041
+
2042
+ void (*in_gp)(Pixel*, png_const_voidp);
2043
+ void (*out_gp)(Pixel*, png_const_voidp);
2044
+
2045
+ void (*transform)(Pixel *out, const Pixel *in, const Background *back);
2046
+ /* A function to perform the required transform */
2047
+
2048
+ void (*from_linear)(Pixel *out, const Pixel *in, const Background *back);
2049
+ /* For 'via_linear' transforms the final, from linear, step, else NULL */
2050
+
2051
+ png_uint_16 error[4];
2052
+ /* Three error values for transparent, partially transparent and opaque
2053
+ * input pixels (in turn).
2054
+ */
2055
+
2056
+ png_uint_16 *error_ptr;
2057
+ /* Where these are stored in the static array (for 'accumulate') */
2058
+ }
2059
+ Transform;
2060
+
2061
+ /* Return a 'transform' as above for the given format conversion. */
2062
+ static void
2063
+ transform_from_formats(Transform *result, Image *in_image,
2064
+ const Image *out_image, png_const_colorp background, int via_linear)
2065
+ {
2066
+ png_uint_32 in_format, out_format;
2067
+ png_uint_32 in_base, out_base;
2068
+
2069
+ memset(result, 0, sizeof *result);
2070
+
2071
+ /* Store the original images for error messages */
2072
+ result->in_image = in_image;
2073
+ result->out_image = out_image;
2074
+
2075
+ in_format = in_image->image.format;
2076
+ out_format = out_image->image.format;
2077
+
2078
+ if (in_format & PNG_FORMAT_FLAG_LINEAR)
2079
+ result->in_opaque = 65535;
2080
+ else
2081
+ result->in_opaque = 255;
2082
+
2083
+ result->output_8bit = (out_format & PNG_FORMAT_FLAG_LINEAR) == 0;
2084
+
2085
+ result->is_palette = 0; /* set by caller if required */
2086
+ result->accumulate = (in_image->opts & ACCUMULATE) != 0;
2087
+
2088
+ /* The loaders (which need the ordering information) */
2089
+ result->in_gp = get_pixel(in_format);
2090
+ result->out_gp = get_pixel(out_format);
2091
+
2092
+ /* Remove the ordering information: */
2093
+ in_format &= BASE_FORMATS | PNG_FORMAT_FLAG_COLORMAP;
2094
+ in_base = in_format & BASE_FORMATS;
2095
+ out_format &= BASE_FORMATS | PNG_FORMAT_FLAG_COLORMAP;
2096
+ out_base = out_format & BASE_FORMATS;
2097
+
2098
+ if (via_linear)
2099
+ {
2100
+ /* Check for an error in this program: */
2101
+ if (out_format & (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLORMAP))
2102
+ {
2103
+ fprintf(stderr, "internal transform via linear error 0x%x->0x%x\n",
2104
+ in_format, out_format);
2105
+ exit(1);
2106
+ }
2107
+
2108
+ result->transform = gpc_fn[in_base][out_base | PNG_FORMAT_FLAG_LINEAR];
2109
+ result->from_linear = gpc_fn[out_base | PNG_FORMAT_FLAG_LINEAR][out_base];
2110
+ result->error_ptr = gpc_error_via_linear[in_format][out_format];
2111
+ }
2112
+
2113
+ else if (~in_format & out_format & PNG_FORMAT_FLAG_COLORMAP)
2114
+ {
2115
+ /* The input is not colormapped but the output is, the errors will
2116
+ * typically be large (only the grayscale-no-alpha case permits preserving
2117
+ * even 8-bit values.)
2118
+ */
2119
+ result->transform = gpc_fn[in_base][out_base];
2120
+ result->from_linear = NULL;
2121
+ result->error_ptr = gpc_error_to_colormap[in_base][out_base];
2122
+ }
2123
+
2124
+ else
2125
+ {
2126
+ /* The caller handles the colormap->pixel value conversion, so the
2127
+ * transform function just gets a pixel value, however because libpng
2128
+ * currently contains a different implementation for mapping a colormap if
2129
+ * both input and output are colormapped we need different conversion
2130
+ * functions to deal with errors in the libpng implementation.
2131
+ */
2132
+ if (in_format & out_format & PNG_FORMAT_FLAG_COLORMAP)
2133
+ result->transform = gpc_fn_colormapped[in_base][out_base];
2134
+ else
2135
+ result->transform = gpc_fn[in_base][out_base];
2136
+ result->from_linear = NULL;
2137
+ result->error_ptr = gpc_error[in_format][out_format];
2138
+ }
2139
+
2140
+ /* Follow the libpng simplified API rules to work out what to pass to the gpc
2141
+ * routines as a background value, if one is not required pass NULL so that
2142
+ * this program crashes in the even of a programming error.
2143
+ */
2144
+ result->background = NULL; /* default: not required */
2145
+
2146
+ /* Rule 1: background only need be supplied if alpha is to be removed */
2147
+ if (in_format & ~out_format & PNG_FORMAT_FLAG_ALPHA)
2148
+ {
2149
+ /* The input value is 'NULL' to use the background and (otherwise) an sRGB
2150
+ * background color (to use a solid color). The code above uses a fixed
2151
+ * byte value, BUFFER_INIT8, for buffer even for 16-bit output. For
2152
+ * linear (16-bit) output the sRGB background color is ignored; the
2153
+ * composition is always on the background (so BUFFER_INIT8 * 257), except
2154
+ * that for the colormap (i.e. linear colormapped output) black is used.
2155
+ */
2156
+ result->background = &result->background_color;
2157
+
2158
+ if (out_format & PNG_FORMAT_FLAG_LINEAR || via_linear)
2159
+ {
2160
+ if (out_format & PNG_FORMAT_FLAG_COLORMAP)
2161
+ {
2162
+ result->background_color.ir =
2163
+ result->background_color.ig =
2164
+ result->background_color.ib = 0;
2165
+ result->background_color.dr =
2166
+ result->background_color.dg =
2167
+ result->background_color.db = 0;
2168
+ }
2169
+
2170
+ else
2171
+ {
2172
+ result->background_color.ir =
2173
+ result->background_color.ig =
2174
+ result->background_color.ib = BUFFER_INIT8 * 257;
2175
+ result->background_color.dr =
2176
+ result->background_color.dg =
2177
+ result->background_color.db = 0;
2178
+ }
2179
+ }
2180
+
2181
+ else /* sRGB output */
2182
+ {
2183
+ if (background != NULL)
2184
+ {
2185
+ if (out_format & PNG_FORMAT_FLAG_COLOR)
2186
+ {
2187
+ result->background_color.ir = background->red;
2188
+ result->background_color.ig = background->green;
2189
+ result->background_color.ib = background->blue;
2190
+ /* TODO: sometimes libpng uses the power law conversion here, how
2191
+ * to handle this?
2192
+ */
2193
+ result->background_color.dr = sRGB_to_d[background->red];
2194
+ result->background_color.dg = sRGB_to_d[background->green];
2195
+ result->background_color.db = sRGB_to_d[background->blue];
2196
+ }
2197
+
2198
+ else /* grayscale: libpng only looks at 'g' */
2199
+ {
2200
+ result->background_color.ir =
2201
+ result->background_color.ig =
2202
+ result->background_color.ib = background->green;
2203
+ /* TODO: sometimes libpng uses the power law conversion here, how
2204
+ * to handle this?
2205
+ */
2206
+ result->background_color.dr =
2207
+ result->background_color.dg =
2208
+ result->background_color.db = sRGB_to_d[background->green];
2209
+ }
2210
+ }
2211
+
2212
+ else if ((out_format & PNG_FORMAT_FLAG_COLORMAP) == 0)
2213
+ {
2214
+ result->background_color.ir =
2215
+ result->background_color.ig =
2216
+ result->background_color.ib = BUFFER_INIT8;
2217
+ /* TODO: sometimes libpng uses the power law conversion here, how
2218
+ * to handle this?
2219
+ */
2220
+ result->background_color.dr =
2221
+ result->background_color.dg =
2222
+ result->background_color.db = sRGB_to_d[BUFFER_INIT8];
2223
+ }
2224
+
2225
+ /* Else the output is colormapped and a background color must be
2226
+ * provided; if pngstest crashes then that is a bug in this program
2227
+ * (though libpng should png_error as well.)
2228
+ */
2229
+ else
2230
+ result->background = NULL;
2231
+ }
2232
+ }
2233
+
2234
+ if (result->background == NULL)
2235
+ {
2236
+ result->background_color.ir =
2237
+ result->background_color.ig =
2238
+ result->background_color.ib = -1; /* not used */
2239
+ result->background_color.dr =
2240
+ result->background_color.dg =
2241
+ result->background_color.db = 1E30; /* not used */
2242
+ }
2243
+
2244
+
2245
+ /* Copy the error values into the Transform: */
2246
+ result->error[0] = result->error_ptr[0];
2247
+ result->error[1] = result->error_ptr[1];
2248
+ result->error[2] = result->error_ptr[2];
2249
+ result->error[3] = result->error_ptr[3];
2250
+ }
2251
+
2252
+
2253
+ /* Compare two pixels.
2254
+ *
2255
+ * OLD error values:
2256
+ static int error_to_linear = 811; * by experiment *
2257
+ static int error_to_linear_grayscale = 424; * by experiment *
2258
+ static int error_to_sRGB = 6; * by experiment *
2259
+ static int error_to_sRGB_grayscale = 17; * libpng error by calculation +
2260
+ 2 by experiment *
2261
+ static int error_in_compose = 2; * by experiment *
2262
+ static int error_in_premultiply = 1;
2263
+ *
2264
+ * The following is *just* the result of a round trip from 8-bit sRGB to linear
2265
+ * then back to 8-bit sRGB when it is done by libpng. There are two problems:
2266
+ *
2267
+ * 1) libpng currently uses a 2.2 power law with no linear segment, this results
2268
+ * in instability in the low values and even with 16-bit precision sRGB(1) ends
2269
+ * up mapping to sRGB(0) as a result of rounding in the 16-bit representation.
2270
+ * This gives an error of 1 in the handling of value 1 only.
2271
+ *
2272
+ * 2) libpng currently uses an intermediate 8-bit linear value in gamma
2273
+ * correction of 8-bit values. This results in many more errors, the worse of
2274
+ * which is mapping sRGB(14) to sRGB(0).
2275
+ *
2276
+ * The general 'error_via_linear' is more complex because of pre-multiplication,
2277
+ * this compounds the 8-bit errors according to the alpha value of the pixel.
2278
+ * As a result 256 values are pre-calculated for error_via_linear.
2279
+ */
2280
+ #if 0
2281
+ static int error_in_libpng_gamma;
2282
+ static int error_via_linear[256]; /* Indexed by 8-bit alpha */
2283
+
2284
+ static void
2285
+ init_error_via_linear(void)
2286
+ {
2287
+ int alpha;
2288
+
2289
+ error_via_linear[0] = 255; /* transparent pixel */
2290
+
2291
+ for (alpha=1; alpha<=255; ++alpha)
2292
+ {
2293
+ /* 16-bit values less than 128.5 get rounded to 8-bit 0 and so the worst
2294
+ * case error arises with 16-bit 128.5, work out what sRGB
2295
+ * (non-associated) value generates 128.5; any value less than this is
2296
+ * going to map to 0, so the worst error is floor(value).
2297
+ *
2298
+ * Note that errors are considerably higher (more than a factor of 2)
2299
+ * because libpng uses a simple power law for sRGB data at present.
2300
+ *
2301
+ * Add .1 for arithmetic errors inside libpng.
2302
+ */
2303
+ double v = floor(255*pow(.5/*(128.5 * 255 / 65535)*/ / alpha, 1/2.2)+.1);
2304
+
2305
+ error_via_linear[alpha] = (int)v;
2306
+ }
2307
+
2308
+ /* This is actually 14.99, but, despite the closeness to 15, 14 seems to work
2309
+ * ok in this case.
2310
+ */
2311
+ error_in_libpng_gamma = 14;
2312
+ }
2313
+ #endif
2314
+
2315
+ static void
2316
+ print_pixel(char string[64], const Pixel *pixel, png_uint_32 format)
2317
+ {
2318
+ switch (format & (PNG_FORMAT_FLAG_ALPHA|PNG_FORMAT_FLAG_COLOR))
2319
+ {
2320
+ case 0:
2321
+ sprintf(string, "%s(%d)", format_names[format], pixel->g);
2322
+ break;
2323
+
2324
+ case PNG_FORMAT_FLAG_ALPHA:
2325
+ sprintf(string, "%s(%d,%d)", format_names[format], pixel->g,
2326
+ pixel->a);
2327
+ break;
2328
+
2329
+ case PNG_FORMAT_FLAG_COLOR:
2330
+ sprintf(string, "%s(%d,%d,%d)", format_names[format],
2331
+ pixel->r, pixel->g, pixel->b);
2332
+ break;
2333
+
2334
+ case PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA:
2335
+ sprintf(string, "%s(%d,%d,%d,%d)", format_names[format],
2336
+ pixel->r, pixel->g, pixel->b, pixel->a);
2337
+ break;
2338
+
2339
+ default:
2340
+ sprintf(string, "invalid-format");
2341
+ break;
2342
+ }
2343
+ }
2344
+
2345
+ static int
2346
+ logpixel(const Transform *transform, png_uint_32 x, png_uint_32 y,
2347
+ const Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
2348
+ {
2349
+ png_uint_32 in_format = transform->in_image->image.format;
2350
+ png_uint_32 out_format = transform->out_image->image.format;
2351
+
2352
+ png_uint_32 back_format = out_format & ~PNG_FORMAT_FLAG_ALPHA;
2353
+ const char *via_linear = "";
2354
+
2355
+ char pixel_in[64], pixel_calc[64], pixel_out[64], pixel_loc[64];
2356
+ char background_info[100];
2357
+
2358
+ print_pixel(pixel_in, in, in_format);
2359
+ print_pixel(pixel_calc, calc, out_format);
2360
+ print_pixel(pixel_out, out, out_format);
2361
+
2362
+ if (transform->is_palette)
2363
+ sprintf(pixel_loc, "palette: %lu", (unsigned long)y);
2364
+ else
2365
+ sprintf(pixel_loc, "%lu,%lu", (unsigned long)x, (unsigned long)y);
2366
+
2367
+ if (transform->from_linear != NULL)
2368
+ {
2369
+ via_linear = " (via linear)";
2370
+ /* And as a result the *read* format which did any background processing
2371
+ * was itself linear, so the background color information is also
2372
+ * linear.
2373
+ */
2374
+ back_format |= PNG_FORMAT_FLAG_LINEAR;
2375
+ }
2376
+
2377
+ if (transform->background != NULL)
2378
+ {
2379
+ Pixel back;
2380
+ char pixel_back[64];
2381
+
2382
+ back.r = transform->background->ir;
2383
+ back.g = transform->background->ig;
2384
+ back.b = transform->background->ib;
2385
+ back.a = -1; /* not used */
2386
+
2387
+ print_pixel(pixel_back, &back, back_format);
2388
+ sprintf(background_info, " on background %s", pixel_back);
2389
+ }
2390
+
2391
+ else
2392
+ background_info[0] = 0;
2393
+
2394
+ if (transform->in_image->file_name != transform->out_image->file_name)
2395
+ {
2396
+ char error_buffer[512];
2397
+ sprintf(error_buffer,
2398
+ "(%s) %s error%s:\n %s%s ->\n %s\n not: %s.\n"
2399
+ "Use --preserve and examine: ", pixel_loc, reason, via_linear,
2400
+ pixel_in, background_info, pixel_out, pixel_calc);
2401
+ return logerror(transform->in_image, transform->in_image->file_name,
2402
+ error_buffer, transform->out_image->file_name);
2403
+ }
2404
+
2405
+ else
2406
+ {
2407
+ char error_buffer[512];
2408
+ sprintf(error_buffer,
2409
+ "(%s) %s error%s:\n %s%s ->\n %s\n not: %s.\n"
2410
+ " The error happened when reading the original file with this format.",
2411
+ pixel_loc, reason, via_linear, pixel_in, background_info, pixel_out,
2412
+ pixel_calc);
2413
+ return logerror(transform->in_image, transform->in_image->file_name,
2414
+ error_buffer, "");
2415
+ }
2416
+ }
2417
+
2418
+ static int
2419
+ cmppixel(Transform *transform, png_const_voidp in, png_const_voidp out,
2420
+ png_uint_32 x, png_uint_32 y/*or palette index*/)
2421
+ {
2422
+ int maxerr;
2423
+ png_const_charp errmsg;
2424
+ Pixel pixel_in, pixel_calc, pixel_out;
2425
+
2426
+ transform->in_gp(&pixel_in, in);
2427
+
2428
+ if (transform->from_linear == NULL)
2429
+ transform->transform(&pixel_calc, &pixel_in, transform->background);
2430
+
2431
+ else
2432
+ {
2433
+ transform->transform(&pixel_out, &pixel_in, transform->background);
2434
+ transform->from_linear(&pixel_calc, &pixel_out, NULL);
2435
+ }
2436
+
2437
+ transform->out_gp(&pixel_out, out);
2438
+
2439
+ /* Eliminate the case where the input and output values match exactly. */
2440
+ if (pixel_calc.a == pixel_out.a && pixel_calc.r == pixel_out.r &&
2441
+ pixel_calc.g == pixel_out.g && pixel_calc.b == pixel_out.b)
2442
+ return 1;
2443
+
2444
+ /* Eliminate the case where the output pixel is transparent and the output
2445
+ * is 8-bit - any component values are valid. Don't check the input alpha
2446
+ * here to also skip the 16-bit small alpha cases.
2447
+ */
2448
+ if (transform->output_8bit && pixel_calc.a == 0 && pixel_out.a == 0)
2449
+ return 1;
2450
+
2451
+ /* Check for alpha errors first; an alpha error can damage the components too
2452
+ * so avoid spurious checks on components if one is found.
2453
+ */
2454
+ errmsg = NULL;
2455
+ {
2456
+ int err_a = abs(pixel_calc.a-pixel_out.a);
2457
+
2458
+ if (err_a > transform->error[3])
2459
+ {
2460
+ /* If accumulating check the components too */
2461
+ if (transform->accumulate)
2462
+ transform->error[3] = (png_uint_16)err_a;
2463
+
2464
+ else
2465
+ errmsg = "alpha";
2466
+ }
2467
+ }
2468
+
2469
+ /* Now if *either* of the output alphas are 0 but alpha is within tolerance
2470
+ * eliminate the 8-bit component comparison.
2471
+ */
2472
+ if (errmsg == NULL && transform->output_8bit &&
2473
+ (pixel_calc.a == 0 || pixel_out.a == 0))
2474
+ return 1;
2475
+
2476
+ if (errmsg == NULL) /* else just signal an alpha error */
2477
+ {
2478
+ int err_r = abs(pixel_calc.r - pixel_out.r);
2479
+ int err_g = abs(pixel_calc.g - pixel_out.g);
2480
+ int err_b = abs(pixel_calc.b - pixel_out.b);
2481
+ int limit;
2482
+
2483
+ if ((err_r | err_g | err_b) == 0)
2484
+ return 1; /* exact match */
2485
+
2486
+ /* Mismatch on a component, check the input alpha */
2487
+ if (pixel_in.a >= transform->in_opaque)
2488
+ {
2489
+ errmsg = "opaque component";
2490
+ limit = 2; /* opaque */
2491
+ }
2492
+
2493
+ else if (pixel_in.a > 0)
2494
+ {
2495
+ errmsg = "alpha component";
2496
+ limit = 1; /* partially transparent */
2497
+ }
2498
+
2499
+ else
2500
+ {
2501
+ errmsg = "transparent component (background)";
2502
+ limit = 0; /* transparent */
2503
+ }
2504
+
2505
+ maxerr = err_r;
2506
+ if (maxerr < err_g) maxerr = err_g;
2507
+ if (maxerr < err_b) maxerr = err_b;
2508
+
2509
+ if (maxerr <= transform->error[limit])
2510
+ return 1; /* within the error limits */
2511
+
2512
+ /* Handle a component mis-match; log it, just return an error code, or
2513
+ * accumulate it.
2514
+ */
2515
+ if (transform->accumulate)
2516
+ {
2517
+ transform->error[limit] = (png_uint_16)maxerr;
2518
+ return 1; /* to cause the caller to keep going */
2519
+ }
2520
+ }
2521
+
2522
+ /* Failure to match and not accumulating, so the error must be logged. */
2523
+ return logpixel(transform, x, y, &pixel_in, &pixel_calc, &pixel_out, errmsg);
2524
+ }
2525
+
2526
+ static png_byte
2527
+ component_loc(png_byte loc[4], png_uint_32 format)
2528
+ {
2529
+ /* Given a format return the number of channels and the location of
2530
+ * each channel.
2531
+ *
2532
+ * The mask 'loc' contains the component offset of the channels in the
2533
+ * following order. Note that if 'format' is grayscale the entries 1-3 must
2534
+ * all contain the location of the gray channel.
2535
+ *
2536
+ * 0: alpha
2537
+ * 1: red or gray
2538
+ * 2: green or gray
2539
+ * 3: blue or gray
2540
+ */
2541
+ png_byte channels;
2542
+
2543
+ if (format & PNG_FORMAT_FLAG_COLOR)
2544
+ {
2545
+ channels = 3;
2546
+
2547
+ loc[2] = 1;
2548
+
2549
+ # ifdef PNG_FORMAT_BGR_SUPPORTED
2550
+ if (format & PNG_FORMAT_FLAG_BGR)
2551
+ {
2552
+ loc[1] = 2;
2553
+ loc[3] = 0;
2554
+ }
2555
+
2556
+ else
2557
+ # endif
2558
+ {
2559
+ loc[1] = 0;
2560
+ loc[3] = 2;
2561
+ }
2562
+ }
2563
+
2564
+ else
2565
+ {
2566
+ channels = 1;
2567
+ loc[1] = loc[2] = loc[3] = 0;
2568
+ }
2569
+
2570
+ if (format & PNG_FORMAT_FLAG_ALPHA)
2571
+ {
2572
+ # ifdef PNG_FORMAT_AFIRST_SUPPORTED
2573
+ if (format & PNG_FORMAT_FLAG_AFIRST)
2574
+ {
2575
+ loc[0] = 0;
2576
+ ++loc[1];
2577
+ ++loc[2];
2578
+ ++loc[3];
2579
+ }
2580
+
2581
+ else
2582
+ # endif
2583
+ loc[0] = channels;
2584
+
2585
+ ++channels;
2586
+ }
2587
+
2588
+ else
2589
+ loc[0] = 4; /* not present */
2590
+
2591
+ return channels;
2592
+ }
2593
+
2594
+ /* Compare two images, the original 'a', which was written out then read back in
2595
+ * to * give image 'b'. The formats may have been changed.
2596
+ */
2597
+ static int
2598
+ compare_two_images(Image *a, Image *b, int via_linear,
2599
+ png_const_colorp background)
2600
+ {
2601
+ ptrdiff_t stridea = a->stride;
2602
+ ptrdiff_t strideb = b->stride;
2603
+ png_const_bytep rowa = a->buffer+16;
2604
+ png_const_bytep rowb = b->buffer+16;
2605
+ png_uint_32 width = a->image.width;
2606
+ png_uint_32 height = a->image.height;
2607
+ png_uint_32 formata = a->image.format;
2608
+ png_uint_32 formatb = b->image.format;
2609
+ unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
2610
+ unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
2611
+ int alpha_added, alpha_removed;
2612
+ int bchannels;
2613
+ png_uint_32 y;
2614
+ Transform tr;
2615
+ int btoa[4]={0,0,0,0};
2616
+
2617
+ /* This should never happen: */
2618
+ if (width != b->image.width || height != b->image.height)
2619
+ return logerror(a, a->file_name, ": width x height changed: ",
2620
+ b->file_name);
2621
+
2622
+ /* Set up the background and the transform */
2623
+ transform_from_formats(&tr, a, b, background, via_linear);
2624
+
2625
+ /* Find the first row and inter-row space. */
2626
+ if (!(formata & PNG_FORMAT_FLAG_COLORMAP) &&
2627
+ (formata & PNG_FORMAT_FLAG_LINEAR))
2628
+ stridea *= 2;
2629
+
2630
+ if (!(formatb & PNG_FORMAT_FLAG_COLORMAP) &&
2631
+ (formatb & PNG_FORMAT_FLAG_LINEAR))
2632
+ strideb *= 2;
2633
+
2634
+ if (stridea < 0) rowa += (height-1) * (-stridea);
2635
+ if (strideb < 0) rowb += (height-1) * (-strideb);
2636
+
2637
+ /* First shortcut the two colormap case by comparing the image data; if it
2638
+ * matches then we expect the colormaps to match, although this is not
2639
+ * absolutely necessary for an image match. If the colormaps fail to match
2640
+ * then there is a problem in libpng.
2641
+ */
2642
+ if (formata & formatb & PNG_FORMAT_FLAG_COLORMAP)
2643
+ {
2644
+ /* Only check colormap entries that actually exist; */
2645
+ png_const_bytep ppa, ppb;
2646
+ int match;
2647
+ png_byte in_use[256], amax = 0, bmax = 0;
2648
+
2649
+ memset(in_use, 0, sizeof in_use);
2650
+
2651
+ ppa = rowa;
2652
+ ppb = rowb;
2653
+
2654
+ /* Do this the slow way to accumulate the 'in_use' flags, don't break out
2655
+ * of the loop until the end; this validates the color-mapped data to
2656
+ * ensure all pixels are valid color-map indexes.
2657
+ */
2658
+ for (y=0, match=1; y<height && match; ++y, ppa += stridea, ppb += strideb)
2659
+ {
2660
+ png_uint_32 x;
2661
+
2662
+ for (x=0; x<width; ++x)
2663
+ {
2664
+ png_byte bval = ppb[x];
2665
+ png_byte aval = ppa[x];
2666
+
2667
+ if (bval > bmax)
2668
+ bmax = bval;
2669
+
2670
+ if (bval != aval)
2671
+ match = 0;
2672
+
2673
+ in_use[aval] = 1;
2674
+ if (aval > amax)
2675
+ amax = aval;
2676
+ }
2677
+ }
2678
+
2679
+ /* If the buffers match then the colormaps must too. */
2680
+ if (match)
2681
+ {
2682
+ /* Do the color-maps match, entry by entry? Only check the 'in_use'
2683
+ * entries. An error here should be logged as a color-map error.
2684
+ */
2685
+ png_const_bytep a_cmap = (png_const_bytep)a->colormap;
2686
+ png_const_bytep b_cmap = (png_const_bytep)b->colormap;
2687
+ int result = 1; /* match by default */
2688
+
2689
+ /* This is used in logpixel to get the error message correct. */
2690
+ tr.is_palette = 1;
2691
+
2692
+ for (y=0; y<256; ++y, a_cmap += a_sample, b_cmap += b_sample)
2693
+ if (in_use[y])
2694
+ {
2695
+ /* The colormap entries should be valid, but because libpng doesn't
2696
+ * do any checking at present the original image may contain invalid
2697
+ * pixel values. These cause an error here (at present) unless
2698
+ * accumulating errors in which case the program just ignores them.
2699
+ */
2700
+ if (y >= a->image.colormap_entries)
2701
+ {
2702
+ if ((a->opts & ACCUMULATE) == 0)
2703
+ {
2704
+ char pindex[9];
2705
+ sprintf(pindex, "%lu[%lu]", (unsigned long)y,
2706
+ (unsigned long)a->image.colormap_entries);
2707
+ logerror(a, a->file_name, ": bad pixel index: ", pindex);
2708
+ }
2709
+ result = 0;
2710
+ }
2711
+
2712
+ else if (y >= b->image.colormap_entries)
2713
+ {
2714
+ if ((b->opts & ACCUMULATE) == 0)
2715
+ {
2716
+ char pindex[9];
2717
+ sprintf(pindex, "%lu[%lu]", (unsigned long)y,
2718
+ (unsigned long)b->image.colormap_entries);
2719
+ logerror(b, b->file_name, ": bad pixel index: ", pindex);
2720
+ }
2721
+ result = 0;
2722
+ }
2723
+
2724
+ /* All the mismatches are logged here; there can only be 256! */
2725
+ else if (!cmppixel(&tr, a_cmap, b_cmap, 0, y))
2726
+ result = 0;
2727
+ }
2728
+
2729
+ /* If requested, copy the error values back from the Transform. */
2730
+ if (a->opts & ACCUMULATE)
2731
+ {
2732
+ tr.error_ptr[0] = tr.error[0];
2733
+ tr.error_ptr[1] = tr.error[1];
2734
+ tr.error_ptr[2] = tr.error[2];
2735
+ tr.error_ptr[3] = tr.error[3];
2736
+ result = 1; /* force a continue */
2737
+ }
2738
+
2739
+ return result;
2740
+ }
2741
+
2742
+ /* else the image buffers don't match pixel-wise so compare sample values
2743
+ * instead, but first validate that the pixel indexes are in range (but
2744
+ * only if not accumulating, when the error is ignored.)
2745
+ */
2746
+ else if ((a->opts & ACCUMULATE) == 0)
2747
+ {
2748
+ # ifdef __GNUC__
2749
+ # define BYTE_CHARS 20 /* 2^32: GCC sprintf warning */
2750
+ # else
2751
+ # define BYTE_CHARS 3 /* 2^8: real maximum value */
2752
+ # endif
2753
+ /* Check the original image first,
2754
+ * TODO: deal with input images with bad pixel values?
2755
+ */
2756
+ if (amax >= a->image.colormap_entries)
2757
+ {
2758
+ char pindex[3+2*BYTE_CHARS];
2759
+ sprintf(pindex, "%d[%u]", amax,
2760
+ (png_byte)/*SAFE*/a->image.colormap_entries);
2761
+ return logerror(a, a->file_name, ": bad pixel index: ", pindex);
2762
+ }
2763
+
2764
+ else if (bmax >= b->image.colormap_entries)
2765
+ {
2766
+ char pindex[3+2*BYTE_CHARS];
2767
+ sprintf(pindex, "%d[%u]", bmax,
2768
+ (png_byte)/*SAFE*/b->image.colormap_entries);
2769
+ return logerror(b, b->file_name, ": bad pixel index: ", pindex);
2770
+ }
2771
+ }
2772
+ }
2773
+
2774
+ /* We can directly compare pixel values without the need to use the read
2775
+ * or transform support (i.e. a memory compare) if:
2776
+ *
2777
+ * 1) The bit depth has not changed.
2778
+ * 2) RGB to grayscale has not been done (the reverse is ok; we just compare
2779
+ * the three RGB values to the original grayscale.)
2780
+ * 3) An alpha channel has not been removed from an 8-bit format, or the
2781
+ * 8-bit alpha value of the pixel was 255 (opaque).
2782
+ *
2783
+ * If an alpha channel has been *added* then it must have the relevant opaque
2784
+ * value (255 or 65535).
2785
+ *
2786
+ * The fist two the tests (in the order given above) (using the boolean
2787
+ * equivalence !a && !b == !(a || b))
2788
+ */
2789
+ if (!(((formata ^ formatb) & PNG_FORMAT_FLAG_LINEAR) |
2790
+ (formata & (formatb ^ PNG_FORMAT_FLAG_COLOR) & PNG_FORMAT_FLAG_COLOR)))
2791
+ {
2792
+ /* Was an alpha channel changed? */
2793
+ png_uint_32 alpha_changed = (formata ^ formatb) & PNG_FORMAT_FLAG_ALPHA;
2794
+
2795
+ /* Was an alpha channel removed? (The third test.) If so the direct
2796
+ * comparison is only possible if the input alpha is opaque.
2797
+ */
2798
+ alpha_removed = (formata & alpha_changed) != 0;
2799
+
2800
+ /* Was an alpha channel added? */
2801
+ alpha_added = (formatb & alpha_changed) != 0;
2802
+
2803
+ /* The channels may have been moved between input and output, this finds
2804
+ * out how, recording the result in the btoa array, which says where in
2805
+ * 'a' to find each channel of 'b'. If alpha was added then btoa[alpha]
2806
+ * ends up as 4 (and is not used.)
2807
+ */
2808
+ {
2809
+ int i;
2810
+ png_byte aloc[4];
2811
+ png_byte bloc[4];
2812
+
2813
+ /* The following are used only if the formats match, except that
2814
+ * 'bchannels' is a flag for matching formats. btoa[x] says, for each
2815
+ * channel in b, where to find the corresponding value in a, for the
2816
+ * bchannels. achannels may be different for a gray to rgb transform
2817
+ * (a will be 1 or 2, b will be 3 or 4 channels.)
2818
+ */
2819
+ (void)component_loc(aloc, formata);
2820
+ bchannels = component_loc(bloc, formatb);
2821
+
2822
+ /* Hence the btoa array. */
2823
+ for (i=0; i<4; ++i) if (bloc[i] < 4)
2824
+ btoa[bloc[i]] = aloc[i]; /* may be '4' for alpha */
2825
+
2826
+ if (alpha_added)
2827
+ alpha_added = bloc[0]; /* location of alpha channel in image b */
2828
+
2829
+ else
2830
+ alpha_added = 4; /* Won't match an image b channel */
2831
+
2832
+ if (alpha_removed)
2833
+ alpha_removed = aloc[0]; /* location of alpha channel in image a */
2834
+
2835
+ else
2836
+ alpha_removed = 4;
2837
+ }
2838
+ }
2839
+
2840
+ else
2841
+ {
2842
+ /* Direct compare is not possible, cancel out all the corresponding local
2843
+ * variables.
2844
+ */
2845
+ bchannels = 0;
2846
+ alpha_removed = alpha_added = 4;
2847
+ btoa[3] = btoa[2] = btoa[1] = btoa[0] = 4; /* 4 == not present */
2848
+ }
2849
+
2850
+ for (y=0; y<height; ++y, rowa += stridea, rowb += strideb)
2851
+ {
2852
+ png_const_bytep ppa, ppb;
2853
+ png_uint_32 x;
2854
+
2855
+ for (x=0, ppa=rowa, ppb=rowb; x<width; ++x)
2856
+ {
2857
+ png_const_bytep psa, psb;
2858
+
2859
+ if (formata & PNG_FORMAT_FLAG_COLORMAP)
2860
+ psa = (png_const_bytep)a->colormap + a_sample * *ppa++;
2861
+ else
2862
+ psa = ppa, ppa += a_sample;
2863
+
2864
+ if (formatb & PNG_FORMAT_FLAG_COLORMAP)
2865
+ psb = (png_const_bytep)b->colormap + b_sample * *ppb++;
2866
+ else
2867
+ psb = ppb, ppb += b_sample;
2868
+
2869
+ /* Do the fast test if possible. */
2870
+ if (bchannels)
2871
+ {
2872
+ /* Check each 'b' channel against either the corresponding 'a'
2873
+ * channel or the opaque alpha value, as appropriate. If
2874
+ * alpha_removed value is set (not 4) then also do this only if the
2875
+ * 'a' alpha channel (alpha_removed) is opaque; only relevant for
2876
+ * the 8-bit case.
2877
+ */
2878
+ if (formatb & PNG_FORMAT_FLAG_LINEAR) /* 16-bit checks */
2879
+ {
2880
+ png_const_uint_16p pua = aligncastconst(png_const_uint_16p, psa);
2881
+ png_const_uint_16p pub = aligncastconst(png_const_uint_16p, psb);
2882
+
2883
+ switch (bchannels)
2884
+ {
2885
+ case 4:
2886
+ if (pua[btoa[3]] != pub[3]) break;
2887
+ /* FALLTHROUGH */
2888
+ case 3:
2889
+ if (pua[btoa[2]] != pub[2]) break;
2890
+ /* FALLTHROUGH */
2891
+ case 2:
2892
+ if (pua[btoa[1]] != pub[1]) break;
2893
+ /* FALLTHROUGH */
2894
+ case 1:
2895
+ if (pua[btoa[0]] != pub[0]) break;
2896
+ if (alpha_added != 4 && pub[alpha_added] != 65535) break;
2897
+ continue; /* x loop */
2898
+ default:
2899
+ break; /* impossible */
2900
+ }
2901
+ }
2902
+
2903
+ else if (alpha_removed == 4 || psa[alpha_removed] == 255)
2904
+ {
2905
+ switch (bchannels)
2906
+ {
2907
+ case 4:
2908
+ if (psa[btoa[3]] != psb[3]) break;
2909
+ /* FALLTHROUGH */
2910
+ case 3:
2911
+ if (psa[btoa[2]] != psb[2]) break;
2912
+ /* FALLTHROUGH */
2913
+ case 2:
2914
+ if (psa[btoa[1]] != psb[1]) break;
2915
+ /* FALLTHROUGH */
2916
+ case 1:
2917
+ if (psa[btoa[0]] != psb[0]) break;
2918
+ if (alpha_added != 4 && psb[alpha_added] != 255) break;
2919
+ continue; /* x loop */
2920
+ default:
2921
+ break; /* impossible */
2922
+ }
2923
+ }
2924
+ }
2925
+
2926
+ /* If we get to here the fast match failed; do the slow match for this
2927
+ * pixel.
2928
+ */
2929
+ if (!cmppixel(&tr, psa, psb, x, y) && (a->opts & KEEP_GOING) == 0)
2930
+ return 0; /* error case */
2931
+ }
2932
+ }
2933
+
2934
+ /* If requested, copy the error values back from the Transform. */
2935
+ if (a->opts & ACCUMULATE)
2936
+ {
2937
+ tr.error_ptr[0] = tr.error[0];
2938
+ tr.error_ptr[1] = tr.error[1];
2939
+ tr.error_ptr[2] = tr.error[2];
2940
+ tr.error_ptr[3] = tr.error[3];
2941
+ }
2942
+
2943
+ return 1;
2944
+ }
2945
+
2946
+ /* Read the file; how the read gets done depends on which of input_file and
2947
+ * input_memory have been set.
2948
+ */
2949
+ static int
2950
+ read_file(Image *image, png_uint_32 format, png_const_colorp background)
2951
+ {
2952
+ memset(&image->image, 0, sizeof image->image);
2953
+ image->image.version = PNG_IMAGE_VERSION;
2954
+
2955
+ if (image->input_memory != NULL)
2956
+ {
2957
+ if (!png_image_begin_read_from_memory(&image->image, image->input_memory,
2958
+ image->input_memory_size))
2959
+ return logerror(image, "memory init: ", image->file_name, "");
2960
+ }
2961
+
2962
+ # ifdef PNG_STDIO_SUPPORTED
2963
+ else if (image->input_file != NULL)
2964
+ {
2965
+ if (!png_image_begin_read_from_stdio(&image->image, image->input_file))
2966
+ return logerror(image, "stdio init: ", image->file_name, "");
2967
+ }
2968
+
2969
+ else
2970
+ {
2971
+ if (!png_image_begin_read_from_file(&image->image, image->file_name))
2972
+ return logerror(image, "file init: ", image->file_name, "");
2973
+ }
2974
+ # else
2975
+ else
2976
+ {
2977
+ return logerror(image, "unsupported file/stdio init: ",
2978
+ image->file_name, "");
2979
+ }
2980
+ # endif
2981
+
2982
+ /* This must be set after the begin_read call: */
2983
+ if (image->opts & sRGB_16BIT)
2984
+ image->image.flags |= PNG_IMAGE_FLAG_16BIT_sRGB;
2985
+
2986
+ /* Have an initialized image with all the data we need plus, maybe, an
2987
+ * allocated file (myfile) or buffer (mybuffer) that need to be freed.
2988
+ */
2989
+ {
2990
+ int result;
2991
+ png_uint_32 image_format;
2992
+
2993
+ /* Print both original and output formats. */
2994
+ image_format = image->image.format;
2995
+
2996
+ if (image->opts & VERBOSE)
2997
+ {
2998
+ printf("%s %lu x %lu %s -> %s", image->file_name,
2999
+ (unsigned long)image->image.width,
3000
+ (unsigned long)image->image.height,
3001
+ format_names[image_format & FORMAT_MASK],
3002
+ (format & FORMAT_NO_CHANGE) != 0 || image->image.format == format
3003
+ ? "no change" : format_names[format & FORMAT_MASK]);
3004
+
3005
+ if (background != NULL)
3006
+ printf(" background(%d,%d,%d)\n", background->red,
3007
+ background->green, background->blue);
3008
+ else
3009
+ printf("\n");
3010
+
3011
+ fflush(stdout);
3012
+ }
3013
+
3014
+ /* 'NO_CHANGE' combined with the color-map flag forces the base format
3015
+ * flags to be set on read to ensure that the original representation is
3016
+ * not lost in the pass through a colormap format.
3017
+ */
3018
+ if ((format & FORMAT_NO_CHANGE) != 0)
3019
+ {
3020
+ if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0 &&
3021
+ (image_format & PNG_FORMAT_FLAG_COLORMAP) != 0)
3022
+ format = (image_format & ~BASE_FORMATS) | (format & BASE_FORMATS);
3023
+
3024
+ else
3025
+ format = image_format;
3026
+ }
3027
+
3028
+ image->image.format = format;
3029
+
3030
+ image->stride = PNG_IMAGE_ROW_STRIDE(image->image) + image->stride_extra;
3031
+ allocbuffer(image);
3032
+
3033
+ result = png_image_finish_read(&image->image, background,
3034
+ image->buffer+16, (png_int_32)image->stride, image->colormap);
3035
+
3036
+ checkbuffer(image, image->file_name);
3037
+
3038
+ if (result)
3039
+ return checkopaque(image);
3040
+
3041
+ else
3042
+ return logerror(image, image->file_name, ": image read failed", "");
3043
+ }
3044
+ }
3045
+
3046
+ /* Reads from a filename, which must be in image->file_name, but uses
3047
+ * image->opts to choose the method. The file is always read in its native
3048
+ * format (the one the simplified API suggests).
3049
+ */
3050
+ static int
3051
+ read_one_file(Image *image)
3052
+ {
3053
+ if (!(image->opts & USE_FILE) || (image->opts & USE_STDIO))
3054
+ {
3055
+ /* memory or stdio. */
3056
+ FILE *f = fopen(image->file_name, "rb");
3057
+
3058
+ if (f != NULL)
3059
+ {
3060
+ if (image->opts & USE_FILE)
3061
+ image->input_file = f;
3062
+
3063
+ else /* memory */
3064
+ {
3065
+ if (fseek(f, 0, SEEK_END) == 0)
3066
+ {
3067
+ long int cb = ftell(f);
3068
+
3069
+ if (cb > 0)
3070
+ {
3071
+ #ifndef __COVERITY__
3072
+ if ((unsigned long int)cb <= (size_t)~(size_t)0)
3073
+ #endif
3074
+ {
3075
+ png_bytep b = voidcast(png_bytep, malloc((size_t)cb));
3076
+
3077
+ if (b != NULL)
3078
+ {
3079
+ rewind(f);
3080
+
3081
+ if (fread(b, (size_t)cb, 1, f) == 1)
3082
+ {
3083
+ fclose(f);
3084
+ image->input_memory_size = cb;
3085
+ image->input_memory = b;
3086
+ }
3087
+
3088
+ else
3089
+ {
3090
+ free(b);
3091
+ return logclose(image, f, image->file_name,
3092
+ ": read failed: ");
3093
+ }
3094
+ }
3095
+
3096
+ else
3097
+ return logclose(image, f, image->file_name,
3098
+ ": out of memory: ");
3099
+ }
3100
+
3101
+ else
3102
+ return logclose(image, f, image->file_name,
3103
+ ": file too big for this architecture: ");
3104
+ /* cb is the length of the file as a (long) and
3105
+ * this is greater than the maximum amount of
3106
+ * memory that can be requested from malloc.
3107
+ */
3108
+ }
3109
+
3110
+ else if (cb == 0)
3111
+ return logclose(image, f, image->file_name,
3112
+ ": zero length: ");
3113
+
3114
+ else
3115
+ return logclose(image, f, image->file_name,
3116
+ ": tell failed: ");
3117
+ }
3118
+
3119
+ else
3120
+ return logclose(image, f, image->file_name, ": seek failed: ");
3121
+ }
3122
+ }
3123
+
3124
+ else
3125
+ return logerror(image, image->file_name, ": open failed: ",
3126
+ strerror(errno));
3127
+ }
3128
+
3129
+ return read_file(image, FORMAT_NO_CHANGE, NULL);
3130
+ }
3131
+
3132
+ #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
3133
+ static int
3134
+ write_one_file(Image *output, Image *image, int convert_to_8bit)
3135
+ {
3136
+ if (image->opts & FAST_WRITE)
3137
+ image->image.flags |= PNG_IMAGE_FLAG_FAST;
3138
+
3139
+ if (image->opts & USE_STDIO)
3140
+ {
3141
+ #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
3142
+ #ifndef __COVERITY__
3143
+ FILE *f = tmpfile();
3144
+ #else
3145
+ /* Experimental. Coverity says tmpfile() is insecure because it
3146
+ * generates predictable names.
3147
+ *
3148
+ * It is possible to satisfy Coverity by using mkstemp(); however,
3149
+ * any platform supporting mkstemp() undoubtedly has a secure tmpfile()
3150
+ * implementation as well, and doesn't need the fix. Note that
3151
+ * the fix won't work on platforms that don't support mkstemp().
3152
+ *
3153
+ * https://www.securecoding.cert.org/confluence/display/c/
3154
+ * FIO21-C.+Do+not+create+temporary+files+in+shared+directories
3155
+ * says that most historic implementations of tmpfile() provide
3156
+ * only a limited number of possible temporary file names
3157
+ * (usually 26) before file names are recycled. That article also
3158
+ * provides a secure solution that unfortunately depends upon mkstemp().
3159
+ */
3160
+ char tmpfile[] = "pngstest-XXXXXX";
3161
+ int filedes;
3162
+ FILE *f;
3163
+ umask(0177);
3164
+ filedes = mkstemp(tmpfile);
3165
+ if (filedes < 0)
3166
+ f = NULL;
3167
+ else
3168
+ {
3169
+ f = fdopen(filedes,"w+");
3170
+ /* Hide the filename immediately and ensure that the file does
3171
+ * not exist after the program ends
3172
+ */
3173
+ (void) unlink(tmpfile);
3174
+ }
3175
+ #endif
3176
+
3177
+ if (f != NULL)
3178
+ {
3179
+ if (png_image_write_to_stdio(&image->image, f, convert_to_8bit,
3180
+ image->buffer+16, (png_int_32)image->stride, image->colormap))
3181
+ {
3182
+ if (fflush(f) == 0)
3183
+ {
3184
+ rewind(f);
3185
+ initimage(output, image->opts, "tmpfile", image->stride_extra);
3186
+ output->input_file = f;
3187
+ if (!checkopaque(image))
3188
+ return 0;
3189
+ }
3190
+
3191
+ else
3192
+ return logclose(image, f, "tmpfile", ": flush: ");
3193
+ }
3194
+
3195
+ else
3196
+ {
3197
+ fclose(f);
3198
+ return logerror(image, "tmpfile", ": write failed", "");
3199
+ }
3200
+ }
3201
+
3202
+ else
3203
+ return logerror(image, "tmpfile", ": open: ", strerror(errno));
3204
+ #else /* SIMPLIFIED_WRITE_STDIO */
3205
+ return logerror(image, "tmpfile", ": open: unsupported", "");
3206
+ #endif /* SIMPLIFIED_WRITE_STDIO */
3207
+ }
3208
+
3209
+ else if (image->opts & USE_FILE)
3210
+ {
3211
+ #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
3212
+ static int counter = 0;
3213
+ char name[32];
3214
+
3215
+ sprintf(name, "%s%d.png", tmpf, ++counter);
3216
+
3217
+ if (png_image_write_to_file(&image->image, name, convert_to_8bit,
3218
+ image->buffer+16, (png_int_32)image->stride, image->colormap))
3219
+ {
3220
+ initimage(output, image->opts, output->tmpfile_name,
3221
+ image->stride_extra);
3222
+ /* Afterwards, or freeimage will delete it! */
3223
+ strcpy(output->tmpfile_name, name);
3224
+
3225
+ if (!checkopaque(image))
3226
+ return 0;
3227
+ }
3228
+
3229
+ else
3230
+ return logerror(image, name, ": write failed", "");
3231
+ #else /* SIMPLIFIED_WRITE_STDIO */
3232
+ return logerror(image, "stdio", ": open: unsupported", "");
3233
+ #endif /* SIMPLIFIED_WRITE_STDIO */
3234
+ }
3235
+
3236
+ else /* use memory */
3237
+ {
3238
+ png_alloc_size_t size;
3239
+
3240
+ if (png_image_write_get_memory_size(image->image, size, convert_to_8bit,
3241
+ image->buffer+16, (png_int_32)image->stride, image->colormap))
3242
+ {
3243
+ /* This is non-fatal but ignoring it was causing serious problems in
3244
+ * the macro to be ignored:
3245
+ */
3246
+ if (size > PNG_IMAGE_PNG_SIZE_MAX(image->image))
3247
+ return logerror(image, "memory", ": PNG_IMAGE_SIZE_MAX wrong", "");
3248
+
3249
+ initimage(output, image->opts, "memory", image->stride_extra);
3250
+ output->input_memory = malloc(size);
3251
+
3252
+ if (output->input_memory != NULL)
3253
+ {
3254
+ output->input_memory_size = size;
3255
+
3256
+ if (png_image_write_to_memory(&image->image, output->input_memory,
3257
+ &output->input_memory_size, convert_to_8bit, image->buffer+16,
3258
+ (png_int_32)image->stride, image->colormap))
3259
+ {
3260
+ /* This is also non-fatal but it safes safer to error out anyway:
3261
+ */
3262
+ if (size != output->input_memory_size)
3263
+ return logerror(image, "memory", ": memory size wrong", "");
3264
+ }
3265
+
3266
+ else
3267
+ return logerror(image, "memory", ": write failed", "");
3268
+ }
3269
+
3270
+ else
3271
+ return logerror(image, "memory", ": out of memory", "");
3272
+ }
3273
+
3274
+ else
3275
+ return logerror(image, "memory", ": get size:", "");
3276
+ }
3277
+
3278
+ /* 'output' has an initialized temporary image, read this back in and compare
3279
+ * this against the original: there should be no change since the original
3280
+ * format was written unmodified unless 'convert_to_8bit' was specified.
3281
+ * However, if the original image was color-mapped, a simple read will zap
3282
+ * the linear, color and maybe alpha flags, this will cause spurious failures
3283
+ * under some circumstances.
3284
+ */
3285
+ if (read_file(output, image->image.format | FORMAT_NO_CHANGE, NULL))
3286
+ {
3287
+ png_uint_32 original_format = image->image.format;
3288
+
3289
+ if (convert_to_8bit)
3290
+ original_format &= ~PNG_FORMAT_FLAG_LINEAR;
3291
+
3292
+ if ((output->image.format & BASE_FORMATS) !=
3293
+ (original_format & BASE_FORMATS))
3294
+ return logerror(image, image->file_name, ": format changed on read: ",
3295
+ output->file_name);
3296
+
3297
+ return compare_two_images(image, output, 0/*via linear*/, NULL);
3298
+ }
3299
+
3300
+ else
3301
+ return logerror(output, output->tmpfile_name,
3302
+ ": read of new file failed", "");
3303
+ }
3304
+ #endif
3305
+
3306
+ static int
3307
+ testimage(Image *image, png_uint_32 opts, format_list *pf)
3308
+ {
3309
+ int result;
3310
+ Image copy;
3311
+
3312
+ /* Copy the original data, stealing it from 'image' */
3313
+ checkopaque(image);
3314
+ copy = *image;
3315
+
3316
+ copy.opts = opts;
3317
+ copy.buffer = NULL;
3318
+ copy.bufsize = 0;
3319
+ copy.allocsize = 0;
3320
+
3321
+ image->input_file = NULL;
3322
+ image->input_memory = NULL;
3323
+ image->input_memory_size = 0;
3324
+ image->tmpfile_name[0] = 0;
3325
+
3326
+ {
3327
+ png_uint_32 counter;
3328
+ Image output;
3329
+
3330
+ newimage(&output);
3331
+
3332
+ result = 1;
3333
+
3334
+ /* Use the low bit of 'counter' to indicate whether or not to do alpha
3335
+ * removal with a background color or by composting onto the image; this
3336
+ * step gets skipped if it isn't relevant
3337
+ */
3338
+ for (counter=0; counter<2*FORMAT_COUNT; ++counter)
3339
+ if (format_isset(pf, counter >> 1))
3340
+ {
3341
+ png_uint_32 format = counter >> 1;
3342
+
3343
+ png_color background_color;
3344
+ png_colorp background = NULL;
3345
+
3346
+ /* If there is a format change that removes the alpha channel then
3347
+ * the background is relevant. If the output is 8-bit color-mapped
3348
+ * then a background color *must* be provided, otherwise there are
3349
+ * two tests to do - one with a color, the other with NULL. The
3350
+ * NULL test happens second.
3351
+ */
3352
+ if ((counter & 1) == 0)
3353
+ {
3354
+ if ((format & PNG_FORMAT_FLAG_ALPHA) == 0 &&
3355
+ (image->image.format & PNG_FORMAT_FLAG_ALPHA) != 0)
3356
+ {
3357
+ /* Alpha/transparency will be removed, the background is
3358
+ * relevant: make it a color the first time
3359
+ */
3360
+ random_color(&background_color);
3361
+ background = &background_color;
3362
+
3363
+ /* BUT if the output is to a color-mapped 8-bit format then
3364
+ * the background must always be a color, so increment 'counter'
3365
+ * to skip the NULL test.
3366
+ */
3367
+ if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0 &&
3368
+ (format & PNG_FORMAT_FLAG_LINEAR) == 0)
3369
+ ++counter;
3370
+ }
3371
+
3372
+ /* Otherwise an alpha channel is not being eliminated, just leave
3373
+ * background NULL and skip the (counter & 1) NULL test.
3374
+ */
3375
+ else
3376
+ ++counter;
3377
+ }
3378
+ /* else just use NULL for background */
3379
+
3380
+ resetimage(&copy);
3381
+ copy.opts = opts; /* in case read_file needs to change it */
3382
+
3383
+ result = read_file(&copy, format, background);
3384
+ if (!result)
3385
+ break;
3386
+
3387
+ /* Make sure the file just read matches the original file. */
3388
+ result = compare_two_images(image, &copy, 0/*via linear*/, background);
3389
+ if (!result)
3390
+ break;
3391
+
3392
+ # ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
3393
+ /* Write the *copy* just made to a new file to make sure the write
3394
+ * side works ok. Check the conversion to sRGB if the copy is
3395
+ * linear.
3396
+ */
3397
+ output.opts = opts;
3398
+ result = write_one_file(&output, &copy, 0/*convert to 8bit*/);
3399
+ if (!result)
3400
+ break;
3401
+
3402
+ /* Validate against the original too; the background is needed here
3403
+ * as well so that compare_two_images knows what color was used.
3404
+ */
3405
+ result = compare_two_images(image, &output, 0, background);
3406
+ if (!result)
3407
+ break;
3408
+
3409
+ if ((format & PNG_FORMAT_FLAG_LINEAR) != 0 &&
3410
+ (format & PNG_FORMAT_FLAG_COLORMAP) == 0)
3411
+ {
3412
+ /* 'output' is linear, convert to the corresponding sRGB format.
3413
+ */
3414
+ output.opts = opts;
3415
+ result = write_one_file(&output, &copy, 1/*convert to 8bit*/);
3416
+ if (!result)
3417
+ break;
3418
+
3419
+ /* This may involve a conversion via linear; in the ideal world
3420
+ * this would round-trip correctly, but libpng 1.5.7 is not the
3421
+ * ideal world so allow a drift (error_via_linear).
3422
+ *
3423
+ * 'image' has an alpha channel but 'output' does not then there
3424
+ * will a strip-alpha-channel operation (because 'output' is
3425
+ * linear), handle this by composing on black when doing the
3426
+ * comparison.
3427
+ */
3428
+ result = compare_two_images(image, &output, 1/*via_linear*/,
3429
+ background);
3430
+ if (!result)
3431
+ break;
3432
+ }
3433
+ # endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */
3434
+ }
3435
+
3436
+ freeimage(&output);
3437
+ }
3438
+
3439
+ freeimage(&copy);
3440
+
3441
+ return result;
3442
+ }
3443
+
3444
+ static int
3445
+ test_one_file(const char *file_name, format_list *formats, png_uint_32 opts,
3446
+ int stride_extra, int log_pass)
3447
+ {
3448
+ int result;
3449
+ Image image;
3450
+
3451
+ if (!(opts & NO_RESEED))
3452
+ reseed(); /* ensure that the random numbers don't depend on file order */
3453
+ newimage(&image);
3454
+ initimage(&image, opts, file_name, stride_extra);
3455
+ result = read_one_file(&image);
3456
+ if (result)
3457
+ result = testimage(&image, opts, formats);
3458
+ freeimage(&image);
3459
+
3460
+ /* Ensure that stderr is flushed into any log file */
3461
+ fflush(stderr);
3462
+
3463
+ if (log_pass)
3464
+ {
3465
+ if (result)
3466
+ printf("PASS:");
3467
+
3468
+ else
3469
+ printf("FAIL:");
3470
+
3471
+ # ifndef PNG_SIMPLIFIED_WRITE_SUPPORTED
3472
+ printf(" (no write)");
3473
+ # endif
3474
+
3475
+ print_opts(opts);
3476
+ printf(" %s\n", file_name);
3477
+ /* stdout may not be line-buffered if it is piped to a file, so: */
3478
+ fflush(stdout);
3479
+ }
3480
+
3481
+ else if (!result)
3482
+ exit(1);
3483
+
3484
+ return result;
3485
+ }
3486
+
3487
+ int
3488
+ main(int argc, char **argv)
3489
+ {
3490
+ png_uint_32 opts = FAST_WRITE | STRICT;
3491
+ format_list formats;
3492
+ const char *touch = NULL;
3493
+ int log_pass = 0;
3494
+ int redundant = 0;
3495
+ int stride_extra = 0;
3496
+ int retval = 0;
3497
+ int c;
3498
+
3499
+ #if PNG_LIBPNG_VER >= 10700
3500
+ /* This error should not exist in 1.7 or later: */
3501
+ opts |= GBG_ERROR;
3502
+ #endif
3503
+
3504
+ init_sRGB_to_d();
3505
+ #if 0
3506
+ init_error_via_linear();
3507
+ #endif
3508
+ format_init(&formats);
3509
+ reseed(); /* initialize random number seeds */
3510
+
3511
+ for (c=1; c<argc; ++c)
3512
+ {
3513
+ const char *arg = argv[c];
3514
+
3515
+ if (strcmp(arg, "--log") == 0)
3516
+ log_pass = 1;
3517
+ else if (strcmp(arg, "--fresh") == 0)
3518
+ {
3519
+ memset(gpc_error, 0, sizeof gpc_error);
3520
+ memset(gpc_error_via_linear, 0, sizeof gpc_error_via_linear);
3521
+ }
3522
+ else if (strcmp(arg, "--file") == 0)
3523
+ # ifdef PNG_STDIO_SUPPORTED
3524
+ opts |= USE_FILE;
3525
+ # else
3526
+ return SKIP; /* skipped: no support */
3527
+ # endif
3528
+ else if (strcmp(arg, "--memory") == 0)
3529
+ opts &= ~USE_FILE;
3530
+ else if (strcmp(arg, "--stdio") == 0)
3531
+ # ifdef PNG_STDIO_SUPPORTED
3532
+ opts |= USE_STDIO;
3533
+ # else
3534
+ return SKIP; /* skipped: no support */
3535
+ # endif
3536
+ else if (strcmp(arg, "--name") == 0)
3537
+ opts &= ~USE_STDIO;
3538
+ else if (strcmp(arg, "--verbose") == 0)
3539
+ opts |= VERBOSE;
3540
+ else if (strcmp(arg, "--quiet") == 0)
3541
+ opts &= ~VERBOSE;
3542
+ else if (strcmp(arg, "--preserve") == 0)
3543
+ opts |= KEEP_TMPFILES;
3544
+ else if (strcmp(arg, "--nopreserve") == 0)
3545
+ opts &= ~KEEP_TMPFILES;
3546
+ else if (strcmp(arg, "--keep-going") == 0)
3547
+ opts |= KEEP_GOING;
3548
+ else if (strcmp(arg, "--fast") == 0)
3549
+ opts |= FAST_WRITE;
3550
+ else if (strcmp(arg, "--slow") == 0)
3551
+ opts &= ~FAST_WRITE;
3552
+ else if (strcmp(arg, "--accumulate") == 0)
3553
+ opts |= ACCUMULATE;
3554
+ else if (strcmp(arg, "--redundant") == 0)
3555
+ redundant = 1;
3556
+ else if (strcmp(arg, "--stop") == 0)
3557
+ opts &= ~KEEP_GOING;
3558
+ else if (strcmp(arg, "--strict") == 0)
3559
+ opts |= STRICT;
3560
+ else if (strcmp(arg, "--nostrict") == 0)
3561
+ opts &= ~STRICT;
3562
+ else if (strcmp(arg, "--sRGB-16bit") == 0)
3563
+ opts |= sRGB_16BIT;
3564
+ else if (strcmp(arg, "--linear-16bit") == 0)
3565
+ opts &= ~sRGB_16BIT;
3566
+ else if (strcmp(arg, "--noreseed") == 0)
3567
+ opts |= NO_RESEED;
3568
+ else if (strcmp(arg, "--fault-gbg-warning") == 0)
3569
+ opts |= GBG_ERROR;
3570
+ else if (strcmp(arg, "--tmpfile") == 0)
3571
+ {
3572
+ if (c+1 < argc)
3573
+ {
3574
+ if (strlen(argv[++c]) >= sizeof tmpf)
3575
+ {
3576
+ fflush(stdout);
3577
+ fprintf(stderr, "%s: %s is too long for a temp file prefix\n",
3578
+ argv[0], argv[c]);
3579
+ exit(99);
3580
+ }
3581
+
3582
+ /* Safe: checked above */
3583
+ strncpy(tmpf, argv[c], sizeof (tmpf)-1);
3584
+ }
3585
+
3586
+ else
3587
+ {
3588
+ fflush(stdout);
3589
+ fprintf(stderr, "%s: %s requires a temporary file prefix\n",
3590
+ argv[0], arg);
3591
+ exit(99);
3592
+ }
3593
+ }
3594
+ else if (strcmp(arg, "--touch") == 0)
3595
+ {
3596
+ if (c+1 < argc)
3597
+ touch = argv[++c];
3598
+
3599
+ else
3600
+ {
3601
+ fflush(stdout);
3602
+ fprintf(stderr, "%s: %s requires a file name argument\n",
3603
+ argv[0], arg);
3604
+ exit(99);
3605
+ }
3606
+ }
3607
+ else if (arg[0] == '+')
3608
+ {
3609
+ png_uint_32 format = formatof(arg+1);
3610
+
3611
+ if (format > FORMAT_COUNT)
3612
+ exit(99);
3613
+
3614
+ format_set(&formats, format);
3615
+ }
3616
+ else if (arg[0] == '-' && arg[1] != 0 && (arg[1] != '0' || arg[2] != 0))
3617
+ {
3618
+ fflush(stdout);
3619
+ fprintf(stderr, "%s: unknown option: %s\n", argv[0], arg);
3620
+ exit(99);
3621
+ }
3622
+ else
3623
+ {
3624
+ if (format_is_initial(&formats))
3625
+ format_default(&formats, redundant);
3626
+
3627
+ if (arg[0] == '-')
3628
+ {
3629
+ int term = (arg[1] == '0' ? 0 : '\n');
3630
+ unsigned int ich = 0;
3631
+
3632
+ /* Loop reading files, use a static buffer to simplify this and just
3633
+ * stop if the name gets to long.
3634
+ */
3635
+ static char buffer[4096];
3636
+
3637
+ do
3638
+ {
3639
+ int ch = getchar();
3640
+
3641
+ /* Don't allow '\0' in file names, and terminate with '\n' or,
3642
+ * for -0, just '\0' (use -print0 to find to make this work!)
3643
+ */
3644
+ if (ch == EOF || ch == term || ch == 0)
3645
+ {
3646
+ buffer[ich] = 0;
3647
+
3648
+ if (ich > 0 && !test_one_file(buffer, &formats, opts,
3649
+ stride_extra, log_pass))
3650
+ retval = 1;
3651
+
3652
+ if (ch == EOF)
3653
+ break;
3654
+
3655
+ ich = 0;
3656
+ --ich; /* so that the increment below sets it to 0 again */
3657
+ }
3658
+
3659
+ else
3660
+ buffer[ich] = (char)ch;
3661
+ } while (++ich < sizeof buffer);
3662
+
3663
+ if (ich)
3664
+ {
3665
+ buffer[32] = 0;
3666
+ buffer[4095] = 0;
3667
+ fprintf(stderr, "%s...%s: file name too long\n", buffer,
3668
+ buffer+(4096-32));
3669
+ exit(99);
3670
+ }
3671
+ }
3672
+
3673
+ else if (!test_one_file(arg, &formats, opts, stride_extra, log_pass))
3674
+ retval = 1;
3675
+ }
3676
+ }
3677
+
3678
+ if (opts & ACCUMULATE)
3679
+ {
3680
+ unsigned int in;
3681
+
3682
+ printf("/* contrib/libtests/pngstest-errors.h\n");
3683
+ printf(" *\n");
3684
+ printf(" * BUILT USING:" PNG_HEADER_VERSION_STRING);
3685
+ printf(" *\n");
3686
+ printf(" * This code is released under the libpng license.\n");
3687
+ printf(" * For conditions of distribution and use, see the disclaimer\n");
3688
+ printf(" * and license in png.h\n");
3689
+ printf(" *\n");
3690
+ printf(" * THIS IS A MACHINE GENERATED FILE: do not edit it directly!\n");
3691
+ printf(" * Instead run:\n");
3692
+ printf(" *\n");
3693
+ printf(" * pngstest --accumulate\n");
3694
+ printf(" *\n");
3695
+ printf(" * on as many PNG files as possible; at least PNGSuite and\n");
3696
+ printf(" * contrib/libtests/testpngs.\n");
3697
+ printf(" */\n");
3698
+
3699
+ printf("static png_uint_16 gpc_error[16/*in*/][16/*out*/][4/*a*/] =\n");
3700
+ printf("{\n");
3701
+ for (in=0; in<16; ++in)
3702
+ {
3703
+ unsigned int out;
3704
+ printf(" { /* input: %s */\n ", format_names[in]);
3705
+ for (out=0; out<16; ++out)
3706
+ {
3707
+ unsigned int alpha;
3708
+ printf(" {");
3709
+ for (alpha=0; alpha<4; ++alpha)
3710
+ {
3711
+ printf(" %d", gpc_error[in][out][alpha]);
3712
+ if (alpha < 3) putchar(',');
3713
+ }
3714
+ printf(" }");
3715
+ if (out < 15)
3716
+ {
3717
+ putchar(',');
3718
+ if (out % 4 == 3) printf("\n ");
3719
+ }
3720
+ }
3721
+ printf("\n }");
3722
+
3723
+ if (in < 15)
3724
+ putchar(',');
3725
+ else
3726
+ putchar('\n');
3727
+ }
3728
+ printf("};\n");
3729
+
3730
+ printf("static png_uint_16 gpc_error_via_linear[16][4/*out*/][4] =\n");
3731
+ printf("{\n");
3732
+ for (in=0; in<16; ++in)
3733
+ {
3734
+ unsigned int out;
3735
+ printf(" { /* input: %s */\n ", format_names[in]);
3736
+ for (out=0; out<4; ++out)
3737
+ {
3738
+ unsigned int alpha;
3739
+ printf(" {");
3740
+ for (alpha=0; alpha<4; ++alpha)
3741
+ {
3742
+ printf(" %d", gpc_error_via_linear[in][out][alpha]);
3743
+ if (alpha < 3) putchar(',');
3744
+ }
3745
+ printf(" }");
3746
+ if (out < 3)
3747
+ putchar(',');
3748
+ }
3749
+ printf("\n }");
3750
+
3751
+ if (in < 15)
3752
+ putchar(',');
3753
+ else
3754
+ putchar('\n');
3755
+ }
3756
+ printf("};\n");
3757
+
3758
+ printf("static png_uint_16 gpc_error_to_colormap[8/*i*/][8/*o*/][4] =\n");
3759
+ printf("{\n");
3760
+ for (in=0; in<8; ++in)
3761
+ {
3762
+ unsigned int out;
3763
+ printf(" { /* input: %s */\n ", format_names[in]);
3764
+ for (out=0; out<8; ++out)
3765
+ {
3766
+ unsigned int alpha;
3767
+ printf(" {");
3768
+ for (alpha=0; alpha<4; ++alpha)
3769
+ {
3770
+ printf(" %d", gpc_error_to_colormap[in][out][alpha]);
3771
+ if (alpha < 3) putchar(',');
3772
+ }
3773
+ printf(" }");
3774
+ if (out < 7)
3775
+ {
3776
+ putchar(',');
3777
+ if (out % 4 == 3) printf("\n ");
3778
+ }
3779
+ }
3780
+ printf("\n }");
3781
+
3782
+ if (in < 7)
3783
+ putchar(',');
3784
+ else
3785
+ putchar('\n');
3786
+ }
3787
+ printf("};\n");
3788
+ printf("/* END MACHINE GENERATED */\n");
3789
+ }
3790
+
3791
+ if (retval == 0 && touch != NULL)
3792
+ {
3793
+ FILE *fsuccess = fopen(touch, "wt");
3794
+
3795
+ if (fsuccess != NULL)
3796
+ {
3797
+ int error = 0;
3798
+ fprintf(fsuccess, "PNG simple API tests succeeded\n");
3799
+ fflush(fsuccess);
3800
+ error = ferror(fsuccess);
3801
+
3802
+ if (fclose(fsuccess) || error)
3803
+ {
3804
+ fflush(stdout);
3805
+ fprintf(stderr, "%s: write failed\n", touch);
3806
+ exit(99);
3807
+ }
3808
+ }
3809
+
3810
+ else
3811
+ {
3812
+ fflush(stdout);
3813
+ fprintf(stderr, "%s: open failed\n", touch);
3814
+ exit(99);
3815
+ }
3816
+ }
3817
+
3818
+ return retval;
3819
+ }
3820
+
3821
+ #else /* !PNG_SIMPLIFIED_READ_SUPPORTED */
3822
+ int main(void)
3823
+ {
3824
+ fprintf(stderr, "pngstest: no read support in libpng, test skipped\n");
3825
+ /* So the test is skipped: */
3826
+ return SKIP;
3827
+ }
3828
+ #endif /* PNG_SIMPLIFIED_READ_SUPPORTED */