comparison h263.c @ 1505:010f76d07a27 libavcodec

use lagrange multipler instead of qp for ratecontrol, this may break some things, tell me ASAP if u notice anything broken quality which was 1..31 float is now a 1..FF_LAMBDA_MAX int, and FF_QP2LAMBDA * qp can be used to convert to the new range
author michaelni
date Tue, 07 Oct 2003 11:32:40 +0000
parents 3518325146fc
children e9f83c2323bf
comparison
equal deleted inserted replaced
1504:df7ab60d1ee0 1505:010f76d07a27
624 if(s->flags & CODEC_FLAG_CBP_RD){ 624 if(s->flags & CODEC_FLAG_CBP_RD){
625 int best_cbpy_score= INT_MAX; 625 int best_cbpy_score= INT_MAX;
626 int best_cbpc_score= INT_MAX; 626 int best_cbpc_score= INT_MAX;
627 int cbpc, cbpy; 627 int cbpc, cbpy;
628 const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0); 628 const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0);
629 const int lambda= (s->qscale*s->qscale*64*105 + 64)>>7; 629 const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
630 630
631 for(i=0; i<4; i++){ 631 for(i=0; i<4; i++){
632 int score= inter_MCBPC_bits[i + offset] * lambda; 632 int score= inter_MCBPC_bits[i + offset] * lambda;
633 if(i&1) score += s->coded_score[5]; 633 if(i&1) score += s->coded_score[5];
634 if(i&2) score += s->coded_score[4]; 634 if(i&2) score += s->coded_score[4];
677 int motion_x, int motion_y, int mb_type){ 677 int motion_x, int motion_y, int mb_type){
678 int cbp=0, i; 678 int cbp=0, i;
679 679
680 if(s->flags & CODEC_FLAG_CBP_RD){ 680 if(s->flags & CODEC_FLAG_CBP_RD){
681 int score=0; 681 int score=0;
682 const int lambda= (s->qscale*s->qscale*64*105 + 64)>>7; 682 const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
683 683
684 for(i=0; i<6; i++){ 684 for(i=0; i<6; i++){
685 if(s->coded_score[i] < 0){ 685 if(s->coded_score[i] < 0){
686 score += s->coded_score[i]; 686 score += s->coded_score[i];
687 cbp |= 1 << (5 - i); 687 cbp |= 1 << (5 - i);