VP8Decimate "RDO/only Distortion" branch

31 views
Skip to first unread message

Pablo Enfedaque

unread,
Jun 27, 2016, 10:44:50 PM6/27/16
to WebP Discussion

Hi there,


In the function VP8Decimate() there is an if/else that separates two cases:


1. if (rd_opt > RD_OPT_NONE):

For a given macroblock, the rate and distortion of different prediction modes are measured + reconstruction of that MB.

2. else:

Only distortion measurements are performed + reconstruction of that MB.


The comment before the “else” says that:


// At this point we have heuristically decided intra16 / intra4.

// For method >= 2, pick the best intra4/intra16 based on SSE (~tad slower).

// For method <= 1, we don't re-examine the decision but just go ahead with

// quantization/reconstruction.


There is necessarily a previous decision regarding the prediction mode in that MB? Could not be the first time that it is evaluated??


From what I understand, when inside StatLoop() → OneStatPass() → VP8Decimate, if method < 3 then rd_opt=RD_OPT_NONE, so the evaluation in VP8Decimate goes to the “else” branch. However, this will be the first time that that MB is checked, so no previous decisions have been made. Is this right?


Depending on the method (0..6) used, in the main loop of VP8EncLoop(), it could also be the first time that a MB is visited, if inside StatLoop() not all macroblocks have been evaluated (fast mode).


Can someone please clarify those scenarios?


Thanks!


Pablo

Pascal Massimino

unread,
Jun 29, 2016, 10:28:10 AM6/29/16
to WebP Discussion
Hi Pablo,

On Mon, Jun 27, 2016 at 7:44 PM, Pablo Enfedaque <pablo.e...@gmail.com> wrote:

Hi there,


In the function VP8Decimate() there is an if/else that separates two cases:


1. if (rd_opt > RD_OPT_NONE):

For a given macroblock, the rate and distortion of different prediction modes are measured + reconstruction of that MB.

2. else:

Only distortion measurements are performed + reconstruction of that MB.


The comment before the “else” says that:


// At this point we have heuristically decided intra16 / intra4.

// For method >= 2, pick the best intra4/intra16 based on SSE (~tad slower).

// For method <= 1, we don't re-examine the decision but just go ahead with

// quantization/reconstruction.


There is necessarily a previous decision regarding the prediction mode in that MB? Could not be the first time that it is evaluated??


Actually, the mode is 'decided' to be forced to intra16 during the analysis pass: we call DoSegmentJob() in analysis.c, which in turn calls MBAnalyze(), which calls MBAnalyzeBestIntra16Mode() first. Then, for method >= 5, we refine the decision with MBAnalyzeBestIntra4Mode().

hope it helps,
skal/


From what I understand, when inside StatLoop() → OneStatPass() → VP8Decimate, if method < 3 then rd_opt=RD_OPT_NONE, so the evaluation in VP8Decimate goes to the “else” branch. However, this will be the first time that that MB is checked, so no previous decisions have been made. Is this right?


Depending on the method (0..6) used, in the main loop of VP8EncLoop(), it could also be the first time that a MB is visited, if inside StatLoop() not all macroblocks have been evaluated (fast mode).


Can someone please clarify those scenarios?


Thanks!


Pablo

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

Pablo Enfedaque

unread,
Jul 5, 2016, 8:57:05 PM7/5/16
to WebP Discussion
Hi skal,

Ok! That makes sense, much clearer now.  

The analysis pass is the one that is actually implemented with multithreading support, right? Do you know if all the macroblocks could be analyzed in parallel in this stage??

Thank you very much!

Pablo

Pascal Massimino

unread,
Jul 6, 2016, 9:48:35 AM7/6/16
to WebP Discussion
Hi Pablo,

On Tue, Jul 5, 2016 at 5:57 PM, Pablo Enfedaque <pablo.e...@gmail.com> wrote:
Hi skal,

Ok! That makes sense, much clearer now.  

The analysis pass is the one that is actually implemented with multithreading support, right? Do you know if all the macroblocks could be analyzed in parallel in this stage??

yes, they can. They're no dependency between macroblocks, each analysis can be done separately. But keep in mind that
this part (analysis) is only a minor fraction of the overall encoding time (the most consuming part is the later RD evaluation).

hope it helps,
skal/

Reply all
Reply to author
Forward
0 new messages