Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
cad9d7fc
Commit
cad9d7fc
authored
Dec 27, 2022
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/palettegen: allow a minimum of 2 colors
parent
c94988a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
vf_palettegen.c
libavfilter/vf_palettegen.c
+6
-1
No files found.
libavfilter/vf_palettegen.c
View file @
cad9d7fc
...
...
@@ -82,7 +82,7 @@ typedef struct PaletteGenContext {
#define OFFSET(x) offsetof(PaletteGenContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
palettegen_options
[]
=
{
{
"max_colors"
,
"set the maximum number of colors to use in the palette"
,
OFFSET
(
max_colors
),
AV_OPT_TYPE_INT
,
{.
i64
=
256
},
4
,
256
,
FLAGS
},
{
"max_colors"
,
"set the maximum number of colors to use in the palette"
,
OFFSET
(
max_colors
),
AV_OPT_TYPE_INT
,
{.
i64
=
256
},
2
,
256
,
FLAGS
},
{
"reserve_transparent"
,
"reserve a palette entry for transparency"
,
OFFSET
(
reserve_transparent
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
1
},
0
,
1
,
FLAGS
},
{
"transparency_color"
,
"set a background color for transparency"
,
OFFSET
(
transparency_color
),
AV_OPT_TYPE_COLOR
,
{.
str
=
"lime"
},
0
,
0
,
FLAGS
},
{
"stats_mode"
,
"set statistics mode"
,
OFFSET
(
stats_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
STATS_MODE_ALL_FRAMES
},
0
,
NB_STATS_MODE
-
1
,
FLAGS
,
"mode"
},
...
...
@@ -586,6 +586,11 @@ static int init(AVFilterContext *ctx)
if
(
s
->
use_alpha
&&
s
->
reserve_transparent
)
s
->
reserve_transparent
=
0
;
if
(
s
->
max_colors
-
s
->
reserve_transparent
<
2
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"max_colors=2 is only allowed without reserving a transparent color slot
\n
"
);
return
AVERROR
(
EINVAL
);
}
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment