summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-03-04 23:31:54 +0000
committerjstebbins <[email protected]>2009-03-04 23:31:54 +0000
commit66672c6931393a17a4ffc48c1509205d23518221 (patch)
treea7ae5a67f93b0297cee3048c2167bbc88ea1aa58 /libhb
parent3ca54dc4fdee70ca197cffc7015fa7317d75e380 (diff)
reorder some calculations in hb_set_anamorphic_size so that the height
calculated after all adjustments have been made to the width. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2222 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/hb.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index bc1c1f0a6..daee5cca9 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -476,7 +476,8 @@ void hb_get_preview( hb_handle_t * h, hb_title_t * title, int picture,
*/
int hb_detect_comb( hb_buffer_t * buf, int width, int height, int color_equal, int color_diff, int threshold, int prog_equal, int prog_diff, int prog_threshold )
{
- int j, k, n, off, cc_1, cc_2, cc[3], flag[3] ;
+ int j, k, n, off, cc_1, cc_2, cc[3];
+ // int flag[3] ; // debugging flag
uint16_t s1, s2, s3, s4;
cc_1 = 0; cc_2 = 0;
@@ -662,7 +663,7 @@ void hb_set_anamorphic_size( hb_job_t * job,
- Allows users to set the width
*/
width = job->width;
- height; // Gets set later, ignore user job->height value
+ // height: Gets set later, ignore user job->height value
/* Gotta handle bounding dimensions.
If the width is too big, just reset it with no rescaling.
@@ -674,18 +675,23 @@ void hb_set_anamorphic_size( hb_job_t * job,
if ( job->maxWidth && (job->maxWidth < job->width) )
width = job->maxWidth;
+
+ /* Time to get picture width that divide cleanly.*/
+ width = MULTIPLE_MOD( width, mod);
+
+ /* Verify these new dimensions don't violate max height and width settings */
+ if ( job->maxWidth && (job->maxWidth < job->width) )
+ width = job->maxWidth;
+
height = ((double)width / storage_aspect) + 0.5;
if ( job->maxHeight && (job->maxHeight < height) )
height = job->maxHeight;
- /* Time to get picture dimensions that divide cleanly.*/
- width = MULTIPLE_MOD( width, mod);
+ /* Time to get picture height that divide cleanly.*/
height = MULTIPLE_MOD( height, mod);
/* Verify these new dimensions don't violate max height and width settings */
- if ( job->maxWidth && (job->maxWidth < job->width) )
- width = job->maxWidth;
if ( job->maxHeight && (job->maxHeight < height) )
height = job->maxHeight;