image_pack 0.2.2 → 0.2.3

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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -0
  3. data/README.md +23 -4
  4. data/ext/image_pack/extconf.rb +35 -124
  5. data/ext/image_pack/image_pack.c +638 -595
  6. data/ext/image_pack/mozjpeg_sources.rb +178 -0
  7. data/ext/image_pack/vendor/mozjpeg/BUILDING.md +744 -0
  8. data/ext/image_pack/vendor/mozjpeg/CODE_OF_CONDUCT.md +15 -0
  9. data/ext/image_pack/vendor/mozjpeg/ChangeLog.md +1996 -0
  10. data/lib/image_pack/configuration.rb +54 -8
  11. data/lib/image_pack/version.rb +1 -1
  12. data/lib/image_pack.rb +65 -18
  13. metadata +13 -78
  14. data/ext/image_pack/vendor/mozjpeg/README.ijg +0 -258
  15. data/ext/image_pack/vendor/mozjpeg/cdjpeg.c +0 -156
  16. data/ext/image_pack/vendor/mozjpeg/cjpeg.c +0 -961
  17. data/ext/image_pack/vendor/mozjpeg/djpeg.c +0 -855
  18. data/ext/image_pack/vendor/mozjpeg/jaricom.c +0 -157
  19. data/ext/image_pack/vendor/mozjpeg/jcarith.c +0 -972
  20. data/ext/image_pack/vendor/mozjpeg/jcstest.c +0 -126
  21. data/ext/image_pack/vendor/mozjpeg/jdarith.c +0 -782
  22. data/ext/image_pack/vendor/mozjpeg/jdatadst-tj.c +0 -198
  23. data/ext/image_pack/vendor/mozjpeg/jdatasrc-tj.c +0 -194
  24. data/ext/image_pack/vendor/mozjpeg/jpegtran.c +0 -827
  25. data/ext/image_pack/vendor/mozjpeg/jpegyuv.c +0 -172
  26. data/ext/image_pack/vendor/mozjpeg/rdbmp.c +0 -690
  27. data/ext/image_pack/vendor/mozjpeg/rdcolmap.c +0 -253
  28. data/ext/image_pack/vendor/mozjpeg/rdgif.c +0 -720
  29. data/ext/image_pack/vendor/mozjpeg/rdjpeg.c +0 -160
  30. data/ext/image_pack/vendor/mozjpeg/rdjpgcom.c +0 -494
  31. data/ext/image_pack/vendor/mozjpeg/rdpng.c +0 -194
  32. data/ext/image_pack/vendor/mozjpeg/rdppm.c +0 -781
  33. data/ext/image_pack/vendor/mozjpeg/rdswitch.c +0 -642
  34. data/ext/image_pack/vendor/mozjpeg/rdtarga.c +0 -508
  35. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch32/jccolext-neon.c +0 -148
  36. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch32/jchuff-neon.c +0 -334
  37. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch32/jsimd.c +0 -976
  38. data/ext/image_pack/vendor/mozjpeg/simd/i386/jsimd.c +0 -1312
  39. data/ext/image_pack/vendor/mozjpeg/simd/mips/jsimd.c +0 -1143
  40. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jccolext-mmi.c +0 -455
  41. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jccolor-mmi.c +0 -148
  42. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jcgray-mmi.c +0 -132
  43. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jcgryext-mmi.c +0 -374
  44. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jcsample-mmi.c +0 -98
  45. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdcolext-mmi.c +0 -415
  46. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdcolor-mmi.c +0 -139
  47. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdmerge-mmi.c +0 -149
  48. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdmrgext-mmi.c +0 -615
  49. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdsample-mmi.c +0 -304
  50. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jfdctfst-mmi.c +0 -255
  51. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jfdctint-mmi.c +0 -398
  52. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jidctfst-mmi.c +0 -395
  53. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jidctint-mmi.c +0 -571
  54. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jquanti-mmi.c +0 -124
  55. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jsimd.c +0 -866
  56. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jccolext-altivec.c +0 -269
  57. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jccolor-altivec.c +0 -116
  58. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jcgray-altivec.c +0 -111
  59. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jcgryext-altivec.c +0 -228
  60. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jcsample-altivec.c +0 -159
  61. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdcolext-altivec.c +0 -276
  62. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdcolor-altivec.c +0 -106
  63. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdmerge-altivec.c +0 -130
  64. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdmrgext-altivec.c +0 -329
  65. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdsample-altivec.c +0 -400
  66. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jfdctfst-altivec.c +0 -154
  67. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jfdctint-altivec.c +0 -258
  68. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jidctfst-altivec.c +0 -255
  69. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jidctint-altivec.c +0 -357
  70. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jquanti-altivec.c +0 -250
  71. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jsimd.c +0 -884
  72. data/ext/image_pack/vendor/mozjpeg/strtest.c +0 -170
  73. data/ext/image_pack/vendor/mozjpeg/tjbench.c +0 -1044
  74. data/ext/image_pack/vendor/mozjpeg/tjexample.c +0 -406
  75. data/ext/image_pack/vendor/mozjpeg/tjunittest.c +0 -961
  76. data/ext/image_pack/vendor/mozjpeg/tjutil.c +0 -70
  77. data/ext/image_pack/vendor/mozjpeg/transupp.c +0 -2373
  78. data/ext/image_pack/vendor/mozjpeg/turbojpeg-jni.c +0 -1259
  79. data/ext/image_pack/vendor/mozjpeg/turbojpeg.c +0 -2320
  80. data/ext/image_pack/vendor/mozjpeg/wrbmp.c +0 -552
  81. data/ext/image_pack/vendor/mozjpeg/wrgif.c +0 -580
  82. data/ext/image_pack/vendor/mozjpeg/wrjpgcom.c +0 -577
  83. data/ext/image_pack/vendor/mozjpeg/wrppm.c +0 -366
  84. data/ext/image_pack/vendor/mozjpeg/wrtarga.c +0 -258
  85. data/ext/image_pack/vendor/mozjpeg/yuvjpeg.c +0 -268
