Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
0612e29b
Commit
0612e29b
authored
May 10, 2018
by
Haihao Xiang
Committed by
Mark Thompson
May 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vaapi_encode_h265: Insert content light level information
Signed-off-by:
Haihao Xiang
<
haihao.xiang@intel.com
>
parent
2943dd35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
vaapi_encode_h265.c
libavcodec/vaapi_encode_h265.c
+33
-3
No files found.
libavcodec/vaapi_encode_h265.c
View file @
0612e29b
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
enum
{
enum
{
SEI_MASTERING_DISPLAY
=
0x08
,
SEI_MASTERING_DISPLAY
=
0x08
,
SEI_CONTENT_LIGHT_LEVEL
=
0x10
,
};
};
typedef
struct
VAAPIEncodeH265Context
{
typedef
struct
VAAPIEncodeH265Context
{
...
@@ -55,6 +56,7 @@ typedef struct VAAPIEncodeH265Context {
...
@@ -55,6 +56,7 @@ typedef struct VAAPIEncodeH265Context {
H265RawSEI
sei
;
H265RawSEI
sei
;
H265RawSEIMasteringDisplayColourVolume
mastering_display
;
H265RawSEIMasteringDisplayColourVolume
mastering_display
;
H265RawSEIContentLightLevelInfo
content_light_level
;
int64_t
last_idr_frame
;
int64_t
last_idr_frame
;
int
pic_order_cnt
;
int
pic_order_cnt
;
...
@@ -218,6 +220,12 @@ static int vaapi_encode_h265_write_extra_header(AVCodecContext *avctx,
...
@@ -218,6 +220,12 @@ static int vaapi_encode_h265_write_extra_header(AVCodecContext *avctx,
++
i
;
++
i
;
}
}
if
(
priv
->
sei_needed
&
SEI_CONTENT_LIGHT_LEVEL
)
{
priv
->
sei
.
payload
[
i
].
payload_type
=
HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO
;
priv
->
sei
.
payload
[
i
].
payload
.
content_light_level
=
priv
->
content_light_level
;
++
i
;
}
priv
->
sei
.
payload_count
=
i
;
priv
->
sei
.
payload_count
=
i
;
av_assert0
(
priv
->
sei
.
payload_count
>
0
);
av_assert0
(
priv
->
sei
.
payload_count
>
0
);
...
@@ -706,6 +714,25 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
...
@@ -706,6 +714,25 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
}
}
}
}
if
((
opt
->
sei
&
SEI_CONTENT_LIGHT_LEVEL
)
&&
(
pic
->
type
==
PICTURE_TYPE_I
||
pic
->
type
==
PICTURE_TYPE_IDR
))
{
AVFrameSideData
*
sd
=
av_frame_get_side_data
(
pic
->
input_image
,
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
);
if
(
sd
)
{
AVContentLightMetadata
*
clm
=
(
AVContentLightMetadata
*
)
sd
->
data
;
priv
->
content_light_level
.
max_content_light_level
=
FFMIN
(
clm
->
MaxCLL
,
65535
);
priv
->
content_light_level
.
max_pic_average_light_level
=
FFMIN
(
clm
->
MaxFALL
,
65535
);
priv
->
sei_needed
|=
SEI_CONTENT_LIGHT_LEVEL
;
}
}
vpic
->
decoded_curr_pic
=
(
VAPictureHEVC
)
{
vpic
->
decoded_curr_pic
=
(
VAPictureHEVC
)
{
.
picture_id
=
pic
->
recon_surface
,
.
picture_id
=
pic
->
recon_surface
,
.
pic_order_cnt
=
priv
->
pic_order_cnt
,
.
pic_order_cnt
=
priv
->
pic_order_cnt
,
...
@@ -1127,10 +1154,13 @@ static const AVOption vaapi_encode_h265_options[] = {
...
@@ -1127,10 +1154,13 @@ static const AVOption vaapi_encode_h265_options[] = {
{
"sei"
,
"Set SEI to include"
,
{
"sei"
,
"Set SEI to include"
,
OFFSET
(
sei
),
AV_OPT_TYPE_FLAGS
,
OFFSET
(
sei
),
AV_OPT_TYPE_FLAGS
,
{
.
i64
=
SEI_MASTERING_DISPLAY
},
{
.
i64
=
SEI_MASTERING_DISPLAY
|
SEI_CONTENT_LIGHT_LEVEL
},
0
,
INT_MAX
,
FLAGS
,
"sei"
},
0
,
INT_MAX
,
FLAGS
,
"sei"
},
{
"hdr"
,
"Include HDR metadata for mastering display colour volume"
,
{
"hdr"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
SEI_MASTERING_DISPLAY
},
"Include HDR metadata for mastering display colour volume "
"and content light level information"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
SEI_MASTERING_DISPLAY
|
SEI_CONTENT_LIGHT_LEVEL
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"sei"
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"sei"
},
{
NULL
},
{
NULL
},
...
...
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