From 4a2db828ecdb41d2446f1da3a036f7fd39415809 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Wed, 5 Aug 2009 03:19:32 +0200 Subject: Clarify the AR parameter meanings Use the correct terms (SAR/DAR) for the aspect ratio parameters. --- libass/ass.h | 6 +++--- libass/ass_render.c | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libass/ass.h b/libass/ass.h index 8c26153..16e7399 100644 --- a/libass/ass.h +++ b/libass/ass.h @@ -167,10 +167,10 @@ void ass_set_use_margins(ass_renderer_t *priv, int use); /** * \brief Set aspect ratio parameters. * \param priv renderer handle - * \param ar physical aspect ratio - * \param par pixel ratio, e.g. width / height of the video + * \param dar display aspect ratio (DAR), prescaled for output PAR + * \param sar storage aspect ratio (SAR) */ -void ass_set_aspect_ratio(ass_renderer_t *priv, double ar, double par); +void ass_set_aspect_ratio(ass_renderer_t *priv, double dar, double sar); /** * \brief Set a fixed font scaling factor. diff --git a/libass/ass_render.c b/libass/ass_render.c index 8c249e0..b1cfd1a 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -76,7 +76,7 @@ typedef struct { int use_margins; // 0 - place all subtitles inside original frame // 1 - use margins for placing toptitles and subtitles double aspect; // frame aspect ratio, d_width / d_height. - double pixel_ratio; // pixel ratio of the source image + double storage_aspect; // pixel ratio of the source image ass_hinting_t hinting; char *default_font; @@ -3162,7 +3162,7 @@ void ass_set_frame_size(ass_renderer_t *priv, int w, int h) priv->settings.frame_height = h; if (priv->settings.aspect == 0.) { priv->settings.aspect = ((double) w) / h; - priv->settings.pixel_ratio = ((double) w) / h; + priv->settings.storage_aspect = ((double) w) / h; } ass_reconfigure(priv); } @@ -3187,11 +3187,11 @@ void ass_set_use_margins(ass_renderer_t *priv, int use) priv->settings.use_margins = use; } -void ass_set_aspect_ratio(ass_renderer_t *priv, double ar, double par) +void ass_set_aspect_ratio(ass_renderer_t *priv, double dar, double sar) { - if (priv->settings.aspect != ar || priv->settings.pixel_ratio != par) { - priv->settings.aspect = ar; - priv->settings.pixel_ratio = par; + if (priv->settings.aspect != dar || priv->settings.storage_aspect != sar) { + priv->settings.aspect = dar; + priv->settings.storage_aspect = sar; ass_reconfigure(priv); } } @@ -3293,7 +3293,7 @@ ass_start_frame(ass_renderer_t *render_priv, ass_track_t *track, // PAR correction render_priv->font_scale_x = render_priv->settings.aspect / - render_priv->settings.pixel_ratio; + render_priv->settings.storage_aspect; render_priv->prev_images_root = render_priv->images_root; render_priv->images_root = 0; -- cgit v1.2.3