Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
572ef567
Commit
572ef567
authored
6 years ago
by
Vittorio Giovara
Browse files
Options
Downloads
Patches
Plain Diff
vf_tonemap_opencl: Move update_metadata() to a shared file
parent
e467179c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libavfilter/colorspace.c
+17
-0
17 additions, 0 deletions
libavfilter/colorspace.c
libavfilter/colorspace.h
+1
-0
1 addition, 0 deletions
libavfilter/colorspace.h
libavfilter/vf_tonemap_opencl.c
+1
-18
1 addition, 18 deletions
libavfilter/vf_tonemap_opencl.c
with
19 additions
and
18 deletions
libavfilter/colorspace.c
+
17
−
0
View file @
572ef567
...
@@ -118,3 +118,20 @@ double ff_determine_signal_peak(AVFrame *in)
...
@@ -118,3 +118,20 @@ double ff_determine_signal_peak(AVFrame *in)
return
peak
;
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
);
}
}
This diff is collapsed.
Click to expand it.
libavfilter/colorspace.h
+
1
−
0
View file @
572ef567
...
@@ -45,5 +45,6 @@ void ff_fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
...
@@ -45,5 +45,6 @@ void ff_fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
double
rgb2xyz
[
3
][
3
]);
double
rgb2xyz
[
3
][
3
]);
double
ff_determine_signal_peak
(
AVFrame
*
in
);
double
ff_determine_signal_peak
(
AVFrame
*
in
);
void
ff_update_hdr_metadata
(
AVFrame
*
in
,
double
peak
);
#endif
#endif
This diff is collapsed.
Click to expand it.
libavfilter/vf_tonemap_opencl.c
+
1
−
18
View file @
572ef567
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
#include
"libavutil/bprint.h"
#include
"libavutil/bprint.h"
#include
"libavutil/common.h"
#include
"libavutil/common.h"
#include
"libavutil/imgutils.h"
#include
"libavutil/imgutils.h"
#include
"libavutil/mastering_display_metadata.h"
#include
"libavutil/mem.h"
#include
"libavutil/mem.h"
#include
"libavutil/opt.h"
#include
"libavutil/opt.h"
#include
"libavutil/pixdesc.h"
#include
"libavutil/pixdesc.h"
...
@@ -342,22 +341,6 @@ fail:
...
@@ -342,22 +341,6 @@ fail:
return
err
;
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
)
static
int
tonemap_opencl_filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
input
)
{
{
AVFilterContext
*
avctx
=
inlink
->
dst
;
AVFilterContext
*
avctx
=
inlink
->
dst
;
...
@@ -444,7 +427,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
...
@@ -444,7 +427,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
av_frame_free
(
&
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_log
(
ctx
,
AV_LOG_DEBUG
,
"Tone-mapping output: %s, %ux%u (%"
PRId64
").
\n
"
,
av_get_pix_fmt_name
(
output
->
format
),
av_get_pix_fmt_name
(
output
->
format
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment