summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-07-16 21:46:03 +0000
committerjstebbins <[email protected]>2014-07-16 21:46:03 +0000
commitc6afbd222d785b25523b80b3531566ff6001b4d8 (patch)
tree03680dee8f0c5a5f9ab6616d0185861459b1cd14 /libhb
parent3bd8e012e3416963b89035f3212b632d9aa85958 (diff)
cli: Simplify output geometry calculation
Fix bug where non-anamorphic mode ignores modulus Change default modulus to 2 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6234 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/hb.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index 5476e7482..e6036587f 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -931,7 +931,7 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
int cropped_width = src_geo->width - ui_geo->crop[2] - ui_geo->crop[3];
int cropped_height = src_geo->height - ui_geo->crop[0] - ui_geo->crop[1];
double storage_aspect = (double)cropped_width / cropped_height;
- int mod = ui_geo->modulus ? EVEN(ui_geo->modulus) : 16;
+ int mod = ui_geo->modulus ? EVEN(ui_geo->modulus) : 2;
// Use 64 bits to avoid overflow till the final hb_reduce() call
hb_reduce(&in_par.num, &in_par.den, ui_geo->par.num, ui_geo->par.den);
@@ -1018,19 +1018,19 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
{
if (!keep_height)
{
- width = ui_geo->width;
+ width = MULTIPLE_MOD_UP(ui_geo->width, mod);
height = MULTIPLE_MOD((int)(width / dar), mod);
}
else
{
- height = ui_geo->height;
+ height = MULTIPLE_MOD_UP(ui_geo->height, mod);
width = MULTIPLE_MOD((int)(height * dar), mod);
}
}
else
{
- width = ui_geo->width;
- height = ui_geo->height;
+ width = MULTIPLE_MOD_UP(ui_geo->width, mod);
+ height = MULTIPLE_MOD_UP(ui_geo->height, mod);
}
if (maxWidth && (width > maxWidth))
{
@@ -1052,8 +1052,8 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
* - Uses mod2-compliant dimensions,
* - Forces title - crop dimensions
*/
- width = MULTIPLE_MOD(cropped_width, 2);
- height = MULTIPLE_MOD(cropped_height, 2);
+ width = MULTIPLE_MOD_UP(cropped_width, 2);
+ height = MULTIPLE_MOD_UP(cropped_height, 2);
/* Adjust the output PAR for new width/height
* Film AR is the source display width / cropped source height.
@@ -1080,13 +1080,13 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
*/
if (!keep_height)
{
- width = MULTIPLE_MOD(ui_geo->width, mod);
- height = MULTIPLE_MOD((int)(width / storage_aspect + 0.5), mod);
+ width = MULTIPLE_MOD_UP(ui_geo->width, mod);
+ height = MULTIPLE_MOD_UP((int)(width / storage_aspect + 0.5), mod);
}
else
{
- height = MULTIPLE_MOD(ui_geo->height, mod);
- width = MULTIPLE_MOD((int)(height * storage_aspect + 0.5), mod);
+ height = MULTIPLE_MOD_UP(ui_geo->height, mod);
+ width = MULTIPLE_MOD_UP((int)(height * storage_aspect + 0.5), mod);
}
if (maxWidth && (maxWidth < width))
@@ -1114,12 +1114,10 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
/* Use specified storage dimensions */
storage_aspect = (double)ui_geo->width / ui_geo->height;
- width = ui_geo->width;
- height = ui_geo->height;
/* Time to get picture dimensions that divide cleanly.*/
- width = MULTIPLE_MOD(width, mod);
- height = MULTIPLE_MOD(height, mod);
+ width = MULTIPLE_MOD_UP(ui_geo->width, mod);
+ height = MULTIPLE_MOD_UP(ui_geo->height, mod);
/* Bind to max dimensions */
if (maxWidth && width > maxWidth)