JPEG XL

Info

rules 57
github 35276
reddit 647

JPEG XL

tools 4225
website 1655
adoption 20712
image-compression-forum 0

General chat

welcome 3810
introduce-yourself 291
color 1414
photography 3435
other-codecs 23765
on-topic 24923
off-topic 22701

Voice Channels

General 2147

Archived

bot-spam 4380

on-topic

Whatever else

Traneptora
2024-01-06 09:21:11
I mean that the model is tuned so that the number you specify will likely achieve the bitrate across a large corpus of audio files
lonjil
2024-01-06 09:21:12
the model being good should have the *opposite* effect of making files usually be close to the specified bitrate.
Traneptora I mean that the model is tuned so that the number you specify will likely achieve the bitrate across a large corpus of audio files
2024-01-06 09:21:25
right yeah
Oleksii Matiash
Traneptora it's not actually ABR
2024-01-06 09:21:28
In my world VBR with target bitrate is ABR, true VBR is when I specify quality and let encoder do the rest. The same as with image encoders - we specify quality, not approximate desired size
Traneptora
2024-01-06 09:21:37
it's not a target bitrate
2024-01-06 09:21:44
It's a target quality, that's by design a similar number to bitrate
2024-01-06 09:22:02
the units are of the same order of magnitude, but it *is* a quality setting
Oleksii Matiash
2024-01-06 09:22:37
I specified 256, got 255 and 249 for two files. I think it IS target bitrate.
Traneptora
2024-01-06 09:23:29
sample size of two
Oleksii Matiash
2024-01-06 09:23:36
And I really don't care how it is called internally. It is called bitrate, results in very close bitrate - it is a bitrate. πŸ€·β€β™‚οΈ
Traneptora
2024-01-06 09:23:38
here's a random file I found l ying around
2024-01-06 09:23:43
``` $ opusenc --bitrate 128 a.flac a.opus Encoding using libopus 1.4 (audio) ----------------------------------------------------- Input: 48 kHz, 1 channel Output: 1 channel (1 uncoupled) 20ms packets, 128 kbit/s VBR Preskip: 312 Encoding complete ----------------------------------------------------- Encoded: 10.02 seconds Runtime: 0 seconds Wrote: 196692 bytes, 501 packets, 13 pages Bitrate: 155.329 kbit/s (without overhead) Instant rates: 150.4 to 256.4 kbit/s (376 to 641 bytes per packet) Overhead: 1.09% (container+metadata) ```
Oleksii Matiash And I really don't care how it is called internally. It is called bitrate, results in very close bitrate - it is a bitrate. πŸ€·β€β™‚οΈ
2024-01-06 09:23:58
It's literally VBR mate idk what else to say
2024-01-06 09:26:37
You can say "I don't believe you cause the option says bitrate on it" but it's not actually ABR, it's true VBR
2024-01-06 09:27:55
You could, read the docs, where `--vbr` is the default. If you want ABR, you can use `--cvbr` for constrained variable bitrate encoding (same thing), or if you want real CBR you use `--hard-cbr` for hard constant bitrate encoding
2024-01-06 09:28:41
You can choose not to use Opus because you ignore all the information in front of you and decide it isn't what it says it is
Oleksii Matiash
2024-01-06 09:28:53
It is has variable bitrate, I know, but not having quality setting and instead having bitrate turns it to ABR. This is how it was called at least since LAME. I don't know what is happening under the opus hood, but for me as external observer it is not true VBR just because of this reason. Once more - I converted two files with 44 and 11 kHz, and 11 kHz file resulted in bigger opus file. It is a nonsense for me
Traneptora
Oleksii Matiash It is has variable bitrate, I know, but not having quality setting and instead having bitrate turns it to ABR. This is how it was called at least since LAME. I don't know what is happening under the opus hood, but for me as external observer it is not true VBR just because of this reason. Once more - I converted two files with 44 and 11 kHz, and 11 kHz file resulted in bigger opus file. It is a nonsense for me
2024-01-06 09:29:13
Once again, i remind you, it literally has a quality setting
2024-01-06 09:29:16
and it is literally not ABR
2024-01-06 09:29:26
You're straight up wrong about that.
Oleksii Matiash
2024-01-06 09:29:42
I will not use it because it is not usable for me, definitely. I can't stand with the situation I described. So let's stop here
fab
2024-01-06 09:29:45
337 nero abr is the best
2024-01-06 09:30:04
Opus is still behind
Traneptora
Oleksii Matiash I will not use it because it is not usable for me, definitely. I can't stand with the situation I described. So let's stop here
2024-01-06 09:30:14
Yes you fed it two files and the quality setting you passed roughly matched the bitrate of the output file, **completely unusable** πŸ€“
fab
2024-01-06 09:30:16
Useful at 230 kbps rate for ffmpeg libopus
2024-01-06 09:30:30
Or ffmpeg libopus
2024-01-06 09:30:45
I have also suggestions for the bitrate to use in reddit
2024-01-06 09:30:50
Tomorrow i will send
Traneptora
2024-01-06 09:31:12
You are not required to use it, but you're making a decision based on objectively false information, that is well-documented to be directly false, and you are deliberately ignoring all the information that is available to you.
Oleksii Matiash
Traneptora Yes you fed it two files and the quality setting you passed roughly matched the bitrate of the output file, **completely unusable** πŸ€“
2024-01-06 09:31:44
Do you think it is ok? When files with 4 times different "information" in it are encoded in the same resulting file size?
fab
2024-01-06 09:31:59
lonjil
2024-01-06 09:32:02
I tried 4 random files I happened to have lying around: ``` % opusenc --bitrate 128 Devin\ Townsend\ Project-The\ Mighty\ Masturbator.wav /tmp/a.opus % opusenc --bitrate 128 Laibach\ -\ Jesus\ Christ\ Superstar\ \(24kHz\).wav /tmp/b.opus % opusenc --bitrate 128 Timeless\ Miracle\ -\ Heaven\ in\ hell\ \(Demo\)\ \(2006\).wav /tmp/c.opus % opusenc --bitrate 128 I\ Won\ The\ Loudness\ War\ WARNING\ THIS\ MIGHT\ DESTROY\ YOUR\ SPEAKERS\ \[WSg_6Osx-eE\].flac /tmp/d.opus % for x in /tmp/*.opus; do echo; opusinfo "$x" | grep "Average bitrate"; done Average bitrate: 124.2 kbit/s Average bitrate: 120.2 kbit/s Average bitrate: 127.9 kbit/s Average bitrate: 180.6 kbit/s ```
Traneptora
Oleksii Matiash Do you think it is ok? When files with 4 times different "information" in it are encoded in the same resulting file size?
2024-01-06 09:32:08
Yes it divides it by the sample rate beforehand
2024-01-06 09:32:15
I mentioned this
fab
Traneptora You are not required to use it, but you're making a decision based on objectively false information, that is well-documented to be directly false, and you are deliberately ignoring all the information that is available to you.
2024-01-06 09:32:38
64 kbps for the latest 1.4.0 is considered low as it only changes the RDO
Traneptora
2024-01-06 09:32:47
fab shut up
spider-mario
2024-01-06 09:32:55
I guess one could make the criticism that the scale being made to correlate so strongly with bitrate makes it hard to intuit
fab
2024-01-06 09:32:57
So you have improvements when the song is 1:15
lonjil
Oleksii Matiash Do you think it is ok? When files with 4 times different "information" in it are encoded in the same resulting file size?
2024-01-06 09:33:05
they don't have 4 times different information in them. It's perfectly possible that most of the audible content in the file is in lower frequencies.
spider-mario
2024-01-06 09:33:16
like, what’s β€œd1”? is it `--bitrate 128`? `--bitrate 160`?
Oleksii Matiash
Traneptora Yes it divides it by the sample rate beforehand
2024-01-06 09:33:24
Ok, if it is logical for you, then we should definitely stop here, because our vision is completely opposite
fab
2024-01-06 09:33:26
For examples in si tu no estas by Nicky jam he says medallo
2024-01-06 09:33:43
For coding it now 115 kbps is considered medium
Traneptora
Oleksii Matiash Ok, if it is logical for you, then we should definitely stop here, because our vision is completely opposite
2024-01-06 09:33:55
I'm literally reporting what the documentation says. if you think the documentation is lying you can check the source code as well, it's all open source, and available online
fab
2024-01-06 09:34:08
But it was possible even with libopus 1.3.1-166
2024-01-06 09:34:28
Just difficult you had a roughe sound
Traneptora
spider-mario like, what’s β€œd1”? is it `--bitrate 128`? `--bitrate 160`?
2024-01-06 09:34:30
tbf what does "d1" mean by itself?
fab
2024-01-06 09:34:36
Bitrate were 400kb
Traneptora
2024-01-06 09:34:41
sure it's libjxl's default but it's definitely not transparent
spider-mario
2024-01-06 09:34:51
it’s supposed to mean a just noticeable difference
2024-01-06 09:34:55
but it has drifted somewhat from that
fab
Traneptora I'm literally reporting what the documentation says. if you think the documentation is lying you can check the source code as well, it's all open source, and available online
2024-01-06 09:35:02
You are intelligent do you ever studied?
Oleksii Matiash
Traneptora I'm literally reporting what the documentation says. if you think the documentation is lying you can check the source code as well, it's all open source, and available online
2024-01-06 09:35:08
I don't think that documentation is lying, I'm just saying that the whole opus behavior is not ok for me. And it is pity, because of it's quality
fab
lonjil I tried 4 random files I happened to have lying around: ``` % opusenc --bitrate 128 Devin\ Townsend\ Project-The\ Mighty\ Masturbator.wav /tmp/a.opus % opusenc --bitrate 128 Laibach\ -\ Jesus\ Christ\ Superstar\ \(24kHz\).wav /tmp/b.opus % opusenc --bitrate 128 Timeless\ Miracle\ -\ Heaven\ in\ hell\ \(Demo\)\ \(2006\).wav /tmp/c.opus % opusenc --bitrate 128 I\ Won\ The\ Loudness\ War\ WARNING\ THIS\ MIGHT\ DESTROY\ YOUR\ SPEAKERS\ \[WSg_6Osx-eE\].flac /tmp/d.opus % for x in /tmp/*.opus; do echo; opusinfo "$x" | grep "Average bitrate"; done Average bitrate: 124.2 kbit/s Average bitrate: 120.2 kbit/s Average bitrate: 127.9 kbit/s Average bitrate: 180.6 kbit/s ```
2024-01-06 09:35:33
I agree with you
Traneptora
Oleksii Matiash I don't think that documentation is lying, I'm just saying that the whole opus behavior is not ok for me. And it is pity, because of it's quality
2024-01-06 09:35:35
well what you think the "whole opus behavior" is directly disagrees with what the documentation says so if it is not lying then you are mistaken
Oleksii Matiash
Traneptora fab shut up
2024-01-06 09:36:15
Very useful feature, btw
fab
2024-01-06 09:36:27
It's 22:36pm I'll continue afternoon
2024-01-06 09:36:35
Hi 😊 all
lonjil
2024-01-06 09:36:37
see you later
Traneptora
Oleksii Matiash Very useful feature, btw
2024-01-06 09:36:48
blocking is not a useful feature tbh because it doesn't actually hide messages, it just shows that blocked messages exist
2024-01-06 09:37:00
it's mostly useful to prevent people from sending you unwanted direct messages
Oleksii Matiash
2024-01-06 09:37:06
But it does not annoy with it's content
lonjil
Traneptora well what you think the "whole opus behavior" is directly disagrees with what the documentation says so if it is not lying then you are mistaken
2024-01-06 09:38:06
I think Oleksii accepts that it converts the specified bitrate into an actual quality, but thinks dividing by the sample rate is bad. He thinks the 11kHz file should definitely be a lot smaller. Because it has a lot less information in it, a quality targetting VBR mode should be able to make it smaller.
Traneptora
2024-01-06 09:38:29
That would be true if the file actually had way less information in it
Oleksii Matiash
lonjil I think Oleksii accepts that it converts the specified bitrate into an actual quality, but thinks dividing by the sample rate is bad. He thinks the 11kHz file should definitely be a lot smaller. Because it has a lot less information in it, a quality targetting VBR mode should be able to make it smaller.
2024-01-06 09:38:33
Exactly
lonjil
2024-01-06 09:38:50
Indeed, I made that point before. The 11kHz file may in fact still have most audible information in it.
Oleksii Matiash
2024-01-06 09:38:56
This is how all other audio lossy encoders with VBR behave
lonjil
2024-01-06 09:39:43
In which case Opus was already throwing away most of the higher frequency content, which means that reducing the sample rate was just removing the data Opus was removing anyway.
2024-01-06 09:40:16
It could be that other encoders aren't as smart about what is or is not audible.
2024-01-06 09:40:36
Of course, this is just speculation, but I think your test is not very conclusive.
jonnyawsom3
spider-mario it’s supposed to mean a just noticeable difference
2024-01-06 09:40:37
I always interpreted it as "d/100 people would notice in a blind test at original size"
2024-01-06 09:41:04
So the default is 1/100 people at 100% zoom for JXL
Traneptora
Oleksii Matiash This is how all other audio lossy encoders with VBR behave
2024-01-06 09:41:13
not always the correct choice
spider-mario
2024-01-06 09:41:46
I suspect that around d1 is probably the only point where this might approximately hold
Traneptora
2024-01-06 09:41:51
Here's an example of two files that have identical audio content ``` $ oggenc -q 5 48k.flac Opening with flac module: FLAC file reader Encoding "48k.flac" to "48k.ogg" at quality 5.00 [ 94.1%] [ 0m00s remaining] - Done encoding file "48k.ogg" File length: 0m 10.0s Elapsed time: 0m 00.0s Rate: 211.8824 Average bitrate: 15.7 kb/s $ oggenc -q 5 8k.flac Opening with flac module: FLAC file reader Encoding "8k.flac" to "8k.ogg" at quality 5.00 [ 92.2%] [ 0m00s remaining] - Done encoding file "8k.ogg" File length: 0m 10.0s Elapsed time: 0m 00.0s Rate: 955.5662 Average bitrate: 6.1 kb/s ``` One's 8k, and one's 48k. They *should* be the same bitrate when you encode them to vorbis, but they are not.
spider-mario
2024-01-06 09:42:03
d10 would likely be noticeably different for way more than just 10% of people
Traneptora
2024-01-06 09:42:16
The difference here is only the sample rate. both of them are pure tone 440 Hz files
2024-01-06 09:42:21
just a sine wave
jonnyawsom3
spider-mario d10 would likely be noticeably different for way more than just 10% of people
2024-01-06 09:42:55
Certainly a non-linear scale, but from d 0.5 to 3.0 like libjxl reccomends it probably lines up
Traneptora
2024-01-06 09:43:24
d3 meaning 3% of the people wouldn't notice a difference doesn't line up at all
Oleksii Matiash
lonjil In which case Opus was already throwing away most of the higher frequency content, which means that reducing the sample rate was just removing the data Opus was removing anyway.
2024-01-06 09:43:41
I can't say the information "quantity" is equal
Traneptora
2024-01-06 09:44:06
it does appear from the spectogram that the highest amplitudes are all in the lowest frequencies
lonjil
2024-01-06 09:44:09
it's psychoacoustically weighted
Traneptora
2024-01-06 09:44:14
lower than, say 6 kHz
lonjil
2024-01-06 09:44:26
information that makes a bigger different to what you notice is given more importance
Oleksii Matiash
Traneptora it does appear from the spectogram that the highest amplitudes are all in the lowest frequencies
2024-01-06 09:45:26
Sorry, didn't get you
spider-mario
2024-01-06 09:45:35
11β€―kHz to 20β€―kHz is barely an octave
Oleksii Matiash
2024-01-06 09:45:45
They sound completely different
Traneptora
spider-mario 11β€―kHz to 20β€―kHz is barely an octave
2024-01-06 09:46:00
well tbf 11 kHz audio is capped at 5.5 kHz for audible frequencies
spider-mario
2024-01-06 09:46:25
ah, right, 11β€―kHz was the sample rate, sorry
Traneptora
Oleksii Matiash They sound completely different
2024-01-06 09:46:28
sure but you don't need that much information to actually sound all that different
2024-01-06 09:47:04
if you hard lowpass any piece of music at 5.5 kHz you'll hear something wildly different, even if *most* of the auditory information is in that band
lonjil
2024-01-06 09:47:31
Yeah, Opus only spends a small number of bits on high frequency content
Oleksii Matiash
lonjil Yeah, Opus only spends a small number of bits on high frequency content
2024-01-06 09:48:54
(originally) 11 kHz file is actually a bit bigger than 44 πŸ€·β€β™‚οΈ
lonjil
2024-01-06 09:49:21
yes, it certainly isn't perfect
Oleksii Matiash
2024-01-06 09:50:43
This is (one of two) the thing I'm talking about
2024-01-06 09:52:00
Ok, guys, it's time to sleep here
lonjil
2024-01-06 09:52:04
good night!
2024-01-06 09:52:20
huh I just noticed that most Opus devs now work at AWS
2024-01-06 09:54:01
https://www.amazon.science/blog/neural-encoding-enables-more-efficient-recovery-of-lost-audio-packets
Pieter
lonjil https://www.amazon.science/blog/neural-encoding-enables-more-efficient-recovery-of-lost-audio-packets
2024-01-07 03:30:32
There were a number of Opus people who became the video codec team at Mozilla, who then worked on Daala, which turned into AV1. Then Mozilla laid off the whole team, and some got hired by Amazon.
fab
Oleksii Matiash I can't say the information "quantity" is equal
2024-01-07 09:58:40
Do not be fooled by those thungs
Oleksii Matiash
2024-01-07 10:15:44
Well, to sum up my complains to opus. Encoded two different music style and complexity files, one classic (1st part of Moonlight sonata) and one speed metal, both with --bitrate 256. Attaching spectres to get idea about files complexity. Here is what opus produced (TAK - lossless encoder to estimate complexity). As you can see, opus ignores very low complexity of classic file, and produces file with higher bitrate than lossless encoder. So no, for me, --bitrate is not a quality setting, it is a target bitrate. And here I'm stopping this hard offtop.
fab
Oleksii Matiash Well, to sum up my complains to opus. Encoded two different music style and complexity files, one classic (1st part of Moonlight sonata) and one speed metal, both with --bitrate 256. Attaching spectres to get idea about files complexity. Here is what opus produced (TAK - lossless encoder to estimate complexity). As you can see, opus ignores very low complexity of classic file, and produces file with higher bitrate than lossless encoder. So no, for me, --bitrate is not a quality setting, it is a target bitrate. And here I'm stopping this hard offtop.
2024-01-07 10:19:26
No continue
2024-01-07 10:20:28
133465 40ms ffmpeg libopus newer if you want probably would sound also good or 172135 40ms ffopus of this night
Oleksii Matiash Very useful feature, btw
2024-01-07 10:21:51
Don't expect me to know more about audio and abiura. I can do one song at time.
2024-01-07 10:22:14
I have two file of texts showing file audios in bitrate.
2024-01-07 10:23:17
Oleksii Matiash
2024-01-07 10:32:04
Updated bitrates screenshot with vorbis -q 8.0 files
fab
2024-01-07 10:35:25
In my opinion the bitrate on yt seems lower why
2024-01-07 10:35:50
I did a playlist before this and I found lower quality than this
2024-01-07 10:36:32
The resampling maybe they changing internally something at 5.00am
2024-01-07 10:37:11
I have Philips uh220 since one year and it seems the playlist before this gotta an bad ugly sound
2024-01-07 10:43:01
Why hevc 60fps is so fast to decode I didn't realized it was so fast to decode
2024-01-07 10:44:56
<@1102876331986927627> new font dly High quality font for your MIUI
2024-01-07 11:01:28
I did another version of that
2024-01-07 11:01:49
The First is already downloading i'm sorry i will download even this
2024-01-07 11:05:47
I didn't increased anything still 1358 tracks i only downloaded 12 of the ones i got ingested
2024-01-07 11:05:55
But on this I need to it All
2024-01-07 11:11:47
https://github.com/fraunhoferhhi/vvdec/issues/158#issuecomment-1875915496
2024-01-07 11:41:36
Less autistic music version of that
2024-01-07 12:12:05
https://open.spotify.com/playlist/7b93FT0p9XBgMOC6Y1N8Tw?si=MxzFEpmpTDy1zY55F6bhCQ&pi=e-0Fpya7wMQcyU
2024-01-07 12:27:01
Anyway is fake as hell English will never listen to Summer music as where they live is -27c curve polare artico
2024-01-07 12:27:04
https://music.youtube.com/playlist?list=PLnXJEiJ6Zb-z0lMg6fxsARz0zZmmvs7Io&si=a8gtBYxd_bUsI_YT
2024-01-07 12:27:45
Even simplified to the max it doesn't appeal English because they have different climate.
2024-01-07 12:46:17
And why my autism is so predictable by Fb?
2024-01-07 12:46:40
Is there are pdf paper you can me link
2024-01-07 12:46:44
Not avm codec
2024-01-07 12:47:12
What prompts should I ask to chatgpt 3.5?
2024-01-07 01:29:50
Rare example where parametric v2 is more efficient at higher bitrate than 64 kbps
2024-01-07 01:29:50
64 kbps isn't the limit of specification this 64,21 kbps is the HEVC one
2024-01-07 01:29:50
The HEVC one I sacrified video to get better audio
2024-01-07 01:29:51
I downloaded with telegram the HEVC one
2024-01-07 01:33:09
I'm complicating more ytm algorithm to get close to this
2024-01-07 01:33:10
https://music.youtube.com/playlist?list=PLSC65hLOsV-rQKd-VrIcaB44TjnPSxaR7&si=Wdzc1wZhV_wpBCY8
2024-01-07 01:33:17
Is a 4 minute work
2024-01-07 01:33:38
I know how to do to even more in one minute plus 2 seconds
2024-01-07 01:33:57
YouTube tell me the error 433
2024-01-07 01:34:05
It's a new unknown error
2024-01-07 01:34:24
Apparently rolled out now only I I unlocked this
2024-01-07 01:41:32
https://music.youtube.com/playlist?list=PLnXJEiJ6Zb-zadV28_3VlfY9SOPF-WtB5&si=Q6yyZl3jt2_2ASK9
2024-01-07 01:41:42
<@321486891079696385>
2024-01-07 01:41:57
I finished entire YouTube music algorithm
2024-01-07 02:10:10
2024-01-07 02:10:17
Autism audio reliever
2024-01-07 04:24:34
2024-01-07 04:24:53
Which is the best encoded?
2024-01-07 04:25:30
Assign a score from 1 to 10 to the average of my encodes
2024-01-07 04:25:44
<@1102876331986927627>
2024-01-07 04:25:52
I would like your opinion on this
diskorduser
2024-01-07 04:28:54
Calm down fab
fab
2024-01-07 04:29:56
2024-01-07 04:30:13
Also evaluate this image
diskorduser Calm down fab
2024-01-07 04:30:26
Can you do those two tasks
2024-01-07 04:30:45
I'm new to HEVC only 6 month experience
diskorduser
2024-01-07 04:30:47
I don't know
fab
diskorduser I don't know
2024-01-07 04:31:00
Don't tell lies
diskorduser
2024-01-07 04:31:11
I am new to hevc. Only 0.3 month of experience
damian101
2024-01-07 05:40:33
I'm getting this error when trying to build libjxl-metrics-git from AUR for many weeks now: ``` [ 4%] Building CXX object lib/CMakeFiles/jpegli-static.dir/jpegli/bit_writer.cc.o a2x: ERROR: "xmllint" --nonet --noout --valid "/home/damian101/.cache/yay/libjxl-metrics-git/src/build/cjxl.xml" returned non-zero exit status 4 a2x: ERROR: "xmllint" --nonet --noout --valid "/home/damian101/.cache/yay/libjxl-metrics-git/src/build/djxl.xml" returned non-zero exit status 4 make[2]: *** [CMakeFiles/manpages.dir/build.make:74: cjxl.1] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: *** [CMakeFiles/manpages.dir/build.make:78: djxl.1] Error 1 make[1]: *** [CMakeFiles/Makefile2:393: CMakeFiles/manpages.dir/all] Error 2 ```
DZgas Π–
2024-01-10 09:15:03
πŸ’€ https://xol.io/blah/introducing-vcc/ https://www.opennet.ru/opennews/art.shtml?num=60413
jonnyawsom3
2024-01-10 05:56:23
Since a lot of people here already have scripts or methods to test and compare different encoders/tools, I thought I'd ask if someone could compare [Oxipng](https://github.com/shssoichiro/oxipng) to [ECT](https://github.com/fhanau/Efficient-Compression-Tool) Ideally with all speed settings (`-o 0` to `-o max`, with/without `--fast` for Oxipng. `-1` to `-9` with and without `--allfilters` for ECT) Results comparing time, size and memory usage I've done some brief testing myself but don't have an easy way to log memory usage, and being on a 7 year old CPU the higher levels can take considerable time too. Thanks in advance if someone takes it up
yoochan
2024-01-10 07:56:51
I was doing something similar ! to reproduce a part of https://docs.google.com/spreadsheets/d/1ju4q1WkaXT7WoxZINmQpf4ElgMD2VMlqeDN2DuZ6yJ8/edit#gid=174429822
2024-01-10 07:57:25
and I saw they used pingo and ect for png, but didn't timed it πŸ˜„
jonnyawsom3
2024-01-10 08:02:20
I found this and so far ECT is half the memory usage of Oxipng while being around 3 seconds slower on default, although I'm only testing one or two images at one or two settings https://github.com/cbielow/wintime
2024-01-10 08:03:23
Default ECT vs `-9` ``` PageFaultCount: 9383991 PeakWorkingSetSize: 330.5 MiB QuotaPeakPagedPoolUsage: 25.2 KiB QuotaPeakNonPagedPoolUsage: 5.438 KiB PeakPagefileUsage: 328.5 MiB Creation time 2024/01/10 19:43:24.298 Exit time 2024/01/10 19:44:00.669 Wall time: 0 days, 00:00:36.371 (36.37 seconds) User time: 0 days, 00:00:07.390 (7.39 seconds) Kernel time: 0 days, 00:00:28.937 (28.94 seconds) ``` Just a tad slower ``` PageFaultCount: 25908451 PeakWorkingSetSize: 330.2 MiB QuotaPeakPagedPoolUsage: 25.2 KiB QuotaPeakNonPagedPoolUsage: 5.438 KiB PeakPagefileUsage: 349.2 MiB Creation time 2024/01/10 19:47:14.237 Exit time 2024/01/10 19:54:51.023 Wall time: 0 days, 00:07:36.785 (456.79 seconds) User time: 0 days, 00:00:21.093 (21.09 seconds) Kernel time: 0 days, 00:07:15.671 (435.67 seconds) ```
2024-01-10 08:03:46
For 3.4% further improvement
yoochan
2024-01-10 08:07:43
objective number one is to bench jpegxl but I wanted to find a worthy opponent for png. I don't know if I will have time to review all png optimizer... ect seems to be a good horse
jonnyawsom3
2024-01-10 08:18:00
Yeah, this is a 8,000 x 4,000 image I'm testing on, so I'd try JXL but don't want to slam my RAM with another 6GB encode
yoochan
2024-01-10 08:26:56
πŸ˜„
2024-01-10 08:40:12
6 Gb is just a chrome session, almost nothing πŸ™‚
jonnyawsom3
2024-01-10 08:41:12
Chrome's already using 3 and I've only got 16 total xD
2024-01-10 10:29:32
Well, after some testing it seems `-5` on ECT is the best, still half Oxipng memory with a further 10% savings compared to default although at double the time JXL is the best after that at `-e 7` reducing by a further 25% in only 7 seconds (ECT was using about 70)
diskorduser
2024-01-11 01:30:32
Windows 11 consumes 4gb-5.5gb when idle. πŸ™‚
jonnyawsom3
2024-01-11 01:33:33
Yeah, around that on my stagnating Windows 10
diskorduser
2024-01-11 01:52:55
Some modded win11 like tiny11 use only 1 to 1.5
w
2024-01-11 02:27:39
most of it scales based on total memory
2024-01-11 02:28:04
makes background services run faster
jonnyawsom3
2024-01-11 03:08:12
Well, Windows doesn't count cached memory towards used memory, but yeah, a lot of the time it's fixed percentages
yoochan
2024-01-11 10:23:10
(lol, extract from the png spec : PNG is pronounced "ping" http://www.libpng.org/pub/png/spec/1.2/png-1.2-pdg.html)
2024-01-11 10:23:43
<@238552565619359744> I didn't found a pingo version for linux, crap...
damian101
Well, after some testing it seems `-5` on ECT is the best, still half Oxipng memory with a further 10% savings compared to default although at double the time JXL is the best after that at `-e 7` reducing by a further 25% in only 7 seconds (ECT was using about 70)
2024-01-11 11:39:37
Btw, I always recommend using oxipng first before using ECT, as it does more things like remove unused alpha channel, bit depth reduction and stuff. Also, it lets you remove metadata WITHOUT removing essential color metadata.
Oleksii Matiash
2024-01-11 11:55:06
I use pinga for jpeg/png optimization. However, it does not support 16 bpc pngs, reducing it to 8 bpc. But other of that it works great and also have various options about removing not necessary data\metadata
jonnyawsom3
Btw, I always recommend using oxipng first before using ECT, as it does more things like remove unused alpha channel, bit depth reduction and stuff. Also, it lets you remove metadata WITHOUT removing essential color metadata.
2024-01-11 06:23:47
In my case I want to keep all metadata due to storing date, location and players in game screenshots that I take
damian101
2024-01-11 06:42:03
makes sense, but it's optional anyway
jonnyawsom3
2024-01-11 07:46:00
Just did a quick test and ECT also removes unused Alpha channels and reduces bit depth, although ECT lags slightly behind Oxipng at max in those cases too Around 0.01% difference, from 4 MB to 1.87 KB and ECT ended up 2.16 KB)
damian101
Just did a quick test and ECT also removes unused Alpha channels and reduces bit depth, although ECT lags slightly behind Oxipng at max in those cases too Around 0.01% difference, from 4 MB to 1.87 KB and ECT ended up 2.16 KB)
2024-01-11 08:12:52
It does not remove unused alpha channels in my experience
2024-01-11 08:20:00
with unused I mean a fully transparent alpha channel
jonnyawsom3
2024-01-11 08:21:36
I did a simple test with ffmpeg at compression level 0, got a 32 bit file out, ran that through ECT and got a 24 bit result
2024-01-11 08:33:51
It seems on my 1 bit image test Oxipng is actually far better than even genetic filtering on ECT. Using zopfli only took 9 seconds for 1791 bytes, ECT took 140 seconds for 1797 bytes. Also 28 MB of RAM instead of 32MB for ECT Miniscule differences, but interesting
Oleksii Matiash
It seems on my 1 bit image test Oxipng is actually far better than even genetic filtering on ECT. Using zopfli only took 9 seconds for 1791 bytes, ECT took 140 seconds for 1797 bytes. Also 28 MB of RAM instead of 32MB for ECT Miniscule differences, but interesting
2024-01-11 08:35:16
Could you please share it?
Quackdoc
with unused I mean a fully transparent alpha channel
2024-01-11 09:01:26
<:PepeHands:808829977608323112>
jonnyawsom3
Oleksii Matiash Could you please share it?
2024-01-11 09:02:18
400 seconds on max ECT vs 10 for zopfli on OxiPNG, and ECT still looses by 12 bytes on this
2024-01-11 09:02:31
(yes it's horrendously artificial)
Oleksii Matiash
2024-01-11 09:07:10
It saves as 396 kB webp, is it intended?
jonnyawsom3
2024-01-11 09:15:55
That's... Strange...
2024-01-11 09:16:08
Maybe you're getting WebP from Discord's CDN?
Oleksii Matiash
2024-01-11 09:17:05
Trimming ?... from link helped
jonnyawsom3
2024-01-11 09:18:38
For 64 bit images (Exported from Krita as 16 bit per channel) ECT is far more efficent, although neither palleted or lowered the bitdepth like for 8 bit``` wintime -- oxipng -p -r -o max --fast -Z SmileOxi.png Processing: SmileOxi.png 49559 bytes (99.83% smaller): SmileOxi.png PageFaultCount: 575218 PeakWorkingSetSize: 879.1 MiB QuotaPeakPagedPoolUsage: 32.89 KiB QuotaPeakNonPagedPoolUsage: 10.22 KiB PeakPagefileUsage: 995.6 MiB Wall time: 0 days, 00:05:04.566 (304.57 seconds) wintime -- ect -p -r -k -5 SmileECT.png Processed 1 file Saved 28.17MB out of 28.21MB (99.8314%) PageFaultCount: 1853274 PeakWorkingSetSize: 157.7 MiB QuotaPeakPagedPoolUsage: 25.2 KiB QuotaPeakNonPagedPoolUsage: 4.906 KiB PeakPagefileUsage: 175 MiB Wall time: 0 days, 00:00:11.623 (11.62 seconds) ```
2024-01-11 09:19:19
Didn't crank ECT up because of how long Oxipng took compared to the 8 bit file, so trying that now
Oleksii Matiash
2024-01-11 09:20:23
Yes, pinga failed on this image. 3346 without stripping anything, 2391 with
diskorduser
2024-01-13 03:59:00
https://www.phoronix.com/news/GNOME-46-Alpha-Released Jxl wallpaper is coming in this version
_wb_
2024-01-13 10:50:40
sure
2024-01-13 10:51:42
done
fab
2024-01-13 11:03:56
Did you Exported it?
diskorduser
2024-01-19 02:25:49
https://fxtwitter.com/nixcraft/status/1748315798714622174?t=syzYxePsuQ_Ier2lD3dB4w&s=19
jonnyawsom3
2024-01-19 02:29:44
I learnt that while reading the spec the other day, my friends were not amused
yoochan
diskorduser https://fxtwitter.com/nixcraft/status/1748315798714622174?t=syzYxePsuQ_Ier2lD3dB4w&s=19
2024-01-19 03:48:20
ninja'd here https://discord.com/channels/794206087879852103/794206087879852106/1194949619382226944 πŸ˜„
afed
2024-01-19 03:55:29
https://youtu.be/RYJf7kelYQQ?t=276
_wb_
2024-01-20 12:27:34
I know it is supposed to be "ping" but I always say Pee 'N Gee...
lonjil
2024-01-20 01:06:06
Everyone says that
2024-01-20 01:06:40
Just like how everyone says gif not jif, despite what its creator says.
w
2024-01-20 01:07:45
i say jif
damian101
2024-01-20 01:17:42
yes, it's "Dschee Eye Eff", not "Gee Eye Eff" afterall
_wb_
2024-01-20 01:19:15
It's "ping" because it stands for Pirtable Network Graphics
2024-01-20 01:20:50
And "jif" because it's the Giraffical Interchange Format πŸ¦’
w
2024-01-20 01:54:23
when i hear that argument i say jfag
yurume
_wb_ It's "ping" because it stands for Pirtable Network Graphics
2024-01-20 02:14:26
maybe it was Portable *Internet and* Network Graphics instead πŸ˜‰
Oleksii Matiash
2024-01-20 05:01:29
Here we say gif (and it's derivatives, that assume that it is something small and of female gender), and png is something like "Pee 'N Gee" Β© but with local specific πŸ˜…
spider-mario
2024-01-20 07:47:08
https://youtu.be/Nrk8sqZfsgI
yoochan
_wb_ It's "ping" because it stands for Pirtable Network Graphics
2024-01-20 02:59:26
could have been pong then πŸ˜„
Traneptora
_wb_ And "jif" because it's the Giraffical Interchange Format πŸ¦’
2024-01-20 04:12:10
I hate when people try to logic out why it's "actually supposed to be gif with a hard g"
2024-01-20 04:12:24
the same people likely don't say "jay-feg" for JPEG image
2024-01-20 04:13:12
considering that in English, a g followed by an `e` or an `i` is usually soft it makes sense, people just want to invent pronunciation logic where it doesn't exist
lonjil
2024-01-20 04:16:43
Gift
spider-mario
2024-01-20 04:16:44
it would be more consistent with git, gift and get, though
2024-01-20 04:17:27
though not with gib
2024-01-20 04:17:48
ah, sorry, for gib, it varies
Traneptora
2024-01-20 04:18:45
gist, ginger, giant, gin
2024-01-20 04:18:48
it's pretty variant
2024-01-20 04:19:00
if you dig into it there's really no consistency
w
2024-01-20 04:19:02
a problem with gift is that if you say gif like that it sounds too similar
Traneptora
2024-01-20 04:19:29
that's why i hate when people try to logic it out
2024-01-20 04:19:35
English pronunciation is pretty random
2024-01-20 04:20:02
monkey and donkey don't rhyme. why? /shrug
2024-01-20 04:20:24
it's also not even consistent within regions
2024-01-20 04:20:46
my dad was born two states east of me and he pronounces "hover" like it was "hahver"
2024-01-20 04:20:49
and no he's not from Boston
lonjil
2024-01-20 04:21:11
I read somewhere that when given an unknown word, English speakers guess the correct pronunciation 75% of the time.
Traneptora
2024-01-20 04:22:11
which is like 2 bits of entropy in every word
w
2024-01-20 04:22:29
something like americans getting it right vs brits because spanish sounds are what is in most other languages
Traneptora
2024-01-20 04:22:58
I'd believe that in the south but I have no exposure to spanish where I live
2024-01-20 04:24:22
having a 25% chance of not being able to pronounce a word you have only ever seen written is pretty high
lonjil
2024-01-20 04:24:52
here is an argument not based on trying to logic out the pronunciation: hard g is vastly more popular, purely due to that being how the average english speaker thinks it's supposed to be said when they first read it.
Traneptora having a 25% chance of not being able to pronounce a word you have only ever seen written is pretty high
2024-01-20 04:25:06
indeed. I believe the figure for Mandarin is about the same.
Traneptora
2024-01-20 04:25:21
and mandarin doesn't have letters
2024-01-20 04:25:31
well Hanzi has radicals but it's not the same thing as letters
lonjil here is an argument not based on trying to logic out the pronunciation: hard g is vastly more popular, purely due to that being how the average english speaker thinks it's supposed to be said when they first read it.
2024-01-20 04:25:55
it's true that "gif" is much more likely to be said by those who haven't heard it before
2024-01-20 04:26:13
I say "jif" mostly because when I grew up the format already existed and my dad called them "jiffs"
2024-01-20 04:26:23
since he knew about them
lonjil
2024-01-20 04:26:48
||i refuse to call anything yiff /joke||
Traneptora
2024-01-20 04:27:07
if you want to cite some authoritative source, the OED cites both as pronunciations for that word
2024-01-20 04:27:12
it just straight up lists both
_wb_ I know it is supposed to be "ping" but I always say Pee 'N Gee...
2024-01-20 04:27:47
should we start calling JXL "Jixel" or should we stick with "Jay Ex Ell"
lonjil
Traneptora and mandarin doesn't have letters
2024-01-20 04:28:53
at least in Chinese, the characters are often picto-phonetic, with one component indicating pronunciation.
Traneptora
2024-01-20 04:29:10
yea that's what a radical is, isn't it?
2024-01-20 04:29:27
Hanzi and Hangul scripts are constructed from radicals
w
2024-01-20 04:29:54
i've always had the idea you can figure out the sound by the radical. I never figured it out but some of my friends did
2024-01-20 04:30:11
this was from learning when i was 6-12
Traneptora
2024-01-20 04:30:32
https://en.wikipedia.org/wiki/Radical_(Chinese_characters)
2024-01-20 04:30:35
this is what I'm referring to
lonjil
Traneptora yea that's what a radical is, isn't it?
2024-01-20 04:32:09
yeah. the components of a han character can be phonetic, semantic, or neither. about 80% of characters have a phonetic component.
Traneptora
2024-01-20 04:32:55
but then you have the Japanese students who see the Kanji but since they don't sepeak Mandarin they just have nothing to go on
2024-01-20 04:32:57
it's all memorization
2024-01-20 04:33:30
since iirc there's minimal correlation between the pronunciation of a Kanji in Japanese and the correpsonding Manadrin pronunciation of the corresponding Hanzi character
lonjil
2024-01-20 04:33:47
tfw you have fewer characters (like 2000 common ones instead of 5000) but every single one has between 2 and 5 arbitrary pronunciations you have to learn.
Traneptora
2024-01-20 04:34:34
they have to teach people how to read through middle school
2024-01-20 04:34:51
and I don't mean like, in the US where english class is about literature
2024-01-20 04:34:56
it's just straight up reading
2024-01-20 04:35:03
kind of an inconvenient language ngl
w
2024-01-20 04:36:41
japanese pronunciation is similar to at least the cantonese
2024-01-20 04:36:43
it's still chinese
2024-01-20 04:37:03
go (wu region/south china) and kan(han dynasty) readings are from chinese
lonjil
2024-01-20 04:38:42
I think it's like, one pronunciation based on the Japanese word corresponding to whatever the han character means, and then additional ones based on however it was pronounced in different places in China like various numbers of hundreds of years ago.
w
2024-01-20 04:43:01
anyway it's jif
lonjil
2024-01-20 04:47:53
maybe I should learn some variety of Chinese instead of Japanese
w
2024-01-20 04:48:09
just learn mandarin
2024-01-20 04:48:10
more useful
lonjil
2024-01-20 04:48:30
that's a variety of chinese :p
Oleksii Matiash
w anyway it's jif
2024-01-20 04:48:35
No way, it is gif
lonjil
2024-01-20 04:48:49
brb learning Taiwanese Mandarin
Oleksii Matiash
2024-01-20 04:49:49
Bit too late, we have probably the easiest case - what you see is what you pronounce, no exceptions afair. Unfortunately it is the only easy part of language πŸ˜…
w
2024-01-20 04:53:18
going to pronounce every name wrong because what i see is what i pronounce
2024-01-20 04:53:20
including yours
Oleksii Matiash
2024-01-20 04:56:02
As you wish
_wb_
Traneptora should we start calling JXL "Jixel" or should we stick with "Jay Ex Ell"
2024-01-20 05:03:00
My view: people can call it whatever they want. I like something that rhymes with pixel (jixel or yixel), but I am not even doing that myself and instead use the "just spell it" approach (so Jay Ex Ell in English), so who am I to say what's the correct way.
spider-mario
Traneptora which is like 2 bits of entropy in every word
2024-01-20 05:09:30
0.8 bits, no?
lonjil
2024-01-20 05:09:47
a jixel must surely be an element of some kind, just like a pixel (picture element) or a texel (texture element)
_wb_
Traneptora the same people likely don't say "jay-feg" for JPEG image
2024-01-20 05:12:05
"Joy Feg", it's Joint, not Jaint πŸ™‚ Yeah that's a good point, nobody does that. I guess an acronym does become a word on its own in a way, and typically you just spell it but if there is a pronounceable part in it that looks like a syllable, you just pronounce that part like a word.
Traneptora
spider-mario 0.8 bits, no?
2024-01-20 05:13:18
1/log(0.25)
_wb_
lonjil a jixel must surely be an element of some kind, just like a pixel (picture element) or a texel (texture element)
2024-01-20 05:13:50
A jixel is a giraffe element πŸ¦’
spider-mario
Traneptora 1/log(0.25)
2024-01-20 05:14:36
where is that formula from? shouldn’t it be: -(0.75Β·logβ‚‚(0.75) + 0.25Β·logβ‚‚(0.25))
2024-01-20 05:14:47
yours goes to infinity as the probability of getting it right goes to 100%
_wb_
Traneptora 1/log(0.25)
2024-01-20 05:15:09
If you can guess correctly 75% of the time, that's less than one bit of info you have to guess
spider-mario
2024-01-20 05:15:20
and 50% should have maximum entropy, and it’s 1 bit
Traneptora
spider-mario where is that formula from? shouldn’t it be: -(0.75Β·logβ‚‚(0.75) + 0.25Β·logβ‚‚(0.25))
2024-01-20 05:27:44
I miswrote it, I meant `log(1/0.25)` but yea I suppose what you wrote is more correct
spider-mario and 50% should have maximum entropy, and it’s 1 bit
2024-01-20 05:28:10
not necessarily, because "50% probability of guessing correctly" for a *fair coin* is 1 bit of entropy
2024-01-20 05:28:42
but that's not what's happening here, since a 50% probability of guessing correctly for how an english word is pronounced is a different thing
2024-01-20 05:29:12
consider a case where you only have a 10% chance of guessing it correctly
2024-01-20 05:29:18
vs 90%
2024-01-20 05:29:26
these aren't actually the same scenario, like they would be for a coin
2024-01-20 05:30:11
since 10% chance of guessing correctly would mean the letters have minimal information in them that tells a trained speaker how to pronounce the word a 90% chance of guessing correctly would mean that the letters have a lot of information in them - almost all the information needed to actually pronounce the word
spider-mario
2024-01-20 05:31:00
right, my formula is something like the entropy of guessing whether someone will guess correctly, rather than the entropy of guessing correctly
2024-01-20 05:31:23
but AFAICT, that’s all we can compute from just β€œpeople get it right 75% of the time”
Traneptora
2024-01-20 05:31:35
in the case of guessing correctly for a coin, there's only one way of beign incorrect but that's not the case with english words there's a whole massive space of theoretically possibly pronunciations
2024-01-20 05:31:48
and being correct is choosing which of the many of them, not choosing which of the 2 of them
2024-01-20 05:32:02
so in that regard a word has significantly more than 2 bits of entropy
2024-01-20 05:32:17
since 75% of the time you get it right
lonjil
2024-01-20 05:32:42
we'd need to figure out which words are those which are guessed correctly, and then how much information is contained within a correction of pronunciation of the remaining 25%.
2024-01-20 05:32:53
who wants to fund a massive study
Traneptora
2024-01-20 05:32:56
:D
monad
yoochan <@238552565619359744> I didn't found a pingo version for linux, crap...
2024-01-21 08:36:54
<https://archive.org/details/pingo-linux> if you want it (the Windows build does run with a translation layer like Wine, but you'll have to handle errors on filenames with certain characters)
yurume
2024-01-22 06:44:59
on the Remez algorithm: I meant https://en.wikipedia.org/wiki/Remez_algorithm
2024-01-22 06:46:00
this is particularly useful for floating-point approximations where each operation is not so much ideal mathematical one
Traneptora
yurume on the Remez algorithm: I meant https://en.wikipedia.org/wiki/Remez_algorithm
2024-01-22 06:50:24
oh this, that's how I generated the srgb approximation polynomial in the first place
yurume
2024-01-22 06:50:40
oh then that's good
2024-01-22 06:50:58
I thought you just generated a Chebyshev polynomial
Traneptora
2024-01-22 06:51:10
not an arbitrary one no
yurume
2024-01-22 06:53:35
it is rare to see a Remez implementation that can handle fp inaccuracy as well though, except for sollya AFAIK
veluca
2024-01-22 09:03:57
use rational polynomials! they are the best πŸ˜›
2024-01-22 09:04:51
and feel free to copy algorithms from https://github.com/libjxl/libjxl/blob/main/lib/jxl/base/fast_math-inl.h
Tirr
2024-01-22 09:05:26
jxl-oxide copied a lot from there
veluca
2024-01-22 09:06:26
or from lib/jxl/cms/transfer_functions-inl.h for that matter
2024-01-22 09:06:56
yeah make sense
2024-01-22 09:07:04
coming up with those approximations is loads of fun πŸ˜„
yurume
2024-01-22 09:11:17
does that work better than a higher-degree poly approximation though?
Tirr
2024-01-22 09:15:28
I think it will be faster than higher-degree poly because of data dependence, not sure
veluca
2024-01-22 09:16:11
it also works much better for most functions
2024-01-22 09:16:22
in terms of accuracy
jonnyawsom3
2024-01-22 09:17:24
Probably irrelevant for modern computers, but I keep remembering this every time I read "polynomial" https://youtu.be/hffgNRfL1XY
veluca
2024-01-22 09:22:46
this stuff is definitely still relevant for whoever deals with image processing
yurume
Tirr I think it will be faster than higher-degree poly because of data dependence, not sure
2024-01-22 09:42:37
of course assuming that we don't use a naive horner rule
2024-01-22 09:43:08
I think a pairwise horner rule is frequent enough?
spider-mario
2024-01-22 09:56:02
https://github.com/ar-lex/cue2tracks/blob/master/cue2tracks
2024-01-22 09:56:07
really, in bash?
Traneptora
veluca and feel free to copy algorithms from https://github.com/libjxl/libjxl/blob/main/lib/jxl/base/fast_math-inl.h
2024-01-22 08:13:28
is HWY_REP4(x) effectively the same thing as `x, x, x, x`
veluca
2024-01-22 08:13:41
Yep
Traneptora
2024-01-22 08:39:08
out of curiosity, is floating point multiplication and addition commutative?
2024-01-22 08:39:17
I know it's not associative
2024-01-22 08:40:27
I'm wondering if a compiler can take `b + x * a` and generate a single multiply-add instruction
lonjil
2024-01-22 08:44:25
FMA gives a different answer than doing the operations separately, but IEEE-754 allows, in some cases, value changing optimizations as long as the value is closer to the true mathematical result than what you'd normally get, as long as there's a way for the programmer to control this behavior.
Traneptora
2024-01-22 08:45:26
I'm avoiding intrinsics since I want the code to be maximally portable but I'd also like the compiler to generate the relevant optimizations when targeting an instruction set that supports them, e.g. x86_64
lonjil
2024-01-22 08:45:36
In C, this is controlled via `#pragma STDC FP_CONTRACT`
Traneptora
2024-01-22 08:45:44
what's that do?
lonjil
2024-01-22 08:46:39
if you give it the argument ON, it allows contracting operations into more precise operations, like contracting `b + x * a` into an FMA. If you give the argument OFF, this is not allowed.
2024-01-22 08:46:48
The default behavior is implementation-defined.
Traneptora
2024-01-22 08:47:23
is `#pragma STDC FP_CONTRACT ON` permitted by ISOC99?
lonjil
2024-01-22 08:47:32
lemme check
2024-01-22 08:48:04
looks like that's when it was added
2024-01-22 08:48:15
note that most compilers default to it being on by default
Traneptora
2024-01-22 08:48:21
according to cppreference.com:
2024-01-22 08:48:30
> ISO C language standard requires that C compilers support the following three pragmas, and some C++ compiler vendors support them, to varying degrees, in their C++ frontends: > ... > #pragma STDC FP_CONTRACT arg (2)
lonjil
2024-01-22 08:48:53
here is the C version of that page without the C++ talk: https://en.cppreference.com/w/c/preprocessor/impl
Traneptora
2024-01-22 08:49:02
oh ty
lonjil
2024-01-22 08:49:12
It says `(since C99)`
Traneptora
2024-01-22 08:49:17
it does
2024-01-22 08:49:20
I'm defaulting to C99
2024-01-22 08:50:18
....
2024-01-22 08:50:23
> warning: ignoring β€˜#pragma STDC FP_CONTRACT’ [-Wunknown-pragmas] thanks gcc
2024-01-22 08:50:26
real helpful
lonjil
2024-01-22 08:50:37
rip
2024-01-22 08:52:58
alternatively you could use this function? https://en.cppreference.com/w/c/numeric/math/fma
Traneptora
2024-01-22 08:53:18
incurs a dependency on libm.so
2024-01-22 08:53:25
which I currently do not have
2024-01-22 08:54:43
it does look like GCC has switch `-ffp-contract=fast`
2024-01-22 08:54:58
which enables the generation of FMA instructions even when it doesn't produce the identical result
2024-01-22 08:55:01
and it's enabled by default
lonjil
lonjil note that most compilers default to it being on by default
2024-01-22 08:57:22
Yep
Traneptora
2024-01-22 09:01:04
what are some good Werrors, btw?
2024-01-22 09:01:16
I have `-Werror=implicit-function-declaration` on as one example
2024-01-22 09:01:23
and `-Werror=format-security`
lonjil
2024-01-22 09:02:16
I tend to werror everything and then disable warnings I think are bad.
Traneptora
2024-01-22 09:04:54
can't do that reasoanbly cause compilers differ
2024-01-22 09:05:09
your compiler might not warn about something that someone else's does
2024-01-22 09:05:21
and then suddenly your thing doesn't build with another compiler, or another version of the same compiler
lonjil
2024-01-22 09:05:54
warnings should simply be entirely disabled outside of development πŸ˜„
2024-01-22 09:06:39
hm, gcc 13.2 on godbolt doesn't emit an FMA unless I add `-mfma`. Gotta check which gen added fma and which gen gcc defaults to.
Traneptora
2024-01-22 09:06:45
I wonder if `-ffast-math` breaks fast-inverse-square-root and other bithack algorithms
lonjil hm, gcc 13.2 on godbolt doesn't emit an FMA unless I add `-mfma`. Gotta check which gen added fma and which gen gcc defaults to.
2024-01-22 09:07:05
gcc defaults to `-march=x86_64 -mtune=generic` iirc
2024-01-22 09:07:07
unless you tell it otherwise
lonjil
2024-01-22 09:08:25
oh, FMA is Haswell and newer, or Piledriver and newer
2024-01-22 09:17:00
so, FMA is x86-64-v3 I guess πŸ€”
Traneptora
2024-01-22 09:17:30
oh wow, `-march=native` makes a massive difference
2024-01-22 09:17:37
cuts the time down by almost 50%
veluca
Traneptora I'm wondering if a compiler can take `b + x * a` and generate a single multiply-add instruction
2024-01-22 09:20:25
that depends on the compiler settings (`-fp-contract` I believe is the flag)
Traneptora
2024-01-22 09:20:27
I tried disabling `-march=native` and encode times increased over 90%
2024-01-22 09:20:40
turns out fma is pretty great
veluca that depends on the compiler settings (`-fp-contract` I believe is the flag)
2024-01-22 09:20:47
yup, see discussion
veluca
Traneptora it does look like GCC has switch `-ffp-contract=fast`
2024-01-22 09:21:00
yep that
2024-01-22 09:21:12
just got to it now πŸ˜„
2024-01-22 09:21:26
yup yup, fma is pretty useful for these things
2024-01-22 09:21:35
it pretty much halves the cost of DCTs and the like
2024-01-22 09:21:58
too bad it's super arch dependant what you actually get 😒
Traneptora
2024-01-22 09:22:16
I wonder if gcc is smart enough to replace `a += b * c` with `a = b * c + a` and then add an fma instruction
veluca
2024-01-22 09:23:26
ah, on your prev question: afaiu mul and add of floats *is* commutative
Traneptora
2024-01-22 11:50:46
good, so that means teh compiler can turn a + b * c into an fma(b, c, a)
lonjil
2024-01-23 12:14:25
I don't see what that has to do with commutativity.
2024-01-23 12:15:29
(other than in an imo very trivial sense, that is by no means sufficient)
2024-01-23 12:22:12
ah, yep, IEEE-754-2008 defines `fusedMultiplyAdd(x,y,z)` as `(x Γ— y) + z`, so you need commutativity of addition for the specific example you gave.
Traneptora
lonjil I don't see what that has to do with commutativity.
2024-01-23 12:58:54
if `fma(a, b, c)` is defined to be `a * b + c`, and addition is not commutative, then you can't replace `c + a * b` with `a * b + c` before contracting into an fma
2024-01-23 12:59:02
but since it is, that works fine
2024-01-23 01:00:11
I do think fp addition and multiplication are commutative, just not associative
lonjil
2024-01-23 01:02:12
I know, but it seems trivial to me since you could just write your code differently. (Since, presumably, if it wasn't commutative, the difference would be more than small enough for your use case, even if it prevented automatic reordering by the compiler.)
Traneptora
2024-01-23 01:02:33
You could, but then I'd have to rewrite the code
2024-01-23 01:02:35
<:Madge:859968580996956200>
2024-01-23 01:02:43
im lazy
2024-01-23 01:02:59
yes if it weren't i could just literally put the addition on the other side
2024-01-23 01:03:05
but <:Madge:859968580996956200>
lonjil
2024-01-23 01:03:18
πŸ˜„
Traneptora
2024-01-23 01:13:43
<@167023260574154752> did you hear about Java's fma btw added in Java 9
2024-01-23 01:13:55
I discovered this when I was working on jxlatte
lonjil
2024-01-23 01:14:13
I have not
Traneptora
2024-01-23 01:14:20
so they created an annotation called `@IntrinsicTarget` which is wrapped around some standard library functions
2024-01-23 01:14:28
it's not something you can define yourself
2024-01-23 01:14:55
but it's a flag for the jvm that calls to this function can possibly be replaced with an intrinsic by the jit compiler
2024-01-23 01:15:10
so I was like "oh cool, I'll just replace all my fmas with calls to `Math.fma`" and everything will be faster
2024-01-23 01:15:31
and then it *was* until
2024-01-23 01:15:44
until someone reported that on their system with the last commit it slowed to a crawl
2024-01-23 01:15:48
and I was like "hm, I wonder why?"
2024-01-23 01:16:04
turns out **if** your system has fma instructions, them `Math.fma` is replaced by those instructions in the jit compiler
2024-01-23 01:16:17
on the jvm
2024-01-23 01:16:34
if it *doesn't* then it wraps each `float` argument to a `java.lang.math.BigDecimal`
2024-01-23 01:16:44
performs a BigDecimal multiplication followed by a BigDecimal addition
2024-01-23 01:16:53
and then calls `floatValue()`
lonjil
2024-01-23 01:16:59
Lol
Traneptora
2024-01-23 01:17:10
no, it doesn't just do `a * b + c`
190n
Traneptora if it *doesn't* then it wraps each `float` argument to a `java.lang.math.BigDecimal`
2024-01-23 01:17:15
πŸ’€
lonjil
2024-01-23 01:17:21
Actually the C fma function might have the same issue
Traneptora
2024-01-23 01:18:17
and there's no way to determine at runtime whether or not this will happen
2024-01-23 01:18:20
that's the best part
2024-01-23 01:18:30
to the java class files, they're just calling `Math.fma`
2024-01-23 01:18:32
which does a thing
lonjil
2024-01-23 01:18:36
I think the spec says that it has to give the result that you'd expect given only one round of rounding, unlike the double rounding you get from a*b+c
Traneptora
2024-01-23 01:18:47
you can't determine at runtime if the call to `Math.fma` *would* be replaced by an fma instruction
2024-01-23 01:19:00
and if not, instead just do `a * b + c` which is much faster than the pure java implementation
lonjil
2024-01-23 01:19:39
Might even be a ieee 754 violation to have a function called fma that doesn't work like this
Traneptora
2024-01-23 01:19:49
yea, but it makes the function entirely useless
2024-01-23 01:20:19
because it becomes unusably slow without the instructions
2024-01-23 01:21:14
like, if you don't care about the precision loss for whatever reason there's *no way to tell the jvm* to replace `fma` with `a * b + c`
2024-01-23 01:21:16
it just won't
2024-01-23 01:21:28
it calls BigDecimal
lonjil
2024-01-23 01:22:14
I'll send a letter to the ieee people asking for the next revision of 754 to include a fmaButIdcAboutPrecision function
Traneptora like, if you don't care about the precision loss for whatever reason there's *no way to tell the jvm* to replace `fma` with `a * b + c`
2024-01-23 01:23:20
At startup run a benchmark and then use byte code patching to select the faster version
2024-01-23 01:23:41
(I have bad ideas when I need to sleep, good night)
Traneptora
2024-01-23 01:24:04
oh god
2024-01-23 01:24:06
fuck no
2024-01-23 01:24:17
> This method corresponds to the fusedMultiplyAdd operation defined in IEEE 754-2008.
2024-01-23 01:24:19
yea, but still
2024-01-23 01:24:21
it's kinda useless
lonjil
2024-01-23 01:27:43
They could at least use a more efficient way of doing it than BigDecimal
2024-01-23 01:28:20
Like using doubles if the inputs are single precision
2024-01-23 01:28:36
Or pair of doubles when the inputs are doubles
2024-01-23 01:29:36
(which is what libc implementations presumably do when there's no fma support in hw)
2024-01-23 01:30:57
Actually, what probably happened is scientists writing slower but more accurate number crunching routines using such techniques, and then asking Intel and IEEE to speed it up for them.
yurume
lonjil At startup run a benchmark and then use byte code patching to select the faster version
2024-01-23 04:38:16
hey, that's more or less how ifuncs do work
2024-01-23 04:38:26
https://sourceware.org/glibc/wiki/GNU_IFUNC
2024-01-23 04:43:15
by the way unfortunately there seems no easy way for opportunistic fma
2024-01-23 04:43:31
in fact, FP_CONTRACT is possibly the only easy way
2024-01-23 04:43:50
otherwise you have to manually probe the cpuid and equivalent
2024-01-23 04:44:53
(for example, GCC `__builtin_fma` would turn into a libm call unless FMA is natively supported. but `__has_builtin(__builtin_fma)` always return true in either case. I know this is technically correct, but I want to know whether it's useful...)
lonjil
lonjil alternatively you could use this function? https://en.cppreference.com/w/c/numeric/math/fma
2024-01-23 12:24:29
found glibc's implementation: ```c double __fma (double x, double y, double z) { return (x * y) + z; } ``` πŸ€¦β€β™€οΈ
veluca
2024-01-23 12:30:58
it *could* be special-cased in the compiler
2024-01-23 12:31:25
clang does that for i.e. memcpy, IIRC
spider-mario
2024-01-23 12:37:00
so does gcc
2024-01-23 12:37:10
if you actually want glibc’s memcpy, you have to really want it
lonjil
2024-01-23 12:52:22
fma as an instruction probably is, but what about the software fallback? `Computes (x*y) + z as if to infinite precision and rounded only once to fit the result type.`, but that expression rounds twice, so it isn't compliant.
veluca
2024-01-23 01:05:11
I would not be surprised if the compiler special cases how `__fma` is compiled
Traneptora
spider-mario if you actually want glibc’s memcpy, you have to really want it
2024-01-23 03:11:39
this created some funsies with ffmpeg's allocation it always mallocs with posix_memalign instead of with malloc
2024-01-23 03:11:59
since a lot of simd doesn't work on unaligned memory
2024-01-23 03:12:32
turns out there was a regression in glibc that made posix_memalign slow
2024-01-23 03:13:22
following the thread is wild tho
2024-01-23 03:13:22
https://sourceware.org/pipermail/libc-alpha/2023-August/150653.html
2024-01-23 03:16:27
> There were a LOT of other size requests. The smallest I saw was TWO > bytes. WHY? I'm tempted to not fix this, to teach developers to not > use posix_memalign() unless they REALLY need it ;-)
2024-01-23 03:19:41
it was eventually fixed tho
veluca
2024-01-23 03:20:47
that's one heck of a performance regression
yurume
lonjil found glibc's implementation: ```c double __fma (double x, double y, double z) { return (x * y) + z; } ``` πŸ€¦β€β™€οΈ
2024-01-24 12:55:34
you are very likely to look at the fallback implementation. search for other files named `s_fma.c`..
2024-01-24 12:56:14
(I do agree that glibc is structured in a somewhat confusing way though)
lonjil
2024-01-24 12:56:23
I did find another file, forgot to post about it
2024-01-24 12:56:43
Since it's a math.h function, I looked in the math folder
2024-01-24 12:57:01
But turns out there's an ieee754 folder with the proper algorithm
yurume
2024-01-24 12:57:12
yeah `sysdeps` is a whole can of confusion
2024-01-24 12:57:29
pretty much *any* file can be overridden from those directories
lonjil
2024-01-24 12:58:36
Kinda confusing because the proper implementation is just normal double math. Way more of it, but ought to work everywhere where the simpler impl works.
yurume
2024-01-24 01:00:00
I believe you can't even try to implement fma if you don't know which fp impl is being used (as opposed to IEEE 754)
lonjil
2024-01-24 01:03:36
Oh yeah, I guess the fallback gives a decent answer even on non 754 systems
2024-01-24 01:03:47
Forgot those exist
Traneptora
2024-01-24 06:30:25
are there any systems that have 4-byte floats that aren't IEEE-compliant
2024-01-24 06:30:33
I mean there used to be but do they exist anymore
jonnyawsom3
2024-01-24 07:32:56
https://youtu.be/nJlZT5AE9zY
2024-01-24 11:23:09
Part of the automated pallete selection based on CIELAB mentioned near the end of that video https://fixupx.com/moulberry/status/1741995924237533515?s=20
diskorduser
2024-01-26 01:32:54
That file opens fine on gimp.
Traneptora
diskorduser That file opens fine on gimp.
2024-01-26 06:11:50
which file?
diskorduser
Traneptora which file?
2024-01-27 01:23:49
gb82
spider-mario as far as I can tell, that would involve recompression from pixels to JPEG XL
2024-01-29 09:37:13
that's fine, I don't mind in this instance
2024-01-29 09:37:20
also, sorry for the late reply lol
diskorduser
2024-01-29 03:47:23
why is the xyb image look black and white? am I encoding it wrongly?
Traneptora
diskorduser why is the xyb image look black and white? am I encoding it wrongly?
2024-01-29 03:49:27
XYB jpeg? shouldn't be
2024-01-29 03:49:50
not unless the original is grayscale
diskorduser
2024-01-29 03:50:02
source is a png file
Traneptora
2024-01-29 03:50:04
I wonder if your viewer is struggling with RGB jpegs
diskorduser
2024-01-29 03:50:16
I tried 3 different apps