From 0a0bb9059f42671c267ea5d0c8faa3ac71a8c742 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 19 Dec 2015 20:04:31 +0100 Subject: 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). --- video/decode/vd_lavc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'video/decode/vd_lavc.c') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 92ea8bd0d8..89fa21c4e1 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -484,7 +484,6 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame, struct MPOpts *opts = ctx->opts; int width = frame->width; int height = frame->height; - float aspect = av_q2d(frame->sample_aspect_ratio) * width / height; int pix_fmt = frame->format; if (pix_fmt != ctx->pix_fmt) { @@ -499,8 +498,8 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame, .imgfmt = ctx->best_csp, .w = width, .h = height, - .d_w = 0, - .d_h = 0, + .p_w = frame->sample_aspect_ratio.num, + .p_h = frame->sample_aspect_ratio.den, .colorspace = avcol_spc_to_mp_csp(ctx->avctx->colorspace), .colorlevels = avcol_range_to_mp_csp_levels(ctx->avctx->color_range), .primaries = avcol_pri_to_mp_csp_prim(ctx->avctx->color_primaries), @@ -511,9 +510,6 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame, .stereo_in = vd->header->video->stereo_mode, }; - if (aspect > 0) - vf_set_dar(&out_params->d_w, &out_params->d_h, width, height, aspect); - if (opts->video_rotate < 0) { out_params->rotate = 0; } else { -- cgit v1.2.3