comparison mpegvideo_enc.c @ 6719:e88e719b5e77 libavcodec

Typo: distoration -> distortion.
author ramiro
date Tue, 29 Apr 2008 14:08:01 +0000
parents 5df0c730234d
children e1302edb0f69
comparison
equal deleted inserted replaced
6718:c9579699437a 6719:e88e719b5e77
2740 if(ENABLE_MPEG4_ENCODER && s->codec_id == CODEC_ID_MPEG4) 2740 if(ENABLE_MPEG4_ENCODER && s->codec_id == CODEC_ID_MPEG4)
2741 ff_set_mpeg4_time(s); 2741 ff_set_mpeg4_time(s);
2742 2742
2743 s->me.scene_change_score=0; 2743 s->me.scene_change_score=0;
2744 2744
2745 // s->lambda= s->current_picture_ptr->quality; //FIXME qscale / ... stuff for ME ratedistoration 2745 // s->lambda= s->current_picture_ptr->quality; //FIXME qscale / ... stuff for ME rate distortion
2746 2746
2747 if(s->pict_type==FF_I_TYPE){ 2747 if(s->pict_type==FF_I_TYPE){
2748 if(s->msmpeg4_version >= 3) s->no_rounding=1; 2748 if(s->msmpeg4_version >= 3) s->no_rounding=1;
2749 else s->no_rounding=0; 2749 else s->no_rounding=0;
2750 }else if(s->pict_type!=FF_B_TYPE){ 2750 }else if(s->pict_type!=FF_B_TYPE){
3076 score_tab[start_i]= 0; 3076 score_tab[start_i]= 0;
3077 survivor[0]= start_i; 3077 survivor[0]= start_i;
3078 survivor_count= 1; 3078 survivor_count= 1;
3079 3079
3080 for(i=start_i; i<=last_non_zero; i++){ 3080 for(i=start_i; i<=last_non_zero; i++){
3081 int level_index, j, zero_distoration; 3081 int level_index, j, zero_distortion;
3082 int dct_coeff= FFABS(block[ scantable[i] ]); 3082 int dct_coeff= FFABS(block[ scantable[i] ]);
3083 int best_score=256*256*256*120; 3083 int best_score=256*256*256*120;
3084 3084
3085 if ( s->dsp.fdct == fdct_ifast 3085 if ( s->dsp.fdct == fdct_ifast
3086 #ifndef FAAN_POSTSCALE 3086 #ifndef FAAN_POSTSCALE
3087 || s->dsp.fdct == ff_faandct 3087 || s->dsp.fdct == ff_faandct
3088 #endif 3088 #endif
3089 ) 3089 )
3090 dct_coeff= (dct_coeff*inv_aanscales[ scantable[i] ]) >> 12; 3090 dct_coeff= (dct_coeff*inv_aanscales[ scantable[i] ]) >> 12;
3091 zero_distoration= dct_coeff*dct_coeff; 3091 zero_distortion= dct_coeff*dct_coeff;
3092 3092
3093 for(level_index=0; level_index < coeff_count[i]; level_index++){ 3093 for(level_index=0; level_index < coeff_count[i]; level_index++){
3094 int distoration; 3094 int distortion;
3095 int level= coeff[level_index][i]; 3095 int level= coeff[level_index][i];
3096 const int alevel= FFABS(level); 3096 const int alevel= FFABS(level);
3097 int unquant_coeff; 3097 int unquant_coeff;
3098 3098
3099 assert(level); 3099 assert(level);
3110 unquant_coeff = (unquant_coeff - 1) | 1; 3110 unquant_coeff = (unquant_coeff - 1) | 1;
3111 } 3111 }
3112 unquant_coeff<<= 3; 3112 unquant_coeff<<= 3;
3113 } 3113 }
3114 3114
3115 distoration= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distoration; 3115 distortion= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distortion;
3116 level+=64; 3116 level+=64;
3117 if((level&(~127)) == 0){ 3117 if((level&(~127)) == 0){
3118 for(j=survivor_count-1; j>=0; j--){ 3118 for(j=survivor_count-1; j>=0; j--){
3119 int run= i - survivor[j]; 3119 int run= i - survivor[j];
3120 int score= distoration + length[UNI_AC_ENC_INDEX(run, level)]*lambda; 3120 int score= distortion + length[UNI_AC_ENC_INDEX(run, level)]*lambda;
3121 score += score_tab[i-run]; 3121 score += score_tab[i-run];
3122 3122
3123 if(score < best_score){ 3123 if(score < best_score){
3124 best_score= score; 3124 best_score= score;
3125 run_tab[i+1]= run; 3125 run_tab[i+1]= run;
3128 } 3128 }
3129 3129
3130 if(s->out_format == FMT_H263){ 3130 if(s->out_format == FMT_H263){
3131 for(j=survivor_count-1; j>=0; j--){ 3131 for(j=survivor_count-1; j>=0; j--){
3132 int run= i - survivor[j]; 3132 int run= i - survivor[j];
3133 int score= distoration + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda; 3133 int score= distortion + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda;
3134 score += score_tab[i-run]; 3134 score += score_tab[i-run];
3135 if(score < last_score){ 3135 if(score < last_score){
3136 last_score= score; 3136 last_score= score;
3137 last_run= run; 3137 last_run= run;
3138 last_level= level-64; 3138 last_level= level-64;
3139 last_i= i+1; 3139 last_i= i+1;
3140 } 3140 }
3141 } 3141 }
3142 } 3142 }
3143 }else{ 3143 }else{
3144 distoration += esc_length*lambda; 3144 distortion += esc_length*lambda;
3145 for(j=survivor_count-1; j>=0; j--){ 3145 for(j=survivor_count-1; j>=0; j--){
3146 int run= i - survivor[j]; 3146 int run= i - survivor[j];
3147 int score= distoration + score_tab[i-run]; 3147 int score= distortion + score_tab[i-run];
3148 3148
3149 if(score < best_score){ 3149 if(score < best_score){
3150 best_score= score; 3150 best_score= score;
3151 run_tab[i+1]= run; 3151 run_tab[i+1]= run;
3152 level_tab[i+1]= level-64; 3152 level_tab[i+1]= level-64;
3154 } 3154 }
3155 3155
3156 if(s->out_format == FMT_H263){ 3156 if(s->out_format == FMT_H263){
3157 for(j=survivor_count-1; j>=0; j--){ 3157 for(j=survivor_count-1; j>=0; j--){
3158 int run= i - survivor[j]; 3158 int run= i - survivor[j];
3159 int score= distoration + score_tab[i-run]; 3159 int score= distortion + score_tab[i-run];
3160 if(score < last_score){ 3160 if(score < last_score){
3161 last_score= score; 3161 last_score= score;
3162 last_run= run; 3162 last_run= run;
3163 last_level= level-64; 3163 last_level= level-64;
3164 last_i= i+1; 3164 last_i= i+1;