[Mplayer-dev-eng] Re: Dynamic Output Quality Patch, Take 2

Timothy B. Terriberry tterribe at vt.edu
Tue Jul 31 09:21:01 CEST 2001


Of course, immediately after I sent that, I noticed that decode_video()
was called in two places, and so that patch will not initialize
vdecode_time correctly. A new mplayer.c diff (still from the original
7/31 snapshot) is attached.
-------------- next part --------------
228c228,229
< int divx_quality=0;
---
> int divx_quality=-1;
> int output_quality;
387a389,390
> extern int get_video_quality_max(sh_video_t *sh_video);
> extern void set_video_quality(sh_video_t *sh_video,int quality);
878a882,887
> /*Set the initial video quality on codecs that support it.*/
> output_quality=get_video_quality_max(sh_video);
> if(divx_quality<0||divx_quality>output_quality)divx_quality=output_quality;
> else output_quality=divx_quality;
> set_video_quality(sh_video,output_quality);
> 
997c1006
< //float frame_correction=0; // average of A-V timestamp differences
---
> float frame_correction=0; // average of A-V timestamp differences
1007a1017,1019
> double cvideo_base_vtime;
> double cvideo_base_vframe;
> double vdecode_time;
1189a1202,1203
> cvideo_base_vframe=sh_video->timer;
> cvideo_base_vtime=video_time_usage;
1246a1261
>     vdecode_time=video_time_usage;
1247a1263
>     vdecode_time-=video_time_usage;
1289c1305
< 
---
>  
1367a1384
>   frame_correction=0;
1404c1421
<         float x=(a_pts-delay-audio_delay)-v_pts;
---
>         float x=frame_correction=(a_pts-delay-audio_delay)-v_pts;
1438a1456,1474
> 
>     /*Output quality adjustments:*/
>     /*If we took a long time decoding this frame, downgrade the quality.*/
>     if(output_quality>0&&
>        (video_time_usage-cvideo_base_vtime)*sh_video->timer>=
>        (0.95*sh_video->timer-(vout_time_usage+audio_time_usage))*
>        (sh_video->timer-cvideo_base_vframe-frame_correction)){
>      output_quality>>=1;
>      /*printf("Downgrading quality to %i.\n",output_quality);*/
>      set_video_quality(sh_video,output_quality);}
>     /*If we had plenty of extra time, upgrade the quality.*/
>     if(output_quality<divx_quality&&
>        vdecode_time<0.5*frame_time&&
>        (video_time_usage-cvideo_base_vtime)*sh_video->timer<
>        (0.67*sh_video->timer-(vout_time_usage+audio_time_usage))*
>        (sh_video->timer-cvideo_base_vframe-frame_correction)){
>      output_quality++;
>      /*printf("Upgrading quality to %i.\n",output_quality);*/
>      set_video_quality(sh_video,output_quality);}


More information about the MPlayer-dev-eng mailing list