summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-19 20:04:31 +0100
committerwm4 <wm4@nowhere>2015-12-19 20:45:36 +0100
commit0a0bb9059f42671c267ea5d0c8faa3ac71a8c742 (patch)
tree89cbdee7748d36f98cc5d0efbfc8a3fc810b2016 /sub
parent1f7c099dc0feb9a160d9018ad6ad068e0295341a (diff)
downloadmpv-0a0bb9059f42671c267ea5d0c8faa3ac71a8c742.tar.bz2
mpv-0a0bb9059f42671c267ea5d0c8faa3ac71a8c742.tar.xz
video: switch from using display aspect to sample aspect
MPlayer traditionally always used the display aspect ratio, e.g. 16:9, while FFmpeg uses the sample (aka pixel) aspect ratio. Both have a bunch of advantages and disadvantages. Actually, it seems using sample aspect ratio is generally nicer. The main reason for the change is making mpv closer to how FFmpeg works in order to make life easier. It's also nice that everything uses integer fractions instead of floats now (except --video-aspect option/property). Note that there is at least 1 user-visible change: vf_dsize now does not set the display size, only the display aspect ratio. This is because the image_params d_w/d_h fields did not just set the display aspect, but also the size (except in encoding mode).
Diffstat (limited to 'sub')
-rw-r--r--sub/osd.c5
-rw-r--r--sub/sd_ass.c6
-rw-r--r--sub/sd_lavc.c7
3 files changed, 6 insertions, 12 deletions
diff --git a/sub/osd.c b/sub/osd.c
index 2d11b80cbb..ba4011c040 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -388,13 +388,10 @@ void osd_draw_on_image_p(struct osd_state *osd, struct mp_osd_res res,
// ratio if the image does not have a 1:1 pixel aspect ratio.
struct mp_osd_res osd_res_from_image_params(const struct mp_image_params *p)
{
- double sar = (double)p->w / p->h;
- double dar = (double)p->d_w / p->d_h;
-
return (struct mp_osd_res) {
.w = p->w,
.h = p->h,
- .display_par = sar / dar,
+ .display_par = p->p_h / (double)p->p_w,
};
}
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index baf35b5d30..32179c843d 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -343,11 +343,9 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res dim, double pts,
opts->ass_vsfilter_aspect_compat))
{
// Let's use the original video PAR for vsfilter compatibility:
- double par = scale
- * (ctx->video_params.d_w / (double)ctx->video_params.d_h)
- / (ctx->video_params.w / (double)ctx->video_params.h);
+ double par = ctx->video_params.p_w / (double)ctx->video_params.p_h;
if (isnormal(par))
- scale = par;
+ scale *= par;
}
configure_ass(sd, &dim, converted, track);
ass_set_pixel_aspect(renderer, scale);
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 08fff28d8a..86aaf4fda9 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -318,11 +318,10 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, double pts,
double video_par = 0;
if (priv->avctx->codec_id == AV_CODEC_ID_DVD_SUBTITLE &&
- opts->stretch_dvd_subs) {
+ opts->stretch_dvd_subs)
+ {
// For DVD subs, try to keep the subtitle PAR at display PAR.
- double par =
- (priv->video_params.d_w / (double)priv->video_params.d_h)
- / (priv->video_params.w / (double)priv->video_params.h);
+ double par = priv->video_params.p_w / (double)priv->video_params.p_h;
if (isnormal(par))
video_par = par;
}