Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ananasmoe
Copy link
Member

@ananasmoe ananasmoe commented Dec 2, 2024

@ananasmoe ananasmoe changed the title feat: lanczos feat: lanczos downscaling Dec 2, 2024
@THEGOLDENPRO
Copy link
Member

I will have to hardcore test this with my test images.

Also how does Lanczos filtering work again? I need this code a little more commented.

@ananasmoe
Copy link
Member Author

idk how to explain lanczos, my brain is fried. https://en.wikipedia.org/wiki/Lanczos_resampling

@ananasmoe
Copy link
Member Author

Hope that comment explains it

@THEGOLDENPRO
Copy link
Member

THEGOLDENPRO commented Dec 2, 2024

Can we name some variables better, like what is a meant to be?

Also is lanczos_window basically square_block_size like in the code below? (I'm just trying to understand exactly how this works, I'll read more into that wiki later™)

// Here we basically take a 2x2 square block (4 pixels) from the source image so we can
// average their colour values to downscale that to one pixel in the downsampled image.
for vertical_offset in 0..square_block_size {
for horizontal_offset in 0..square_block_size {

@THEGOLDENPRO
Copy link
Member

THEGOLDENPRO commented Dec 2, 2024

Alright starting to understand this...

EDIT: I'm commenting more of the code now.

@THEGOLDENPRO THEGOLDENPRO linked an issue Dec 2, 2024 that may be closed by this pull request
@THEGOLDENPRO
Copy link
Member

I don't know if it's gotten slower or what but image-rs down-sampling is faster with every other image except purposely large images like uwu_bomb.png. Lanczos is naturally more expensive so I expect it to be slower than the previews algorithm but now I got to compare the two versions and see if I can somehow improve it.

@THEGOLDENPRO
Copy link
Member

Imagine this on an AMD Threadripper 💀 you'll be able to downsample 8k images A LOT faster.

BTW I do have a potential solution I could try to speed this up, i just don't know I'll work until I actually implement it and test it A LOT as we might be talking about very small milliseconds of improvement.

@THEGOLDENPRO
Copy link
Member

performance issues fixed! It's a lot faster than the image-rs backend now with all images I've tested so far.

image

@THEGOLDENPRO
Copy link
Member

During my tests I found the roseate backend having issues with some images

Screenshot_20241208_214114

going back versions this issue has existed since I wrote the first iteration though so I can still close this pr, thanks!

@THEGOLDENPRO THEGOLDENPRO merged commit 7a6907d into main Dec 8, 2024
@THEGOLDENPRO THEGOLDENPRO deleted the feat/lanczos-downscaling branch December 8, 2024 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Current downsampling algorithm sucks

3 participants