diff options
author | van <[email protected]> | 2008-08-08 06:19:54 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-08-08 06:19:54 +0000 |
commit | f8eb63aed0df0e9c99b5d652728ccb01a2d4eb68 (patch) | |
tree | 5a2a0a1e1200b8e41c78b66349001f398befc4f2 /libhb/decmpeg2.c | |
parent | 138aa5d206ae6ee6296948367de807089f414f6a (diff) |
- change aspect from a scaled int to a double so we can handle the wider
range of aspect ratios we get from ffmpeg files.
- add container_aspect to title struct (always zero except for DVDs
when it's the aspect from the VTSI). To handle broken French DVDs,
make HB complain & use the container aspect if it's different from
the aspect computed from the video PAR.
- fix ScanFunc's job template init so that it doesn't think the only
legal aspect ratios are 16:9 & 4:3.
- hb_reduce wouldn't reduce any fraction where both terms were equal and
prime (e.g., 2/2, 3/3, 5/5, etc. would not become 1/1). Recoded it using
Euclid's Algorithm so it always works and is faster.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1616 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/decmpeg2.c')
-rw-r--r-- | libhb/decmpeg2.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libhb/decmpeg2.c b/libhb/decmpeg2.c index bccbd065b..4972d0468 100644 --- a/libhb/decmpeg2.c +++ b/libhb/decmpeg2.c @@ -39,7 +39,7 @@ typedef struct hb_libmpeg2_s int width; int height; int rate; - int aspect_ratio; + double aspect_ratio; int got_iframe; /* set when we get our first iframe */ int look_for_iframe; /* need an iframe to add chap break */ int look_for_break; /* need gop start to add chap break */ @@ -109,13 +109,10 @@ static int hb_libmpeg2_decode( hb_libmpeg2_t * m, hb_buffer_t * buf_es, * it keeps the pixel width & height that would cause * the storage width & height to come out in the correct * aspect ratio. Convert these back to aspect ratio. - * We do the calc in floating point to get the rounding right. - * We round in the second decimal digit because we scale - * the (integer) aspect by 9 to preserve the 1st digit. */ double ar_numer = m->width * m->info->sequence->pixel_width; double ar_denom = m->height * m->info->sequence->pixel_height; - m->aspect_ratio = ( ar_numer / ar_denom + .05 ) * HB_ASPECT_BASE; + m->aspect_ratio = ar_numer / ar_denom; } } } @@ -431,7 +428,7 @@ static int decmpeg2Info( hb_work_object_t *w, hb_work_info_t *info ) info->height = m->height; info->pixel_aspect_width = m->info->sequence->pixel_width; info->pixel_aspect_height = m->info->sequence->pixel_height; - info->aspect = (double)m->aspect_ratio; + info->aspect = m->aspect_ratio; // if the frame is progressive & NTSC DVD height report it as 23.976 FPS // so that scan can autodetect NTSC film |