minscan 0.1.0__tar.gz

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 (136) hide show
  1. minscan-0.1.0/.clang-format +93 -0
  2. minscan-0.1.0/.clang-tidy +10 -0
  3. minscan-0.1.0/.editorconfig +18 -0
  4. minscan-0.1.0/.git-blame-ignore-revs +2 -0
  5. minscan-0.1.0/.github/workflows/ci.yml +108 -0
  6. minscan-0.1.0/.github/workflows/wheels.yml +71 -0
  7. minscan-0.1.0/.gitignore +49 -0
  8. minscan-0.1.0/LICENSE +21 -0
  9. minscan-0.1.0/PKG-INFO +126 -0
  10. minscan-0.1.0/README.md +106 -0
  11. minscan-0.1.0/cross/mingw.ini +12 -0
  12. minscan-0.1.0/include/minscan/capi.h +122 -0
  13. minscan-0.1.0/meson.build +190 -0
  14. minscan-0.1.0/meson_options.txt +12 -0
  15. minscan-0.1.0/misc/minolta.inf +165 -0
  16. minscan-0.1.0/pyproject.toml +37 -0
  17. minscan-0.1.0/python/minscan/__init__.py +50 -0
  18. minscan-0.1.0/python/minscan/_api.py +498 -0
  19. minscan-0.1.0/python/tests/test_api.py +61 -0
  20. minscan-0.1.0/src/capi.c +528 -0
  21. minscan-0.1.0/src/cli/args.c +115 -0
  22. minscan-0.1.0/src/cli/args.h +50 -0
  23. minscan-0.1.0/src/cli/cancel.c +40 -0
  24. minscan-0.1.0/src/cli/cancel.h +23 -0
  25. minscan-0.1.0/src/cli/cmd_eject.c +56 -0
  26. minscan-0.1.0/src/cli/cmd_focus.c +169 -0
  27. minscan-0.1.0/src/cli/cmd_help.c +55 -0
  28. minscan-0.1.0/src/cli/cmd_probe.c +102 -0
  29. minscan-0.1.0/src/cli/cmd_scan.c +472 -0
  30. minscan-0.1.0/src/cli/commands.h +84 -0
  31. minscan-0.1.0/src/cli/main.c +41 -0
  32. minscan-0.1.0/src/cli/output.c +29 -0
  33. minscan-0.1.0/src/cli/progress.c +326 -0
  34. minscan-0.1.0/src/cli/progress.h +75 -0
  35. minscan-0.1.0/src/cli/session_open.c +48 -0
  36. minscan-0.1.0/src/cli/session_open.h +32 -0
  37. minscan-0.1.0/src/core/error.h +36 -0
  38. minscan-0.1.0/src/core/frame.h +33 -0
  39. minscan-0.1.0/src/core/image/balance.c +99 -0
  40. minscan-0.1.0/src/core/image/coreg.c +96 -0
  41. minscan-0.1.0/src/core/image/frame.c +99 -0
  42. minscan-0.1.0/src/core/image/gain.c +60 -0
  43. minscan-0.1.0/src/core/image/ice.c +1115 -0
  44. minscan-0.1.0/src/core/image/image.h +162 -0
  45. minscan-0.1.0/src/core/image/ir.c +133 -0
  46. minscan-0.1.0/src/core/image/pipeline.c +78 -0
  47. minscan-0.1.0/src/core/image/shading.c +127 -0
  48. minscan-0.1.0/src/core/image/tiff.c +207 -0
  49. minscan-0.1.0/src/core/image/tiff.h +23 -0
  50. minscan-0.1.0/src/core/log.c +72 -0
  51. minscan-0.1.0/src/core/log.h +36 -0
  52. minscan-0.1.0/src/core/num.h +26 -0
  53. minscan-0.1.0/src/core/scan/exposure.c +169 -0
  54. minscan-0.1.0/src/core/scan/exposure.h +56 -0
  55. minscan-0.1.0/src/core/scan/job.c +338 -0
  56. minscan-0.1.0/src/core/scan/job.h +27 -0
  57. minscan-0.1.0/src/core/scan/ladder.c +250 -0
  58. minscan-0.1.0/src/core/scan/ladder.h +37 -0
  59. minscan-0.1.0/src/core/scan/request.h +58 -0
  60. minscan-0.1.0/src/core/scan/window.c +378 -0
  61. minscan-0.1.0/src/core/scan/window.h +108 -0
  62. minscan-0.1.0/src/core/session/acquire.c +488 -0
  63. minscan-0.1.0/src/core/session/calibrate.c +210 -0
  64. minscan-0.1.0/src/core/session/calibration_cache.c +175 -0
  65. minscan-0.1.0/src/core/session/calibration_cache.h +28 -0
  66. minscan-0.1.0/src/core/session/exposure.c +146 -0
  67. minscan-0.1.0/src/core/session/focus.c +666 -0
  68. minscan-0.1.0/src/core/session/internal.h +236 -0
  69. minscan-0.1.0/src/core/session/io.c +322 -0
  70. minscan-0.1.0/src/core/session/probe.c +419 -0
  71. minscan-0.1.0/src/core/session/session.h +273 -0
  72. minscan-0.1.0/src/core/session/stage.c +164 -0
  73. minscan-0.1.0/src/core/wire/cdb.c +91 -0
  74. minscan-0.1.0/src/core/wire/cdb.h +37 -0
  75. minscan-0.1.0/src/core/wire/descriptor.c +131 -0
  76. minscan-0.1.0/src/core/wire/descriptor.h +114 -0
  77. minscan-0.1.0/src/core/wire/pages.c +110 -0
  78. minscan-0.1.0/src/core/wire/pages.h +63 -0
  79. minscan-0.1.0/src/core/wire/scsi.h +104 -0
  80. minscan-0.1.0/src/core/wire/unpack.c +47 -0
  81. minscan-0.1.0/src/core/wire/unpack.h +33 -0
  82. minscan-0.1.0/src/platform/mem.h +58 -0
  83. minscan-0.1.0/src/platform/time.c +29 -0
  84. minscan-0.1.0/src/platform/time.h +43 -0
  85. minscan-0.1.0/src/platform/time_posix.c +120 -0
  86. minscan-0.1.0/src/platform/time_unsupported.c +37 -0
  87. minscan-0.1.0/src/platform/time_win32.c +159 -0
  88. minscan-0.1.0/src/transport/linux_sg.c +292 -0
  89. minscan-0.1.0/src/transport/transport.c +110 -0
  90. minscan-0.1.0/src/transport/transport.h +109 -0
  91. minscan-0.1.0/src/transport/unsupported.c +42 -0
  92. minscan-0.1.0/src/transport/win32_scsiscan.c +564 -0
  93. minscan-0.1.0/subprojects/argtable3.wrap +14 -0
  94. minscan-0.1.0/subprojects/libtiff.wrap +14 -0
  95. minscan-0.1.0/tests/capi/test_capi.c +27 -0
  96. minscan-0.1.0/tests/cli/test_progress.c +32 -0
  97. minscan-0.1.0/tests/image/test_ice.c +397 -0
  98. minscan-0.1.0/tests/image/test_image.c +78 -0
  99. minscan-0.1.0/tests/image/test_linear.c +156 -0
  100. minscan-0.1.0/tests/image/test_tiff.c +141 -0
  101. minscan-0.1.0/tests/scan/test_descriptor_build.c +347 -0
  102. minscan-0.1.0/tests/scan/testdata/desc_arm_35mm.bin +0 -0
  103. minscan-0.1.0/tests/scan/testdata/desc_arm_ice_6x9.bin +0 -0
  104. minscan-0.1.0/tests/scan/testdata/desc_color35mm_arm2_div1.bin +0 -0
  105. minscan-0.1.0/tests/scan/testdata/desc_color35mm_arm_div1.bin +0 -0
  106. minscan-0.1.0/tests/scan/testdata/desc_color35mm_prescan_div8.bin +0 -0
  107. minscan-0.1.0/tests/scan/testdata/desc_color35mm_scan_div1.bin +0 -0
  108. minscan-0.1.0/tests/scan/testdata/desc_color35mm_scan_div4.bin +0 -0
  109. minscan-0.1.0/tests/scan/testdata/desc_color35mm_scan_div4_slotA.bin +0 -0
  110. minscan-0.1.0/tests/scan/testdata/desc_color35mm_scan_div4_slotB.bin +0 -0
  111. minscan-0.1.0/tests/scan/testdata/desc_focus_35mm.bin +0 -0
  112. minscan-0.1.0/tests/scan/testdata/desc_focus_6x9.bin +0 -0
  113. minscan-0.1.0/tests/scan/testdata/desc_focusopen_35mm.bin +0 -0
  114. minscan-0.1.0/tests/scan/testdata/desc_focusopen_6x9.bin +0 -0
  115. minscan-0.1.0/tests/scan/testdata/desc_ice_0_10plus11.bin +0 -0
  116. minscan-0.1.0/tests/scan/testdata/desc_ice_2_12.bin +0 -0
  117. minscan-0.1.0/tests/scan/testdata/desc_mono35mm_scan_div1.bin +0 -0
  118. minscan-0.1.0/tests/scan/testdata/desc_mono35mm_scan_div4_slotA.bin +0 -0
  119. minscan-0.1.0/tests/scan/testdata/desc_mono35mm_scan_div4_slotB.bin +0 -0
  120. minscan-0.1.0/tests/scan/testdata/desc_mono6x9_prescan_div8.bin +0 -0
  121. minscan-0.1.0/tests/scan/testdata/desc_mono6x9_scan_div1.bin +0 -0
  122. minscan-0.1.0/tests/scan/testdata/desc_mono6x9_scan_div2.bin +0 -0
  123. minscan-0.1.0/tests/scan/testdata/desc_mono6x9_scan_div4.bin +0 -0
  124. minscan-0.1.0/tests/scan/testdata/desc_prescan_35mm.bin +0 -0
  125. minscan-0.1.0/tests/scan/testdata/desc_prescan_ice_10plus11.bin +0 -0
  126. minscan-0.1.0/tests/scan/testdata/desc_prescan_ice_div8.bin +0 -0
  127. minscan-0.1.0/tests/scan/testdata/desc_prescan_noice_10plus11.bin +0 -0
  128. minscan-0.1.0/tests/scan/testdata/desc_scan_35mm.bin +0 -0
  129. minscan-0.1.0/tests/scan/testdata/desc_scan_ice_div1.bin +0 -0
  130. minscan-0.1.0/tests/scan/testdata/desc_scan_ice_div2.bin +0 -0
  131. minscan-0.1.0/tests/session/test_session_guard.c +465 -0
  132. minscan-0.1.0/tests/test.h +50 -0
  133. minscan-0.1.0/tests/wire/test_cdb.c +66 -0
  134. minscan-0.1.0/tests/wire/test_descriptor.c +66 -0
  135. minscan-0.1.0/tests/wire/test_pages.c +56 -0
  136. minscan-0.1.0/tools/check_layers.py +64 -0
