@SMaag
Maybe this is also interesting to you.
https://stackoverflow.com/questions/524 ... ate-filter
This is how chromium css does it.
It's again different. More like my original code but with different weights and + and - of the hue rotation angle switched.
Search found 3635 matches
- Mon Sep 18, 2023 7:44 am
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
- Sun Sep 17, 2023 4:56 pm
- Forum: Tricks 'n' Tips
- Topic: fsum implementation, converted from Pythons fsum
- Replies: 13
- Views: 1350
Re: fsum implementation, converted from Pythons fsum
The code you posted does do a better job.NicTheQuick wrote: ↑Sun Sep 17, 2023 2:42 pm Hi wilbert. I also thought about doing it like this but on the other side there are also people way smarter than me and because of that I just converted that existing code.
I just wanted to try something relatively simple.
- Sun Sep 17, 2023 9:01 am
- Forum: Tricks 'n' Tips
- Topic: fsum implementation, converted from Pythons fsum
- Replies: 13
- Views: 1350
- Sun Sep 17, 2023 7:19 am
- Forum: Tricks 'n' Tips
- Topic: fsum implementation, converted from Pythons fsum
- Replies: 13
- Views: 1350
Re: fsum implementation, converted from Pythons fsum
ThanksLittle John wrote: ↑Sun Sep 17, 2023 6:54 am Wilbert, what you are doing is incredible!
I'm glad you're back on the forum and I hope you're doing well.
I'm okay.
- Sun Sep 17, 2023 7:14 am
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
Re: HSL/HSV to RGB
The 256 Bit Version is 40x slower than the 128Bit Version. That means, the 256Bit SSE is slower than the classic verison without SSE extention. I can't understand why! I also did some tests with AVX2 and it was also much slower. But that wasn't the only problem I ran into. The instructions also don...
- Sat Sep 16, 2023 6:51 pm
- Forum: Tricks 'n' Tips
- Topic: fsum implementation, converted from Pythons fsum
- Replies: 13
- Views: 1350
Re: fsum implementation, converted from Pythons fsum
I know it doesn't exactly do what your code does but just for fun a simple PB approach. Structure S_DoubleQuadUnion StructureUnion d.d : q.q EndStructureUnion EndStructure Procedure.d SumDoubles(Array d.d(1)) Protected Dim Sums.d(2047) Protected Sum.d, *DQ.S_DoubleQuadUnion = @d() Protected i, j = A...
- Sat Sep 16, 2023 4:22 pm
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
Re: HSL/HSV to RGB
I tried to do a HSL to RGB as well with integer math. You have to make sure yourself the input is within the correct range but it is pretty fast I guess. Procedure HSLToRGB(h, s = 100, l = 50) ; h[0,360], s[0,100], l[0,100] Protected.l c, x, r, g, b c = l If l > 50 c = 100 - c EndIf c*s l = 100*l - ...
- Sat Sep 16, 2023 2:46 pm
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
Re: HSL/HSV to RGB
@wilbert: may you test again, (see previos post with the code) I updated it. Now it looks ok! In the original matrix.c is a bug! The rotation direction for hue is inverted. Red 120° rotates to blue not to green! The problem was in the Z rotation matrix. A rotation of 120 or 240 looks okay now but a...
- Fri Sep 15, 2023 5:47 am
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
Re: HSL/HSV to RGB
One small error I coudn't not find until know is the hue rotatian angle. It now is just the opposite of the hue rotation from my code and the hue rotation in Affinity Photo 2 (the graphics application I'm using). A hue rotation of -60 degrees in your test code is about the same as a rotation of +60...
- Wed Sep 13, 2023 6:19 pm
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
Re: HSL/HSV to RGB
I can't follow your code at all, because you are doing some optimations what are good for speed but hard to understand. Especally the form of the Matrix. For me, at the moment it looks like as you moved some entries to other positions to optimate SSE Commands! That is right. :wink: Because the inte...
- Wed Sep 13, 2023 1:39 pm
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
Re: HSL/HSV to RGB
I guess it is a problem of the matrix parameters! I think it has to do with the YIQ colorspace. A quote from the page where the matrix multiplication came from ... RGB values aren’t very convenient for doing complex transforms on, especially hue. The math for doing a hue rotation on RGB is nasty. H...
- Wed Sep 13, 2023 9:31 am
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
Re: HSL/HSV to RGB
CPU's Ryzen 5800X : 1.45ms Intel I7 8565U : 6.4ms Intel I7 from 2016 : 7.8ms AMD form 2011 : 7.4ms I still don't understand why your Ryzen is so fast. I tried AVX2 but am not very familiar with it. My experiments were much slower as the SSE2 code. I was able to modify the SSE2 code to handle two pi...
- Tue Sep 12, 2023 1:15 pm
- Forum: Coding Questions
- Topic: Fast accessing maps
- Replies: 8
- Views: 489
Re: Fast accessing maps
Oh, that's some light on the topic. I would expect the first approach to be faster too, or at least not slower. I'll have to change some of my programs, I never thought about that. You are all right. I answered the question with yes but made a mistake in typing second instead of first. Of course th...
- Tue Sep 12, 2023 10:03 am
- Forum: Coding Questions
- Topic: HSL/HSV to RGB
- Replies: 44
- Views: 2546
Re: HSL/HSV to RGB
Could we use YMMn Or ZMMn ? Like you probably already have noticed I need the full 128 bits to process a single pixel (2x PMADDWD to do the 16 multiplications required for the matrix multiplication). If the cpu supports AVX2 or AVX512 you could indeed adapt the source to process 2 or 4 pixels in pa...
- Tue Sep 12, 2023 7:12 am
- Forum: Coding Questions
- Topic: Fast accessing maps
- Replies: 8
- Views: 489
Re: Fast accessing maps
Does this mean that ... is faster than ... ? Yes, the first approach is a lot faster. Secondly, I can define how many slots are preoccupied/predefined on creation. Can I change that afterwards, like redimming an array? No, you can't change that. A map uses a (hash) function on the key you pass to f...