Add --input-fps and --bitrate parameters.

This commit is contained in:
Arttu Ylä-Outinen 2015-03-13 16:31:00 +02:00
parent 5b8cd76f01
commit d27cde55a4
4 changed files with 28 additions and 0 deletions

View file

@ -20,6 +20,7 @@ http://github.com/ultravideo/kvazaar/wiki/List-of-suggested-topics for a list of
-n, --frames <integer> : Number of frames to code [all] -n, --frames <integer> : Number of frames to code [all]
--seek <integer> : First frame to code [0] --seek <integer> : First frame to code [0]
--input-res <int>x<int> : Input resolution (width x height) --input-res <int>x<int> : Input resolution (width x height)
--input-fps <number> : Framerate of the input video [25.0]
-q, --qp <integer> : Quantization Parameter [32] -q, --qp <integer> : Quantization Parameter [32]
-p, --period <integer> : Period of intra pictures [0] -p, --period <integer> : Period of intra pictures [0]
0: only first picture is intra 0: only first picture is intra
@ -60,6 +61,9 @@ http://github.com/ultravideo/kvazaar/wiki/List-of-suggested-topics for a list of
--no-info : Don't add information about the encoder to settings. --no-info : Don't add information about the encoder to settings.
--gop <int> : Length of Group of Pictures, must be 8 or 0 [0] --gop <int> : Length of Group of Pictures, must be 8 or 0 [0]
--bipred : Enable bi-prediction search --bipred : Enable bi-prediction search
--bitrate <integer> : Target bitrate. [0]
0: disable rate-control
N: target N bits per second
Video Usability Information: Video Usability Information:
--sar <width:height> : Specify Sample Aspect Ratio --sar <width:height> : Specify Sample Aspect Ratio

View file

@ -60,6 +60,7 @@ int config_init(config_t *cfg)
cfg->frames = 0; cfg->frames = 0;
cfg->width = 0; cfg->width = 0;
cfg->height = 0; cfg->height = 0;
cfg->framerate = 25;
cfg->qp = 32; cfg->qp = 32;
cfg->intra_period = 0; cfg->intra_period = 0;
cfg->vps_period = 0; cfg->vps_period = 0;
@ -90,6 +91,7 @@ int config_init(config_t *cfg)
cfg->seek = 0; cfg->seek = 0;
cfg->gop_len = 0; cfg->gop_len = 0;
cfg->bipred = 0; cfg->bipred = 0;
cfg->target_bitrate = 0;
cfg->tiles_width_count = 0; cfg->tiles_width_count = 0;
cfg->tiles_height_count = 0; cfg->tiles_height_count = 0;
@ -344,6 +346,13 @@ static int config_parse(config_t *cfg, const char *name, const char *value)
cfg->width = cfg->height = 0; cfg->width = cfg->height = 0;
} }
} }
else if OPT("input-fps") {
cfg->framerate = atof(value);
if (cfg->framerate <= 0.0) {
fprintf(stderr, "Input error: --input-fps must be positive\n");
error = 1;
}
}
else if OPT("frames") else if OPT("frames")
cfg->frames = atoi(value); cfg->frames = atoi(value);
else if OPT("qp") else if OPT("qp")
@ -566,6 +575,13 @@ static int config_parse(config_t *cfg, const char *name, const char *value)
} }
else if OPT("bipred") else if OPT("bipred")
cfg->bipred = atobool(value); cfg->bipred = atobool(value);
else if OPT("bitrate") {
cfg->target_bitrate = atoi(value);
if (cfg->target_bitrate < 0) {
fprintf(stderr, "Input error: --bitrate must be nonnegative\n");
error = 1;
}
}
else else
return 0; return 0;
#undef OPT #undef OPT
@ -596,6 +612,7 @@ int config_read(config_t *cfg,int argc, char *argv[])
{ "ref", required_argument, NULL, 'r' }, { "ref", required_argument, NULL, 'r' },
{ "vps-period", required_argument, NULL, 0 }, { "vps-period", required_argument, NULL, 0 },
{ "input-res", required_argument, NULL, 0 }, { "input-res", required_argument, NULL, 0 },
{ "input-fps", required_argument, NULL, 0 },
{ "no-deblock", no_argument, NULL, 0 }, { "no-deblock", no_argument, NULL, 0 },
{ "deblock", required_argument, NULL, 0 }, { "deblock", required_argument, NULL, 0 },
{ "no-sao", no_argument, NULL, 0 }, { "no-sao", no_argument, NULL, 0 },
@ -630,6 +647,7 @@ int config_read(config_t *cfg,int argc, char *argv[])
{ "no-info", no_argument, NULL, 0 }, { "no-info", no_argument, NULL, 0 },
{ "gop", required_argument, NULL, 0 }, { "gop", required_argument, NULL, 0 },
{ "bipred", no_argument, NULL, 0 }, { "bipred", no_argument, NULL, 0 },
{ "bitrate", required_argument, NULL, 0 },
{0, 0, 0, 0} {0, 0, 0, 0}
}; };

