if(qmin<2) qmin=2;
if(qmin<1) qmin=1;
int ff_rate_estimate_qscale_pass2(MpegEncContext *s){    int qmin= s->qmin;    int qmax= s->qmax;    float q;    int qscale;    float br_compensation;    double diff;    int picture_number= s->picture_number;    RateControlEntry *rce= &s->rc_context.entry[picture_number];    int64_t wanted_bits= rce->expected_bits;    emms_c();//    printf("%d %d %d\n", picture_number, (int)wanted_bits, (int)s->total_bits);        if(s->pict_type==B_TYPE){        qmin= (int)(qmin*s->b_quant_factor+0.5);        qmax= (int)(qmax*s->b_quant_factor+0.5);    }    if(qmin<2) qmin=2;    if(qmax>31) qmax=31;    if(qmax<=qmin) qmax= qmin;    q= rce->new_qscale;    diff= s->total_bits - wanted_bits;    br_compensation= (s->bit_rate_tolerance - diff)/s->bit_rate_tolerance;    if(br_compensation<=0.0) br_compensation=0.001;    q/=br_compensation;    qscale= (int)(q + 0.5);    if     (qscale<qmin) qscale=qmin;    else if(qscale>qmax) qscale=qmax;//    printf("%d %d %d %d type:%d\n", qmin, qscale, qmax, picture_number, s->pict_type); fflush(stdout);    return qscale;}