On 03/07/2012 04:33 PM, Ronald S. Bultje wrote:
Hi,

On Wed, Mar 7, 2012 at 1:38 AM, Benjamin Larsson<[email protected]>  wrote:
On 03/06/2012 10:45 PM, Ronald S. Bultje wrote:
From: "Ronald S. Bultje"<[email protected]>

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: [email protected]
---
  libavcodec/cookdata.h |   22 ++++++++++++++++------
  1 file changed, 16 insertions(+), 6 deletions(-)

Nice, I like the solution, but it definitely needs a comment in the source.
Will add.

And why do you add a 1 in the beginning just to offset the table later ?
The decoupling uses this code:

  830     idx = (1<<  p->js_vlc_bits) - 1;
  831     for (i = p->js_subband_start; i<  p->subbands; i++) {
  832         cpl_tmp = cplband[i];
  833         idx -= decouple_tab[cpl_tmp];
  834         cplscale = q->cplscales[p->js_vlc_bits - 2];  // choose
decoupler table
  835         f1 = cplscale[decouple_tab[cpl_tmp]];
  836         f2 = cplscale[idx - 1];

Example, if vlc_bits == 5, then idx in line 830 is 31, so if
decouple_tab is X, then it uses f1_idx=X and f2_idx=31-X-1, e.g. if
f1=31, then f2=-1. I could either offset the indexing tables
(decouple_tab) by one, or offset the cplscale tables by one, the
second looked simpler. It's admittedly a little hacky, so I can it the
other way around also.

Ronald

Just offset the index calculation in the code with 1. The table trickery is not easy to understand. Patch ok after that.


MvH
Benjamin Larsson
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to