dhash-vips 0.2.0.0 → 0.2.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.
- checksums.yaml +5 -5
- data/dhash-vips.gemspec +1 -1
- data/lib/dhash-vips.rb +6 -1
- data/test.rb +16 -8
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a51cdf1232968a0f4717b6a76ef15a7e4378004fabdc240e472fbaac429c22c7
|
4
|
+
data.tar.gz: e20fc002226f349de7ce4cfd2c5709cbd8198640e6b2445a572abebce3a7b85d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd4d7ecb82a95361cd7a1075691a9303c80f18c4b186f37cb348c041f9787d6bdf61e34d39df3d416980aba2b680e98568743c2f1822e8df75838cea8fde3e60
|
7
|
+
data.tar.gz: 297c8b7e8662e97bd051777d2b662504ae15fcfed448bf9248fd8ef941fa320430eba48bb5ff64ad10f890d985c0d7aca337578f033dcfef031b3d52026de276
|
data/dhash-vips.gemspec
CHANGED
data/lib/dhash-vips.rb
CHANGED
@@ -34,7 +34,12 @@ module DHashVips
|
|
34
34
|
begin
|
35
35
|
require_relative "../idhash.#{Gem::Platform.local.os == "darwin" ? "bundle" : "o"}"
|
36
36
|
rescue LoadError
|
37
|
-
|
37
|
+
class << self
|
38
|
+
# https://github.com/minitest/minitest/issues/939
|
39
|
+
def distance3 a, b
|
40
|
+
distance3_ruby a, b
|
41
|
+
end
|
42
|
+
end
|
38
43
|
else
|
39
44
|
# we can't just do `defined? Bignum` because it's defined but deprecated (some internal CONST_DEPRECATED flag)
|
40
45
|
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.4")
|
data/test.rb
CHANGED
@@ -156,6 +156,9 @@ require_relative "lib/dhash-vips"
|
|
156
156
|
].each do |lib, dm, calc, min_similar, max_similar, min_not_similar, max_not_similar, bw_exceptional|
|
157
157
|
|
158
158
|
describe lib do
|
159
|
+
require "fileutils"
|
160
|
+
require "digest"
|
161
|
+
require "mll"
|
159
162
|
|
160
163
|
# these are false positive by idhash
|
161
164
|
# 6d97739b4a08f965dc9239dd24382e96.jpg
|
@@ -176,20 +179,16 @@ require_relative "lib/dhash-vips"
|
|
176
179
|
}, bw_exceptional, bw_exceptional], # these are the same photo but of different size and colorspace
|
177
180
|
].each do |_images, min, max|
|
178
181
|
|
179
|
-
require "fileutils"
|
180
|
-
require "digest"
|
181
|
-
require "mll"
|
182
|
-
|
183
182
|
require_relative "common"
|
184
183
|
images = _images.map{ |_| download_if_needed "test_images/#{_}" }
|
185
184
|
|
186
185
|
hashes = images.map &lib.method(calc)
|
187
186
|
table = MLL::table[lib.method(dm), [hashes], [hashes]]
|
188
187
|
|
189
|
-
|
190
|
-
|
191
|
-
PP.pp table, STDERR
|
192
|
-
STDERR.puts ""
|
188
|
+
# STDERR.puts ""
|
189
|
+
# require "pp"
|
190
|
+
# PP.pp table, STDERR
|
191
|
+
# STDERR.puts ""
|
193
192
|
|
194
193
|
hashes.size.times.to_a.repeated_combination(2) do |i, j|
|
195
194
|
it "#{_images[i]} #{_images[j]}" do
|
@@ -209,9 +208,18 @@ require_relative "lib/dhash-vips"
|
|
209
208
|
end
|
210
209
|
|
211
210
|
it "accepts Vips::Image" do
|
211
|
+
# https://github.com/libvips/ruby-vips/issues/349
|
212
212
|
lib.public_send calc, Vips::Image.new_from_buffer("GIF89a\x01\x00\x01\x00\x80\x01\x00\xFF\xFF\xFF\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;", "")
|
213
213
|
end
|
214
214
|
|
215
215
|
end
|
216
216
|
|
217
217
|
end
|
218
|
+
|
219
|
+
describe DHashVips::IDHash do
|
220
|
+
it "does not call distance3_ruby" do
|
221
|
+
DHashVips::IDHash.stub :distance3_ruby, ->*{fail} do
|
222
|
+
assert_equal 0, DHashVips::IDHash.distance3((2<<256)-1, (2<<256)-1)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dhash-vips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Maslov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-vips
|
@@ -71,8 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0'
|
73
73
|
requirements: []
|
74
|
-
|
75
|
-
rubygems_version: 2.5.2.3
|
74
|
+
rubygems_version: 3.3.25
|
76
75
|
signing_key:
|
77
76
|
specification_version: 4
|
78
77
|
summary: dHash and IDHash perceptual image hashing/fingerprinting
|