From 3a4445bd11bc948c28b3e0706c599213ac221870 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Fri, 23 Nov 2018 21:50:17 +0100 Subject: API/scalable: add all_layers Dav1dSettings Refs #188, adds a dav1d CLI option. Defaults to 1 to allow adjustment of the tests of scalable bitstreams. --- include/dav1d/dav1d.h | 1 + src/internal.h | 1 + src/lib.c | 2 ++ tools/dav1d_cli_parse.c | 9 ++++++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/dav1d/dav1d.h b/include/dav1d/dav1d.h index 64b9042..f5c8c62 100644 --- a/include/dav1d/dav1d.h +++ b/include/dav1d/dav1d.h @@ -47,6 +47,7 @@ typedef struct Dav1dSettings { Dav1dPicAllocator allocator; int apply_grain; int operating_point; ///< select an operating point for scalable AV1 bitstreams (0 - 31) + int all_layers; ///< output all spatial layers of a scalable AV1 biststream } Dav1dSettings; /** diff --git a/src/internal.h b/src/internal.h index 5332200..b139443 100644 --- a/src/internal.h +++ b/src/internal.h @@ -118,6 +118,7 @@ struct Dav1dContext { int apply_grain; int operating_point; unsigned operating_point_idc; + int all_layers; }; struct Dav1dFrameContext { diff --git a/src/lib.c b/src/lib.c index 22fab5e..90cb16f 100644 --- a/src/lib.c +++ b/src/lib.c @@ -63,6 +63,7 @@ void dav1d_default_settings(Dav1dSettings *const s) { s->allocator.alloc_picture_callback = default_picture_allocator; s->allocator.release_picture_callback = default_picture_release; s->operating_point = 0; + s->all_layers = 1; // just until the tests are adjusted } int dav1d_open(Dav1dContext **const c_out, @@ -91,6 +92,7 @@ int dav1d_open(Dav1dContext **const c_out, c->allocator = s->allocator; c->apply_grain = s->apply_grain; c->operating_point = s->operating_point; + c->all_layers = s->all_layers; c->n_fc = s->n_frame_threads; c->fc = dav1d_alloc_aligned(sizeof(*c->fc) * s->n_frame_threads, 32); if (!c->fc) goto error; diff --git a/tools/dav1d_cli_parse.c b/tools/dav1d_cli_parse.c index affd75c..da036c5 100644 --- a/tools/dav1d_cli_parse.c +++ b/tools/dav1d_cli_parse.c @@ -50,6 +50,7 @@ enum { ARG_VERIFY, ARG_FILM_GRAIN, ARG_OPPOINT, + ARG_ALL_LAYERS, }; static const struct option long_opts[] = { @@ -66,6 +67,7 @@ static const struct option long_opts[] = { { "verify", 1, NULL, ARG_VERIFY }, { "filmgrain", 1, NULL, ARG_FILM_GRAIN }, { "oppoint", 1, NULL, ARG_OPPOINT }, + { "alllayers", 1, NULL, ARG_ALL_LAYERS }, { NULL, 0, NULL, 0 }, }; @@ -91,7 +93,8 @@ static void usage(const char *const app, const char *const reason, ...) { " --framethreads $num: number of frame threads (default: 1)\n" " --tilethreads $num: number of tile threads (default: 1)\n" " --filmgrain enable film grain application (default: 1, except if muxer is md5)\n" - " --oppoint $num: select an operating point for scalable AV1 (0 - 32)\n" + " --oppoint $num: select an operating point of a scalable AV1 bitstream (0 - 32)\n" + " --alllayers $num: output all spatial layers of a scalable AV1 bitstream (default: 1)\n" " --verify $md5: verify decoded md5. implies --muxer md5, no output\n"); exit(1); } @@ -175,6 +178,10 @@ void parse(const int argc, char *const *const argv, lib_settings->operating_point = parse_unsigned(optarg, ARG_OPPOINT, argv[0]); break; + case ARG_ALL_LAYERS: + lib_settings->all_layers = + !!parse_unsigned(optarg, ARG_ALL_LAYERS, argv[0]); + break; case 'v': fprintf(stderr, "%s\n", dav1d_version()); exit(0); -- cgit v1.2.3