com.wallstop-studios.unity-helpers 2.0.0-rc81.7 → 2.0.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.
Files changed (1500) hide show
  1. package/.config/dotnet-tools.json +10 -10
  2. package/.csharpierignore +1 -0
  3. package/.csharpierrc.json +3 -0
  4. package/.editorconfig +184 -184
  5. package/.gitattributes +87 -63
  6. package/.githooks/pre-commit +75 -0
  7. package/.githooks/pre-push +50 -0
  8. package/.github/dependabot.yml +32 -10
  9. package/.github/scripts/check-markdown-links.ps1 +77 -0
  10. package/.github/scripts/check_markdown_links.py +89 -0
  11. package/.github/scripts/check_markdown_url_encoding.py +74 -0
  12. package/.github/scripts/validate_markdown_links.py +194 -0
  13. package/.github/workflows/csharpier-autofix.yml +152 -0
  14. package/.github/workflows/format-on-demand.yml +305 -0
  15. package/.github/workflows/lint-doc-links.yml +30 -0
  16. package/.github/workflows/markdown-json.yml +45 -0
  17. package/.github/workflows/npm-publish.yml +75 -75
  18. package/.github/workflows/prettier-autofix.yml +195 -0
  19. package/.github/workflows/update-dotnet-tools.yml +80 -0
  20. package/.github/workflows/yaml-format-lint.yml +41 -0
  21. package/.lychee.toml +26 -0
  22. package/.markdownlint.json +21 -0
  23. package/.markdownlint.jsonc +21 -0
  24. package/.markdownlintignore +8 -0
  25. package/.pre-commit-config.yaml +47 -22
  26. package/.prettierignore +22 -0
  27. package/.prettierrc.json +20 -0
  28. package/.yamllint.yaml +31 -0
  29. package/AGENTS.md +56 -0
  30. package/{Third Party Notices.md.meta → AGENTS.md.meta} +7 -7
  31. package/CHANGELOG.md +11 -0
  32. package/CHANGELOG.md.meta +7 -7
  33. package/CONTRIBUTING.md +49 -0
  34. package/CONTRIBUTING.md.meta +7 -0
  35. package/DATA_STRUCTURES.md +324 -0
  36. package/DATA_STRUCTURES.md.meta +7 -0
  37. package/Docs/Images/attribute_resolution.svg +40 -0
  38. package/Docs/Images/attribute_resolution.svg.meta +7 -0
  39. package/Docs/Images/bitset.svg +47 -0
  40. package/Docs/Images/bitset.svg.meta +7 -0
  41. package/Docs/Images/concave_hull.svg +30 -0
  42. package/Docs/Images/concave_hull.svg.meta +7 -0
  43. package/Docs/Images/convex_hull.svg +29 -0
  44. package/Docs/Images/convex_hull.svg.meta +7 -0
  45. package/Docs/Images/cyclic_buffer.svg +37 -0
  46. package/Docs/Images/cyclic_buffer.svg.meta +7 -0
  47. package/Docs/Images/data_distribution_decision.svg +88 -0
  48. package/Docs/Images/data_distribution_decision.svg.meta +7 -0
  49. package/Docs/Images/deque.svg +64 -0
  50. package/Docs/Images/deque.svg.meta +7 -0
  51. package/Docs/Images/deque_queue.svg +107 -0
  52. package/Docs/Images/deque_queue.svg.meta +7 -0
  53. package/Docs/Images/disjoint_set.svg +47 -0
  54. package/Docs/Images/disjoint_set.svg.meta +7 -0
  55. package/Docs/Images/effects_pipeline.svg +59 -0
  56. package/Docs/Images/effects_pipeline.svg.meta +7 -0
  57. package/Docs/Images/geometry_edge_cases.svg +61 -0
  58. package/Docs/Images/geometry_edge_cases.svg.meta +7 -0
  59. package/Docs/Images/heap.svg +56 -0
  60. package/Docs/Images/heap.svg.meta +7 -0
  61. package/Docs/Images/kdtree_2d.svg +38 -0
  62. package/Docs/Images/kdtree_2d.svg.meta +7 -0
  63. package/Docs/Images/kdtree_3d.svg +83 -0
  64. package/Docs/Images/kdtree_3d.svg.meta +7 -0
  65. package/Docs/Images/octree_3d.svg +79 -0
  66. package/Docs/Images/octree_3d.svg.meta +7 -0
  67. package/Docs/Images/polyline_simplify.svg +18 -0
  68. package/Docs/Images/polyline_simplify.svg.meta +7 -0
  69. package/Docs/Images/quadtree_2d.svg +37 -0
  70. package/Docs/Images/quadtree_2d.svg.meta +7 -0
  71. package/Docs/Images/query_boundaries.svg +38 -0
  72. package/Docs/Images/query_boundaries.svg.meta +7 -0
  73. package/Docs/Images/random_generators.svg +105 -0
  74. package/Docs/Images/random_generators.svg.meta +7 -0
  75. package/Docs/Images/reflection_scan.svg +33 -0
  76. package/Docs/Images/reflection_scan.svg.meta +7 -0
  77. package/Docs/Images/relational_wiring.svg +75 -0
  78. package/Docs/Images/relational_wiring.svg.meta +7 -0
  79. package/Docs/Images/rtree_2d.svg +27 -0
  80. package/Docs/Images/rtree_2d.svg.meta +7 -0
  81. package/Docs/Images/rtree_3d.svg +79 -0
  82. package/Docs/Images/rtree_3d.svg.meta +7 -0
  83. package/Docs/Images/serialization_flow.svg +50 -0
  84. package/Docs/Images/serialization_flow.svg.meta +7 -0
  85. package/Docs/Images/singletons_lifecycle.svg +54 -0
  86. package/Docs/Images/singletons_lifecycle.svg.meta +7 -0
  87. package/Docs/Images/sparse_set.svg +54 -0
  88. package/Docs/Images/sparse_set.svg.meta +7 -0
  89. package/Docs/Images/trie.svg +55 -0
  90. package/Docs/Images/trie.svg.meta +7 -0
  91. package/Docs/Images.meta +8 -0
  92. package/Docs.meta +8 -0
  93. package/EDITOR_TOOLS_GUIDE.md +1980 -0
  94. package/EDITOR_TOOLS_GUIDE.md.meta +7 -0
  95. package/EFFECTS_SYSTEM.md +242 -0
  96. package/EFFECTS_SYSTEM.md.meta +7 -0
  97. package/EFFECTS_SYSTEM_TUTORIAL.md +467 -0
  98. package/EFFECTS_SYSTEM_TUTORIAL.md.meta +7 -0
  99. package/Editor/AnimationEventEditor.cs +1570 -874
  100. package/Editor/AnimationEventEditor.cs.meta +11 -11
  101. package/Editor/AssemblyInfo.cs +4 -0
  102. package/Editor/AssemblyInfo.cs.meta +3 -0
  103. package/Editor/AssetProcessors/SpriteLabelProcessor.cs +138 -111
  104. package/Editor/AssetProcessors/SpriteLabelProcessor.cs.meta +2 -2
  105. package/Editor/AssetProcessors.meta +2 -2
  106. package/Editor/Core/Helper/AnimationEventHelpers.cs +230 -0
  107. package/{Runtime/Core/DataStructure/ISpatialTree.cs.meta → Editor/Core/Helper/AnimationEventHelpers.cs.meta} +11 -11
  108. package/Editor/Core/Helper.meta +8 -0
  109. package/Editor/Core.meta +8 -0
  110. package/Editor/CustomDrawers/IntDropdownDrawer.cs +46 -46
  111. package/Editor/CustomDrawers/IntDropdownDrawer.cs.meta +2 -2
  112. package/Editor/CustomDrawers/StringInListeDrawer.cs +135 -135
  113. package/Editor/CustomDrawers/StringInListeDrawer.cs.meta +2 -2
  114. package/Editor/CustomDrawers/WShowIfPropertyDrawer.cs +105 -105
  115. package/Editor/CustomDrawers/WShowIfPropertyDrawer.cs.meta +2 -2
  116. package/Editor/CustomDrawers.meta +2 -2
  117. package/Editor/CustomEditors/MatchColliderToSpriteEditor.cs +32 -32
  118. package/Editor/CustomEditors/MatchColliderToSpriteEditor.cs.meta +2 -2
  119. package/Editor/CustomEditors/PersistentDirectoryGUI.cs +808 -799
  120. package/Editor/CustomEditors/PersistentDirectoryGUI.cs.meta +2 -2
  121. package/Editor/CustomEditors/PolygonCollider2DOptimizerEditor.cs +38 -40
  122. package/Editor/CustomEditors/PolygonCollider2DOptimizerEditor.cs.meta +2 -2
  123. package/Editor/CustomEditors/SourceFolderEntryDrawer.cs +685 -413
  124. package/Editor/CustomEditors/SourceFolderEntryDrawer.cs.meta +2 -2
  125. package/Editor/CustomEditors/TexturePlatformOverrideEntryDrawer.cs +155 -0
  126. package/{Runtime/Core/DataStructure/KDTree.cs.meta → Editor/CustomEditors/TexturePlatformOverrideEntryDrawer.cs.meta} +11 -11
  127. package/Editor/CustomEditors.meta +2 -2
  128. package/Editor/Extensions/SerializedPropertyExtensions.cs +217 -190
  129. package/Editor/Extensions/SerializedPropertyExtensions.cs.meta +2 -2
  130. package/Editor/Extensions/UnityExtensions.cs +50 -26
  131. package/Editor/Extensions/UnityExtensions.cs.meta +2 -2
  132. package/Editor/Extensions.meta +2 -2
  133. package/Editor/FitTextureSizeWindow.cs +809 -332
  134. package/Editor/FitTextureSizeWindow.cs.meta +2 -2
  135. package/Editor/Persistence/MultiFileSelectorPersistenceManager.cs +62 -0
  136. package/{Runtime/Core/DataStructure/QuadTree.cs.meta → Editor/Persistence/MultiFileSelectorPersistenceManager.cs.meta} +11 -11
  137. package/Editor/Persistence/MultiFileSelectorPersistenceWindow.cs +65 -0
  138. package/Editor/Persistence/MultiFileSelectorPersistenceWindow.cs.meta +11 -0
  139. package/Editor/Persistence.meta +8 -0
  140. package/Editor/PersistentDirectorySettings.cs +581 -248
  141. package/Editor/PersistentDirectorySettings.cs.meta +2 -2
  142. package/Editor/PrefabChecker.cs +1396 -741
  143. package/Editor/PrefabChecker.cs.meta +11 -11
  144. package/Editor/Sprites/AnimationCopier.cs +1594 -789
  145. package/Editor/Sprites/AnimationCopier.cs.meta +2 -2
  146. package/Editor/Sprites/AnimationCreator.cs +1573 -881
  147. package/Editor/Sprites/AnimationCreator.cs.meta +11 -11
  148. package/Editor/Sprites/AnimationViewerWindow.cs +1670 -1522
  149. package/Editor/Sprites/AnimationViewerWindow.cs.meta +2 -2
  150. package/Editor/Sprites/ScriptableSpriteAtlas.cs +251 -178
  151. package/Editor/Sprites/ScriptableSpriteAtlas.cs.meta +2 -2
  152. package/Editor/Sprites/ScriptableSpriteAtlasEditor.cs +1470 -1026
  153. package/Editor/Sprites/ScriptableSpriteAtlasEditor.cs.meta +2 -2
  154. package/Editor/Sprites/SpriteCropper.cs +1013 -523
  155. package/Editor/Sprites/SpriteCropper.cs.meta +2 -2
  156. package/Editor/Sprites/SpritePivotAdjustor.cs +605 -265
  157. package/Editor/Sprites/SpritePivotAdjustor.cs.meta +2 -2
  158. package/Editor/Sprites/SpriteSettingsApplier.cs +942 -918
  159. package/Editor/Sprites/SpriteSettingsApplier.cs.meta +2 -2
  160. package/Editor/Sprites/SpriteSettingsApplierAPI.cs +441 -0
  161. package/Editor/Sprites/SpriteSettingsApplierAPI.cs.meta +11 -0
  162. package/Editor/Sprites/SpriteSettingsProfileCollection.cs +12 -0
  163. package/Editor/Sprites/SpriteSettingsProfileCollection.cs.meta +11 -0
  164. package/Editor/Sprites/SpriteSheetAnimationCreator.cs +1586 -1537
  165. package/Editor/Sprites/SpriteSheetAnimationCreator.cs.meta +2 -2
  166. package/Editor/Sprites/TexturePlatformNameHelper.cs +89 -0
  167. package/Editor/Sprites/TexturePlatformNameHelper.cs.meta +11 -0
  168. package/Editor/Sprites/TextureResizerWizard.cs +456 -175
  169. package/Editor/Sprites/TextureResizerWizard.cs.meta +2 -2
  170. package/Editor/Sprites/TextureSettingsApplierAPI.cs +359 -0
  171. package/Editor/Sprites/TextureSettingsApplierAPI.cs.meta +11 -0
  172. package/Editor/Sprites/TextureSettingsApplierWindow.cs +668 -0
  173. package/Editor/Sprites/TextureSettingsApplierWindow.cs.meta +11 -0
  174. package/Editor/Sprites.meta +2 -2
  175. package/Editor/Styles/AnimationViewer.uss +115 -115
  176. package/Editor/Styles/AnimationViewer.uss.meta +2 -2
  177. package/Editor/Styles/AnimationViewer.uxml +56 -56
  178. package/Editor/Styles/AnimationViewer.uxml.meta +2 -2
  179. package/Editor/Styles/SpriteSheetAnimationCreator.uss +10 -0
  180. package/Editor/Styles/SpriteSheetAnimationCreator.uss.meta +11 -0
  181. package/Editor/Styles.meta +2 -2
  182. package/Editor/Tags/AttributeMetadataCacheEditor.cs +46 -0
  183. package/Editor/Tags/AttributeMetadataCacheEditor.cs.meta +11 -0
  184. package/Editor/Tags/AttributeMetadataCacheGenerator.cs +258 -0
  185. package/Editor/Tags/AttributeMetadataCacheGenerator.cs.meta +11 -0
  186. package/Editor/Tags.meta +8 -0
  187. package/Editor/Tools/ImageBlurTool.cs +522 -409
  188. package/Editor/Tools/ImageBlurTool.cs.meta +2 -2
  189. package/Editor/Tools.meta +2 -2
  190. package/Editor/Utils/DxReadOnlyPropertyDrawer.cs +26 -26
  191. package/Editor/Utils/DxReadOnlyPropertyDrawer.cs.meta +11 -11
  192. package/Editor/Utils/EditorUi.cs +228 -0
  193. package/Editor/Utils/EditorUi.cs.meta +11 -0
  194. package/Editor/Utils/EditorUtilities.cs +22 -22
  195. package/Editor/Utils/EditorUtilities.cs.meta +11 -11
  196. package/Editor/Utils/ScriptableObjectSingletonCreator.cs +633 -52
  197. package/Editor/Utils/ScriptableObjectSingletonCreator.cs.meta +2 -2
  198. package/Editor/Utils.meta +8 -8
  199. package/Editor/Visuals/EnhancedImageEditor.cs +160 -160
  200. package/Editor/Visuals/EnhancedImageEditor.cs.meta +11 -11
  201. package/Editor/Visuals.meta +2 -2
  202. package/Editor/WallstopStudios.UnityHelpers.Editor.asmdef +14 -18
  203. package/Editor/WallstopStudios.UnityHelpers.Editor.asmdef.meta +7 -7
  204. package/Editor.meta +8 -8
  205. package/GETTING_STARTED.md +409 -0
  206. package/GETTING_STARTED.md.meta +7 -0
  207. package/GLOSSARY.md +313 -0
  208. package/GLOSSARY.md.meta +7 -0
  209. package/HULLS.md +45 -0
  210. package/HULLS.md.meta +7 -0
  211. package/INDEX.md +429 -0
  212. package/INDEX.md.meta +7 -0
  213. package/LICENSE +21 -21
  214. package/LICENSE.md +7 -7
  215. package/LICENSE.md.meta +7 -7
  216. package/LICENSE.meta +7 -7
  217. package/MATH_AND_EXTENSIONS.md +316 -0
  218. package/MATH_AND_EXTENSIONS.md.meta +7 -0
  219. package/RANDOM_PERFORMANCE.md +140 -0
  220. package/RANDOM_PERFORMANCE.md.meta +7 -0
  221. package/README.md +1183 -188
  222. package/README.md.meta +7 -7
  223. package/REFLECTION_HELPERS.md +272 -0
  224. package/REFLECTION_HELPERS.md.meta +7 -0
  225. package/RELATIONAL_COMPONENTS.md +552 -0
  226. package/RELATIONAL_COMPONENTS.md.meta +7 -0
  227. package/Runtime/AssemblyInfo.cs +9 -0
  228. package/Runtime/AssemblyInfo.cs.meta +11 -0
  229. package/Runtime/Binaries/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  230. package/Runtime/Binaries/Microsoft.Bcl.AsyncInterfaces.dll.meta +33 -33
  231. package/Runtime/Binaries/Microsoft.Bcl.AsyncInterfaces.xml +499 -278
  232. package/Runtime/Binaries/Microsoft.Bcl.AsyncInterfaces.xml.meta +7 -7
  233. package/Runtime/Binaries/System.IO.Pipelines.dll +0 -0
  234. package/Runtime/Binaries/System.IO.Pipelines.dll.meta +33 -0
  235. package/Runtime/Binaries/System.IO.Pipelines.xml +702 -0
  236. package/Runtime/Binaries/System.IO.Pipelines.xml.meta +7 -0
  237. package/Runtime/Binaries/System.Text.Encodings.Web.dll +0 -0
  238. package/Runtime/Binaries/System.Text.Encodings.Web.dll.meta +33 -33
  239. package/Runtime/Binaries/System.Text.Encodings.Web.xml +1084 -1079
  240. package/Runtime/Binaries/System.Text.Encodings.Web.xml.meta +7 -7
  241. package/Runtime/Binaries/System.Text.Json.dll +0 -0
  242. package/Runtime/Binaries/System.Text.Json.dll.meta +33 -33
  243. package/Runtime/Binaries/System.Text.Json.xml +10217 -8116
  244. package/Runtime/Binaries/System.Text.Json.xml.meta +7 -7
  245. package/Runtime/Binaries.meta +8 -8
  246. package/Runtime/Core/Attributes/AnimationEventAttribute.cs +10 -138
  247. package/Runtime/Core/Attributes/AnimationEventAttribute.cs.meta +11 -11
  248. package/Runtime/Core/Attributes/BaseRelationalComponentAttribute.cs +841 -0
  249. package/Runtime/Core/Attributes/BaseRelationalComponentAttribute.cs.meta +11 -0
  250. package/Runtime/Core/Attributes/ChildComponentAttribute.cs +284 -226
  251. package/Runtime/Core/Attributes/ChildComponentAttribute.cs.meta +11 -11
  252. package/Runtime/Core/Attributes/DxReadOnlyAttribute.cs +6 -6
  253. package/Runtime/Core/Attributes/DxReadOnlyAttribute.cs.meta +11 -11
  254. package/Runtime/Core/Attributes/EnumDisplayNameAttribute.cs +15 -15
  255. package/Runtime/Core/Attributes/EnumDisplayNameAttribute.cs.meta +2 -2
  256. package/Runtime/Core/Attributes/IRelationalComponentAssigner.cs +36 -0
  257. package/Runtime/Core/Attributes/IRelationalComponentAssigner.cs.meta +11 -0
  258. package/Runtime/Core/Attributes/IntDropdownAttribute.cs +14 -14
  259. package/Runtime/Core/Attributes/IntDropdownAttribute.cs.meta +2 -2
  260. package/Runtime/Core/Attributes/KSerializableAttribute.cs +19 -19
  261. package/Runtime/Core/Attributes/KSerializableAttribute.cs.meta +11 -11
  262. package/Runtime/Core/Attributes/NotNullAttribute.cs +30 -32
  263. package/Runtime/Core/Attributes/NotNullAttribute.cs.meta +11 -11
  264. package/Runtime/Core/Attributes/ParentComponentAttribute.cs +376 -0
  265. package/Runtime/Core/Attributes/{ParentComponent.cs.meta → ParentComponentAttribute.cs.meta} +11 -11
  266. package/Runtime/Core/Attributes/RelationalComponentAssigner.cs +152 -0
  267. package/Runtime/Core/Attributes/RelationalComponentAssigner.cs.meta +11 -0
  268. package/Runtime/Core/Attributes/RelationalComponentExtensions.cs +61 -14
  269. package/Runtime/Core/Attributes/RelationalComponentExtensions.cs.meta +11 -11
  270. package/Runtime/Core/Attributes/RelationalComponentInitializer.cs +331 -0
  271. package/Runtime/Core/Attributes/RelationalComponentInitializer.cs.meta +11 -0
  272. package/Runtime/Core/Attributes/ScriptableSingletonPathAttribute.cs +15 -15
  273. package/Runtime/Core/Attributes/ScriptableSingletonPathAttribute.cs.meta +2 -2
  274. package/Runtime/Core/Attributes/SiblingComponentAttribute.cs +264 -137
  275. package/Runtime/Core/Attributes/SiblingComponentAttribute.cs.meta +11 -11
  276. package/Runtime/Core/Attributes/ValidateAssignmentAttribute.cs +115 -106
  277. package/Runtime/Core/Attributes/ValidateAssignmentAttribute.cs.meta +11 -11
  278. package/Runtime/Core/Attributes/ValueHelpers.cs +10 -0
  279. package/Runtime/Core/Attributes/ValueHelpers.cs.meta +3 -0
  280. package/Runtime/Core/Attributes/WShowIfAttribute.cs +24 -24
  281. package/Runtime/Core/Attributes/WShowIfAttribute.cs.meta +2 -2
  282. package/Runtime/Core/Attributes.meta +8 -8
  283. package/Runtime/Core/DataStructure/Adapters/FastVector2Int.cs +192 -92
  284. package/Runtime/Core/DataStructure/Adapters/FastVector2Int.cs.meta +11 -11
  285. package/Runtime/Core/DataStructure/Adapters/FastVector3Int.cs +268 -185
  286. package/Runtime/Core/DataStructure/Adapters/FastVector3Int.cs.meta +11 -11
  287. package/Runtime/Core/DataStructure/Adapters/KGuid.cs +360 -305
  288. package/Runtime/Core/DataStructure/Adapters/KGuid.cs.meta +11 -11
  289. package/Runtime/Core/DataStructure/Adapters/KVector2.cs +146 -80
  290. package/Runtime/Core/DataStructure/Adapters/KVector2.cs.meta +11 -11
  291. package/Runtime/Core/DataStructure/Adapters.meta +8 -8
  292. package/Runtime/Core/DataStructure/BitSet.cs +626 -0
  293. package/Runtime/Core/DataStructure/BitSet.cs.meta +11 -0
  294. package/Runtime/Core/DataStructure/BoundingBox3D.cs +405 -0
  295. package/Runtime/Core/DataStructure/BoundingBox3D.cs.meta +11 -0
  296. package/Runtime/Core/DataStructure/Circle.cs +203 -50
  297. package/Runtime/Core/DataStructure/Circle.cs.meta +11 -11
  298. package/Runtime/Core/DataStructure/CyclicBuffer.cs +488 -266
  299. package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +11 -11
  300. package/Runtime/Core/DataStructure/Deque.cs +561 -0
  301. package/Runtime/Core/DataStructure/Deque.cs.meta +11 -0
  302. package/Runtime/Core/DataStructure/DisjointSet.cs +483 -0
  303. package/Runtime/Core/DataStructure/DisjointSet.cs.meta +11 -0
  304. package/Runtime/Core/DataStructure/Heap.cs +514 -0
  305. package/Runtime/Core/DataStructure/Heap.cs.meta +11 -0
  306. package/Runtime/Core/DataStructure/{ISpatialTree.cs → ISpatialTree2D.cs} +25 -21
  307. package/Runtime/Core/DataStructure/ISpatialTree2D.cs.meta +11 -0
  308. package/Runtime/Core/DataStructure/ISpatialTree3D.cs +33 -0
  309. package/Runtime/Core/DataStructure/ISpatialTree3D.cs.meta +11 -0
  310. package/Runtime/Core/DataStructure/ImmutableBitSet.cs +398 -0
  311. package/Runtime/Core/DataStructure/ImmutableBitSet.cs.meta +3 -0
  312. package/Runtime/Core/DataStructure/KDTree2D.cs +852 -0
  313. package/Runtime/Core/DataStructure/KDTree2D.cs.meta +11 -0
  314. package/Runtime/Core/DataStructure/KDTree3D.cs +911 -0
  315. package/Runtime/Core/DataStructure/KDTree3D.cs.meta +11 -0
  316. package/Runtime/Core/DataStructure/OctTree3D.cs +983 -0
  317. package/Runtime/Core/DataStructure/OctTree3D.cs.meta +11 -0
  318. package/Runtime/Core/DataStructure/PriorityQueue.cs +194 -0
  319. package/Runtime/Core/DataStructure/PriorityQueue.cs.meta +11 -0
  320. package/Runtime/Core/DataStructure/QuadTree2D.cs +722 -0
  321. package/Runtime/Core/DataStructure/QuadTree2D.cs.meta +11 -0
  322. package/Runtime/Core/DataStructure/RTree2D.cs +704 -0
  323. package/Runtime/Core/DataStructure/{RTree.cs.meta → RTree2D.cs.meta} +11 -11
  324. package/Runtime/Core/DataStructure/RTree3D.cs +775 -0
  325. package/Runtime/Core/DataStructure/RTree3D.cs.meta +11 -0
  326. package/Runtime/Core/DataStructure/SparseSet.cs +597 -0
  327. package/Runtime/Core/DataStructure/SparseSet.cs.meta +11 -0
  328. package/Runtime/Core/DataStructure/SpatialHash2D.cs +312 -0
  329. package/Runtime/Core/DataStructure/SpatialHash2D.cs.meta +3 -0
  330. package/Runtime/Core/DataStructure/SpatialHash3D.cs +341 -0
  331. package/Runtime/Core/DataStructure/SpatialHash3D.cs.meta +11 -0
  332. package/Runtime/Core/DataStructure/Sphere.cs +264 -0
  333. package/Runtime/Core/DataStructure/Sphere.cs.meta +11 -0
  334. package/Runtime/Core/DataStructure/StringWrapper.cs +115 -91
  335. package/Runtime/Core/DataStructure/StringWrapper.cs.meta +11 -11
  336. package/Runtime/Core/DataStructure/TimedCache.cs +88 -66
  337. package/Runtime/Core/DataStructure/TimedCache.cs.meta +11 -11
  338. package/Runtime/Core/DataStructure/Trie.cs +660 -359
  339. package/Runtime/Core/DataStructure/Trie.cs.meta +2 -2
  340. package/Runtime/Core/DataStructure.meta +8 -8
  341. package/Runtime/Core/Extension/AnimatorExtensions.cs +40 -25
  342. package/Runtime/Core/Extension/AnimatorExtensions.cs.meta +11 -11
  343. package/Runtime/Core/Extension/AsyncOperationExtensions.cs +404 -110
  344. package/Runtime/Core/Extension/AsyncOperationExtensions.cs.meta +2 -2
  345. package/Runtime/Core/Extension/CircleExtensions.cs +125 -25
  346. package/Runtime/Core/Extension/CircleExtensions.cs.meta +11 -11
  347. package/Runtime/Core/Extension/ColorExtensions.cs +983 -644
  348. package/Runtime/Core/Extension/ColorExtensions.cs.meta +11 -11
  349. package/Runtime/Core/Extension/DictionaryExtensions.cs +606 -299
  350. package/Runtime/Core/Extension/DictionaryExtensions.cs.meta +11 -11
  351. package/Runtime/Core/Extension/DirectionExtensions.cs +377 -213
  352. package/Runtime/Core/Extension/DirectionExtensions.cs.meta +11 -11
  353. package/Runtime/Core/Extension/EnumExtensions.cs +535 -137
  354. package/Runtime/Core/Extension/EnumExtensions.cs.meta +2 -2
  355. package/Runtime/Core/Extension/IEnumerableExtensions.cs +341 -124
  356. package/Runtime/Core/Extension/IEnumerableExtensions.cs.meta +11 -11
  357. package/Runtime/Core/Extension/IListExtensions.cs +767 -248
  358. package/Runtime/Core/Extension/IListExtensions.cs.meta +11 -11
  359. package/Runtime/Core/Extension/IReadonlyListExtensions.cs +687 -37
  360. package/Runtime/Core/Extension/IReadonlyListExtensions.cs.meta +2 -2
  361. package/Runtime/Core/Extension/ProtoEqualityExtensions.cs +292 -0
  362. package/Runtime/Core/Extension/ProtoEqualityExtensions.cs.meta +3 -0
  363. package/Runtime/Core/Extension/RandomExtensions.cs +1006 -109
  364. package/Runtime/Core/Extension/RandomExtensions.cs.meta +11 -11
  365. package/Runtime/Core/Extension/StringExtensions.cs +1635 -239
  366. package/Runtime/Core/Extension/StringExtensions.cs.meta +11 -11
  367. package/Runtime/Core/Extension/UnityExtensions.cs +4555 -1689
  368. package/Runtime/Core/Extension/UnityExtensions.cs.meta +11 -11
  369. package/Runtime/Core/Extension/WallstopStudiosLogger.cs +287 -245
  370. package/Runtime/Core/Extension/WallstopStudiosLogger.cs.meta +11 -11
  371. package/Runtime/Core/Extension.meta +8 -8
  372. package/Runtime/Core/Helper/ArrayConverter.cs +73 -39
  373. package/Runtime/Core/Helper/ArrayConverter.cs.meta +2 -2
  374. package/Runtime/Core/Helper/AssignUtilities.cs +33 -14
  375. package/Runtime/Core/Helper/AssignUtilities.cs.meta +11 -11
  376. package/Runtime/Core/Helper/DirectoryHelper.cs +210 -196
  377. package/Runtime/Core/Helper/DirectoryHelper.cs.meta +2 -2
  378. package/Runtime/Core/Helper/Enumerables.cs +51 -17
  379. package/Runtime/Core/Helper/Enumerables.cs.meta +11 -11
  380. package/Runtime/Core/Helper/FileHelper.cs +97 -77
  381. package/Runtime/Core/Helper/FileHelper.cs.meta +2 -2
  382. package/Runtime/Core/Helper/FormattingHelpers.cs +49 -38
  383. package/Runtime/Core/Helper/FormattingHelpers.cs.meta +2 -2
  384. package/Runtime/Core/Helper/FuncBasedComparer.cs +29 -0
  385. package/Runtime/Core/Helper/FuncBasedComparer.cs.meta +3 -0
  386. package/Runtime/Core/Helper/Geometry.cs +65 -43
  387. package/Runtime/Core/Helper/Geometry.cs.meta +11 -11
  388. package/Runtime/Core/Helper/Helpers.cs +1271 -831
  389. package/Runtime/Core/Helper/Helpers.cs.meta +11 -11
  390. package/Runtime/Core/Helper/IterationHelpers.cs +83 -32
  391. package/Runtime/Core/Helper/IterationHelpers.cs.meta +11 -11
  392. package/Runtime/Core/Helper/LifetimeHelpers.cs +20 -13
  393. package/Runtime/Core/Helper/LifetimeHelpers.cs.meta +11 -11
  394. package/Runtime/Core/Helper/LineHelper.cs +259 -194
  395. package/Runtime/Core/Helper/LineHelper.cs.meta +2 -2
  396. package/Runtime/Core/Helper/Logging/UnityLogTagFormatter.cs +549 -539
  397. package/Runtime/Core/Helper/Logging/UnityLogTagFormatter.cs.meta +2 -2
  398. package/Runtime/Core/Helper/Logging.meta +2 -2
  399. package/Runtime/Core/Helper/Objects.cs +477 -769
  400. package/Runtime/Core/Helper/Objects.cs.meta +11 -11
  401. package/Runtime/Core/Helper/Partials/LogHelpers.cs +13 -13
  402. package/Runtime/Core/Helper/Partials/LogHelpers.cs.meta +2 -2
  403. package/Runtime/Core/Helper/Partials/MathHelpers.cs +45 -30
  404. package/Runtime/Core/Helper/Partials/MathHelpers.cs.meta +2 -2
  405. package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +509 -400
  406. package/Runtime/Core/Helper/Partials/ObjectHelpers.cs.meta +2 -2
  407. package/Runtime/Core/Helper/Partials/TransformHelpers.cs +393 -377
  408. package/Runtime/Core/Helper/Partials/TransformHelpers.cs.meta +2 -2
  409. package/Runtime/Core/Helper/Partials.meta +2 -2
  410. package/Runtime/Core/Helper/PathHelper.cs +42 -15
  411. package/Runtime/Core/Helper/PathHelper.cs.meta +2 -2
  412. package/Runtime/Core/Helper/ReflectionHelpers.cs +5298 -1963
  413. package/Runtime/Core/Helper/ReflectionHelpers.cs.meta +2 -2
  414. package/Runtime/Core/Helper/ReverseComparer.cs +33 -0
  415. package/Runtime/Core/Helper/ReverseComparer.cs.meta +3 -0
  416. package/Runtime/Core/Helper/SceneHelper.cs +251 -224
  417. package/Runtime/Core/Helper/SceneHelper.cs.meta +2 -2
  418. package/Runtime/Core/Helper/SpriteHelpers.cs +52 -41
  419. package/Runtime/Core/Helper/SpriteHelpers.cs.meta +11 -11
  420. package/Runtime/Core/Helper/StringInList.cs +61 -35
  421. package/Runtime/Core/Helper/StringInList.cs.meta +11 -11
  422. package/Runtime/Core/Helper/TestAssemblyHelper.cs +134 -0
  423. package/Runtime/Core/Helper/TestAssemblyHelper.cs.meta +11 -0
  424. package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +144 -82
  425. package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs.meta +2 -2
  426. package/Runtime/Core/Helper/WallMath.cs +672 -166
  427. package/Runtime/Core/Helper/WallMath.cs.meta +11 -11
  428. package/Runtime/Core/Helper.meta +8 -8
  429. package/Runtime/Core/Math/Line2D.cs +263 -0
  430. package/Runtime/Core/Math/Line2D.cs.meta +11 -0
  431. package/Runtime/Core/Math/Line3D.cs +452 -0
  432. package/Runtime/Core/Math/Line3D.cs.meta +11 -0
  433. package/Runtime/Core/Math/Parabola.cs +241 -47
  434. package/Runtime/Core/Math/Parabola.cs.meta +11 -11
  435. package/Runtime/Core/Math/PointPolygonCheck.cs +175 -36
  436. package/Runtime/Core/Math/PointPolygonCheck.cs.meta +11 -11
  437. package/Runtime/Core/Math/Range.cs +157 -92
  438. package/Runtime/Core/Math/Range.cs.meta +11 -11
  439. package/Runtime/Core/Math.meta +8 -8
  440. package/Runtime/Core/Model/Direction.cs +25 -43
  441. package/Runtime/Core/Model/Direction.cs.meta +11 -11
  442. package/Runtime/Core/Model.meta +8 -8
  443. package/Runtime/Core/OneOf/FastOneOf.cs +252 -152
  444. package/Runtime/Core/OneOf/FastOneOf.cs.meta +11 -11
  445. package/Runtime/Core/OneOf/FastOneOf2.cs +198 -0
  446. package/Runtime/Core/OneOf/FastOneOf2.cs.meta +11 -0
  447. package/Runtime/Core/OneOf/FastOneOf4.cs +324 -0
  448. package/Runtime/Core/OneOf/FastOneOf4.cs.meta +11 -0
  449. package/Runtime/Core/OneOf/None.cs +30 -4
  450. package/Runtime/Core/OneOf/None.cs.meta +11 -11
  451. package/Runtime/Core/OneOf.meta +8 -8
  452. package/Runtime/Core/Random/AbstractRandom.cs +1318 -655
  453. package/Runtime/Core/Random/AbstractRandom.cs.meta +11 -11
  454. package/Runtime/Core/Random/DotNetRandom.cs +118 -54
  455. package/Runtime/Core/Random/DotNetRandom.cs.meta +2 -2
  456. package/Runtime/Core/Random/IRandom.cs +203 -161
  457. package/Runtime/Core/Random/IRandom.cs.meta +11 -11
  458. package/Runtime/Core/Random/IllusionFlow.cs +171 -107
  459. package/Runtime/Core/Random/IllusionFlow.cs.meta +2 -2
  460. package/Runtime/Core/Random/LinearCongruentialGenerator.cs +90 -49
  461. package/Runtime/Core/Random/LinearCongruentialGenerator.cs.meta +2 -2
  462. package/Runtime/Core/Random/NativePcgRandom.cs +139 -97
  463. package/Runtime/Core/Random/NativePcgRandom.cs.meta +11 -11
  464. package/Runtime/Core/Random/PRNG.cs +21 -7
  465. package/Runtime/Core/Random/PRNG.cs.meta +2 -2
  466. package/Runtime/Core/Random/PcgRandom.cs +243 -149
  467. package/Runtime/Core/Random/PcgRandom.cs.meta +11 -11
  468. package/Runtime/Core/Random/PerlinNoise.cs +369 -369
  469. package/Runtime/Core/Random/PerlinNoise.cs.meta +2 -2
  470. package/Runtime/Core/Random/RandomComparer.cs +34 -0
  471. package/Runtime/Core/Random/RandomComparer.cs.meta +3 -0
  472. package/Runtime/Core/Random/RandomState.cs +206 -131
  473. package/Runtime/Core/Random/RandomState.cs.meta +11 -11
  474. package/Runtime/Core/Random/RandomUtilities.cs +55 -26
  475. package/Runtime/Core/Random/RandomUtilities.cs.meta +11 -11
  476. package/Runtime/Core/Random/RomuDuo.cs +171 -116
  477. package/Runtime/Core/Random/RomuDuo.cs.meta +2 -2
  478. package/Runtime/Core/Random/SplitMix64.cs +134 -94
  479. package/Runtime/Core/Random/SplitMix64.cs.meta +2 -2
  480. package/Runtime/Core/Random/SquirrelRandom.cs +127 -84
  481. package/Runtime/Core/Random/SquirrelRandom.cs.meta +11 -11
  482. package/Runtime/Core/Random/SystemRandom.cs +203 -162
  483. package/Runtime/Core/Random/SystemRandom.cs.meta +11 -11
  484. package/Runtime/Core/Random/ThreadLocalRandom.cs +25 -12
  485. package/Runtime/Core/Random/ThreadLocalRandom.cs.meta +11 -11
  486. package/Runtime/Core/Random/UnityRandom.cs +109 -57
  487. package/Runtime/Core/Random/UnityRandom.cs.meta +11 -11
  488. package/Runtime/Core/Random/WyRandom.cs +158 -121
  489. package/Runtime/Core/Random/WyRandom.cs.meta +2 -2
  490. package/Runtime/Core/Random/XorShiftRandom.cs +106 -52
  491. package/Runtime/Core/Random/XorShiftRandom.cs.meta +11 -11
  492. package/Runtime/Core/Random/XoroShiroRandom.cs +184 -119
  493. package/Runtime/Core/Random/XoroShiroRandom.cs.meta +2 -2
  494. package/Runtime/Core/Random.meta +8 -8
  495. package/Runtime/Core/Serialization/JsonConverters/AnimationCurveConverter.cs +248 -0
  496. package/Runtime/Core/Serialization/JsonConverters/AnimationCurveConverter.cs.meta +11 -0
  497. package/Runtime/Core/Serialization/JsonConverters/BitSetConverter.cs +119 -0
  498. package/Runtime/Core/Serialization/JsonConverters/BitSetConverter.cs.meta +11 -0
  499. package/Runtime/Core/Serialization/JsonConverters/BoundingSphereConverter.cs +74 -0
  500. package/Runtime/Core/Serialization/JsonConverters/BoundingSphereConverter.cs.meta +11 -0
  501. package/Runtime/Core/Serialization/JsonConverters/BoundsConverter.cs +132 -0
  502. package/Runtime/Core/Serialization/JsonConverters/BoundsConverter.cs.meta +11 -0
  503. package/Runtime/Core/Serialization/JsonConverters/BoundsIntConverter.cs +135 -0
  504. package/Runtime/Core/Serialization/JsonConverters/BoundsIntConverter.cs.meta +11 -0
  505. package/Runtime/Core/Serialization/JsonConverters/Color32Converter.cs +98 -0
  506. package/Runtime/Core/Serialization/JsonConverters/Color32Converter.cs.meta +11 -0
  507. package/Runtime/Core/Serialization/JsonConverters/ColorBlockConverter.cs +123 -0
  508. package/Runtime/Core/Serialization/JsonConverters/ColorBlockConverter.cs.meta +11 -0
  509. package/Runtime/Core/Serialization/JsonConverters/ColorConverter.cs +88 -88
  510. package/Runtime/Core/Serialization/JsonConverters/ColorConverter.cs.meta +2 -2
  511. package/Runtime/Core/Serialization/JsonConverters/CyclicBufferConverterFactory.cs +112 -0
  512. package/Runtime/Core/Serialization/JsonConverters/CyclicBufferConverterFactory.cs.meta +11 -0
  513. package/Runtime/Core/Serialization/JsonConverters/DequeConverterFactory.cs +62 -0
  514. package/Runtime/Core/Serialization/JsonConverters/DequeConverterFactory.cs.meta +11 -0
  515. package/Runtime/Core/Serialization/JsonConverters/FastVector2IntConverter.cs +72 -0
  516. package/Runtime/Core/Serialization/JsonConverters/FastVector2IntConverter.cs.meta +11 -0
  517. package/Runtime/Core/Serialization/JsonConverters/FastVector3IntConverter.cs +80 -0
  518. package/Runtime/Core/Serialization/JsonConverters/FastVector3IntConverter.cs.meta +11 -0
  519. package/Runtime/Core/Serialization/JsonConverters/GameObjectConverter.cs +44 -36
  520. package/Runtime/Core/Serialization/JsonConverters/GameObjectConverter.cs.meta +2 -2
  521. package/Runtime/Core/Serialization/JsonConverters/GradientConverter.cs +245 -0
  522. package/Runtime/Core/Serialization/JsonConverters/GradientConverter.cs.meta +11 -0
  523. package/Runtime/Core/Serialization/JsonConverters/Hash128Converter.cs +92 -0
  524. package/Runtime/Core/Serialization/JsonConverters/Hash128Converter.cs.meta +11 -0
  525. package/Runtime/Core/Serialization/JsonConverters/ImmutableBitSetConverter.cs +119 -0
  526. package/Runtime/Core/Serialization/JsonConverters/ImmutableBitSetConverter.cs.meta +11 -0
  527. package/Runtime/Core/Serialization/JsonConverters/KVector2Converter.cs +72 -0
  528. package/Runtime/Core/Serialization/JsonConverters/KVector2Converter.cs.meta +11 -0
  529. package/Runtime/Core/Serialization/JsonConverters/LayerMaskConverter.cs +95 -0
  530. package/Runtime/Core/Serialization/JsonConverters/LayerMaskConverter.cs.meta +11 -0
  531. package/Runtime/Core/Serialization/JsonConverters/Matrix4x4Converter.cs +237 -218
  532. package/Runtime/Core/Serialization/JsonConverters/Matrix4x4Converter.cs.meta +2 -2
  533. package/Runtime/Core/Serialization/JsonConverters/MinMaxCurveConverter.cs +142 -0
  534. package/Runtime/Core/Serialization/JsonConverters/MinMaxCurveConverter.cs.meta +11 -0
  535. package/Runtime/Core/Serialization/JsonConverters/MinMaxGradientConverter.cs +135 -0
  536. package/Runtime/Core/Serialization/JsonConverters/MinMaxGradientConverter.cs.meta +11 -0
  537. package/Runtime/Core/Serialization/JsonConverters/PlaneConverter.cs +79 -0
  538. package/Runtime/Core/Serialization/JsonConverters/PlaneConverter.cs.meta +11 -0
  539. package/Runtime/Core/Serialization/JsonConverters/PoseConverter.cs +76 -0
  540. package/Runtime/Core/Serialization/JsonConverters/PoseConverter.cs.meta +11 -0
  541. package/Runtime/Core/Serialization/JsonConverters/QuaternionConverter.cs +88 -0
  542. package/Runtime/Core/Serialization/JsonConverters/QuaternionConverter.cs.meta +11 -0
  543. package/Runtime/Core/Serialization/JsonConverters/RangeConverterFactory.cs +106 -0
  544. package/Runtime/Core/Serialization/JsonConverters/RangeConverterFactory.cs.meta +11 -0
  545. package/Runtime/Core/Serialization/JsonConverters/RangeIntConverter.cs +71 -0
  546. package/Runtime/Core/Serialization/JsonConverters/RangeIntConverter.cs.meta +11 -0
  547. package/Runtime/Core/Serialization/JsonConverters/Ray2DConverter.cs +80 -0
  548. package/Runtime/Core/Serialization/JsonConverters/Ray2DConverter.cs.meta +11 -0
  549. package/Runtime/Core/Serialization/JsonConverters/RayConverter.cs +76 -0
  550. package/Runtime/Core/Serialization/JsonConverters/RayConverter.cs.meta +11 -0
  551. package/Runtime/Core/Serialization/JsonConverters/RaycastHitConverter.cs +115 -0
  552. package/Runtime/Core/Serialization/JsonConverters/RaycastHitConverter.cs.meta +11 -0
  553. package/Runtime/Core/Serialization/JsonConverters/RectConverter.cs +84 -0
  554. package/Runtime/Core/Serialization/JsonConverters/RectConverter.cs.meta +11 -0
  555. package/Runtime/Core/Serialization/JsonConverters/RectIntConverter.cs +88 -0
  556. package/Runtime/Core/Serialization/JsonConverters/RectIntConverter.cs.meta +11 -0
  557. package/Runtime/Core/Serialization/JsonConverters/RectOffsetConverter.cs +87 -0
  558. package/Runtime/Core/Serialization/JsonConverters/RectOffsetConverter.cs.meta +11 -0
  559. package/Runtime/Core/Serialization/JsonConverters/RenderTextureDescriptorConverter.cs +264 -0
  560. package/Runtime/Core/Serialization/JsonConverters/RenderTextureDescriptorConverter.cs.meta +11 -0
  561. package/Runtime/Core/Serialization/JsonConverters/ResolutionConverter.cs +158 -0
  562. package/Runtime/Core/Serialization/JsonConverters/ResolutionConverter.cs.meta +11 -0
  563. package/Runtime/Core/Serialization/JsonConverters/SceneConverter.cs +103 -0
  564. package/Runtime/Core/Serialization/JsonConverters/SceneConverter.cs.meta +11 -0
  565. package/Runtime/Core/Serialization/JsonConverters/SphericalHarmonicsL2Converter.cs +121 -0
  566. package/Runtime/Core/Serialization/JsonConverters/SphericalHarmonicsL2Converter.cs.meta +11 -0
  567. package/Runtime/Core/Serialization/JsonConverters/TouchConverter.cs +54 -0
  568. package/Runtime/Core/Serialization/JsonConverters/TouchConverter.cs.meta +11 -0
  569. package/Runtime/Core/Serialization/JsonConverters/TypeConverter.cs +30 -28
  570. package/Runtime/Core/Serialization/JsonConverters/TypeConverter.cs.meta +2 -2
  571. package/Runtime/Core/Serialization/JsonConverters/Vector2Converter.cs +72 -74
  572. package/Runtime/Core/Serialization/JsonConverters/Vector2Converter.cs.meta +11 -11
  573. package/Runtime/Core/Serialization/JsonConverters/Vector2IntConverter.cs +72 -0
  574. package/Runtime/Core/Serialization/JsonConverters/Vector2IntConverter.cs.meta +11 -0
  575. package/Runtime/Core/Serialization/JsonConverters/Vector3Converter.cs +80 -81
  576. package/Runtime/Core/Serialization/JsonConverters/Vector3Converter.cs.meta +11 -11
  577. package/Runtime/Core/Serialization/JsonConverters/Vector3IntConverter.cs +80 -0
  578. package/Runtime/Core/Serialization/JsonConverters/Vector3IntConverter.cs.meta +11 -0
  579. package/Runtime/Core/Serialization/JsonConverters/Vector4Converter.cs +88 -88
  580. package/Runtime/Core/Serialization/JsonConverters/Vector4Converter.cs.meta +2 -2
  581. package/Runtime/Core/Serialization/JsonConverters.meta +8 -8
  582. package/Runtime/Core/Serialization/ProtobufUnitySurrogates.cs +383 -0
  583. package/Runtime/Core/Serialization/ProtobufUnitySurrogates.cs.meta +11 -0
  584. package/Runtime/Core/Serialization/Serializer.cs +2121 -195
  585. package/Runtime/Core/Serialization/Serializer.cs.meta +11 -11
  586. package/Runtime/Core/Serialization.meta +8 -8
  587. package/Runtime/Core/Threading/SingleThreadedThreadPool.cs +228 -228
  588. package/Runtime/Core/Threading/SingleThreadedThreadPool.cs.meta +11 -11
  589. package/Runtime/Core/Threading.meta +8 -8
  590. package/Runtime/Core.meta +8 -8
  591. package/Runtime/Integrations/VContainer/AssemblyInfo.cs +9 -0
  592. package/Runtime/Integrations/VContainer/AssemblyInfo.cs.meta +3 -0
  593. package/Runtime/Integrations/VContainer/ObjectResolverRelationalExtensions.cs +281 -0
  594. package/Runtime/Integrations/VContainer/ObjectResolverRelationalExtensions.cs.meta +11 -0
  595. package/Runtime/Integrations/VContainer/RelationalComponentEntryPoint.cs +189 -0
  596. package/Runtime/Integrations/VContainer/RelationalComponentEntryPoint.cs.meta +11 -0
  597. package/Runtime/Integrations/VContainer/RelationalComponentsBuilderExtensions.cs +90 -0
  598. package/Runtime/Integrations/VContainer/RelationalComponentsBuilderExtensions.cs.meta +11 -0
  599. package/Runtime/Integrations/VContainer/RelationalObjectPools.cs +114 -0
  600. package/Runtime/Integrations/VContainer/RelationalObjectPools.cs.meta +11 -0
  601. package/Runtime/Integrations/VContainer/RelationalSceneAssignmentOptions.cs +95 -0
  602. package/Runtime/Integrations/VContainer/RelationalSceneAssignmentOptions.cs.meta +11 -0
  603. package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs +241 -0
  604. package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs.meta +11 -0
  605. package/Runtime/Integrations/VContainer/WallstopStudios.UnityHelpers.Integration.VContainer.asmdef +30 -0
  606. package/Runtime/Integrations/VContainer/WallstopStudios.UnityHelpers.Integration.VContainer.asmdef.meta +7 -0
  607. package/Runtime/Integrations/VContainer.meta +8 -0
  608. package/Runtime/Integrations/Zenject/AssemblyInfo.cs +9 -0
  609. package/Runtime/Integrations/Zenject/AssemblyInfo.cs.meta +3 -0
  610. package/Runtime/Integrations/Zenject/DiContainerRelationalExtensions.cs +247 -0
  611. package/Runtime/Integrations/Zenject/DiContainerRelationalExtensions.cs.meta +11 -0
  612. package/Runtime/Integrations/Zenject/RelationalComponentSceneInitializer.cs +182 -0
  613. package/Runtime/Integrations/Zenject/RelationalComponentSceneInitializer.cs.meta +11 -0
  614. package/Runtime/Integrations/Zenject/RelationalComponentsInstaller.cs +94 -0
  615. package/Runtime/Integrations/Zenject/RelationalComponentsInstaller.cs.meta +11 -0
  616. package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs +44 -0
  617. package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs.meta +11 -0
  618. package/Runtime/Integrations/Zenject/RelationalSceneAssignmentOptions.cs +93 -0
  619. package/Runtime/Integrations/Zenject/RelationalSceneAssignmentOptions.cs.meta +11 -0
  620. package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs +243 -0
  621. package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs.meta +11 -0
  622. package/Runtime/Integrations/Zenject/WallstopStudios.UnityHelpers.Integration.Zenject.asmdef +30 -0
  623. package/Runtime/Integrations/Zenject/WallstopStudios.UnityHelpers.Integration.Zenject.asmdef.meta +7 -0
  624. package/Runtime/Integrations/Zenject.meta +8 -0
  625. package/Runtime/Integrations.meta +8 -0
  626. package/Runtime/Protobuf-Net/System.Collections.Immutable.dll.meta +33 -33
  627. package/Runtime/Protobuf-Net/System.Runtime.CompilerServices.Unsafe.dll.meta +33 -33
  628. package/Runtime/Protobuf-Net/protobuf-net.Core.dll.meta +33 -33
  629. package/Runtime/Protobuf-Net/protobuf-net.dll.meta +33 -33
  630. package/Runtime/Protobuf-Net.meta +8 -8
  631. package/Runtime/Tags/AlwaysIncludeInAttributeMetadataCacheAttribute.cs +11 -0
  632. package/Runtime/Tags/AlwaysIncludeInAttributeMetadataCacheAttribute.cs.meta +11 -0
  633. package/Runtime/Tags/Attribute.cs +399 -205
  634. package/Runtime/Tags/Attribute.cs.meta +2 -2
  635. package/Runtime/Tags/AttributeEffect.cs +372 -281
  636. package/Runtime/Tags/AttributeEffect.cs.meta +2 -2
  637. package/Runtime/Tags/AttributeMetadataCache.cs +500 -0
  638. package/Runtime/Tags/AttributeMetadataCache.cs.meta +11 -0
  639. package/Runtime/Tags/AttributeMetadataFilters.cs +108 -0
  640. package/Runtime/Tags/AttributeMetadataFilters.cs.meta +11 -0
  641. package/Runtime/Tags/AttributeModification.cs +132 -48
  642. package/Runtime/Tags/AttributeModification.cs.meta +2 -2
  643. package/Runtime/Tags/AttributeUtilities.cs +376 -209
  644. package/Runtime/Tags/AttributeUtilities.cs.meta +2 -2
  645. package/Runtime/Tags/AttributesComponent.cs +237 -163
  646. package/Runtime/Tags/AttributesComponent.cs.meta +2 -2
  647. package/Runtime/Tags/CollisionSenses.cs +117 -91
  648. package/Runtime/Tags/CollisionSenses.cs.meta +2 -2
  649. package/Runtime/Tags/CosmeticEffectComponent.cs +112 -50
  650. package/Runtime/Tags/CosmeticEffectComponent.cs.meta +2 -2
  651. package/Runtime/Tags/CosmeticEffectData.cs +109 -63
  652. package/Runtime/Tags/CosmeticEffectData.cs.meta +2 -2
  653. package/Runtime/Tags/EffectHandle.cs +150 -65
  654. package/Runtime/Tags/EffectHandle.cs.meta +2 -2
  655. package/Runtime/Tags/EffectHandler.cs +470 -393
  656. package/Runtime/Tags/EffectHandler.cs.meta +2 -2
  657. package/Runtime/Tags/ModificationAction.cs +60 -9
  658. package/Runtime/Tags/ModificationAction.cs.meta +2 -2
  659. package/Runtime/Tags/ModifierDurationType.cs +71 -13
  660. package/Runtime/Tags/ModifierDurationType.cs.meta +2 -2
  661. package/Runtime/Tags/TagHandler.cs +373 -158
  662. package/Runtime/Tags/TagHandler.cs.meta +2 -2
  663. package/Runtime/Tags.meta +2 -2
  664. package/Runtime/Utils/AnimationEventEqualityComparer.cs +198 -161
  665. package/Runtime/Utils/AnimationEventEqualityComparer.cs.meta +11 -11
  666. package/Runtime/Utils/AnimatorEnumStateMachine.cs +110 -88
  667. package/Runtime/Utils/AnimatorEnumStateMachine.cs.meta +11 -11
  668. package/Runtime/Utils/Ascii85.cs +132 -115
  669. package/Runtime/Utils/Ascii85.cs.meta +2 -2
  670. package/Runtime/Utils/Buffers.cs +1151 -550
  671. package/Runtime/Utils/Buffers.cs.meta +11 -11
  672. package/Runtime/Utils/CenterPointOffset.cs +35 -30
  673. package/Runtime/Utils/CenterPointOffset.cs.meta +2 -2
  674. package/Runtime/Utils/ChildSpawner.cs +250 -157
  675. package/Runtime/Utils/ChildSpawner.cs.meta +2 -2
  676. package/Runtime/Utils/CircleLineRenderer.cs +142 -142
  677. package/Runtime/Utils/CircleLineRenderer.cs.meta +11 -11
  678. package/Runtime/Utils/CollisionProxy.cs +48 -48
  679. package/Runtime/Utils/CollisionProxy.cs.meta +2 -2
  680. package/Runtime/Utils/CoroutineHandler.cs +4 -4
  681. package/Runtime/Utils/CoroutineHandler.cs.meta +2 -2
  682. package/Runtime/Utils/DeferredDisposalResult.cs +20 -23
  683. package/Runtime/Utils/DeferredDisposalResult.cs.meta +2 -2
  684. package/Runtime/Utils/LZMA.cs +276 -53
  685. package/Runtime/Utils/LZMA.cs.meta +2 -2
  686. package/Runtime/Utils/MatchColliderToSprite.cs +104 -104
  687. package/Runtime/Utils/MatchColliderToSprite.cs.meta +2 -2
  688. package/Runtime/Utils/MatchTransform.cs +99 -82
  689. package/Runtime/Utils/MatchTransform.cs.meta +2 -2
  690. package/Runtime/Utils/Oscillator.cs +27 -27
  691. package/Runtime/Utils/Oscillator.cs.meta +11 -11
  692. package/Runtime/Utils/PolygonCollider2DOptimizer.cs +104 -83
  693. package/Runtime/Utils/PolygonCollider2DOptimizer.cs.meta +2 -2
  694. package/Runtime/Utils/RuntimeSingleton.cs +139 -89
  695. package/Runtime/Utils/RuntimeSingleton.cs.meta +11 -11
  696. package/Runtime/Utils/ScriptableObjectSingleton.cs +225 -85
  697. package/Runtime/Utils/ScriptableObjectSingleton.cs.meta +2 -2
  698. package/Runtime/Utils/SerializedStringComparer.cs +107 -107
  699. package/Runtime/Utils/SerializedStringComparer.cs.meta +2 -2
  700. package/Runtime/Utils/SetTextureImportData.cs +71 -69
  701. package/Runtime/Utils/SetTextureImportData.cs.meta +11 -11
  702. package/Runtime/Utils/SevenZip/Common/CRC.cs +70 -70
  703. package/Runtime/Utils/SevenZip/Common/CRC.cs.meta +11 -11
  704. package/Runtime/Utils/SevenZip/Common/InBuffer.cs +84 -84
  705. package/Runtime/Utils/SevenZip/Common/InBuffer.cs.meta +11 -11
  706. package/Runtime/Utils/SevenZip/Common/OutBuffer.cs +70 -70
  707. package/Runtime/Utils/SevenZip/Common/OutBuffer.cs.meta +11 -11
  708. package/Runtime/Utils/SevenZip/Common.meta +2 -2
  709. package/Runtime/Utils/SevenZip/Compress/LZ/IMatchFinder.cs +28 -28
  710. package/Runtime/Utils/SevenZip/Compress/LZ/IMatchFinder.cs.meta +11 -11
  711. package/Runtime/Utils/SevenZip/Compress/LZ/LzBinTree.cs +454 -454
  712. package/Runtime/Utils/SevenZip/Compress/LZ/LzBinTree.cs.meta +11 -11
  713. package/Runtime/Utils/SevenZip/Compress/LZ/LzInWindow.cs +179 -179
  714. package/Runtime/Utils/SevenZip/Compress/LZ/LzInWindow.cs.meta +11 -11
  715. package/Runtime/Utils/SevenZip/Compress/LZ/LzOutWindow.cs +137 -137
  716. package/Runtime/Utils/SevenZip/Compress/LZ/LzOutWindow.cs.meta +11 -11
  717. package/Runtime/Utils/SevenZip/Compress/LZ.meta +8 -8
  718. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaBase.cs +110 -110
  719. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaBase.cs.meta +11 -11
  720. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaDecoder.cs +525 -527
  721. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaDecoder.cs.meta +11 -11
  722. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaEncoder.cs +1891 -1904
  723. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaEncoder.cs.meta +11 -11
  724. package/Runtime/Utils/SevenZip/Compress/LZMA.meta +8 -8
  725. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoder.cs +242 -242
  726. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoder.cs.meta +11 -11
  727. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBit.cs +146 -149
  728. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBit.cs.meta +11 -11
  729. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBitTree.cs +177 -177
  730. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBitTree.cs.meta +11 -11
  731. package/Runtime/Utils/SevenZip/Compress/RangeCoder.meta +8 -8
  732. package/Runtime/Utils/SevenZip/Compress.meta +8 -8
  733. package/Runtime/Utils/SevenZip/ICoder.cs +177 -177
  734. package/Runtime/Utils/SevenZip/ICoder.cs.meta +11 -11
  735. package/Runtime/Utils/SevenZip.meta +2 -2
  736. package/Runtime/Utils/SpriteRendererMetadata.cs +346 -370
  737. package/Runtime/Utils/SpriteRendererMetadata.cs.meta +2 -2
  738. package/Runtime/Utils/SpriteRendererSyncer.cs +100 -100
  739. package/Runtime/Utils/SpriteRendererSyncer.cs.meta +2 -2
  740. package/Runtime/Utils/StartTracker.cs +15 -15
  741. package/Runtime/Utils/StartTracker.cs.meta +2 -2
  742. package/Runtime/Utils/TextureScale.cs +364 -179
  743. package/Runtime/Utils/TextureScale.cs.meta +2 -2
  744. package/Runtime/Utils/TypeNameSorter.cs +17 -17
  745. package/Runtime/Utils/TypeNameSorter.cs.meta +2 -2
  746. package/Runtime/Utils/UnityObjectNameComparer.cs +89 -89
  747. package/Runtime/Utils/UnityObjectNameComparer.cs.meta +2 -2
  748. package/Runtime/Utils.meta +8 -8
  749. package/Runtime/Visuals/AnimatedSpriteLayer.cs +217 -130
  750. package/Runtime/Visuals/AnimatedSpriteLayer.cs.meta +2 -2
  751. package/Runtime/Visuals/UGUI/EnhancedImage.cs +224 -85
  752. package/Runtime/Visuals/UGUI/EnhancedImage.cs.meta +2 -2
  753. package/Runtime/Visuals/UGUI.meta +2 -2
  754. package/Runtime/Visuals/UIToolkit/LayeredImage.cs +784 -484
  755. package/Runtime/Visuals/UIToolkit/LayeredImage.cs.meta +2 -2
  756. package/Runtime/Visuals/UIToolkit/MultiFileSelectorElement.cs +945 -322
  757. package/Runtime/Visuals/UIToolkit/MultiFileSelectorElement.cs.meta +2 -2
  758. package/Runtime/Visuals/UIToolkit.meta +2 -2
  759. package/Runtime/Visuals.meta +2 -2
  760. package/Runtime/WallstopStudios.UnityHelpers.asmdef +22 -14
  761. package/Runtime/WallstopStudios.UnityHelpers.asmdef.meta +7 -7
  762. package/Runtime.meta +8 -8
  763. package/SERIALIZATION.md +663 -0
  764. package/SERIALIZATION.md.meta +7 -0
  765. package/SINGLETONS.md +427 -0
  766. package/SINGLETONS.md.meta +7 -0
  767. package/SPATIAL_TREES_2D_GUIDE.md +261 -0
  768. package/SPATIAL_TREES_2D_GUIDE.md.meta +7 -0
  769. package/SPATIAL_TREES_3D_GUIDE.md +214 -0
  770. package/SPATIAL_TREES_3D_GUIDE.md.meta +7 -0
  771. package/SPATIAL_TREE_2D_PERFORMANCE.md +241 -0
  772. package/SPATIAL_TREE_2D_PERFORMANCE.md.meta +7 -0
  773. package/SPATIAL_TREE_3D_PERFORMANCE.md +243 -0
  774. package/SPATIAL_TREE_3D_PERFORMANCE.md.meta +7 -0
  775. package/SPATIAL_TREE_SEMANTICS.md +106 -0
  776. package/SPATIAL_TREE_SEMANTICS.md.meta +7 -0
  777. package/Samples~/DI - VContainer/Prefabs/RelationalConsumer.prefab +77 -0
  778. package/Samples~/DI - VContainer/Prefabs/RelationalConsumer.prefab.meta +8 -0
  779. package/Samples~/DI - VContainer/Prefabs/Spawner.prefab +47 -0
  780. package/Samples~/DI - VContainer/Prefabs/Spawner.prefab.meta +8 -0
  781. package/Samples~/DI - VContainer/Prefabs.meta +9 -0
  782. package/Samples~/DI - VContainer/README.md +515 -0
  783. package/Samples~/DI - VContainer/README.md.meta +8 -0
  784. package/Samples~/DI - VContainer/Scenes/VContainer_Sample.unity +120 -0
  785. package/Samples~/DI - VContainer/Scenes/VContainer_Sample.unity.meta +8 -0
  786. package/Samples~/DI - VContainer/Scenes.meta +9 -0
  787. package/Samples~/DI - VContainer/Scripts/GameLifetimeScope.cs +42 -0
  788. package/Samples~/DI - VContainer/Scripts/GameLifetimeScope.cs.meta +12 -0
  789. package/Samples~/DI - VContainer/Scripts/RelationalConsumer.cs +24 -0
  790. package/Samples~/DI - VContainer/Scripts/RelationalConsumer.cs.meta +12 -0
  791. package/Samples~/DI - VContainer/Scripts/Samples.UnityHelpers.DI.VContainer.asmdef +37 -0
  792. package/Samples~/DI - VContainer/Scripts/Samples.UnityHelpers.DI.VContainer.asmdef.meta +8 -0
  793. package/Samples~/DI - VContainer/Scripts/Spawner.cs +130 -0
  794. package/Samples~/DI - VContainer/Scripts/Spawner.cs.meta +12 -0
  795. package/Samples~/DI - VContainer/Scripts.meta +9 -0
  796. package/Samples~/DI - VContainer.meta +9 -0
  797. package/Samples~/DI - Zenject/Prefabs/RelationalConsumer.prefab +77 -0
  798. package/Samples~/DI - Zenject/Prefabs/RelationalConsumer.prefab.meta +8 -0
  799. package/Samples~/DI - Zenject/Prefabs/SpawnerZenject.prefab +47 -0
  800. package/Samples~/DI - Zenject/Prefabs/SpawnerZenject.prefab.meta +8 -0
  801. package/Samples~/DI - Zenject/Prefabs.meta +9 -0
  802. package/Samples~/DI - Zenject/README.md +553 -0
  803. package/Samples~/DI - Zenject/README.md.meta +7 -0
  804. package/Samples~/DI - Zenject/Scenes/Zenject_Sample.unity +164 -0
  805. package/Samples~/DI - Zenject/Scenes/Zenject_Sample.unity.meta +8 -0
  806. package/Samples~/DI - Zenject/Scenes.meta +9 -0
  807. package/Samples~/DI - Zenject/Scripts/RelationalConsumer.cs +22 -0
  808. package/Samples~/DI - Zenject/Scripts/RelationalConsumer.cs.meta +12 -0
  809. package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs +37 -0
  810. package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs.meta +12 -0
  811. package/Samples~/DI - Zenject/Scripts/Samples.UnityHelpers.DI.Zenject.asmdef +36 -0
  812. package/Samples~/DI - Zenject/Scripts/Samples.UnityHelpers.DI.Zenject.asmdef.meta +8 -0
  813. package/Samples~/DI - Zenject/Scripts/SceneContextPlaceholder.cs +47 -0
  814. package/Samples~/DI - Zenject/Scripts/SceneContextPlaceholder.cs.meta +12 -0
  815. package/Samples~/DI - Zenject/Scripts/SpawnerZenject.cs +91 -0
  816. package/Samples~/DI - Zenject/Scripts/SpawnerZenject.cs.meta +12 -0
  817. package/Samples~/DI - Zenject/Scripts.meta +9 -0
  818. package/Samples~/DI - Zenject.meta +9 -0
  819. package/Samples~/Random - PRNG/README.md +13 -0
  820. package/Samples~/Random - PRNG/README.md.meta +8 -0
  821. package/Samples~/Random - PRNG/Scripts/RandomPrngDemo.cs +28 -0
  822. package/Samples~/Random - PRNG/Scripts/RandomPrngDemo.cs.meta +12 -0
  823. package/Samples~/Random - PRNG/Scripts/Samples.UnityHelpers.Random.Prng.asmdef +17 -0
  824. package/Samples~/Random - PRNG/Scripts/Samples.UnityHelpers.Random.Prng.asmdef.meta +8 -0
  825. package/Samples~/Random - PRNG/Scripts.meta +9 -0
  826. package/Samples~/Random - PRNG.meta +9 -0
  827. package/Samples~/Relational Components - Basic/README.md +21 -0
  828. package/Samples~/Relational Components - Basic/README.md.meta +8 -0
  829. package/Samples~/Relational Components - Basic/Scripts/RelationalBasicConsumer.cs +37 -0
  830. package/Samples~/Relational Components - Basic/Scripts/RelationalBasicConsumer.cs.meta +12 -0
  831. package/Samples~/Relational Components - Basic/Scripts/Samples.UnityHelpers.Relational.Basic.asmdef +17 -0
  832. package/Samples~/Relational Components - Basic/Scripts/Samples.UnityHelpers.Relational.Basic.asmdef.meta +8 -0
  833. package/Samples~/Relational Components - Basic/Scripts.meta +9 -0
  834. package/Samples~/Relational Components - Basic.meta +9 -0
  835. package/Samples~/Serialization - JSON/README.md +14 -0
  836. package/Samples~/Serialization - JSON/README.md.meta +8 -0
  837. package/Samples~/Serialization - JSON/Scripts/JsonSerializationDemo.cs +50 -0
  838. package/Samples~/Serialization - JSON/Scripts/JsonSerializationDemo.cs.meta +12 -0
  839. package/Samples~/Serialization - JSON/Scripts/Samples.UnityHelpers.Serialization.Json.asmdef +17 -0
  840. package/Samples~/Serialization - JSON/Scripts/Samples.UnityHelpers.Serialization.Json.asmdef.meta +8 -0
  841. package/Samples~/Serialization - JSON/Scripts.meta +9 -0
  842. package/Samples~/Serialization - JSON.meta +9 -0
  843. package/Samples~/Spatial Structures - 2D and 3D/README.md +14 -0
  844. package/Samples~/Spatial Structures - 2D and 3D/README.md.meta +8 -0
  845. package/Samples~/Spatial Structures - 2D and 3D/Scripts/Samples.UnityHelpers.SpatialStructures.asmdef +17 -0
  846. package/Samples~/Spatial Structures - 2D and 3D/Scripts/Samples.UnityHelpers.SpatialStructures.asmdef.meta +8 -0
  847. package/Samples~/Spatial Structures - 2D and 3D/Scripts/SpatialStructuresDemo.cs +62 -0
  848. package/Samples~/Spatial Structures - 2D and 3D/Scripts/SpatialStructuresDemo.cs.meta +12 -0
  849. package/Samples~/Spatial Structures - 2D and 3D/Scripts.meta +9 -0
  850. package/Samples~/Spatial Structures - 2D and 3D.meta +9 -0
  851. package/Samples~/UGUI - EnhancedImage/README.md +13 -0
  852. package/Samples~/UGUI - EnhancedImage/README.md.meta +8 -0
  853. package/Samples~/UGUI - EnhancedImage/Scripts/EnhancedImageDemo.cs +36 -0
  854. package/Samples~/UGUI - EnhancedImage/Scripts/EnhancedImageDemo.cs.meta +12 -0
  855. package/Samples~/UGUI - EnhancedImage/Scripts/Samples.UnityHelpers.UGUI.EnhancedImage.asmdef +17 -0
  856. package/Samples~/UGUI - EnhancedImage/Scripts/Samples.UnityHelpers.UGUI.EnhancedImage.asmdef.meta +8 -0
  857. package/Samples~/UGUI - EnhancedImage/Scripts.meta +9 -0
  858. package/Samples~/UGUI - EnhancedImage.meta +9 -0
  859. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/README.md +13 -0
  860. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/README.md.meta +8 -0
  861. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor/MultiFileSelectorSampleWindow.cs +45 -0
  862. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor/MultiFileSelectorSampleWindow.cs.meta +12 -0
  863. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor/Samples.UnityHelpers.UIToolkit.Editor.asmdef +19 -0
  864. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor/Samples.UnityHelpers.UIToolkit.Editor.asmdef.meta +8 -0
  865. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor.meta +9 -0
  866. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts.meta +9 -0
  867. package/Samples~/UI Toolkit - MultiFile Selector (Editor).meta +9 -0
  868. package/Shaders/Materials/BackgroundMask-Material.mat +59 -59
  869. package/Shaders/Materials/BackgroundMask-Material.mat.meta +8 -8
  870. package/Shaders/Materials.meta +8 -8
  871. package/Shaders/ShaderGraph/BackgroundMask.shadergraph +1653 -1653
  872. package/Shaders/ShaderGraph/BackgroundMask.shadergraph.meta +10 -10
  873. package/Shaders/ShaderGraph/DebugDisplayValue.shadersubgraph +835 -835
  874. package/Shaders/ShaderGraph/DebugDisplayValue.shadersubgraph.meta +10 -10
  875. package/Shaders/ShaderGraph.meta +8 -8
  876. package/Shaders/Support/EnhancedImageSupport.shader +64 -0
  877. package/Shaders/Support/EnhancedImageSupport.shader.meta +9 -0
  878. package/Shaders/Support.meta +8 -0
  879. package/Shaders.meta +8 -8
  880. package/Styles/Elements/Progress/ArcedProgressBar.cs +345 -345
  881. package/Styles/Elements/Progress/ArcedProgressBar.cs.meta +2 -2
  882. package/Styles/Elements/Progress/CircularProgressBar.cs +307 -307
  883. package/Styles/Elements/Progress/CircularProgressBar.cs.meta +2 -2
  884. package/Styles/Elements/Progress/GlitchProgressBar.cs +416 -416
  885. package/Styles/Elements/Progress/GlitchProgressBar.cs.meta +2 -2
  886. package/Styles/Elements/Progress/LiquidProgressBar.cs +632 -632
  887. package/Styles/Elements/Progress/LiquidProgressBar.cs.meta +2 -2
  888. package/Styles/Elements/Progress/MarchingAntsProgressBar.cs +722 -722
  889. package/Styles/Elements/Progress/MarchingAntsProgressBar.cs.meta +2 -2
  890. package/Styles/Elements/Progress/RegularProgressBar.cs +405 -405
  891. package/Styles/Elements/Progress/RegularProgressBar.cs.meta +2 -2
  892. package/Styles/Elements/Progress/WigglyProgressBar.cs +837 -837
  893. package/Styles/Elements/Progress/WigglyProgressBar.cs.meta +2 -2
  894. package/Styles/Elements/Progress.meta +2 -2
  895. package/Styles/Elements.meta +2 -2
  896. package/Styles/USS/ArcedProgressBar.uss +18 -18
  897. package/Styles/USS/ArcedProgressBar.uss.meta +2 -2
  898. package/Styles/USS/CirclularProgressBar.uss +17 -17
  899. package/Styles/USS/CirclularProgressBar.uss.meta +2 -2
  900. package/Styles/USS/RegularProgressBar.uss +32 -32
  901. package/Styles/USS/RegularProgressBar.uss.meta +2 -2
  902. package/Styles/USS/WigglyProgressBar.uss +16 -16
  903. package/Styles/USS/WigglyProgressBar.uss.meta +2 -2
  904. package/Styles/USS.meta +2 -2
  905. package/Styles/WallstopStudios.UnityHelpers.Styles.asmdef +14 -17
  906. package/Styles/WallstopStudios.UnityHelpers.Styles.asmdef.meta +7 -7
  907. package/Styles.meta +2 -2
  908. package/THIRD_PARTY_NOTICES.md +74 -0
  909. package/THIRD_PARTY_NOTICES.md.meta +7 -0
  910. package/Tests/Editor/Attributes/AnimationEventHelpersTests.cs +171 -0
  911. package/Tests/Editor/Attributes/AnimationEventHelpersTests.cs.meta +11 -0
  912. package/Tests/Editor/Attributes.meta +8 -0
  913. package/Tests/Editor/Core/Attributes/RelationalComponentAssignerTests.cs +118 -0
  914. package/Tests/Editor/Core/Attributes/RelationalComponentAssignerTests.cs.meta +11 -0
  915. package/Tests/Editor/Core/Attributes.meta +8 -0
  916. package/Tests/Editor/Core.meta +8 -0
  917. package/Tests/Editor/Extensions/SerializedPropertyExtensionsTests.cs +194 -0
  918. package/Tests/Editor/Extensions/SerializedPropertyExtensionsTests.cs.meta +3 -0
  919. package/Tests/Editor/Extensions.meta +3 -0
  920. package/Tests/Editor/Helper/DummyScriptableObject.cs +6 -0
  921. package/Tests/Editor/Helper/DummyScriptableObject.cs.meta +3 -0
  922. package/Tests/Editor/Helper/HelpersTests.cs +101 -0
  923. package/Tests/Editor/Helper/HelpersTests.cs.meta +3 -0
  924. package/Tests/Editor/Helper/ObjectHelpersEditorTests.cs +63 -0
  925. package/Tests/Editor/Helper/ObjectHelpersEditorTests.cs.meta +11 -0
  926. package/Tests/Editor/Helper/PromptScope.cs +28 -0
  927. package/Tests/Editor/Helper/PromptScope.cs.meta +11 -0
  928. package/Tests/Editor/Helper/ReflectionHelpersEditorTests.cs +105 -0
  929. package/Tests/Editor/Helper/ReflectionHelpersEditorTests.cs.meta +11 -0
  930. package/Tests/Editor/Helper/SpriteHelpersTests.cs +334 -0
  931. package/Tests/Editor/Helper/SpriteHelpersTests.cs.meta +3 -0
  932. package/Tests/Editor/Helper/SpriteSettingsApplierAdditionalTests.cs +183 -0
  933. package/Tests/Editor/Helper/SpriteSettingsApplierAdditionalTests.cs.meta +11 -0
  934. package/Tests/Editor/Helper/SpriteSettingsApplierTests.cs +161 -0
  935. package/Tests/Editor/Helper/SpriteSettingsApplierTests.cs.meta +11 -0
  936. package/Tests/Editor/Helper.meta +3 -0
  937. package/Tests/Editor/Integrations/VContainer/VContainerIntegrationCompilationTests.cs +40 -0
  938. package/Tests/Editor/Integrations/VContainer/VContainerIntegrationCompilationTests.cs.meta +11 -0
  939. package/Tests/Editor/Integrations/VContainer/VContainerRelationalEntryPointTests.cs +81 -0
  940. package/Tests/Editor/Integrations/VContainer/VContainerRelationalEntryPointTests.cs.meta +11 -0
  941. package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs +170 -0
  942. package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs.meta +11 -0
  943. package/Tests/Editor/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Editor.VContainer.asmdef +37 -0
  944. package/Tests/Editor/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Editor.VContainer.asmdef.meta +7 -0
  945. package/Tests/Editor/Integrations/VContainer.meta +8 -0
  946. package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef +37 -0
  947. package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef.meta +7 -0
  948. package/Tests/Editor/Integrations/Zenject/ZenjectIntegrationCompilationTests.cs +40 -0
  949. package/Tests/Editor/Integrations/Zenject/ZenjectIntegrationCompilationTests.cs.meta +11 -0
  950. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs +131 -0
  951. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs.meta +11 -0
  952. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalInitializerTests.cs +80 -0
  953. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalInitializerTests.cs.meta +11 -0
  954. package/Tests/Editor/Integrations/Zenject.meta +8 -0
  955. package/Tests/Editor/Integrations.meta +8 -0
  956. package/Tests/Editor/MultiFileSelectorElementTests.cs +265 -0
  957. package/Tests/Editor/MultiFileSelectorElementTests.cs.meta +11 -0
  958. package/Tests/Editor/MultiFileSelectorPersistenceManagerTests.cs +100 -0
  959. package/Tests/Editor/MultiFileSelectorPersistenceManagerTests.cs.meta +11 -0
  960. package/Tests/Editor/PersistentDirectorySettingsTests.cs +59 -0
  961. package/Tests/Editor/PersistentDirectorySettingsTests.cs.meta +11 -0
  962. package/Tests/Editor/PrefabCheckerReportTests.cs +32 -0
  963. package/Tests/Editor/PrefabCheckerReportTests.cs.meta +11 -0
  964. package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs +64 -0
  965. package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs.meta +11 -0
  966. package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs +199 -0
  967. package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs.meta +11 -0
  968. package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs +38 -0
  969. package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs.meta +11 -0
  970. package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs +108 -0
  971. package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs.meta +11 -0
  972. package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs +323 -0
  973. package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs.meta +11 -0
  974. package/Tests/Editor/Sprites/SpriteCropperTests.cs +162 -0
  975. package/Tests/Editor/Sprites/SpriteCropperTests.cs.meta +11 -0
  976. package/Tests/Editor/Sprites/SpritePivotAdjusterAdditionalTests.cs +227 -0
  977. package/Tests/Editor/Sprites/SpritePivotAdjusterAdditionalTests.cs.meta +11 -0
  978. package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs +113 -0
  979. package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs.meta +11 -0
  980. package/Tests/Editor/Sprites/TexturePlatformNameHelperTests.cs +46 -0
  981. package/Tests/Editor/Sprites/TexturePlatformNameHelperTests.cs.meta +11 -0
  982. package/Tests/Editor/Sprites/TextureResizerWizardTests.cs +248 -0
  983. package/Tests/Editor/Sprites/TextureResizerWizardTests.cs.meta +11 -0
  984. package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs +180 -0
  985. package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs.meta +11 -0
  986. package/Tests/Editor/Sprites/TextureSettingsApplierWizardAdditionalTests.cs +295 -0
  987. package/Tests/Editor/Sprites/TextureSettingsApplierWizardAdditionalTests.cs.meta +11 -0
  988. package/Tests/Editor/Sprites/TextureSettingsApplierWizardTests.cs +134 -0
  989. package/Tests/Editor/Sprites/TextureSettingsApplierWizardTests.cs.meta +11 -0
  990. package/Tests/Editor/Sprites.meta +8 -0
  991. package/Tests/Editor/TestComponents/PrewarmTesterComponent.cs +10 -0
  992. package/Tests/Editor/TestComponents/PrewarmTesterComponent.cs.meta +11 -0
  993. package/Tests/Editor/TestComponents.meta +8 -0
  994. package/Tests/Editor/Tools/ImageBlurToolTests.cs +47 -0
  995. package/Tests/Editor/Tools/ImageBlurToolTests.cs.meta +11 -0
  996. package/Tests/Editor/Tools.meta +8 -0
  997. package/Tests/Editor/Utils/CommonTestBase.cs +250 -0
  998. package/Tests/Editor/Utils/CommonTestBase.cs.meta +11 -0
  999. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorEditorTests.cs +306 -0
  1000. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorEditorTests.cs.meta +9 -0
  1001. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorTests.cs +183 -0
  1002. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorTests.cs.meta +11 -0
  1003. package/Tests/Editor/Utils/ScriptableObjectSingletonTests.cs +466 -0
  1004. package/Tests/Editor/Utils/ScriptableObjectSingletonTests.cs.meta +11 -0
  1005. package/Tests/Editor/Utils.meta +3 -0
  1006. package/Tests/Editor/WallstopStudios.UnityHelpers.Tests.Editor.asmdef +19 -0
  1007. package/Tests/Editor/WallstopStudios.UnityHelpers.Tests.Editor.asmdef.meta +7 -0
  1008. package/Tests/Editor/Windows/FitTextureSizeWindowTests.cs +773 -0
  1009. package/Tests/Editor/Windows/FitTextureSizeWindowTests.cs.meta +11 -0
  1010. package/Tests/Editor/Windows/PrefabCheckerFolderAdditionTests.cs +96 -0
  1011. package/Tests/Editor/Windows/PrefabCheckerFolderAdditionTests.cs.meta +11 -0
  1012. package/Tests/Editor/Windows/PrefabCheckerTests.cs +81 -0
  1013. package/Tests/Editor/Windows/PrefabCheckerTests.cs.meta +11 -0
  1014. package/Tests/Editor/Windows.meta +8 -0
  1015. package/Tests/Editor.meta +8 -0
  1016. package/Tests/Runtime/AssemblyInfo.cs +4 -0
  1017. package/Tests/Runtime/AssemblyInfo.cs.meta +3 -0
  1018. package/Tests/Runtime/Attributes/ChildComponentTests.cs +766 -81
  1019. package/Tests/Runtime/Attributes/ChildComponentTests.cs.meta +2 -2
  1020. package/Tests/Runtime/Attributes/Components/ExpectChildSpriteRenderers.cs +28 -28
  1021. package/Tests/Runtime/Attributes/Components/ExpectChildSpriteRenderers.cs.meta +2 -2
  1022. package/Tests/Runtime/Attributes/Components/ExpectParentSpriteRenderers.cs +28 -28
  1023. package/Tests/Runtime/Attributes/Components/ExpectParentSpriteRenderers.cs.meta +2 -2
  1024. package/Tests/Runtime/{Components → Attributes/Components}/RelationalComponentTesterComplex.cs +34 -34
  1025. package/Tests/Runtime/{Components → Attributes/Components}/RelationalComponentTesterComplex.cs.meta +2 -2
  1026. package/Tests/Runtime/Attributes/Components/RelationalComponentsTesterSimple.cs +37 -0
  1027. package/Tests/Runtime/{Components → Attributes/Components}/RelationalComponentsTesterSimple.cs.meta +2 -2
  1028. package/Tests/Runtime/Attributes/Components.meta +2 -2
  1029. package/Tests/Runtime/Attributes/MiscRuntimeAttributeTests.cs +75 -0
  1030. package/Tests/Runtime/Attributes/MiscRuntimeAttributeTests.cs.meta +11 -0
  1031. package/Tests/Runtime/Attributes/NotNullAttributeTests.cs +26 -0
  1032. package/Tests/Runtime/Attributes/NotNullAttributeTests.cs.meta +3 -0
  1033. package/Tests/Runtime/Attributes/ParentComponentTests.cs +565 -68
  1034. package/Tests/Runtime/Attributes/ParentComponentTests.cs.meta +2 -2
  1035. package/Tests/Runtime/Attributes/RelationalComponentAdvancedTests.cs +614 -0
  1036. package/Tests/Runtime/Attributes/RelationalComponentAdvancedTests.cs.meta +11 -0
  1037. package/Tests/Runtime/Attributes/RelationalComponentBackwardCompatibilityTests.cs +478 -0
  1038. package/Tests/Runtime/Attributes/RelationalComponentBackwardCompatibilityTests.cs.meta +11 -0
  1039. package/Tests/Runtime/Attributes/RelationalComponentExtensionsTests.cs +56 -0
  1040. package/Tests/Runtime/Attributes/RelationalComponentExtensionsTests.cs.meta +11 -0
  1041. package/Tests/Runtime/Attributes/RelationalComponentHashSetTests.cs +226 -0
  1042. package/Tests/Runtime/Attributes/RelationalComponentHashSetTests.cs.meta +11 -0
  1043. package/Tests/Runtime/Attributes/RelationalComponentInitializerTests.cs +98 -0
  1044. package/Tests/Runtime/Attributes/RelationalComponentInitializerTests.cs.meta +11 -0
  1045. package/Tests/Runtime/Attributes/RelationalComponentTagAndNameFilterEdgeTests.cs +234 -0
  1046. package/Tests/Runtime/Attributes/RelationalComponentTagAndNameFilterEdgeTests.cs.meta +11 -0
  1047. package/Tests/Runtime/Attributes/SiblingComponentTests.cs +721 -0
  1048. package/Tests/Runtime/Attributes/SiblingComponentTests.cs.meta +11 -0
  1049. package/Tests/Runtime/Attributes/ValidateAssignmentAttributeTests.cs +96 -0
  1050. package/Tests/Runtime/Attributes/ValidateAssignmentAttributeTests.cs.meta +11 -0
  1051. package/Tests/Runtime/Attributes.meta +2 -2
  1052. package/Tests/Runtime/Core/Random/RandomComparerTests.cs +166 -0
  1053. package/Tests/Runtime/Core/Random/RandomComparerTests.cs.meta +11 -0
  1054. package/Tests/Runtime/Core/Random.meta +8 -0
  1055. package/Tests/Runtime/Core/Threading/SingleThreadedThreadPoolTests.cs +56 -56
  1056. package/Tests/Runtime/Core/Threading/SingleThreadedThreadPoolTests.cs.meta +2 -2
  1057. package/Tests/Runtime/Core/Threading.meta +2 -2
  1058. package/Tests/Runtime/Core.meta +2 -2
  1059. package/Tests/Runtime/DataStructures/BalancedKDTree2DTests.cs +562 -0
  1060. package/Tests/Runtime/DataStructures/{BalancedKDTreeTests.cs.meta → BalancedKDTree2DTests.cs.meta} +11 -11
  1061. package/Tests/Runtime/DataStructures/BalancedKDTree3DTests.cs +10 -0
  1062. package/Tests/Runtime/DataStructures/BalancedKDTree3DTests.cs.meta +11 -0
  1063. package/Tests/Runtime/DataStructures/BitSetTests.cs +1400 -0
  1064. package/Tests/Runtime/DataStructures/BitSetTests.cs.meta +3 -0
  1065. package/Tests/Runtime/DataStructures/BoundingBox3DTests.cs +1215 -0
  1066. package/Tests/Runtime/DataStructures/BoundingBox3DTests.cs.meta +11 -0
  1067. package/Tests/Runtime/DataStructures/CircleTests.cs +965 -0
  1068. package/Tests/Runtime/DataStructures/CircleTests.cs.meta +11 -0
  1069. package/Tests/Runtime/DataStructures/CyclicBufferTests.cs +2083 -324
  1070. package/Tests/Runtime/DataStructures/CyclicBufferTests.cs.meta +2 -2
  1071. package/Tests/Runtime/DataStructures/DequeTests.cs +790 -0
  1072. package/Tests/Runtime/DataStructures/DequeTests.cs.meta +3 -0
  1073. package/Tests/Runtime/DataStructures/DisjointSetTests.cs +1114 -0
  1074. package/Tests/Runtime/DataStructures/DisjointSetTests.cs.meta +3 -0
  1075. package/Tests/Runtime/DataStructures/FastOneOfTests.cs +966 -0
  1076. package/Tests/Runtime/DataStructures/FastOneOfTests.cs.meta +11 -0
  1077. package/Tests/Runtime/DataStructures/FastVector2IntTests.cs +286 -0
  1078. package/Tests/Runtime/DataStructures/FastVector2IntTests.cs.meta +11 -0
  1079. package/Tests/Runtime/DataStructures/FastVector3IntTests.cs +414 -0
  1080. package/Tests/Runtime/DataStructures/FastVector3IntTests.cs.meta +11 -0
  1081. package/Tests/Runtime/DataStructures/HeapTests.cs +1953 -0
  1082. package/Tests/Runtime/DataStructures/HeapTests.cs.meta +11 -0
  1083. package/Tests/Runtime/DataStructures/ImmutableBitSetTests.cs +833 -0
  1084. package/Tests/Runtime/DataStructures/ImmutableBitSetTests.cs.meta +3 -0
  1085. package/Tests/Runtime/DataStructures/KDTree3DTestsBase.cs +297 -0
  1086. package/Tests/Runtime/DataStructures/KDTree3DTestsBase.cs.meta +11 -0
  1087. package/Tests/Runtime/DataStructures/OctTree3DTests.cs +351 -0
  1088. package/Tests/Runtime/DataStructures/OctTree3DTests.cs.meta +11 -0
  1089. package/Tests/Runtime/DataStructures/PriorityQueueTests.cs +71 -0
  1090. package/Tests/Runtime/DataStructures/PriorityQueueTests.cs.meta +3 -0
  1091. package/Tests/Runtime/DataStructures/ProtobufSerializationTests.cs +475 -0
  1092. package/Tests/Runtime/DataStructures/ProtobufSerializationTests.cs.meta +11 -0
  1093. package/Tests/Runtime/DataStructures/QuadTree2DTests.cs +660 -0
  1094. package/Tests/Runtime/DataStructures/QuadTree2DTests.cs.meta +11 -0
  1095. package/Tests/Runtime/DataStructures/RTree2DTests.cs +823 -0
  1096. package/Tests/Runtime/DataStructures/RTree2DTests.cs.meta +3 -0
  1097. package/Tests/Runtime/DataStructures/RTree3DTests.cs +270 -0
  1098. package/Tests/Runtime/DataStructures/RTree3DTests.cs.meta +11 -0
  1099. package/Tests/Runtime/DataStructures/SparseSetTests.cs +1146 -0
  1100. package/Tests/Runtime/DataStructures/SparseSetTests.cs.meta +3 -0
  1101. package/Tests/Runtime/DataStructures/SpatialHashTests.cs +992 -0
  1102. package/Tests/Runtime/DataStructures/SpatialHashTests.cs.meta +11 -0
  1103. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsConsistencyTests.cs +351 -0
  1104. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsConsistencyTests.cs.meta +11 -0
  1105. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsEdgeTests.cs +127 -0
  1106. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsEdgeTests.cs.meta +11 -0
  1107. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsFuzzTests.cs +218 -0
  1108. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsFuzzTests.cs.meta +11 -0
  1109. package/Tests/Runtime/DataStructures/SpatialTree2DTests.cs +396 -0
  1110. package/Tests/Runtime/DataStructures/SpatialTree2DTests.cs.meta +11 -0
  1111. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsConsistencyTests.cs +281 -0
  1112. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsConsistencyTests.cs.meta +11 -0
  1113. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsEdgeTests.cs +127 -0
  1114. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsEdgeTests.cs.meta +11 -0
  1115. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsFuzzTests.cs +170 -0
  1116. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsFuzzTests.cs.meta +11 -0
  1117. package/Tests/Runtime/DataStructures/SpatialTree3DTests.cs +474 -0
  1118. package/Tests/Runtime/DataStructures/SpatialTree3DTests.cs.meta +11 -0
  1119. package/Tests/Runtime/DataStructures/SphereTests.cs +806 -0
  1120. package/Tests/Runtime/DataStructures/SphereTests.cs.meta +3 -0
  1121. package/Tests/Runtime/DataStructures/StringWrapperTests.cs +333 -0
  1122. package/Tests/Runtime/DataStructures/StringWrapperTests.cs.meta +11 -0
  1123. package/Tests/Runtime/DataStructures/TimedCacheTests.cs +669 -0
  1124. package/Tests/Runtime/DataStructures/TimedCacheTests.cs.meta +11 -0
  1125. package/Tests/Runtime/DataStructures/TrieTests.cs +3385 -0
  1126. package/Tests/Runtime/DataStructures/TrieTests.cs.meta +11 -0
  1127. package/Tests/Runtime/DataStructures/UnbalancedKDTree2DTests.cs +565 -0
  1128. package/Tests/Runtime/DataStructures/{UnbalancedKDTreeTests.cs.meta → UnbalancedKDTree2DTests.cs.meta} +11 -11
  1129. package/Tests/Runtime/DataStructures/UnbalancedKDTree3DTests.cs +10 -0
  1130. package/Tests/Runtime/DataStructures/UnbalancedKDTree3DTests.cs.meta +11 -0
  1131. package/Tests/Runtime/DataStructures.meta +8 -8
  1132. package/Tests/Runtime/Extensions/AnimatorExtensionsTests.cs +28 -0
  1133. package/Tests/Runtime/Extensions/AnimatorExtensionsTests.cs.meta +11 -0
  1134. package/Tests/Runtime/Extensions/AsyncOperationExtensionsTests.cs +667 -0
  1135. package/Tests/Runtime/Extensions/AsyncOperationExtensionsTests.cs.meta +11 -0
  1136. package/Tests/Runtime/Extensions/CircleExtensionsTests.cs +230 -0
  1137. package/Tests/Runtime/Extensions/CircleExtensionsTests.cs.meta +11 -0
  1138. package/Tests/Runtime/Extensions/ColorExtensionsTests.cs +55 -0
  1139. package/Tests/Runtime/Extensions/ColorExtensionsTests.cs.meta +11 -0
  1140. package/Tests/Runtime/Extensions/DictionaryExtensionTests.cs +724 -438
  1141. package/Tests/Runtime/Extensions/DictionaryExtensionTests.cs.meta +2 -2
  1142. package/Tests/Runtime/Extensions/DirectionExtensionsComprehensiveTests.cs +403 -0
  1143. package/Tests/Runtime/Extensions/DirectionExtensionsComprehensiveTests.cs.meta +11 -0
  1144. package/Tests/Runtime/Extensions/DirectionExtensionsTests.cs +69 -0
  1145. package/Tests/Runtime/Extensions/DirectionExtensionsTests.cs.meta +11 -0
  1146. package/Tests/Runtime/Extensions/EnumExtensionTests.cs +809 -153
  1147. package/Tests/Runtime/Extensions/EnumExtensionTests.cs.meta +2 -2
  1148. package/Tests/Runtime/Extensions/IEnumerableExtensionsTests.cs +191 -0
  1149. package/Tests/Runtime/Extensions/IEnumerableExtensionsTests.cs.meta +11 -0
  1150. package/Tests/Runtime/Extensions/IListExtensionTests.cs +955 -169
  1151. package/Tests/Runtime/Extensions/IListExtensionTests.cs.meta +2 -2
  1152. package/Tests/Runtime/Extensions/IReadonlyListExtensionTests.cs +266 -58
  1153. package/Tests/Runtime/Extensions/IReadonlyListExtensionTests.cs.meta +2 -2
  1154. package/Tests/Runtime/Extensions/LoggingExtensionTests.cs +721 -718
  1155. package/Tests/Runtime/Extensions/LoggingExtensionTests.cs.meta +2 -2
  1156. package/Tests/Runtime/Extensions/ProtoEqualityExtensionsTests.cs +565 -0
  1157. package/Tests/Runtime/Extensions/ProtoEqualityExtensionsTests.cs.meta +3 -0
  1158. package/Tests/Runtime/Extensions/ProtoEqualityPolymorphismTests.cs +100 -0
  1159. package/Tests/Runtime/Extensions/ProtoEqualityPolymorphismTests.cs.meta +11 -0
  1160. package/Tests/Runtime/Extensions/RandomExtensionTests.cs +719 -27
  1161. package/Tests/Runtime/Extensions/RandomExtensionTests.cs.meta +2 -2
  1162. package/Tests/Runtime/Extensions/StringExtensionTests.cs +2592 -31
  1163. package/Tests/Runtime/Extensions/StringExtensionTests.cs.meta +2 -2
  1164. package/Tests/Runtime/Extensions/UnityExtensionsBasicTests.cs +166 -0
  1165. package/Tests/Runtime/Extensions/UnityExtensionsBasicTests.cs.meta +11 -0
  1166. package/Tests/Runtime/Extensions/UnityExtensionsComprehensiveTests.cs +1446 -0
  1167. package/Tests/Runtime/Extensions/UnityExtensionsComprehensiveTests.cs.meta +11 -0
  1168. package/Tests/Runtime/Extensions/UnityExtensionsMathTests.cs +1779 -0
  1169. package/Tests/Runtime/Extensions/UnityExtensionsMathTests.cs.meta +11 -0
  1170. package/Tests/Runtime/Extensions/UnityExtensionsVector2HullTests.cs +292 -0
  1171. package/Tests/Runtime/Extensions/UnityExtensionsVector2HullTests.cs.meta +11 -0
  1172. package/Tests/Runtime/Extensions/UnityLogTagFormatterEdgeTests.cs +260 -0
  1173. package/Tests/Runtime/Extensions/UnityLogTagFormatterEdgeTests.cs.meta +11 -0
  1174. package/Tests/Runtime/Extensions.meta +2 -2
  1175. package/Tests/Runtime/Helper/ArrayConverterTests.cs +19 -19
  1176. package/Tests/Runtime/Helper/ArrayConverterTests.cs.meta +2 -2
  1177. package/Tests/Runtime/Helper/AssignUtilitiesTests.cs +38 -0
  1178. package/Tests/Runtime/Helper/AssignUtilitiesTests.cs.meta +11 -0
  1179. package/Tests/Runtime/Helper/DirectoryHelperTests.cs +347 -0
  1180. package/Tests/Runtime/Helper/DirectoryHelperTests.cs.meta +11 -0
  1181. package/Tests/Runtime/Helper/EnumerablesTests.cs +45 -0
  1182. package/Tests/Runtime/Helper/EnumerablesTests.cs.meta +11 -0
  1183. package/Tests/Runtime/Helper/FileHelperTests.cs +481 -0
  1184. package/Tests/Runtime/Helper/FileHelperTests.cs.meta +11 -0
  1185. package/Tests/Runtime/Helper/FormattingHelpersTests.cs +353 -0
  1186. package/Tests/Runtime/Helper/FormattingHelpersTests.cs.meta +11 -0
  1187. package/Tests/Runtime/Helper/FuncBasedComparerTests.cs +27 -0
  1188. package/Tests/Runtime/Helper/FuncBasedComparerTests.cs.meta +11 -0
  1189. package/Tests/Runtime/Helper/GeometryTests.cs +517 -0
  1190. package/Tests/Runtime/Helper/GeometryTests.cs.meta +3 -0
  1191. package/Tests/Runtime/Helper/HelpersTests.cs +749 -0
  1192. package/Tests/Runtime/Helper/HelpersTests.cs.meta +11 -0
  1193. package/Tests/Runtime/Helper/IterationHelpersTests.cs +173 -0
  1194. package/Tests/Runtime/Helper/IterationHelpersTests.cs.meta +11 -0
  1195. package/Tests/Runtime/Helper/LineHelperTests.cs +662 -0
  1196. package/Tests/Runtime/Helper/LineHelperTests.cs.meta +11 -0
  1197. package/Tests/Runtime/Helper/ObjectHelperTests.cs +444 -432
  1198. package/Tests/Runtime/Helper/ObjectHelperTests.cs.meta +2 -2
  1199. package/Tests/Runtime/Helper/ObjectsTests.cs +363 -0
  1200. package/Tests/Runtime/Helper/ObjectsTests.cs.meta +3 -0
  1201. package/Tests/Runtime/Helper/PathHelperTests.cs +183 -0
  1202. package/Tests/Runtime/Helper/PathHelperTests.cs.meta +11 -0
  1203. package/Tests/Runtime/Helper/ReflectionHelperTests.cs +2199 -1493
  1204. package/Tests/Runtime/Helper/ReflectionHelperTests.cs.meta +2 -2
  1205. package/Tests/Runtime/Helper/ReflectionHelpersMemberLookupTests.cs +192 -0
  1206. package/Tests/Runtime/Helper/ReflectionHelpersMemberLookupTests.cs.meta +11 -0
  1207. package/Tests/Runtime/Helper/ReflectionHelpersTypeScanningTests.cs +58 -0
  1208. package/Tests/Runtime/Helper/ReflectionHelpersTypeScanningTests.cs.meta +11 -0
  1209. package/Tests/Runtime/Helper/SceneHelperTests.cs +77 -94
  1210. package/Tests/Runtime/Helper/SceneHelperTests.cs.meta +2 -2
  1211. package/Tests/Runtime/Helper/UnityMainThreadDispatcherTests.cs +45 -0
  1212. package/Tests/Runtime/Helper/UnityMainThreadDispatcherTests.cs.meta +11 -0
  1213. package/Tests/Runtime/Helper/WallMathTests.cs +1884 -233
  1214. package/Tests/Runtime/Helper/WallMathTests.cs.meta +2 -2
  1215. package/Tests/Runtime/Helper.meta +2 -2
  1216. package/Tests/Runtime/Integrations/VContainer/RelationalComponentsVContainerTests.cs +601 -0
  1217. package/Tests/Runtime/Integrations/VContainer/RelationalComponentsVContainerTests.cs.meta +11 -0
  1218. package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs +86 -0
  1219. package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs.meta +11 -0
  1220. package/Tests/Runtime/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Runtime.VContainer.asmdef +38 -0
  1221. package/Tests/Runtime/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Runtime.VContainer.asmdef.meta +7 -0
  1222. package/Tests/Runtime/Integrations/VContainer.meta +8 -0
  1223. package/Tests/Runtime/Integrations/Zenject/RelationalComponentsZenjectTests.cs +619 -0
  1224. package/Tests/Runtime/Integrations/Zenject/RelationalComponentsZenjectTests.cs.meta +11 -0
  1225. package/Tests/Runtime/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Runtime.Zenject.asmdef +38 -0
  1226. package/Tests/Runtime/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Runtime.Zenject.asmdef.meta +7 -0
  1227. package/Tests/Runtime/Integrations/Zenject.meta +8 -0
  1228. package/Tests/Runtime/Integrations.meta +8 -0
  1229. package/Tests/Runtime/Math/Line2DTests.cs +594 -0
  1230. package/Tests/Runtime/Math/Line2DTests.cs.meta +11 -0
  1231. package/Tests/Runtime/Math/Line3DTests.cs +655 -0
  1232. package/Tests/Runtime/Math/Line3DTests.cs.meta +11 -0
  1233. package/Tests/Runtime/Math/LineTests.cs +480 -0
  1234. package/Tests/Runtime/Math/LineTests.cs.meta +11 -0
  1235. package/Tests/Runtime/Math/ParabolaTests.cs +477 -0
  1236. package/Tests/Runtime/Math/ParabolaTests.cs.meta +11 -0
  1237. package/Tests/Runtime/Math/PointPolygonCheckTests.cs +939 -0
  1238. package/Tests/Runtime/Math/PointPolygonCheckTests.cs.meta +11 -0
  1239. package/Tests/Runtime/Math/RangeTests.cs +197 -0
  1240. package/Tests/Runtime/Math/RangeTests.cs.meta +11 -0
  1241. package/Tests/Runtime/Math.meta +8 -0
  1242. package/Tests/Runtime/Performance/BenchmarkReadmeUpdater.cs +81 -0
  1243. package/Tests/Runtime/Performance/BenchmarkReadmeUpdater.cs.meta +11 -0
  1244. package/Tests/Runtime/Performance/JsonSerializationPerformanceTests.cs +421 -0
  1245. package/Tests/Runtime/Performance/JsonSerializationPerformanceTests.cs.meta +3 -0
  1246. package/Tests/Runtime/Performance/ListExtensionPerformanceTests.cs +76 -76
  1247. package/Tests/Runtime/Performance/ListExtensionPerformanceTests.cs.meta +2 -2
  1248. package/Tests/Runtime/Performance/ProtoEqualsPerformanceTests.cs +161 -0
  1249. package/Tests/Runtime/Performance/ProtoEqualsPerformanceTests.cs.meta +11 -0
  1250. package/Tests/Runtime/Performance/ProtoSerializationPerformanceTests.cs +207 -0
  1251. package/Tests/Runtime/Performance/ProtoSerializationPerformanceTests.cs.meta +3 -0
  1252. package/Tests/Runtime/Performance/RandomPerformanceTests.cs +195 -181
  1253. package/Tests/Runtime/Performance/RandomPerformanceTests.cs.meta +11 -11
  1254. package/Tests/Runtime/Performance/RelationComponentPerformanceTests.cs +60 -61
  1255. package/Tests/Runtime/Performance/RelationComponentPerformanceTests.cs.meta +2 -2
  1256. package/Tests/Runtime/Performance/SpatialTree2DPerformanceTests.cs +697 -0
  1257. package/Tests/Runtime/Performance/SpatialTree2DPerformanceTests.cs.meta +11 -0
  1258. package/Tests/Runtime/Performance/SpatialTree3DPerformanceTests.cs +653 -0
  1259. package/Tests/Runtime/Performance/SpatialTree3DPerformanceTests.cs.meta +11 -0
  1260. package/Tests/Runtime/Performance.meta +8 -8
  1261. package/Tests/Runtime/Random/DotNetRandomTests.cs +9 -9
  1262. package/Tests/Runtime/Random/DotNetRandomTests.cs.meta +2 -2
  1263. package/Tests/Runtime/Random/IllusionFlowTests.cs +12 -12
  1264. package/Tests/Runtime/Random/IllusionFlowTests.cs.meta +2 -2
  1265. package/Tests/Runtime/Random/LinearCongruentialGeneratorTests.cs +12 -12
  1266. package/Tests/Runtime/Random/LinearCongruentialGeneratorTests.cs.meta +2 -2
  1267. package/Tests/Runtime/Random/PcgRandomTests.cs +9 -9
  1268. package/Tests/Runtime/Random/PcgRandomTests.cs.meta +11 -11
  1269. package/Tests/Runtime/Random/RandomProtoSerializationTests.cs +494 -0
  1270. package/Tests/Runtime/Random/RandomProtoSerializationTests.cs.meta +3 -0
  1271. package/Tests/Runtime/Random/RandomStateSerializationTests.cs +304 -0
  1272. package/Tests/Runtime/Random/RandomStateSerializationTests.cs.meta +4 -0
  1273. package/Tests/Runtime/Random/RandomTestBase.cs +836 -787
  1274. package/Tests/Runtime/Random/RandomTestBase.cs.meta +11 -11
  1275. package/Tests/Runtime/Random/RomuDuoRandomTests.cs +9 -9
  1276. package/Tests/Runtime/Random/RomuDuoRandomTests.cs.meta +2 -2
  1277. package/Tests/Runtime/Random/SplitMix64RandomTests.cs +9 -9
  1278. package/Tests/Runtime/Random/SplitMix64RandomTests.cs.meta +2 -2
  1279. package/Tests/Runtime/Random/SquirrelRandomTests.cs +14 -14
  1280. package/Tests/Runtime/Random/SquirrelRandomTests.cs.meta +11 -11
  1281. package/Tests/Runtime/Random/SystemRandomTests.cs +10 -10
  1282. package/Tests/Runtime/Random/SystemRandomTests.cs.meta +11 -11
  1283. package/Tests/Runtime/Random/UnityRandomTests.cs +9 -9
  1284. package/Tests/Runtime/Random/UnityRandomTests.cs.meta +11 -11
  1285. package/Tests/Runtime/Random/WyRandomTests.cs +9 -9
  1286. package/Tests/Runtime/Random/WyRandomTests.cs.meta +2 -2
  1287. package/Tests/Runtime/Random/XorShiftRandomTests.cs +9 -9
  1288. package/Tests/Runtime/Random/XorShiftRandomTests.cs.meta +11 -11
  1289. package/Tests/Runtime/Random/XoroShiroRandomTests.cs +9 -9
  1290. package/Tests/Runtime/Random/XoroShiroRandomTests.cs.meta +2 -2
  1291. package/Tests/Runtime/Random.meta +8 -8
  1292. package/Tests/Runtime/RuntimeTestTimeouts.cs +3 -0
  1293. package/Tests/Runtime/RuntimeTestTimeouts.cs.meta +11 -0
  1294. package/Tests/Runtime/Scenes/Test1.unity +723 -723
  1295. package/Tests/Runtime/Scenes/Test1.unity.meta +7 -7
  1296. package/Tests/Runtime/Scenes/Test2.unity +723 -723
  1297. package/Tests/Runtime/Scenes/Test2.unity.meta +7 -7
  1298. package/Tests/Runtime/Scenes.meta +2 -2
  1299. package/Tests/Runtime/Serialization/AdaptersJsonTests.cs +67 -0
  1300. package/Tests/Runtime/Serialization/AdaptersJsonTests.cs.meta +11 -0
  1301. package/Tests/Runtime/Serialization/BitSetJsonTests.cs +50 -0
  1302. package/Tests/Runtime/Serialization/BitSetJsonTests.cs.meta +11 -0
  1303. package/Tests/Runtime/Serialization/CyclicBufferJsonTests.cs +67 -0
  1304. package/Tests/Runtime/Serialization/CyclicBufferJsonTests.cs.meta +11 -0
  1305. package/Tests/Runtime/Serialization/DequeJsonTests.cs +70 -0
  1306. package/Tests/Runtime/Serialization/DequeJsonTests.cs.meta +11 -0
  1307. package/Tests/Runtime/Serialization/ImmutableBitSetJsonTests.cs +25 -0
  1308. package/Tests/Runtime/Serialization/ImmutableBitSetJsonTests.cs.meta +11 -0
  1309. package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs +30 -0
  1310. package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs.meta +11 -0
  1311. package/Tests/Runtime/Serialization/JsonConverterTests.cs +1153 -0
  1312. package/Tests/Runtime/Serialization/JsonConverterTests.cs.meta +11 -0
  1313. package/Tests/Runtime/Serialization/JsonRoundtripComprehensiveTests.cs +239 -0
  1314. package/Tests/Runtime/Serialization/JsonRoundtripComprehensiveTests.cs.meta +11 -0
  1315. package/Tests/Runtime/Serialization/JsonSerializationCorrectnessTests.cs +458 -0
  1316. package/Tests/Runtime/Serialization/JsonSerializationCorrectnessTests.cs.meta +3 -0
  1317. package/Tests/Runtime/Serialization/JsonSerializationTest.cs +167 -156
  1318. package/Tests/Runtime/Serialization/JsonSerializationTest.cs.meta +2 -2
  1319. package/Tests/Runtime/Serialization/MathJsonTests.cs +79 -0
  1320. package/Tests/Runtime/Serialization/MathJsonTests.cs.meta +11 -0
  1321. package/Tests/Runtime/Serialization/ProtoInterfaceResolutionEdgeTests.cs +76 -0
  1322. package/Tests/Runtime/Serialization/ProtoInterfaceResolutionEdgeTests.cs.meta +11 -0
  1323. package/Tests/Runtime/Serialization/ProtoRootRegistrationTests.cs +80 -0
  1324. package/Tests/Runtime/Serialization/ProtoRootRegistrationTests.cs.meta +11 -0
  1325. package/Tests/Runtime/Serialization/ProtoRoundtripComprehensiveTests.cs +257 -0
  1326. package/Tests/Runtime/Serialization/ProtoRoundtripComprehensiveTests.cs.meta +11 -0
  1327. package/Tests/Runtime/Serialization/ProtoSerializationCorrectnessTests.cs +471 -0
  1328. package/Tests/Runtime/Serialization/ProtoSerializationCorrectnessTests.cs.meta +3 -0
  1329. package/Tests/Runtime/Serialization/ProtoSerializationTests.cs +169 -0
  1330. package/Tests/Runtime/Serialization/ProtoSerializationTests.cs.meta +11 -0
  1331. package/Tests/Runtime/Serialization/ProtoSerializeBehaviorTests.cs +62 -0
  1332. package/Tests/Runtime/Serialization/ProtoSerializeBehaviorTests.cs.meta +11 -0
  1333. package/Tests/Runtime/Serialization/SerializerAdditionalTests.cs +907 -0
  1334. package/Tests/Runtime/Serialization/SerializerAdditionalTests.cs.meta +3 -0
  1335. package/Tests/Runtime/Serialization/SerializerFileIoTests.cs +105 -0
  1336. package/Tests/Runtime/Serialization/SerializerFileIoTests.cs.meta +11 -0
  1337. package/Tests/Runtime/Serialization/TypeConverterTests.cs +34 -0
  1338. package/Tests/Runtime/Serialization/TypeConverterTests.cs.meta +11 -0
  1339. package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs +247 -0
  1340. package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs.meta +11 -0
  1341. package/Tests/Runtime/Serialization.meta +2 -2
  1342. package/Tests/Runtime/Tags/AttributeComponentTests.cs +174 -0
  1343. package/Tests/Runtime/Tags/AttributeComponentTests.cs.meta +3 -0
  1344. package/Tests/Runtime/Tags/AttributeDataTests.cs +312 -0
  1345. package/Tests/Runtime/Tags/AttributeDataTests.cs.meta +11 -0
  1346. package/Tests/Runtime/Tags/AttributeUtilitiesTests.cs +405 -0
  1347. package/Tests/Runtime/Tags/AttributeUtilitiesTests.cs.meta +3 -0
  1348. package/Tests/Runtime/Tags/CosmeticAndCollisionTests.cs +147 -0
  1349. package/Tests/Runtime/Tags/CosmeticAndCollisionTests.cs.meta +11 -0
  1350. package/Tests/Runtime/Tags/CosmeticEffectDataTests.cs +60 -0
  1351. package/Tests/Runtime/Tags/CosmeticEffectDataTests.cs.meta +3 -0
  1352. package/Tests/Runtime/Tags/EffectHandleTests.cs +61 -0
  1353. package/Tests/Runtime/Tags/EffectHandleTests.cs.meta +3 -0
  1354. package/Tests/Runtime/Tags/EffectHandlerTests.cs +270 -0
  1355. package/Tests/Runtime/Tags/EffectHandlerTests.cs.meta +3 -0
  1356. package/Tests/Runtime/Tags/Helpers/RecordingCosmeticComponent.cs +39 -0
  1357. package/Tests/Runtime/Tags/Helpers/RecordingCosmeticComponent.cs.meta +3 -0
  1358. package/Tests/Runtime/Tags/Helpers/TagTestBase.cs +49 -0
  1359. package/Tests/Runtime/Tags/Helpers/TagTestBase.cs.meta +3 -0
  1360. package/Tests/Runtime/Tags/Helpers/TestAttributesComponent.cs +28 -0
  1361. package/Tests/Runtime/Tags/Helpers/TestAttributesComponent.cs.meta +3 -0
  1362. package/Tests/Runtime/Tags/Helpers.meta +3 -0
  1363. package/Tests/Runtime/Tags/TagHandlerTests.cs +108 -0
  1364. package/Tests/Runtime/Tags/TagHandlerTests.cs.meta +3 -0
  1365. package/Tests/Runtime/Tags.meta +8 -0
  1366. package/Tests/Runtime/TestUtils/CommonTestBase.cs +301 -0
  1367. package/Tests/Runtime/TestUtils/CommonTestBase.cs.meta +11 -0
  1368. package/Tests/Runtime/TestUtils/GCAssert.cs +55 -0
  1369. package/Tests/Runtime/TestUtils/GCAssert.cs.meta +11 -0
  1370. package/Tests/Runtime/TestUtils/SpatialAssert.cs +33 -0
  1371. package/Tests/Runtime/TestUtils/SpatialAssert.cs.meta +11 -0
  1372. package/Tests/Runtime/TestUtils/SpatialDiagnostics.cs +195 -0
  1373. package/Tests/Runtime/TestUtils/SpatialDiagnostics.cs.meta +11 -0
  1374. package/Tests/Runtime/TestUtils.meta +8 -0
  1375. package/Tests/Runtime/Utils/AnimationEventEqualityComparerTests.cs +144 -0
  1376. package/Tests/Runtime/Utils/AnimationEventEqualityComparerTests.cs.meta +11 -0
  1377. package/Tests/Runtime/Utils/Ascii85Tests.cs +56 -0
  1378. package/Tests/Runtime/Utils/Ascii85Tests.cs.meta +11 -0
  1379. package/Tests/Runtime/Utils/BuffersTests.cs +1148 -741
  1380. package/Tests/Runtime/Utils/BuffersTests.cs.meta +2 -2
  1381. package/Tests/Runtime/Utils/BuffersWaitInstructionTests.cs +31 -0
  1382. package/Tests/Runtime/Utils/BuffersWaitInstructionTests.cs.meta +11 -0
  1383. package/Tests/Runtime/Utils/CenterPointOffsetTests.cs +67 -0
  1384. package/Tests/Runtime/Utils/CenterPointOffsetTests.cs.meta +11 -0
  1385. package/Tests/Runtime/Utils/ChildSpawnerTests.cs +490 -0
  1386. package/Tests/Runtime/Utils/ChildSpawnerTests.cs.meta +11 -0
  1387. package/Tests/Runtime/Utils/CircleLineRendererTests.cs +80 -0
  1388. package/Tests/Runtime/Utils/CircleLineRendererTests.cs.meta +11 -0
  1389. package/Tests/Runtime/Utils/CollisionProxyTests.cs +442 -0
  1390. package/Tests/Runtime/Utils/CollisionProxyTests.cs.meta +11 -0
  1391. package/Tests/Runtime/Utils/CoroutineHandlerTests.cs +353 -0
  1392. package/Tests/Runtime/Utils/CoroutineHandlerTests.cs.meta +11 -0
  1393. package/Tests/Runtime/Utils/DeferredDisposalResultTests.cs +44 -0
  1394. package/Tests/Runtime/Utils/DeferredDisposalResultTests.cs.meta +11 -0
  1395. package/Tests/Runtime/Utils/LZMAComprehensiveTests.cs +249 -0
  1396. package/Tests/Runtime/Utils/LZMAComprehensiveTests.cs.meta +11 -0
  1397. package/Tests/Runtime/Utils/LZMATests.cs +31 -0
  1398. package/Tests/Runtime/Utils/LZMATests.cs.meta +11 -0
  1399. package/Tests/Runtime/Utils/MatchColliderToSpriteAdditionalTests.cs +86 -0
  1400. package/Tests/Runtime/Utils/MatchColliderToSpriteAdditionalTests.cs.meta +11 -0
  1401. package/Tests/Runtime/Utils/MatchColliderToSpriteTests.cs +503 -0
  1402. package/Tests/Runtime/Utils/MatchColliderToSpriteTests.cs.meta +11 -0
  1403. package/Tests/Runtime/Utils/MatchTransformEdgeTests.cs +34 -0
  1404. package/Tests/Runtime/Utils/MatchTransformEdgeTests.cs.meta +11 -0
  1405. package/Tests/Runtime/Utils/MatchTransformTests.cs +495 -0
  1406. package/Tests/Runtime/Utils/MatchTransformTests.cs.meta +11 -0
  1407. package/Tests/Runtime/Utils/OscillatorTests.cs +540 -0
  1408. package/Tests/Runtime/Utils/OscillatorTests.cs.meta +11 -0
  1409. package/Tests/Runtime/Utils/PolygonCollider2DOptimizerTests.cs +52 -0
  1410. package/Tests/Runtime/Utils/PolygonCollider2DOptimizerTests.cs.meta +11 -0
  1411. package/Tests/Runtime/Utils/RuntimeSingletonTests.cs +766 -0
  1412. package/Tests/Runtime/Utils/RuntimeSingletonTests.cs.meta +11 -0
  1413. package/Tests/Runtime/Utils/SerializedStringComparerEdgeTests.cs +47 -0
  1414. package/Tests/Runtime/Utils/SerializedStringComparerEdgeTests.cs.meta +11 -0
  1415. package/Tests/Runtime/Utils/SerializedStringComparerTests.cs +361 -0
  1416. package/Tests/Runtime/Utils/SerializedStringComparerTests.cs.meta +11 -0
  1417. package/Tests/Runtime/Utils/SpriteRendererMetadataTests.cs +383 -398
  1418. package/Tests/Runtime/Utils/SpriteRendererMetadataTests.cs.meta +2 -2
  1419. package/Tests/Runtime/Utils/SpriteRendererSyncTests.cs +134 -0
  1420. package/Tests/Runtime/Utils/SpriteRendererSyncTests.cs.meta +11 -0
  1421. package/Tests/Runtime/Utils/StartTrackerTests.cs +24 -0
  1422. package/Tests/Runtime/Utils/StartTrackerTests.cs.meta +11 -0
  1423. package/Tests/Runtime/Utils/TextureScaleEdgeTests.cs +114 -0
  1424. package/Tests/Runtime/Utils/TextureScaleEdgeTests.cs.meta +11 -0
  1425. package/Tests/Runtime/Utils/TextureScaleTests.cs +298 -0
  1426. package/Tests/Runtime/Utils/TextureScaleTests.cs.meta +3 -0
  1427. package/Tests/Runtime/Utils/TypeNameSorterAdditionalTests.cs +36 -0
  1428. package/Tests/Runtime/Utils/TypeNameSorterAdditionalTests.cs.meta +11 -0
  1429. package/Tests/Runtime/Utils/TypeNameSorterTests.cs +34 -0
  1430. package/Tests/Runtime/Utils/TypeNameSorterTests.cs.meta +11 -0
  1431. package/Tests/Runtime/Utils/UnityObjectNameComparerEdgeTests.cs +63 -0
  1432. package/Tests/Runtime/Utils/UnityObjectNameComparerEdgeTests.cs.meta +11 -0
  1433. package/Tests/Runtime/Utils/UnityObjectNameComparerTests.cs +59 -0
  1434. package/Tests/Runtime/Utils/UnityObjectNameComparerTests.cs.meta +11 -0
  1435. package/Tests/Runtime/Utils.meta +2 -2
  1436. package/Tests/Runtime/Visuals/AnimatedSpriteLayerTests.cs +266 -0
  1437. package/Tests/Runtime/Visuals/AnimatedSpriteLayerTests.cs.meta +11 -0
  1438. package/Tests/Runtime/Visuals/EnhancedImageTests.cs +153 -0
  1439. package/Tests/Runtime/Visuals/EnhancedImageTests.cs.meta +11 -0
  1440. package/Tests/Runtime/Visuals/LayeredImageTests.cs +422 -0
  1441. package/Tests/Runtime/Visuals/LayeredImageTests.cs.meta +11 -0
  1442. package/Tests/Runtime/Visuals/VisualsTestHelpers.cs +125 -0
  1443. package/Tests/Runtime/Visuals/VisualsTestHelpers.cs.meta +11 -0
  1444. package/Tests/Runtime/Visuals.meta +3 -0
  1445. package/Tests/Runtime/WallstopStudios.UnityHelpers.Tests.Runtime.asmdef +24 -23
  1446. package/Tests/Runtime/WallstopStudios.UnityHelpers.Tests.Runtime.asmdef.meta +7 -7
  1447. package/Tests/Runtime.meta +8 -8
  1448. package/Tests.meta +8 -8
  1449. package/URP/VolumeProfiles/Post Processing Bloom Profile(URP).asset +63 -63
  1450. package/URP/VolumeProfiles/Post Processing Bloom Profile(URP).asset.meta +8 -8
  1451. package/URP/VolumeProfiles.meta +8 -8
  1452. package/URP.meta +8 -8
  1453. package/node_modules.meta +8 -0
  1454. package/package-lock.json.meta +7 -0
  1455. package/package.json +99 -38
  1456. package/package.json.meta +7 -7
  1457. package/scripts/check-eol.ps1 +51 -0
  1458. package/scripts/check-eol.ps1.meta +7 -0
  1459. package/scripts/clean-nul.ps1 +29 -0
  1460. package/scripts/clean-nul.ps1.meta +7 -0
  1461. package/scripts/lint-doc-links.ps1 +80 -0
  1462. package/scripts/lint-doc-links.ps1.meta +7 -0
  1463. package/scripts/lint-tests.ps1 +156 -0
  1464. package/scripts/lint-tests.ps1.meta +7 -0
  1465. package/scripts/normalize-eol.ps1 +68 -0
  1466. package/scripts/normalize-eol.ps1.meta +7 -0
  1467. package/scripts.meta +8 -0
  1468. package/Editor/Sprites/ProjectAnimationSettings.cs +0 -50
  1469. package/Editor/Sprites/ProjectAnimationSettings.cs.meta +0 -3
  1470. package/Editor/Sprites/TextureSettingsApplier.cs +0 -178
  1471. package/Editor/Sprites/TextureSettingsApplier.cs.meta +0 -3
  1472. package/Runtime/Core/Attributes/ParentComponent.cs +0 -189
  1473. package/Runtime/Core/DataStructure/KDTree.cs +0 -434
  1474. package/Runtime/Core/DataStructure/QuadTree.cs +0 -431
  1475. package/Runtime/Core/DataStructure/RTree.cs +0 -356
  1476. package/Runtime/Core/Extension/HashSetExtensions.cs +0 -12
  1477. package/Runtime/Core/Extension/HashSetExtensions.cs.meta +0 -11
  1478. package/Runtime/Core/Math/Line.cs +0 -55
  1479. package/Runtime/Core/Math/Line.cs.meta +0 -11
  1480. package/Runtime/Core/Math/XXHash.cs +0 -310
  1481. package/Runtime/Core/Math/XXHash.cs.meta +0 -11
  1482. package/Tests/Runtime/Components/RelationalComponentsTesterSimple.cs +0 -40
  1483. package/Tests/Runtime/Components.meta +0 -3
  1484. package/Tests/Runtime/DataStructures/BalancedKDTreeTests.cs +0 -14
  1485. package/Tests/Runtime/DataStructures/QuadTreeTests.cs +0 -14
  1486. package/Tests/Runtime/DataStructures/QuadTreeTests.cs.meta +0 -11
  1487. package/Tests/Runtime/DataStructures/SpatialTreeTests.cs +0 -130
  1488. package/Tests/Runtime/DataStructures/SpatialTreeTests.cs.meta +0 -11
  1489. package/Tests/Runtime/DataStructures/UnbalancedKDTreeTests.cs +0 -14
  1490. package/Tests/Runtime/Helper/FormattingHelperTests.cs +0 -129
  1491. package/Tests/Runtime/Helper/FormattingHelperTests.cs.meta +0 -3
  1492. package/Tests/Runtime/Performance/KDTreePerformanceTests.cs +0 -14
  1493. package/Tests/Runtime/Performance/KDTreePerformanceTests.cs.meta +0 -11
  1494. package/Tests/Runtime/Performance/QuadTreePerformanceTests.cs +0 -14
  1495. package/Tests/Runtime/Performance/QuadTreePerformanceTests.cs.meta +0 -11
  1496. package/Tests/Runtime/Performance/SpatialTreePerformanceTest.cs +0 -158
  1497. package/Tests/Runtime/Performance/SpatialTreePerformanceTest.cs.meta +0 -11
  1498. package/Tests/Runtime/Performance/UnbalancedKDTreeTests.cs +0 -14
  1499. package/Tests/Runtime/Performance/UnbalancedKDTreeTests.cs.meta +0 -11
  1500. package/Third Party Notices.md +0 -1
