[svn] / trunk / vfw / src / 2pass.c Repository:
ViewVC logotype

Diff of /trunk/vfw/src/2pass.c

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

revision 343, Sat Jul 27 21:38:19 2002 UTC revision 482, Thu Sep 12 21:18:49 2002 UTC
# Line 161  Line 161 
161                                  {                                  {
162                                          if (twopass->nns1.quant & NNSTATS_KEYFRAME)                                          if (twopass->nns1.quant & NNSTATS_KEYFRAME)
163                                          {                                          {
164                                                  i_boost_total = twopass->nns2.bytes * codec->config.keyframe_boost / 100;                                                  i_boost_total += twopass->nns2.bytes * codec->config.keyframe_boost / 100;
165                                                  i_total += twopass->nns2.bytes;                                                  i_total += twopass->nns2.bytes;
166                                                  twopass->keyframe_locations[i_frames] = frames;                                                  twopass->keyframe_locations[i_frames] = frames;
167                                                  ++i_frames;                                                  ++i_frames;
# Line 794  Line 794 
794                  }                  }
795                  else    // DLG_MODE_2PASS_2_EXT                  else    // DLG_MODE_2PASS_2_EXT
796                  {                  {
797                            if (codec->config.credits_mode == CREDITS_MODE_QUANT)
798                            {
799                                    if (codec->config.credits_quant_i != codec->config.credits_quant_p)
800                                    {
801                                            frame->quant = frame->intra ?
802                                                    codec->config.credits_quant_i :
803                                                    codec->config.credits_quant_p;
804                                    }
805                                    else
806                                    {
807                                            frame->quant = codec->config.credits_quant_p;
808                                            frame->intra = -1;
809                                    }
810    
811                                    twopass->bytes1 = bytes1;
812                                    twopass->bytes2 = bytes1;
813                                    twopass->desired_bytes2 = bytes1;
814                                    return ICERR_OK;
815                            }
816                            else
817                          bytes2 = twopass->nns2.bytes;                          bytes2 = twopass->nns2.bytes;
818                  }                  }
819          }          }
# Line 930  Line 950 
950    
951          twopass->desired_bytes2 = bytes2;          twopass->desired_bytes2 = bytes2;
952    
953          if (frame->intra)          // if this keyframe is too close to the next,
954            // reduce it's byte allotment
955            if (frame->intra && !credits_pos)
956          {          {
957                  KFdistance = codec->twopass.keyframe_locations[codec->twopass.KF_idx] -                  KFdistance = codec->twopass.keyframe_locations[codec->twopass.KF_idx] -
958                          codec->twopass.keyframe_locations[codec->twopass.KF_idx - 1];                          codec->twopass.keyframe_locations[codec->twopass.KF_idx - 1];
# Line 1135  Line 1157 
1157                          codec->twopass.quant_count[frame->quant]++;                          codec->twopass.quant_count[frame->quant]++;
1158                          if ((codec->twopass.nns1.quant & NNSTATS_KEYFRAME))                          if ((codec->twopass.nns1.quant & NNSTATS_KEYFRAME))
1159                          {                          {
1160                                    // calculate how much to distribute per frame in
1161                                    // order to make up for this keyframe's overflow
1162    
1163                                  codec->twopass.overflow += codec->twopass.KFoverflow;                                  codec->twopass.overflow += codec->twopass.KFoverflow;
1164                                  codec->twopass.KFoverflow = codec->twopass.desired_bytes2 - frame->length;                                  codec->twopass.KFoverflow = codec->twopass.desired_bytes2 - frame->length;
1165    
# Line 1157  Line 1182 
1182                          }                          }
1183                          else                          else
1184                          {                          {
1185                                    // distribute part of the keyframe overflow
1186    
1187                                  codec->twopass.overflow += codec->twopass.desired_bytes2 - frame->length +                                  codec->twopass.overflow += codec->twopass.desired_bytes2 - frame->length +
1188                                          codec->twopass.KFoverflow_partial;                                          codec->twopass.KFoverflow_partial;
1189                                  codec->twopass.KFoverflow -= codec->twopass.KFoverflow_partial;                                  codec->twopass.KFoverflow -= codec->twopass.KFoverflow_partial;

Legend:
Removed from v.343  
changed lines
  Added in v.482

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