diff options
author | jstebbins <[email protected]> | 2008-12-05 16:02:38 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2008-12-05 16:02:38 +0000 |
commit | e1cbbcb2bbfd8307a1f2941549f97a0d174defd8 (patch) | |
tree | 51cc5e0b061d5c547422c61755dd059580dae98c /libhb | |
parent | dea975e8c71f793ce0ed95c137e83528a501c643 (diff) |
fix some floating point rounding errors in aspect ratio calculations
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2009 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/hb.c | 2 | ||||
-rw-r--r-- | libhb/scan.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libhb/hb.c b/libhb/hb.c index 058924848..31b45c2df 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -589,7 +589,7 @@ void hb_set_anamorphic_size( hb_job_t * job, if ( job->maxWidth && (job->maxWidth < job->width) ) width = job->maxWidth; - height = (double)width / storage_aspect; + height = ((double)width / storage_aspect) + 0.5; if ( job->maxHeight && (job->maxHeight < height) ) height = job->maxHeight; diff --git a/libhb/scan.c b/libhb/scan.c index 631fa43ef..6459c1d50 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -200,7 +200,7 @@ static void ScanFunc( void * _data ) !job->pixel_aspect_width && !job->pixel_aspect_height) { hb_reduce( &job->pixel_aspect_width, &job->pixel_aspect_height, - (int)(title->aspect * title->height), title->width ); + (int)(title->aspect * title->height + 0.5), title->width ); } job->width = title->width - job->crop[2] - job->crop[3]; @@ -686,14 +686,14 @@ skip_preview: // aspect ratio from the DVD metadata. So, if the aspect computed // from the PAR is different from the container's aspect we use // the container's aspect & recompute the PAR from it. - if( title->container_aspect && title->aspect != title->container_aspect ) + if( title->container_aspect && (int)(title->aspect * 9) != (int)(title->container_aspect * 9) ) { hb_log("scan: content PAR gives wrong aspect %.2f; " "using container aspect %.2f", title->aspect, title->container_aspect ); title->aspect = title->container_aspect; hb_reduce( &title->pixel_aspect_width, &title->pixel_aspect_height, - (int)(title->aspect * title->height), title->width ); + (int)(title->aspect * title->height + 0.5), title->width ); } } |