Ok. The HSV formula for transferring RGB triplet into the HSV form is widely published. But I've failed to find any hints to how one arrives at it, so I could try to optimize it for my game's blitter routine. Therefore I tried to infer h,s,v formula myself, using basic vector math.
v = (r+g+b)/3 //value hs = v-r,v-g,v-b //hue*saturation vector s = hs.length //saturation h = angle(hs/s) //hue is the angle of the vector
Guess when one needs to just change the saturation, there is no reason compute the angle or even vector length in full, but the common requirement to change the hue requires nasty computation. Can anyone hint at any efficient way of shifting hue?
>>48↵
Benchmark it with current Spectre patches.
Benchmark it with current Spectre patches. ↵
Branch prediction is getting riskier and riskier.↵
https://en.wikipedia.org/wiki/Category:Speculative_execution_security_vulnerabilities
Name:
Anonymous2019-08-01 11:18
>>47 OP asked a question about ARM. you post answer about x86. it is you who needs to prove its relevance to the question you hamster-killing psychopathic bydlo
>>61 StackOverflower: how much is 2+2? Bydlita: 3+3 is 6 SO: but I want to know how much is 2+2 B: it's 6 SO: I don't think your're are right B: prove it!
Name:
Anonymous2019-08-01 13:48
Hue shit
Name:
Anonymous2019-08-01 13:53
>>59 Lookup table: one(likely cached) memory load. sqrt: 3 divs with consequent dependence, 1 early branch.
Name:
Anonymous2019-08-01 14:06
Lookup tables win EVEN if they don't fit in the cache, IIRC most chess programs have precomputed "bitboard" tables, often several megabytes of different piece tables to quickly solve intersection/bijection test for attacks. Only the first accesses of a such table is penalized, then the L2/L3 cache begins to kick in and no algorithms can compete.
Name:
Anonymous2019-08-01 14:15
look up the repeating digits in my poast number
Name:
Anonymous2019-08-01 16:02
>>64 ARMs are not that cache dependent and the LUT is just 1000 bytes - enough to fit in a cache.
Name:
Anonymous2019-08-01 16:04
>>65 In most cases lookup tables are accessed locally. I.e. if you're processing RGB color photo, then they RGB values will vary smoothly across image.
Name:
Anonymous2019-08-01 16:06
>>64 Also, that early branch dependency isn't my code, but a copy from the upvoted answer from stackoveflow.
Name:
Anonymous2019-08-01 16:52
>>67 256 bytes, if the sqrt is in range 0-15(0-255). 128 bytes, with more complex adressing(store 2 sqrts in one byte.4bits fits 0-15 exactly)
Name:
Anonymous2019-08-01 17:54
Lookups = non constant time operation.
Name:
Anonymous2019-08-01 19:10
>>71 Actually memory/cache latency is fairly constant.
>>77 It's using a lazy estimate/precalc of sqrt(2) in 1 + 1 * 0.41 error value of 20 on ~sqrt(300^2 + 400^2) doesn't seem too bad, +4% error 6% for (100, 400), and similar for (200,400)
Calculation should just about be competitive with the sum of square precalculation
I'm using it for gamma packing, not distance. And precision is somewhat important. I considered using 9bit floating point numbers, but they mapped badly to gamma rgbs, producing more loss of precision.
I'm doing it all in software, so I can't really afford true 16 floats, like GPUs do.
Name:
Anonymous2019-08-03 1:53
I was just introduced to YCoCg-R, I'm in love. —FLIF user