[svn] / branches / dev-api-3 / vfw / src / 2pass.c Repository:
ViewVC logotype

Diff of /branches/dev-api-3/vfw/src/2pass.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 108, Sun Apr 7 11:57:47 2002 UTC revision 109, Mon Apr 8 12:51:41 2002 UTC
# Line 23  Line 23 
23   *   *
24   *      History:   *      History:
25   *   *
26     *      07.04.2002      added max bitrate constraint, overflow controls (foxer)
27   *      31.03.2002      inital version;   *      31.03.2002      inital version;
28   *   *
29   *************************************************************************/   *************************************************************************/
# Line 700  Line 701 
701          int bytes1, bytes2;          int bytes1, bytes2;
702          int overflow;          int overflow;
703          int credits_pos;          int credits_pos;
704            int capped_to_max_framesize = 0;
705    
706          if (codec->framenum == 0)          if (codec->framenum == 0)
707          {          {
# Line 930  Line 932 
932          }          }
933    
934          // Foxer: make sure overflow doesn't run away          // Foxer: make sure overflow doesn't run away
935          if (overflow > bytes2 * 6 / 10)          if (overflow > bytes2 * codec->config.twopass_max_overflow_improvement / 100)
936          {          {
937                  bytes2 += (overflow <= bytes2) ? bytes2 * 6 / 10 : overflow * 6 / 10;                  bytes2 += (overflow <= bytes2) ? bytes2 * codec->config.twopass_max_overflow_improvement / 100 :
938                            overflow * codec->config.twopass_max_overflow_improvement / 100;
939          }          }
940          else if (overflow < bytes2 * -6 / 10)          else if (overflow < bytes2 * codec->config.twopass_max_overflow_degradation / -100)
941          {          {
942                  bytes2 += bytes2 * -6 / 10;                  bytes2 += bytes2 * codec->config.twopass_max_overflow_degradation / -100;
943          }          }
944          else          else
945          {          {
946                  bytes2 += overflow;                  bytes2 += overflow;
947          }          }
948    
949            if (bytes2 > twopass->max_framesize)
950            {
951                    capped_to_max_framesize = 1;
952                    bytes2 = twopass->max_framesize;
953            }
954    
955          if (bytes2 < 1)          if (bytes2 < 1)
956          {          {
957                  bytes2 = 1;                  bytes2 = 1;
# Line 1006  Line 1015 
1015                  }                  }
1016    
1017                  // subsequent frame quants can only be +- 2                  // subsequent frame quants can only be +- 2
1018                  if (last_quant)                  if (last_quant && capped_to_max_framesize == 0)
1019                  {                  {
1020                          if (frame->quant > last_quant + 2)                          if (frame->quant > last_quant + 2)
1021                          {                          {
# Line 1021  Line 1030 
1030                  }                  }
1031          }          }
1032    
1033            if (capped_to_max_framesize == 0)
1034          last_quant = frame->quant;          last_quant = frame->quant;
1035    
1036          if (codec->config.quant_type == QUANT_MODE_MOD)          if (codec->config.quant_type == QUANT_MODE_MOD)

Legend:
Removed from v.108  
changed lines
  Added in v.109

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4