comparison msmpeg4.c @ 1164:0e3c0c4a7b3d libavcodec

msmpeg4 2pass support & some related cleanup
author michaelni
date Wed, 02 Apr 2003 09:57:34 +0000
parents 0951691c4225
children fea03d2c4946
comparison
equal deleted inserted replaced
1163:0951691c4225 1164:0e3c0c4a7b3d
547 cbp |= 1 << (5 - i); 547 cbp |= 1 << (5 - i);
548 } 548 }
549 if (s->use_skip_mb_code && (cbp | motion_x | motion_y) == 0) { 549 if (s->use_skip_mb_code && (cbp | motion_x | motion_y) == 0) {
550 /* skip macroblock */ 550 /* skip macroblock */
551 put_bits(&s->pb, 1, 1); 551 put_bits(&s->pb, 1, 1);
552 s->last_bits++;
553 s->misc_bits++;
554
552 return; 555 return;
553 } 556 }
554 if (s->use_skip_mb_code) 557 if (s->use_skip_mb_code)
555 put_bits(&s->pb, 1, 0); /* mb coded */ 558 put_bits(&s->pb, 1, 0); /* mb coded */
556 559
562 else coded_cbp= cbp; 565 else coded_cbp= cbp;
563 566
564 put_bits(&s->pb, 567 put_bits(&s->pb,
565 cbpy_tab[coded_cbp>>2][1], 568 cbpy_tab[coded_cbp>>2][1],
566 cbpy_tab[coded_cbp>>2][0]); 569 cbpy_tab[coded_cbp>>2][0]);
567 570
571 s->misc_bits += get_bits_diff(s);
572
568 h263_pred_motion(s, 0, &pred_x, &pred_y); 573 h263_pred_motion(s, 0, &pred_x, &pred_y);
569 msmpeg4v2_encode_motion(s, motion_x - pred_x); 574 msmpeg4v2_encode_motion(s, motion_x - pred_x);
570 msmpeg4v2_encode_motion(s, motion_y - pred_y); 575 msmpeg4v2_encode_motion(s, motion_y - pred_y);
571 }else{ 576 }else{
572 put_bits(&s->pb, 577 put_bits(&s->pb,
573 table_mb_non_intra[cbp + 64][1], 578 table_mb_non_intra[cbp + 64][1],
574 table_mb_non_intra[cbp + 64][0]); 579 table_mb_non_intra[cbp + 64][0]);
575 580
581 s->misc_bits += get_bits_diff(s);
582
576 /* motion vector */ 583 /* motion vector */
577 h263_pred_motion(s, 0, &pred_x, &pred_y); 584 h263_pred_motion(s, 0, &pred_x, &pred_y);
578 msmpeg4_encode_motion(s, motion_x - pred_x, 585 msmpeg4_encode_motion(s, motion_x - pred_x,
579 motion_y - pred_y); 586 motion_y - pred_y);
580 } 587 }
588
589 s->mv_bits += get_bits_diff(s);
590
591 for (i = 0; i < 6; i++) {
592 msmpeg4_encode_block(s, block[i], i);
593 }
594 s->p_tex_bits += get_bits_diff(s);
581 } else { 595 } else {
582 /* compute cbp */ 596 /* compute cbp */
583 cbp = 0; 597 cbp = 0;
584 coded_cbp = 0; 598 coded_cbp = 0;
585 for (i = 0; i < 6; i++) { 599 for (i = 0; i < 6; i++) {
631 if(s->inter_intra_pred){ 645 if(s->inter_intra_pred){
632 s->h263_aic_dir=0; 646 s->h263_aic_dir=0;
633 put_bits(&s->pb, table_inter_intra[s->h263_aic_dir][1], table_inter_intra[s->h263_aic_dir][0]); 647 put_bits(&s->pb, table_inter_intra[s->h263_aic_dir][1], table_inter_intra[s->h263_aic_dir][0]);
634 } 648 }
635 } 649 }
636 } 650 s->misc_bits += get_bits_diff(s);
637 651
638 for (i = 0; i < 6; i++) { 652 for (i = 0; i < 6; i++) {
639 msmpeg4_encode_block(s, block[i], i); 653 msmpeg4_encode_block(s, block[i], i);
654 }
655 s->i_tex_bits += get_bits_diff(s);
640 } 656 }
641 } 657 }
642 658
643 #endif //CONFIG_ENCODERS 659 #endif //CONFIG_ENCODERS
644 660