Live data from Hacker News

Dav2d

jbkempf.com

111–120 of 212 posts

Re: Dav2d

#111
> The page you have tried to access is not available because the owner of the file you are trying to access has exceeded our short term bandwidth limits. Please try again shortly.

HN hug of death

Re: Dav2d

#113
I'm not quite convinced a 25% reduction in size is worth effectively obsoleting all devices that have hardware decoders for AV1 but will struggle to decode AV2

Re: Dav2d

#114

Earlier quoted context omitted.

The safety can be worth it in certain cases. Like when handling untrusted input. And it's not just Rust: look at WUFFS for example. WUFFS can actually rival handwritten implementations in certain cases.

but not these cases

It really should be, though: https://en.wikipedia.org/wiki/FORCEDENTRY

Re: Dav2d

#115
post #75

Earlier quoted context omitted.

Yes, much higher computation required to encode it, and decode it, both.

He only mentioned decode complexity. Would be interesting to know the average encode complexity compared to AV1.

Encoding speed even on Mac Studio is atrocious, it’s in range of single frames per second as opposed to realtime+ for even h265

Re: Dav2d

#116
post #16
post #7

Sorry if this sounds naive, but does it make sense to write a codec library in C/ASM considering how well Rust is progressing, especially when, as the author puts it, AV2 decoding is roughly five times more complex than AV1 decoding ?

Because it's 5 times more complex, you need to get the maximum performance available. Therefore more ASM than ever. Rust does not bring more performance. Just more safety.

> Rust does not bring more performance. Just more safety.

Though more safety can in some cases bring a bit more performance. For instance, with Rust you can often avoid "defensive copies" of objects.

Re: Dav2d

#117

I'm not quite convinced a 25% reduction in size is worth effectively obsoleting all devices that have hardware decoders for AV1 but will struggle to decode AV2

Modern video services perform multiple encodings with different codecs, bitrates and screen dimensions, and serve up the most appropriate format that the client device can decode. Youtube has hundreds of format variants:

https://gist.github.com/MartinEesmaa/2f4b261cb90a47e9c41ba11...

Devices with AV1 hardware decoding - rare as they are - won't be obsoleted for a long time.

Re: Dav2d

#118

Earlier quoted context omitted.

Encoder and decoder writers frequently need extremely fine grain control over SIMD instructions in order to get good performance. The way they weave these instructions can be very hard to express with a high level language. Further, there's a ton of work with arrays and importantly parts of arrays. They can, for example, need to extract every other element up to 1/2 the array. Unfortunately, rust has runtime array bo…

Performance should not be priority #1. Security should be. Why do we slow down all CPUs to prevent SPECTRE attacks yet continue to write in C? As rav1d shows, the perf loss is far less to migrate from C to Rust than it is to apply SPECTRE mitigations, and adding a sandbox around a memory-unsafe codec is going to be way more expensive again than using Rust code to start.

> As rav1d shows

rav1d is not a full rewrite of dav1d to rust. So it really doesn't show that. It's currently C + rust + asm.

I don't think we can say anything about what this does or does not prove about the performance of safe code.

> Performance should not be priority #1. Security should be.

Entirely depends on the application. The reason rust has `unsafe` is because there's some situations where performance needs to preempt potential security problems.

Re: Dav2d

#119
post #7

Sorry if this sounds naive, but does it make sense to write a codec library in C/ASM considering how well Rust is progressing, especially when, as the author puts it, AV2 decoding is roughly five times more complex than AV1 decoding ?

yes it makes sense to use C/ASM here, but if you're curious, there is a rust port of dav1d named rav1d: https://github.com/memorysafety/rav1d it's not much slower than the original C/ASM implementation (last i checked ~5%?) but that matters here

It is much slower than 5%, there were other independent tests that put it around 20%.
Post reply on HN