Revision 23e54f69 libavcodec/ratecontrol.c

View differences:

libavcodec/ratecontrol.c
123 123
        rcc->short_term_qsum=0.001;
124 124
        rcc->short_term_qcount=0.001;
125 125
    
126
        rcc->pass1_bits       =0.001;
126
        rcc->pass1_rc_eq_output_sum= 0.001;
127 127
        rcc->pass1_wanted_bits=0.001;
128 128
        
129 129
        /* init stuff with the user specified complexity */
......
163 163

  
164 164
                bits= rce.i_tex_bits + rce.p_tex_bits;
165 165

  
166
                q= get_qscale(s, &rce, rcc->pass1_wanted_bits/rcc->pass1_bits, i);
166
                q= get_qscale(s, &rce, rcc->pass1_wanted_bits/rcc->pass1_rc_eq_output_sum, i);
167 167
                rcc->pass1_wanted_bits+= s->bit_rate/(s->frame_rate / (double)FRAME_RATE_BASE);
168 168
            }
169 169
        }
......
296 296

  
297 297
    bits= ff_eval(s->avctx->rc_eq, const_values, const_names, func1, func1_names, NULL, NULL, rce);
298 298
    
299
    rcc->pass1_bits+= bits;
299
    rcc->pass1_rc_eq_output_sum+= bits;
300 300
    bits*=rate_factor;
301 301
    if(bits<0.0) bits=0.0;
302 302
    bits+= 1.0; //avoid 1/0 issues
......
628 628
        rcc->frame_count[pict_type] ++;
629 629

  
630 630
        bits= rce->i_tex_bits + rce->p_tex_bits;
631
        rate_factor= rcc->pass1_wanted_bits/rcc->pass1_bits * br_compensation;
631
        rate_factor= rcc->pass1_wanted_bits/rcc->pass1_rc_eq_output_sum * br_compensation;
632 632
    
633 633
        q= get_qscale(s, rce, rate_factor, picture_number);
634 634

  

Also available in: Unified diff