ref: c1c15e0d2c5798c80bbc2b00b0e908d7fbb6024e
parent: b1adc7cf93eee9125e0d894bb21e679c2a04703a
author: Raphaël Zumer <rzumer@tebako.net>
date: Thu Sep 27 10:35:02 EDT 2018
Handle chroma position in 4:2:0 Y4M output
--- a/tools/output/y4m2.c
+++ b/tools/output/y4m2.c
@@ -49,14 +49,24 @@
return -1;
}
- static const char *const ss_name[][2] = {
+ static const char *const ss_names[][2] = {
[DAV1D_PIXEL_LAYOUT_I400] = { "mono", "mono10" },
[DAV1D_PIXEL_LAYOUT_I420] = { "420jpeg", "420p10" },
[DAV1D_PIXEL_LAYOUT_I422] = { "422", "422p10" },
[DAV1D_PIXEL_LAYOUT_I444] = { "444", "444p10" }
};
+
+ static const char *const chr_names_8bpc_i420[] = {
+ [DAV1D_CHR_UNKNOWN] = "420jpeg",
+ [DAV1D_CHR_VERTICAL] = "420mpeg2",
+ [DAV1D_CHR_COLOCATED] = "420"
+ };
+
+ const char *const ss_name = p->layout == DAV1D_PIXEL_LAYOUT_I420 && p->bpc == 8 ?
+ chr_names_8bpc_i420[p->chr] : ss_names[p->layout][p->bpc > 8];
+
fprintf(c->f, "YUV4MPEG2 W%d H%d C%s Ip F%d:%d\n",
- p->w, p->h, ss_name[p->layout][p->bpc > 8], fps[0], fps[1]);
+ p->w, p->h, ss_name, fps[0], fps[1]);
return 0;
}