]> granicus.if.org Git - handbrake/commitdiff
merge: libhb: fix application of max width/height
authorjstebbins <jstebbins.hb@gmail.com>
Wed, 22 Jul 2015 17:12:30 +0000 (17:12 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Wed, 22 Jul 2015 17:12:30 +0000 (17:12 +0000)
In non-anamorphic and custom-anamorphic, if keep-aspect is not set,
don't adjust dimensions to fix aspect when applying max width or height.
If the user is telling us to distort the image, do it.

git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.10.x@7363 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/hb.c

index bc289dbb76d8f946e9a79ef3ea484ebbfff38c59..b2a1f38d2b2ff8d8e2a21702699e9c08d966f816 100644 (file)
@@ -1095,12 +1095,18 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
             if (maxWidth && (width > maxWidth))
             {
                 width  = maxWidth;
-                height = MULTIPLE_MOD(width / dar, mod);
+                if (keep_display_aspect)
+                {
+                    height = MULTIPLE_MOD(width / dar, mod);
+                }
             }
             if (maxHeight && (height > maxHeight))
             {
                 height  = maxHeight;
-                width = MULTIPLE_MOD(height * dar, mod);
+                if (keep_display_aspect)
+                {
+                    width = MULTIPLE_MOD(height * dar, mod);
+                }
             }
             dst_par_num = dst_par_den = 1;
         } break;
@@ -1191,7 +1197,8 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
                 // But otherwise, PAR and DAR will change the least
                 // if we stay as close as possible to the requested
                 // storage aspect.
-                if (!keep_display_aspect)
+                if (!keep_display_aspect &&
+                    (maxHeight == 0 || height < maxHeight))
                 {
                     height = width / storage_aspect + 0.5;
                     height = MULTIPLE_MOD(height, mod);
@@ -1201,7 +1208,8 @@ void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
             {
                 height = maxHeight;
                 // Ditto, see comment above
-                if (!keep_display_aspect)
+                if (!keep_display_aspect &&
+                    (maxWidth == 0 || width < maxWidth))
                 {
                     width = height * storage_aspect + 0.5;
                     width  = MULTIPLE_MOD(width, mod);