Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
572ef567
Commit
572ef567
authored
Jul 25, 2018
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_tonemap_opencl: Move update_metadata() to a shared file
parent
e467179c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
18 deletions
+19
-18
colorspace.c
libavfilter/colorspace.c
+17
-0
colorspace.h
libavfilter/colorspace.h
+1
-0
vf_tonemap_opencl.c
libavfilter/vf_tonemap_opencl.c
+1
-18
No files found.
libavfilter/colorspace.c
View file @
572ef567
...
...
@@ -118,3 +118,20 @@ double ff_determine_signal_peak(AVFrame *in)
return
peak
;
}
void
ff_update_hdr_metadata
(
AVFrame
*
in
,
double
peak
)
{
AVFrameSideData
*
sd
=
av_frame_get_side_data
(
in
,
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
);
if
(
sd
)
{
AVContentLightMetadata
*
clm
=
(
AVContentLightMetadata
*
)
sd
->
data
;
clm
->
MaxCLL
=
(
unsigned
)(
peak
*
REFERENCE_WHITE
);
}
sd
=
av_frame_get_side_data
(
in
,
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
);
if
(
sd
)
{
AVMasteringDisplayMetadata
*
metadata
=
(
AVMasteringDisplayMetadata
*
)
sd
->
data
;
if
(
metadata
->
has_luminance
)
metadata
->
max_luminance
=
av_d2q
(
peak
*
REFERENCE_WHITE
,
10000
);
}
}
libavfilter/colorspace.h
View file @
572ef567
...
...
@@ -45,5 +45,6 @@ void ff_fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
double
rgb2xyz
[
3
][
3
]);
double
ff_determine_signal_peak
(
AVFrame
*
in
);
void
ff_update_hdr_metadata
(
AVFrame
*
in
,
double
peak
);
#endif
libavfilter/vf_tonemap_opencl.c
View file @
572ef567
...
...
@@ -21,7 +21,6 @@
#include "libavutil/bprint.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/mastering_display_metadata.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
...
...
@@ -342,22 +341,6 @@ fail:
return
err
;
}
static
void
update_metadata
(
AVFrame
*
in
,
double
peak
)
{
AVFrameSideData
*
sd
=
av_frame_get_side_data
(
in
,
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
);
if
(
sd
)
{
AVContentLightMetadata
*
clm
=
(
AVContentLightMetadata
*
)
sd
->
data
;
clm
->
MaxCLL
=
(
unsigned
)(
peak
*
REFERENCE_WHITE
);
}
sd
=
av_frame_get_side_data
(
in
,
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
);
if
(
sd
)
{
AVMasteringDisplayMetadata
*
metadata
=
(
AVMasteringDisplayMetadata
*
)
sd
->
data
;
if
(
metadata
->
has_luminance
)
metadata
->
max_luminance
=
av_d2q
(
peak
*
REFERENCE_WHITE
,
10000
);
}
}
static
int
tonemap_opencl_filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
input
)
{
AVFilterContext
*
avctx
=
inlink
->
dst
;
...
...
@@ -444,7 +427,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
av_frame_free
(
&
input
);
update
_metadata
(
output
,
ctx
->
target_peak
);
ff_update_hdr
_metadata
(
output
,
ctx
->
target_peak
);
av_log
(
ctx
,
AV_LOG_DEBUG
,
"Tone-mapping output: %s, %ux%u (%"
PRId64
").
\n
"
,
av_get_pix_fmt_name
(
output
->
format
),
...
...
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