@@ -0,0 +1,93 @@
1
+ BasedOnStyle: LLVM
2
+
3
+ AlignAfterOpenBracket: Align
4
+ AlignArrayOfStructures: Left
5
+
6
+ AlignConsecutiveMacros: AcrossEmptyLinesAndComments
7
+ AlignConsecutiveAssignments: Consecutive
8
+ AlignConsecutiveBitFields: AcrossEmptyLines
9
+ AlignConsecutiveDeclarations: Consecutive
10
+
11
+ AlignEscapedNewlines: Left
12
+ AlignOperands: Align
13
+
14
+ AlignTrailingComments: true
15
+ AllowAllArgumentsOnNextLine: false
16
+ AllowAllParametersOfDeclarationOnNextLine: true
17
+
18
+ AllowShortEnumsOnASingleLine: true
19
+ AllowShortBlocksOnASingleLine: Empty
20
+ AllowShortCaseLabelsOnASingleLine: false
21
+ AllowShortFunctionsOnASingleLine: Empty
22
+ AllowShortIfStatementsOnASingleLine: WithoutElse
23
+ AllowShortLoopsOnASingleLine: true
24
+ AlwaysBreakAfterReturnType: None
25
+ AlwaysBreakBeforeMultilineStrings: false
26
+
27
+ BinPackArguments: true
28
+ BinPackParameters: true
29
+
30
+ BreakBeforeBraces: Allman
31
+
32
+ BreakBeforeBinaryOperators: None
33
+ BreakBeforeTernaryOperators: false
34
+ BreakStringLiterals: true
35
+ ColumnLimit: 120
36
+ ContinuationIndentWidth: 4
37
+ DeriveLineEnding: true
38
+ DerivePointerAlignment: false
39
+ DisableFormat: false
40
+
41
+ ForEachMacros:
42
+ - foreach
43
+
44
+ SortIncludes: true
45
+ IncludeBlocks: Regroup
46
+
47
+ IndentCaseLabels: true
48
+ IndentCaseBlocks: false
49
+ IndentGotoLabels: false
50
+ IndentPPDirectives: None
51
+ IndentExternBlock: NoIndent
52
+ IndentWidth: 4
53
+ IndentWrappedFunctionNames: true
54
+ KeepEmptyLinesAtTheStartOfBlocks: false
55
+ MacroBlockBegin: ''
56
+ MacroBlockEnd: ''
57
+ MaxEmptyLinesToKeep: 1
58
+
59
+ PenaltyBreakAssignment: 9
60
+ PenaltyBreakBeforeFirstCallParameter: 19
61
+ PenaltyBreakComment: 300
62
+ PenaltyBreakFirstLessLess: 120
63
+ PenaltyBreakString: 1000
64
+ PenaltyExcessCharacter: 1000000
65
+ PenaltyReturnTypeOnItsOwnLine: 60
66
+ PenaltyIndentedWhitespace: 0
67
+ PointerAlignment: Right
68
+ ReflowComments: true
69
+ RemoveBracesLLVM: false
70
+ SeparateDefinitionBlocks: Always
71
+
72
+ SpaceAfterCStyleCast: false
73
+ SpaceAfterLogicalNot: false
74
+ SpaceBeforeAssignmentOperators: true
75
+ SpaceBeforeCaseColon: false
76
+ SpaceBeforeParens: ControlStatementsExceptForEachMacros
77
+ SpaceAroundPointerQualifiers: Default
78
+ SpaceInEmptyBlock: false
79
+ SpaceInEmptyParentheses: false
80
+ SpacesBeforeTrailingComments: 1
81
+ SpacesInConditionalStatement: false
82
+ SpacesInCStyleCastParentheses: false
83
+ SpacesInParentheses: false
84
+ SpacesInSquareBrackets: false
85
+ SpaceBeforeSquareBrackets: false
86
+ BitFieldColonSpacing: Both
87
+
88
+ TabWidth: 4
89
+ UseCRLF: false
90
+ UseTab: Never
91
+ WhitespaceSensitiveMacros:
92
+ - STRINGIZE
93
+ - PP_STRINGIZE
@@ -0,0 +1,10 @@
1
+ Checks: >
2
+ -*,
3
+ clang-analyzer-*,
4
+ bugprone-*,
5
+ -bugprone-easily-swappable-parameters,
6
+ -bugprone-signed-bitwise,
7
+ -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
8
+ WarningsAsErrors: ''
9
+ HeaderFilterRegex: '.*/include/minscan/.*'
10
+ FormatStyle: file
@@ -0,0 +1,18 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ indent_style = space
8
+ indent_size = 4
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.{c,h}]
12
+ indent_size = 4
13
+
14
+ [meson.build]
15
+ indent_size = 2
16
+
17
+ [*.md]
18
+ trim_trailing_whitespace = false
@@ -0,0 +1,2 @@
1
+ # formatting run
2
+ 9b4aae865cbe9fb505bddf5da35af3e46241504f
@@ -0,0 +1,108 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ concurrency:
10
+ group: ci-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ linux:
15
+ name: Linux (gcc)
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+
20
+ - uses: actions/setup-python@v7
21
+ with:
22
+ python-version: "3.13"
23
+
24
+ - name: Install build tools
25
+ run: python -m pip install --upgrade pip meson ninja
26
+
27
+ - name: Configure
28
+ run: meson setup build --wrap-mode=forcefallback
29
+
30
+ - name: Build
31
+ run: meson compile -C build
32
+
33
+ - name: Test
34
+ run: meson test -C build --suite minscan --print-errorlogs
35
+
36
+ sanitizers:
37
+ name: Linux (ASan + UBSan)
38
+ runs-on: ubuntu-24.04
39
+ steps:
40
+ - uses: actions/checkout@v7
41
+
42
+ - uses: actions/setup-python@v7
43
+ with:
44
+ python-version: "3.13"
45
+
46
+ - name: Install build tools
47
+ run: python -m pip install --upgrade pip meson ninja
48
+
49
+ - name: Configure
50
+ run: meson setup build -Db_sanitize=address,undefined -Dbuildtype=debug --wrap-mode=forcefallback
51
+
52
+ - name: Build
53
+ run: meson compile -C build
54
+
55
+ - name: Test
56
+ run: meson test -C build --suite minscan --print-errorlogs
57
+
58
+ windows-cross:
59
+ name: Windows (mingw cross build)
60
+ runs-on: ubuntu-24.04
61
+ steps:
62
+ - uses: actions/checkout@v7
63
+
64
+ - uses: actions/setup-python@v7
65
+ with:
66
+ python-version: "3.13"
67
+
68
+ - name: Install build tools
69
+ run: |
70
+ sudo apt-get update
71
+ sudo apt-get install -y gcc-mingw-w64-x86-64
72
+ python -m pip install --upgrade pip meson ninja
73
+
74
+ - name: Configure
75
+ run: >-
76
+ meson setup --cross-file cross/mingw.ini build-win
77
+ -Dbuild_cli=true -Dbuild_tests=false
78
+
79
+ - name: Build
80
+ run: meson compile -C build-win
81
+
82
+ - name: Verify artifacts
83
+ run: |
84
+ test -f build-win/minscan.exe
85
+ test -f build-win/libminscan.dll
86
+ x86_64-w64-mingw32-objdump -p build-win/minscan.exe | grep -q SETUPAPI.dll
87
+ x86_64-w64-mingw32-nm build-win/libminscan.dll | grep -q " T ms_open"
88
+
89
+ wheel:
90
+ name: Python wheel smoke test
91
+ runs-on: ubuntu-24.04
92
+ steps:
93
+ - uses: actions/checkout@v7
94
+
95
+ - uses: actions/setup-python@v7
96
+ with:
97
+ python-version: "3.13"
98
+
99
+ - name: Build wheel
100
+ run: |
101
+ python -m pip install --upgrade pip build
102
+ python -m build --wheel
103
+
104
+ - name: Install and import
105
+ run: |
106
+ python -m venv /tmp/wheel-venv
107
+ /tmp/wheel-venv/bin/pip install dist/*.whl
108
+ /tmp/wheel-venv/bin/python -c "import minscan; print(minscan.__version__)"
@@ -0,0 +1,71 @@
1
+ name: Wheels
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+
8
+ concurrency:
9
+ group: wheels-${{ github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ build_wheels:
14
+ name: Build manylinux wheels
15
+ runs-on: ubuntu-24.04
16
+ steps:
17
+ - uses: actions/checkout@v7
18
+
19
+ - name: Build wheels
20
+ uses: pypa/cibuildwheel@v4.3.5
21
+ env:
22
+ CIBW_BUILD: "cp313-manylinux_x86_64 cp314-manylinux_x86_64"
23
+ CIBW_ARCHS_LINUX: x86_64
24
+ CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
25
+ CIBW_TEST_COMMAND: "python -c 'import minscan; print(minscan.__version__)'"
26
+ CIBW_BUILD_VERBOSITY: 1
27
+
28
+ - uses: actions/upload-artifact@v4
29
+ with:
30
+ name: wheels
31
+ path: wheelhouse/*.whl
32
+
33
+ build_sdist:
34
+ name: Build sdist
35
+ runs-on: ubuntu-24.04
36
+ steps:
37
+ - uses: actions/checkout@v7
38
+
39
+ - uses: actions/setup-python@v7
40
+ with:
41
+ python-version: "3.13"
42
+
43
+ - name: Build sdist
44
+ run: |
45
+ python -m pip install --upgrade pip build
46
+ python -m build --sdist
47
+
48
+ - uses: actions/upload-artifact@v4
49
+ with:
50
+ name: sdist
51
+ path: dist/*.tar.gz
52
+
53
+ publish:
54
+ name: Publish to PyPI
55
+ needs: [build_wheels, build_sdist]
56
+ if: startsWith(github.ref, 'refs/tags/v')
57
+ runs-on: ubuntu-24.04
58
+ environment:
59
+ name: pypi
60
+ url: https://pypi.org/p/minscan
61
+ permissions:
62
+ id-token: write
63
+ steps:
64
+ - uses: actions/download-artifact@v4
65
+ with:
66
+ path: dist
67
+ merge-multiple: true
68
+
69
+ - uses: pypa/gh-action-pypi-publish@release/v1
70
+ with:
71
+ packages-dir: dist
@@ -0,0 +1,49 @@
1
+ # Meson/Ninja
2
+ build*/
3
+ meson-logs/
4
+ meson-private/
5
+ compile_commands.json
6
+ compile_commands.json.tmp
7
+ subprojects/*
8
+ !subprojects/*.wrap
9
+ !subprojects/packagefiles/
10
+
11
+ # Objects and binaries
12
+ *.o
13
+ *.a
14
+ *.so
15
+ *.so.*
16
+ *.dylib
17
+ *.dll
18
+ *.exe
19
+ *.pdb
20
+ /minscan
21
+ /test_cdb
22
+ /test_pages
23
+ /test_descriptor
24
+ /tests/test_cdb
25
+ /tests/test_pages
26
+ /tests/test_descriptor
27
+
28
+ # Captures / test output
29
+ *.raw
30
+ *.tif
31
+ *.tiff
32
+ *.log
33
+ core.*
34
+ vgcore.*
35
+ perf.data
36
+ perf.data.old
37
+
38
+ # Editors / tooling
39
+ .cache/
40
+ .clangd/
41
+ .vscode/
42
+ .idea/
43
+ *.swp
44
+ *.swo
45
+ *~
46
+ .DS_Store
47
+
48
+ __pycache__
49
+ .pytest_cache
minscan-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Toesoe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
minscan-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.1
2
+ Name: minscan
3
+ Version: 0.1.0
4
+ Summary: Python bindings for the Minolta DiMAGE minscan C library
5
+ Author-Email: Toesoe <code@toesoe.dev>
6
+ License: MIT
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: End Users/Desktop
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Programming Language :: C
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Topic :: Multimedia :: Graphics :: Capture :: Scanners
14
+ Project-URL: Homepage, https://github.com/toesoe/minscan
15
+ Project-URL: Repository, https://github.com/toesoe/minscan
16
+ Requires-Python: >=3.13
17
+ Requires-Dist: cffi>=1.17
18
+ Requires-Dist: numpy>=2.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ # minscan
22
+
23
+ a clean C23 userland driver for Minolta DiMAGE film scanners. created with a _lot_ of reverse engineering and a few evenings of protocol analysis. this tool supports all scanner features that DiMAGE Scan exposes.
24
+
25
+ currently only supports the DiMAGE SCAN Multi PRO (AF-5000), as that's the unit I have. I suspect that all scanners use more or less the same protocol. the tool needs a bit of rework in order to add multi-scanner support, that's on the to-do list.
26
+
27
+ minscan supports Linux and Windows. Apple ditched Firewire support in macOS so there's no support builtin for now. for Windows you will need a driver, see misc/minolta.inf, that should be sufficient.
28
+
29
+ ## notes
30
+
31
+ ice is LLM-ported from nkscan (give me a break, I suck at math), currently singlethreaded, and slow as balls (think ~30 secs for a 6x9 frame). I wrote the frame layout with SIMD in mind as well so let's see how much speed I can push out of this thing. for now, negpy's IR routines are _way_ better than what I cooked up so if you care about quality give that a shot.
32
+
33
+ ## build
34
+
35
+ ```sh
36
+ meson setup build
37
+ ninja -C build
38
+ meson test -C build --print-errorlogs
39
+ ```
40
+
41
+ debug with sanitizers:
42
+
43
+ ```sh
44
+ meson setup build-asan -Db_sanitize=address,undefined -Dbuildtype=debug
45
+ ninja -C build-asan
46
+ meson test -C build-asan
47
+ ```
48
+
49
+ ## usage
50
+
51
+ make sure you have the sg module loaded into your kernel first. `--device` is optional: without it minscan looks for the Minolta scanner itself (`/sys/class/scsi_generic` on Linux, the SCSI port driver on Windows). for a regular scan of a 6x9 color negative, IR channel in the 4th layer, using the HA-P1 glass holder:
52
+
53
+ ```sh
54
+ ./minscan scan -s 6x9 --filmtype colorneg --dpi 3200 --focus auto --rgbi output.tiff
55
+ ```
56
+
57
+ pass `-d /dev/sg1` (or `-d '\\.\Scanner0'` on Windows) to select a device explicitly.
58
+
59
+ <details>
60
+ <summary><code>minscan help</code></summary>
61
+
62
+ ```text
63
+ focus focus sweep
64
+ scan acquire a frame
65
+ eject eject carrier
66
+ help output usage information
67
+ probe probe the scanner
68
+ ```
69
+ </details>
70
+
71
+ <details>
72
+ <summary><code>minscan scan --help</code></summary>
73
+
74
+ ```text
75
+ scan: acquire a frame
76
+ Usage:
77
+ minscan [-h|--help] [-d|--device=<device>] [-p|--prescan] -s|--size=<6x45|6x6|6x7|6x8|6x9|35mm> [-g|--glassless] -r|--dpi=<dpi> [-e|-v|--exposure_value=<-2.5...2.5>] [-f|--focus=<-250...250|auto>] [--frame=<frame>] --filmtype=<colorneg|colorpos|bw> [--ir] [--ice] [--rgbi] [--calibrate] [--verbose] <file>
78
+
79
+ Available options:
80
+ -h, --help show this help
81
+ -d, --device=<device> SCSI device (default: autodetect)
82
+ -p, --prescan grab a low-res prescan instead of a full scan
83
+ -s, --size=<6x45|6x6|6x7|6x8|6x9|35mm> film size (carrier is autodetected)
84
+ -g, --glassless use the HA-P2 insert instead of HA-P1 (120 only)
85
+ -r, --dpi=<dpi> DPI for scan (must divide 4800 for 35mm or 3200 for 120)
86
+ -e, -v, --exposure_value=<-2.5...2.5> exposure compensation (stops). defaults to 0
87
+ -f, --focus=<-250...250|auto> auto to perform autofocus, or a manual value. defaults to stored device value
88
+ --frame=<frame> frame to scan (35mm: 1..6, 120: 1; default 1)
89
+ --filmtype=<colorneg|colorpos|bw> film type (changes exposure curves)
90
+ --ir acquire IR; write a separate _IR TIFF (also with --rgbi)
91
+ --ice run ICE dust/scratch removal. acquires IR; the IR plane is written only with --ir or --rgbi
92
+ --rgbi write one 64-bit RGBI TIFF (acquires IR; sidecar only with --ir)
93
+ --calibrate force refresh the scanner's dark/light calibration data
94
+ --verbose show info log lines (ICE rebuild stats, row counts)
95
+ <file> output file
96
+ ```
97
+
98
+ IR/ICE output combinations:
99
+
100
+ ```text
101
+ --ir RGB + _IR sidecar
102
+ --rgbi 4-channel RGBI
103
+ --ir --rgbi RGBI + _IR sidecar
104
+ --ice RGB (IR discarded after ICE)
105
+ --ir --ice RGB + _IR sidecar
106
+ --rgbi --ice RGBI (ICE applied to the RGB planes; IR kept as channel 4)
107
+ ```
108
+ </details>
109
+
110
+ ## layout
111
+
112
+ ```text
113
+ include/minscan/ internal interfaces
114
+ src/core/ portable protocol/descriptor/session/image code
115
+ src/platform/ platform-specific abstractions
116
+ src/transport/ OS-specific SCSI passthrough backends
117
+ tests/ golden CDB/page/descriptor tests
118
+ ```
119
+
120
+ ## contributing
121
+
122
+ yes, please! do mark your PRs as AI-generated if they are, though; I'm not against LLM use, I used my fair share of them to simplify the RE and wire analysis as well as the math (and I haven't written a test since 2024 or so :D) but I like to know who (or in this case, what) created the code I'm looking at.
123
+
124
+ ## other projects you may like
125
+
126
+ - [nkscan](https://github.com/activexray/nkscan) - the one that finally got me to pull the trigger on this project to get rid of Windows once and for all, and the source of the ICE implementation used in minscan
@@ -0,0 +1,106 @@
1
+ # minscan
2
+
3
+ a clean C23 userland driver for Minolta DiMAGE film scanners. created with a _lot_ of reverse engineering and a few evenings of protocol analysis. this tool supports all scanner features that DiMAGE Scan exposes.
4
+
5
+ currently only supports the DiMAGE SCAN Multi PRO (AF-5000), as that's the unit I have. I suspect that all scanners use more or less the same protocol. the tool needs a bit of rework in order to add multi-scanner support, that's on the to-do list.
6
+
7
+ minscan supports Linux and Windows. Apple ditched Firewire support in macOS so there's no support builtin for now. for Windows you will need a driver, see misc/minolta.inf, that should be sufficient.
8
+
9
+ ## notes
10
+
11
+ ice is LLM-ported from nkscan (give me a break, I suck at math), currently singlethreaded, and slow as balls (think ~30 secs for a 6x9 frame). I wrote the frame layout with SIMD in mind as well so let's see how much speed I can push out of this thing. for now, negpy's IR routines are _way_ better than what I cooked up so if you care about quality give that a shot.
12
+
13
+ ## build
14
+
15
+ ```sh
16
+ meson setup build
17
+ ninja -C build
18
+ meson test -C build --print-errorlogs
19
+ ```
20
+
21
+ debug with sanitizers:
22
+
23
+ ```sh
24
+ meson setup build-asan -Db_sanitize=address,undefined -Dbuildtype=debug
25
+ ninja -C build-asan
26
+ meson test -C build-asan
27
+ ```
28
+
29
+ ## usage
30
+
31
+ make sure you have the sg module loaded into your kernel first. `--device` is optional: without it minscan looks for the Minolta scanner itself (`/sys/class/scsi_generic` on Linux, the SCSI port driver on Windows). for a regular scan of a 6x9 color negative, IR channel in the 4th layer, using the HA-P1 glass holder:
32
+
33
+ ```sh
34
+ ./minscan scan -s 6x9 --filmtype colorneg --dpi 3200 --focus auto --rgbi output.tiff
35
+ ```
36
+
37
+ pass `-d /dev/sg1` (or `-d '\\.\Scanner0'` on Windows) to select a device explicitly.
38
+
39
+ <details>
40
+ <summary><code>minscan help</code></summary>
41
+
42
+ ```text
43
+ focus focus sweep
44
+ scan acquire a frame
45
+ eject eject carrier
46
+ help output usage information
47
+ probe probe the scanner
48
+ ```
49
+ </details>
50
+
51
+ <details>
52
+ <summary><code>minscan scan --help</code></summary>
53
+
54
+ ```text
55
+ scan: acquire a frame
56
+ Usage:
57
+ minscan [-h|--help] [-d|--device=<device>] [-p|--prescan] -s|--size=<6x45|6x6|6x7|6x8|6x9|35mm> [-g|--glassless] -r|--dpi=<dpi> [-e|-v|--exposure_value=<-2.5...2.5>] [-f|--focus=<-250...250|auto>] [--frame=<frame>] --filmtype=<colorneg|colorpos|bw> [--ir] [--ice] [--rgbi] [--calibrate] [--verbose] <file>
58
+
59
+ Available options:
60
+ -h, --help show this help
61
+ -d, --device=<device> SCSI device (default: autodetect)
62
+ -p, --prescan grab a low-res prescan instead of a full scan
63
+ -s, --size=<6x45|6x6|6x7|6x8|6x9|35mm> film size (carrier is autodetected)
64
+ -g, --glassless use the HA-P2 insert instead of HA-P1 (120 only)
65
+ -r, --dpi=<dpi> DPI for scan (must divide 4800 for 35mm or 3200 for 120)
66
+ -e, -v, --exposure_value=<-2.5...2.5> exposure compensation (stops). defaults to 0
67
+ -f, --focus=<-250...250|auto> auto to perform autofocus, or a manual value. defaults to stored device value
68
+ --frame=<frame> frame to scan (35mm: 1..6, 120: 1; default 1)
69
+ --filmtype=<colorneg|colorpos|bw> film type (changes exposure curves)
70
+ --ir acquire IR; write a separate _IR TIFF (also with --rgbi)
71
+ --ice run ICE dust/scratch removal. acquires IR; the IR plane is written only with --ir or --rgbi
72
+ --rgbi write one 64-bit RGBI TIFF (acquires IR; sidecar only with --ir)
73
+ --calibrate force refresh the scanner's dark/light calibration data
74
+ --verbose show info log lines (ICE rebuild stats, row counts)
75
+ <file> output file
76
+ ```
77
+
78
+ IR/ICE output combinations:
79
+
80
+ ```text
81
+ --ir RGB + _IR sidecar
82
+ --rgbi 4-channel RGBI
83
+ --ir --rgbi RGBI + _IR sidecar
84
+ --ice RGB (IR discarded after ICE)
85
+ --ir --ice RGB + _IR sidecar
86
+ --rgbi --ice RGBI (ICE applied to the RGB planes; IR kept as channel 4)
87
+ ```
88
+ </details>
89
+
90
+ ## layout
91
+
92
+ ```text
93
+ include/minscan/ internal interfaces
94
+ src/core/ portable protocol/descriptor/session/image code
95
+ src/platform/ platform-specific abstractions
96
+ src/transport/ OS-specific SCSI passthrough backends
97
+ tests/ golden CDB/page/descriptor tests
98
+ ```
99
+
100
+ ## contributing
101
+
102
+ yes, please! do mark your PRs as AI-generated if they are, though; I'm not against LLM use, I used my fair share of them to simplify the RE and wire analysis as well as the math (and I haven't written a test since 2024 or so :D) but I like to know who (or in this case, what) created the code I'm looking at.
103
+
104
+ ## other projects you may like
105
+
106
+ - [nkscan](https://github.com/activexray/nkscan) - the one that finally got me to pull the trigger on this project to get rid of Windows once and for all, and the source of the ICE implementation used in minscan
@@ -0,0 +1,12 @@
1
+ # meson setup --cross-file cross/mingw.ini build-win -Dbuild_cli=true -Dbuild_tests=false
2
+ [binaries]
3
+ c = 'x86_64-w64-mingw32-gcc'
4
+ ar = 'x86_64-w64-mingw32-ar'
5
+ strip = 'x86_64-w64-mingw32-strip'
6
+ windres = 'x86_64-w64-mingw32-windres'
7
+
8
+ [host_machine]
9
+ system = 'windows'
10
+ cpu_family = 'x86_64'
11
+ cpu = 'x86_64'
12
+ endian = 'little'