config: Add --no-deblock to disable deblocking filter.

This commit is contained in:
Yusuke Nakamura 2014-02-04 07:16:42 +09:00
parent 4286c0f988
commit 89800d3690
3 changed files with 31 additions and 3 deletions

View file

@ -60,6 +60,7 @@ int config_init(config *cfg)
cfg->height = 240;
cfg->qp = 32;
cfg->intra_period = 0;
cfg->deblock_enable = 1;
return 1;
}
@ -98,10 +99,32 @@ char *copy_string(const char *string)
return allocated_string;
}
static int atobool(const char *str)
{
if (!strcmp(str, "1") ||
!strcmp(str, "true") ||
!strcmp(str, "yes"))
return 1;
if (!strcmp(str, "0") ||
!strcmp(str, "false") ||
!strcmp(str, "no"))
return 0;
return 0;
}
static int config_parse(config *cfg, const char *name, const char *value)
{
int i;
if (!name)
return 0;
if (!value)
value = "true";
if ((!strncmp(name, "no-", 3) && (i = 3))) {
name += i;
value = atobool(value) ? "false" : "true";
}
#define OPT(STR) else if (!strcmp(name, STR))
if (0);
@ -121,6 +144,8 @@ 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);
else
return 0;
#undef OPT
@ -152,6 +177,7 @@ int config_read(config *cfg,int argc, char *argv[])
{ "frames", required_argument, NULL, 'n' },
{ "qp", required_argument, NULL, 'q' },
{ "period", required_argument, NULL, 'p' },
{ "no-deblock", no_argument, NULL, 0 },
{0, 0, 0, 0}
};

View file

@ -41,6 +41,7 @@ typedef struct
int32_t frames; /*!< \brief Number of frames to decode */
int32_t width; /*!< \brief frame width */
int32_t height; /*!< \brief frame height */
int8_t deblock_enable; /*!< \brief Flag to enable deblocking filter */
} config;
/* Function definitions */

View file

@ -100,6 +100,7 @@ int main(int argc, char *argv[])
fprintf(stderr, " 0: only first picture is intra\r\n");
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");
if (cfg)
config_destroy(cfg);
@ -162,7 +163,7 @@ int main(int argc, char *argv[])
encoder->QP = encoder->cfg->qp;
encoder->in.video_format = FORMAT_420;
// deblocking filter
encoder->deblock_enable = 1;
encoder->deblock_enable = encoder->cfg->deblock_enable;
encoder->beta_offset_div2 = 0;
encoder->tc_offset_div2 = 0;
// SAO