comparison libmpcodecs/vd_xvid4.c @ 29263:0f1b5b68af32

whitespace cosmetics: Remove all trailing whitespace.
author diego
date Wed, 13 May 2009 02:58:57 +0000
parents a365271c97a5
children cc27da5d7286
comparison
equal deleted inserted replaced
29262:7d545a6b8aff 29263:0f1b5b68af32
101 priv_t* p; 101 priv_t* p;
102 int cs; 102 int cs;
103 103
104 memset(&xvid_gbl_info, 0, sizeof(xvid_gbl_info_t)); 104 memset(&xvid_gbl_info, 0, sizeof(xvid_gbl_info_t));
105 xvid_gbl_info.version = XVID_VERSION; 105 xvid_gbl_info.version = XVID_VERSION;
106 106
107 memset(&xvid_ini, 0, sizeof(xvid_gbl_init_t)); 107 memset(&xvid_ini, 0, sizeof(xvid_gbl_init_t));
108 xvid_ini.version = XVID_VERSION; 108 xvid_ini.version = XVID_VERSION;
109 109
110 memset(&dec_p, 0, sizeof(xvid_dec_create_t)); 110 memset(&dec_p, 0, sizeof(xvid_dec_create_t));
111 dec_p.version = XVID_VERSION; 111 dec_p.version = XVID_VERSION;
112 112
113 113
114 switch(sh->codec->outfmt[sh->outfmtidx]){ 114 switch(sh->codec->outfmt[sh->outfmtidx]){
121 cs = XVID_CSP_YUY2; 121 cs = XVID_CSP_YUY2;
122 break; 122 break;
123 case IMGFMT_UYVY: 123 case IMGFMT_UYVY:
124 cs = XVID_CSP_UYVY; 124 cs = XVID_CSP_UYVY;
125 break; 125 break;
126 case IMGFMT_I420: 126 case IMGFMT_I420:
127 case IMGFMT_IYUV: 127 case IMGFMT_IYUV:
128 /* We will use our own buffers, this speeds decoding avoiding 128 /* We will use our own buffers, this speeds decoding avoiding
129 * frame memcpy's overhead */ 129 * frame memcpy's overhead */
130 cs = (do_dr2)?XVID_CSP_INTERNAL:XVID_CSP_USER; 130 cs = (do_dr2)?XVID_CSP_INTERNAL:XVID_CSP_USER;
131 break; 131 break;
132 case IMGFMT_BGR15: 132 case IMGFMT_BGR15:
133 cs = XVID_CSP_RGB555; 133 cs = XVID_CSP_RGB555;
134 break; 134 break;
135 case IMGFMT_BGR16: 135 case IMGFMT_BGR16:
136 cs = XVID_CSP_RGB565; 136 cs = XVID_CSP_RGB565;
137 break; 137 break;
138 case IMGFMT_BGR32: 138 case IMGFMT_BGR32:
139 cs = XVID_CSP_BGRA; 139 cs = XVID_CSP_BGRA;
140 break; 140 break;
155 XVID_VERSION_MAJOR(xvid_gbl_info.actual_version), 155 XVID_VERSION_MAJOR(xvid_gbl_info.actual_version),
156 XVID_VERSION_MINOR(xvid_gbl_info.actual_version), 156 XVID_VERSION_MINOR(xvid_gbl_info.actual_version),
157 XVID_VERSION_PATCH(xvid_gbl_info.actual_version), 157 XVID_VERSION_PATCH(xvid_gbl_info.actual_version),
158 xvid_gbl_info.build); 158 xvid_gbl_info.build);
159 } 159 }
160 160
161 /* Initialize the xvidcore library */ 161 /* Initialize the xvidcore library */
162 if(xvid_global(NULL, XVID_GBL_INIT, &xvid_ini, NULL)) 162 if(xvid_global(NULL, XVID_GBL_INIT, &xvid_ini, NULL))
163 return 0; 163 return 0;
164 164
165 /* We use 0 width and height so xvidcore will resize its buffers 165 /* We use 0 width and height so xvidcore will resize its buffers
239 | (chromadeblock ? XVID_DEBLOCKUV : 0 ); 239 | (chromadeblock ? XVID_DEBLOCKUV : 0 );
240 #if XVID_API >= XVID_MAKE_API(4,1) 240 #if XVID_API >= XVID_MAKE_API(4,1)
241 dec.general |= (lumadering ? XVID_DEBLOCKY|XVID_DERINGY : 0 ); 241 dec.general |= (lumadering ? XVID_DEBLOCKY|XVID_DERINGY : 0 );
242 dec.general |= (chromadering ? XVID_DEBLOCKUV|XVID_DERINGUV : 0 ); 242 dec.general |= (chromadering ? XVID_DEBLOCKUV|XVID_DERINGUV : 0 );
243 #endif 243 #endif
244 dec.output.csp = p->cs; 244 dec.output.csp = p->cs;
245 245
246 /* Decoding loop because xvidcore may return VOL information for 246 /* Decoding loop because xvidcore may return VOL information for
247 * on the fly buffer resizing. In that case we must decode VOL, 247 * on the fly buffer resizing. In that case we must decode VOL,
248 * init VO, then decode the frame */ 248 * init VO, then decode the frame */
249 do { 249 do {
254 * is initialized and we can obviously output something */ 254 * is initialized and we can obviously output something */
255 if (p->vo_initialized) { 255 if (p->vo_initialized) {
256 mpi = mpcodecs_get_image(sh, p->img_type, 256 mpi = mpcodecs_get_image(sh, p->img_type,
257 MP_IMGFLAG_ACCEPT_STRIDE, 257 MP_IMGFLAG_ACCEPT_STRIDE,
258 sh->disp_w, sh->disp_h); 258 sh->disp_w, sh->disp_h);
259 259
260 if(p->cs != XVID_CSP_INTERNAL) { 260 if(p->cs != XVID_CSP_INTERNAL) {
261 dec.output.plane[0] = mpi->planes[0]; 261 dec.output.plane[0] = mpi->planes[0];
262 dec.output.plane[1] = mpi->planes[1]; 262 dec.output.plane[1] = mpi->planes[1];
263 dec.output.plane[2] = mpi->planes[2]; 263 dec.output.plane[2] = mpi->planes[2];
264 264
265 dec.output.stride[0] = mpi->stride[0]; 265 dec.output.stride[0] = mpi->stride[0];
266 dec.output.stride[1] = mpi->stride[1]; 266 dec.output.stride[1] = mpi->stride[1];
267 dec.output.stride[2] = mpi->stride[2]; 267 dec.output.stride[2] = mpi->stride[2];
268 } 268 }
269 } 269 }
270 270
271 /* Decode data */ 271 /* Decode data */
272 consumed = xvid_decore(p->hdl, XVID_DEC_DECODE, &dec, &stats); 272 consumed = xvid_decore(p->hdl, XVID_DEC_DECODE, &dec, &stats);
273 if (consumed < 0) { 273 if (consumed < 0) {
274 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Decoding error\n"); 274 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Decoding error\n");
275 return NULL; 275 return NULL;
279 * yet then do it now */ 279 * yet then do it now */
280 if (stats.type == XVID_TYPE_VOL && !p->vo_initialized) { 280 if (stats.type == XVID_TYPE_VOL && !p->vo_initialized) {
281 sh->aspect = stats2aspect(&stats); 281 sh->aspect = stats2aspect(&stats);
282 if(!mpcodecs_config_vo(sh, stats.data.vol.width, stats.data.vol.height, IMGFMT_YV12)) 282 if(!mpcodecs_config_vo(sh, stats.data.vol.width, stats.data.vol.height, IMGFMT_YV12))
283 return NULL; 283 return NULL;
284 284
285 /* Don't take this path twice */ 285 /* Don't take this path twice */
286 p->vo_initialized = !p->vo_initialized; 286 p->vo_initialized = !p->vo_initialized;
287 } 287 }
288 288
289 /* Don't forget to update buffer position and buffer length */ 289 /* Don't forget to update buffer position and buffer length */
292 } while ((stats.type == XVID_TYPE_VOL || stats.type == XVID_TYPE_NOTHING) && dec.length > 0); 292 } while ((stats.type == XVID_TYPE_VOL || stats.type == XVID_TYPE_NOTHING) && dec.length > 0);
293 293
294 /* There are two ways to get out of the decoding loop: 294 /* There are two ways to get out of the decoding loop:
295 * - a frame has been returned 295 * - a frame has been returned
296 * - no more data in buffer and no frames returned */ 296 * - no more data in buffer and no frames returned */
297 297
298 /* If mpi is NULL, it proves nothing has been returned by the decoder 298 /* If mpi is NULL, it proves nothing has been returned by the decoder
299 * so don't try to display internal buffers. */ 299 * so don't try to display internal buffers. */
300 if (mpi != NULL && p->cs == XVID_CSP_INTERNAL) { 300 if (mpi != NULL && p->cs == XVID_CSP_INTERNAL) {
301 mpi->planes[0] = dec.output.plane[0]; 301 mpi->planes[0] = dec.output.plane[0];
302 mpi->planes[1] = dec.output.plane[1]; 302 mpi->planes[1] = dec.output.plane[1];
322 { 322 {
323 if (stats->type == XVID_TYPE_VOL) { 323 if (stats->type == XVID_TYPE_VOL) {
324 float wpar; 324 float wpar;
325 float hpar; 325 float hpar;
326 float dar; 326 float dar;
327 327
328 /* MPEG4 strem stores PAR (Pixel Aspect Ratio), mplayer uses 328 /* MPEG4 strem stores PAR (Pixel Aspect Ratio), mplayer uses
329 * DAR (Display Aspect Ratio) 329 * DAR (Display Aspect Ratio)
330 * 330 *
331 * Both are related thanks to the equation: 331 * Both are related thanks to the equation:
332 * width 332 * width
333 * DAR = ----- x PAR 333 * DAR = ----- x PAR
334 * height 334 * height
335 * 335 *
336 * As MPEG4 is so well designed (*cough*), VOL header carries 336 * As MPEG4 is so well designed (*cough*), VOL header carries
337 * both informations together -- lucky eh ? */ 337 * both informations together -- lucky eh ? */
376 376
377 /***************************************************************************** 377 /*****************************************************************************
378 * Module structure definition 378 * Module structure definition
379 ****************************************************************************/ 379 ****************************************************************************/
380 380
381 static vd_info_t info = 381 static vd_info_t info =
382 { 382 {
383 "XviD 1.0 decoder", 383 "XviD 1.0 decoder",
384 "xvid", 384 "xvid",
385 "Marco Belli <elcabesa@inwind.it>, Edouard Gomez <ed.gomez@free.fr>", 385 "Marco Belli <elcabesa@inwind.it>, Edouard Gomez <ed.gomez@free.fr>",
386 "Marco Belli <elcabesa@inwind.it>, Edouard Gomez <ed.gomez@free.fr>", 386 "Marco Belli <elcabesa@inwind.it>, Edouard Gomez <ed.gomez@free.fr>",