View file

@ -54,6 +54,7 @@ typedef struct
int32_t frames; /*!< \brief Number of frames to decode */ int32_t frames; /*!< \brief Number of frames to decode */
int32_t width; /*!< \brief frame width */ int32_t width; /*!< \brief frame width */
int32_t height; /*!< \brief frame height */ int32_t height; /*!< \brief frame height */
double framerate; /*!< \brief Input framerate */
int32_t deblock_enable; /*!< \brief Flag to enable deblocking filter */ int32_t deblock_enable; /*!< \brief Flag to enable deblocking filter */
int32_t sao_enable; /*!< \brief Flag to enable sample adaptive offset filter */ int32_t sao_enable; /*!< \brief Flag to enable sample adaptive offset filter */
int32_t rdoq_enable; /*!< \brief Flag to enable RD optimized quantization. */ int32_t rdoq_enable; /*!< \brief Flag to enable RD optimized quantization. */
@ -107,6 +108,7 @@ typedef struct
int8_t gop_len; /*!< \brief length of GOP for the video sequence */ int8_t gop_len; /*!< \brief length of GOP for the video sequence */
gop_config_t gop[MAX_GOP]; /*!< \brief Array of GOP settings */ gop_config_t gop[MAX_GOP]; /*!< \brief Array of GOP settings */
int32_t target_bitrate;
} config_t; } config_t;
/* Function definitions */ /* Function definitions */

View file

@ -99,6 +99,7 @@ int main(int argc, char *argv[])
" -n, --frames <integer> : Number of frames to code [all]\n" " -n, --frames <integer> : Number of frames to code [all]\n"
" --seek <integer> : First frame to code [0]\n" " --seek <integer> : First frame to code [0]\n"
" --input-res <int>x<int> : Input resolution (width x height)\n" " --input-res <int>x<int> : Input resolution (width x height)\n"
" --input-fps <number> : Framerate of the input video [25.0]\n"
" -q, --qp <integer> : Quantization Parameter [32]\n" " -q, --qp <integer> : Quantization Parameter [32]\n"
" -p, --period <integer> : Period of intra pictures [0]\n" " -p, --period <integer> : Period of intra pictures [0]\n"
" 0: only first picture is intra\n" " 0: only first picture is intra\n"
@ -139,6 +140,9 @@ int main(int argc, char *argv[])
" --no-info : Don't add information about the encoder to settings.\n" " --no-info : Don't add information about the encoder to settings.\n"
" --gop <int> : Length of Group of Pictures, must be 8 or 0 [0]\n" " --gop <int> : Length of Group of Pictures, must be 8 or 0 [0]\n"
" --bipred : Enable bi-prediction search\n" " --bipred : Enable bi-prediction search\n"
" --bitrate <integer> : Target bitrate. [0]\n"
" 0: disable rate-control\n"
" N: target N bits per second\n"
"\n" "\n"
" Video Usability Information:\n" " Video Usability Information:\n"
" --sar <width:height> : Specify Sample Aspect Ratio\n" " --sar <width:height> : Specify Sample Aspect Ratio\n"