<div dir="ltr">Apologies, I forgot to "reply all".<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">Jake Taylor</strong> <span dir="auto"><<a href="mailto:yupferris@gmail.com">yupferris@gmail.com</a>></span><br>Date: Mon, Jul 5, 2021 at 9:29 AM<br>Subject: Re: [EXT] Re: [opus] Coarse energy predictor confusion<br>To: Ulrich Windl <<a href="mailto:Ulrich.Windl@rz.uni-regensburg.de">Ulrich.Windl@rz.uni-regensburg.de</a>><br></div><br><br><div dir="ltr">> Personally I think your thoughts could be valuable to people trying to understand the code.<div><br></div><div>I was planning to blog about this, basically repeat the last notes and add some stuff about going the other way (eg. swapping terms so that the decoder can work without knowing the current energy value yet, and then deriving the code). I suppose it could be useful to share a link to that when it's ready?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 5, 2021 at 9:26 AM Ulrich Windl <<a href="mailto:Ulrich.Windl@rz.uni-regensburg.de" target="_blank">Ulrich.Windl@rz.uni-regensburg.de</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">>>> Jake Taylor <<a href="mailto:yupferris@gmail.com" target="_blank">yupferris@gmail.com</a>> schrieb am 03.07.2021 um 13:51 in Nachricht<br>
<CALkcPkLpPT1kG5KLpQ4ZHoTYRHJukNH58=<a href="mailto:ThYCJF-m7kZRV9Xw@mail.gmail.com" target="_blank">ThYCJF-m7kZRV9Xw@mail.gmail.com</a>>:<br>
> Hi again all,<br>
> <br>
> I've solved it (in fact the clues showed up in earlier notes, but I didn't<br>
> put it together entirely until now)! I was making a crucial conceptual<br>
> mistake. I assumed the output of the predictor was the *prediction*,<br>
> however, this is incorrect - instead it outputs the *residual* directly.<br>
> Under that interpretation, everything falls into place. So I no longer need<br>
> help with this, and sorry for the noise while I figured it out!<br>
<br>
Personally I think your thoughts could be valuable to people trying to understand the code.<br>
Maybe it could be "weaved in" or added to the resources at the web site.<br>
<br>
> <br>
> For the curious, once again, notes in pdf/lyx format are attached, as well<br>
> as on my dropbox:<br>
> pdf:<br>
> <a href="https://www.dropbox.com/s/rzm08055hytjy6c/predictor-confusion-5.pdf?dl=0" rel="noreferrer" target="_blank">https://www.dropbox.com/s/rzm08055hytjy6c/predictor-confusion-5.pdf?dl=0</a> <br>
> <<a href="https://www.dropbox.com/s/l4tzyvq1mne8jan/predictor-confusion-4.pdf?dl=0" rel="noreferrer" target="_blank">https://www.dropbox.com/s/l4tzyvq1mne8jan/predictor-confusion-4.pdf?dl=0</a>><br>
> lyx:<br>
> <a href="https://www.dropbox.com/s/vj1s3pbm8q914vf/predictor-confusion-5.lyx?dl=0" rel="noreferrer" target="_blank">https://www.dropbox.com/s/vj1s3pbm8q914vf/predictor-confusion-5.lyx?dl=0</a> <br>
> <<a href="https://www.dropbox.com/s/map3slkbnhyctui/predictor-confusion-4.lyx?dl=0" rel="noreferrer" target="_blank">https://www.dropbox.com/s/map3slkbnhyctui/predictor-confusion-4.lyx?dl=0</a>><br>
> and plaintext below.<br>
> <br>
> Thanks again,<br>
> Jake<br>
> <br>
> ---<br>
> <br>
> Opus Coarse Energy Predictor Notes (Round 5)<br>
> <br>
> Jake Taylor (<a href="mailto:yupferris@gmail.com" target="_blank">yupferris@gmail.com</a>), 3 July 2021<br>
> <br>
> I've solved it - I was simply mistaken about what the output of<br>
> the filters should be. Instead of the filters outputting the<br>
> prediction, they output the residual directly. Under this<br>
> interpretation, everything falls into place.<br>
> <br>
> According to the paper[0]/RFC[1], the 2D z-transform should be:<br>
> <br>
> A(z_{\ell},z_{b})=(1-\alpha z_{\ell}^{-1})\cdot\frac{1-z_{b}^{-1}}{1-\beta<br>
> z_{b}^{-1}}<br>
> <br>
> I've simplified the source code (in unquant_coarse_energy in<br>
> quant_bands.c in libopus 1.3.1[2]) to the following C (pseudo)code:<br>
> <br>
> void unquant_coarse_energy(float *e, int bands) {<br>
>   float alpha = /* ... */;<br>
>   float beta = /* ... */;<br>
>   float prev = 0.0f;<br>
>   for (int b = 0; b < bands; b++) {<br>
>     float r = /* read from bitstream */;<br>
>     e[i] = alpha * e[i] + prev + r;<br>
>     prev = prev + (1 - beta) * r;<br>
>   }<br>
> }<br>
> <br>
> The goal is simple: extract difference equations from the code,<br>
> derive the corresponding z-transforms, and then solve the final z<br>
> -transform which should hopefully match what the paper/RFC list.<br>
> <br>
> The code is governed by the following difference equations:<br>
> <br>
> e[\ell,b]=\alpha e[\ell-1,b]+prev[\ell,b-1]+r[\ell,b]<br>
> <br>
> prev[\ell,b]=prev[\ell,b-1]+(1-\beta)r[\ell,b]<br>
> <br>
> The corresponding z-transforms are:<br>
> <br>
> E(z_{\ell},z_{b})=\alpha<br>
> z_{\ell}^{-1}E(z_{\ell},z_{b})+z_{b}^{-1}Prev(z_{\ell},z_{b})+R(z_{\ell},z_{<br>
> b})<br>
> <br>
> Prev(z_{\ell},z_{b})=z_{b}^{-1}Prev(z_{\ell},z_{b})+(1-\beta)R(z_{\ell},z_{b\par > <br>
<br>
<br>
</blockquote></div>
</div></div>