@@ -0,0 +1,178 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Single source of truth for the vendored MozJPEG runtime file set.
4
+ #
5
+ # Keep this file free of build-time side effects: it is required by
6
+ # image_pack.gemspec, ext/image_pack/extconf.rb, script/vendor_libs.rb, and
7
+ # packaging tests. Files listed as include templates are copied/packaged because
8
+ # MozJPEG includes them textually from other C/ASM files, but they must not be
9
+ # compiled as standalone translation units.
10
+ module ImagePackMozjpegSources
11
+ VERSION = "4.1.5"
12
+ VERSION_NUMBER = "4001005"
13
+ SHA256 = "9fcbb7171f6ac383f5b391175d6fb3acde5e64c4c4727274eade84ed0998fcc1"
14
+
15
+ LICENSE_AND_DOC_FILES = %w[
16
+ LICENSE.md
17
+ README.md
18
+ README-mozilla.txt
19
+ README-turbo.txt
20
+ README.ijg
21
+ ].freeze
22
+
23
+ # Files compiled as standalone translation units in the scalar/runtime core.
24
+ TOPLEVEL_C_SOURCES = %w[
25
+ jcapimin.c
26
+ jcapistd.c
27
+ jccoefct.c
28
+ jccolor.c
29
+ jcdctmgr.c
30
+ jchuff.c
31
+ jcext.c
32
+ jcicc.c
33
+ jcinit.c
34
+ jcmainct.c
35
+ jcmarker.c
36
+ jcmaster.c
37
+ jcomapi.c
38
+ jcparam.c
39
+ jcphuff.c
40
+ jcprepct.c
41
+ jcsample.c
42
+ jctrans.c
43
+ jdapimin.c
44
+ jdapistd.c
45
+ jdatadst.c
46
+ jdatasrc.c
47
+ jdcoefct.c
48
+ jdcolor.c
49
+ jddctmgr.c
50
+ jdhuff.c
51
+ jdicc.c
52
+ jdinput.c
53
+ jdmainct.c
54
+ jdmarker.c
55
+ jdmaster.c
56
+ jdmerge.c
57
+ jdphuff.c
58
+ jdpostct.c
59
+ jdsample.c
60
+ jdtrans.c
61
+ jerror.c
62
+ jfdctflt.c
63
+ jfdctfst.c
64
+ jfdctint.c
65
+ jidctflt.c
66
+ jidctfst.c
67
+ jidctint.c
68
+ jidctred.c
69
+ jquant1.c
70
+ jquant2.c
71
+ jutils.c
72
+ jmemmgr.c
73
+ jmemnobs.c
74
+ ].freeze
75
+
76
+ # MozJPEG/libjpeg-turbo uses these top-level .c files as textual include
77
+ # templates. They are required at compile time but must not be added to $srcs.
78
+ TOPLEVEL_INCLUDE_TEMPLATES = %w[
79
+ jccolext.c
80
+ jdcol565.c
81
+ jdcolext.c
82
+ jdmrg565.c
83
+ jdmrgext.c
84
+ jstdhuff.c
85
+ ].freeze
86
+
87
+ TOPLEVEL_RUNTIME_C_FILES = (TOPLEVEL_C_SOURCES + TOPLEVEL_INCLUDE_TEMPLATES + %w[jsimd_none.c]).freeze
88
+
89
+ NEON_AARCH64_C_SOURCES = %w[
90
+ simd/arm/aarch64/jsimd.c
91
+ simd/arm/aarch64/jchuff-neon.c
92
+ simd/arm/jccolor-neon.c
93
+ simd/arm/jcgray-neon.c
94
+ simd/arm/jcphuff-neon.c
95
+ simd/arm/jcsample-neon.c
96
+ simd/arm/jdcolor-neon.c
97
+ simd/arm/jdmerge-neon.c
98
+ simd/arm/jdsample-neon.c
99
+ simd/arm/jfdctfst-neon.c
100
+ simd/arm/jfdctint-neon.c
101
+ simd/arm/jidctfst-neon.c
102
+ simd/arm/jidctint-neon.c
103
+ simd/arm/jidctred-neon.c
104
+ simd/arm/jquanti-neon.c
105
+ ].freeze
106
+
107
+ # AArch64 NEON C include templates required by the NEON sources above.
108
+ NEON_AARCH64_INCLUDE_TEMPLATES = %w[
109
+ simd/arm/aarch64/jccolext-neon.c
110
+ simd/arm/jcgryext-neon.c
111
+ simd/arm/jdcolext-neon.c
112
+ simd/arm/jdmrgext-neon.c
113
+ ].freeze
114
+
115
+ X86_64_C_SOURCES = %w[
116
+ simd/x86_64/jsimd.c
117
+ ].freeze
118
+
119
+ X86_64_ASM_SOURCES = %w[
120
+ simd/x86_64/jsimdcpu.asm
121
+ simd/x86_64/jfdctflt-sse.asm
122
+ simd/x86_64/jccolor-sse2.asm
123
+ simd/x86_64/jcgray-sse2.asm
124
+ simd/x86_64/jchuff-sse2.asm
125
+ simd/x86_64/jcphuff-sse2.asm
126
+ simd/x86_64/jcsample-sse2.asm
127
+ simd/x86_64/jdcolor-sse2.asm
128
+ simd/x86_64/jdmerge-sse2.asm
129
+ simd/x86_64/jdsample-sse2.asm
130
+ simd/x86_64/jfdctfst-sse2.asm
131
+ simd/x86_64/jfdctint-sse2.asm
132
+ simd/x86_64/jidctflt-sse2.asm
133
+ simd/x86_64/jidctfst-sse2.asm
134
+ simd/x86_64/jidctint-sse2.asm
135
+ simd/x86_64/jidctred-sse2.asm
136
+ simd/x86_64/jquantf-sse2.asm
137
+ simd/x86_64/jquanti-sse2.asm
138
+ simd/x86_64/jccolor-avx2.asm
139
+ simd/x86_64/jcgray-avx2.asm
140
+ simd/x86_64/jcsample-avx2.asm
141
+ simd/x86_64/jdcolor-avx2.asm
142
+ simd/x86_64/jdmerge-avx2.asm
143
+ simd/x86_64/jdsample-avx2.asm
144
+ simd/x86_64/jfdctint-avx2.asm
145
+ simd/x86_64/jidctint-avx2.asm
146
+ simd/x86_64/jquanti-avx2.asm
147
+ ].freeze
148
+
149
+ # .c files that must be shipped in the gem. This includes compile units and
150
+ # textual include templates; extconf decides which compile units to add to $srcs.
151
+ GEM_RUNTIME_C_SOURCES = (
152
+ TOPLEVEL_RUNTIME_C_FILES +
153
+ NEON_AARCH64_C_SOURCES +
154
+ NEON_AARCH64_INCLUDE_TEMPLATES +
155
+ X86_64_C_SOURCES
156
+ ).freeze
157
+
158
+ TOPLEVEL_EXTENSIONS = %w[.h .in .txt .md].freeze
159
+
160
+ # `.in` matters under simd/ too: simd/arm/neon-compat.h.in is the
161
+ # CMake-generated header template processed by extconf.rb at build time.
162
+ SIMD_EXTENSIONS = %w[.c .h .asm .inc .S .in].freeze
163
+
164
+ def self.mozjpeg_file?(relative_path)
165
+ return false if relative_path.empty?
166
+
167
+ if relative_path.include?("/")
168
+ return false unless relative_path.start_with?("simd/")
169
+
170
+ return SIMD_EXTENSIONS.include?(File.extname(relative_path))
171
+ end
172
+
173
+ basename = File.basename(relative_path)
174
+ LICENSE_AND_DOC_FILES.include?(basename) ||
175
+ TOPLEVEL_RUNTIME_C_FILES.include?(basename) ||
176
+ TOPLEVEL_EXTENSIONS.include?(File.extname(basename))
177
+ end
178
+ end