]> granicus.if.org Git - libass/commitdiff
Assume 4:3 AR when calculating missing PlayResX/Y
authorGrigori Goronzy <greg@blackbox>
Sat, 25 Jul 2009 01:38:56 +0000 (03:38 +0200)
committerGrigori Goronzy <greg@blackbox>
Sat, 25 Jul 2009 12:56:00 +0000 (14:56 +0200)
In case only one PlayResX/Y component is specified, calculate the other
component by assuming a 4:3 aspect ratio.  This is similar to vsfilter.

libass/ass_render.c

index d2f3c1bca5138e160f8cc088420afbbc34acf68e..94556f973a8224a6f75904aee8fc572fd2c4992a 100644 (file)
@@ -252,7 +252,6 @@ struct render_priv_s {
 static void ass_lazy_track_init(ass_renderer_t *render_priv)
 {
     ass_track_t *track = render_priv->track;
-    ass_settings_t *settings_priv = &render_priv->settings;
 
     if (track->PlayResX && track->PlayResY)
         return;
@@ -262,16 +261,12 @@ static void ass_lazy_track_init(ass_renderer_t *render_priv)
         track->PlayResX = 384;
         track->PlayResY = 288;
     } else {
-        double orig_aspect =
-            (settings_priv->aspect * render_priv->height *
-             render_priv->orig_width) / render_priv->orig_height /
-            render_priv->width;
         if (!track->PlayResY && track->PlayResX == 1280) {
             track->PlayResY = 1024;
             ass_msg(render_priv->library, MSGL_WARN,
                    "PlayResY undefined, setting to %d", track->PlayResY);
         } else if (!track->PlayResY) {
-            track->PlayResY = track->PlayResX / orig_aspect + .5;
+            track->PlayResY = track->PlayResX * 3 / 4;
             ass_msg(render_priv->library, MSGL_WARN,
                    "PlayResY undefined, setting to %d", track->PlayResY);
         } else if (!track->PlayResX && track->PlayResY == 1024) {
@@ -279,7 +274,7 @@ static void ass_lazy_track_init(ass_renderer_t *render_priv)
             ass_msg(render_priv->library, MSGL_WARN,
                    "PlayResX undefined, setting to %d", track->PlayResX);
         } else if (!track->PlayResX) {
-            track->PlayResX = track->PlayResY * orig_aspect + .5;
+            track->PlayResX = track->PlayResY * 4 / 3;
             ass_msg(render_priv->library, MSGL_WARN,
                    "PlayResX undefined, setting to %d", track->PlayResX);
         }