VP9 frame-level parallel encoding

102 views
Skip to first unread message

peichuan zhang

unread,
Feb 1, 2019, 3:29:13 AM2/1/19
to Codec Developers
Is frame-level parallel encoding feasible for VP9?
As far as I can see is that if I enable 'frame_parallel_decoding_mode' and manage the frame context properly, it should work.

Anyone has done this before?

James Zern

unread,
Feb 1, 2019, 3:44:50 AM2/1/19
to codec...@webmproject.org
Hi,
ffmpeg's vp9 decoder implements frame parallel decoding. It will work
with and without frame_parallel_decoding_mode set, but won't be bit
exact if it is false.

[1] https://git.ffmpeg.org/gitweb/ffmpeg.git/blob_plain/HEAD:/libavcodec/vp9.c

Ronald S. Bultje

unread,
Feb 1, 2019, 6:21:36 AM2/1/19
to Codec Developers
Hi,

On Fri, Feb 1, 2019 at 3:44 AM 'James Zern' via Codec Developers <codec...@webmproject.org> wrote:
Hi,

On Fri, Feb 1, 2019 at 12:29 AM peichuan zhang
<peichuan...@gmail.com> wrote:
>
> Is frame-level parallel encoding feasible for VP9?
> As far as I can see is that if I enable 'frame_parallel_decoding_mode' and manage the frame context properly, it should work.
>
> Anyone has done this before?
>

ffmpeg's vp9 decoder implements frame parallel decoding. It will work
with and without frame_parallel_decoding_mode set, but won't be bit
exact if it is false.

Decoding (with ffvp9) *is* bit-exact, even if frame_parallel_decoding_mode is set and frame-multithreaded decoding is used.

As for frame-multithreaded encoding, libvpx does not support that. There's commercial VP9 encoders that support it.

Ronald 

James Zern

unread,
Feb 1, 2019, 12:37:42 PM2/1/19
to codec...@webmproject.org


On Fri, Feb 1, 2019, 03:21 Ronald S. Bultje <rsbu...@gmail.com wrote:
Hi,

On Fri, Feb 1, 2019 at 3:44 AM 'James Zern' via Codec Developers <codec...@webmproject.org> wrote:
Hi,

On Fri, Feb 1, 2019 at 12:29 AM peichuan zhang
<peichuan...@gmail.com> wrote:
>
> Is frame-level parallel encoding feasible for VP9?
> As far as I can see is that if I enable 'frame_parallel_decoding_mode' and manage the frame context properly, it should work.
>
> Anyone has done this before?
>

ffmpeg's vp9 decoder implements frame parallel decoding. It will work
with and without frame_parallel_decoding_mode set, but won't be bit
exact if it is false.

Decoding (with ffvp9) *is* bit-exact, even if frame_parallel_decoding_mode is set and frame-multithreaded decoding is used.

My mistake, thanks for the correction Ronald.


As for frame-multithreaded encoding, libvpx does not support that. There's commercial VP9 encoders that support it.

Ronald 

--
You received this message because you are subscribed to the Google Groups "Codec Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codec-devel...@webmproject.org.
To post to this group, send email to codec...@webmproject.org.
Visit this group at https://groups.google.com/a/webmproject.org/group/codec-devel/.
For more options, visit https://groups.google.com/a/webmproject.org/d/optout.

peichuan zhang

unread,
Feb 1, 2019, 9:19:07 PM2/1/19
to Codec Developers

Since vp9 updates context at the frame level, it seems like frame-multithreaded encoding would suffer a great loss.
I'll do some testings first.

As for decoding, I don't know if I got it wrong or something, but it really confused me. If the encoder refreshed the frame context after encoding one frame, then how could parallel decoding be possible?


在 2019年2月1日星期五 UTC+8下午7:21:36,rbultje写道:

Ronald S. Bultje

unread,
Feb 1, 2019, 10:36:01 PM2/1/19
to Codec Developers
Hi,

On Fri, Feb 1, 2019 at 9:19 PM peichuan zhang <peichuan...@gmail.com> wrote:
Since vp9 updates context at the frame level, it seems like frame-multithreaded encoding would suffer a great loss.

That is not what we see.

As for decoding, I don't know if I got it wrong or something, but it really confused me. If the encoder refreshed the frame context after encoding one frame, then how could parallel decoding be possible?

FFmpeg has one pass for symbol parsing, then it signals the next frame thread to starts its symbol parsing, while a second pass in the first thread to do reconstruction (so, yes: 2-pass decoding!). Since reconstruction takes significantly more time than symbol parsing on regular-bitrate content, this gives sufficient concurrency to be worth it (since various frames can be working on their reconstruction pass at the same time). It doesn't scale exactly as well per thread as without the symbol context dependency, but it typically will saturate a couple of cores, which is enough for our use cases.

Ronald

peichuan zhang

unread,
Feb 1, 2019, 11:32:11 PM2/1/19
to Codec Developers
Hi

在 2019年2月2日星期六 UTC+8上午11:36:01,rbultje写道:
Hi,

On Fri, Feb 1, 2019 at 9:19 PM peichuan zhang <peichuan...@gmail.com> wrote:
Since vp9 updates context at the frame level, it seems like frame-multithreaded encoding would suffer a great loss.

That is not what we see.

Thanks for your answer Ronald, I'll check the spec and libvpx for some details.
 

As for decoding, I don't know if I got it wrong or something, but it really confused me. If the encoder refreshed the frame context after encoding one frame, then how could parallel decoding be possible?

FFmpeg has one pass for symbol parsing, then it signals the next frame thread to starts its symbol parsing, while a second pass in the first thread to do reconstruction (so, yes: 2-pass decoding!). Since reconstruction takes significantly more time than symbol parsing on regular-bitrate content, this gives sufficient concurrency to be worth it (since various frames can be working on their reconstruction pass at the same time). It doesn't scale exactly as well per thread as without the symbol context dependency, but it typically will saturate a couple of cores, which is enough for our use cases.

 2pass decoding is really brilliant!


Ronald
Reply all
Reply to author
Forward
0 new messages