comparison libvo/vo_dxr3.c @ 3629:a9d1ee93d1c9

Removed some old libavcodec code which would cause inproper scaling of some movies...
author mswitch
date Thu, 20 Dec 2001 07:40:30 +0000
parents 1b95a1467cc0
children f24527fc1b79
comparison
equal deleted inserted replaced
3628:eaa34a4ae1c0 3629:a9d1ee93d1c9
48 static unsigned char *picture_data[3]; 48 static unsigned char *picture_data[3];
49 static unsigned int picture_linesize[3]; 49 static unsigned int picture_linesize[3];
50 50
51 static int v_width,v_height; 51 static int v_width,v_height;
52 static int s_width,s_height; 52 static int s_width,s_height;
53 static int c_width,c_height;
54 static int s_pos_x,s_pos_y; 53 static int s_pos_x,s_pos_y;
55 static int d_pos_x,d_pos_y; 54 static int d_pos_x,d_pos_y;
56 static int osd_w,osd_h; 55 static int osd_w,osd_h;
57 56
58 static int img_format = 0; 57 static int img_format = 0;
130 { 129 {
131 printf( "VO: [dxr3] Unable to initialize MP1E!\n" ); 130 printf( "VO: [dxr3] Unable to initialize MP1E!\n" );
132 return -1; 131 return -1;
133 } 132 }
134 133
135 if(width<=352 && height<=288){ 134 s_width = (scr_width+15)/16; s_width*=16;
136 c_width=352; 135 s_height = (scr_height+15)/16; s_height*=16;
137 c_height=288; 136
138 } else 137 mp1e_context = rte_context_new( s_width, s_height, NULL );
139 if(width<=352 && height<=576){
140 c_width=352;
141 c_height=576;
142 } else
143 if(width<=480 && height<=576){
144 c_width=480;
145 c_height=576;
146 } else
147 if(width<=544 && height<=576){
148 c_width=544;
149 c_height=576;
150 } else {
151 c_width=704;
152 c_height=576;
153 }
154
155 mp1e_context = rte_context_new( c_width, c_height, NULL );
156 rte_set_verbosity( mp1e_context, 0 ); 138 rte_set_verbosity( mp1e_context, 0 );
157 139
158 printf( "VO: [dxr3] %dx%d => %dx%d\n", v_width, v_height, c_width, c_height ); 140 printf( "VO: [dxr3] %dx%d => %dx%d\n", v_width, v_height, s_width, s_height );
159 141
160 if( !mp1e_context ) 142 if( !mp1e_context )
161 { 143 {
162 printf( "VO: [dxr3] Unable to create context!\n" ); 144 printf( "VO: [dxr3] Unable to create context!\n" );
163 return -1; 145 return -1;
199 printf( "VO: [dxr3] Unable to init mp1e context!\n" ); 181 printf( "VO: [dxr3] Unable to init mp1e context!\n" );
200 rte_context_delete( mp1e_context ); 182 rte_context_delete( mp1e_context );
201 return -1; 183 return -1;
202 } 184 }
203 185
204 osd_w=scr_width; 186 osd_w=s_width;
205 d_pos_x=(c_width-(int)scr_width)/2; 187 d_pos_x=(s_width-v_width)/2;
206 if(d_pos_x<0) 188 if(d_pos_x<0)
207 { 189 {
208 s_pos_x=-d_pos_x;d_pos_x=0; 190 s_pos_x=-d_pos_x;d_pos_x=0;
209 osd_w=c_width; 191 osd_w=s_width;
210 } else s_pos_x=0; 192 } else s_pos_x=0;
211 193
212 osd_h=scr_height; 194 osd_h=s_height;
213 d_pos_y=(c_height-(int)scr_height)/2; 195 d_pos_y=(s_height-v_height)/2;
214 if(d_pos_y<0) 196 if(d_pos_y<0)
215 { 197 {
216 s_pos_y=-d_pos_y;d_pos_y=0; 198 s_pos_y=-d_pos_y;d_pos_y=0;
217 osd_h=c_height; 199 osd_h=s_height;
218 } else s_pos_y=0; 200 } else s_pos_y=0;
219 201
220 printf("VO: [dxr3] Position mapping: %d;%d => %d;%d\n",s_pos_x,s_pos_y,d_pos_x,d_pos_y); 202 printf("VO: [dxr3] Position mapping: %d;%d => %d;%d\n",s_pos_x,s_pos_y,d_pos_x,d_pos_y);
221 203
222 size = c_width*c_height; 204 size = s_width*s_height;
223 205
224 picture_data[0] = malloc((size * 3)/2); 206 picture_data[0] = malloc((size * 3)/2);
225 picture_data[1] = picture_data[0] + size; 207 picture_data[1] = picture_data[0] + size;
226 picture_data[2] = picture_data[1] + size / 4; 208 picture_data[2] = picture_data[1] + size / 4;
227 picture_linesize[0] = c_width; 209 picture_linesize[0] = s_width;
228 picture_linesize[1] = c_width / 2; 210 picture_linesize[1] = s_width / 2;
229 picture_linesize[2] = c_width / 2; 211 picture_linesize[2] = s_width / 2;
230 212
231 // Set the border colorwou 213 // Set the border colorwou
232 RGBTOYUV(0,0,0) 214 RGBTOYUV(0,0,0)
233 memset( picture_data[0], YUV_s.Y, picture_linesize[0]*c_height ); 215 memset( picture_data[0], YUV_s.Y, picture_linesize[0]*s_height );
234 memset( picture_data[1], YUV_s.U, picture_linesize[1]*(c_height/2) ); 216 memset( picture_data[1], YUV_s.U, picture_linesize[1]*(s_height/2) );
235 memset( picture_data[2], YUV_s.V, picture_linesize[2]*(c_height/2) ); 217 memset( picture_data[2], YUV_s.V, picture_linesize[2]*(s_height/2) );
236 218
237 if( !rte_start_encoding( mp1e_context ) ) 219 if( !rte_start_encoding( mp1e_context ) )
238 { 220 {
239 printf( "VO: [dxr3] Unable to start mp1e encoding!\n" ); 221 printf( "VO: [dxr3] Unable to start mp1e encoding!\n" );
240 uninit(); 222 uninit();
288 { 270 {
289 int w=v_width,h=v_height; 271 int w=v_width,h=v_height;
290 unsigned char *s,*dY,*dU,*dV; 272 unsigned char *s,*dY,*dU,*dV;
291 273
292 if(d_pos_x+w>picture_linesize[0]) w=picture_linesize[0]-d_pos_x; 274 if(d_pos_x+w>picture_linesize[0]) w=picture_linesize[0]-d_pos_x;
293 if(d_pos_y+h>c_height) h=c_height-d_pos_y; 275 if(d_pos_y+h>s_height) h=s_height-d_pos_y;
294 276
295 s = src[0]+s_pos_x+s_pos_y*(w*2); 277 s = src[0]+s_pos_x+s_pos_y*(w*2);
296 dY = picture_data[0]+d_pos_x+d_pos_y*picture_linesize[0]; 278 dY = picture_data[0]+d_pos_x+d_pos_y*picture_linesize[0];
297 dU = picture_data[1]+(d_pos_x/2)+(d_pos_y/2)*picture_linesize[1]; 279 dU = picture_data[1]+(d_pos_x/2)+(d_pos_y/2)*picture_linesize[1];
298 dV = picture_data[2]+(d_pos_x/2)+(d_pos_y/2)*picture_linesize[2]; 280 dV = picture_data[2]+(d_pos_x/2)+(d_pos_y/2)*picture_linesize[2];
309 { 291 {
310 int x,y,w=v_width,h=v_height; 292 int x,y,w=v_width,h=v_height;
311 unsigned char *s,*dY,*dU,*dV; 293 unsigned char *s,*dY,*dU,*dV;
312 294
313 if(d_pos_x+w>picture_linesize[0]) w=picture_linesize[0]-d_pos_x; 295 if(d_pos_x+w>picture_linesize[0]) w=picture_linesize[0]-d_pos_x;
314 if(d_pos_y+h>c_height) h=c_height-d_pos_y; 296 if(d_pos_y+h>s_height) h=s_height-d_pos_y;
315 297
316 s = src[0]+s_pos_y*(w*3); 298 s = src[0]+s_pos_y*(w*3);
317 299
318 dY = picture_data[0]+d_pos_y*picture_linesize[0]; 300 dY = picture_data[0]+d_pos_y*picture_linesize[0];
319 dU = picture_data[1]+(d_pos_y/2)*picture_linesize[1]; 301 dU = picture_data[1]+(d_pos_y/2)*picture_linesize[1];
381 363
382 x0+=d_pos_x; 364 x0+=d_pos_x;
383 y0+=d_pos_y; 365 y0+=d_pos_y;
384 366
385 if(x0+w>picture_linesize[0]) w=picture_linesize[0]-x0; 367 if(x0+w>picture_linesize[0]) w=picture_linesize[0]-x0;
386 if(y0+h>c_height) h=c_height-y0; 368 if(y0+h>s_height) h=s_height-y0;
387 369
388 s=srcimg[0]+s_pos_x+s_pos_y*stride[0]; 370 s=srcimg[0]+s_pos_x+s_pos_y*stride[0];
389 d=picture_data[0]+x0+y0*picture_linesize[0]; 371 d=picture_data[0]+x0+y0*picture_linesize[0];
390 for(y=0;y<h;y++) 372 for(y=0;y<h;y++)
391 { 373 {