diff options
author | jstebbins <[email protected]> | 2015-01-03 18:01:28 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-01-03 18:01:28 +0000 |
commit | 207a1c9599e13f9790a70b4784d290899d45bab8 (patch) | |
tree | fb705c262712f83f72db69199e159548fe091f67 /libhb/hb.c | |
parent | e1301a6a4ece63bf195c3a86976ed29236d7b8c0 (diff) |
libhb: simplify job initialization
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6683 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/hb.c')
-rw-r--r-- | libhb/hb.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libhb/hb.c b/libhb/hb.c index e9d5e38da..73dbd448c 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -909,6 +909,16 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo, double storage_aspect = (double)cropped_width / cropped_height; int mod = geo->modulus ? EVEN(geo->modulus) : 2; + // Sanitize PAR + if (geo->geometry.par.num == 0 || geo->geometry.par.den == 0) + { + geo->geometry.par.num = geo->geometry.par.den = 1; + } + if (src_geo->par.num == 0 || src_geo->par.den == 0) + { + src_geo->par.num = src_geo->par.den = 1; + } + // Use 64 bits to avoid overflow till the final hb_reduce() call hb_reduce(&in_par.num, &in_par.den, geo->geometry.par.num, geo->geometry.par.den); @@ -1160,7 +1170,8 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo, hb_limit_rational64(&dst_par_num, &dst_par_den, dst_par_num, dst_par_den, 65535); - /* If the user is directling updating PAR, don't override his values */ + // If the user is directling updating PAR, don't override his values. + // I.e. don't even reduce the values. hb_reduce(&out_par.num, &out_par.den, dst_par_num, dst_par_den); if (geo->mode == HB_ANAMORPHIC_CUSTOM && !keep_display_aspect && out_par.num == in_par.num && out_par.den == in_par.den) |