~xiph/celt/trunk

« back to all changes in this revision

Viewing changes to libcelt/celt.c

  • Committer: Jean-Marc Valin
  • Author(s): Gregory Maxwell
  • Date: 2011-04-13 21:15:55 UTC
  • Revision ID: git-v1:fdd867534a8f53ddb3f2845fc1dd48d13e734125
Stop adjusting the VBR drift during silent frames, this prevents overshoot after silent spans. This also results in undershoot on files with lots of silence, but this is desirable in terms of increasing quality consistency. It will be even better if we later include some open-loop correction of the targets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1425
1425
     nbAvailableBytes = IMAX(min_allowed,nbAvailableBytes);
1426
1426
     nbAvailableBytes = IMIN(nbCompressedBytes,nbAvailableBytes+nbFilledBytes) - nbFilledBytes;
1427
1427
 
 
1428
     /* By how much did we "miss" the target on that frame */
 
1429
     delta = target - vbr_rate;
 
1430
 
 
1431
     target=nbAvailableBytes<<(BITRES+3);
 
1432
 
 
1433
     /*If the frame is silent we don't adjust our drift, otherwise
 
1434
       the encoder will shoot to very high rates after hitting a
 
1435
       span of silence, but we do allow the bitres to refill.
 
1436
       This means that we'll undershoot our target in CVBR/VBR modes
 
1437
       on files with lots of silence. */
1428
1438
     if(silence)
1429
1439
     {
1430
1440
       nbAvailableBytes = 2;
1431
1441
       target = 2*8<<BITRES;
 
1442
       delta = 0;
1432
1443
     }
1433
1444
 
1434
 
     /* By how much did we "miss" the target on that frame */
1435
 
     delta = target - vbr_rate;
1436
 
 
1437
 
     target=nbAvailableBytes<<(BITRES+3);
1438
 
 
1439
1445
     if (st->vbr_count < 970)
1440
1446
     {
1441
1447
        st->vbr_count++;