Skip to content

Commit

Permalink
Merge pull request #1
Browse files Browse the repository at this point in the history
Bump to 0.1.1, optimize SLIC index computation
  • Loading branch information
okaneco authored Jan 15, 2023
2 parents 1f0e954 + 3e7ed70 commit ebb6398
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 151 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# `simple_clustering` changelog

## Version 0.1.1 - 2023-01
Improved SLIC calculation speed by ~15-20% after refactoring calculation loop.

[#1][1] - Bump to 0.1.1, Optimize slic index computation

## Version 0.1.0 - 2022-04
- Initial Commit

[1]: https://github.com/okaneco/simple_clustering/pull/1
137 changes: 60 additions & 77 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "simple_clustering"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
exclude = ["gfx", ".github"]
description = "Implementations of image clustering and segmentation algorithms such as SLIC and SNIC."
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-APACHE
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@

END OF TERMS AND CONDITIONS

Copyright 2022 Collyn O'Kane
Copyright 2022-2023 Collyn O'Kane

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2022 Collyn O'Kane
Copyright 2022-2023 Collyn O'Kane

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# simple_clustering
[![Build Status](https://img.shields.io/github/workflow/status/okaneco/simple_clustering/Rust%20CI)](https://github.com/okaneco/simple_clustering)
[![Build Status](https://github.com/okaneco/simple_clustering/workflows/Rust%20CI/badge.svg)](https://github.com/okaneco/simple_clustering)
[![Crates.io](https://img.shields.io/crates/v/simple_clustering.svg)](https://crates.io/crates/simple_clustering)
[![Docs.rs](https://docs.rs/simple_clustering/badge.svg)](https://docs.rs/simple_clustering)

Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ where
/// Checks if the index is in bounds and returns a reference to the data at that
/// point if it exists.
#[inline]
fn get_in_bounds<T>(width: i64, height: i64, x: i64, y: i64, image: &[T]) -> Option<&T> {
if (0..width).contains(&x) && (0..height).contains(&y) {
fn get_in_bounds<T>(width: i64, _height: i64, x: i64, y: i64, image: &[T]) -> Option<&T> {
if (0..width).contains(&x) {
let i = u64::try_from(y)
.ok()?
.checked_mul(u64::try_from(width).ok()?)?
Expand All @@ -188,12 +188,12 @@ fn get_in_bounds<T>(width: i64, height: i64, x: i64, y: i64, image: &[T]) -> Opt
#[inline]
fn get_mut_in_bounds<T>(
width: i64,
height: i64,
_height: i64,
x: i64,
y: i64,
image: &mut [T],
) -> Option<&mut T> {
if (0..width).contains(&x) && (0..height).contains(&y) {
if (0..width).contains(&x) {
let i = u64::try_from(y)
.ok()?
.checked_mul(u64::try_from(width).ok()?)?
Expand Down
Loading

0 comments on commit ebb6398

Please sign in to comment.