comparison libvo/aspect.c @ 2071:7f27b212e07b

Add debug printfs to aspect(), add aspect() usage to vo_sdl.
author atmos4
date Thu, 04 Oct 2001 11:42:21 +0000
parents b840d0913383
children a98d5300f5e9
comparison
equal deleted inserted replaced
2070:c1edbb8bfc0c 2071:7f27b212e07b
1 /* Stuff for correct aspect scaling. */ 1 /* Stuff for correct aspect scaling. */
2 #undef ASPECT_DEBUG
3
4 #ifdef ASPECT_DEBUG
5 #include <stdio.h>
6 #endif
2 7
3 float monitor_aspect=4.0/3.0; 8 float monitor_aspect=4.0/3.0;
4 9
5 /* aspect is called with the source resolution and the 10 /* aspect is called with the source resolution and the
6 * resolution, that the scaled image should fit into 11 * resolution, that the scaled image should fit into
8 13
9 void aspect(int *srcw, int *srch, int fitinw, int fitinh){ 14 void aspect(int *srcw, int *srch, int fitinw, int fitinh){
10 int srcwcp, srchcp; 15 int srcwcp, srchcp;
11 srcwcp=*srcw; srchcp=*srch; 16 srcwcp=*srcw; srchcp=*srch;
12 srcwcp=fitinw; 17 srcwcp=fitinw;
18 #ifdef ASPECT_DEBUG
19 printf("aspect(0) fitin: %dx%d \n",fitinw,fitinh);
20 printf("aspect(1) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
21 #endif
13 srchcp=(int)(((float)fitinw / (float)*srcw * (float)*srch) 22 srchcp=(int)(((float)fitinw / (float)*srcw * (float)*srch)
14 * ((float)fitinh/((float)fitinw/monitor_aspect))); 23 * ((float)fitinh / ((float)fitinw / monitor_aspect)));
15 srchcp+=srchcp%2; // round 24 srchcp+=srchcp%2; // round
16 //printf("aspect rez wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch); 25 #ifdef ASPECT_DEBUG
26 printf("aspect(2) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
27 #endif
17 if(srchcp>fitinh || srchcp<*srch){ 28 if(srchcp>fitinh || srchcp<*srch){
18 srchcp=fitinh; 29 srchcp=fitinh;
19 srcwcp=(int)(((float)fitinh / (float)*srch * (float)*srcw) 30 srcwcp=(int)(((float)fitinh / (float)*srch * (float)*srcw)
20 * ((float)fitinw/((float)fitinh/(1/monitor_aspect)))); 31 * ((float)fitinw / ((float)fitinh / (1/monitor_aspect))));
21 srcwcp+=srcwcp%2; // round 32 srcwcp+=srcwcp%2; // round
22 } 33 }
23 //printf("aspect ret wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch); 34 #ifdef ASPECT_DEBUG
35 printf("aspect(3) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
36 #endif
24 *srcw=srcwcp; *srch=srchcp; 37 *srcw=srcwcp; *srch=srchcp;
38 #ifdef ASPECT_DEBUG
39 printf("aspect(4) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
40 #endif
25 } 41 }
26 42