<div>I’m merely a subscriber to this mailing list (no access to merge), but in absence of a response this fix makes sense to me.<caret></caret></div><div><br></div>On Tue, May 5, 2020 at 3:50 PM, Vitaly Buka <<a href="mailto:vitalybuka@gmail.com" class="">vitalybuka@gmail.com</a>> wrote:<blockquote class="protonmail_quote" type="cite">  <div dir="ltr">I would like to re-ask for the review of this trivial patch again.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 15 Apr 2020 at 22:01, Vitaly Buka <<a href="mailto:vitalybuka@google.com">vitalybuka@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Vitaly Buka <<a href="mailto:vitalybuka@gmail.com">vitalybuka@gmail.com</a>><br>
<br>
rcc->last_non_b_pict_type can be -1 in cases when last_non_b_q even<br>
not used.<br>
---<br>
 encoder/ratecontrol.c | 3 +--<br>
 1 file changed, 1 insertion(+), 2 deletions(-)<br>
<br>
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c<br>
index 1598b508..06359442 100644<br>
--- a/encoder/ratecontrol.c<br>
+++ b/encoder/ratecontrol.c<br>
@@ -2031,7 +2031,6 @@ static double get_diff_limited_q(x264_t *h, ratecontrol_entry_t *rce, double q,<br>
<br>
     // force I/B quants as a function of P quants<br>
     const double last_p_q    = rcc->last_qscale_for[SLICE_TYPE_P];<br>
-    const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];<br>
     if( pict_type == SLICE_TYPE_I )<br>
     {<br>
         double iq = q;<br>
@@ -2050,7 +2049,7 @@ static double get_diff_limited_q(x264_t *h, ratecontrol_entry_t *rce, double q,<br>
     else if( pict_type == SLICE_TYPE_B )<br>
     {<br>
         if( h->param.rc.f_pb_factor > 0 )<br>
-            q = last_non_b_q;<br>
+            q = rcc->last_qscale_for[rcc->last_non_b_pict_type];<br>
         if( !rce->kept_as_ref )<br>
             q *= fabs( h->param.rc.f_pb_factor );<br>
     }<br>
-- <br>
2.26.0.110.g2183baf09c-goog<br>
<br>
</blockquote></div>
</blockquote><div><br></div><div><br></div>