config: Add --deblock to specify deblocking parameter offsets divided by

2.
This commit is contained in:
Yusuke Nakamura 2014-02-04 07:31:24 +09:00
parent 89800d3690
commit f40d9a3e2f
3 changed files with 21 additions and 4 deletions

View file

@ -61,6 +61,8 @@ int config_init(config *cfg)
cfg->qp = 32;
cfg->intra_period = 0;
cfg->deblock_enable = 1;
cfg->deblock_beta = 0;
cfg->deblock_tc = 0;
return 1;
}
@ -144,8 +146,19 @@ static int config_parse(config *cfg, const char *name, const char *value)
cfg->qp = atoi(value);
OPT("period")
cfg->intra_period = atoi(value);
OPT("deblock")
cfg->deblock_enable = atobool(value);
OPT("deblock") {
int beta, tc;
if (2 == sscanf(value, "%d:%d", &beta, &tc)) {
cfg->deblock_enable = 1;
cfg->deblock_beta = beta;
cfg->deblock_tc = tc;
} else if (sscanf(value, "%d", &beta)) {
cfg->deblock_enable = 1;
cfg->deblock_beta = beta;
cfg->deblock_tc = cfg->deblock_beta;
} else
cfg->deblock_enable = atobool(value);
}
else
return 0;
#undef OPT
@ -178,6 +191,7 @@ int config_read(config *cfg,int argc, char *argv[])
{ "qp", required_argument, NULL, 'q' },
{ "period", required_argument, NULL, 'p' },
{ "no-deblock", no_argument, NULL, 0 },
{ "deblock", required_argument, NULL, 0 },
{0, 0, 0, 0}
};

View file

@ -42,6 +42,8 @@ typedef struct
int32_t width; /*!< \brief frame width */
int32_t height; /*!< \brief frame height */
int8_t deblock_enable; /*!< \brief Flag to enable deblocking filter */
int8_t deblock_beta; /*!< \brief (deblocking) beta offset (div 2), range -6...6 */
int8_t deblock_tc; /*!< \brief (deblocking) tc offset (div 2), range -6...6 */
} config;
/* Function definitions */

View file

@ -101,6 +101,7 @@ int main(int argc, char *argv[])
fprintf(stderr, " 1: all pictures are intra\r\n");
fprintf(stderr, " 2-N: every Nth picture is intra\r\n");
fprintf(stderr, " --no-deblock : Disable deblocking filter\r\n");
fprintf(stderr, " --deblock <beta:tc> : Deblocking filter parameters\r\n");
if (cfg)
config_destroy(cfg);
@ -164,8 +165,8 @@ int main(int argc, char *argv[])
encoder->in.video_format = FORMAT_420;
// deblocking filter
encoder->deblock_enable = encoder->cfg->deblock_enable;
encoder->beta_offset_div2 = 0;
encoder->tc_offset_div2 = 0;
encoder->beta_offset_div2 = encoder->cfg->deblock_beta;
encoder->tc_offset_div2 = encoder->cfg->deblock_tc;
// SAO
encoder->sao_enable = 1;