Skip to content
  • Timothy B. Terriberry's avatar
    Give the bit we reserved to end skipping back when we don't use it. · 76ea41e1
    Timothy B. Terriberry authored and Jean-Marc Valin's avatar Jean-Marc Valin committed
    Commit 8e447678 increased the number of cases where we end skipping
     without explicit signaling.
    Before, this would cause the bit we reserved for this purpose to
     either a) get grabbed by some N=1 band to code its sign bits or
     b) wind up as part of the fine energy at the end.
    This patch gives it back to the band where we stopped skipping,
     which is either the first band, or a band that was boosted by
     dynalloc.
    This allows the bit to be used for shape coding in that band, and
     allows the better computation of the fine offset, since the band
     knows it will get that bit in advance.
    
    With this change, we now guarantee that the number of bits allocated
     by compute_allocation() is exactly equal to the input total, less
     the bits consumed by skip flags during allocation itself (assuming
     total was non-negative; for negative total, no bits are emitted,
     and no bits are allocated).
    76ea41e1