News for hackers. Stuff that matters.
Re:H.266/Versatile Video Coding (VVC) by giantrobot on Monday July 06, 2020 @02:17PM (#23750947)
Video compression is a calculus of IO capacity, memory, and algorithmic complexity. Take the MPEG-1 codec for instance, it was new about 30 years ago. While today most people think of MPEG-1 videos as low quality the spec provides the ability to handle bit rates up to 100Mb/s and resolutions up to 4095x4095. That was way higher than the hardware of the time supported.

One of MPEG-1's design goals was to get VHS-quality video at a bitrate that could stream over T1/E1 lines or 1x CD-ROMs. The limit on bitrate led to increased algorithmic complexity. It was well into the Pentium/PowerPC era until desktop systems could play back VCD quality MPEG-1 video in software.

Later MPEG codecs increased their algorithmic complexity to squeeze better quality video into low bit rates. A lot of those features existed on paper 20-30 years ago but weren't practical on hardware of the time, even custom ASICs. Even within a spec features are bound to profiles so a file/stream can be handled by less capable decoders/hardware.

There's plenty of video codecs or settings for them that can choke modern hardware. It also depends on what you mean by "modern hardware". There's codecs/configurations a Threadripper with 64GB of RAM in a mains powered jet engine sounding desktop could handle in software that would kill a Snapdragon with 6GB of RAM in a phone. There's also codecs/configurations the Snapdragon in the phone could play using hardware acceleration that would choke a low powered Celeron or Atom decoding in software.

Re:H.266/Versatile Video Coding (VVC) by AareyBaba on Monday July 06, 2020 @03:55PM (#23752028)
Are there codecs that require high compute (Threadripper) for encode but can be easily decoded on a Snapdragon ?
Re:H.266/Versatile Video Coding (VVC) by pcl on Monday July 06, 2020 @04:28PM (#23752366)
Yes — many codecs can be optimized for decoding at the expense of encoding. This is appropriate for any sort of broadcast (YouTube, television, etc).

Also, in many applications, it’s suitable to exchange time for memory / compute. You can spend an hour of compute time optimally encoding a 20-minute YouTube video, with no real downside.

Neither of these approaches are suitable for things like video conferencing, where there is a small number of receivers for each encoded stream and latency is critical. At 60fps, you have less than 17ms to encode each frame.

Interestingly, for a while, real-time encoders were going in a massively parallel direction, in which an ASIC chopped up a frame and encoded different regions in parallel. This was a useful optimization for a while, but now, common GPUs can handle encoding an entire 1080p frame (and sometimes even 4K) within that 17ms budget. Encoding the whole frame at once is way simpler from an engineering standpoint, and you can get better compression and / or fewer artifacts since the algorithm can take into account all the frame data rather than just chopped up bits.

Re:H.266/Versatile Video Coding (VVC) by beervirus on Monday July 06, 2020 @07:46PM (#23754078)
Surely videoconferencing doesn’t actually use 60 FPS...
Re:H.266/Versatile Video Coding (VVC) by naikrovek on Monday July 06, 2020 @10:11PM (#23754942)
Why not? It's not full-motion video, it's literally talking heads. Talking heads are easy to push to 60fps on a relatively low bitrate.
Re:H.266/Versatile Video Coding (VVC) by giantrobot on Monday July 06, 2020 @08:51PM (#23754465)
Some web conferencing would want to do 60fps. There's also realtime streaming like Twitch, PS Now, and Google's Stadia.
Re:H.266/Versatile Video Coding (VVC) by imtringued on Tuesday July 07, 2020 @03:27AM (#23756605)
Twitch isn't real time.
Re:H.266/Versatile Video Coding (VVC) by mathw on Tuesday July 07, 2020 @06:27AM (#23757612)
Yes it is. The delay on a Twitch stream doesn't mean they don't have to deal with encoding and transmitting frames at full speed. If Twitch wasn't real time, you'd only be able to watch live streams slowed down!
Re:H.266/Versatile Video Coding (VVC) by Kihashi on Tuesday July 07, 2020 @09:46AM (#23759183)
That's a different definition than most people mean when they say "real-time".
Re:H.266/Versatile Video Coding (VVC) by pavon on Tuesday July 07, 2020 @05:29PM (#23764314)
Not me. All realtime systems have some latency, but what makes them realtime is that they must maintain throughput, processing data as quickly as it comes in. You can subdivide to hard-realtime and soft-realtime depending on how strict your latency requirements are, but it is still realtime.
Re:H.266/Versatile Video Coding (VVC) by neonfuz on Tuesday July 07, 2020 @10:39AM (#23759731)
really? I think not. Lets use speech synthesis as an example: I would call speech synthesis real time if it takes less than one second to produce one second of synthesized speech. I think you're probably thinking of the word "live". There's always going to be a small delay when re-encoding. Real time doesn't mean 0ms delay, that's impossible. Twitch has a small delay, but it's still re-encoded in real time (encoding 1 second takes ≤ 1 second for twitch).
Re:H.266/Versatile Video Coding (VVC) by ygra on Tuesday July 07, 2020 @06:18AM (#23757555)
The delay (configurable) isn't due to the encoder. And the encoder has to process everything in real time, otherwise you start skipping frames or fall behind.
Re:H.266/Versatile Video Coding (VVC) by giantrobot on Monday July 06, 2020 @04:18PM (#23752265)
Pretty much all of them. Encode complexity for most codecs is way higher than decode complexity (on purpose).

This has been an issue with AV1, it's got relatively high decode complexity and there's not a lot of hardware acceleration available. The encode complexity is fantastic though and is very slow even on very powerful hardware, less than 1fps so ~30 hours to encode a one hour video. Even Intel's highly optimized AV1 encoder can't break 10fps (three hours to encode an hour of video) while their h.265 encoder can hit 300fps on the same hardware.

Re:H.266/Versatile Video Coding (VVC) by monocasa on Monday July 06, 2020 @04:01PM (#23752096)
A lot of video codecs are NP hard to encode optimally, so rely on heuristics. So you could certainly say that some approaches take a lot of compute power to encode, but are much more easily decodable.
Re:H.266/Versatile Video Coding (VVC) by cogman10 on Tuesday July 07, 2020 @10:11AM (#23759461)
The codecs aren't NP hard. Rather, the "perfect" encode is. That's where the heuristics are coming into play. The codec just specifies what the stream can look like, the encoders have to pick out how to write that language and the decoders how to read it.

Decoders are relatively simple book keepers/transformers. Encoders are complex systems with tons of heuristics.

This is also why hardware decoders tend to be in everything and are relatively cheap with equal quality to software counterparts. On the flip side, hardware encoders are almost always worse than their software counterparts when it comes to the quality of the output (while being significantly faster).

Re:H.266/Versatile Video Coding (VVC) by monocasa on Tuesday July 07, 2020 @01:17PM (#23761480)
> The codecs aren't NP hard. Rather, the "perfect" encode is.

That's what I meant by my first sentence.

And I'll throw out there that the vast majority of 'hardware codecs' are in fact software codecs running on a pretty general purpose DSP. You could absolutely reach the same quality as a high quality encoder given the right organizational impetus of the manufacturer; they simply are focused on reaching a specific real time bitrate for resolution rather than overall quality. By the time they've hit that, there's a new SoC with it's own DSPs and it's own Jira cards that needs attention. If these cores were more open, I'm sure you'd see less real time focused encoder software targeting them as well.

Re:H.266/Versatile Video Coding (VVC) by cellularmitosis on Monday July 06, 2020 @03:42PM (#23751895)
I wonder why all of the MPEG1 encoders of the day enforced a maximum of 320x240?
Re:H.266/Versatile Video Coding (VVC) by giantrobot on Monday July 06, 2020 @04:07PM (#23752152)
While the spec allowed for outrageous settings playback wouldn't have been possible. Most hardware decoders were meant for (or derived from) VCD playback. The VCD spec covered CIF video which mean QVGA would fall into the supported macroblock rate for hardware decoders.

In MPEG-1's heyday there would haven't been a lot of point in encoding presets producing content common hardware decoders couldn't handle.

There were several other video codecs in the same era that didn't have hardware decode requirements. Cinepak was widely used and could be readily played on a 68030, 486, and even CD-ROM game consoles. As I recall Cinepak encoders had more knobs and dials since the output didn't need to hit a hardware decoder limitation.

Re:H.266/Versatile Video Coding (VVC) by anthk on Monday July 06, 2020 @04:39PM (#23752501)
PAL/NTSC resolutions.