@@ -1,1904 +1,1891 @@
1
- // LzmaEncoder.cs
2
-
3
- using System;
4
-
5
- namespace SevenZip.Compression.LZMA
6
- {
7
- using RangeCoder;
8
-
9
- public class Encoder : ICoder, ISetCoderProperties, IWriteCoderProperties
10
- {
11
- enum EMatchFinderType
12
- {
13
- BT2,
14
- BT4,
15
- };
16
-
17
- const UInt32 kIfinityPrice = 0xFFFFFFF;
18
-
19
- static readonly Byte[] g_FastPos = new Byte[1 << 11];
20
-
21
- static Encoder()
22
- {
23
- const Byte kFastSlots = 22;
24
- int c = 2;
25
- g_FastPos[0] = 0;
26
- g_FastPos[1] = 1;
27
- for (Byte slotFast = 2; slotFast < kFastSlots; slotFast++)
28
- {
29
- UInt32 k = ((UInt32)1 << ((slotFast >> 1) - 1));
30
- for (UInt32 j = 0; j < k; j++, c++)
31
- {
32
- g_FastPos[c] = slotFast;
33
- }
34
- }
35
- }
36
-
37
- static UInt32 GetPosSlot(UInt32 pos)
38
- {
39
- if (pos < (1 << 11))
40
- {
41
- return g_FastPos[pos];
42
- }
43
-
44
- if (pos < (1 << 21))
45
- {
46
- return (UInt32)(g_FastPos[pos >> 10] + 20);
47
- }
48
-
49
- return (UInt32)(g_FastPos[pos >> 20] + 40);
50
- }
51
-
52
- static UInt32 GetPosSlot2(UInt32 pos)
53
- {
54
- if (pos < (1 << 17))
55
- {
56
- return (UInt32)(g_FastPos[pos >> 6] + 12);
57
- }
58
-
59
- if (pos < (1 << 27))
60
- {
61
- return (UInt32)(g_FastPos[pos >> 16] + 32);
62
- }
63
-
64
- return (UInt32)(g_FastPos[pos >> 26] + 52);
65
- }
66
-
67
- Base.State _state = new Base.State();
68
- Byte _previousByte;
69
- readonly UInt32[] _repDistances = new UInt32[Base.kNumRepDistances];
70
-
71
- void BaseInit()
72
- {
73
- _state.Init();
74
- _previousByte = 0;
75
- for (UInt32 i = 0; i < Base.kNumRepDistances; i++)
76
- {
77
- _repDistances[i] = 0;
78
- }
79
- }
80
-
81
- const int kDefaultDictionaryLogSize = 22;
82
- const UInt32 kNumFastBytesDefault = 0x20;
83
-
84
- class LiteralEncoder
85
- {
86
- public struct Encoder2
87
- {
88
- BitEncoder[] m_Encoders;
89
-
90
- public void Create()
91
- {
92
- m_Encoders = new BitEncoder[0x300];
93
- }
94
-
95
- public void Init()
96
- {
97
- for (int i = 0; i < 0x300; i++)
98
- {
99
- m_Encoders[i].Init();
100
- }
101
- }
102
-
103
- public void Encode(RangeCoder.Encoder rangeEncoder, byte symbol)
104
- {
105
- uint context = 1;
106
- for (int i = 7; i >= 0; i--)
107
- {
108
- uint bit = (uint)((symbol >> i) & 1);
109
- m_Encoders[context].Encode(rangeEncoder, bit);
110
- context = (context << 1) | bit;
111
- }
112
- }
113
-
114
- public void EncodeMatched(
115
- RangeCoder.Encoder rangeEncoder,
116
- byte matchByte,
117
- byte symbol
118
- )
119
- {
120
- uint context = 1;
121
- bool same = true;
122
- for (int i = 7; i >= 0; i--)
123
- {
124
- uint bit = (uint)((symbol >> i) & 1);
125
- uint state = context;
126
- if (same)
127
- {
128
- uint matchBit = (uint)((matchByte >> i) & 1);
129
- state += ((1 + matchBit) << 8);
130
- same = (matchBit == bit);
131
- }
132
- m_Encoders[state].Encode(rangeEncoder, bit);
133
- context = (context << 1) | bit;
134
- }
135
- }
136
-
137
- public uint GetPrice(bool matchMode, byte matchByte, byte symbol)
138
- {
139
- uint price = 0;
140
- uint context = 1;
141
- int i = 7;
142
- if (matchMode)
143
- {
144
- for (; i >= 0; i--)
145
- {
146
- uint matchBit = (uint)(matchByte >> i) & 1;
147
- uint bit = (uint)(symbol >> i) & 1;
148
- price += m_Encoders[((1 + matchBit) << 8) + context].GetPrice(bit);
149
- context = (context << 1) | bit;
150
- if (matchBit != bit)
151
- {
152
- i--;
153
- break;
154
- }
155
- }
156
- }
157
- for (; i >= 0; i--)
158
- {
159
- uint bit = (uint)(symbol >> i) & 1;
160
- price += m_Encoders[context].GetPrice(bit);
161
- context = (context << 1) | bit;
162
- }
163
- return price;
164
- }
165
- }
166
-
167
- Encoder2[] m_Coders;
168
- int m_NumPrevBits;
169
- int m_NumPosBits;
170
- uint m_PosMask;
171
-
172
- public void Create(int numPosBits, int numPrevBits)
173
- {
174
- if (m_Coders != null && m_NumPrevBits == numPrevBits && m_NumPosBits == numPosBits)
175
- {
176
- return;
177
- }
178
-
179
- m_NumPosBits = numPosBits;
180
- m_PosMask = ((uint)1 << numPosBits) - 1;
181
- m_NumPrevBits = numPrevBits;
182
- uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
183
- m_Coders = new Encoder2[numStates];
184
- for (uint i = 0; i < numStates; i++)
185
- {
186
- m_Coders[i].Create();
187
- }
188
- }
189
-
190
- public void Init()
191
- {
192
- uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
193
- for (uint i = 0; i < numStates; i++)
194
- {
195
- m_Coders[i].Init();
196
- }
197
- }
198
-
199
- public Encoder2 GetSubCoder(UInt32 pos, Byte prevByte)
200
- {
201
- return m_Coders[
202
- ((pos & m_PosMask) << m_NumPrevBits) + (uint)(prevByte >> (8 - m_NumPrevBits))
203
- ];
204
- }
205
- }
206
-
207
- class LenEncoder
208
- {
209
- RangeCoder.BitEncoder _choice = new RangeCoder.BitEncoder();
210
- RangeCoder.BitEncoder _choice2 = new RangeCoder.BitEncoder();
211
-
212
- readonly RangeCoder.BitTreeEncoder[] _lowCoder = new RangeCoder.BitTreeEncoder[
213
- Base.kNumPosStatesEncodingMax
214
- ];
215
-
216
- readonly RangeCoder.BitTreeEncoder[] _midCoder = new RangeCoder.BitTreeEncoder[
217
- Base.kNumPosStatesEncodingMax
218
- ];
219
- RangeCoder.BitTreeEncoder _highCoder = new RangeCoder.BitTreeEncoder(
220
- Base.kNumHighLenBits
221
- );
222
-
223
- public LenEncoder()
224
- {
225
- for (UInt32 posState = 0; posState < Base.kNumPosStatesEncodingMax; posState++)
226
- {
227
- _lowCoder[posState] = new RangeCoder.BitTreeEncoder(Base.kNumLowLenBits);
228
- _midCoder[posState] = new RangeCoder.BitTreeEncoder(Base.kNumMidLenBits);
229
- }
230
- }
231
-
232
- public void Init(UInt32 numPosStates)
233
- {
234
- _choice.Init();
235
- _choice2.Init();
236
- for (UInt32 posState = 0; posState < numPosStates; posState++)
237
- {
238
- _lowCoder[posState].Init();
239
- _midCoder[posState].Init();
240
- }
241
- _highCoder.Init();
242
- }
243
-
244
- public void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState)
245
- {
246
- if (symbol < Base.kNumLowLenSymbols)
247
- {
248
- _choice.Encode(rangeEncoder, 0);
249
- _lowCoder[posState].Encode(rangeEncoder, symbol);
250
- }
251
- else
252
- {
253
- symbol -= Base.kNumLowLenSymbols;
254
- _choice.Encode(rangeEncoder, 1);
255
- if (symbol < Base.kNumMidLenSymbols)
256
- {
257
- _choice2.Encode(rangeEncoder, 0);
258
- _midCoder[posState].Encode(rangeEncoder, symbol);
259
- }
260
- else
261
- {
262
- _choice2.Encode(rangeEncoder, 1);
263
- _highCoder.Encode(rangeEncoder, symbol - Base.kNumMidLenSymbols);
264
- }
265
- }
266
- }
267
-
268
- public void SetPrices(UInt32 posState, UInt32 numSymbols, UInt32[] prices, UInt32 st)
269
- {
270
- UInt32 a0 = _choice.GetPrice0();
271
- UInt32 a1 = _choice.GetPrice1();
272
- UInt32 b0 = a1 + _choice2.GetPrice0();
273
- UInt32 b1 = a1 + _choice2.GetPrice1();
274
- UInt32 i = 0;
275
- for (i = 0; i < Base.kNumLowLenSymbols; i++)
276
- {
277
- if (i >= numSymbols)
278
- {
279
- return;
280
- }
281
-
282
- prices[st + i] = a0 + _lowCoder[posState].GetPrice(i);
283
- }
284
- for (; i < Base.kNumLowLenSymbols + Base.kNumMidLenSymbols; i++)
285
- {
286
- if (i >= numSymbols)
287
- {
288
- return;
289
- }
290
-
291
- prices[st + i] = b0 + _midCoder[posState].GetPrice(i - Base.kNumLowLenSymbols);
292
- }
293
- for (; i < numSymbols; i++)
294
- {
295
- prices[st + i] =
296
- b1
297
- + _highCoder.GetPrice(i - Base.kNumLowLenSymbols - Base.kNumMidLenSymbols);
298
- }
299
- }
300
- };
301
-
302
- const UInt32 kNumLenSpecSymbols = Base.kNumLowLenSymbols + Base.kNumMidLenSymbols;
303
-
304
- class LenPriceTableEncoder : LenEncoder
305
- {
306
- readonly UInt32[] _prices = new UInt32[
307
- Base.kNumLenSymbols << Base.kNumPosStatesBitsEncodingMax
308
- ];
309
- UInt32 _tableSize;
310
- readonly UInt32[] _counters = new UInt32[Base.kNumPosStatesEncodingMax];
311
-
312
- public void SetTableSize(UInt32 tableSize)
313
- {
314
- _tableSize = tableSize;
315
- }
316
-
317
- public UInt32 GetPrice(UInt32 symbol, UInt32 posState)
318
- {
319
- return _prices[posState * Base.kNumLenSymbols + symbol];
320
- }
321
-
322
- void UpdateTable(UInt32 posState)
323
- {
324
- SetPrices(posState, _tableSize, _prices, posState * Base.kNumLenSymbols);
325
- _counters[posState] = _tableSize;
326
- }
327
-
328
- public void UpdateTables(UInt32 numPosStates)
329
- {
330
- for (UInt32 posState = 0; posState < numPosStates; posState++)
331
- {
332
- UpdateTable(posState);
333
- }
334
- }
335
-
336
- public new void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState)
337
- {
338
- base.Encode(rangeEncoder, symbol, posState);
339
- if (--_counters[posState] == 0)
340
- {
341
- UpdateTable(posState);
342
- }
343
- }
344
- }
345
-
346
- const UInt32 kNumOpts = 1 << 12;
347
-
348
- class Optimal
349
- {
350
- public Base.State State;
351
-
352
- public bool Prev1IsChar;
353
- public bool Prev2;
354
-
355
- public UInt32 PosPrev2;
356
- public UInt32 BackPrev2;
357
-
358
- public UInt32 Price;
359
- public UInt32 PosPrev;
360
- public UInt32 BackPrev;
361
-
362
- public UInt32 Backs0;
363
- public UInt32 Backs1;
364
- public UInt32 Backs2;
365
- public UInt32 Backs3;
366
-
367
- public void MakeAsChar()
368
- {
369
- BackPrev = 0xFFFFFFFF;
370
- Prev1IsChar = false;
371
- }
372
-
373
- public void MakeAsShortRep()
374
- {
375
- BackPrev = 0;
376
- ;
377
- Prev1IsChar = false;
378
- }
379
-
380
- public bool IsShortRep()
381
- {
382
- return (BackPrev == 0);
383
- }
384
- };
385
-
386
- readonly Optimal[] _optimum = new Optimal[kNumOpts];
387
- LZ.IMatchFinder _matchFinder = null;
388
- readonly RangeCoder.Encoder _rangeEncoder = new RangeCoder.Encoder();
389
-
390
- readonly RangeCoder.BitEncoder[] _isMatch = new RangeCoder.BitEncoder[
391
- Base.kNumStates << Base.kNumPosStatesBitsMax
392
- ];
393
-
394
- readonly RangeCoder.BitEncoder[] _isRep = new RangeCoder.BitEncoder[Base.kNumStates];
395
- readonly RangeCoder.BitEncoder[] _isRepG0 = new RangeCoder.BitEncoder[Base.kNumStates];
396
- readonly RangeCoder.BitEncoder[] _isRepG1 = new RangeCoder.BitEncoder[Base.kNumStates];
397
- readonly RangeCoder.BitEncoder[] _isRepG2 = new RangeCoder.BitEncoder[Base.kNumStates];
398
-
399
- readonly RangeCoder.BitEncoder[] _isRep0Long = new RangeCoder.BitEncoder[
400
- Base.kNumStates << Base.kNumPosStatesBitsMax
401
- ];
402
-
403
- readonly RangeCoder.BitTreeEncoder[] _posSlotEncoder = new RangeCoder.BitTreeEncoder[
404
- Base.kNumLenToPosStates
405
- ];
406
-
407
- readonly RangeCoder.BitEncoder[] _posEncoders = new RangeCoder.BitEncoder[
408
- Base.kNumFullDistances - Base.kEndPosModelIndex
409
- ];
410
- RangeCoder.BitTreeEncoder _posAlignEncoder = new RangeCoder.BitTreeEncoder(
411
- Base.kNumAlignBits
412
- );
413
-
414
- readonly LenPriceTableEncoder _lenEncoder = new LenPriceTableEncoder();
415
- readonly LenPriceTableEncoder _repMatchLenEncoder = new LenPriceTableEncoder();
416
-
417
- readonly LiteralEncoder _literalEncoder = new LiteralEncoder();
418
-
419
- readonly UInt32[] _matchDistances = new UInt32[Base.kMatchMaxLen * 2 + 2];
420
-
421
- UInt32 _numFastBytes = kNumFastBytesDefault;
422
- UInt32 _longestMatchLength;
423
- UInt32 _numDistancePairs;
424
-
425
- UInt32 _additionalOffset;
426
-
427
- UInt32 _optimumEndIndex;
428
- UInt32 _optimumCurrentIndex;
429
-
430
- bool _longestMatchWasFound;
431
-
432
- readonly UInt32[] _posSlotPrices = new UInt32[
433
- 1 << (Base.kNumPosSlotBits + Base.kNumLenToPosStatesBits)
434
- ];
435
-
436
- readonly UInt32[] _distancesPrices = new UInt32[
437
- Base.kNumFullDistances << Base.kNumLenToPosStatesBits
438
- ];
439
-
440
- readonly UInt32[] _alignPrices = new UInt32[Base.kAlignTableSize];
441
- UInt32 _alignPriceCount;
442
-
443
- UInt32 _distTableSize = (kDefaultDictionaryLogSize * 2);
444
-
445
- int _posStateBits = 2;
446
- UInt32 _posStateMask = (4 - 1);
447
- int _numLiteralPosStateBits = 0;
448
- int _numLiteralContextBits = 3;
449
-
450
- UInt32 _dictionarySize = (1 << kDefaultDictionaryLogSize);
451
- UInt32 _dictionarySizePrev = 0xFFFFFFFF;
452
- UInt32 _numFastBytesPrev = 0xFFFFFFFF;
453
-
454
- Int64 nowPos64;
455
- bool _finished;
456
- System.IO.Stream _inStream;
457
-
458
- EMatchFinderType _matchFinderType = EMatchFinderType.BT4;
459
- bool _writeEndMark = false;
460
-
461
- bool _needReleaseMFStream;
462
-
463
- void Create()
464
- {
465
- if (_matchFinder == null)
466
- {
467
- LZ.BinTree bt = new LZ.BinTree();
468
- int numHashBytes = 4;
469
- if (_matchFinderType == EMatchFinderType.BT2)
470
- {
471
- numHashBytes = 2;
472
- }
473
-
474
- bt.SetType(numHashBytes);
475
- _matchFinder = bt;
476
- }
477
- _literalEncoder.Create(_numLiteralPosStateBits, _numLiteralContextBits);
478
-
479
- if (_dictionarySize == _dictionarySizePrev && _numFastBytesPrev == _numFastBytes)
480
- {
481
- return;
482
- }
483
-
484
- _matchFinder.Create(_dictionarySize, kNumOpts, _numFastBytes, Base.kMatchMaxLen + 1);
485
- _dictionarySizePrev = _dictionarySize;
486
- _numFastBytesPrev = _numFastBytes;
487
- }
488
-
489
- public Encoder()
490
- {
491
- for (int i = 0; i < kNumOpts; i++)
492
- {
493
- _optimum[i] = new Optimal();
494
- }
495
-
496
- for (int i = 0; i < Base.kNumLenToPosStates; i++)
497
- {
498
- _posSlotEncoder[i] = new RangeCoder.BitTreeEncoder(Base.kNumPosSlotBits);
499
- }
500
- }
501
-
502
- void SetWriteEndMarkerMode(bool writeEndMarker)
503
- {
504
- _writeEndMark = writeEndMarker;
505
- }
506
-
507
- void Init()
508
- {
509
- BaseInit();
510
- _rangeEncoder.Init();
511
-
512
- uint i;
513
- for (i = 0; i < Base.kNumStates; i++)
514
- {
515
- for (uint j = 0; j <= _posStateMask; j++)
516
- {
517
- uint complexState = (i << Base.kNumPosStatesBitsMax) + j;
518
- _isMatch[complexState].Init();
519
- _isRep0Long[complexState].Init();
520
- }
521
- _isRep[i].Init();
522
- _isRepG0[i].Init();
523
- _isRepG1[i].Init();
524
- _isRepG2[i].Init();
525
- }
526
- _literalEncoder.Init();
527
- for (i = 0; i < Base.kNumLenToPosStates; i++)
528
- {
529
- _posSlotEncoder[i].Init();
530
- }
531
-
532
- for (i = 0; i < Base.kNumFullDistances - Base.kEndPosModelIndex; i++)
533
- {
534
- _posEncoders[i].Init();
535
- }
536
-
537
- _lenEncoder.Init((UInt32)1 << _posStateBits);
538
- _repMatchLenEncoder.Init((UInt32)1 << _posStateBits);
539
-
540
- _posAlignEncoder.Init();
541
-
542
- _longestMatchWasFound = false;
543
- _optimumEndIndex = 0;
544
- _optimumCurrentIndex = 0;
545
- _additionalOffset = 0;
546
- }
547
-
548
- void ReadMatchDistances(out UInt32 lenRes, out UInt32 numDistancePairs)
549
- {
550
- lenRes = 0;
551
- numDistancePairs = _matchFinder.GetMatches(_matchDistances);
552
- if (numDistancePairs > 0)
553
- {
554
- lenRes = _matchDistances[numDistancePairs - 2];
555
- if (lenRes == _numFastBytes)
556
- {
557
- lenRes += _matchFinder.GetMatchLen(
558
- (int)lenRes - 1,
559
- _matchDistances[numDistancePairs - 1],
560
- Base.kMatchMaxLen - lenRes
561
- );
562
- }
563
- }
564
- _additionalOffset++;
565
- }
566
-
567
- void MovePos(UInt32 num)
568
- {
569
- if (num > 0)
570
- {
571
- _matchFinder.Skip(num);
572
- _additionalOffset += num;
573
- }
574
- }
575
-
576
- UInt32 GetRepLen1Price(Base.State state, UInt32 posState)
577
- {
578
- return _isRepG0[state.Index].GetPrice0()
579
- + _isRep0Long[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0();
580
- }
581
-
582
- UInt32 GetPureRepPrice(UInt32 repIndex, Base.State state, UInt32 posState)
583
- {
584
- UInt32 price;
585
- if (repIndex == 0)
586
- {
587
- price = _isRepG0[state.Index].GetPrice0();
588
- price += _isRep0Long[(state.Index << Base.kNumPosStatesBitsMax) + posState]
589
- .GetPrice1();
590
- }
591
- else
592
- {
593
- price = _isRepG0[state.Index].GetPrice1();
594
- if (repIndex == 1)
595
- {
596
- price += _isRepG1[state.Index].GetPrice0();
597
- }
598
- else
599
- {
600
- price += _isRepG1[state.Index].GetPrice1();
601
- price += _isRepG2[state.Index].GetPrice(repIndex - 2);
602
- }
603
- }
604
- return price;
605
- }
606
-
607
- UInt32 GetRepPrice(UInt32 repIndex, UInt32 len, Base.State state, UInt32 posState)
608
- {
609
- UInt32 price = _repMatchLenEncoder.GetPrice(len - Base.kMatchMinLen, posState);
610
- return price + GetPureRepPrice(repIndex, state, posState);
611
- }
612
-
613
- UInt32 GetPosLenPrice(UInt32 pos, UInt32 len, UInt32 posState)
614
- {
615
- UInt32 price;
616
- UInt32 lenToPosState = Base.GetLenToPosState(len);
617
- if (pos < Base.kNumFullDistances)
618
- {
619
- price = _distancesPrices[(lenToPosState * Base.kNumFullDistances) + pos];
620
- }
621
- else
622
- {
623
- price =
624
- _posSlotPrices[(lenToPosState << Base.kNumPosSlotBits) + GetPosSlot2(pos)]
625
- + _alignPrices[pos & Base.kAlignMask];
626
- }
627
-
628
- return price + _lenEncoder.GetPrice(len - Base.kMatchMinLen, posState);
629
- }
630
-
631
- UInt32 Backward(out UInt32 backRes, UInt32 cur)
632
- {
633
- _optimumEndIndex = cur;
634
- UInt32 posMem = _optimum[cur].PosPrev;
635
- UInt32 backMem = _optimum[cur].BackPrev;
636
- do
637
- {
638
- if (_optimum[cur].Prev1IsChar)
639
- {
640
- _optimum[posMem].MakeAsChar();
641
- _optimum[posMem].PosPrev = posMem - 1;
642
- if (_optimum[cur].Prev2)
643
- {
644
- _optimum[posMem - 1].Prev1IsChar = false;
645
- _optimum[posMem - 1].PosPrev = _optimum[cur].PosPrev2;
646
- _optimum[posMem - 1].BackPrev = _optimum[cur].BackPrev2;
647
- }
648
- }
649
- UInt32 posPrev = posMem;
650
- UInt32 backCur = backMem;
651
-
652
- backMem = _optimum[posPrev].BackPrev;
653
- posMem = _optimum[posPrev].PosPrev;
654
-
655
- _optimum[posPrev].BackPrev = backCur;
656
- _optimum[posPrev].PosPrev = cur;
657
- cur = posPrev;
658
- } while (cur > 0);
659
- backRes = _optimum[0].BackPrev;
660
- _optimumCurrentIndex = _optimum[0].PosPrev;
661
- return _optimumCurrentIndex;
662
- }
663
-
664
- readonly UInt32[] reps = new UInt32[Base.kNumRepDistances];
665
- readonly UInt32[] repLens = new UInt32[Base.kNumRepDistances];
666
-
667
- UInt32 GetOptimum(UInt32 position, out UInt32 backRes)
668
- {
669
- if (_optimumEndIndex != _optimumCurrentIndex)
670
- {
671
- UInt32 lenRes = _optimum[_optimumCurrentIndex].PosPrev - _optimumCurrentIndex;
672
- backRes = _optimum[_optimumCurrentIndex].BackPrev;
673
- _optimumCurrentIndex = _optimum[_optimumCurrentIndex].PosPrev;
674
- return lenRes;
675
- }
676
- _optimumCurrentIndex = _optimumEndIndex = 0;
677
-
678
- UInt32 lenMain,
679
- numDistancePairs;
680
- if (!_longestMatchWasFound)
681
- {
682
- ReadMatchDistances(out lenMain, out numDistancePairs);
683
- }
684
- else
685
- {
686
- lenMain = _longestMatchLength;
687
- numDistancePairs = _numDistancePairs;
688
- _longestMatchWasFound = false;
689
- }
690
-
691
- UInt32 numAvailableBytes = _matchFinder.GetNumAvailableBytes() + 1;
692
- if (numAvailableBytes < 2)
693
- {
694
- backRes = 0xFFFFFFFF;
695
- return 1;
696
- }
697
- if (numAvailableBytes > Base.kMatchMaxLen)
698
- {
699
- numAvailableBytes = Base.kMatchMaxLen;
700
- }
701
-
702
- UInt32 repMaxIndex = 0;
703
- UInt32 i;
704
- for (i = 0; i < Base.kNumRepDistances; i++)
705
- {
706
- reps[i] = _repDistances[i];
707
- repLens[i] = _matchFinder.GetMatchLen(0 - 1, reps[i], Base.kMatchMaxLen);
708
- if (repLens[i] > repLens[repMaxIndex])
709
- {
710
- repMaxIndex = i;
711
- }
712
- }
713
- if (repLens[repMaxIndex] >= _numFastBytes)
714
- {
715
- backRes = repMaxIndex;
716
- UInt32 lenRes = repLens[repMaxIndex];
717
- MovePos(lenRes - 1);
718
- return lenRes;
719
- }
720
-
721
- if (lenMain >= _numFastBytes)
722
- {
723
- backRes = _matchDistances[numDistancePairs - 1] + Base.kNumRepDistances;
724
- MovePos(lenMain - 1);
725
- return lenMain;
726
- }
727
-
728
- Byte currentByte = _matchFinder.GetIndexByte(0 - 1);
729
- Byte matchByte = _matchFinder.GetIndexByte((Int32)(0 - _repDistances[0] - 1 - 1));
730
-
731
- if (lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2)
732
- {
733
- backRes = (UInt32)0xFFFFFFFF;
734
- return 1;
735
- }
736
-
737
- _optimum[0].State = _state;
738
-
739
- UInt32 posState = (position & _posStateMask);
740
-
741
- _optimum[1].Price =
742
- _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0()
743
- + _literalEncoder
744
- .GetSubCoder(position, _previousByte)
745
- .GetPrice(!_state.IsCharState(), matchByte, currentByte);
746
- _optimum[1].MakeAsChar();
747
-
748
- UInt32 matchPrice = _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState]
749
- .GetPrice1();
750
- UInt32 repMatchPrice = matchPrice + _isRep[_state.Index].GetPrice1();
751
-
752
- if (matchByte == currentByte)
753
- {
754
- UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(_state, posState);
755
- if (shortRepPrice < _optimum[1].Price)
756
- {
757
- _optimum[1].Price = shortRepPrice;
758
- _optimum[1].MakeAsShortRep();
759
- }
760
- }
761
-
762
- UInt32 lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]);
763
-
764
- if (lenEnd < 2)
765
- {
766
- backRes = _optimum[1].BackPrev;
767
- return 1;
768
- }
769
-
770
- _optimum[1].PosPrev = 0;
771
-
772
- _optimum[0].Backs0 = reps[0];
773
- _optimum[0].Backs1 = reps[1];
774
- _optimum[0].Backs2 = reps[2];
775
- _optimum[0].Backs3 = reps[3];
776
-
777
- UInt32 len = lenEnd;
778
- do
779
- {
780
- _optimum[len--].Price = kIfinityPrice;
781
- } while (len >= 2);
782
-
783
- for (i = 0; i < Base.kNumRepDistances; i++)
784
- {
785
- UInt32 repLen = repLens[i];
786
- if (repLen < 2)
787
- {
788
- continue;
789
- }
790
-
791
- UInt32 price = repMatchPrice + GetPureRepPrice(i, _state, posState);
792
- do
793
- {
794
- UInt32 curAndLenPrice =
795
- price + _repMatchLenEncoder.GetPrice(repLen - 2, posState);
796
- Optimal optimum = _optimum[repLen];
797
- if (curAndLenPrice < optimum.Price)
798
- {
799
- optimum.Price = curAndLenPrice;
800
- optimum.PosPrev = 0;
801
- optimum.BackPrev = i;
802
- optimum.Prev1IsChar = false;
803
- }
804
- } while (--repLen >= 2);
805
- }
806
-
807
- UInt32 normalMatchPrice = matchPrice + _isRep[_state.Index].GetPrice0();
808
-
809
- len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
810
- if (len <= lenMain)
811
- {
812
- UInt32 offs = 0;
813
- while (len > _matchDistances[offs])
814
- {
815
- offs += 2;
816
- }
817
-
818
- for (; ; len++)
819
- {
820
- UInt32 distance = _matchDistances[offs + 1];
821
- UInt32 curAndLenPrice =
822
- normalMatchPrice + GetPosLenPrice(distance, len, posState);
823
- Optimal optimum = _optimum[len];
824
- if (curAndLenPrice < optimum.Price)
825
- {
826
- optimum.Price = curAndLenPrice;
827
- optimum.PosPrev = 0;
828
- optimum.BackPrev = distance + Base.kNumRepDistances;
829
- optimum.Prev1IsChar = false;
830
- }
831
- if (len == _matchDistances[offs])
832
- {
833
- offs += 2;
834
- if (offs == numDistancePairs)
835
- {
836
- break;
837
- }
838
- }
839
- }
840
- }
841
-
842
- UInt32 cur = 0;
843
-
844
- while (true)
845
- {
846
- cur++;
847
- if (cur == lenEnd)
848
- {
849
- return Backward(out backRes, cur);
850
- }
851
-
852
- UInt32 newLen;
853
- ReadMatchDistances(out newLen, out numDistancePairs);
854
- if (newLen >= _numFastBytes)
855
- {
856
- _numDistancePairs = numDistancePairs;
857
- _longestMatchLength = newLen;
858
- _longestMatchWasFound = true;
859
- return Backward(out backRes, cur);
860
- }
861
- position++;
862
- UInt32 posPrev = _optimum[cur].PosPrev;
863
- Base.State state;
864
- if (_optimum[cur].Prev1IsChar)
865
- {
866
- posPrev--;
867
- if (_optimum[cur].Prev2)
868
- {
869
- state = _optimum[_optimum[cur].PosPrev2].State;
870
- if (_optimum[cur].BackPrev2 < Base.kNumRepDistances)
871
- {
872
- state.UpdateRep();
873
- }
874
- else
875
- {
876
- state.UpdateMatch();
877
- }
878
- }
879
- else
880
- {
881
- state = _optimum[posPrev].State;
882
- }
883
-
884
- state.UpdateChar();
885
- }
886
- else
887
- {
888
- state = _optimum[posPrev].State;
889
- }
890
-
891
- if (posPrev == cur - 1)
892
- {
893
- if (_optimum[cur].IsShortRep())
894
- {
895
- state.UpdateShortRep();
896
- }
897
- else
898
- {
899
- state.UpdateChar();
900
- }
901
- }
902
- else
903
- {
904
- UInt32 pos;
905
- if (_optimum[cur].Prev1IsChar && _optimum[cur].Prev2)
906
- {
907
- posPrev = _optimum[cur].PosPrev2;
908
- pos = _optimum[cur].BackPrev2;
909
- state.UpdateRep();
910
- }
911
- else
912
- {
913
- pos = _optimum[cur].BackPrev;
914
- if (pos < Base.kNumRepDistances)
915
- {
916
- state.UpdateRep();
917
- }
918
- else
919
- {
920
- state.UpdateMatch();
921
- }
922
- }
923
- Optimal opt = _optimum[posPrev];
924
- if (pos < Base.kNumRepDistances)
925
- {
926
- if (pos == 0)
927
- {
928
- reps[0] = opt.Backs0;
929
- reps[1] = opt.Backs1;
930
- reps[2] = opt.Backs2;
931
- reps[3] = opt.Backs3;
932
- }
933
- else if (pos == 1)
934
- {
935
- reps[0] = opt.Backs1;
936
- reps[1] = opt.Backs0;
937
- reps[2] = opt.Backs2;
938
- reps[3] = opt.Backs3;
939
- }
940
- else if (pos == 2)
941
- {
942
- reps[0] = opt.Backs2;
943
- reps[1] = opt.Backs0;
944
- reps[2] = opt.Backs1;
945
- reps[3] = opt.Backs3;
946
- }
947
- else
948
- {
949
- reps[0] = opt.Backs3;
950
- reps[1] = opt.Backs0;
951
- reps[2] = opt.Backs1;
952
- reps[3] = opt.Backs2;
953
- }
954
- }
955
- else
956
- {
957
- reps[0] = (pos - Base.kNumRepDistances);
958
- reps[1] = opt.Backs0;
959
- reps[2] = opt.Backs1;
960
- reps[3] = opt.Backs2;
961
- }
962
- }
963
- _optimum[cur].State = state;
964
- _optimum[cur].Backs0 = reps[0];
965
- _optimum[cur].Backs1 = reps[1];
966
- _optimum[cur].Backs2 = reps[2];
967
- _optimum[cur].Backs3 = reps[3];
968
- UInt32 curPrice = _optimum[cur].Price;
969
-
970
- currentByte = _matchFinder.GetIndexByte(0 - 1);
971
- matchByte = _matchFinder.GetIndexByte((Int32)(0 - reps[0] - 1 - 1));
972
-
973
- posState = (position & _posStateMask);
974
-
975
- UInt32 curAnd1Price =
976
- curPrice
977
- + _isMatch[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0()
978
- + _literalEncoder
979
- .GetSubCoder(position, _matchFinder.GetIndexByte(0 - 2))
980
- .GetPrice(!state.IsCharState(), matchByte, currentByte);
981
-
982
- Optimal nextOptimum = _optimum[cur + 1];
983
-
984
- bool nextIsChar = false;
985
- if (curAnd1Price < nextOptimum.Price)
986
- {
987
- nextOptimum.Price = curAnd1Price;
988
- nextOptimum.PosPrev = cur;
989
- nextOptimum.MakeAsChar();
990
- nextIsChar = true;
991
- }
992
-
993
- matchPrice =
994
- curPrice
995
- + _isMatch[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice1();
996
- repMatchPrice = matchPrice + _isRep[state.Index].GetPrice1();
997
-
998
- if (
999
- matchByte == currentByte
1000
- && !(nextOptimum.PosPrev < cur && nextOptimum.BackPrev == 0)
1001
- )
1002
- {
1003
- UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(state, posState);
1004
- if (shortRepPrice <= nextOptimum.Price)
1005
- {
1006
- nextOptimum.Price = shortRepPrice;
1007
- nextOptimum.PosPrev = cur;
1008
- nextOptimum.MakeAsShortRep();
1009
- nextIsChar = true;
1010
- }
1011
- }
1012
-
1013
- UInt32 numAvailableBytesFull = _matchFinder.GetNumAvailableBytes() + 1;
1014
- numAvailableBytesFull = Math.Min(kNumOpts - 1 - cur, numAvailableBytesFull);
1015
- numAvailableBytes = numAvailableBytesFull;
1016
-
1017
- if (numAvailableBytes < 2)
1018
- {
1019
- continue;
1020
- }
1021
-
1022
- if (numAvailableBytes > _numFastBytes)
1023
- {
1024
- numAvailableBytes = _numFastBytes;
1025
- }
1026
-
1027
- if (!nextIsChar && matchByte != currentByte)
1028
- {
1029
- // try Literal + rep0
1030
- UInt32 t = Math.Min(numAvailableBytesFull - 1, _numFastBytes);
1031
- UInt32 lenTest2 = _matchFinder.GetMatchLen(0, reps[0], t);
1032
- if (lenTest2 >= 2)
1033
- {
1034
- Base.State state2 = state;
1035
- state2.UpdateChar();
1036
- UInt32 posStateNext = (position + 1) & _posStateMask;
1037
- UInt32 nextRepMatchPrice =
1038
- curAnd1Price
1039
- + _isMatch[(state2.Index << Base.kNumPosStatesBitsMax) + posStateNext]
1040
- .GetPrice1()
1041
- + _isRep[state2.Index].GetPrice1();
1042
- {
1043
- UInt32 offset = cur + 1 + lenTest2;
1044
- while (lenEnd < offset)
1045
- {
1046
- _optimum[++lenEnd].Price = kIfinityPrice;
1047
- }
1048
-
1049
- UInt32 curAndLenPrice =
1050
- nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext);
1051
- Optimal optimum = _optimum[offset];
1052
- if (curAndLenPrice < optimum.Price)
1053
- {
1054
- optimum.Price = curAndLenPrice;
1055
- optimum.PosPrev = cur + 1;
1056
- optimum.BackPrev = 0;
1057
- optimum.Prev1IsChar = true;
1058
- optimum.Prev2 = false;
1059
- }
1060
- }
1061
- }
1062
- }
1063
-
1064
- UInt32 startLen = 2; // speed optimization
1065
-
1066
- for (UInt32 repIndex = 0; repIndex < Base.kNumRepDistances; repIndex++)
1067
- {
1068
- UInt32 lenTest = _matchFinder.GetMatchLen(
1069
- 0 - 1,
1070
- reps[repIndex],
1071
- numAvailableBytes
1072
- );
1073
- if (lenTest < 2)
1074
- {
1075
- continue;
1076
- }
1077
-
1078
- UInt32 lenTestTemp = lenTest;
1079
- do
1080
- {
1081
- while (lenEnd < cur + lenTest)
1082
- {
1083
- _optimum[++lenEnd].Price = kIfinityPrice;
1084
- }
1085
-
1086
- UInt32 curAndLenPrice =
1087
- repMatchPrice + GetRepPrice(repIndex, lenTest, state, posState);
1088
- Optimal optimum = _optimum[cur + lenTest];
1089
- if (curAndLenPrice < optimum.Price)
1090
- {
1091
- optimum.Price = curAndLenPrice;
1092
- optimum.PosPrev = cur;
1093
- optimum.BackPrev = repIndex;
1094
- optimum.Prev1IsChar = false;
1095
- }
1096
- } while (--lenTest >= 2);
1097
- lenTest = lenTestTemp;
1098
-
1099
- if (repIndex == 0)
1100
- {
1101
- startLen = lenTest + 1;
1102
- }
1103
-
1104
- // if (_maxMode)
1105
- if (lenTest < numAvailableBytesFull)
1106
- {
1107
- UInt32 t = Math.Min(numAvailableBytesFull - 1 - lenTest, _numFastBytes);
1108
- UInt32 lenTest2 = _matchFinder.GetMatchLen(
1109
- (Int32)lenTest,
1110
- reps[repIndex],
1111
- t
1112
- );
1113
- if (lenTest2 >= 2)
1114
- {
1115
- Base.State state2 = state;
1116
- state2.UpdateRep();
1117
- UInt32 posStateNext = (position + lenTest) & _posStateMask;
1118
- UInt32 curAndLenCharPrice =
1119
- repMatchPrice
1120
- + GetRepPrice(repIndex, lenTest, state, posState)
1121
- + _isMatch[
1122
- (state2.Index << Base.kNumPosStatesBitsMax) + posStateNext
1123
- ]
1124
- .GetPrice0()
1125
- + _literalEncoder
1126
- .GetSubCoder(
1127
- position + lenTest,
1128
- _matchFinder.GetIndexByte((Int32)lenTest - 1 - 1)
1129
- )
1130
- .GetPrice(
1131
- true,
1132
- _matchFinder.GetIndexByte(
1133
- (Int32)(
1134
- (Int32)lenTest - 1 - (Int32)(reps[repIndex] + 1)
1135
- )
1136
- ),
1137
- _matchFinder.GetIndexByte((Int32)lenTest - 1)
1138
- );
1139
- state2.UpdateChar();
1140
- posStateNext = (position + lenTest + 1) & _posStateMask;
1141
- UInt32 nextMatchPrice =
1142
- curAndLenCharPrice
1143
- + _isMatch[
1144
- (state2.Index << Base.kNumPosStatesBitsMax) + posStateNext
1145
- ]
1146
- .GetPrice1();
1147
- UInt32 nextRepMatchPrice =
1148
- nextMatchPrice + _isRep[state2.Index].GetPrice1();
1149
-
1150
- // for(; lenTest2 >= 2; lenTest2--)
1151
- {
1152
- UInt32 offset = lenTest + 1 + lenTest2;
1153
- while (lenEnd < cur + offset)
1154
- {
1155
- _optimum[++lenEnd].Price = kIfinityPrice;
1156
- }
1157
-
1158
- UInt32 curAndLenPrice =
1159
- nextRepMatchPrice
1160
- + GetRepPrice(0, lenTest2, state2, posStateNext);
1161
- Optimal optimum = _optimum[cur + offset];
1162
- if (curAndLenPrice < optimum.Price)
1163
- {
1164
- optimum.Price = curAndLenPrice;
1165
- optimum.PosPrev = cur + lenTest + 1;
1166
- optimum.BackPrev = 0;
1167
- optimum.Prev1IsChar = true;
1168
- optimum.Prev2 = true;
1169
- optimum.PosPrev2 = cur;
1170
- optimum.BackPrev2 = repIndex;
1171
- }
1172
- }
1173
- }
1174
- }
1175
- }
1176
-
1177
- if (newLen > numAvailableBytes)
1178
- {
1179
- newLen = numAvailableBytes;
1180
- for (
1181
- numDistancePairs = 0;
1182
- newLen > _matchDistances[numDistancePairs];
1183
- numDistancePairs += 2
1184
- )
1185
- {
1186
- ;
1187
- }
1188
-
1189
- _matchDistances[numDistancePairs] = newLen;
1190
- numDistancePairs += 2;
1191
- }
1192
- if (newLen >= startLen)
1193
- {
1194
- normalMatchPrice = matchPrice + _isRep[state.Index].GetPrice0();
1195
- while (lenEnd < cur + newLen)
1196
- {
1197
- _optimum[++lenEnd].Price = kIfinityPrice;
1198
- }
1199
-
1200
- UInt32 offs = 0;
1201
- while (startLen > _matchDistances[offs])
1202
- {
1203
- offs += 2;
1204
- }
1205
-
1206
- for (UInt32 lenTest = startLen; ; lenTest++)
1207
- {
1208
- UInt32 curBack = _matchDistances[offs + 1];
1209
- UInt32 curAndLenPrice =
1210
- normalMatchPrice + GetPosLenPrice(curBack, lenTest, posState);
1211
- Optimal optimum = _optimum[cur + lenTest];
1212
- if (curAndLenPrice < optimum.Price)
1213
- {
1214
- optimum.Price = curAndLenPrice;
1215
- optimum.PosPrev = cur;
1216
- optimum.BackPrev = curBack + Base.kNumRepDistances;
1217
- optimum.Prev1IsChar = false;
1218
- }
1219
-
1220
- if (lenTest == _matchDistances[offs])
1221
- {
1222
- if (lenTest < numAvailableBytesFull)
1223
- {
1224
- UInt32 t = Math.Min(
1225
- numAvailableBytesFull - 1 - lenTest,
1226
- _numFastBytes
1227
- );
1228
- UInt32 lenTest2 = _matchFinder.GetMatchLen(
1229
- (Int32)lenTest,
1230
- curBack,
1231
- t
1232
- );
1233
- if (lenTest2 >= 2)
1234
- {
1235
- Base.State state2 = state;
1236
- state2.UpdateMatch();
1237
- UInt32 posStateNext = (position + lenTest) & _posStateMask;
1238
- UInt32 curAndLenCharPrice =
1239
- curAndLenPrice
1240
- + _isMatch[
1241
- (state2.Index << Base.kNumPosStatesBitsMax)
1242
- + posStateNext
1243
- ]
1244
- .GetPrice0()
1245
- + _literalEncoder
1246
- .GetSubCoder(
1247
- position + lenTest,
1248
- _matchFinder.GetIndexByte((Int32)lenTest - 1 - 1)
1249
- )
1250
- .GetPrice(
1251
- true,
1252
- _matchFinder.GetIndexByte(
1253
- (Int32)lenTest - (Int32)(curBack + 1) - 1
1254
- ),
1255
- _matchFinder.GetIndexByte((Int32)lenTest - 1)
1256
- );
1257
- state2.UpdateChar();
1258
- posStateNext = (position + lenTest + 1) & _posStateMask;
1259
- UInt32 nextMatchPrice =
1260
- curAndLenCharPrice
1261
- + _isMatch[
1262
- (state2.Index << Base.kNumPosStatesBitsMax)
1263
- + posStateNext
1264
- ]
1265
- .GetPrice1();
1266
- UInt32 nextRepMatchPrice =
1267
- nextMatchPrice + _isRep[state2.Index].GetPrice1();
1268
-
1269
- UInt32 offset = lenTest + 1 + lenTest2;
1270
- while (lenEnd < cur + offset)
1271
- {
1272
- _optimum[++lenEnd].Price = kIfinityPrice;
1273
- }
1274
-
1275
- curAndLenPrice =
1276
- nextRepMatchPrice
1277
- + GetRepPrice(0, lenTest2, state2, posStateNext);
1278
- optimum = _optimum[cur + offset];
1279
- if (curAndLenPrice < optimum.Price)
1280
- {
1281
- optimum.Price = curAndLenPrice;
1282
- optimum.PosPrev = cur + lenTest + 1;
1283
- optimum.BackPrev = 0;
1284
- optimum.Prev1IsChar = true;
1285
- optimum.Prev2 = true;
1286
- optimum.PosPrev2 = cur;
1287
- optimum.BackPrev2 = curBack + Base.kNumRepDistances;
1288
- }
1289
- }
1290
- }
1291
- offs += 2;
1292
- if (offs == numDistancePairs)
1293
- {
1294
- break;
1295
- }
1296
- }
1297
- }
1298
- }
1299
- }
1300
- }
1301
-
1302
- bool ChangePair(UInt32 smallDist, UInt32 bigDist)
1303
- {
1304
- const int kDif = 7;
1305
- return (smallDist < ((UInt32)(1) << (32 - kDif)) && bigDist >= (smallDist << kDif));
1306
- }
1307
-
1308
- void WriteEndMarker(UInt32 posState)
1309
- {
1310
- if (!_writeEndMark)
1311
- {
1312
- return;
1313
- }
1314
-
1315
- _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState]
1316
- .Encode(_rangeEncoder, 1);
1317
- _isRep[_state.Index].Encode(_rangeEncoder, 0);
1318
- _state.UpdateMatch();
1319
- UInt32 len = Base.kMatchMinLen;
1320
- _lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
1321
- UInt32 posSlot = (1 << Base.kNumPosSlotBits) - 1;
1322
- UInt32 lenToPosState = Base.GetLenToPosState(len);
1323
- _posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
1324
- int footerBits = 30;
1325
- UInt32 posReduced = (((UInt32)1) << footerBits) - 1;
1326
- _rangeEncoder.EncodeDirectBits(
1327
- posReduced >> Base.kNumAlignBits,
1328
- footerBits - Base.kNumAlignBits
1329
- );
1330
- _posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
1331
- }
1332
-
1333
- void Flush(UInt32 nowPos)
1334
- {
1335
- ReleaseMFStream();
1336
- WriteEndMarker(nowPos & _posStateMask);
1337
- _rangeEncoder.FlushData();
1338
- _rangeEncoder.FlushStream();
1339
- }
1340
-
1341
- public void CodeOneBlock(out Int64 inSize, out Int64 outSize, out bool finished)
1342
- {
1343
- inSize = 0;
1344
- outSize = 0;
1345
- finished = true;
1346
-
1347
- if (_inStream != null)
1348
- {
1349
- _matchFinder.SetStream(_inStream);
1350
- _matchFinder.Init();
1351
- _needReleaseMFStream = true;
1352
- _inStream = null;
1353
- if (_trainSize > 0)
1354
- {
1355
- _matchFinder.Skip(_trainSize);
1356
- }
1357
- }
1358
-
1359
- if (_finished)
1360
- {
1361
- return;
1362
- }
1363
-
1364
- _finished = true;
1365
-
1366
- Int64 progressPosValuePrev = nowPos64;
1367
- if (nowPos64 == 0)
1368
- {
1369
- if (_matchFinder.GetNumAvailableBytes() == 0)
1370
- {
1371
- Flush((UInt32)nowPos64);
1372
- return;
1373
- }
1374
- UInt32 len,
1375
- numDistancePairs; // it's not used
1376
- ReadMatchDistances(out len, out numDistancePairs);
1377
- UInt32 posState = (UInt32)(nowPos64) & _posStateMask;
1378
- _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState]
1379
- .Encode(_rangeEncoder, 0);
1380
- _state.UpdateChar();
1381
- Byte curByte = _matchFinder.GetIndexByte((Int32)(0 - _additionalOffset));
1382
- _literalEncoder
1383
- .GetSubCoder((UInt32)(nowPos64), _previousByte)
1384
- .Encode(_rangeEncoder, curByte);
1385
- _previousByte = curByte;
1386
- _additionalOffset--;
1387
- nowPos64++;
1388
- }
1389
- if (_matchFinder.GetNumAvailableBytes() == 0)
1390
- {
1391
- Flush((UInt32)nowPos64);
1392
- return;
1393
- }
1394
- while (true)
1395
- {
1396
- UInt32 pos;
1397
- UInt32 len = GetOptimum((UInt32)nowPos64, out pos);
1398
-
1399
- UInt32 posState = ((UInt32)nowPos64) & _posStateMask;
1400
- UInt32 complexState = (_state.Index << Base.kNumPosStatesBitsMax) + posState;
1401
- if (len == 1 && pos == 0xFFFFFFFF)
1402
- {
1403
- _isMatch[complexState].Encode(_rangeEncoder, 0);
1404
- Byte curByte = _matchFinder.GetIndexByte((Int32)(0 - _additionalOffset));
1405
- LiteralEncoder.Encoder2 subCoder = _literalEncoder.GetSubCoder(
1406
- (UInt32)nowPos64,
1407
- _previousByte
1408
- );
1409
- if (!_state.IsCharState())
1410
- {
1411
- Byte matchByte = _matchFinder.GetIndexByte(
1412
- (Int32)(0 - _repDistances[0] - 1 - _additionalOffset)
1413
- );
1414
- subCoder.EncodeMatched(_rangeEncoder, matchByte, curByte);
1415
- }
1416
- else
1417
- {
1418
- subCoder.Encode(_rangeEncoder, curByte);
1419
- }
1420
-
1421
- _previousByte = curByte;
1422
- _state.UpdateChar();
1423
- }
1424
- else
1425
- {
1426
- _isMatch[complexState].Encode(_rangeEncoder, 1);
1427
- if (pos < Base.kNumRepDistances)
1428
- {
1429
- _isRep[_state.Index].Encode(_rangeEncoder, 1);
1430
- if (pos == 0)
1431
- {
1432
- _isRepG0[_state.Index].Encode(_rangeEncoder, 0);
1433
- if (len == 1)
1434
- {
1435
- _isRep0Long[complexState].Encode(_rangeEncoder, 0);
1436
- }
1437
- else
1438
- {
1439
- _isRep0Long[complexState].Encode(_rangeEncoder, 1);
1440
- }
1441
- }
1442
- else
1443
- {
1444
- _isRepG0[_state.Index].Encode(_rangeEncoder, 1);
1445
- if (pos == 1)
1446
- {
1447
- _isRepG1[_state.Index].Encode(_rangeEncoder, 0);
1448
- }
1449
- else
1450
- {
1451
- _isRepG1[_state.Index].Encode(_rangeEncoder, 1);
1452
- _isRepG2[_state.Index].Encode(_rangeEncoder, pos - 2);
1453
- }
1454
- }
1455
- if (len == 1)
1456
- {
1457
- _state.UpdateShortRep();
1458
- }
1459
- else
1460
- {
1461
- _repMatchLenEncoder.Encode(
1462
- _rangeEncoder,
1463
- len - Base.kMatchMinLen,
1464
- posState
1465
- );
1466
- _state.UpdateRep();
1467
- }
1468
- UInt32 distance = _repDistances[pos];
1469
- if (pos != 0)
1470
- {
1471
- for (UInt32 i = pos; i >= 1; i--)
1472
- {
1473
- _repDistances[i] = _repDistances[i - 1];
1474
- }
1475
-
1476
- _repDistances[0] = distance;
1477
- }
1478
- }
1479
- else
1480
- {
1481
- _isRep[_state.Index].Encode(_rangeEncoder, 0);
1482
- _state.UpdateMatch();
1483
- _lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
1484
- pos -= Base.kNumRepDistances;
1485
- UInt32 posSlot = GetPosSlot(pos);
1486
- UInt32 lenToPosState = Base.GetLenToPosState(len);
1487
- _posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
1488
-
1489
- if (posSlot >= Base.kStartPosModelIndex)
1490
- {
1491
- int footerBits = (int)((posSlot >> 1) - 1);
1492
- UInt32 baseVal = ((2 | (posSlot & 1)) << footerBits);
1493
- UInt32 posReduced = pos - baseVal;
1494
-
1495
- if (posSlot < Base.kEndPosModelIndex)
1496
- {
1497
- RangeCoder.BitTreeEncoder.ReverseEncode(
1498
- _posEncoders,
1499
- baseVal - posSlot - 1,
1500
- _rangeEncoder,
1501
- footerBits,
1502
- posReduced
1503
- );
1504
- }
1505
- else
1506
- {
1507
- _rangeEncoder.EncodeDirectBits(
1508
- posReduced >> Base.kNumAlignBits,
1509
- footerBits - Base.kNumAlignBits
1510
- );
1511
- _posAlignEncoder.ReverseEncode(
1512
- _rangeEncoder,
1513
- posReduced & Base.kAlignMask
1514
- );
1515
- _alignPriceCount++;
1516
- }
1517
- }
1518
- UInt32 distance = pos;
1519
- for (UInt32 i = Base.kNumRepDistances - 1; i >= 1; i--)
1520
- {
1521
- _repDistances[i] = _repDistances[i - 1];
1522
- }
1523
-
1524
- _repDistances[0] = distance;
1525
- _matchPriceCount++;
1526
- }
1527
- _previousByte = _matchFinder.GetIndexByte((Int32)(len - 1 - _additionalOffset));
1528
- }
1529
- _additionalOffset -= len;
1530
- nowPos64 += len;
1531
- if (_additionalOffset == 0)
1532
- {
1533
- // if (!_fastMode)
1534
- if (_matchPriceCount >= (1 << 7))
1535
- {
1536
- FillDistancesPrices();
1537
- }
1538
-
1539
- if (_alignPriceCount >= Base.kAlignTableSize)
1540
- {
1541
- FillAlignPrices();
1542
- }
1543
-
1544
- inSize = nowPos64;
1545
- outSize = _rangeEncoder.GetProcessedSizeAdd();
1546
- if (_matchFinder.GetNumAvailableBytes() == 0)
1547
- {
1548
- Flush((UInt32)nowPos64);
1549
- return;
1550
- }
1551
-
1552
- if (nowPos64 - progressPosValuePrev >= (1 << 12))
1553
- {
1554
- _finished = false;
1555
- finished = false;
1556
- return;
1557
- }
1558
- }
1559
- }
1560
- }
1561
-
1562
- void ReleaseMFStream()
1563
- {
1564
- if (_matchFinder != null && _needReleaseMFStream)
1565
- {
1566
- _matchFinder.ReleaseStream();
1567
- _needReleaseMFStream = false;
1568
- }
1569
- }
1570
-
1571
- void SetOutStream(System.IO.Stream outStream)
1572
- {
1573
- _rangeEncoder.SetStream(outStream);
1574
- }
1575
-
1576
- void ReleaseOutStream()
1577
- {
1578
- _rangeEncoder.ReleaseStream();
1579
- }
1580
-
1581
- void ReleaseStreams()
1582
- {
1583
- ReleaseMFStream();
1584
- ReleaseOutStream();
1585
- }
1586
-
1587
- void SetStreams(
1588
- System.IO.Stream inStream,
1589
- System.IO.Stream outStream,
1590
- Int64 inSize,
1591
- Int64 outSize
1592
- )
1593
- {
1594
- _inStream = inStream;
1595
- _finished = false;
1596
- Create();
1597
- SetOutStream(outStream);
1598
- Init();
1599
-
1600
- // if (!_fastMode)
1601
- {
1602
- FillDistancesPrices();
1603
- FillAlignPrices();
1604
- }
1605
-
1606
- _lenEncoder.SetTableSize(_numFastBytes + 1 - Base.kMatchMinLen);
1607
- _lenEncoder.UpdateTables((UInt32)1 << _posStateBits);
1608
- _repMatchLenEncoder.SetTableSize(_numFastBytes + 1 - Base.kMatchMinLen);
1609
- _repMatchLenEncoder.UpdateTables((UInt32)1 << _posStateBits);
1610
-
1611
- nowPos64 = 0;
1612
- }
1613
-
1614
- public void Code(
1615
- System.IO.Stream inStream,
1616
- System.IO.Stream outStream,
1617
- Int64 inSize,
1618
- Int64 outSize,
1619
- ICodeProgress progress
1620
- )
1621
- {
1622
- _needReleaseMFStream = false;
1623
- try
1624
- {
1625
- SetStreams(inStream, outStream, inSize, outSize);
1626
- while (true)
1627
- {
1628
- Int64 processedInSize;
1629
- Int64 processedOutSize;
1630
- bool finished;
1631
- CodeOneBlock(out processedInSize, out processedOutSize, out finished);
1632
- if (finished)
1633
- {
1634
- return;
1635
- }
1636
-
1637
- if (progress != null)
1638
- {
1639
- progress.SetProgress(processedInSize, processedOutSize);
1640
- }
1641
- }
1642
- }
1643
- finally
1644
- {
1645
- ReleaseStreams();
1646
- }
1647
- }
1648
-
1649
- const int kPropSize = 5;
1650
- readonly Byte[] properties = new Byte[kPropSize];
1651
-
1652
- public void WriteCoderProperties(System.IO.Stream outStream)
1653
- {
1654
- properties[0] = (Byte)(
1655
- (_posStateBits * 5 + _numLiteralPosStateBits) * 9 + _numLiteralContextBits
1656
- );
1657
- for (int i = 0; i < 4; i++)
1658
- {
1659
- properties[1 + i] = (Byte)((_dictionarySize >> (8 * i)) & 0xFF);
1660
- }
1661
-
1662
- outStream.Write(properties, 0, kPropSize);
1663
- }
1664
-
1665
- readonly UInt32[] tempPrices = new UInt32[Base.kNumFullDistances];
1666
- UInt32 _matchPriceCount;
1667
-
1668
- void FillDistancesPrices()
1669
- {
1670
- for (UInt32 i = Base.kStartPosModelIndex; i < Base.kNumFullDistances; i++)
1671
- {
1672
- UInt32 posSlot = GetPosSlot(i);
1673
- int footerBits = (int)((posSlot >> 1) - 1);
1674
- UInt32 baseVal = ((2 | (posSlot & 1)) << footerBits);
1675
- tempPrices[i] = BitTreeEncoder.ReverseGetPrice(
1676
- _posEncoders,
1677
- baseVal - posSlot - 1,
1678
- footerBits,
1679
- i - baseVal
1680
- );
1681
- }
1682
-
1683
- for (UInt32 lenToPosState = 0; lenToPosState < Base.kNumLenToPosStates; lenToPosState++)
1684
- {
1685
- UInt32 posSlot;
1686
- RangeCoder.BitTreeEncoder encoder = _posSlotEncoder[lenToPosState];
1687
-
1688
- UInt32 st = (lenToPosState << Base.kNumPosSlotBits);
1689
- for (posSlot = 0; posSlot < _distTableSize; posSlot++)
1690
- {
1691
- _posSlotPrices[st + posSlot] = encoder.GetPrice(posSlot);
1692
- }
1693
-
1694
- for (posSlot = Base.kEndPosModelIndex; posSlot < _distTableSize; posSlot++)
1695
- {
1696
- _posSlotPrices[st + posSlot] += (
1697
- (((posSlot >> 1) - 1) - Base.kNumAlignBits)
1698
- << RangeCoder.BitEncoder.kNumBitPriceShiftBits
1699
- );
1700
- }
1701
-
1702
- UInt32 st2 = lenToPosState * Base.kNumFullDistances;
1703
- UInt32 i;
1704
- for (i = 0; i < Base.kStartPosModelIndex; i++)
1705
- {
1706
- _distancesPrices[st2 + i] = _posSlotPrices[st + i];
1707
- }
1708
-
1709
- for (; i < Base.kNumFullDistances; i++)
1710
- {
1711
- _distancesPrices[st2 + i] = _posSlotPrices[st + GetPosSlot(i)] + tempPrices[i];
1712
- }
1713
- }
1714
- _matchPriceCount = 0;
1715
- }
1716
-
1717
- void FillAlignPrices()
1718
- {
1719
- for (UInt32 i = 0; i < Base.kAlignTableSize; i++)
1720
- {
1721
- _alignPrices[i] = _posAlignEncoder.ReverseGetPrice(i);
1722
- }
1723
-
1724
- _alignPriceCount = 0;
1725
- }
1726
-
1727
- static readonly string[] kMatchFinderIDs = { "BT2", "BT4" };
1728
-
1729
- static int FindMatchFinder(string s)
1730
- {
1731
- for (int m = 0; m < kMatchFinderIDs.Length; m++)
1732
- {
1733
- if (s == kMatchFinderIDs[m])
1734
- {
1735
- return m;
1736
- }
1737
- }
1738
-
1739
- return -1;
1740
- }
1741
-
1742
- public void SetCoderProperties(CoderPropID[] propIDs, object[] properties)
1743
- {
1744
- for (UInt32 i = 0; i < properties.Length; i++)
1745
- {
1746
- object prop = properties[i];
1747
- switch (propIDs[i])
1748
- {
1749
- case CoderPropID.NumFastBytes:
1750
- {
1751
- if (!(prop is Int32))
1752
- {
1753
- throw new InvalidParamException();
1754
- }
1755
-
1756
- Int32 numFastBytes = (Int32)prop;
1757
- if (numFastBytes < 5 || numFastBytes > Base.kMatchMaxLen)
1758
- {
1759
- throw new InvalidParamException();
1760
- }
1761
-
1762
- _numFastBytes = (UInt32)numFastBytes;
1763
- break;
1764
- }
1765
- case CoderPropID.Algorithm:
1766
- {
1767
- /*
1768
- if (!(prop is Int32))
1769
- throw new InvalidParamException();
1770
- Int32 maximize = (Int32)prop;
1771
- _fastMode = (maximize == 0);
1772
- _maxMode = (maximize >= 2);
1773
- */
1774
- break;
1775
- }
1776
- case CoderPropID.MatchFinder:
1777
- {
1778
- if (!(prop is String))
1779
- {
1780
- throw new InvalidParamException();
1781
- }
1782
-
1783
- EMatchFinderType matchFinderIndexPrev = _matchFinderType;
1784
- int m = FindMatchFinder(((string)prop).ToUpper());
1785
- if (m < 0)
1786
- {
1787
- throw new InvalidParamException();
1788
- }
1789
-
1790
- _matchFinderType = (EMatchFinderType)m;
1791
- if (_matchFinder != null && matchFinderIndexPrev != _matchFinderType)
1792
- {
1793
- _dictionarySizePrev = 0xFFFFFFFF;
1794
- _matchFinder = null;
1795
- }
1796
- break;
1797
- }
1798
- case CoderPropID.DictionarySize:
1799
- {
1800
- const int kDicLogSizeMaxCompress = 30;
1801
- if (!(prop is Int32))
1802
- {
1803
- throw new InvalidParamException();
1804
- }
1805
- ;
1806
- Int32 dictionarySize = (Int32)prop;
1807
- if (
1808
- dictionarySize < (UInt32)(1 << Base.kDicLogSizeMin)
1809
- || dictionarySize > (UInt32)(1 << kDicLogSizeMaxCompress)
1810
- )
1811
- {
1812
- throw new InvalidParamException();
1813
- }
1814
-
1815
- _dictionarySize = (UInt32)dictionarySize;
1816
- int dicLogSize;
1817
- for (
1818
- dicLogSize = 0;
1819
- dicLogSize < (UInt32)kDicLogSizeMaxCompress;
1820
- dicLogSize++
1821
- )
1822
- {
1823
- if (dictionarySize <= ((UInt32)(1) << dicLogSize))
1824
- {
1825
- break;
1826
- }
1827
- }
1828
-
1829
- _distTableSize = (UInt32)dicLogSize * 2;
1830
- break;
1831
- }
1832
- case CoderPropID.PosStateBits:
1833
- {
1834
- if (!(prop is Int32))
1835
- {
1836
- throw new InvalidParamException();
1837
- }
1838
-
1839
- Int32 v = (Int32)prop;
1840
- if (v < 0 || v > (UInt32)Base.kNumPosStatesBitsEncodingMax)
1841
- {
1842
- throw new InvalidParamException();
1843
- }
1844
-
1845
- _posStateBits = (int)v;
1846
- _posStateMask = (((UInt32)1) << (int)_posStateBits) - 1;
1847
- break;
1848
- }
1849
- case CoderPropID.LitPosBits:
1850
- {
1851
- if (!(prop is Int32))
1852
- {
1853
- throw new InvalidParamException();
1854
- }
1855
-
1856
- Int32 v = (Int32)prop;
1857
- if (v < 0 || v > (UInt32)Base.kNumLitPosStatesBitsEncodingMax)
1858
- {
1859
- throw new InvalidParamException();
1860
- }
1861
-
1862
- _numLiteralPosStateBits = (int)v;
1863
- break;
1864
- }
1865
- case CoderPropID.LitContextBits:
1866
- {
1867
- if (!(prop is Int32))
1868
- {
1869
- throw new InvalidParamException();
1870
- }
1871
-
1872
- Int32 v = (Int32)prop;
1873
- if (v < 0 || v > (UInt32)Base.kNumLitContextBitsMax)
1874
- {
1875
- throw new InvalidParamException();
1876
- }
1877
- ;
1878
- _numLiteralContextBits = (int)v;
1879
- break;
1880
- }
1881
- case CoderPropID.EndMarker:
1882
- {
1883
- if (!(prop is Boolean))
1884
- {
1885
- throw new InvalidParamException();
1886
- }
1887
-
1888
- SetWriteEndMarkerMode((Boolean)prop);
1889
- break;
1890
- }
1891
- default:
1892
- throw new InvalidParamException();
1893
- }
1894
- }
1895
- }
1896
-
1897
- uint _trainSize = 0;
1898
-
1899
- public void SetTrainSize(uint trainSize)
1900
- {
1901
- _trainSize = trainSize;
1902
- }
1903
- }
1904
- }
1
+ // LzmaEncoder.cs
2
+
3
+ using System;
4
+
5
+ namespace SevenZip.Compression.LZMA
6
+ {
7
+ using RangeCoder;
8
+
9
+ public class Encoder : ICoder, ISetCoderProperties, IWriteCoderProperties
10
+ {
11
+ enum EMatchFinderType
12
+ {
13
+ BT2,
14
+ BT4,
15
+ };
16
+
17
+ const UInt32 kIfinityPrice = 0xFFFFFFF;
18
+
19
+ static readonly Byte[] g_FastPos = new Byte[1 << 11];
20
+
21
+ static Encoder()
22
+ {
23
+ const Byte kFastSlots = 22;
24
+ int c = 2;
25
+ g_FastPos[0] = 0;
26
+ g_FastPos[1] = 1;
27
+ for (Byte slotFast = 2; slotFast < kFastSlots; slotFast++)
28
+ {
29
+ UInt32 k = ((UInt32)1 << ((slotFast >> 1) - 1));
30
+ for (UInt32 j = 0; j < k; j++, c++)
31
+ {
32
+ g_FastPos[c] = slotFast;
33
+ }
34
+ }
35
+ }
36
+
37
+ static UInt32 GetPosSlot(UInt32 pos)
38
+ {
39
+ if (pos < (1 << 11))
40
+ {
41
+ return g_FastPos[pos];
42
+ }
43
+
44
+ if (pos < (1 << 21))
45
+ {
46
+ return (UInt32)(g_FastPos[pos >> 10] + 20);
47
+ }
48
+
49
+ return (UInt32)(g_FastPos[pos >> 20] + 40);
50
+ }
51
+
52
+ static UInt32 GetPosSlot2(UInt32 pos)
53
+ {
54
+ if (pos < (1 << 17))
55
+ {
56
+ return (UInt32)(g_FastPos[pos >> 6] + 12);
57
+ }
58
+
59
+ if (pos < (1 << 27))
60
+ {
61
+ return (UInt32)(g_FastPos[pos >> 16] + 32);
62
+ }
63
+
64
+ return (UInt32)(g_FastPos[pos >> 26] + 52);
65
+ }
66
+
67
+ Base.State _state = new();
68
+ Byte _previousByte;
69
+ readonly UInt32[] _repDistances = new UInt32[Base.kNumRepDistances];
70
+
71
+ void BaseInit()
72
+ {
73
+ _state.Init();
74
+ _previousByte = 0;
75
+ for (UInt32 i = 0; i < Base.kNumRepDistances; i++)
76
+ {
77
+ _repDistances[i] = 0;
78
+ }
79
+ }
80
+
81
+ const int kDefaultDictionaryLogSize = 22;
82
+ const UInt32 kNumFastBytesDefault = 0x20;
83
+
84
+ class LiteralEncoder
85
+ {
86
+ public struct Encoder2
87
+ {
88
+ BitEncoder[] m_Encoders;
89
+
90
+ public void Create()
91
+ {
92
+ m_Encoders = new BitEncoder[0x300];
93
+ }
94
+
95
+ public void Init()
96
+ {
97
+ for (int i = 0; i < 0x300; i++)
98
+ {
99
+ m_Encoders[i].Init();
100
+ }
101
+ }
102
+
103
+ public void Encode(RangeCoder.Encoder rangeEncoder, byte symbol)
104
+ {
105
+ uint context = 1;
106
+ for (int i = 7; i >= 0; i--)
107
+ {
108
+ uint bit = (uint)((symbol >> i) & 1);
109
+ m_Encoders[context].Encode(rangeEncoder, bit);
110
+ context = (context << 1) | bit;
111
+ }
112
+ }
113
+
114
+ public void EncodeMatched(
115
+ RangeCoder.Encoder rangeEncoder,
116
+ byte matchByte,
117
+ byte symbol
118
+ )
119
+ {
120
+ uint context = 1;
121
+ bool same = true;
122
+ for (int i = 7; i >= 0; i--)
123
+ {
124
+ uint bit = (uint)((symbol >> i) & 1);
125
+ uint state = context;
126
+ if (same)
127
+ {
128
+ uint matchBit = (uint)((matchByte >> i) & 1);
129
+ state += ((1 + matchBit) << 8);
130
+ same = (matchBit == bit);
131
+ }
132
+ m_Encoders[state].Encode(rangeEncoder, bit);
133
+ context = (context << 1) | bit;
134
+ }
135
+ }
136
+
137
+ public uint GetPrice(bool matchMode, byte matchByte, byte symbol)
138
+ {
139
+ uint price = 0;
140
+ uint context = 1;
141
+ int i = 7;
142
+ if (matchMode)
143
+ {
144
+ for (; i >= 0; i--)
145
+ {
146
+ uint matchBit = (uint)(matchByte >> i) & 1;
147
+ uint bit = (uint)(symbol >> i) & 1;
148
+ price += m_Encoders[((1 + matchBit) << 8) + context].GetPrice(bit);
149
+ context = (context << 1) | bit;
150
+ if (matchBit != bit)
151
+ {
152
+ i--;
153
+ break;
154
+ }
155
+ }
156
+ }
157
+ for (; i >= 0; i--)
158
+ {
159
+ uint bit = (uint)(symbol >> i) & 1;
160
+ price += m_Encoders[context].GetPrice(bit);
161
+ context = (context << 1) | bit;
162
+ }
163
+ return price;
164
+ }
165
+ }
166
+
167
+ Encoder2[] m_Coders;
168
+ int m_NumPrevBits;
169
+ int m_NumPosBits;
170
+ uint m_PosMask;
171
+
172
+ public void Create(int numPosBits, int numPrevBits)
173
+ {
174
+ if (m_Coders != null && m_NumPrevBits == numPrevBits && m_NumPosBits == numPosBits)
175
+ {
176
+ return;
177
+ }
178
+
179
+ m_NumPosBits = numPosBits;
180
+ m_PosMask = ((uint)1 << numPosBits) - 1;
181
+ m_NumPrevBits = numPrevBits;
182
+ uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
183
+ m_Coders = new Encoder2[numStates];
184
+ for (uint i = 0; i < numStates; i++)
185
+ {
186
+ m_Coders[i].Create();
187
+ }
188
+ }
189
+
190
+ public void Init()
191
+ {
192
+ uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
193
+ for (uint i = 0; i < numStates; i++)
194
+ {
195
+ m_Coders[i].Init();
196
+ }
197
+ }
198
+
199
+ public Encoder2 GetSubCoder(UInt32 pos, Byte prevByte)
200
+ {
201
+ return m_Coders[
202
+ ((pos & m_PosMask) << m_NumPrevBits) + (uint)(prevByte >> (8 - m_NumPrevBits))
203
+ ];
204
+ }
205
+ }
206
+
207
+ class LenEncoder
208
+ {
209
+ BitEncoder _choice = new();
210
+ BitEncoder _choice2 = new();
211
+
212
+ readonly BitTreeEncoder[] _lowCoder = new BitTreeEncoder[Base.kNumPosStatesEncodingMax];
213
+
214
+ readonly BitTreeEncoder[] _midCoder = new BitTreeEncoder[Base.kNumPosStatesEncodingMax];
215
+ BitTreeEncoder _highCoder = new(Base.kNumHighLenBits);
216
+
217
+ public LenEncoder()
218
+ {
219
+ for (UInt32 posState = 0; posState < Base.kNumPosStatesEncodingMax; posState++)
220
+ {
221
+ _lowCoder[posState] = new BitTreeEncoder(Base.kNumLowLenBits);
222
+ _midCoder[posState] = new BitTreeEncoder(Base.kNumMidLenBits);
223
+ }
224
+ }
225
+
226
+ public void Init(UInt32 numPosStates)
227
+ {
228
+ _choice.Init();
229
+ _choice2.Init();
230
+ for (UInt32 posState = 0; posState < numPosStates; posState++)
231
+ {
232
+ _lowCoder[posState].Init();
233
+ _midCoder[posState].Init();
234
+ }
235
+ _highCoder.Init();
236
+ }
237
+
238
+ public void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState)
239
+ {
240
+ if (symbol < Base.kNumLowLenSymbols)
241
+ {
242
+ _choice.Encode(rangeEncoder, 0);
243
+ _lowCoder[posState].Encode(rangeEncoder, symbol);
244
+ }
245
+ else
246
+ {
247
+ symbol -= Base.kNumLowLenSymbols;
248
+ _choice.Encode(rangeEncoder, 1);
249
+ if (symbol < Base.kNumMidLenSymbols)
250
+ {
251
+ _choice2.Encode(rangeEncoder, 0);
252
+ _midCoder[posState].Encode(rangeEncoder, symbol);
253
+ }
254
+ else
255
+ {
256
+ _choice2.Encode(rangeEncoder, 1);
257
+ _highCoder.Encode(rangeEncoder, symbol - Base.kNumMidLenSymbols);
258
+ }
259
+ }
260
+ }
261
+
262
+ public void SetPrices(UInt32 posState, UInt32 numSymbols, UInt32[] prices, UInt32 st)
263
+ {
264
+ UInt32 a0 = _choice.GetPrice0();
265
+ UInt32 a1 = _choice.GetPrice1();
266
+ UInt32 b0 = a1 + _choice2.GetPrice0();
267
+ UInt32 b1 = a1 + _choice2.GetPrice1();
268
+ UInt32 i = 0;
269
+ for (i = 0; i < Base.kNumLowLenSymbols; i++)
270
+ {
271
+ if (i >= numSymbols)
272
+ {
273
+ return;
274
+ }
275
+
276
+ prices[st + i] = a0 + _lowCoder[posState].GetPrice(i);
277
+ }
278
+ for (; i < Base.kNumLowLenSymbols + Base.kNumMidLenSymbols; i++)
279
+ {
280
+ if (i >= numSymbols)
281
+ {
282
+ return;
283
+ }
284
+
285
+ prices[st + i] = b0 + _midCoder[posState].GetPrice(i - Base.kNumLowLenSymbols);
286
+ }
287
+ for (; i < numSymbols; i++)
288
+ {
289
+ prices[st + i] =
290
+ b1
291
+ + _highCoder.GetPrice(i - Base.kNumLowLenSymbols - Base.kNumMidLenSymbols);
292
+ }
293
+ }
294
+ };
295
+
296
+ const UInt32 kNumLenSpecSymbols = Base.kNumLowLenSymbols + Base.kNumMidLenSymbols;
297
+
298
+ class LenPriceTableEncoder : LenEncoder
299
+ {
300
+ readonly UInt32[] _prices = new UInt32[
301
+ Base.kNumLenSymbols << Base.kNumPosStatesBitsEncodingMax
302
+ ];
303
+ UInt32 _tableSize;
304
+ readonly UInt32[] _counters = new UInt32[Base.kNumPosStatesEncodingMax];
305
+
306
+ public void SetTableSize(UInt32 tableSize)
307
+ {
308
+ _tableSize = tableSize;
309
+ }
310
+
311
+ public UInt32 GetPrice(UInt32 symbol, UInt32 posState)
312
+ {
313
+ return _prices[posState * Base.kNumLenSymbols + symbol];
314
+ }
315
+
316
+ void UpdateTable(UInt32 posState)
317
+ {
318
+ SetPrices(posState, _tableSize, _prices, posState * Base.kNumLenSymbols);
319
+ _counters[posState] = _tableSize;
320
+ }
321
+
322
+ public void UpdateTables(UInt32 numPosStates)
323
+ {
324
+ for (UInt32 posState = 0; posState < numPosStates; posState++)
325
+ {
326
+ UpdateTable(posState);
327
+ }
328
+ }
329
+
330
+ public new void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState)
331
+ {
332
+ base.Encode(rangeEncoder, symbol, posState);
333
+ if (--_counters[posState] == 0)
334
+ {
335
+ UpdateTable(posState);
336
+ }
337
+ }
338
+ }
339
+
340
+ const UInt32 kNumOpts = 1 << 12;
341
+
342
+ class Optimal
343
+ {
344
+ public Base.State State;
345
+
346
+ public bool Prev1IsChar;
347
+ public bool Prev2;
348
+
349
+ public UInt32 PosPrev2;
350
+ public UInt32 BackPrev2;
351
+
352
+ public UInt32 Price;
353
+ public UInt32 PosPrev;
354
+ public UInt32 BackPrev;
355
+
356
+ public UInt32 Backs0;
357
+ public UInt32 Backs1;
358
+ public UInt32 Backs2;
359
+ public UInt32 Backs3;
360
+
361
+ public void MakeAsChar()
362
+ {
363
+ BackPrev = 0xFFFFFFFF;
364
+ Prev1IsChar = false;
365
+ }
366
+
367
+ public void MakeAsShortRep()
368
+ {
369
+ BackPrev = 0;
370
+ ;
371
+ Prev1IsChar = false;
372
+ }
373
+
374
+ public bool IsShortRep()
375
+ {
376
+ return (BackPrev == 0);
377
+ }
378
+ };
379
+
380
+ readonly Optimal[] _optimum = new Optimal[kNumOpts];
381
+ LZ.IMatchFinder _matchFinder = null;
382
+ readonly RangeCoder.Encoder _rangeEncoder = new();
383
+
384
+ readonly BitEncoder[] _isMatch = new BitEncoder[
385
+ Base.kNumStates << Base.kNumPosStatesBitsMax
386
+ ];
387
+
388
+ readonly BitEncoder[] _isRep = new BitEncoder[Base.kNumStates];
389
+ readonly BitEncoder[] _isRepG0 = new BitEncoder[Base.kNumStates];
390
+ readonly BitEncoder[] _isRepG1 = new BitEncoder[Base.kNumStates];
391
+ readonly BitEncoder[] _isRepG2 = new BitEncoder[Base.kNumStates];
392
+
393
+ readonly BitEncoder[] _isRep0Long = new BitEncoder[
394
+ Base.kNumStates << Base.kNumPosStatesBitsMax
395
+ ];
396
+
397
+ readonly BitTreeEncoder[] _posSlotEncoder = new BitTreeEncoder[Base.kNumLenToPosStates];
398
+
399
+ readonly BitEncoder[] _posEncoders = new BitEncoder[
400
+ Base.kNumFullDistances - Base.kEndPosModelIndex
401
+ ];
402
+ BitTreeEncoder _posAlignEncoder = new(Base.kNumAlignBits);
403
+
404
+ readonly LenPriceTableEncoder _lenEncoder = new();
405
+ readonly LenPriceTableEncoder _repMatchLenEncoder = new();
406
+
407
+ readonly LiteralEncoder _literalEncoder = new();
408
+
409
+ readonly UInt32[] _matchDistances = new UInt32[Base.kMatchMaxLen * 2 + 2];
410
+
411
+ UInt32 _numFastBytes = kNumFastBytesDefault;
412
+ UInt32 _longestMatchLength;
413
+ UInt32 _numDistancePairs;
414
+
415
+ UInt32 _additionalOffset;
416
+
417
+ UInt32 _optimumEndIndex;
418
+ UInt32 _optimumCurrentIndex;
419
+
420
+ bool _longestMatchWasFound;
421
+
422
+ readonly UInt32[] _posSlotPrices = new UInt32[
423
+ 1 << (Base.kNumPosSlotBits + Base.kNumLenToPosStatesBits)
424
+ ];
425
+
426
+ readonly UInt32[] _distancesPrices = new UInt32[
427
+ Base.kNumFullDistances << Base.kNumLenToPosStatesBits
428
+ ];
429
+
430
+ readonly UInt32[] _alignPrices = new UInt32[Base.kAlignTableSize];
431
+ UInt32 _alignPriceCount;
432
+
433
+ UInt32 _distTableSize = (kDefaultDictionaryLogSize * 2);
434
+
435
+ int _posStateBits = 2;
436
+ UInt32 _posStateMask = (4 - 1);
437
+ int _numLiteralPosStateBits = 0;
438
+ int _numLiteralContextBits = 3;
439
+
440
+ UInt32 _dictionarySize = (1 << kDefaultDictionaryLogSize);
441
+ UInt32 _dictionarySizePrev = 0xFFFFFFFF;
442
+ UInt32 _numFastBytesPrev = 0xFFFFFFFF;
443
+
444
+ Int64 nowPos64;
445
+ bool _finished;
446
+ System.IO.Stream _inStream;
447
+
448
+ EMatchFinderType _matchFinderType = EMatchFinderType.BT4;
449
+ bool _writeEndMark = false;
450
+
451
+ bool _needReleaseMFStream;
452
+
453
+ void Create()
454
+ {
455
+ if (_matchFinder == null)
456
+ {
457
+ LZ.BinTree bt = new();
458
+ int numHashBytes = 4;
459
+ if (_matchFinderType == EMatchFinderType.BT2)
460
+ {
461
+ numHashBytes = 2;
462
+ }
463
+
464
+ bt.SetType(numHashBytes);
465
+ _matchFinder = bt;
466
+ }
467
+ _literalEncoder.Create(_numLiteralPosStateBits, _numLiteralContextBits);
468
+
469
+ if (_dictionarySize == _dictionarySizePrev && _numFastBytesPrev == _numFastBytes)
470
+ {
471
+ return;
472
+ }
473
+
474
+ _matchFinder.Create(_dictionarySize, kNumOpts, _numFastBytes, Base.kMatchMaxLen + 1);
475
+ _dictionarySizePrev = _dictionarySize;
476
+ _numFastBytesPrev = _numFastBytes;
477
+ }
478
+
479
+ public Encoder()
480
+ {
481
+ for (int i = 0; i < kNumOpts; i++)
482
+ {
483
+ _optimum[i] = new Optimal();
484
+ }
485
+
486
+ for (int i = 0; i < Base.kNumLenToPosStates; i++)
487
+ {
488
+ _posSlotEncoder[i] = new BitTreeEncoder(Base.kNumPosSlotBits);
489
+ }
490
+ }
491
+
492
+ void SetWriteEndMarkerMode(bool writeEndMarker)
493
+ {
494
+ _writeEndMark = writeEndMarker;
495
+ }
496
+
497
+ void Init()
498
+ {
499
+ BaseInit();
500
+ _rangeEncoder.Init();
501
+
502
+ uint i;
503
+ for (i = 0; i < Base.kNumStates; i++)
504
+ {
505
+ for (uint j = 0; j <= _posStateMask; j++)
506
+ {
507
+ uint complexState = (i << Base.kNumPosStatesBitsMax) + j;
508
+ _isMatch[complexState].Init();
509
+ _isRep0Long[complexState].Init();
510
+ }
511
+ _isRep[i].Init();
512
+ _isRepG0[i].Init();
513
+ _isRepG1[i].Init();
514
+ _isRepG2[i].Init();
515
+ }
516
+ _literalEncoder.Init();
517
+ for (i = 0; i < Base.kNumLenToPosStates; i++)
518
+ {
519
+ _posSlotEncoder[i].Init();
520
+ }
521
+
522
+ for (i = 0; i < Base.kNumFullDistances - Base.kEndPosModelIndex; i++)
523
+ {
524
+ _posEncoders[i].Init();
525
+ }
526
+
527
+ _lenEncoder.Init((UInt32)1 << _posStateBits);
528
+ _repMatchLenEncoder.Init((UInt32)1 << _posStateBits);
529
+
530
+ _posAlignEncoder.Init();
531
+
532
+ _longestMatchWasFound = false;
533
+ _optimumEndIndex = 0;
534
+ _optimumCurrentIndex = 0;
535
+ _additionalOffset = 0;
536
+ }
537
+
538
+ void ReadMatchDistances(out UInt32 lenRes, out UInt32 numDistancePairs)
539
+ {
540
+ lenRes = 0;
541
+ numDistancePairs = _matchFinder.GetMatches(_matchDistances);
542
+ if (numDistancePairs > 0)
543
+ {
544
+ lenRes = _matchDistances[numDistancePairs - 2];
545
+ if (lenRes == _numFastBytes)
546
+ {
547
+ lenRes += _matchFinder.GetMatchLen(
548
+ (int)lenRes - 1,
549
+ _matchDistances[numDistancePairs - 1],
550
+ Base.kMatchMaxLen - lenRes
551
+ );
552
+ }
553
+ }
554
+ _additionalOffset++;
555
+ }
556
+
557
+ void MovePos(UInt32 num)
558
+ {
559
+ if (num > 0)
560
+ {
561
+ _matchFinder.Skip(num);
562
+ _additionalOffset += num;
563
+ }
564
+ }
565
+
566
+ UInt32 GetRepLen1Price(Base.State state, UInt32 posState)
567
+ {
568
+ return _isRepG0[state.Index].GetPrice0()
569
+ + _isRep0Long[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0();
570
+ }
571
+
572
+ UInt32 GetPureRepPrice(UInt32 repIndex, Base.State state, UInt32 posState)
573
+ {
574
+ UInt32 price;
575
+ if (repIndex == 0)
576
+ {
577
+ price = _isRepG0[state.Index].GetPrice0();
578
+ price += _isRep0Long[(state.Index << Base.kNumPosStatesBitsMax) + posState]
579
+ .GetPrice1();
580
+ }
581
+ else
582
+ {
583
+ price = _isRepG0[state.Index].GetPrice1();
584
+ if (repIndex == 1)
585
+ {
586
+ price += _isRepG1[state.Index].GetPrice0();
587
+ }
588
+ else
589
+ {
590
+ price += _isRepG1[state.Index].GetPrice1();
591
+ price += _isRepG2[state.Index].GetPrice(repIndex - 2);
592
+ }
593
+ }
594
+ return price;
595
+ }
596
+
597
+ UInt32 GetRepPrice(UInt32 repIndex, UInt32 len, Base.State state, UInt32 posState)
598
+ {
599
+ UInt32 price = _repMatchLenEncoder.GetPrice(len - Base.kMatchMinLen, posState);
600
+ return price + GetPureRepPrice(repIndex, state, posState);
601
+ }
602
+
603
+ UInt32 GetPosLenPrice(UInt32 pos, UInt32 len, UInt32 posState)
604
+ {
605
+ UInt32 price;
606
+ UInt32 lenToPosState = Base.GetLenToPosState(len);
607
+ if (pos < Base.kNumFullDistances)
608
+ {
609
+ price = _distancesPrices[(lenToPosState * Base.kNumFullDistances) + pos];
610
+ }
611
+ else
612
+ {
613
+ price =
614
+ _posSlotPrices[(lenToPosState << Base.kNumPosSlotBits) + GetPosSlot2(pos)]
615
+ + _alignPrices[pos & Base.kAlignMask];
616
+ }
617
+
618
+ return price + _lenEncoder.GetPrice(len - Base.kMatchMinLen, posState);
619
+ }
620
+
621
+ UInt32 Backward(out UInt32 backRes, UInt32 cur)
622
+ {
623
+ _optimumEndIndex = cur;
624
+ UInt32 posMem = _optimum[cur].PosPrev;
625
+ UInt32 backMem = _optimum[cur].BackPrev;
626
+ do
627
+ {
628
+ if (_optimum[cur].Prev1IsChar)
629
+ {
630
+ _optimum[posMem].MakeAsChar();
631
+ _optimum[posMem].PosPrev = posMem - 1;
632
+ if (_optimum[cur].Prev2)
633
+ {
634
+ _optimum[posMem - 1].Prev1IsChar = false;
635
+ _optimum[posMem - 1].PosPrev = _optimum[cur].PosPrev2;
636
+ _optimum[posMem - 1].BackPrev = _optimum[cur].BackPrev2;
637
+ }
638
+ }
639
+ UInt32 posPrev = posMem;
640
+ UInt32 backCur = backMem;
641
+
642
+ backMem = _optimum[posPrev].BackPrev;
643
+ posMem = _optimum[posPrev].PosPrev;
644
+
645
+ _optimum[posPrev].BackPrev = backCur;
646
+ _optimum[posPrev].PosPrev = cur;
647
+ cur = posPrev;
648
+ } while (cur > 0);
649
+ backRes = _optimum[0].BackPrev;
650
+ _optimumCurrentIndex = _optimum[0].PosPrev;
651
+ return _optimumCurrentIndex;
652
+ }
653
+
654
+ readonly UInt32[] reps = new UInt32[Base.kNumRepDistances];
655
+ readonly UInt32[] repLens = new UInt32[Base.kNumRepDistances];
656
+
657
+ UInt32 GetOptimum(UInt32 position, out UInt32 backRes)
658
+ {
659
+ if (_optimumEndIndex != _optimumCurrentIndex)
660
+ {
661
+ UInt32 lenRes = _optimum[_optimumCurrentIndex].PosPrev - _optimumCurrentIndex;
662
+ backRes = _optimum[_optimumCurrentIndex].BackPrev;
663
+ _optimumCurrentIndex = _optimum[_optimumCurrentIndex].PosPrev;
664
+ return lenRes;
665
+ }
666
+ _optimumCurrentIndex = _optimumEndIndex = 0;
667
+
668
+ UInt32 lenMain;
669
+ UInt32 numDistancePairs;
670
+ if (!_longestMatchWasFound)
671
+ {
672
+ ReadMatchDistances(out lenMain, out numDistancePairs);
673
+ }
674
+ else
675
+ {
676
+ lenMain = _longestMatchLength;
677
+ numDistancePairs = _numDistancePairs;
678
+ _longestMatchWasFound = false;
679
+ }
680
+
681
+ UInt32 numAvailableBytes = _matchFinder.GetNumAvailableBytes() + 1;
682
+ if (numAvailableBytes < 2)
683
+ {
684
+ backRes = 0xFFFFFFFF;
685
+ return 1;
686
+ }
687
+ if (numAvailableBytes > Base.kMatchMaxLen)
688
+ {
689
+ numAvailableBytes = Base.kMatchMaxLen;
690
+ }
691
+
692
+ UInt32 repMaxIndex = 0;
693
+ UInt32 i;
694
+ for (i = 0; i < Base.kNumRepDistances; i++)
695
+ {
696
+ reps[i] = _repDistances[i];
697
+ repLens[i] = _matchFinder.GetMatchLen(0 - 1, reps[i], Base.kMatchMaxLen);
698
+ if (repLens[i] > repLens[repMaxIndex])
699
+ {
700
+ repMaxIndex = i;
701
+ }
702
+ }
703
+ if (repLens[repMaxIndex] >= _numFastBytes)
704
+ {
705
+ backRes = repMaxIndex;
706
+ UInt32 lenRes = repLens[repMaxIndex];
707
+ MovePos(lenRes - 1);
708
+ return lenRes;
709
+ }
710
+
711
+ if (lenMain >= _numFastBytes)
712
+ {
713
+ backRes = _matchDistances[numDistancePairs - 1] + Base.kNumRepDistances;
714
+ MovePos(lenMain - 1);
715
+ return lenMain;
716
+ }
717
+
718
+ Byte currentByte = _matchFinder.GetIndexByte(0 - 1);
719
+ Byte matchByte = _matchFinder.GetIndexByte((Int32)(0 - _repDistances[0] - 1 - 1));
720
+
721
+ if (lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2)
722
+ {
723
+ backRes = 0xFFFFFFFF;
724
+ return 1;
725
+ }
726
+
727
+ _optimum[0].State = _state;
728
+
729
+ UInt32 posState = (position & _posStateMask);
730
+
731
+ _optimum[1].Price =
732
+ _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0()
733
+ + _literalEncoder
734
+ .GetSubCoder(position, _previousByte)
735
+ .GetPrice(!_state.IsCharState(), matchByte, currentByte);
736
+ _optimum[1].MakeAsChar();
737
+
738
+ UInt32 matchPrice = _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState]
739
+ .GetPrice1();
740
+ UInt32 repMatchPrice = matchPrice + _isRep[_state.Index].GetPrice1();
741
+
742
+ if (matchByte == currentByte)
743
+ {
744
+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(_state, posState);
745
+ if (shortRepPrice < _optimum[1].Price)
746
+ {
747
+ _optimum[1].Price = shortRepPrice;
748
+ _optimum[1].MakeAsShortRep();
749
+ }
750
+ }
751
+
752
+ UInt32 lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]);
753
+
754
+ if (lenEnd < 2)
755
+ {
756
+ backRes = _optimum[1].BackPrev;
757
+ return 1;
758
+ }
759
+
760
+ _optimum[1].PosPrev = 0;
761
+
762
+ _optimum[0].Backs0 = reps[0];
763
+ _optimum[0].Backs1 = reps[1];
764
+ _optimum[0].Backs2 = reps[2];
765
+ _optimum[0].Backs3 = reps[3];
766
+
767
+ UInt32 len = lenEnd;
768
+ do
769
+ {
770
+ _optimum[len--].Price = kIfinityPrice;
771
+ } while (len >= 2);
772
+
773
+ for (i = 0; i < Base.kNumRepDistances; i++)
774
+ {
775
+ UInt32 repLen = repLens[i];
776
+ if (repLen < 2)
777
+ {
778
+ continue;
779
+ }
780
+
781
+ UInt32 price = repMatchPrice + GetPureRepPrice(i, _state, posState);
782
+ do
783
+ {
784
+ UInt32 curAndLenPrice =
785
+ price + _repMatchLenEncoder.GetPrice(repLen - 2, posState);
786
+ Optimal optimum = _optimum[repLen];
787
+ if (curAndLenPrice < optimum.Price)
788
+ {
789
+ optimum.Price = curAndLenPrice;
790
+ optimum.PosPrev = 0;
791
+ optimum.BackPrev = i;
792
+ optimum.Prev1IsChar = false;
793
+ }
794
+ } while (--repLen >= 2);
795
+ }
796
+
797
+ UInt32 normalMatchPrice = matchPrice + _isRep[_state.Index].GetPrice0();
798
+
799
+ len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
800
+ if (len <= lenMain)
801
+ {
802
+ UInt32 offs = 0;
803
+ while (len > _matchDistances[offs])
804
+ {
805
+ offs += 2;
806
+ }
807
+
808
+ for (; ; len++)
809
+ {
810
+ UInt32 distance = _matchDistances[offs + 1];
811
+ UInt32 curAndLenPrice =
812
+ normalMatchPrice + GetPosLenPrice(distance, len, posState);
813
+ Optimal optimum = _optimum[len];
814
+ if (curAndLenPrice < optimum.Price)
815
+ {
816
+ optimum.Price = curAndLenPrice;
817
+ optimum.PosPrev = 0;
818
+ optimum.BackPrev = distance + Base.kNumRepDistances;
819
+ optimum.Prev1IsChar = false;
820
+ }
821
+ if (len == _matchDistances[offs])
822
+ {
823
+ offs += 2;
824
+ if (offs == numDistancePairs)
825
+ {
826
+ break;
827
+ }
828
+ }
829
+ }
830
+ }
831
+
832
+ UInt32 cur = 0;
833
+
834
+ while (true)
835
+ {
836
+ cur++;
837
+ if (cur == lenEnd)
838
+ {
839
+ return Backward(out backRes, cur);
840
+ }
841
+
842
+ ReadMatchDistances(out UInt32 newLen, out numDistancePairs);
843
+ if (newLen >= _numFastBytes)
844
+ {
845
+ _numDistancePairs = numDistancePairs;
846
+ _longestMatchLength = newLen;
847
+ _longestMatchWasFound = true;
848
+ return Backward(out backRes, cur);
849
+ }
850
+ position++;
851
+ UInt32 posPrev = _optimum[cur].PosPrev;
852
+ Base.State state;
853
+ if (_optimum[cur].Prev1IsChar)
854
+ {
855
+ posPrev--;
856
+ if (_optimum[cur].Prev2)
857
+ {
858
+ state = _optimum[_optimum[cur].PosPrev2].State;
859
+ if (_optimum[cur].BackPrev2 < Base.kNumRepDistances)
860
+ {
861
+ state.UpdateRep();
862
+ }
863
+ else
864
+ {
865
+ state.UpdateMatch();
866
+ }
867
+ }
868
+ else
869
+ {
870
+ state = _optimum[posPrev].State;
871
+ }
872
+
873
+ state.UpdateChar();
874
+ }
875
+ else
876
+ {
877
+ state = _optimum[posPrev].State;
878
+ }
879
+
880
+ if (posPrev == cur - 1)
881
+ {
882
+ if (_optimum[cur].IsShortRep())
883
+ {
884
+ state.UpdateShortRep();
885
+ }
886
+ else
887
+ {
888
+ state.UpdateChar();
889
+ }
890
+ }
891
+ else
892
+ {
893
+ UInt32 pos;
894
+ if (_optimum[cur].Prev1IsChar && _optimum[cur].Prev2)
895
+ {
896
+ posPrev = _optimum[cur].PosPrev2;
897
+ pos = _optimum[cur].BackPrev2;
898
+ state.UpdateRep();
899
+ }
900
+ else
901
+ {
902
+ pos = _optimum[cur].BackPrev;
903
+ if (pos < Base.kNumRepDistances)
904
+ {
905
+ state.UpdateRep();
906
+ }
907
+ else
908
+ {
909
+ state.UpdateMatch();
910
+ }
911
+ }
912
+ Optimal opt = _optimum[posPrev];
913
+ if (pos < Base.kNumRepDistances)
914
+ {
915
+ if (pos == 0)
916
+ {
917
+ reps[0] = opt.Backs0;
918
+ reps[1] = opt.Backs1;
919
+ reps[2] = opt.Backs2;
920
+ reps[3] = opt.Backs3;
921
+ }
922
+ else if (pos == 1)
923
+ {
924
+ reps[0] = opt.Backs1;
925
+ reps[1] = opt.Backs0;
926
+ reps[2] = opt.Backs2;
927
+ reps[3] = opt.Backs3;
928
+ }
929
+ else if (pos == 2)
930
+ {
931
+ reps[0] = opt.Backs2;
932
+ reps[1] = opt.Backs0;
933
+ reps[2] = opt.Backs1;
934
+ reps[3] = opt.Backs3;
935
+ }
936
+ else
937
+ {
938
+ reps[0] = opt.Backs3;
939
+ reps[1] = opt.Backs0;
940
+ reps[2] = opt.Backs1;
941
+ reps[3] = opt.Backs2;
942
+ }
943
+ }
944
+ else
945
+ {
946
+ reps[0] = (pos - Base.kNumRepDistances);
947
+ reps[1] = opt.Backs0;
948
+ reps[2] = opt.Backs1;
949
+ reps[3] = opt.Backs2;
950
+ }
951
+ }
952
+ _optimum[cur].State = state;
953
+ _optimum[cur].Backs0 = reps[0];
954
+ _optimum[cur].Backs1 = reps[1];
955
+ _optimum[cur].Backs2 = reps[2];
956
+ _optimum[cur].Backs3 = reps[3];
957
+ UInt32 curPrice = _optimum[cur].Price;
958
+
959
+ currentByte = _matchFinder.GetIndexByte(0 - 1);
960
+ matchByte = _matchFinder.GetIndexByte((Int32)(0 - reps[0] - 1 - 1));
961
+
962
+ posState = (position & _posStateMask);
963
+
964
+ UInt32 curAnd1Price =
965
+ curPrice
966
+ + _isMatch[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0()
967
+ + _literalEncoder
968
+ .GetSubCoder(position, _matchFinder.GetIndexByte(0 - 2))
969
+ .GetPrice(!state.IsCharState(), matchByte, currentByte);
970
+
971
+ Optimal nextOptimum = _optimum[cur + 1];
972
+
973
+ bool nextIsChar = false;
974
+ if (curAnd1Price < nextOptimum.Price)
975
+ {
976
+ nextOptimum.Price = curAnd1Price;
977
+ nextOptimum.PosPrev = cur;
978
+ nextOptimum.MakeAsChar();
979
+ nextIsChar = true;
980
+ }
981
+
982
+ matchPrice =
983
+ curPrice
984
+ + _isMatch[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice1();
985
+ repMatchPrice = matchPrice + _isRep[state.Index].GetPrice1();
986
+
987
+ if (
988
+ matchByte == currentByte
989
+ && !(nextOptimum.PosPrev < cur && nextOptimum.BackPrev == 0)
990
+ )
991
+ {
992
+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(state, posState);
993
+ if (shortRepPrice <= nextOptimum.Price)
994
+ {
995
+ nextOptimum.Price = shortRepPrice;
996
+ nextOptimum.PosPrev = cur;
997
+ nextOptimum.MakeAsShortRep();
998
+ nextIsChar = true;
999
+ }
1000
+ }
1001
+
1002
+ UInt32 numAvailableBytesFull = _matchFinder.GetNumAvailableBytes() + 1;
1003
+ numAvailableBytesFull = Math.Min(kNumOpts - 1 - cur, numAvailableBytesFull);
1004
+ numAvailableBytes = numAvailableBytesFull;
1005
+
1006
+ if (numAvailableBytes < 2)
1007
+ {
1008
+ continue;
1009
+ }
1010
+
1011
+ if (numAvailableBytes > _numFastBytes)
1012
+ {
1013
+ numAvailableBytes = _numFastBytes;
1014
+ }
1015
+
1016
+ if (!nextIsChar && matchByte != currentByte)
1017
+ {
1018
+ // try Literal + rep0
1019
+ UInt32 t = Math.Min(numAvailableBytesFull - 1, _numFastBytes);
1020
+ UInt32 lenTest2 = _matchFinder.GetMatchLen(0, reps[0], t);
1021
+ if (lenTest2 >= 2)
1022
+ {
1023
+ Base.State state2 = state;
1024
+ state2.UpdateChar();
1025
+ UInt32 posStateNext = (position + 1) & _posStateMask;
1026
+ UInt32 nextRepMatchPrice =
1027
+ curAnd1Price
1028
+ + _isMatch[(state2.Index << Base.kNumPosStatesBitsMax) + posStateNext]
1029
+ .GetPrice1()
1030
+ + _isRep[state2.Index].GetPrice1();
1031
+ {
1032
+ UInt32 offset = cur + 1 + lenTest2;
1033
+ while (lenEnd < offset)
1034
+ {
1035
+ _optimum[++lenEnd].Price = kIfinityPrice;
1036
+ }
1037
+
1038
+ UInt32 curAndLenPrice =
1039
+ nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext);
1040
+ Optimal optimum = _optimum[offset];
1041
+ if (curAndLenPrice < optimum.Price)
1042
+ {
1043
+ optimum.Price = curAndLenPrice;
1044
+ optimum.PosPrev = cur + 1;
1045
+ optimum.BackPrev = 0;
1046
+ optimum.Prev1IsChar = true;
1047
+ optimum.Prev2 = false;
1048
+ }
1049
+ }
1050
+ }
1051
+ }
1052
+
1053
+ UInt32 startLen = 2; // speed optimization
1054
+
1055
+ for (UInt32 repIndex = 0; repIndex < Base.kNumRepDistances; repIndex++)
1056
+ {
1057
+ UInt32 lenTest = _matchFinder.GetMatchLen(
1058
+ 0 - 1,
1059
+ reps[repIndex],
1060
+ numAvailableBytes
1061
+ );
1062
+ if (lenTest < 2)
1063
+ {
1064
+ continue;
1065
+ }
1066
+
1067
+ UInt32 lenTestTemp = lenTest;
1068
+ do
1069
+ {
1070
+ while (lenEnd < cur + lenTest)
1071
+ {
1072
+ _optimum[++lenEnd].Price = kIfinityPrice;
1073
+ }
1074
+
1075
+ UInt32 curAndLenPrice =
1076
+ repMatchPrice + GetRepPrice(repIndex, lenTest, state, posState);
1077
+ Optimal optimum = _optimum[cur + lenTest];
1078
+ if (curAndLenPrice < optimum.Price)
1079
+ {
1080
+ optimum.Price = curAndLenPrice;
1081
+ optimum.PosPrev = cur;
1082
+ optimum.BackPrev = repIndex;
1083
+ optimum.Prev1IsChar = false;
1084
+ }
1085
+ } while (--lenTest >= 2);
1086
+ lenTest = lenTestTemp;
1087
+
1088
+ if (repIndex == 0)
1089
+ {
1090
+ startLen = lenTest + 1;
1091
+ }
1092
+
1093
+ // if (_maxMode)
1094
+ if (lenTest < numAvailableBytesFull)
1095
+ {
1096
+ UInt32 t = Math.Min(numAvailableBytesFull - 1 - lenTest, _numFastBytes);
1097
+ UInt32 lenTest2 = _matchFinder.GetMatchLen(
1098
+ (Int32)lenTest,
1099
+ reps[repIndex],
1100
+ t
1101
+ );
1102
+ if (lenTest2 >= 2)
1103
+ {
1104
+ Base.State state2 = state;
1105
+ state2.UpdateRep();
1106
+ UInt32 posStateNext = (position + lenTest) & _posStateMask;
1107
+ UInt32 curAndLenCharPrice =
1108
+ repMatchPrice
1109
+ + GetRepPrice(repIndex, lenTest, state, posState)
1110
+ + _isMatch[
1111
+ (state2.Index << Base.kNumPosStatesBitsMax) + posStateNext
1112
+ ]
1113
+ .GetPrice0()
1114
+ + _literalEncoder
1115
+ .GetSubCoder(
1116
+ position + lenTest,
1117
+ _matchFinder.GetIndexByte((Int32)lenTest - 1 - 1)
1118
+ )
1119
+ .GetPrice(
1120
+ true,
1121
+ _matchFinder.GetIndexByte(
1122
+ (Int32)lenTest - 1 - (Int32)(reps[repIndex] + 1)
1123
+ ),
1124
+ _matchFinder.GetIndexByte((Int32)lenTest - 1)
1125
+ );
1126
+ state2.UpdateChar();
1127
+ posStateNext = (position + lenTest + 1) & _posStateMask;
1128
+ UInt32 nextMatchPrice =
1129
+ curAndLenCharPrice
1130
+ + _isMatch[
1131
+ (state2.Index << Base.kNumPosStatesBitsMax) + posStateNext
1132
+ ]
1133
+ .GetPrice1();
1134
+ UInt32 nextRepMatchPrice =
1135
+ nextMatchPrice + _isRep[state2.Index].GetPrice1();
1136
+
1137
+ // for(; lenTest2 >= 2; lenTest2--)
1138
+ {
1139
+ UInt32 offset = lenTest + 1 + lenTest2;
1140
+ while (lenEnd < cur + offset)
1141
+ {
1142
+ _optimum[++lenEnd].Price = kIfinityPrice;
1143
+ }
1144
+
1145
+ UInt32 curAndLenPrice =
1146
+ nextRepMatchPrice
1147
+ + GetRepPrice(0, lenTest2, state2, posStateNext);
1148
+ Optimal optimum = _optimum[cur + offset];
1149
+ if (curAndLenPrice < optimum.Price)
1150
+ {
1151
+ optimum.Price = curAndLenPrice;
1152
+ optimum.PosPrev = cur + lenTest + 1;
1153
+ optimum.BackPrev = 0;
1154
+ optimum.Prev1IsChar = true;
1155
+ optimum.Prev2 = true;
1156
+ optimum.PosPrev2 = cur;
1157
+ optimum.BackPrev2 = repIndex;
1158
+ }
1159
+ }
1160
+ }
1161
+ }
1162
+ }
1163
+
1164
+ if (newLen > numAvailableBytes)
1165
+ {
1166
+ newLen = numAvailableBytes;
1167
+ for (
1168
+ numDistancePairs = 0;
1169
+ newLen > _matchDistances[numDistancePairs];
1170
+ numDistancePairs += 2
1171
+ )
1172
+ {
1173
+ ;
1174
+ }
1175
+
1176
+ _matchDistances[numDistancePairs] = newLen;
1177
+ numDistancePairs += 2;
1178
+ }
1179
+ if (newLen >= startLen)
1180
+ {
1181
+ normalMatchPrice = matchPrice + _isRep[state.Index].GetPrice0();
1182
+ while (lenEnd < cur + newLen)
1183
+ {
1184
+ _optimum[++lenEnd].Price = kIfinityPrice;
1185
+ }
1186
+
1187
+ UInt32 offs = 0;
1188
+ while (startLen > _matchDistances[offs])
1189
+ {
1190
+ offs += 2;
1191
+ }
1192
+
1193
+ for (UInt32 lenTest = startLen; ; lenTest++)
1194
+ {
1195
+ UInt32 curBack = _matchDistances[offs + 1];
1196
+ UInt32 curAndLenPrice =
1197
+ normalMatchPrice + GetPosLenPrice(curBack, lenTest, posState);
1198
+ Optimal optimum = _optimum[cur + lenTest];
1199
+ if (curAndLenPrice < optimum.Price)
1200
+ {
1201
+ optimum.Price = curAndLenPrice;
1202
+ optimum.PosPrev = cur;
1203
+ optimum.BackPrev = curBack + Base.kNumRepDistances;
1204
+ optimum.Prev1IsChar = false;
1205
+ }
1206
+
1207
+ if (lenTest == _matchDistances[offs])
1208
+ {
1209
+ if (lenTest < numAvailableBytesFull)
1210
+ {
1211
+ UInt32 t = Math.Min(
1212
+ numAvailableBytesFull - 1 - lenTest,
1213
+ _numFastBytes
1214
+ );
1215
+ UInt32 lenTest2 = _matchFinder.GetMatchLen(
1216
+ (Int32)lenTest,
1217
+ curBack,
1218
+ t
1219
+ );
1220
+ if (lenTest2 >= 2)
1221
+ {
1222
+ Base.State state2 = state;
1223
+ state2.UpdateMatch();
1224
+ UInt32 posStateNext = (position + lenTest) & _posStateMask;
1225
+ UInt32 curAndLenCharPrice =
1226
+ curAndLenPrice
1227
+ + _isMatch[
1228
+ (state2.Index << Base.kNumPosStatesBitsMax)
1229
+ + posStateNext
1230
+ ]
1231
+ .GetPrice0()
1232
+ + _literalEncoder
1233
+ .GetSubCoder(
1234
+ position + lenTest,
1235
+ _matchFinder.GetIndexByte((Int32)lenTest - 1 - 1)
1236
+ )
1237
+ .GetPrice(
1238
+ true,
1239
+ _matchFinder.GetIndexByte(
1240
+ (Int32)lenTest - (Int32)(curBack + 1) - 1
1241
+ ),
1242
+ _matchFinder.GetIndexByte((Int32)lenTest - 1)
1243
+ );
1244
+ state2.UpdateChar();
1245
+ posStateNext = (position + lenTest + 1) & _posStateMask;
1246
+ UInt32 nextMatchPrice =
1247
+ curAndLenCharPrice
1248
+ + _isMatch[
1249
+ (state2.Index << Base.kNumPosStatesBitsMax)
1250
+ + posStateNext
1251
+ ]
1252
+ .GetPrice1();
1253
+ UInt32 nextRepMatchPrice =
1254
+ nextMatchPrice + _isRep[state2.Index].GetPrice1();
1255
+
1256
+ UInt32 offset = lenTest + 1 + lenTest2;
1257
+ while (lenEnd < cur + offset)
1258
+ {
1259
+ _optimum[++lenEnd].Price = kIfinityPrice;
1260
+ }
1261
+
1262
+ curAndLenPrice =
1263
+ nextRepMatchPrice
1264
+ + GetRepPrice(0, lenTest2, state2, posStateNext);
1265
+ optimum = _optimum[cur + offset];
1266
+ if (curAndLenPrice < optimum.Price)
1267
+ {
1268
+ optimum.Price = curAndLenPrice;
1269
+ optimum.PosPrev = cur + lenTest + 1;
1270
+ optimum.BackPrev = 0;
1271
+ optimum.Prev1IsChar = true;
1272
+ optimum.Prev2 = true;
1273
+ optimum.PosPrev2 = cur;
1274
+ optimum.BackPrev2 = curBack + Base.kNumRepDistances;
1275
+ }
1276
+ }
1277
+ }
1278
+ offs += 2;
1279
+ if (offs == numDistancePairs)
1280
+ {
1281
+ break;
1282
+ }
1283
+ }
1284
+ }
1285
+ }
1286
+ }
1287
+ }
1288
+
1289
+ bool ChangePair(UInt32 smallDist, UInt32 bigDist)
1290
+ {
1291
+ const int kDif = 7;
1292
+ return (smallDist < ((UInt32)(1) << (32 - kDif)) && bigDist >= (smallDist << kDif));
1293
+ }
1294
+
1295
+ void WriteEndMarker(UInt32 posState)
1296
+ {
1297
+ if (!_writeEndMark)
1298
+ {
1299
+ return;
1300
+ }
1301
+
1302
+ _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState]
1303
+ .Encode(_rangeEncoder, 1);
1304
+ _isRep[_state.Index].Encode(_rangeEncoder, 0);
1305
+ _state.UpdateMatch();
1306
+ UInt32 len = Base.kMatchMinLen;
1307
+ _lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
1308
+ UInt32 posSlot = (1 << Base.kNumPosSlotBits) - 1;
1309
+ UInt32 lenToPosState = Base.GetLenToPosState(len);
1310
+ _posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
1311
+ int footerBits = 30;
1312
+ UInt32 posReduced = (((UInt32)1) << footerBits) - 1;
1313
+ _rangeEncoder.EncodeDirectBits(
1314
+ posReduced >> Base.kNumAlignBits,
1315
+ footerBits - Base.kNumAlignBits
1316
+ );
1317
+ _posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
1318
+ }
1319
+
1320
+ void Flush(UInt32 nowPos)
1321
+ {
1322
+ ReleaseMFStream();
1323
+ WriteEndMarker(nowPos & _posStateMask);
1324
+ _rangeEncoder.FlushData();
1325
+ _rangeEncoder.FlushStream();
1326
+ }
1327
+
1328
+ public void CodeOneBlock(out Int64 inSize, out Int64 outSize, out bool finished)
1329
+ {
1330
+ inSize = 0;
1331
+ outSize = 0;
1332
+ finished = true;
1333
+
1334
+ if (_inStream != null)
1335
+ {
1336
+ _matchFinder.SetStream(_inStream);
1337
+ _matchFinder.Init();
1338
+ _needReleaseMFStream = true;
1339
+ _inStream = null;
1340
+ if (_trainSize > 0)
1341
+ {
1342
+ _matchFinder.Skip(_trainSize);
1343
+ }
1344
+ }
1345
+
1346
+ if (_finished)
1347
+ {
1348
+ return;
1349
+ }
1350
+
1351
+ _finished = true;
1352
+
1353
+ Int64 progressPosValuePrev = nowPos64;
1354
+ if (nowPos64 == 0)
1355
+ {
1356
+ if (_matchFinder.GetNumAvailableBytes() == 0)
1357
+ {
1358
+ Flush((UInt32)nowPos64);
1359
+ return;
1360
+ }
1361
+ UInt32 len,
1362
+ numDistancePairs; // it's not used
1363
+ ReadMatchDistances(out len, out numDistancePairs);
1364
+ UInt32 posState = (UInt32)(nowPos64) & _posStateMask;
1365
+ _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState]
1366
+ .Encode(_rangeEncoder, 0);
1367
+ _state.UpdateChar();
1368
+ Byte curByte = _matchFinder.GetIndexByte((Int32)(0 - _additionalOffset));
1369
+ _literalEncoder
1370
+ .GetSubCoder((UInt32)(nowPos64), _previousByte)
1371
+ .Encode(_rangeEncoder, curByte);
1372
+ _previousByte = curByte;
1373
+ _additionalOffset--;
1374
+ nowPos64++;
1375
+ }
1376
+ if (_matchFinder.GetNumAvailableBytes() == 0)
1377
+ {
1378
+ Flush((UInt32)nowPos64);
1379
+ return;
1380
+ }
1381
+ while (true)
1382
+ {
1383
+ UInt32 len = GetOptimum((UInt32)nowPos64, out UInt32 pos);
1384
+
1385
+ UInt32 posState = ((UInt32)nowPos64) & _posStateMask;
1386
+ UInt32 complexState = (_state.Index << Base.kNumPosStatesBitsMax) + posState;
1387
+ if (len == 1 && pos == 0xFFFFFFFF)
1388
+ {
1389
+ _isMatch[complexState].Encode(_rangeEncoder, 0);
1390
+ Byte curByte = _matchFinder.GetIndexByte((Int32)(0 - _additionalOffset));
1391
+ LiteralEncoder.Encoder2 subCoder = _literalEncoder.GetSubCoder(
1392
+ (UInt32)nowPos64,
1393
+ _previousByte
1394
+ );
1395
+ if (!_state.IsCharState())
1396
+ {
1397
+ Byte matchByte = _matchFinder.GetIndexByte(
1398
+ (Int32)(0 - _repDistances[0] - 1 - _additionalOffset)
1399
+ );
1400
+ subCoder.EncodeMatched(_rangeEncoder, matchByte, curByte);
1401
+ }
1402
+ else
1403
+ {
1404
+ subCoder.Encode(_rangeEncoder, curByte);
1405
+ }
1406
+
1407
+ _previousByte = curByte;
1408
+ _state.UpdateChar();
1409
+ }
1410
+ else
1411
+ {
1412
+ _isMatch[complexState].Encode(_rangeEncoder, 1);
1413
+ if (pos < Base.kNumRepDistances)
1414
+ {
1415
+ _isRep[_state.Index].Encode(_rangeEncoder, 1);
1416
+ if (pos == 0)
1417
+ {
1418
+ _isRepG0[_state.Index].Encode(_rangeEncoder, 0);
1419
+ if (len == 1)
1420
+ {
1421
+ _isRep0Long[complexState].Encode(_rangeEncoder, 0);
1422
+ }
1423
+ else
1424
+ {
1425
+ _isRep0Long[complexState].Encode(_rangeEncoder, 1);
1426
+ }
1427
+ }
1428
+ else
1429
+ {
1430
+ _isRepG0[_state.Index].Encode(_rangeEncoder, 1);
1431
+ if (pos == 1)
1432
+ {
1433
+ _isRepG1[_state.Index].Encode(_rangeEncoder, 0);
1434
+ }
1435
+ else
1436
+ {
1437
+ _isRepG1[_state.Index].Encode(_rangeEncoder, 1);
1438
+ _isRepG2[_state.Index].Encode(_rangeEncoder, pos - 2);
1439
+ }
1440
+ }
1441
+ if (len == 1)
1442
+ {
1443
+ _state.UpdateShortRep();
1444
+ }
1445
+ else
1446
+ {
1447
+ _repMatchLenEncoder.Encode(
1448
+ _rangeEncoder,
1449
+ len - Base.kMatchMinLen,
1450
+ posState
1451
+ );
1452
+ _state.UpdateRep();
1453
+ }
1454
+ UInt32 distance = _repDistances[pos];
1455
+ if (pos != 0)
1456
+ {
1457
+ for (UInt32 i = pos; i >= 1; i--)
1458
+ {
1459
+ _repDistances[i] = _repDistances[i - 1];
1460
+ }
1461
+
1462
+ _repDistances[0] = distance;
1463
+ }
1464
+ }
1465
+ else
1466
+ {
1467
+ _isRep[_state.Index].Encode(_rangeEncoder, 0);
1468
+ _state.UpdateMatch();
1469
+ _lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
1470
+ pos -= Base.kNumRepDistances;
1471
+ UInt32 posSlot = GetPosSlot(pos);
1472
+ UInt32 lenToPosState = Base.GetLenToPosState(len);
1473
+ _posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
1474
+
1475
+ if (posSlot >= Base.kStartPosModelIndex)
1476
+ {
1477
+ int footerBits = (int)((posSlot >> 1) - 1);
1478
+ UInt32 baseVal = ((2 | (posSlot & 1)) << footerBits);
1479
+ UInt32 posReduced = pos - baseVal;
1480
+
1481
+ if (posSlot < Base.kEndPosModelIndex)
1482
+ {
1483
+ BitTreeEncoder.ReverseEncode(
1484
+ _posEncoders,
1485
+ baseVal - posSlot - 1,
1486
+ _rangeEncoder,
1487
+ footerBits,
1488
+ posReduced
1489
+ );
1490
+ }
1491
+ else
1492
+ {
1493
+ _rangeEncoder.EncodeDirectBits(
1494
+ posReduced >> Base.kNumAlignBits,
1495
+ footerBits - Base.kNumAlignBits
1496
+ );
1497
+ _posAlignEncoder.ReverseEncode(
1498
+ _rangeEncoder,
1499
+ posReduced & Base.kAlignMask
1500
+ );
1501
+ _alignPriceCount++;
1502
+ }
1503
+ }
1504
+ UInt32 distance = pos;
1505
+ for (UInt32 i = Base.kNumRepDistances - 1; i >= 1; i--)
1506
+ {
1507
+ _repDistances[i] = _repDistances[i - 1];
1508
+ }
1509
+
1510
+ _repDistances[0] = distance;
1511
+ _matchPriceCount++;
1512
+ }
1513
+ _previousByte = _matchFinder.GetIndexByte((Int32)(len - 1 - _additionalOffset));
1514
+ }
1515
+ _additionalOffset -= len;
1516
+ nowPos64 += len;
1517
+ if (_additionalOffset == 0)
1518
+ {
1519
+ // if (!_fastMode)
1520
+ if (_matchPriceCount >= (1 << 7))
1521
+ {
1522
+ FillDistancesPrices();
1523
+ }
1524
+
1525
+ if (_alignPriceCount >= Base.kAlignTableSize)
1526
+ {
1527
+ FillAlignPrices();
1528
+ }
1529
+
1530
+ inSize = nowPos64;
1531
+ outSize = _rangeEncoder.GetProcessedSizeAdd();
1532
+ if (_matchFinder.GetNumAvailableBytes() == 0)
1533
+ {
1534
+ Flush((UInt32)nowPos64);
1535
+ return;
1536
+ }
1537
+
1538
+ if (nowPos64 - progressPosValuePrev >= (1 << 12))
1539
+ {
1540
+ _finished = false;
1541
+ finished = false;
1542
+ return;
1543
+ }
1544
+ }
1545
+ }
1546
+ }
1547
+
1548
+ void ReleaseMFStream()
1549
+ {
1550
+ if (_matchFinder != null && _needReleaseMFStream)
1551
+ {
1552
+ _matchFinder.ReleaseStream();
1553
+ _needReleaseMFStream = false;
1554
+ }
1555
+ }
1556
+
1557
+ void SetOutStream(System.IO.Stream outStream)
1558
+ {
1559
+ _rangeEncoder.SetStream(outStream);
1560
+ }
1561
+
1562
+ void ReleaseOutStream()
1563
+ {
1564
+ _rangeEncoder.ReleaseStream();
1565
+ }
1566
+
1567
+ void ReleaseStreams()
1568
+ {
1569
+ ReleaseMFStream();
1570
+ ReleaseOutStream();
1571
+ }
1572
+
1573
+ void SetStreams(
1574
+ System.IO.Stream inStream,
1575
+ System.IO.Stream outStream,
1576
+ Int64 inSize,
1577
+ Int64 outSize
1578
+ )
1579
+ {
1580
+ _inStream = inStream;
1581
+ _finished = false;
1582
+ Create();
1583
+ SetOutStream(outStream);
1584
+ Init();
1585
+
1586
+ // if (!_fastMode)
1587
+ {
1588
+ FillDistancesPrices();
1589
+ FillAlignPrices();
1590
+ }
1591
+
1592
+ _lenEncoder.SetTableSize(_numFastBytes + 1 - Base.kMatchMinLen);
1593
+ _lenEncoder.UpdateTables((UInt32)1 << _posStateBits);
1594
+ _repMatchLenEncoder.SetTableSize(_numFastBytes + 1 - Base.kMatchMinLen);
1595
+ _repMatchLenEncoder.UpdateTables((UInt32)1 << _posStateBits);
1596
+
1597
+ nowPos64 = 0;
1598
+ }
1599
+
1600
+ public void Code(
1601
+ System.IO.Stream inStream,
1602
+ System.IO.Stream outStream,
1603
+ Int64 inSize,
1604
+ Int64 outSize,
1605
+ ICodeProgress progress
1606
+ )
1607
+ {
1608
+ _needReleaseMFStream = false;
1609
+ try
1610
+ {
1611
+ SetStreams(inStream, outStream, inSize, outSize);
1612
+ while (true)
1613
+ {
1614
+ CodeOneBlock(
1615
+ out Int64 processedInSize,
1616
+ out Int64 processedOutSize,
1617
+ out bool finished
1618
+ );
1619
+ if (finished)
1620
+ {
1621
+ return;
1622
+ }
1623
+
1624
+ if (progress != null)
1625
+ {
1626
+ progress.SetProgress(processedInSize, processedOutSize);
1627
+ }
1628
+ }
1629
+ }
1630
+ finally
1631
+ {
1632
+ ReleaseStreams();
1633
+ }
1634
+ }
1635
+
1636
+ const int kPropSize = 5;
1637
+ readonly Byte[] properties = new Byte[kPropSize];
1638
+
1639
+ public void WriteCoderProperties(System.IO.Stream outStream)
1640
+ {
1641
+ properties[0] = (Byte)(
1642
+ (_posStateBits * 5 + _numLiteralPosStateBits) * 9 + _numLiteralContextBits
1643
+ );
1644
+ for (int i = 0; i < 4; i++)
1645
+ {
1646
+ properties[1 + i] = (Byte)((_dictionarySize >> (8 * i)) & 0xFF);
1647
+ }
1648
+
1649
+ outStream.Write(properties, 0, kPropSize);
1650
+ }
1651
+
1652
+ readonly UInt32[] tempPrices = new UInt32[Base.kNumFullDistances];
1653
+ UInt32 _matchPriceCount;
1654
+
1655
+ void FillDistancesPrices()
1656
+ {
1657
+ for (UInt32 i = Base.kStartPosModelIndex; i < Base.kNumFullDistances; i++)
1658
+ {
1659
+ UInt32 posSlot = GetPosSlot(i);
1660
+ int footerBits = (int)((posSlot >> 1) - 1);
1661
+ UInt32 baseVal = ((2 | (posSlot & 1)) << footerBits);
1662
+ tempPrices[i] = BitTreeEncoder.ReverseGetPrice(
1663
+ _posEncoders,
1664
+ baseVal - posSlot - 1,
1665
+ footerBits,
1666
+ i - baseVal
1667
+ );
1668
+ }
1669
+
1670
+ for (UInt32 lenToPosState = 0; lenToPosState < Base.kNumLenToPosStates; lenToPosState++)
1671
+ {
1672
+ UInt32 posSlot;
1673
+ BitTreeEncoder encoder = _posSlotEncoder[lenToPosState];
1674
+
1675
+ UInt32 st = (lenToPosState << Base.kNumPosSlotBits);
1676
+ for (posSlot = 0; posSlot < _distTableSize; posSlot++)
1677
+ {
1678
+ _posSlotPrices[st + posSlot] = encoder.GetPrice(posSlot);
1679
+ }
1680
+
1681
+ for (posSlot = Base.kEndPosModelIndex; posSlot < _distTableSize; posSlot++)
1682
+ {
1683
+ _posSlotPrices[st + posSlot] += (
1684
+ (((posSlot >> 1) - 1) - Base.kNumAlignBits)
1685
+ << BitEncoder.kNumBitPriceShiftBits
1686
+ );
1687
+ }
1688
+
1689
+ UInt32 st2 = lenToPosState * Base.kNumFullDistances;
1690
+ UInt32 i;
1691
+ for (i = 0; i < Base.kStartPosModelIndex; i++)
1692
+ {
1693
+ _distancesPrices[st2 + i] = _posSlotPrices[st + i];
1694
+ }
1695
+
1696
+ for (; i < Base.kNumFullDistances; i++)
1697
+ {
1698
+ _distancesPrices[st2 + i] = _posSlotPrices[st + GetPosSlot(i)] + tempPrices[i];
1699
+ }
1700
+ }
1701
+ _matchPriceCount = 0;
1702
+ }
1703
+
1704
+ void FillAlignPrices()
1705
+ {
1706
+ for (UInt32 i = 0; i < Base.kAlignTableSize; i++)
1707
+ {
1708
+ _alignPrices[i] = _posAlignEncoder.ReverseGetPrice(i);
1709
+ }
1710
+
1711
+ _alignPriceCount = 0;
1712
+ }
1713
+
1714
+ static readonly string[] kMatchFinderIDs = { "BT2", "BT4" };
1715
+
1716
+ static int FindMatchFinder(string s)
1717
+ {
1718
+ for (int m = 0; m < kMatchFinderIDs.Length; m++)
1719
+ {
1720
+ if (s == kMatchFinderIDs[m])
1721
+ {
1722
+ return m;
1723
+ }
1724
+ }
1725
+
1726
+ return -1;
1727
+ }
1728
+
1729
+ public void SetCoderProperties(CoderPropID[] propIDs, object[] properties)
1730
+ {
1731
+ for (UInt32 i = 0; i < properties.Length; i++)
1732
+ {
1733
+ object prop = properties[i];
1734
+ switch (propIDs[i])
1735
+ {
1736
+ case CoderPropID.NumFastBytes:
1737
+ {
1738
+ if (!(prop is Int32))
1739
+ {
1740
+ throw new InvalidParamException();
1741
+ }
1742
+
1743
+ Int32 numFastBytes = (Int32)prop;
1744
+ if (numFastBytes < 5 || numFastBytes > Base.kMatchMaxLen)
1745
+ {
1746
+ throw new InvalidParamException();
1747
+ }
1748
+
1749
+ _numFastBytes = (UInt32)numFastBytes;
1750
+ break;
1751
+ }
1752
+ case CoderPropID.Algorithm:
1753
+ {
1754
+ /*
1755
+ if (!(prop is Int32))
1756
+ throw new InvalidParamException();
1757
+ Int32 maximize = (Int32)prop;
1758
+ _fastMode = (maximize == 0);
1759
+ _maxMode = (maximize >= 2);
1760
+ */
1761
+ break;
1762
+ }
1763
+ case CoderPropID.MatchFinder:
1764
+ {
1765
+ if (!(prop is String))
1766
+ {
1767
+ throw new InvalidParamException();
1768
+ }
1769
+
1770
+ EMatchFinderType matchFinderIndexPrev = _matchFinderType;
1771
+ int m = FindMatchFinder(((string)prop).ToUpper());
1772
+ if (m < 0)
1773
+ {
1774
+ throw new InvalidParamException();
1775
+ }
1776
+
1777
+ _matchFinderType = (EMatchFinderType)m;
1778
+ if (_matchFinder != null && matchFinderIndexPrev != _matchFinderType)
1779
+ {
1780
+ _dictionarySizePrev = 0xFFFFFFFF;
1781
+ _matchFinder = null;
1782
+ }
1783
+ break;
1784
+ }
1785
+ case CoderPropID.DictionarySize:
1786
+ {
1787
+ const int kDicLogSizeMaxCompress = 30;
1788
+ if (!(prop is Int32))
1789
+ {
1790
+ throw new InvalidParamException();
1791
+ }
1792
+ ;
1793
+ Int32 dictionarySize = (Int32)prop;
1794
+ if (
1795
+ dictionarySize < (UInt32)(1 << Base.kDicLogSizeMin)
1796
+ || dictionarySize > (UInt32)(1 << kDicLogSizeMaxCompress)
1797
+ )
1798
+ {
1799
+ throw new InvalidParamException();
1800
+ }
1801
+
1802
+ _dictionarySize = (UInt32)dictionarySize;
1803
+ int dicLogSize;
1804
+ for (
1805
+ dicLogSize = 0;
1806
+ dicLogSize < (UInt32)kDicLogSizeMaxCompress;
1807
+ dicLogSize++
1808
+ )
1809
+ {
1810
+ if (dictionarySize <= ((UInt32)(1) << dicLogSize))
1811
+ {
1812
+ break;
1813
+ }
1814
+ }
1815
+
1816
+ _distTableSize = (UInt32)dicLogSize * 2;
1817
+ break;
1818
+ }
1819
+ case CoderPropID.PosStateBits:
1820
+ {
1821
+ if (!(prop is Int32))
1822
+ {
1823
+ throw new InvalidParamException();
1824
+ }
1825
+
1826
+ Int32 v = (Int32)prop;
1827
+ if (v < 0 || v > (UInt32)Base.kNumPosStatesBitsEncodingMax)
1828
+ {
1829
+ throw new InvalidParamException();
1830
+ }
1831
+
1832
+ _posStateBits = v;
1833
+ _posStateMask = (((UInt32)1) << _posStateBits) - 1;
1834
+ break;
1835
+ }
1836
+ case CoderPropID.LitPosBits:
1837
+ {
1838
+ if (!(prop is Int32))
1839
+ {
1840
+ throw new InvalidParamException();
1841
+ }
1842
+
1843
+ Int32 v = (Int32)prop;
1844
+ if (v < 0 || v > Base.kNumLitPosStatesBitsEncodingMax)
1845
+ {
1846
+ throw new InvalidParamException();
1847
+ }
1848
+
1849
+ _numLiteralPosStateBits = v;
1850
+ break;
1851
+ }
1852
+ case CoderPropID.LitContextBits:
1853
+ {
1854
+ if (!(prop is Int32))
1855
+ {
1856
+ throw new InvalidParamException();
1857
+ }
1858
+
1859
+ Int32 v = (Int32)prop;
1860
+ if (v < 0 || v > Base.kNumLitContextBitsMax)
1861
+ {
1862
+ throw new InvalidParamException();
1863
+ }
1864
+ ;
1865
+ _numLiteralContextBits = v;
1866
+ break;
1867
+ }
1868
+ case CoderPropID.EndMarker:
1869
+ {
1870
+ if (!(prop is Boolean))
1871
+ {
1872
+ throw new InvalidParamException();
1873
+ }
1874
+
1875
+ SetWriteEndMarkerMode((Boolean)prop);
1876
+ break;
1877
+ }
1878
+ default:
1879
+ throw new InvalidParamException();
1880
+ }
1881
+ }
1882
+ }
1883
+
1884
+ uint _trainSize = 0;
1885
+
1886
+ public void SetTrainSize(uint trainSize)
1887
+ {
1888
+ _trainSize = trainSize;
1889
+ }
1890
+ }
1891
+ }