2015-05-13 09:45:11 +00:00
|
|
|
/*****************************************************************************
|
2021-11-23 06:46:06 +00:00
|
|
|
* This file is part of uvg266 VVC encoder.
|
2021-10-07 08:32:59 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
* are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer in the documentation and/or
|
|
|
|
* other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
|
|
|
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
* INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
****************************************************************************/
|
2015-05-13 09:45:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* \file
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-07-03 12:04:36 +00:00
|
|
|
#include "cli.h"
|
2015-05-13 09:45:11 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2015-07-03 12:04:36 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <getopt.h>
|
2015-07-29 16:07:27 +00:00
|
|
|
#include <ctype.h>
|
2015-05-13 09:45:11 +00:00
|
|
|
|
2021-12-02 20:57:44 +00:00
|
|
|
static const char short_options[] = "i:o:d:n:q:p:r:";
|
2015-07-03 12:04:36 +00:00
|
|
|
static const struct option long_options[] = {
|
|
|
|
{ "input", required_argument, NULL, 'i' },
|
|
|
|
{ "output", required_argument, NULL, 'o' },
|
|
|
|
{ "debug", required_argument, NULL, 'd' },
|
2018-03-23 10:33:06 +00:00
|
|
|
{ "frames", required_argument, NULL, 'n' },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "qp", required_argument, NULL, 'q' },
|
|
|
|
{ "period", required_argument, NULL, 'p' },
|
|
|
|
{ "ref", required_argument, NULL, 'r' },
|
|
|
|
{ "vps-period", required_argument, NULL, 0 },
|
|
|
|
{ "input-res", required_argument, NULL, 0 },
|
|
|
|
{ "input-fps", required_argument, NULL, 0 },
|
2021-04-30 06:51:41 +00:00
|
|
|
{ "lmcs", no_argument, NULL, 0 },
|
2015-11-13 12:20:27 +00:00
|
|
|
{ "deblock", required_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "no-deblock", no_argument, NULL, 0 },
|
2020-09-07 09:35:40 +00:00
|
|
|
{ "sao", required_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "no-sao", no_argument, NULL, 0 },
|
2020-11-20 12:48:37 +00:00
|
|
|
{ "alf", required_argument, NULL, 0 },
|
2019-07-04 07:20:18 +00:00
|
|
|
{ "no-alf", no_argument, NULL, 0 },
|
2015-11-03 15:30:16 +00:00
|
|
|
{ "rdoq", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "no-rdoq", no_argument, NULL, 0 },
|
2015-11-03 15:30:16 +00:00
|
|
|
{ "signhide", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "no-signhide", no_argument, NULL, 0 },
|
|
|
|
{ "rd", required_argument, NULL, 0 },
|
|
|
|
{ "full-intra-search", no_argument, NULL, 0 },
|
2015-11-03 15:30:16 +00:00
|
|
|
{ "no-full-intra-search", no_argument, NULL, 0 },
|
|
|
|
{ "transform-skip", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "no-transform-skip", no_argument, NULL, 0 },
|
2022-06-06 06:28:06 +00:00
|
|
|
{ "chroma-transform-skip", no_argument, NULL, 0 },
|
|
|
|
{ "no-chroma-transform-skip", no_argument, NULL, 0 },
|
2021-12-02 20:04:09 +00:00
|
|
|
{ "tr-skip-max-size", required_argument, NULL, 0 },
|
2020-12-18 15:40:47 +00:00
|
|
|
{ "mts", required_argument, NULL, 0 },
|
|
|
|
{ "no-mts", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "tr-depth-intra", required_argument, NULL, 0 },
|
|
|
|
{ "me", required_argument, NULL, 0 },
|
|
|
|
{ "subme", required_argument, NULL, 0 },
|
2015-08-13 09:53:14 +00:00
|
|
|
{ "source-scan-type", required_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "sar", required_argument, NULL, 0 },
|
|
|
|
{ "overscan", required_argument, NULL, 0 },
|
|
|
|
{ "videoformat", required_argument, NULL, 0 },
|
|
|
|
{ "range", required_argument, NULL, 0 },
|
|
|
|
{ "colorprim", required_argument, NULL, 0 },
|
|
|
|
{ "transfer", required_argument, NULL, 0 },
|
|
|
|
{ "colormatrix", required_argument, NULL, 0 },
|
|
|
|
{ "chromaloc", required_argument, NULL, 0 },
|
|
|
|
{ "aud", no_argument, NULL, 0 },
|
2015-11-03 15:30:16 +00:00
|
|
|
{ "no-aud", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "cqmfile", required_argument, NULL, 0 },
|
|
|
|
{ "seek", required_argument, NULL, 0 },
|
2016-03-07 13:54:35 +00:00
|
|
|
{ "tiles", required_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "tiles-width-split", required_argument, NULL, 0 },
|
|
|
|
{ "tiles-height-split", required_argument, NULL, 0 },
|
|
|
|
{ "wpp", no_argument, NULL, 0 },
|
2015-11-03 15:30:16 +00:00
|
|
|
{ "no-wpp", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "owf", required_argument, NULL, 0 },
|
2017-01-31 13:44:23 +00:00
|
|
|
{ "slices", required_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "threads", required_argument, NULL, 0 },
|
2018-03-23 10:32:27 +00:00
|
|
|
{ "cpuid", optional_argument, NULL, 0 },
|
|
|
|
{ "no-cpuid", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "pu-depth-inter", required_argument, NULL, 0 },
|
|
|
|
{ "pu-depth-intra", required_argument, NULL, 0 },
|
2015-11-03 15:30:16 +00:00
|
|
|
{ "info", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "no-info", no_argument, NULL, 0 },
|
|
|
|
{ "gop", required_argument, NULL, 0 },
|
|
|
|
{ "bipred", no_argument, NULL, 0 },
|
2015-11-03 15:30:16 +00:00
|
|
|
{ "no-bipred", no_argument, NULL, 0 },
|
2015-07-03 12:04:36 +00:00
|
|
|
{ "bitrate", required_argument, NULL, 0 },
|
2015-11-03 10:04:22 +00:00
|
|
|
{ "preset", required_argument, NULL, 0 },
|
2015-11-05 11:59:30 +00:00
|
|
|
{ "mv-rdo", no_argument, NULL, 0 },
|
|
|
|
{ "no-mv-rdo", no_argument, NULL, 0 },
|
2016-01-21 13:08:34 +00:00
|
|
|
{ "psnr", no_argument, NULL, 0 },
|
|
|
|
{ "no-psnr", no_argument, NULL, 0 },
|
2016-02-04 11:22:17 +00:00
|
|
|
{ "version", no_argument, NULL, 0 },
|
|
|
|
{ "help", no_argument, NULL, 0 },
|
2016-02-18 17:27:14 +00:00
|
|
|
{ "loop-input", no_argument, NULL, 0 },
|
2016-02-24 10:10:51 +00:00
|
|
|
{ "mv-constraint", required_argument, NULL, 0 },
|
2016-03-17 15:00:43 +00:00
|
|
|
{ "hash", required_argument, NULL, 0 },
|
2016-05-10 11:15:41 +00:00
|
|
|
{"cu-split-termination",required_argument, NULL, 0 },
|
2016-06-07 07:55:26 +00:00
|
|
|
{ "crypto", required_argument, NULL, 0 },
|
2017-08-28 15:15:13 +00:00
|
|
|
{ "key", required_argument, NULL, 0 },
|
2016-06-06 12:47:31 +00:00
|
|
|
{ "me-early-termination",required_argument, NULL, 0 },
|
2018-04-13 14:54:11 +00:00
|
|
|
{ "intra-rdo-et", no_argument, NULL, 0 },
|
|
|
|
{ "no-intra-rdo-et", no_argument, NULL, 0 },
|
2016-05-26 07:38:45 +00:00
|
|
|
{ "lossless", no_argument, NULL, 0 },
|
|
|
|
{ "no-lossless", no_argument, NULL, 0 },
|
2016-08-10 08:58:15 +00:00
|
|
|
{ "tmvp", no_argument, NULL, 0 },
|
|
|
|
{ "no-tmvp", no_argument, NULL, 0 },
|
2016-08-17 07:07:40 +00:00
|
|
|
{ "rdoq-skip", no_argument, NULL, 0 },
|
2016-09-11 08:40:16 +00:00
|
|
|
{ "no-rdoq-skip", no_argument, NULL, 0 },
|
2016-08-16 16:03:21 +00:00
|
|
|
{ "input-bitdepth", required_argument, NULL, 0 },
|
|
|
|
{ "input-format", required_argument, NULL, 0 },
|
2016-08-03 05:18:56 +00:00
|
|
|
{ "implicit-rdpcm", no_argument, NULL, 0 },
|
|
|
|
{ "no-implicit-rdpcm", no_argument, NULL, 0 },
|
2017-01-16 06:47:21 +00:00
|
|
|
{ "roi", required_argument, NULL, 0 },
|
2017-04-19 12:47:47 +00:00
|
|
|
{ "erp-aqp", no_argument, NULL, 0 },
|
|
|
|
{ "no-erp-aqp", no_argument, NULL, 0 },
|
2017-11-03 11:04:05 +00:00
|
|
|
{ "level", required_argument, NULL, 0 },
|
2017-11-03 13:47:35 +00:00
|
|
|
{ "force-level", required_argument, NULL, 0 },
|
2017-11-20 14:05:28 +00:00
|
|
|
{ "high-tier", no_argument, NULL, 0 },
|
2017-12-22 10:10:41 +00:00
|
|
|
{ "me-steps", required_argument, NULL, 0 },
|
2018-03-21 08:46:30 +00:00
|
|
|
{ "roi-file", required_argument, NULL, 0 },
|
2018-06-19 10:39:23 +00:00
|
|
|
{ "fast-residual-cost", required_argument, NULL, 0 },
|
2018-08-21 13:37:55 +00:00
|
|
|
{ "set-qp-in-cu", no_argument, NULL, 0 },
|
2018-10-02 06:55:30 +00:00
|
|
|
{ "open-gop", no_argument, NULL, 0 },
|
|
|
|
{ "no-open-gop", no_argument, NULL, 0 },
|
2020-04-20 13:21:40 +00:00
|
|
|
{ "vaq", required_argument, NULL, 0 },
|
2020-02-04 12:14:39 +00:00
|
|
|
{ "no-vaq", no_argument, NULL, 0 },
|
2018-11-15 07:33:02 +00:00
|
|
|
{ "scaling-list", required_argument, NULL, 0 },
|
2019-02-12 07:21:03 +00:00
|
|
|
{ "max-merge", required_argument, NULL, 0 },
|
2019-07-06 18:34:29 +00:00
|
|
|
{ "early-skip", no_argument, NULL, 0 },
|
|
|
|
{ "no-early-skip", no_argument, NULL, 0 },
|
2020-01-27 11:11:31 +00:00
|
|
|
{ "ml-pu-depth-intra", no_argument, NULL, 0 },
|
2020-01-31 12:22:32 +00:00
|
|
|
{ "partial-coding", required_argument, NULL, 0 },
|
2020-02-04 19:06:21 +00:00
|
|
|
{ "zero-coeff-rdo", no_argument, NULL, 0 },
|
|
|
|
{ "no-zero-coeff-rdo", no_argument, NULL, 0 },
|
2020-02-15 20:15:34 +00:00
|
|
|
{ "intra-qp-offset", required_argument, NULL, 0 },
|
2019-11-18 12:20:43 +00:00
|
|
|
{ "rc-algorithm", required_argument, NULL, 0 },
|
|
|
|
{ "intra-bits", no_argument, NULL, 0 },
|
|
|
|
{ "no-intra-bits", no_argument, NULL, 0 },
|
2019-12-06 07:51:04 +00:00
|
|
|
{ "clip-neighbour", no_argument, NULL, 0 },
|
|
|
|
{ "no-clip-neighbour", no_argument, NULL, 0 },
|
2020-09-07 11:04:48 +00:00
|
|
|
{ "input-file-format", required_argument, NULL, 0 },
|
2020-09-14 11:24:56 +00:00
|
|
|
{ "stats-file-prefix", required_argument, NULL, 0 },
|
2020-09-25 16:18:56 +00:00
|
|
|
{ "fast-coeff-table", required_argument, NULL, 0 },
|
2020-11-03 11:23:19 +00:00
|
|
|
{ "fastrd-sampling", no_argument, NULL, 0 },
|
|
|
|
{ "fastrd-accuracy-check", no_argument, NULL, 0 },
|
2020-11-05 17:47:47 +00:00
|
|
|
{ "fastrd-outdir", required_argument, NULL, 0 },
|
2021-04-23 07:19:43 +00:00
|
|
|
{ "chroma-qp-in", required_argument, NULL, 0 },
|
|
|
|
{ "chroma-qp-out", required_argument, NULL, 0 },
|
2021-07-25 20:34:45 +00:00
|
|
|
{ "mrl", no_argument, NULL, 0 },
|
|
|
|
{ "no-mrl", no_argument, NULL, 0 },
|
2021-12-15 14:25:08 +00:00
|
|
|
{ "mip", no_argument, NULL, 0 },
|
|
|
|
{ "no-mip", no_argument, NULL, 0 },
|
2022-02-22 18:06:53 +00:00
|
|
|
{ "lfnst", no_argument, NULL, 0 },
|
|
|
|
{ "no-lfnst", no_argument, NULL, 0 },
|
2021-08-16 12:39:14 +00:00
|
|
|
{ "jccr", no_argument, NULL, 0 },
|
|
|
|
{ "no-jccr", no_argument, NULL, 0 },
|
2021-11-17 12:14:27 +00:00
|
|
|
{ "amvr", no_argument, NULL, 0 },
|
|
|
|
{ "no-amvr", no_argument, NULL, 0 },
|
2021-11-17 09:33:57 +00:00
|
|
|
{ "cclm", no_argument, NULL, 0 },
|
|
|
|
{ "no-cclm", no_argument, NULL, 0 },
|
2021-12-02 08:42:30 +00:00
|
|
|
{ "combine-intra-cus", no_argument, NULL, 0 },
|
|
|
|
{ "no-combine-intra-cus", no_argument, NULL, 0 },
|
2022-03-17 12:48:08 +00:00
|
|
|
{ "force-inter", no_argument, NULL, 0 },
|
|
|
|
{ "no-force-inter", no_argument, NULL, 0 },
|
2022-06-03 10:28:40 +00:00
|
|
|
{ "cabac-debug-file", required_argument, NULL, 0 },
|
2020-01-27 11:11:31 +00:00
|
|
|
{0, 0, 0, 0}
|
2015-07-03 12:04:36 +00:00
|
|
|
};
|
|
|
|
|
2015-07-29 16:07:27 +00:00
|
|
|
/**
|
|
|
|
* \brief Try to detect resolution from file name automatically
|
|
|
|
*
|
|
|
|
* \param file_name file name to get dimensions from
|
|
|
|
* \param out_width detected width
|
|
|
|
* \param out_height detected height
|
|
|
|
* \return 1 if the resolution is set, 0 on fail
|
|
|
|
*/
|
|
|
|
static int select_input_res_auto(const char *file_name, int32_t *out_width, int32_t *out_height)
|
|
|
|
{
|
|
|
|
if (!file_name) return 0;
|
|
|
|
|
|
|
|
// Find the last delimiter char ( / or \ ). Hope the other kind is not used in the name.
|
|
|
|
// If delim is not found, set pointer to the beginning.
|
2015-07-31 15:44:36 +00:00
|
|
|
unsigned char* sub_str = (unsigned char*)MAX(strrchr(file_name, '/'), strrchr(file_name, '\\'));
|
|
|
|
if (!sub_str) sub_str = (unsigned char*)file_name;
|
2015-07-29 16:07:27 +00:00
|
|
|
|
|
|
|
int success = 0;
|
|
|
|
// Try if the substring starts with "<int>x<int>" without either of them being 0
|
|
|
|
do {
|
2015-07-31 15:44:36 +00:00
|
|
|
success = (sscanf((char*)sub_str, "%dx%d%*s", out_width, out_height) == 2);
|
2015-07-29 16:07:27 +00:00
|
|
|
success &= (*out_width > 0 && *out_height > 0);
|
|
|
|
// Move to the next char until a digit is found or the string ends
|
|
|
|
do{
|
|
|
|
++sub_str;
|
|
|
|
} while (*sub_str != 0 && !isdigit(*sub_str));
|
|
|
|
// Continue until "<int>x<int>" is found or the string ends
|
|
|
|
} while (*sub_str != 0 && !success);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2020-09-07 11:04:48 +00:00
|
|
|
/**
|
|
|
|
* \brief Try to detect file format from file name automatically
|
|
|
|
*
|
|
|
|
* \param file_name file name to get format from
|
|
|
|
* \return 0 (auto) if no format is detected, or id of the format
|
|
|
|
*/
|
|
|
|
static int detect_file_format(const char *file_name) {
|
|
|
|
if (!file_name) return 0;
|
|
|
|
|
2020-09-09 13:05:59 +00:00
|
|
|
// Find the last dot in the file name.
|
|
|
|
// If delim is not found, return 0
|
2020-09-07 12:39:31 +00:00
|
|
|
char* sub_str = (char*)strrchr(file_name, '.');
|
2020-09-07 11:04:48 +00:00
|
|
|
if (!sub_str) return 0;
|
2020-09-10 09:57:25 +00:00
|
|
|
if (strlen(sub_str) != 4) return 0;
|
2020-09-09 13:05:59 +00:00
|
|
|
char ending_lower_case[4];
|
|
|
|
for(int i = 0; i < 4; i++){
|
|
|
|
ending_lower_case[i] = tolower(sub_str[i]);
|
|
|
|
}
|
2020-09-07 11:04:48 +00:00
|
|
|
|
2022-04-28 11:18:09 +00:00
|
|
|
// UVG_FILE_FORMAT
|
2020-09-10 09:57:25 +00:00
|
|
|
if (strncmp(ending_lower_case, ".y4m", 4) == 0) return 1;
|
|
|
|
else if (strncmp(ending_lower_case, ".yuv", 4) == 0) return 2;
|
2020-09-07 11:04:48 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-07-03 12:04:36 +00:00
|
|
|
/**
|
|
|
|
* \brief Parse command line arguments.
|
|
|
|
* \param argc Number of arguments
|
|
|
|
* \param argv Argument list
|
|
|
|
* \return Pointer to the parsed options, or NULL on failure.
|
|
|
|
*/
|
2022-04-28 11:18:09 +00:00
|
|
|
cmdline_opts_t* cmdline_opts_parse(const uvg_api *const api, int argc, char *argv[])
|
2015-07-03 12:04:36 +00:00
|
|
|
{
|
|
|
|
int ok = 1;
|
|
|
|
cmdline_opts_t *opts = calloc(1, sizeof(cmdline_opts_t));
|
|
|
|
if (!opts) {
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
opts->config = api->config_alloc();
|
|
|
|
if (!opts->config || !api->config_init(opts->config)) {
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse command line options
|
|
|
|
for (optind = 0;;) {
|
|
|
|
int long_options_index = -1;
|
|
|
|
|
|
|
|
int c = getopt_long(argc, argv, short_options, long_options, &long_options_index);
|
|
|
|
if (c == -1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (long_options_index < 0) {
|
|
|
|
int i;
|
|
|
|
for (i = 0; long_options[i].name; i++)
|
|
|
|
if (long_options[i].val == c) {
|
|
|
|
long_options_index = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (long_options_index < 0) {
|
|
|
|
// getopt_long already printed an error message
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* name = long_options[long_options_index].name;
|
|
|
|
if (!strcmp(name, "input")) {
|
|
|
|
if (opts->input) {
|
|
|
|
fprintf(stderr, "Input error: More than one input file given.\n");
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
opts->input = strdup(optarg);
|
|
|
|
} else if (!strcmp(name, "output")) {
|
|
|
|
if (opts->output) {
|
|
|
|
fprintf(stderr, "Input error: More than one output file given.\n");
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
opts->output = strdup(optarg);
|
|
|
|
} else if (!strcmp(name, "debug")) {
|
|
|
|
if (opts->debug) {
|
|
|
|
fprintf(stderr, "Input error: More than one debug output file given.\n");
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
opts->debug = strdup(optarg);
|
|
|
|
} else if (!strcmp(name, "seek")) {
|
|
|
|
opts->seek = atoi(optarg);
|
|
|
|
} else if (!strcmp(name, "frames")) {
|
|
|
|
opts->frames = atoi(optarg);
|
2016-02-04 11:22:17 +00:00
|
|
|
} else if (!strcmp(name, "version")) {
|
|
|
|
opts->version = true;
|
|
|
|
goto done;
|
|
|
|
} else if (!strcmp(name, "help")) {
|
|
|
|
opts->help = true;
|
|
|
|
goto done;
|
2016-02-18 17:27:14 +00:00
|
|
|
} else if (!strcmp(name, "loop-input")) {
|
|
|
|
opts->loop_input = true;
|
2015-11-09 11:57:28 +00:00
|
|
|
} else if (!api->config_parse(opts->config, name, optarg)) {
|
2015-07-03 12:04:36 +00:00
|
|
|
fprintf(stderr, "invalid argument: %s=%s\n", name, optarg);
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-13 11:55:23 +00:00
|
|
|
// Check for extra arguments.
|
|
|
|
if (argc - optind > 0) {
|
|
|
|
fprintf(stderr, "Input error: Extra argument found: \"%s\"\n", argv[optind]);
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2015-07-03 12:04:36 +00:00
|
|
|
// Check that the required files were defined
|
|
|
|
if (opts->input == NULL || opts->output == NULL) {
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2015-10-15 12:23:40 +00:00
|
|
|
if (opts->config->vps_period < 0) {
|
2022-06-18 10:49:09 +00:00
|
|
|
// Disabling parameter sets is only possible when using uvg266 as
|
2015-10-15 12:23:40 +00:00
|
|
|
// a library.
|
|
|
|
fprintf(stderr, "Input error: vps_period must be non-negative\n");
|
|
|
|
ok = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2020-09-07 11:04:48 +00:00
|
|
|
// Check the file name for format
|
2022-04-28 11:18:09 +00:00
|
|
|
if (opts->config->file_format == UVG_FORMAT_AUTO) {
|
2020-09-07 11:04:48 +00:00
|
|
|
opts->config->file_format = detect_file_format(opts->input);
|
|
|
|
}
|
|
|
|
|
2015-07-29 16:07:27 +00:00
|
|
|
// Set resolution automatically if necessary
|
2022-04-28 11:18:09 +00:00
|
|
|
if ((opts->config->file_format == UVG_FORMAT_AUTO || opts->config->file_format == UVG_FORMAT_YUV)
|
2020-09-09 13:05:59 +00:00
|
|
|
&& opts->config->width == 0 && opts->config->height == 0) {
|
2015-07-29 16:07:27 +00:00
|
|
|
ok = select_input_res_auto(opts->input, &opts->config->width, &opts->config->height);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2015-07-03 12:04:36 +00:00
|
|
|
done:
|
|
|
|
if (!ok) {
|
|
|
|
cmdline_opts_free(api, opts);
|
|
|
|
opts = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return opts;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Deallocate a cmdline_opts_t structure.
|
|
|
|
*/
|
2022-04-28 11:18:09 +00:00
|
|
|
void cmdline_opts_free(const uvg_api *const api, cmdline_opts_t *opts)
|
2015-07-03 12:04:36 +00:00
|
|
|
{
|
|
|
|
if (opts) {
|
|
|
|
FREE_POINTER(opts->input);
|
|
|
|
FREE_POINTER(opts->output);
|
|
|
|
FREE_POINTER(opts->debug);
|
|
|
|
api->config_destroy(opts->config);
|
|
|
|
opts->config = NULL;
|
|
|
|
}
|
|
|
|
FREE_POINTER(opts);
|
|
|
|
}
|
2015-05-14 15:33:57 +00:00
|
|
|
|
2015-05-13 09:45:11 +00:00
|
|
|
|
2016-02-04 11:22:17 +00:00
|
|
|
void print_usage(void)
|
|
|
|
{
|
|
|
|
fprintf(stdout,
|
2022-05-02 17:51:24 +00:00
|
|
|
"usage: -i and --input-res to set input, -o to set output\n"
|
2021-12-02 20:57:44 +00:00
|
|
|
" --help for more information\n");
|
2016-02-04 11:22:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-05-05 10:28:50 +00:00
|
|
|
void print_version(bool to_stderr)
|
2015-05-13 09:45:11 +00:00
|
|
|
{
|
2022-05-05 10:28:50 +00:00
|
|
|
fprintf(to_stderr ? stderr : stdout,
|
2022-05-02 17:51:24 +00:00
|
|
|
"uvg266 " VERSION_STRING " [" UVG_COMPILER_STRING "] " UVG_COMPILE_DATE "\n");
|
2015-05-13 09:45:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void print_help(void)
|
|
|
|
{
|
2016-02-04 11:22:17 +00:00
|
|
|
fprintf(stdout,
|
2015-05-13 09:45:11 +00:00
|
|
|
"Usage:\n"
|
2021-07-27 06:50:39 +00:00
|
|
|
"uvg266 -i <input> --input-res <width>x<height> -o <output>\n"
|
2015-05-13 09:45:11 +00:00
|
|
|
"\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2016-10-26 23:33:11 +00:00
|
|
|
"Required:\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" -i, --input <filename> : Input file\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" --input-res <res> : Input resolution [auto]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" - auto: Detect from file name.\n"
|
|
|
|
" - <int>x<int>: width times height\n"
|
|
|
|
" -o, --output <filename> : Output file\n"
|
2016-10-26 23:33:11 +00:00
|
|
|
"\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2016-10-26 23:33:11 +00:00
|
|
|
"Presets:\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --preset <preset> : Set options to a preset [medium]\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" - ultrafast, superfast, veryfast, faster,\n"
|
|
|
|
" fast, medium, slow, slower, veryslow\n"
|
2016-10-26 23:33:11 +00:00
|
|
|
" placebo\n"
|
|
|
|
"\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2016-10-26 23:33:11 +00:00
|
|
|
"Input:\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" -n, --frames <integer> : Number of frames to code [all]\n"
|
|
|
|
" --seek <integer> : First frame to code [0]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --input-fps <num>[/<denom>] : Frame rate of the input video [25]\n"
|
|
|
|
" --source-scan-type <string> : Source scan type [progressive]\n"
|
|
|
|
" - progressive: Progressive scan\n"
|
|
|
|
" - tff: Top field first\n"
|
|
|
|
" - bff: Bottom field first\n"
|
|
|
|
" --input-format <string> : P420 or P400 [P420]\n"
|
|
|
|
" --input-bitdepth <int> : 8-16 [8]\n"
|
|
|
|
" --loop-input : Re-read input file forever.\n"
|
2020-09-09 13:05:59 +00:00
|
|
|
" --input-file-format <string> : Input file format [auto]\n"
|
2020-09-07 11:04:48 +00:00
|
|
|
" - auto: Check the file ending for format\n"
|
2020-09-09 13:05:59 +00:00
|
|
|
" - y4m (skips frame headers)\n"
|
|
|
|
" - yuv\n"
|
2016-10-26 23:33:11 +00:00
|
|
|
"\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2016-10-26 23:33:11 +00:00
|
|
|
"Options:\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --help : Print this help message and exit.\n"
|
|
|
|
" --version : Print version information and exit.\n"
|
|
|
|
" --(no-)aud : Use access unit delimiters. [disabled]\n"
|
|
|
|
" --debug <filename> : Output internal reconstruction.\n"
|
|
|
|
" --(no-)cpuid : Enable runtime CPU optimizations. [enabled]\n"
|
|
|
|
" --hash <string> : Decoded picture hash [checksum]\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" - none: 0 bytes\n"
|
|
|
|
" - checksum: 18 bytes\n"
|
|
|
|
" - md5: 56 bytes\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)psnr : Calculate PSNR for frames. [enabled]\n"
|
|
|
|
" --(no-)info : Add encoder info SEI. [enabled]\n"
|
2020-09-09 09:35:47 +00:00
|
|
|
" --stats-file-prefix : A prefix used for stats files that include\n"
|
|
|
|
" bits, lambda, distortion, and qp for each ctu.\n"
|
|
|
|
" These are meant for debugging and are not\n"
|
2020-09-14 11:24:56 +00:00
|
|
|
" written unless the prefix is defined.\n"
|
2022-06-03 10:28:40 +00:00
|
|
|
" --cabac-debug-file : A debug file for cabac context.\n"
|
|
|
|
" Ignore this, it is only for tests.\n"
|
2016-10-26 23:33:11 +00:00
|
|
|
"\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2016-10-26 23:33:11 +00:00
|
|
|
"Video structure:\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" -q, --qp <integer> : Quantization parameter [22]\n"
|
|
|
|
" -p, --period <integer> : Period of intra pictures [64]\n"
|
|
|
|
" - 0: Only first picture is intra.\n"
|
|
|
|
" - 1: All pictures are intra.\n"
|
|
|
|
" - N: Every Nth picture is intra.\n"
|
|
|
|
" --vps-period <integer> : How often the video parameter set is re-sent [0]\n"
|
|
|
|
" - 0: Only send VPS with the first frame.\n"
|
|
|
|
" - N: Send VPS with every Nth intra frame.\n"
|
2018-03-26 09:13:55 +00:00
|
|
|
" -r, --ref <integer> : Number of reference frames, in range 1..15 [4]\n"
|
2020-02-15 20:21:25 +00:00
|
|
|
" --gop <string> : GOP structure [lp-g4d3t1]\n"
|
|
|
|
" - 0: Disabled\n"
|
|
|
|
" - 8: B-frame pyramid of length 8\n"
|
|
|
|
" - 16: B-frame pyramid of length 16\n"
|
|
|
|
" - lp-<string>: Low-delay P/B-frame GOP\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" (e.g. lp-g8d4t2, see README)\n"
|
2020-03-31 10:19:05 +00:00
|
|
|
" --intra-qp-offset <int>: QP offset for intra frames [-51..51] [auto]\n"
|
|
|
|
" - N: Set QP offset to N.\n"
|
|
|
|
" - auto: Select offset automatically based\n"
|
2020-03-31 12:27:48 +00:00
|
|
|
" on GOP length.\n"
|
2018-10-02 06:55:30 +00:00
|
|
|
" --(no-)open-gop : Use open GOP configuration. [enabled]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --cqmfile <filename> : Read custom quantization matrices from a file.\n"
|
2018-11-15 07:33:02 +00:00
|
|
|
" --scaling-list <string>: Set scaling list mode. [off]\n"
|
|
|
|
" - off: Disable scaling lists.\n"
|
|
|
|
" - custom: use custom list (with --cqmfile).\n"
|
|
|
|
" - default: Use default lists.\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --bitrate <integer> : Target bitrate [0]\n"
|
|
|
|
" - 0: Disable rate control.\n"
|
|
|
|
" - N: Target N bits per second.\n"
|
2019-11-18 12:20:43 +00:00
|
|
|
" --rc-algorithm <string>: Select used rc-algorithm. [lambda]\n"
|
|
|
|
" - lambda: rate control from:\n"
|
|
|
|
" DOI: 10.1109/TIP.2014.2336550 \n"
|
|
|
|
" - oba: DOI: 10.1109/TCSVT.2016.2589878\n"
|
2020-03-19 08:47:28 +00:00
|
|
|
" --(no-)intra-bits : Use Hadamard cost based allocation for intra\n"
|
2019-11-18 12:20:43 +00:00
|
|
|
" frames. Default on for gop 8 and off for lp-gop\n"
|
2020-03-19 08:47:28 +00:00
|
|
|
" --(no-)clip-neighbour : On oba based rate control whether to clip \n"
|
|
|
|
" lambda values to same frame's ctus or previous'.\n"
|
|
|
|
" Default on for RA GOPS and disabled for LP.\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)lossless : Use lossless coding. [disabled]\n"
|
|
|
|
" --mv-constraint <string> : Constrain movement vectors. [none]\n"
|
|
|
|
" - none: No constraint\n"
|
|
|
|
" - frametile: Constrain within the tile.\n"
|
|
|
|
" - frametilemargin: Constrain even more.\n"
|
|
|
|
" --roi <filename> : Use a delta QP map for region of interest.\n"
|
2022-02-06 18:08:28 +00:00
|
|
|
" Reads an array of delta QP values from a file.\n"
|
|
|
|
" Text and binary files are supported and detected\n"
|
|
|
|
" from the file extension (.txt/.bin). If a known\n"
|
|
|
|
" extension is not found, the file is treated as\n"
|
|
|
|
" a text file. The file can include one or many\n"
|
|
|
|
" ROI frames each in the following format:\n"
|
|
|
|
" width and height of the QP delta map followed\n"
|
|
|
|
" by width * height delta QP values in raster\n"
|
|
|
|
" order. In binary format, width and height are\n"
|
|
|
|
" 32-bit integers whereas the delta QP values are\n"
|
|
|
|
" signed 8-bit values. The map can be of any size\n"
|
|
|
|
" and will be scaled to the video size. The file\n"
|
|
|
|
" reading will loop if end of the file is reached.\n"
|
|
|
|
" See roi.txt in the examples folder.\n"
|
2018-08-21 13:37:55 +00:00
|
|
|
" --set-qp-in-cu : Set QP at CU level keeping pic_init_qp_minus26.\n"
|
2019-05-22 14:26:10 +00:00
|
|
|
" in PPS and slice_qp_delta in slize header zero.\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)erp-aqp : Use adaptive QP for 360 degree video with\n"
|
|
|
|
" equirectangular projection. [disabled]\n"
|
2017-11-09 14:53:31 +00:00
|
|
|
" --level <number> : Use the given HEVC level in the output and give\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" an error if level limits are exceeded. [6.2]\n"
|
|
|
|
" - 1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6,\n"
|
|
|
|
" 6.1, 6.2\n"
|
|
|
|
" --force-level <number> : Same as --level but warnings instead of errors.\n"
|
|
|
|
" --high-tier : Used with --level. Use high tier bitrate limits\n"
|
|
|
|
" instead of the main tier limits during encoding.\n"
|
2018-05-28 10:53:20 +00:00
|
|
|
" High tier requires level 4 or higher.\n"
|
2020-04-20 13:21:40 +00:00
|
|
|
" --(no-)vaq <integer> : Enable variance adaptive quantization with given\n"
|
|
|
|
" strength, in range 1..20. Recommended: 5.\n"
|
|
|
|
" [disabled]\n"
|
2021-04-23 07:19:43 +00:00
|
|
|
" --chroma-qp-in : List of input values used for mapping the luma\n"
|
|
|
|
" QP into chroma qp. [17,27,32,44]\n"
|
|
|
|
" --chroma-qp-out : List of output values used for mapping the luma\n"
|
|
|
|
" QP into chroma qp. These two lists have to be\n"
|
|
|
|
" same length, start with same value, and can\n"
|
|
|
|
" contain maximum 16 or 36 - starting value\n"
|
|
|
|
" elements. [17,27,32,44]\n"
|
2016-10-26 23:33:11 +00:00
|
|
|
"\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2016-10-26 23:33:11 +00:00
|
|
|
"Compression tools:\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)deblock <beta:tc> : Deblocking filter. [0:0]\n"
|
|
|
|
" - beta: Between -6 and 6\n"
|
|
|
|
" - tc: Between -6 and 6\n"
|
|
|
|
" --sao <string> : Sample Adaptive Offset [full]\n"
|
|
|
|
" - off: SAO disabled\n"
|
|
|
|
" - band: Band offset only\n"
|
|
|
|
" - edge: Edge offset only\n"
|
|
|
|
" - full: Full SAO\n"
|
2021-07-27 06:50:39 +00:00
|
|
|
" --alf <string> : Adaptive Loop Filter [off]\n"
|
|
|
|
" - off: ALF disabled\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" - no-cc: ALF enabled without cross component\n"
|
|
|
|
" refinement\n"
|
2021-07-27 06:50:39 +00:00
|
|
|
" - full: Full ALF\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)rdoq : Rate-distortion optimized quantization [enabled]\n"
|
2018-03-26 09:13:55 +00:00
|
|
|
" --(no-)rdoq-skip : Skip RDOQ for 4x4 blocks. [disabled]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)signhide : Sign hiding [disabled]\n"
|
2018-03-26 09:13:55 +00:00
|
|
|
" --rd <integer> : Intra mode search complexity [0]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" - 0: Skip intra if inter is good enough.\n"
|
|
|
|
" - 1: Rough intra mode search with SATD.\n"
|
|
|
|
" - 2: Refine intra mode search with SSE.\n"
|
2021-11-25 10:32:27 +00:00
|
|
|
" - 3: Enable intra chroma mode search.\n"
|
|
|
|
" - 4: Try all intra modes.\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)mv-rdo : Rate-distortion optimized motion vector costs\n"
|
|
|
|
" [disabled]\n"
|
2020-02-04 19:06:21 +00:00
|
|
|
" --(no-)zero-coeff-rdo : If a CU is set inter, check if forcing zero\n"
|
2020-02-15 20:29:08 +00:00
|
|
|
" residual improves the RD cost. [enabled]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)full-intra-search : Try all intra modes during rough search.\n"
|
|
|
|
" [disabled]\n"
|
|
|
|
" --(no-)transform-skip : Try transform skip [disabled]\n"
|
2022-06-06 06:28:06 +00:00
|
|
|
" --(no-)chroma-transform-skip : Try transform skip for chroma \n"
|
|
|
|
" blocks. [disabled]\n"
|
2021-12-02 20:04:09 +00:00
|
|
|
" --tr-skip-max-size : Max log2 size of transform skip 2..5 [2]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --me <string> : Integer motion estimation algorithm [hexbs]\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" - hexbs: Hexagon Based Search\n"
|
|
|
|
" - tz: Test Zone Search\n"
|
|
|
|
" - full: Full Search\n"
|
|
|
|
" - full8, full16, full32, full64\n"
|
2017-12-12 12:45:01 +00:00
|
|
|
" - dia: Diamond Search\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --me-steps <integer> : Motion estimation search step limit. Only\n"
|
|
|
|
" affects 'hexbs' and 'dia'. [-1]\n"
|
|
|
|
" --subme <integer> : Fractional pixel motion estimation level [4]\n"
|
|
|
|
" - 0: Integer motion estimation only\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" - 1: + 1/2-pixel horizontal and vertical\n"
|
|
|
|
" - 2: + 1/2-pixel diagonal\n"
|
|
|
|
" - 3: + 1/4-pixel horizontal and vertical\n"
|
|
|
|
" - 4: + 1/4-pixel diagonal\n"
|
2018-03-26 09:13:55 +00:00
|
|
|
" --pu-depth-inter <int>-<int> : Inter prediction units sizes [0-3]\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" - 0, 1, 2, 3: from 64x64 to 8x8\n"
|
2020-03-20 11:07:48 +00:00
|
|
|
" - Accepts a list of values separated by ','\n"
|
|
|
|
" for setting separate depths per GOP layer\n"
|
|
|
|
" (values can be omitted to use the first\n"
|
2020-03-20 11:27:07 +00:00
|
|
|
" value for the respective layer).\n"
|
2018-03-26 09:13:55 +00:00
|
|
|
" --pu-depth-intra <int>-<int> : Intra prediction units sizes [1-4]\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" - 0, 1, 2, 3, 4: from 64x64 to 4x4\n"
|
2020-03-20 11:07:48 +00:00
|
|
|
" - Accepts a list of values separated by ','\n"
|
|
|
|
" for setting separate depths per GOP layer\n"
|
|
|
|
" (values can be omitted to use the first\n"
|
2020-03-20 11:27:07 +00:00
|
|
|
" value for the respective layer).\n"
|
2020-01-27 11:11:31 +00:00
|
|
|
" --ml-pu-depth-intra : Predict the pu-depth-intra using machine\n"
|
|
|
|
" learning trees, overrides the\n"
|
|
|
|
" --pu-depth-intra parameter. [disabled]\n"
|
2021-12-02 08:42:30 +00:00
|
|
|
" --(no-)combine-intra-cus: Whether the encoder tries to code a cu\n"
|
|
|
|
" on lower depth even when search is not\n"
|
|
|
|
" performed on said depth. Should only\n"
|
|
|
|
" be disabled if cus absolutely must not\n"
|
|
|
|
" be larger than limited by the search.\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" [enabled]\n"
|
2022-03-17 12:48:08 +00:00
|
|
|
" --force-inter : Force the encoder to use inter always.\n"
|
|
|
|
" This is mostly for debugging and is not\n"
|
|
|
|
" guaranteed to produce sensible bitstream or\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" work at all. [disabled]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --tr-depth-intra <int> : Transform split depth for intra blocks [0]\n"
|
|
|
|
" --(no-)bipred : Bi-prediction [disabled]\n"
|
|
|
|
" --cu-split-termination <string> : CU split search termination [zero]\n"
|
|
|
|
" - off: Don't terminate early.\n"
|
|
|
|
" - zero: Terminate when residual is zero.\n"
|
|
|
|
" --me-early-termination <string> : Motion estimation termination [on]\n"
|
|
|
|
" - off: Don't terminate early.\n"
|
|
|
|
" - on: Terminate early.\n"
|
|
|
|
" - sensitive: Terminate even earlier.\n"
|
2018-06-19 10:39:23 +00:00
|
|
|
" --fast-residual-cost <int> : Skip CABAC cost for residual coefficients\n"
|
|
|
|
" when QP is below the limit. [0]\n"
|
2020-10-06 18:17:36 +00:00
|
|
|
" --fast-coeff-table <string> : Read custom weights for residual\n"
|
|
|
|
" coefficients from a file instead of using\n"
|
|
|
|
" defaults [default]\n"
|
2020-12-01 20:52:30 +00:00
|
|
|
" --fast-rd-sampling : Enable learning data sampling for fast coefficient\n"
|
|
|
|
" table generation\n"
|
|
|
|
" --fastrd-accuracy-check : Evaluate the accuracy of fast coefficient\n"
|
|
|
|
" prediction\n"
|
|
|
|
" --fastrd-outdir : Directory to which to output sampled data or accuracy\n"
|
|
|
|
" data, into <fastrd-outdir>/0.txt to 50.txt, one file\n"
|
|
|
|
" for each QP that blocks were estimated on\n"
|
2018-04-13 14:54:11 +00:00
|
|
|
" --(no-)intra-rdo-et : Check intra modes in rdo stage only until\n"
|
|
|
|
" a zero coefficient CU is found. [disabled]\n"
|
2019-07-06 18:34:29 +00:00
|
|
|
" --(no-)early-skip : Try to find skip cu from merge candidates.\n"
|
|
|
|
" Perform no further search if skip is found.\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" For rd = 0..1: Try the first candidate.\n"
|
|
|
|
" For rd = 2.. : Try the best candidate based\n"
|
|
|
|
" on luma satd cost. [enabled]\n"
|
2021-11-23 06:46:06 +00:00
|
|
|
" --max-merge <integer> : Maximum number of merge candidates, 1..6 [6]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --(no-)implicit-rdpcm : Implicit residual DPCM. Currently only supported\n"
|
|
|
|
" with lossless coding. [disabled]\n"
|
|
|
|
" --(no-)tmvp : Temporal motion vector prediction [enabled]\n"
|
2021-07-25 20:34:45 +00:00
|
|
|
" --(no-)mrl : Enable use of multiple reference lines in intra\n"
|
|
|
|
" predictions.\n"
|
2022-04-29 10:28:10 +00:00
|
|
|
" --(no-)mip : Enable matrix weighted intra prediction.\n"
|
2022-05-23 11:47:25 +00:00
|
|
|
" --(no-)lfnst : Enable low frequency non-separable transform. [disabled]\n"
|
2021-07-27 06:50:39 +00:00
|
|
|
" --mts <string> : Multiple Transform Selection [off].\n"
|
|
|
|
" (Currently only implemented for intra\n"
|
|
|
|
" and has effect only when rd >= 2)\n"
|
|
|
|
" - off: MTS disabled\n"
|
|
|
|
" - intra: MTS applied only for intra blocks.\n"
|
|
|
|
" - inter: MTS applied only for inter blocks.\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" - both: MTS applied for both intra and inter\n"
|
|
|
|
" blocks.\n"
|
|
|
|
" - implicit: uses implicit MTS. Applies DST7\n"
|
2022-06-14 07:38:42 +00:00
|
|
|
" instead of DCT2 to certain intra\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" blocks.\n"
|
2022-04-29 10:28:10 +00:00
|
|
|
" --(no-)jccr : Joint coding of chroma residual.\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" Requires rdo >= 2. [disabled]\n"
|
2021-11-17 09:33:57 +00:00
|
|
|
" --(no-)cclm : Cross component linear model. \n"
|
|
|
|
" Extra chroma prediction modes that are formed\n"
|
|
|
|
" via linear transformation from the luma\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" prediction. Requires rdo >= 3. [disabled\n"
|
2021-11-17 12:14:27 +00:00
|
|
|
" --(no-)amvr : Adaptive Motion Vector Resolution.\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" Code some MVs with reduced resolution [disabled]\n"
|
2015-05-13 09:45:11 +00:00
|
|
|
"\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2016-10-26 23:33:11 +00:00
|
|
|
"Parallel processing:\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" --threads <integer> : Number of threads to use [auto]\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" - 0: Process everything with main thread.\n"
|
|
|
|
" - N: Use N threads for encoding.\n"
|
|
|
|
" - auto: Select automatically.\n"
|
|
|
|
" --owf <integer> : Frame-level parallelism [auto]\n"
|
2018-06-18 06:33:36 +00:00
|
|
|
" - N: Process N+1 frames at a time.\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" - auto: Select automatically.\n"
|
2018-05-30 11:13:15 +00:00
|
|
|
" --(no-)wpp : Wavefront parallel processing. [enabled]\n"
|
|
|
|
" Enabling tiles automatically disables WPP.\n"
|
|
|
|
" To enable WPP with tiles, re-enable it after\n"
|
|
|
|
" enabling tiles. Enabling wpp with tiles is,\n"
|
|
|
|
" however, an experimental feature since it is\n"
|
|
|
|
" not supported in any HEVC profile.\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" --tiles <int>x<int> : Split picture into width x height uniform tiles.\n"
|
|
|
|
" --tiles-width-split <string>|u<int> :\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" - <string>: A comma-separated list of tile\n"
|
|
|
|
" column pixel coordinates.\n"
|
|
|
|
" - u<int>: Number of tile columns of uniform\n"
|
|
|
|
" width.\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" --tiles-height-split <string>|u<int> :\n"
|
2022-06-13 08:29:20 +00:00
|
|
|
" - <string>: A comma-separated list of tile\n"
|
|
|
|
" row column pixel coordinates.\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" - u<int>: Number of tile rows of uniform\n"
|
|
|
|
" height.\n"
|
|
|
|
" --slices <string> : Control how slices are used.\n"
|
|
|
|
" - tiles: Put tiles in independent slices.\n"
|
|
|
|
" - wpp: Put rows in dependent slices.\n"
|
|
|
|
" - tiles+wpp: Do both.\n"
|
2020-01-31 12:22:32 +00:00
|
|
|
" --partial-coding <x-offset>!<y-offset>!<slice-width>!<slice-height>\n"
|
|
|
|
" : Encode partial frame.\n"
|
|
|
|
" Parts must be merged to form a valid bitstream.\n"
|
|
|
|
" X and Y are CTU offsets.\n"
|
|
|
|
" Slice width and height must be divisible by CTU\n"
|
2020-01-31 14:19:48 +00:00
|
|
|
" in pixels unless it is the last CTU row/column.\n"
|
|
|
|
" This parameter is used by kvaShare.\n"
|
2016-10-26 23:33:11 +00:00
|
|
|
"\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2016-10-26 23:33:11 +00:00
|
|
|
"Video Usability Information:\n"
|
2018-03-23 10:33:06 +00:00
|
|
|
" --sar <width:height> : Specify sample aspect ratio\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" --overscan <string> : Specify crop overscan setting [undef]\n"
|
|
|
|
" - undef, show, crop\n"
|
|
|
|
" --videoformat <string> : Specify video format [undef]\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
" - undef, component, pal, ntsc, secam, mac\n"
|
2016-11-04 13:30:58 +00:00
|
|
|
" --range <string> : Specify color range [tv]\n"
|
|
|
|
" - tv, pc\n"
|
|
|
|
" --colorprim <string> : Specify color primaries [undef]\n"
|
|
|
|
" - undef, bt709, bt470m, bt470bg,\n"
|
|
|
|
" smpte170m, smpte240m, film, bt2020\n"
|
|
|
|
" --transfer <string> : Specify transfer characteristics [undef]\n"
|
|
|
|
" - undef, bt709, bt470m, bt470bg,\n"
|
|
|
|
" smpte170m, smpte240m, linear, log100,\n"
|
|
|
|
" log316, iec61966-2-4, bt1361e,\n"
|
|
|
|
" iec61966-2-1, bt2020-10, bt2020-12\n"
|
|
|
|
" --colormatrix <string> : Specify color matrix setting [undef]\n"
|
|
|
|
" - undef, bt709, fcc, bt470bg, smpte170m,\n"
|
|
|
|
" smpte240m, GBR, YCgCo, bt2020nc, bt2020c\n"
|
|
|
|
" --chromaloc <integer> : Specify chroma sample location (0 to 5) [0]\n"
|
2017-12-07 08:47:44 +00:00
|
|
|
/* Word wrap to this width to stay under 80 characters (including ") *************/
|
2022-05-02 19:11:53 +00:00
|
|
|
);
|
2015-05-13 09:45:11 +00:00
|
|
|
}
|
2015-05-14 15:33:57 +00:00
|
|
|
|
|
|
|
|
2022-04-28 11:18:09 +00:00
|
|
|
void print_frame_info(const uvg_frame_info *const info,
|
2015-09-09 07:28:45 +00:00
|
|
|
const double frame_psnr[3],
|
2017-07-19 07:38:37 +00:00
|
|
|
const uint32_t bytes,
|
2019-11-04 15:08:07 +00:00
|
|
|
const bool print_psnr,
|
|
|
|
const double avg_qp)
|
2015-05-14 15:33:57 +00:00
|
|
|
{
|
2019-05-13 13:57:38 +00:00
|
|
|
fprintf(stderr, "POC %4d QP %2d AVG QP %.1f (%c-frame) %10d bits",
|
2015-09-09 07:28:45 +00:00
|
|
|
info->poc,
|
|
|
|
info->qp,
|
2019-05-13 13:57:38 +00:00
|
|
|
avg_qp,
|
2015-09-09 07:28:45 +00:00
|
|
|
"BPI"[info->slice_type % 3],
|
2017-07-19 07:38:37 +00:00
|
|
|
bytes << 3);
|
2019-05-13 13:57:38 +00:00
|
|
|
|
2017-07-19 07:38:37 +00:00
|
|
|
if (print_psnr) {
|
|
|
|
fprintf(stderr, " PSNR Y %2.4f U %2.4f V %2.4f",
|
|
|
|
frame_psnr[0], frame_psnr[1], frame_psnr[2]);
|
|
|
|
}
|
2015-05-14 15:33:57 +00:00
|
|
|
|
2022-04-28 11:18:09 +00:00
|
|
|
if (info->slice_type != UVG_SLICE_I) {
|
2015-09-09 07:01:02 +00:00
|
|
|
// Print reference picture lists
|
2015-05-14 15:33:57 +00:00
|
|
|
fprintf(stderr, " [L0 ");
|
2017-09-25 10:48:56 +00:00
|
|
|
for (int j = 0; j < info->ref_list_len[0]; j++) {
|
2015-09-09 07:28:45 +00:00
|
|
|
fprintf(stderr, "%d ", info->ref_list[0][j]);
|
2015-05-14 15:33:57 +00:00
|
|
|
}
|
|
|
|
fprintf(stderr, "] [L1 ");
|
2015-09-09 07:28:45 +00:00
|
|
|
for (int j = 0; j < info->ref_list_len[1]; j++) {
|
|
|
|
fprintf(stderr, "%d ", info->ref_list[1][j]);
|
2015-05-14 15:33:57 +00:00
|
|
|
}
|
|
|
|
fprintf(stderr, "]");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
}
|