dither 0.2.0.rc3-java → 0.2.0.rc4-java
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 +4 -4
- data/ext/dither/simple_constraint_handler.cc +21 -22
- data/lib/dither/api.rb +2 -1
- data/lib/dither/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50e576d6e9e07d6580bae33577e1f87f36156ec3
|
4
|
+
data.tar.gz: 5900588a4ae476efc19fd04d1f008f326a32e68b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54679f10f893985789178b46b602c460360c4154c3c24bba10458f07570c87b19813e5d910c525396bbc6d40e9f08cc7df78a595fb415f8c88af63c175d62e12
|
7
|
+
data.tar.gz: ea6c142c97711282cf11b1718d9e33630488cde0133c5ed7491df0075f64e3000de40695b27a866cf9b055b8e715ce05f0b4ca533633f4285ddbebfaa7230828
|
@@ -8,13 +8,14 @@
|
|
8
8
|
*/
|
9
9
|
|
10
10
|
#include "simple_constraint_handler.h"
|
11
|
+
#include <iostream>
|
11
12
|
|
12
13
|
namespace dither {
|
13
14
|
|
14
15
|
SimpleConstraintHandler::SimpleConstraintHandler(std::vector<dval>& ranges, std::vector<std::vector<dval>>& pconstraints) : params(ranges) {
|
15
16
|
for(auto it = pconstraints.cbegin(); it != pconstraints.cend(); ++it) {
|
16
17
|
std::vector<std::pair<std::size_t, dval>> constraint;
|
17
|
-
|
18
|
+
std::size_t i = 0;
|
18
19
|
for(auto iit = (*it).cbegin(); iit != (*it).cend(); ++iit, i++) {
|
19
20
|
if((*iit) != -1) {
|
20
21
|
constraint.push_back(std::make_pair(i, *iit));
|
@@ -86,32 +87,30 @@ namespace dither {
|
|
86
87
|
if(indexes.size() == 0) {
|
87
88
|
return true;
|
88
89
|
}
|
89
|
-
std::vector<dval> bound_values(indexes.size(),
|
90
|
+
std::vector<dval> bound_values(indexes.size(), -1);
|
90
91
|
i = 0;
|
91
92
|
|
92
|
-
LOOP:{
|
93
|
-
do {
|
94
|
-
test_case[indexes[i]] = bound_values[i];
|
95
|
-
if(violate_constraints(test_case)) {
|
96
|
-
// try to bump a bound value... return false if no valid value
|
97
|
-
const std::size_t upper_bound = i + 1;
|
98
|
-
for(std::size_t j = 0; j < upper_bound; j++) {
|
99
|
-
auto bump_value = bound_values[i] + 1;
|
100
|
-
if(bump_value < params[indexes[i]]) {
|
101
|
-
bound_values[i] = bump_value;
|
102
|
-
goto LOOP;
|
103
|
-
}
|
104
|
-
|
105
|
-
// unwind
|
106
|
-
bound_values[i] = 0;
|
107
|
-
test_case[indexes[i]] = -1;
|
108
|
-
i--;
|
109
|
-
}
|
93
|
+
LOOP:while(i < indexes.size()) {
|
110
94
|
|
111
|
-
|
95
|
+
const dval max = params[indexes[i]];
|
96
|
+
for(dval value = bound_values[i] + 1; value <= max; value++) {
|
97
|
+
test_case[indexes[i]] = value;
|
98
|
+
if(violate_constraints(test_case)) {
|
99
|
+
continue;
|
112
100
|
}
|
101
|
+
bound_values[i] = value;
|
113
102
|
i++;
|
114
|
-
|
103
|
+
goto LOOP;
|
104
|
+
}
|
105
|
+
|
106
|
+
if(i == 0) {
|
107
|
+
return false;
|
108
|
+
}
|
109
|
+
|
110
|
+
// unwind
|
111
|
+
bound_values[i] = -1;
|
112
|
+
test_case[indexes[i]] = -1;
|
113
|
+
i--;
|
115
114
|
}
|
116
115
|
|
117
116
|
return true;
|
data/lib/dither/api.rb
CHANGED
@@ -5,7 +5,8 @@ require 'ffi'
|
|
5
5
|
module Dither
|
6
6
|
module API
|
7
7
|
extend FFI::Library
|
8
|
-
|
8
|
+
LIB_DIR = File.expand_path('../..', __FILE__)
|
9
|
+
ffi_lib %W[#{LIB_DIR}/dither.so #{LIB_DIR}/dither.dll]
|
9
10
|
|
10
11
|
attach_function :dither_ipog_new, [:int], :pointer
|
11
12
|
attach_function :dither_ipog_add_parameter_int, [:pointer, :int, :pointer, :int], :void
|
data/lib/dither/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dither
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.rc4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Jason Gowan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|