diff options
Diffstat (limited to 'chromium/third_party/dav1d/libdav1d/tools')
5 files changed, 28 insertions, 11 deletions
diff --git a/chromium/third_party/dav1d/libdav1d/tools/dav1d_cli_parse.c b/chromium/third_party/dav1d/libdav1d/tools/dav1d_cli_parse.c index 3f68c4ccc85..4d747c03271 100644 --- a/chromium/third_party/dav1d/libdav1d/tools/dav1d_cli_parse.c +++ b/chromium/third_party/dav1d/libdav1d/tools/dav1d_cli_parse.c @@ -62,6 +62,7 @@ enum { ARG_NEG_STRIDE, ARG_OUTPUT_INVISIBLE, ARG_INLOOP_FILTERS, + ARG_DECODE_FRAME_TYPE, }; static const struct option long_opts[] = { @@ -88,6 +89,7 @@ static const struct option long_opts[] = { { "negstride", 0, NULL, ARG_NEG_STRIDE }, { "outputinvisible", 1, NULL, ARG_OUTPUT_INVISIBLE }, { "inloopfilters", 1, NULL, ARG_INLOOP_FILTERS }, + { "decodeframetype", 1, NULL, ARG_DECODE_FRAME_TYPE }, { NULL, 0, NULL, 0 }, }; @@ -145,7 +147,9 @@ static void usage(const char *const app, const char *const reason, ...) { " --negstride: use negative picture strides\n" " this is mostly meant as a developer option\n" " --outputinvisible $num: whether to output invisible (alt-ref) frames (default: 0)\n" - " --inloopfilters $str: which in-loop filters to enable (none, (no)deblock, (no)cdef, (no)restoration or all; default: all)\n"); + " --inloopfilters $str: which in-loop filters to enable (none, (no)deblock, (no)cdef, (no)restoration or all; default: all)\n" + " --decodeframetype $str: which frame types to decode (reference, intra, key or all; default: all)\n" + ); exit(1); } @@ -233,7 +237,13 @@ static const EnumParseTable inloop_filters_tbl[] = { { "restoration", DAV1D_INLOOPFILTER_RESTORATION }, { "norestoration", DAV1D_INLOOPFILTER_ALL - DAV1D_INLOOPFILTER_RESTORATION }, { "all", DAV1D_INLOOPFILTER_ALL }, - { 0 }, +}; + +static const EnumParseTable decode_frame_type_tbl[] = { + { "all", DAV1D_DECODEFRAMETYPE_ALL }, + { "reference", DAV1D_DECODEFRAMETYPE_REFERENCE }, + { "intra", DAV1D_DECODEFRAMETYPE_INTRA }, + { "key", DAV1D_DECODEFRAMETYPE_KEY }, }; #define ARRAY_SIZE(n) (sizeof(n)/sizeof(*(n))) @@ -382,6 +392,11 @@ void parse(const int argc, char *const *const argv, parse_enum(optarg, inloop_filters_tbl, ARRAY_SIZE(inloop_filters_tbl),ARG_INLOOP_FILTERS, argv[0]); break; + case ARG_DECODE_FRAME_TYPE: + lib_settings->decode_frame_type = + parse_enum(optarg, decode_frame_type_tbl, + ARRAY_SIZE(decode_frame_type_tbl), ARG_DECODE_FRAME_TYPE, argv[0]); + break; default: usage(argv[0], NULL); } diff --git a/chromium/third_party/dav1d/libdav1d/tools/input/annexb.c b/chromium/third_party/dav1d/libdav1d/tools/input/annexb.c index 7c7d4e30b3a..8add61c3558 100644 --- a/chromium/third_party/dav1d/libdav1d/tools/input/annexb.c +++ b/chromium/third_party/dav1d/libdav1d/tools/input/annexb.c @@ -43,7 +43,7 @@ // these functions are based on an implementation from FFmpeg, and relicensed // with author's permission -#define PROBE_SIZE 1024 +#define PROBE_SIZE 2048 static int annexb_probe(const uint8_t *data) { int ret, cnt = 0; @@ -113,10 +113,10 @@ static int annexb_probe(const uint8_t *data) { temporal_unit_size -= obu_unit_size; frame_unit_size -= obu_unit_size; if (frame_unit_size <= 0) - break; + return 0; } - return 0; + return seq; } typedef struct DemuxerPriv { diff --git a/chromium/third_party/dav1d/libdav1d/tools/input/input.c b/chromium/third_party/dav1d/libdav1d/tools/input/input.c index 4756648c749..2dfaa975c58 100644 --- a/chromium/third_party/dav1d/libdav1d/tools/input/input.c +++ b/chromium/third_party/dav1d/libdav1d/tools/input/input.c @@ -41,6 +41,7 @@ struct DemuxerContext { DemuxerPriv *data; const Demuxer *impl; + uint64_t priv_data[]; }; extern const Demuxer ivf_demuxer; @@ -109,12 +110,12 @@ int input_open(DemuxerContext **const c_out, } } - if (!(c = calloc(1, sizeof(DemuxerContext) + impl->priv_data_size))) { + if (!(c = calloc(1, offsetof(DemuxerContext, priv_data) + impl->priv_data_size))) { fprintf(stderr, "Failed to allocate memory\n"); return DAV1D_ERR(ENOMEM); } c->impl = impl; - c->data = (DemuxerPriv *) &c[1]; + c->data = (DemuxerPriv *) c->priv_data; if ((res = impl->open(c->data, filename, fps, num_frames, timebase)) < 0) { free(c); return res; diff --git a/chromium/third_party/dav1d/libdav1d/tools/input/section5.c b/chromium/third_party/dav1d/libdav1d/tools/input/section5.c index b7cc20332fe..db1b34c2274 100644 --- a/chromium/third_party/dav1d/libdav1d/tools/input/section5.c +++ b/chromium/third_party/dav1d/libdav1d/tools/input/section5.c @@ -39,7 +39,7 @@ #include "input/demuxer.h" #include "input/parse.h" -#define PROBE_SIZE 1024 +#define PROBE_SIZE 2048 static int section5_probe(const uint8_t *data) { int ret, cnt = 0; @@ -77,7 +77,7 @@ static int section5_probe(const uint8_t *data) { } } - return 0; + return seq; } typedef struct DemuxerPriv { diff --git a/chromium/third_party/dav1d/libdav1d/tools/output/output.c b/chromium/third_party/dav1d/libdav1d/tools/output/output.c index cf66d2ec5ab..f8910d4894b 100644 --- a/chromium/third_party/dav1d/libdav1d/tools/output/output.c +++ b/chromium/third_party/dav1d/libdav1d/tools/output/output.c @@ -46,6 +46,7 @@ struct MuxerContext { unsigned fps[2]; const char *filename; int framenum; + uint64_t priv_data[]; }; extern const Muxer null_muxer; @@ -123,12 +124,12 @@ int output_open(MuxerContext **const c_out, } } - if (!(c = malloc(sizeof(MuxerContext) + impl->priv_data_size))) { + if (!(c = malloc(offsetof(MuxerContext, priv_data) + impl->priv_data_size))) { fprintf(stderr, "Failed to allocate memory\n"); return DAV1D_ERR(ENOMEM); } c->impl = impl; - c->data = (MuxerPriv *) &c[1]; + c->data = (MuxerPriv *) c->priv_data; int have_num_pattern = 0; for (const char *ptr = filename ? strchr(filename, '%') : NULL; !have_num_pattern && ptr; ptr = strchr(ptr, '%')) |