Revision 4156a436 libavcodec/snow.c

View differences:

libavcodec/snow.c
3875 3875
    }
3876 3876

  
3877 3877
    pict->quality= ff_rate_estimate_qscale(&s->m, 1);
3878
    if (pict->quality < 0)
3879
        return -1;
3878 3880
    s->lambda= pict->quality * 3/2;
3879 3881
    delta_qlog= qscale2qlog(pict->quality) - s->qlog;
3880 3882
    s->qlog+= delta_qlog;
......
4060 4062
        s->m.pict_type =
4061 4063
        pict->pict_type= s->m.rc_context.entry[avctx->frame_number].new_pict_type;
4062 4064
        s->keyframe= pict->pict_type==FF_I_TYPE;
4063
        if(!(avctx->flags&CODEC_FLAG_QSCALE))
4065
        if(!(avctx->flags&CODEC_FLAG_QSCALE)) {
4064 4066
            pict->quality= ff_rate_estimate_qscale(&s->m, 0);
4067
            if (pict->quality < 0)
4068
                return -1;
4069
        }
4065 4070
    }else{
4066 4071
        s->keyframe= avctx->gop_size==0 || avctx->frame_number % avctx->gop_size == 0;
4067 4072
        s->m.pict_type=
......
4181 4186

  
4182 4187
        if(s->pass1_rc && plane_index==0){
4183 4188
            int delta_qlog = ratecontrol_1pass(s, pict);
4189
            if (delta_qlog < 0)
4190
                return -1;
4184 4191
            if(delta_qlog){
4185 4192
                //reordering qlog in the bitstream would eliminate this reset
4186 4193
                ff_init_range_encoder(c, buf, buf_size);
......
4267 4274
    s->m.current_picture.quality = pict->quality;
4268 4275
    s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start);
4269 4276
    if(s->pass1_rc)
4270
        ff_rate_estimate_qscale(&s->m, 0);
4277
        if (ff_rate_estimate_qscale(&s->m, 0) < 0)
4278
            return -1;
4271 4279
    if(avctx->flags&CODEC_FLAG_PASS1)
4272 4280
        ff_write_pass1_stats(&s->m);
4273 4281
    s->m.last_pict_type = s->m.pict_type;

Also available in: Unified diff