mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
config: Add --no-deblock to disable deblocking filter.
This commit is contained in:
parent
4286c0f988
commit
89800d3690
26
src/config.c
26
src/config.c
|
@ -60,6 +60,7 @@ int config_init(config *cfg)
|
||||||
cfg->height = 240;
|
cfg->height = 240;
|
||||||
cfg->qp = 32;
|
cfg->qp = 32;
|
||||||
cfg->intra_period = 0;
|
cfg->intra_period = 0;
|
||||||
|
cfg->deblock_enable = 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -98,10 +99,32 @@ char *copy_string(const char *string)
|
||||||
return allocated_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)
|
static int config_parse(config *cfg, const char *name, const char *value)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return 0;
|
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))
|
#define OPT(STR) else if (!strcmp(name, STR))
|
||||||
if (0);
|
if (0);
|
||||||
|
@ -121,6 +144,8 @@ static int config_parse(config *cfg, const char *name, const char *value)
|
||||||
cfg->qp = atoi(value);
|
cfg->qp = atoi(value);
|
||||||
OPT("period")
|
OPT("period")
|
||||||
cfg->intra_period = atoi(value);
|
cfg->intra_period = atoi(value);
|
||||||
|
OPT("deblock")
|
||||||
|
cfg->deblock_enable = atobool(value);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
#undef OPT
|
#undef OPT
|
||||||
|
@ -152,6 +177,7 @@ int config_read(config *cfg,int argc, char *argv[])
|
||||||
{ "frames", required_argument, NULL, 'n' },
|
{ "frames", required_argument, NULL, 'n' },
|
||||||
{ "qp", required_argument, NULL, 'q' },
|
{ "qp", required_argument, NULL, 'q' },
|
||||||
{ "period", required_argument, NULL, 'p' },
|
{ "period", required_argument, NULL, 'p' },
|
||||||
|
{ "no-deblock", no_argument, NULL, 0 },
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,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 */
|
||||||
|
int8_t deblock_enable; /*!< \brief Flag to enable deblocking filter */
|
||||||
} config;
|
} config;
|
||||||
|
|
||||||
/* Function definitions */
|
/* Function definitions */
|
||||||
|
|
|
@ -100,6 +100,7 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stderr, " 0: only first picture is intra\r\n");
|
fprintf(stderr, " 0: only first picture is intra\r\n");
|
||||||
fprintf(stderr, " 1: all pictures are 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, " 2-N: every Nth picture is intra\r\n");
|
||||||
|
fprintf(stderr, " --no-deblock : Disable deblocking filter\r\n");
|
||||||
|
|
||||||
if (cfg)
|
if (cfg)
|
||||||
config_destroy(cfg);
|
config_destroy(cfg);
|
||||||
|
@ -162,7 +163,7 @@ int main(int argc, char *argv[])
|
||||||
encoder->QP = encoder->cfg->qp;
|
encoder->QP = encoder->cfg->qp;
|
||||||
encoder->in.video_format = FORMAT_420;
|
encoder->in.video_format = FORMAT_420;
|
||||||
// deblocking filter
|
// deblocking filter
|
||||||
encoder->deblock_enable = 1;
|
encoder->deblock_enable = encoder->cfg->deblock_enable;
|
||||||
encoder->beta_offset_div2 = 0;
|
encoder->beta_offset_div2 = 0;
|
||||||
encoder->tc_offset_div2 = 0;
|
encoder->tc_offset_div2 = 0;
|
||||||
// SAO
|
// SAO
|
||||||
|
|
Loading…
Reference in a new issue