diff options
author | Raphaƫl Zumer <rzumer@tebako.net> | 2020-08-20 22:51:09 +0300 |
---|---|---|
committer | Jean-Baptiste Kempf <jb@videolan.org> | 2020-08-30 23:46:39 +0300 |
commit | 484d6595afc4d155ffe4dca2bbcdb01d77f8f198 (patch) | |
tree | 2f78c5db923f9c8427924f4db5c135076e7bbe24 /tools | |
parent | 80aa7823fbbfe5e3b8c1aeba2dad9234f5225d30 (diff) |
Output render size to Y4M
This adds A<W>:<H> to the Y4M header, to
preserve the intended aspect ratio for
anamorphic video.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/output/y4m2.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/output/y4m2.c b/tools/output/y4m2.c index bcd4034..cec9ea0 100644 --- a/tools/output/y4m2.c +++ b/tools/output/y4m2.c @@ -77,8 +77,13 @@ static int write_header(Y4m2OutputContext *const c, const Dav1dPicture *const p) chr_names_8bpc_i420[p->seq_hdr->chr > 2 ? DAV1D_CHR_UNKNOWN : p->seq_hdr->chr] : ss_names[p->p.layout][p->seq_hdr->hbd]; - fprintf(c->f, "YUV4MPEG2 W%d H%d F%d:%d Ip C%s\n", - p->p.w, p->p.h, c->fps[0], c->fps[1], ss_name); + int fw = p->frame_hdr->width[0], fh = p->frame_hdr->height; + int rw = p->frame_hdr->render_width, rh = p->frame_hdr->render_height; + int aw = rw > rh ? rw : (rw + 0.5) / fw * fh; + int ah = rh > rw ? rh : (rh + 0.5) / fh * fw; + + fprintf(c->f, "YUV4MPEG2 W%d H%d F%d:%d Ip A%d:%d C%s\n", + p->p.w, p->p.h, c->fps[0], c->fps[1], aw, ah, ss_name); return 0; } |