shithub: dav1d

Download patch

ref: 3a4445bd11bc948c28b3e0706c599213ac221870
parent: 0eafb6f5abc61a8c08cd27c649c935b40f25fe70
author: Janne Grunau <[email protected]>
date: Fri Nov 23 16:50:17 EST 2018

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.

--- a/include/dav1d/dav1d.h
+++ b/include/dav1d/dav1d.h
@@ -47,6 +47,7 @@
     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;
 
 /**
--- a/src/internal.h
+++ b/src/internal.h
@@ -118,6 +118,7 @@
     int apply_grain;
     int operating_point;
     unsigned operating_point_idc;
+    int all_layers;
 };
 
 struct Dav1dFrameContext {
--- a/src/lib.c
+++ b/src/lib.c
@@ -63,6 +63,7 @@
     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 @@
     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;
--- a/tools/dav1d_cli_parse.c
+++ b/tools/dav1d_cli_parse.c
@@ -50,6 +50,7 @@
     ARG_VERIFY,
     ARG_FILM_GRAIN,
     ARG_OPPOINT,
+    ARG_ALL_LAYERS,
 };
 
 static const struct option long_opts[] = {
@@ -66,6 +67,7 @@
     { "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 @@
             " --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);
 }
@@ -174,6 +177,10 @@
         case ARG_OPPOINT:
             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());