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
c6364b71
Commit
c6364b71
authored
Jun 02, 2022
by
rcombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/vf_tonemap_opencl: fix build
This was broken in
d42b410e
.
parent
3e580351
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
vf_tonemap_opencl.c
libavfilter/vf_tonemap_opencl.c
+19
-20
No files found.
libavfilter/vf_tonemap_opencl.c
View file @
c6364b71
...
...
@@ -80,16 +80,6 @@ static const char *const delinearize_funcs[AVCOL_TRC_NB] = {
[
AVCOL_TRC_BT2020_10
]
=
"inverse_eotf_bt1886"
,
};
static
const
struct
PrimaryCoefficients
primaries_table
[
AVCOL_PRI_NB
]
=
{
[
AVCOL_PRI_BT709
]
=
{
0
.
640
,
0
.
330
,
0
.
300
,
0
.
600
,
0
.
150
,
0
.
060
},
[
AVCOL_PRI_BT2020
]
=
{
0
.
708
,
0
.
292
,
0
.
170
,
0
.
797
,
0
.
131
,
0
.
046
},
};
static
const
struct
WhitepointCoefficients
whitepoint_table
[
AVCOL_PRI_NB
]
=
{
[
AVCOL_PRI_BT709
]
=
{
0
.
3127
,
0
.
3290
},
[
AVCOL_PRI_BT2020
]
=
{
0
.
3127
,
0
.
3290
},
};
static
const
char
*
const
tonemap_func
[
TONEMAP_MAX
]
=
{
[
TONEMAP_NONE
]
=
"direct"
,
[
TONEMAP_LINEAR
]
=
"linear"
,
...
...
@@ -100,14 +90,22 @@ static const char *const tonemap_func[TONEMAP_MAX] = {
[
TONEMAP_MOBIUS
]
=
"mobius"
,
};
static
void
get_rgb2rgb_matrix
(
enum
AVColorPrimaries
in
,
enum
AVColorPrimaries
out
,
double
rgb2rgb
[
3
][
3
])
{
static
int
get_rgb2rgb_matrix
(
enum
AVColorPrimaries
in
,
enum
AVColorPrimaries
out
,
double
rgb2rgb
[
3
][
3
])
{
double
rgb2xyz
[
3
][
3
],
xyz2rgb
[
3
][
3
];
ff_fill_rgb2xyz_table
(
&
primaries_table
[
out
],
&
whitepoint_table
[
out
],
rgb2xyz
);
const
AVColorPrimariesDesc
*
in_primaries
=
av_csp_primaries_desc_from_id
(
in
);
const
AVColorPrimariesDesc
*
out_primaries
=
av_csp_primaries_desc_from_id
(
out
);
if
(
!
in_primaries
||
!
out_primaries
)
return
AVERROR
(
EINVAL
);
ff_fill_rgb2xyz_table
(
&
out_primaries
->
prim
,
&
out_primaries
->
wp
,
rgb2xyz
);
ff_matrix_invert_3x3
(
rgb2xyz
,
xyz2rgb
);
ff_fill_rgb2xyz_table
(
&
primaries_table
[
in
],
&
whitepoint_table
[
in
]
,
rgb2xyz
);
ff_fill_rgb2xyz_table
(
&
in_primaries
->
prim
,
&
in_primaries
->
wp
,
rgb2xyz
);
ff_matrix_mul_3x3
(
rgb2rgb
,
rgb2xyz
,
xyz2rgb
);
return
0
;
}
#define OPENCL_SOURCE_NB 3
...
...
@@ -120,7 +118,7 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
TonemapOpenCLContext
*
ctx
=
avctx
->
priv
;
int
rgb2rgb_passthrough
=
1
;
double
rgb2rgb
[
3
][
3
],
rgb2yuv
[
3
][
3
],
yuv2rgb
[
3
][
3
];
const
struct
LumaCoefficients
*
luma_src
,
*
luma_dst
;
const
AV
LumaCoefficients
*
luma_src
,
*
luma_dst
;
cl_int
cle
;
int
err
;
AVBPrint
header
;
...
...
@@ -184,7 +182,8 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
av_bprintf
(
&
header
,
"#define DETECTION_FRAMES %d
\n
"
,
DETECTION_FRAMES
);
if
(
ctx
->
primaries_out
!=
ctx
->
primaries_in
)
{
get_rgb2rgb_matrix
(
ctx
->
primaries_in
,
ctx
->
primaries_out
,
rgb2rgb
);
if
((
err
=
get_rgb2rgb_matrix
(
ctx
->
primaries_in
,
ctx
->
primaries_out
,
rgb2rgb
))
<
0
)
goto
fail
;
rgb2rgb_passthrough
=
0
;
}
if
(
ctx
->
range_in
==
AVCOL_RANGE_JPEG
)
...
...
@@ -201,7 +200,7 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
ff_opencl_print_const_matrix_3x3
(
&
header
,
"rgb2rgb"
,
rgb2rgb
);
luma_src
=
ff_get_luma_coefficients
(
ctx
->
colorspace_in
);
luma_src
=
av_csp_luma_coeffs_from_avcsp
(
ctx
->
colorspace_in
);
if
(
!
luma_src
)
{
err
=
AVERROR
(
EINVAL
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported input colorspace %d (%s)
\n
"
,
...
...
@@ -209,7 +208,7 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
goto
fail
;
}
luma_dst
=
ff_get_luma_coefficients
(
ctx
->
colorspace_out
);
luma_dst
=
av_csp_luma_coeffs_from_avcsp
(
ctx
->
colorspace_out
);
if
(
!
luma_dst
)
{
err
=
AVERROR
(
EINVAL
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported output colorspace %d (%s)
\n
"
,
...
...
@@ -225,9 +224,9 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
ff_opencl_print_const_matrix_3x3
(
&
header
,
"rgb_matrix"
,
yuv2rgb
);
av_bprintf
(
&
header
,
"constant float3 luma_src = {%.4ff, %.4ff, %.4ff};
\n
"
,
luma_src
->
cr
,
luma_src
->
cg
,
luma_src
->
cb
);
av_q2d
(
luma_src
->
cr
),
av_q2d
(
luma_src
->
cg
),
av_q2d
(
luma_src
->
cb
)
);
av_bprintf
(
&
header
,
"constant float3 luma_dst = {%.4ff, %.4ff, %.4ff};
\n
"
,
luma_dst
->
cr
,
luma_dst
->
cg
,
luma_dst
->
cb
);
av_q2d
(
luma_dst
->
cr
),
av_q2d
(
luma_dst
->
cg
),
av_q2d
(
luma_dst
->
cb
)
);
av_bprintf
(
&
header
,
"#define linearize %s
\n
"
,
linearize_funcs
[
ctx
->
trc_in
]);
av_bprintf
(
&
header
,
"#define delinearize %s
\n
"
,
...
...
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