1 /*****************************************************************************
2 * xxmc.c : HW MPEG decoder thread
3 *****************************************************************************
4 * Copyright (C) 2000-2001 VideoLAN
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Laurent Aimar <fenrir@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
30 #include <vlc_codec.h>
31 #include <vlc_vout_synchro.h>
37 #include "attributes.h"
38 #include "mpeg2_internal.h"
41 /* Aspect ratio (ISO/IEC 13818-2 section 6.3.3, table 6-3) */
42 #define AR_SQUARE_PICTURE 1 /* square pixels */
43 #define AR_3_4_PICTURE 2 /* 3:4 picture (TV) */
44 #define AR_16_9_PICTURE 3 /* 16:9 picture (wide screen) */
45 #define AR_221_1_PICTURE 4 /* 2.21:1 picture (movie) */
47 /*****************************************************************************
48 * decoder_sys_t : libmpeg2 decoder descriptor
49 *****************************************************************************/
55 mpeg2dec_t *p_mpeg2dec;
56 const mpeg2_info_t *p_info;
63 mtime_t i_previous_pts;
64 mtime_t i_current_pts;
65 mtime_t i_previous_dts;
66 mtime_t i_current_dts;
68 picture_t * p_picture_to_destroy;
69 vlc_bool_t b_garbage_pic;
70 vlc_bool_t b_after_sequence_header; /* is it the next frame after
71 * the sequence header ? */
72 vlc_bool_t b_slice_i; /* intra-slice refresh stream */
77 vout_synchro_t *p_synchro;
79 mtime_t i_last_frame_pts;
83 /*****************************************************************************
85 *****************************************************************************/
87 static int OpenDecoder( vlc_object_t * );
88 static void CloseDecoder( vlc_object_t * );
90 static picture_t *DecodeBlock( decoder_t *, block_t ** );
92 static picture_t *GetNewPicture( decoder_t *, uint8_t ** );
94 /*****************************************************************************
96 *****************************************************************************/
98 set_description( _("MPEG I/II hw video decoder (using libmpeg2)") );
99 set_capability( "decoder", 160 );
100 set_callbacks( OpenDecoder, CloseDecoder );
101 add_shortcut( "xxmc" );
104 /*****************************************************************************
105 * OpenDecoder: probe the decoder and return score
106 *****************************************************************************/
107 static int OpenDecoder( vlc_object_t *p_this )
110 decoder_t *p_dec = (decoder_t*)p_this;
111 decoder_sys_t *p_sys = NULL;
112 uint32_t i_accel = 0;
115 msg_Dbg(p_dec, "OpenDecoder Entering");
117 if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','v') &&
118 p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','1') &&
119 /* Pinnacle hardware-mpeg1 */
120 p_dec->fmt_in.i_codec != VLC_FOURCC('P','I','M','1') &&
121 /* VIA hardware-mpeg2 */
122 p_dec->fmt_in.i_codec != VLC_FOURCC('X','x','M','C') &&
124 p_dec->fmt_in.i_codec != VLC_FOURCC('V','C','R','2') &&
125 p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','2') )
130 /* Allocate the memory needed to store the decoder's structure */
131 p_dec->p_sys = p_sys = (decoder_sys_t *)malloc(sizeof(decoder_sys_t));
134 msg_Err( p_dec, "out of memory" );
138 /* Initialize the thread properties */
139 memset( p_sys, 0, sizeof(decoder_sys_t) );
140 p_sys->p_mpeg2dec = NULL;
141 p_sys->p_synchro = NULL;
142 p_sys->p_info = NULL;
143 p_sys->i_pts = mdate() + DEFAULT_PTS_DELAY;
144 p_sys->i_current_pts = 0;
145 p_sys->i_previous_pts = 0;
146 p_sys->i_current_dts = 0;
147 p_sys->i_previous_dts = 0;
148 p_sys->p_picture_to_destroy = NULL;
149 p_sys->b_garbage_pic = 0;
150 p_sys->b_slice_i = 0;
153 #if defined( __i386__ )
154 if( vlc_CPU() & CPU_CAPABILITY_MMX )
156 i_accel |= MPEG2_ACCEL_X86_MMX;
159 if( vlc_CPU() & CPU_CAPABILITY_3DNOW )
161 i_accel |= MPEG2_ACCEL_X86_3DNOW;
164 if( vlc_CPU() & CPU_CAPABILITY_MMXEXT )
166 i_accel |= MPEG2_ACCEL_X86_MMXEXT;
169 #elif defined( __powerpc__ ) || defined( SYS_DARWIN )
170 if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
172 i_accel |= MPEG2_ACCEL_PPC_ALTIVEC;
176 /* If we do not know this CPU, trust libmpeg2's feature detection */
177 i_accel = MPEG2_ACCEL_DETECT;
181 /* Set CPU acceleration features */
182 mpeg2_accel( i_accel );
184 /* Initialize decoder */
185 p_sys->p_mpeg2dec = mpeg2_init();
186 if( p_sys->p_mpeg2dec == NULL)
188 msg_Err( p_dec, "mpeg2_init() failed" );
193 p_sys->p_info = mpeg2_info( p_sys->p_mpeg2dec );
195 p_dec->pf_decode_video = DecodeBlock;
197 f_wd_dec = fopen("/vlc/dec_pid", "w");
199 if (f_wd_dec != NULL)
201 fprintf(f_wd_dec, "%d\n", getpid());
206 msg_Dbg(p_dec, "OpenDecoder Leaving");
210 static void WriteDecodeFile(int value)
214 f_wd_ok = fopen("/vlc/dec_ok", "w");
217 fprintf(f_wd_ok, "%d", value);
223 /*****************************************************************************
224 * RunDecoder: the libmpeg2 decoder
225 *****************************************************************************/
226 static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
228 decoder_sys_t *p_sys = p_dec->p_sys;
234 if( !pp_block || !*pp_block )
240 state = mpeg2_parse( p_sys->p_mpeg2dec );
244 if( !p_block->i_buffer )
246 block_Release( p_block );
249 if( (p_block->i_flags&BLOCK_FLAG_DISCONTINUITY) &&
251 p_sys->p_info->sequence &&
252 p_sys->p_info->sequence->width != (unsigned int)-1 )
254 vout_SynchroReset( p_sys->p_synchro );
255 if( p_sys->p_info->current_fbuf != NULL
256 && p_sys->p_info->current_fbuf->id != NULL )
258 p_sys->b_garbage_pic = 1;
259 p_pic = p_sys->p_info->current_fbuf->id;
264 buf[0] = buf[1] = buf[2] = NULL;
265 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
267 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
269 p_sys->p_picture_to_destroy = p_pic;
271 if ( p_sys->b_slice_i )
273 vout_SynchroNewPicture( p_sys->p_synchro,
274 I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
275 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
276 vout_SynchroDecode( p_sys->p_synchro );
277 vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
284 mpeg2_pts( p_sys->p_mpeg2dec, (uint32_t)p_block->i_pts );
286 #else /* New interface */
287 if( p_block->i_pts || p_block->i_dts )
289 mpeg2_tag_picture( p_sys->p_mpeg2dec,
290 (uint32_t)p_block->i_pts,
291 (uint32_t)p_block->i_dts );
293 p_sys->i_previous_pts = p_sys->i_current_pts;
294 p_sys->i_current_pts = p_block->i_pts;
295 p_sys->i_previous_dts = p_sys->i_current_dts;
296 p_sys->i_current_dts = p_block->i_dts;
298 p_sys->i_current_rate = p_block->i_rate;
300 mpeg2_buffer( p_sys->p_mpeg2dec, p_block->p_buffer,
301 p_block->p_buffer + p_block->i_buffer );
302 p_block->i_buffer = 0;
307 /* Initialize video output */
309 buf[0] = buf[1] = buf[2] = NULL;
311 /* Check whether the input gave a particular aspect ratio */
312 if( p_dec->fmt_in.video.i_aspect )
314 p_sys->i_aspect = p_dec->fmt_in.video.i_aspect;
315 if( p_sys->i_aspect <= AR_221_1_PICTURE )
316 switch( p_sys->i_aspect )
319 p_sys->i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
321 case AR_16_9_PICTURE:
322 p_sys->i_aspect = VOUT_ASPECT_FACTOR * 16 / 9;
324 case AR_221_1_PICTURE:
325 p_sys->i_aspect = VOUT_ASPECT_FACTOR * 221 / 100;
327 case AR_SQUARE_PICTURE:
328 p_sys->i_aspect = VOUT_ASPECT_FACTOR *
329 p_sys->p_info->sequence->width /
330 p_sys->p_info->sequence->height;
336 /* Use the value provided in the MPEG sequence header */
337 if( p_sys->p_info->sequence->pixel_height > 0 )
340 ((uint64_t)p_sys->p_info->sequence->display_width) *
341 p_sys->p_info->sequence->pixel_width *
343 p_sys->p_info->sequence->display_height /
344 p_sys->p_info->sequence->pixel_height;
348 /* Invalid aspect, assume 4:3.
349 * This shouldn't happen and if it does it is a bug
350 * in libmpeg2 (likely triggered by an invalid stream) */
351 p_sys->i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
355 msg_Dbg( p_dec, "%dx%d, aspect %d, %u.%03u fps",
356 p_sys->p_info->sequence->width,
357 p_sys->p_info->sequence->height, p_sys->i_aspect,
358 (uint32_t)((uint64_t)1001000000 * 27 /
359 p_sys->p_info->sequence->frame_period / 1001),
360 (uint32_t)((uint64_t)1001000000 * 27 /
361 p_sys->p_info->sequence->frame_period % 1001) );
363 mpeg2_custom_fbuf( p_sys->p_mpeg2dec, 1 );
365 /* Set the first 2 reference frames */
366 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL );
368 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
370 block_Release( p_block );
373 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
376 p_dec->pf_picture_link( p_dec, p_pic );
378 if( p_sys->p_synchro )
380 vout_SynchroRelease( p_sys->p_synchro );
382 p_sys->p_synchro = vout_SynchroInit( p_dec,
383 (uint32_t)((uint64_t)1001000000 * 27 /
384 p_sys->p_info->sequence->frame_period) );
385 p_sys->b_after_sequence_header = 1;
389 case STATE_PICTURE_2ND:
390 vout_SynchroNewPicture( p_sys->p_synchro,
391 p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
392 p_sys->p_info->current_picture->nb_fields,
393 0, 0, p_sys->i_current_rate,
394 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
398 vout_SynchroTrash( p_sys->p_synchro );
402 vout_SynchroDecode( p_sys->p_synchro );
410 buf[0] = buf[1] = buf[2] = NULL;
412 if ( p_sys->b_after_sequence_header &&
413 ((p_sys->p_info->current_picture->flags &
414 PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P) )
416 /* Intra-slice refresh. Simulate a blank I picture. */
417 msg_Dbg( p_dec, "intra-slice refresh stream" );
418 vout_SynchroNewPicture( p_sys->p_synchro,
419 I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
420 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
421 vout_SynchroDecode( p_sys->p_synchro );
422 vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
423 p_sys->b_slice_i = 1;
425 p_sys->b_after_sequence_header = 0;
428 i_pts = p_sys->p_info->current_picture->flags & PIC_FLAG_PTS ?
429 ( ( p_sys->p_info->current_picture->pts ==
430 (uint32_t)p_sys->i_current_pts ) ?
431 p_sys->i_current_pts : p_sys->i_previous_pts ) : 0;
432 #else /* New interface */
433 i_pts = p_sys->p_info->current_picture->flags & PIC_FLAG_TAGS ?
434 ( ( p_sys->p_info->current_picture->tag ==
435 (uint32_t)p_sys->i_current_pts ) ?
436 p_sys->i_current_pts : p_sys->i_previous_pts ) : 0;
438 /* Hack to handle demuxers which only have DTS timestamps */
439 if( !i_pts && !p_block->i_pts && p_block->i_dts > 0 )
441 if( p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ||
442 (p_sys->p_info->current_picture->flags &
443 PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B )
445 i_pts = p_block->i_dts;
448 p_block->i_pts = p_block->i_dts = 0;
451 vout_SynchroNewPicture( p_sys->p_synchro,
452 p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
453 p_sys->p_info->current_picture->nb_fields, i_pts,
454 0, p_sys->i_current_rate,
455 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
457 if ( !(p_sys->b_slice_i
458 && ((p_sys->p_info->current_picture->flags
459 & PIC_MASK_CODING_TYPE) == P_CODING_TYPE))
460 && !vout_SynchroChoose( p_sys->p_synchro,
461 p_sys->p_info->current_picture->flags
462 & PIC_MASK_CODING_TYPE,
463 /*FindVout(p_dec)->render_time*/ 0 /*FIXME*/,
464 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ) )
466 mpeg2_skip( p_sys->p_mpeg2dec, 1 );
468 vout_SynchroTrash( p_sys->p_synchro );
469 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL );
473 mpeg2_skip( p_sys->p_mpeg2dec, 0 );
475 vout_SynchroDecode( p_sys->p_synchro );
477 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
479 block_Release( p_block );
483 p_sys->p_mpeg2dec->ptr_forward_ref_picture = p_sys->p_mpeg2dec->fbuf[2]->id;
484 p_sys->p_mpeg2dec->ptr_backward_ref_picture = p_sys->p_mpeg2dec->fbuf[1]->id;
486 if ((p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE) != B_CODING_TYPE)
488 //if (p_sys->p_mpeg2dec->ptr_forward_ref_picture &&
489 // p_sys->p_mpeg2dec->ptr_forward_ref_picture != picture->backward_reference_frame)
490 // p_pic->forward_reference_frame->free (p_pic->forward_reference_frame);
492 p_sys->p_mpeg2dec->ptr_forward_ref_picture =
493 p_sys->p_mpeg2dec->ptr_backward_ref_picture;
494 p_sys->p_mpeg2dec->ptr_backward_ref_picture = (void *)p_pic;
496 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
504 if( p_sys->p_info->display_fbuf
505 && p_sys->p_info->display_fbuf->id )
507 p_pic = (picture_t *)p_sys->p_info->display_fbuf->id;
509 vout_SynchroEnd( p_sys->p_synchro,
510 p_sys->p_info->display_picture->flags
511 & PIC_MASK_CODING_TYPE,
512 p_sys->b_garbage_pic );
513 p_sys->b_garbage_pic = 0;
515 if ( p_sys->p_picture_to_destroy != p_pic )
517 p_pic->date = vout_SynchroDate( p_sys->p_synchro );
521 p_sys->p_picture_to_destroy = NULL;
526 if( p_sys->p_info->discard_fbuf &&
527 p_sys->p_info->discard_fbuf->id )
529 p_dec->pf_picture_unlink( p_dec, p_sys->p_info->discard_fbuf->id );
531 /* For still frames */
532 //if( state == STATE_END && p_pic ) p_pic->b_force = VLC_TRUE;
537 /* Avoid frames with identical timestamps.
538 * Especially needed for still frames in DVD menus. */
539 if( p_sys->i_last_frame_pts == p_pic->date ) p_pic->date++;
540 p_sys->i_last_frame_pts = p_pic->date;
549 buf[0] = buf[1] = buf[2] = NULL;
551 msg_Warn( p_dec, "invalid picture encountered" );
552 if ( ( p_sys->p_info->current_picture == NULL ) ||
553 ( ( p_sys->p_info->current_picture->flags &
554 PIC_MASK_CODING_TYPE) != B_CODING_TYPE ) )
556 if( p_sys->p_synchro ) vout_SynchroReset( p_sys->p_synchro );
558 mpeg2_skip( p_sys->p_mpeg2dec, 1 );
561 if( p_sys->p_info->current_fbuf &&
562 p_sys->p_info->current_fbuf->id )
564 p_sys->b_garbage_pic = 1;
565 p_pic = p_sys->p_info->current_fbuf->id;
567 else if( !p_sys->p_info->sequence )
573 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
575 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
577 p_sys->p_picture_to_destroy = p_pic;
579 memset( p_pic->p[0].p_pixels, 0,
580 p_sys->p_info->sequence->width
581 * p_sys->p_info->sequence->height );
582 memset( p_pic->p[1].p_pixels, 0x80,
583 p_sys->p_info->sequence->width
584 * p_sys->p_info->sequence->height / 4 );
585 memset( p_pic->p[2].p_pixels, 0x80,
586 p_sys->p_info->sequence->width
587 * p_sys->p_info->sequence->height / 4 );
589 if( p_sys->b_slice_i )
591 vout_SynchroNewPicture( p_sys->p_synchro,
592 I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
593 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
594 vout_SynchroDecode( p_sys->p_synchro );
595 vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
607 /*****************************************************************************
608 * CloseDecoder: libmpeg2 decoder destruction
609 *****************************************************************************/
610 static void CloseDecoder( vlc_object_t *p_this )
612 decoder_t *p_dec = (decoder_t *)p_this;
613 decoder_sys_t *p_sys = p_dec->p_sys;
616 if( p_sys->p_synchro ) vout_SynchroRelease( p_sys->p_synchro );
617 if( p_sys->p_mpeg2dec ) mpeg2_close( p_sys->p_mpeg2dec );
619 f_wd_dec = fopen("/vlc/dec_pid", "w");
620 if (f_wd_dec != NULL)
622 fprintf(f_wd_dec, "0\n");
629 static double get_aspect_ratio( decoder_t *p_dec )
631 decoder_sys_t *p_sys = p_dec->p_sys;
633 double mpeg1_pel_ratio[16] = {1.0 /* forbidden */,
634 1.0, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935, 0.9157,
635 0.9815, 1.0255, 1.0695, 1.0950, 1.1575, 1.2015, 1.0 /*reserved*/ };
637 if( !p_sys->p_mpeg2dec->decoder.mpeg1 )
639 /* these hardcoded values are defined on mpeg2 standard for
640 * aspect ratio. other values are reserved or forbidden. */
641 switch( p_sys->p_mpeg2dec->decoder.aspect_ratio_information )
654 ratio = (double)p_sys->p_mpeg2dec->decoder.width/(double)p_sys->p_mpeg2dec->decoder.height;
660 /* mpeg1 constants refer to pixel aspect ratio */
661 ratio = (double)p_sys->p_mpeg2dec->decoder.width/(double)p_sys->p_mpeg2dec->decoder.height;
662 ratio /= mpeg1_pel_ratio[p_sys->p_mpeg2dec->decoder.aspect_ratio_information];
666 /*****************************************************************************
667 * GetNewPicture: Get a new picture from the vout and set the buf struct
668 *****************************************************************************/
669 static picture_t *GetNewPicture( decoder_t *p_dec, uint8_t **pp_buf )
671 //msg_Dbg(p_dec, "GetNewPicture Entering");
672 decoder_sys_t *p_sys = p_dec->p_sys;
675 p_dec->fmt_out.video.i_width = p_sys->p_info->sequence->width;
676 p_dec->fmt_out.video.i_height = p_sys->p_info->sequence->height;
677 p_dec->fmt_out.video.i_aspect = p_sys->i_aspect;
679 if( p_sys->p_info->sequence->frame_period > 0 )
681 p_dec->fmt_out.video.i_frame_rate =
682 (uint32_t)( (uint64_t)1001000000 * 27 /
683 p_sys->p_info->sequence->frame_period );
684 p_dec->fmt_out.video.i_frame_rate_base = 1001;
687 p_dec->fmt_out.i_codec =
688 ( p_sys->p_info->sequence->chroma_height <
689 p_sys->p_info->sequence->height ) ?
690 VLC_FOURCC('I','4','2','0') : VLC_FOURCC('I','4','2','2');
693 p_sys->f_wd_nb = fopen("/vlc/dec_nb", "w");
694 if (p_sys->f_wd_nb != NULL)
696 // fprintf(p_sys->f_wd_nb, "%d\n", mdate());
697 fprintf(p_sys->f_wd_nb, "%s\n", mdate());
698 fflush(p_sys->f_wd_nb);
701 p_pic = p_dec->pf_vout_buffer_new( p_dec );
703 if( p_pic == NULL ) return NULL;
705 p_pic->b_progressive = p_sys->p_info->current_picture != NULL ?
706 p_sys->p_info->current_picture->flags & PIC_FLAG_PROGRESSIVE_FRAME : 1;
707 p_pic->b_top_field_first = p_sys->p_info->current_picture != NULL ?
708 p_sys->p_info->current_picture->flags & PIC_FLAG_TOP_FIELD_FIRST : 1;
709 p_pic->i_nb_fields = p_sys->p_info->current_picture != NULL ?
710 p_sys->p_info->current_picture->nb_fields : 2;
711 p_pic->format.i_frame_rate = p_dec->fmt_out.video.i_frame_rate;
712 p_pic->format.i_frame_rate_base = p_dec->fmt_out.video.i_frame_rate_base;
714 p_dec->pf_picture_link( p_dec, p_pic );
716 pp_buf[0] = p_pic->p[0].p_pixels;
717 pp_buf[1] = p_pic->p[1].p_pixels;
718 pp_buf[2] = p_pic->p[2].p_pixels;
720 /* let driver ensure this image has the right format */
722 this->driver->update_frame_format( p_pic->p_sys->p_vout, p_pic,
723 p_dec->fmt_out.video.i_width,
724 p_dec->fmt_out.video.i_height,
725 p_dec->fmt_out.video.i_aspect,
728 mpeg2_xxmc_choose_coding( p_dec, &p_sys->p_mpeg2dec->decoder, p_pic,
729 get_aspect_ratio(p_dec), 0 );