diff options
author | titer <[email protected]> | 2006-04-17 18:50:02 +0000 |
---|---|---|
committer | titer <[email protected]> | 2006-04-17 18:50:02 +0000 |
commit | b30c3a727aa539f10adeae2220b4aa48e0b18feb (patch) | |
tree | eefa942e442271517817b3dcc3e9172e659fe4e0 /libhb/hb.c | |
parent | 82485cc9d132e1c284c9bd16dd8acd0094d42946 (diff) |
Merge from avformat branch
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@60 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/hb.c')
-rw-r--r-- | libhb/hb.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/libhb/hb.c b/libhb/hb.c index 7bc41be8e..d44c05de6 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -260,6 +260,7 @@ void hb_set_size( hb_job_t * job, int aspect, int pixels ) int croppedAspect = title->aspect * title->height * croppedWidth / croppedHeight / title->width; int addCrop; + int i, w, h; if( aspect <= 0 ) { @@ -296,11 +297,29 @@ void hb_set_size( hb_job_t * job, int aspect, int pixels ) else if( aspect > croppedAspect ) { /* Need to crop on the top and bottom */ - /* TODO */ + addCrop = croppedHeight - croppedWidth * title->aspect * + title->height / aspect / title->width; + if( addCrop & 3 ) + { + addCrop = ( addCrop + 1 ) / 2; + job->crop[0] += addCrop; + job->crop[1] += addCrop; + } + else if( addCrop & 2 ) + { + addCrop /= 2; + job->crop[0] += addCrop - 1; + job->crop[1] += addCrop + 1; + } + else + { + addCrop /= 2; + job->crop[0] += addCrop; + job->crop[1] += addCrop; + } } /* Compute a resolution from the number of pixels and aspect */ - int i, w, h; for( i = 0;; i++ ) { w = 16 * i; |