Revision 098eefe1 libavcodec/mpegvideo.c

View differences:

libavcodec/mpegvideo.c
542 542

  
543 543
    encode_picture(s, s->picture_number);
544 544
    avctx->key_frame = (s->pict_type == I_TYPE);
545
    
545
    avctx->header_bits = s->header_bits;
546
    avctx->mv_bits     = s->mv_bits;
547
    avctx->misc_bits   = s->misc_bits;
548
    avctx->i_tex_bits  = s->i_tex_bits;
549
    avctx->p_tex_bits  = s->p_tex_bits;
550
    avctx->i_count     = s->i_count;
551
    avctx->p_count     = s->p_count;
552
    avctx->skip_count  = s->skip_count;
553

  
546 554
    MPV_frame_end(s);
547 555
    s->picture_number++;
548 556
    s->picture_in_gop_number++;
......
554 562
    s->last_frame_bits= s->frame_bits;
555 563
    s->frame_bits  = (pbBufPtr(&s->pb) - s->pb.buf) * 8;
556 564
    s->total_bits += s->frame_bits;
565
    avctx->frame_bits  = s->frame_bits;
566
//printf("fcode: %d, type: %d, head: %d, mv: %d, misc: %d, frame: %d, itex: %d, ptex: %d\n", 
567
//s->f_code, avctx->key_frame, s->header_bits, s->mv_bits, s->misc_bits, s->frame_bits, s->i_tex_bits, s->p_tex_bits);
557 568

  
558 569
    avctx->quality = s->qscale;
559 570
    if (avctx->get_psnr) {
......
1071 1082
    int mb_x, mb_y, wrap, last_gob, pdif = 0;
1072 1083
    UINT8 *ptr;
1073 1084
    int i, motion_x, motion_y;
1085
    int bits;
1074 1086

  
1075 1087
    s->picture_number = picture_number;
1076 1088

  
......
1134 1146

  
1135 1147
        for(i=MAX_FCODE; i>1; i--){
1136 1148
            loose+= mv_num[i];
1137
            if(loose > 4) break; //FIXME this is pretty ineffective
1149
            if(loose > 10) break; //FIXME this is pretty ineffective
1138 1150
        }
1139 1151
        s->f_code= i;
1140 1152
    }else{
......
1179 1191
        convert_matrix(s->q_non_intra_matrix, s->q_non_intra_matrix16, s->non_intra_matrix, s->qscale);
1180 1192
    }
1181 1193

  
1194
    s->last_bits= get_bit_count(&s->pb);
1182 1195
    switch(s->out_format) {
1183 1196
    case FMT_MJPEG:
1184 1197
        mjpeg_picture_header(s);
......
1197 1210
        mpeg1_encode_picture_header(s, picture_number);
1198 1211
        break;
1199 1212
    }
1200
        
1213
    bits= get_bit_count(&s->pb);
1214
    s->header_bits= bits - s->last_bits;
1215
    s->last_bits= bits;
1216
    s->mv_bits=0;
1217
    s->misc_bits=0;
1218
    s->i_tex_bits=0;
1219
    s->p_tex_bits=0;
1220
    s->i_count=0;
1221
    s->p_count=0;
1222
    s->skip_count=0;
1223

  
1201 1224
    /* init last dc values */
1202 1225
    /* note: quant matrix value (8) is implied here */
1203 1226
    s->last_dc[0] = 128;
......
1372 1395
                mjpeg_encode_mb(s, s->block);
1373 1396
                break;
1374 1397
            }
1375

  
1398
            
1376 1399
            /* decompress blocks so that we keep the state of the decoder */
1377 1400
            s->mv[0][0][0] = motion_x;
1378 1401
            s->mv[0][0][1] = motion_y;
......
1394 1417
            s->first_gob_line = 0;
1395 1418
        }
1396 1419
    }
1397
    
1420

  
1398 1421
    if (s->h263_msmpeg4 && s->pict_type == I_TYPE)
1399 1422
        msmpeg4_encode_ext_header(s);
1400 1423

  

Also available in: Unified diff