magro 0.4.3 → 0.5.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 +4 -4
- data/.clang-format +149 -0
- data/.github/workflows/build.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/Steepfile +20 -0
- data/ext/magro/imgrw.c +61 -72
- data/ext/magro/imgrw.h +3 -1
- data/ext/magro/magro.c +1 -2
- data/lib/magro/filter.rb +1 -1
- data/lib/magro/version.rb +1 -1
- data/sig/magro.rbs +9 -0
- data/sig/magro/filter.rbs +20 -0
- data/sig/magro/io.rbs +14 -0
- data/sig/magro/transform.rbs +12 -0
- data/sig/patch.rbs +90 -0
- metadata +13 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1383da33f22a42bc1dbf7ed16cd1f6d21d0e8444967fb027b29bb39dd189d836
|
|
4
|
+
data.tar.gz: 710cb0248ab131d7a5cfc6671b0ec2e83f335287221dfe795887bf3784b0a682
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3bb0a6c16df89efa22b8e057b425fba66235c826f9d2fcaca74d8191825f8b6153d440fe1edda003b311cef313b2ec8b7a817d3a7e54b86f182474bad26899f
|
|
7
|
+
data.tar.gz: 804a97560558d95d56a9867c4a1b36275a1aaca62a872a340ba2eb2a765a3b9e120e072ddc8a6d923b12b20b304f2b25e0e83d957fbe4b3dbf72a0bfe618c471
|
data/.clang-format
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
Language: Cpp
|
|
3
|
+
# BasedOnStyle: LLVM
|
|
4
|
+
AccessModifierOffset: -2
|
|
5
|
+
AlignAfterOpenBracket: Align
|
|
6
|
+
AlignConsecutiveMacros: false
|
|
7
|
+
AlignConsecutiveAssignments: false
|
|
8
|
+
AlignConsecutiveBitFields: false
|
|
9
|
+
AlignConsecutiveDeclarations: false
|
|
10
|
+
AlignEscapedNewlines: Right
|
|
11
|
+
AlignOperands: Align
|
|
12
|
+
AlignTrailingComments: true
|
|
13
|
+
AllowAllArgumentsOnNextLine: true
|
|
14
|
+
AllowAllConstructorInitializersOnNextLine: true
|
|
15
|
+
AllowAllParametersOfDeclarationOnNextLine: true
|
|
16
|
+
AllowShortEnumsOnASingleLine: true
|
|
17
|
+
AllowShortBlocksOnASingleLine: Never
|
|
18
|
+
AllowShortCaseLabelsOnASingleLine: false
|
|
19
|
+
AllowShortFunctionsOnASingleLine: All
|
|
20
|
+
AllowShortLambdasOnASingleLine: All
|
|
21
|
+
AllowShortIfStatementsOnASingleLine: Never
|
|
22
|
+
AllowShortLoopsOnASingleLine: false
|
|
23
|
+
AlwaysBreakAfterDefinitionReturnType: None
|
|
24
|
+
AlwaysBreakAfterReturnType: None
|
|
25
|
+
AlwaysBreakBeforeMultilineStrings: false
|
|
26
|
+
AlwaysBreakTemplateDeclarations: MultiLine
|
|
27
|
+
BinPackArguments: true
|
|
28
|
+
BinPackParameters: true
|
|
29
|
+
BraceWrapping:
|
|
30
|
+
AfterCaseLabel: false
|
|
31
|
+
AfterClass: false
|
|
32
|
+
AfterControlStatement: Never
|
|
33
|
+
AfterEnum: false
|
|
34
|
+
AfterFunction: false
|
|
35
|
+
AfterNamespace: false
|
|
36
|
+
AfterObjCDeclaration: false
|
|
37
|
+
AfterStruct: false
|
|
38
|
+
AfterUnion: false
|
|
39
|
+
AfterExternBlock: false
|
|
40
|
+
BeforeCatch: false
|
|
41
|
+
BeforeElse: false
|
|
42
|
+
BeforeLambdaBody: false
|
|
43
|
+
BeforeWhile: false
|
|
44
|
+
IndentBraces: false
|
|
45
|
+
SplitEmptyFunction: true
|
|
46
|
+
SplitEmptyRecord: true
|
|
47
|
+
SplitEmptyNamespace: true
|
|
48
|
+
BreakBeforeBinaryOperators: None
|
|
49
|
+
BreakBeforeBraces: Attach
|
|
50
|
+
BreakBeforeInheritanceComma: false
|
|
51
|
+
BreakInheritanceList: BeforeColon
|
|
52
|
+
BreakBeforeTernaryOperators: true
|
|
53
|
+
BreakConstructorInitializersBeforeComma: false
|
|
54
|
+
BreakConstructorInitializers: BeforeColon
|
|
55
|
+
BreakAfterJavaFieldAnnotations: false
|
|
56
|
+
BreakStringLiterals: true
|
|
57
|
+
ColumnLimit: 128
|
|
58
|
+
CommentPragmas: '^ IWYU pragma:'
|
|
59
|
+
CompactNamespaces: false
|
|
60
|
+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
|
61
|
+
ConstructorInitializerIndentWidth: 4
|
|
62
|
+
ContinuationIndentWidth: 4
|
|
63
|
+
Cpp11BracedListStyle: true
|
|
64
|
+
DeriveLineEnding: true
|
|
65
|
+
DerivePointerAlignment: false
|
|
66
|
+
DisableFormat: false
|
|
67
|
+
ExperimentalAutoDetectBinPacking: false
|
|
68
|
+
FixNamespaceComments: true
|
|
69
|
+
ForEachMacros:
|
|
70
|
+
- foreach
|
|
71
|
+
- Q_FOREACH
|
|
72
|
+
- BOOST_FOREACH
|
|
73
|
+
IncludeBlocks: Preserve
|
|
74
|
+
IncludeCategories:
|
|
75
|
+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
|
76
|
+
Priority: 2
|
|
77
|
+
SortPriority: 0
|
|
78
|
+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
|
79
|
+
Priority: 3
|
|
80
|
+
SortPriority: 0
|
|
81
|
+
- Regex: '.*'
|
|
82
|
+
Priority: 1
|
|
83
|
+
SortPriority: 0
|
|
84
|
+
IncludeIsMainRegex: '(Test)?$'
|
|
85
|
+
IncludeIsMainSourceRegex: ''
|
|
86
|
+
IndentCaseLabels: false
|
|
87
|
+
IndentCaseBlocks: false
|
|
88
|
+
IndentGotoLabels: true
|
|
89
|
+
IndentPPDirectives: None
|
|
90
|
+
IndentExternBlock: AfterExternBlock
|
|
91
|
+
IndentWidth: 2
|
|
92
|
+
IndentWrappedFunctionNames: false
|
|
93
|
+
InsertTrailingCommas: None
|
|
94
|
+
JavaScriptQuotes: Leave
|
|
95
|
+
JavaScriptWrapImports: true
|
|
96
|
+
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
97
|
+
MacroBlockBegin: ''
|
|
98
|
+
MacroBlockEnd: ''
|
|
99
|
+
MaxEmptyLinesToKeep: 1
|
|
100
|
+
NamespaceIndentation: None
|
|
101
|
+
ObjCBinPackProtocolList: Auto
|
|
102
|
+
ObjCBlockIndentWidth: 2
|
|
103
|
+
ObjCBreakBeforeNestedBlockParam: true
|
|
104
|
+
ObjCSpaceAfterProperty: false
|
|
105
|
+
ObjCSpaceBeforeProtocolList: true
|
|
106
|
+
PenaltyBreakAssignment: 2
|
|
107
|
+
PenaltyBreakBeforeFirstCallParameter: 19
|
|
108
|
+
PenaltyBreakComment: 300
|
|
109
|
+
PenaltyBreakFirstLessLess: 120
|
|
110
|
+
PenaltyBreakString: 1000
|
|
111
|
+
PenaltyBreakTemplateDeclaration: 10
|
|
112
|
+
PenaltyExcessCharacter: 1000000
|
|
113
|
+
PenaltyReturnTypeOnItsOwnLine: 60
|
|
114
|
+
PointerAlignment: Left
|
|
115
|
+
ReflowComments: true
|
|
116
|
+
SortIncludes: true
|
|
117
|
+
SortUsingDeclarations: true
|
|
118
|
+
SpaceAfterCStyleCast: false
|
|
119
|
+
SpaceAfterLogicalNot: false
|
|
120
|
+
SpaceAfterTemplateKeyword: true
|
|
121
|
+
SpaceBeforeAssignmentOperators: true
|
|
122
|
+
SpaceBeforeCpp11BracedList: false
|
|
123
|
+
SpaceBeforeCtorInitializerColon: true
|
|
124
|
+
SpaceBeforeInheritanceColon: true
|
|
125
|
+
SpaceBeforeParens: ControlStatements
|
|
126
|
+
SpaceBeforeRangeBasedForLoopColon: true
|
|
127
|
+
SpaceInEmptyBlock: false
|
|
128
|
+
SpaceInEmptyParentheses: false
|
|
129
|
+
SpacesBeforeTrailingComments: 1
|
|
130
|
+
SpacesInAngles: false
|
|
131
|
+
SpacesInConditionalStatement: false
|
|
132
|
+
SpacesInContainerLiterals: true
|
|
133
|
+
SpacesInCStyleCastParentheses: false
|
|
134
|
+
SpacesInParentheses: false
|
|
135
|
+
SpacesInSquareBrackets: false
|
|
136
|
+
SpaceBeforeSquareBrackets: false
|
|
137
|
+
Standard: Latest
|
|
138
|
+
StatementMacros:
|
|
139
|
+
- Q_UNUSED
|
|
140
|
+
- QT_REQUIRE_VERSION
|
|
141
|
+
TabWidth: 8
|
|
142
|
+
UseCRLF: false
|
|
143
|
+
UseTab: Never
|
|
144
|
+
WhitespaceSensitiveMacros:
|
|
145
|
+
- STRINGIZE
|
|
146
|
+
- PP_STRINGIZE
|
|
147
|
+
- BOOST_PP_STRINGIZE
|
|
148
|
+
...
|
|
149
|
+
|
data/.github/workflows/build.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Steepfile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
target :lib do
|
|
2
|
+
signature "sig"
|
|
3
|
+
#
|
|
4
|
+
check "lib" # Directory name
|
|
5
|
+
# check "Gemfile" # File name
|
|
6
|
+
# check "app/models/**/*.rb" # Glob
|
|
7
|
+
# # ignore "lib/templates/*.rb"
|
|
8
|
+
#
|
|
9
|
+
# # library "pathname", "set" # Standard libraries
|
|
10
|
+
# # library "strong_json" # Gems
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# target :spec do
|
|
14
|
+
# signature "sig", "sig-private"
|
|
15
|
+
#
|
|
16
|
+
# check "spec"
|
|
17
|
+
#
|
|
18
|
+
# # library "pathname", "set" # Standard libraries
|
|
19
|
+
# # library "rspec"
|
|
20
|
+
# end
|
data/ext/magro/imgrw.c
CHANGED
|
@@ -5,9 +5,7 @@ RUBY_EXTERN VALUE mMagro;
|
|
|
5
5
|
/**
|
|
6
6
|
* @!visibility private
|
|
7
7
|
*/
|
|
8
|
-
static
|
|
9
|
-
VALUE magro_io_read_png(VALUE self, VALUE filename_)
|
|
10
|
-
{
|
|
8
|
+
static VALUE magro_io_read_png(VALUE self, VALUE filename_) {
|
|
11
9
|
char* filename = StringValuePtr(filename_);
|
|
12
10
|
FILE* file_ptr = fopen(filename, "rb");
|
|
13
11
|
unsigned char header[8];
|
|
@@ -21,7 +19,7 @@ VALUE magro_io_read_png(VALUE self, VALUE filename_)
|
|
|
21
19
|
png_uint_32 y;
|
|
22
20
|
int n_dims = 0;
|
|
23
21
|
int n_ch;
|
|
24
|
-
size_t shape[3] = {
|
|
22
|
+
size_t shape[3] = {0};
|
|
25
23
|
VALUE nary;
|
|
26
24
|
uint8_t* nary_ptr;
|
|
27
25
|
|
|
@@ -76,36 +74,36 @@ VALUE magro_io_read_png(VALUE self, VALUE filename_)
|
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
switch (color_type) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
77
|
+
case PNG_COLOR_TYPE_GRAY:
|
|
78
|
+
n_ch = 1;
|
|
79
|
+
n_dims = 2;
|
|
80
|
+
shape[0] = height;
|
|
81
|
+
shape[1] = width;
|
|
82
|
+
break;
|
|
83
|
+
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
|
84
|
+
n_ch = 2;
|
|
85
|
+
n_dims = 3;
|
|
86
|
+
shape[0] = height;
|
|
87
|
+
shape[1] = width;
|
|
88
|
+
shape[2] = 2;
|
|
89
|
+
break;
|
|
90
|
+
case PNG_COLOR_TYPE_RGB:
|
|
91
|
+
n_ch = 3;
|
|
92
|
+
n_dims = 3;
|
|
93
|
+
shape[0] = height;
|
|
94
|
+
shape[1] = width;
|
|
95
|
+
shape[2] = 3;
|
|
96
|
+
break;
|
|
97
|
+
case PNG_COLOR_TYPE_RGB_ALPHA:
|
|
98
|
+
n_ch = 4;
|
|
99
|
+
n_dims = 3;
|
|
100
|
+
shape[0] = height;
|
|
101
|
+
shape[1] = width;
|
|
102
|
+
shape[2] = 4;
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
n_dims = 0;
|
|
106
|
+
break;
|
|
109
107
|
}
|
|
110
108
|
|
|
111
109
|
if (n_dims == 0) {
|
|
@@ -134,9 +132,7 @@ VALUE magro_io_read_png(VALUE self, VALUE filename_)
|
|
|
134
132
|
/**
|
|
135
133
|
* @!visibility private
|
|
136
134
|
*/
|
|
137
|
-
static
|
|
138
|
-
VALUE magro_io_save_png(VALUE self, VALUE filename_, VALUE image)
|
|
139
|
-
{
|
|
135
|
+
static VALUE magro_io_save_png(VALUE self, VALUE filename_, VALUE image) {
|
|
140
136
|
char* filename = StringValuePtr(filename_);
|
|
141
137
|
FILE* file_ptr = fopen(filename, "wb");
|
|
142
138
|
png_structp png_ptr;
|
|
@@ -175,18 +171,18 @@ VALUE magro_io_save_png(VALUE self, VALUE filename_, VALUE image)
|
|
|
175
171
|
}
|
|
176
172
|
|
|
177
173
|
switch (n_ch) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
174
|
+
case 4:
|
|
175
|
+
color_type = PNG_COLOR_TYPE_RGBA;
|
|
176
|
+
break;
|
|
177
|
+
case 3:
|
|
178
|
+
color_type = PNG_COLOR_TYPE_RGB;
|
|
179
|
+
break;
|
|
180
|
+
case 2:
|
|
181
|
+
color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
|
|
182
|
+
break;
|
|
183
|
+
default:
|
|
184
|
+
color_type = PNG_COLOR_TYPE_GRAY;
|
|
185
|
+
break;
|
|
190
186
|
}
|
|
191
187
|
|
|
192
188
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
|
@@ -208,8 +204,8 @@ VALUE magro_io_save_png(VALUE self, VALUE filename_, VALUE image)
|
|
|
208
204
|
return Qfalse;
|
|
209
205
|
}
|
|
210
206
|
|
|
211
|
-
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type,
|
|
212
|
-
|
|
207
|
+
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
|
|
208
|
+
PNG_FILTER_TYPE_DEFAULT);
|
|
213
209
|
|
|
214
210
|
row_ptr_ptr = png_malloc(png_ptr, height * sizeof(png_bytep));
|
|
215
211
|
for (y = 0; y < height; y++) {
|
|
@@ -239,9 +235,7 @@ struct my_error_mgr {
|
|
|
239
235
|
jmp_buf setjmp_buffer;
|
|
240
236
|
};
|
|
241
237
|
|
|
242
|
-
static void
|
|
243
|
-
my_error_exit(j_common_ptr cinfo)
|
|
244
|
-
{
|
|
238
|
+
static void my_error_exit(j_common_ptr cinfo) {
|
|
245
239
|
struct my_error_mgr* my_err = (struct my_error_mgr*)cinfo->err;
|
|
246
240
|
(*cinfo->err->output_message)(cinfo);
|
|
247
241
|
longjmp(my_err->setjmp_buffer, 1);
|
|
@@ -250,16 +244,14 @@ my_error_exit(j_common_ptr cinfo)
|
|
|
250
244
|
/**
|
|
251
245
|
* @!visibility private
|
|
252
246
|
*/
|
|
253
|
-
static
|
|
254
|
-
VALUE magro_io_read_jpg(VALUE self, VALUE filename_)
|
|
255
|
-
{
|
|
247
|
+
static VALUE magro_io_read_jpg(VALUE self, VALUE filename_) {
|
|
256
248
|
char* filename = StringValuePtr(filename_);
|
|
257
249
|
FILE* file_ptr = fopen(filename, "rb");
|
|
258
250
|
struct jpeg_decompress_struct jpeg;
|
|
259
251
|
struct my_error_mgr err;
|
|
260
252
|
unsigned int width, height;
|
|
261
253
|
int n_colors;
|
|
262
|
-
size_t shape[3] = {
|
|
254
|
+
size_t shape[3] = {0};
|
|
263
255
|
int n_dims;
|
|
264
256
|
unsigned int y;
|
|
265
257
|
VALUE nary;
|
|
@@ -311,9 +303,7 @@ VALUE magro_io_read_jpg(VALUE self, VALUE filename_)
|
|
|
311
303
|
/**
|
|
312
304
|
* @!visibility private
|
|
313
305
|
*/
|
|
314
|
-
static
|
|
315
|
-
VALUE magro_io_save_jpg(int argc, VALUE* argv, VALUE self)
|
|
316
|
-
{
|
|
306
|
+
static VALUE magro_io_save_jpg(int argc, VALUE* argv, VALUE self) {
|
|
317
307
|
VALUE filename_;
|
|
318
308
|
VALUE image;
|
|
319
309
|
VALUE quality_;
|
|
@@ -378,15 +368,15 @@ VALUE magro_io_save_jpg(int argc, VALUE* argv, VALUE self)
|
|
|
378
368
|
jpeg.input_components = n_ch;
|
|
379
369
|
|
|
380
370
|
switch (n_ch) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
371
|
+
case 3:
|
|
372
|
+
jpeg.in_color_space = JCS_RGB;
|
|
373
|
+
break;
|
|
374
|
+
case 1:
|
|
375
|
+
jpeg.in_color_space = JCS_GRAYSCALE;
|
|
376
|
+
break;
|
|
377
|
+
default:
|
|
378
|
+
jpeg.in_color_space = JCS_UNKNOWN;
|
|
379
|
+
break;
|
|
390
380
|
}
|
|
391
381
|
|
|
392
382
|
jpeg_set_defaults(&jpeg);
|
|
@@ -411,8 +401,7 @@ VALUE magro_io_save_jpg(int argc, VALUE* argv, VALUE self)
|
|
|
411
401
|
return Qtrue;
|
|
412
402
|
}
|
|
413
403
|
|
|
414
|
-
void init_io_module()
|
|
415
|
-
{
|
|
404
|
+
void init_io_module() {
|
|
416
405
|
VALUE mIO = rb_define_module_under(mMagro, "IO");
|
|
417
406
|
rb_define_module_function(mIO, "read_png", magro_io_read_png, 1);
|
|
418
407
|
rb_define_module_function(mIO, "save_png", magro_io_save_png, 2);
|
data/ext/magro/imgrw.h
CHANGED
data/ext/magro/magro.c
CHANGED
data/lib/magro/filter.rb
CHANGED
|
@@ -32,7 +32,7 @@ module Magro
|
|
|
32
32
|
if n_channels.nil?
|
|
33
33
|
filter1ch(padded, kernel, scale, offset)
|
|
34
34
|
else
|
|
35
|
-
image.class.zeros(
|
|
35
|
+
image.class.zeros(image.shape).tap do |filtered|
|
|
36
36
|
n_channels.times do |c|
|
|
37
37
|
filtered[true, true, c] = filter1ch(padded[true, true, c], kernel, scale, offset)
|
|
38
38
|
end
|
data/lib/magro/version.rb
CHANGED
data/sig/magro.rbs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Magro
|
|
2
|
+
module Filter
|
|
3
|
+
def self?.filter2d: (Numo::UInt8 image, Numo::DFloat kernel, ?scale: Float? scale, ?offset: Integer offset) -> Numo::UInt8
|
|
4
|
+
def self?.convolve2d: (magro_image_narray arr1, magro_image_narray arr2) -> magro_image_narray
|
|
5
|
+
|
|
6
|
+
private
|
|
7
|
+
|
|
8
|
+
INTEGER_NARRAY: Array[String]
|
|
9
|
+
|
|
10
|
+
#def self?.zero_padding: (magro_image_narray image, Integer filter_h, Integer filter_w) -> magro_image_narray
|
|
11
|
+
#def self?.filter1ch: (magro_image_narray image, Numo::DFloat kernel, Float? scale, Integer offset) -> magro_image_narray
|
|
12
|
+
#def self?.im2col: (magro_image_narray image, Integer filter_h, Integer filter_w) -> magro_image_narray
|
|
13
|
+
#def self?.integer_narray?: (Numo::NArray image) -> bool
|
|
14
|
+
|
|
15
|
+
def self?.zero_padding: (untyped image, Integer filter_h, Integer filter_w) -> untyped
|
|
16
|
+
def self?.filter1ch: (untyped image, Numo::DFloat kernel, Float? scale, Integer offset) -> untyped
|
|
17
|
+
def self?.im2col: (untyped image, Integer filter_h, Integer filter_w) -> untyped
|
|
18
|
+
def self?.integer_narray?: (Numo::NArray image) -> bool
|
|
19
|
+
end
|
|
20
|
+
end
|
data/sig/magro/io.rbs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Magro
|
|
2
|
+
module IO
|
|
3
|
+
def self?.imread: (String filename) -> Numo::UInt8?
|
|
4
|
+
def self?.imsave: (String filename, Numo::UInt8 image, ?quality: Integer) -> bool
|
|
5
|
+
|
|
6
|
+
private
|
|
7
|
+
|
|
8
|
+
def self?.read_jpg: (String filename) -> Numo::UInt8
|
|
9
|
+
def self?.read_png: (String filename) -> Numo::UInt8
|
|
10
|
+
def self?.save_jpg: (String filename, Numo::UInt8 image, Integer? quality) -> bool
|
|
11
|
+
def self?.save_png: (String filename, Numo::UInt8 image) -> bool
|
|
12
|
+
def self?.url?: (String str) -> bool
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Magro
|
|
2
|
+
module Transform
|
|
3
|
+
def self?.resize: (Numo::UInt8 image, height: Integer height, width: Integer width) -> Numo::UInt8
|
|
4
|
+
|
|
5
|
+
private
|
|
6
|
+
|
|
7
|
+
INTEGER_NARRAY: Array[String]
|
|
8
|
+
|
|
9
|
+
def self?.bilinear_resize: (Numo::UInt8 image, Integer new_height, Integer new_width) -> Numo::UInt8
|
|
10
|
+
def self?.integer_narray?: (Numo::NArray image) -> bool
|
|
11
|
+
end
|
|
12
|
+
end
|
data/sig/patch.rbs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
module Numo
|
|
2
|
+
class NArray
|
|
3
|
+
def self.cast: (untyped a) -> untyped
|
|
4
|
+
def self.zeros: (*Integer) -> untyped
|
|
5
|
+
def self.[]: (*untyped) -> untyped
|
|
6
|
+
def []: () -> untyped
|
|
7
|
+
def []=: () -> untyped
|
|
8
|
+
def +: (untyped) -> untyped
|
|
9
|
+
def empty?: () -> bool
|
|
10
|
+
def flatten: () -> untyped
|
|
11
|
+
def initialize: (*untyped) -> untyped
|
|
12
|
+
def ndim: () -> Integer
|
|
13
|
+
def shape: () -> [Integer, Integer]
|
|
14
|
+
def swapaxes: (Integer, Integer) -> untyped
|
|
15
|
+
def transpose: (*untyped) -> untyped
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Int8 < NArray
|
|
19
|
+
def *: (untyped) -> untyped
|
|
20
|
+
def +: (untyped) -> untyped
|
|
21
|
+
def []: (*untyped) -> untyped
|
|
22
|
+
def []=: (*untyped) -> untyped
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class Int16 < NArray
|
|
26
|
+
def *: (untyped) -> untyped
|
|
27
|
+
def +: (untyped) -> untyped
|
|
28
|
+
def []: (*untyped) -> untyped
|
|
29
|
+
def []=: (*untyped) -> untyped
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class Int32 < NArray
|
|
33
|
+
def *: (untyped) -> untyped
|
|
34
|
+
def +: (untyped) -> untyped
|
|
35
|
+
def []: (*untyped) -> untyped
|
|
36
|
+
def []=: (*untyped) -> untyped
|
|
37
|
+
def seq: (*untyped) -> untyped
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class Int64 < NArray
|
|
41
|
+
def *: (untyped) -> untyped
|
|
42
|
+
def +: (untyped) -> untyped
|
|
43
|
+
def []: (*untyped) -> untyped
|
|
44
|
+
def []=: (*untyped) -> untyped
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class UInt8 < NArray
|
|
48
|
+
def *: (untyped) -> untyped
|
|
49
|
+
def +: (untyped) -> untyped
|
|
50
|
+
def []: (*untyped) -> untyped
|
|
51
|
+
def []=: (*untyped) -> untyped
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class UInt16 < NArray
|
|
55
|
+
def *: (untyped) -> untyped
|
|
56
|
+
def +: (untyped) -> untyped
|
|
57
|
+
def []: (*untyped) -> untyped
|
|
58
|
+
def []=: (*untyped) -> untyped
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class UInt32 < NArray
|
|
62
|
+
def *: (untyped) -> untyped
|
|
63
|
+
def +: (untyped) -> untyped
|
|
64
|
+
def []: (*untyped) -> untyped
|
|
65
|
+
def []=: (*untyped) -> untyped
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class UInt64 < NArray
|
|
69
|
+
def *: (untyped) -> untyped
|
|
70
|
+
def +: (untyped) -> untyped
|
|
71
|
+
def []: (*untyped) -> untyped
|
|
72
|
+
def []=: (*untyped) -> untyped
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
class SFloat < NArray
|
|
76
|
+
def sum: (*untyped) -> untyped
|
|
77
|
+
def *: (untyped) -> untyped
|
|
78
|
+
def +: (untyped) -> untyped
|
|
79
|
+
def []: (*untyped) -> untyped
|
|
80
|
+
def []=: (*untyped) -> untyped
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
class DFloat < NArray
|
|
84
|
+
def sum: (*untyped) -> untyped
|
|
85
|
+
def *: (untyped) -> untyped
|
|
86
|
+
def +: (untyped) -> untyped
|
|
87
|
+
def []: (*untyped) -> untyped
|
|
88
|
+
def []=: (*untyped) -> untyped
|
|
89
|
+
end
|
|
90
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: magro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- yoshoku
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-06-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: numo-narray
|
|
@@ -36,6 +36,7 @@ extensions:
|
|
|
36
36
|
- ext/magro/extconf.rb
|
|
37
37
|
extra_rdoc_files: []
|
|
38
38
|
files:
|
|
39
|
+
- ".clang-format"
|
|
39
40
|
- ".coveralls.yml"
|
|
40
41
|
- ".github/workflows/build.yml"
|
|
41
42
|
- ".github/workflows/coverage.yml"
|
|
@@ -47,6 +48,7 @@ files:
|
|
|
47
48
|
- LICENSE.txt
|
|
48
49
|
- README.md
|
|
49
50
|
- Rakefile
|
|
51
|
+
- Steepfile
|
|
50
52
|
- bin/console
|
|
51
53
|
- bin/setup
|
|
52
54
|
- ext/magro/extconf.rb
|
|
@@ -60,6 +62,11 @@ files:
|
|
|
60
62
|
- lib/magro/transform.rb
|
|
61
63
|
- lib/magro/version.rb
|
|
62
64
|
- magro.gemspec
|
|
65
|
+
- sig/magro.rbs
|
|
66
|
+
- sig/magro/filter.rbs
|
|
67
|
+
- sig/magro/io.rbs
|
|
68
|
+
- sig/magro/transform.rbs
|
|
69
|
+
- sig/patch.rbs
|
|
63
70
|
homepage: https://github.com/yoshoku/magro
|
|
64
71
|
licenses:
|
|
65
72
|
- BSD-3-Clause
|
|
@@ -68,7 +75,7 @@ metadata:
|
|
|
68
75
|
source_code_uri: https://github.com/yoshoku/magro
|
|
69
76
|
changelog_uri: https://github.com/yoshoku/magro/blob/main/CHANGELOG.md
|
|
70
77
|
documentation_uri: https://yoshoku.github.io/magro/doc/
|
|
71
|
-
post_install_message:
|
|
78
|
+
post_install_message:
|
|
72
79
|
rdoc_options: []
|
|
73
80
|
require_paths:
|
|
74
81
|
- lib
|
|
@@ -83,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
83
90
|
- !ruby/object:Gem::Version
|
|
84
91
|
version: '0'
|
|
85
92
|
requirements: []
|
|
86
|
-
rubygems_version: 3.
|
|
87
|
-
signing_key:
|
|
93
|
+
rubygems_version: 3.1.6
|
|
94
|
+
signing_key:
|
|
88
95
|
specification_version: 4
|
|
89
96
|
summary: Magro is a minimal image processing library for Ruby.
|
|
90
97
|
test_files: []
|