Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2018-11-24 04:57:07 +0300
committerRonald S. Bultje <rsbultje@gmail.com>2018-11-25 21:38:31 +0300
commit3e95d8ed717082430db632d290309f4f7326e7fe (patch)
treea49b071b86a0bf1be5e77d3da24d6be8446a1181 /tools
parent9c4bf181e0871d73cceb6e166447cfc3c6c7ca42 (diff)
Move Dav1dPictureParameters-related entries to top of Dav1dSeqHdr
Also remove redundant entries from Dav1dPictureParameters, and move documentation of these fields into Dav1dFrame/SequenceHeader instead.
Diffstat (limited to 'tools')
-rw-r--r--tools/output/y4m2.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/tools/output/y4m2.c b/tools/output/y4m2.c
index 34c4cea..9a81022 100644
--- a/tools/output/y4m2.c
+++ b/tools/output/y4m2.c
@@ -37,6 +37,8 @@
typedef struct MuxerPriv {
FILE *f;
+ int first;
+ unsigned fps[2];
} Y4m2OutputContext;
static int y4m2_open(Y4m2OutputContext *const c, const char *const file,
@@ -49,6 +51,14 @@ static int y4m2_open(Y4m2OutputContext *const c, const char *const file,
return -1;
}
+ c->first = 1;
+ c->fps[0] = fps[0];
+ c->fps[1] = fps[1];
+
+ return 0;
+}
+
+static int write_header(Y4m2OutputContext *const c, const Dav1dPicture *const p) {
static const char *const ss_names[][2] = {
[DAV1D_PIXEL_LAYOUT_I400] = { "mono", "mono10" },
[DAV1D_PIXEL_LAYOUT_I420] = { NULL, "420p10" },
@@ -62,17 +72,23 @@ static int y4m2_open(Y4m2OutputContext *const c, const char *const file,
[DAV1D_CHR_COLOCATED] = "420"
};
- const char *const ss_name = p->layout == DAV1D_PIXEL_LAYOUT_I420 && p->bpc == 8 ?
- chr_names_8bpc_i420[p->chr > 2 ? DAV1D_CHR_UNKNOWN : p->chr] :
- ss_names[p->layout][p->bpc > 8];
+ const char *const ss_name =
+ p->seq_hdr->layout == DAV1D_PIXEL_LAYOUT_I420 && p->seq_hdr->bpc == 8 ?
+ chr_names_8bpc_i420[p->seq_hdr->chr > 2 ? DAV1D_CHR_UNKNOWN : p->seq_hdr->chr] :
+ ss_names[p->seq_hdr->layout][p->seq_hdr->bpc > 8];
fprintf(c->f, "YUV4MPEG2 W%d H%d F%d:%d Ip C%s\n",
- p->w, p->h, fps[0], fps[1], ss_name);
+ p->p.w, p->p.h, c->fps[0], c->fps[1], ss_name);
return 0;
}
static int y4m2_write(Y4m2OutputContext *const c, Dav1dPicture *const p) {
+ if (c->first) {
+ c->first = 0;
+ const int res = write_header(c, p);
+ if (res < 0) return res;
+ }
fprintf(c->f, "FRAME\n");
uint8_t *ptr;