comparison libvo/aspect.c @ 2213:a98d5300f5e9

Add downscaling as a last resort.
author atmos4
date Mon, 15 Oct 2001 17:22:41 +0000
parents 7f27b212e07b
children 48f0ac1e9d13
comparison
equal deleted inserted replaced
2212:f0f681ef92ff 2213:a98d5300f5e9
1 /* Stuff for correct aspect scaling. */ 1 /* Stuff for correct aspect scaling. */
2 #undef ASPECT_DEBUG 2 //#define ASPECT_DEBUG
3 3
4 #ifdef ASPECT_DEBUG 4 #ifdef ASPECT_DEBUG
5 #include <stdio.h> 5 #include <stdio.h>
6 #endif 6 #endif
7 7
10 /* aspect is called with the source resolution and the 10 /* aspect is called with the source resolution and the
11 * resolution, that the scaled image should fit into 11 * resolution, that the scaled image should fit into
12 */ 12 */
13 13
14 void aspect(int *srcw, int *srch, int fitinw, int fitinh){ 14 void aspect(int *srcw, int *srch, int fitinw, int fitinh){
15 int srcwcp, srchcp; 15 int srcwcp, srchcp, tmp;
16 srcwcp=*srcw; srchcp=*srch; 16 srcwcp=*srcw; srchcp=*srch;
17 srcwcp=fitinw; 17 srcwcp=fitinw;
18 #ifdef ASPECT_DEBUG 18 #ifdef ASPECT_DEBUG
19 printf("aspect(0) fitin: %dx%d \n",fitinw,fitinh); 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); 20 printf("aspect(1) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
24 srchcp+=srchcp%2; // round 24 srchcp+=srchcp%2; // round
25 #ifdef ASPECT_DEBUG 25 #ifdef ASPECT_DEBUG
26 printf("aspect(2) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch); 26 printf("aspect(2) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
27 #endif 27 #endif
28 if(srchcp>fitinh || srchcp<*srch){ 28 if(srchcp>fitinh || srchcp<*srch){
29 srchcp=fitinh; 29 tmp=(int)(((float)fitinh / (float)*srch * (float)*srcw)
30 srcwcp=(int)(((float)fitinh / (float)*srch * (float)*srcw) 30 * ((float)fitinw / ((float)fitinh / (1/monitor_aspect))));
31 * ((float)fitinw / ((float)fitinh / (1/monitor_aspect)))); 31 if(srcwcp>fitinw){
32 srcwcp+=srcwcp%2; // round 32 srchcp=fitinh;
33 srcwcp=tmp;
34 srcwcp+=srcwcp%2; // round
35 }
33 } 36 }
34 #ifdef ASPECT_DEBUG 37 #ifdef ASPECT_DEBUG
35 printf("aspect(3) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch); 38 printf("aspect(3) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
36 #endif 39 #endif
37 *srcw=srcwcp; *srch=srchcp; 40 *srcw=srcwcp; *srch=srchcp;