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
794e15fd
Commit
794e15fd
authored
Jul 23, 2021
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cbs_h265: add support for Film Grain Characteristics SEI message
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
6b594ba5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
0 deletions
+92
-0
cbs_h2645.c
libavcodec/cbs_h2645.c
+6
-0
cbs_h265.h
libavcodec/cbs_h265.h
+21
-0
cbs_h265_syntax_template.c
libavcodec/cbs_h265_syntax_template.c
+65
-0
No files found.
libavcodec/cbs_h2645.c
View file @
794e15fd
...
...
@@ -1610,6 +1610,12 @@ static const SEIMessageTypeDescriptor cbs_sei_h265_types[] = {
sizeof
(
H265RawSEIRecoveryPoint
),
SEI_MESSAGE_RW
(
h265
,
sei_recovery_point
),
},
{
SEI_TYPE_FILM_GRAIN_CHARACTERISTICS
,
1
,
0
,
sizeof
(
H265RawFilmGrainCharacteristics
),
SEI_MESSAGE_RW
(
h265
,
film_grain_characteristics
),
},
{
SEI_TYPE_DISPLAY_ORIENTATION
,
1
,
0
,
...
...
libavcodec/cbs_h265.h
View file @
794e15fd
...
...
@@ -594,6 +594,27 @@ typedef struct H265RawSEIRecoveryPoint {
uint8_t
broken_link_flag
;
}
H265RawSEIRecoveryPoint
;
typedef
struct
H265RawFilmGrainCharacteristics
{
uint8_t
film_grain_characteristics_cancel_flag
;
uint8_t
film_grain_model_id
;
uint8_t
separate_colour_description_present_flag
;
uint8_t
film_grain_bit_depth_luma_minus8
;
uint8_t
film_grain_bit_depth_chroma_minus8
;
uint8_t
film_grain_full_range_flag
;
uint8_t
film_grain_colour_primaries
;
uint8_t
film_grain_transfer_characteristics
;
uint8_t
film_grain_matrix_coeffs
;
uint8_t
blending_mode_id
;
uint8_t
log2_scale_factor
;
uint8_t
comp_model_present_flag
[
3
];
uint8_t
num_intensity_intervals_minus1
[
3
];
uint8_t
num_model_values_minus1
[
3
];
uint8_t
intensity_interval_lower_bound
[
3
][
256
];
uint8_t
intensity_interval_upper_bound
[
3
][
256
];
int16_t
comp_model_value
[
3
][
256
][
6
];
uint8_t
film_grain_characteristics_persistence_flag
;
}
H265RawFilmGrainCharacteristics
;
typedef
struct
H265RawSEIDisplayOrientation
{
uint8_t
display_orientation_cancel_flag
;
uint8_t
hor_flip
;
...
...
libavcodec/cbs_h265_syntax_template.c
View file @
794e15fd
...
...
@@ -1844,6 +1844,71 @@ static int FUNC(sei_recovery_point)
return
0
;
}
static
int
FUNC
(
film_grain_characteristics
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
H265RawFilmGrainCharacteristics
*
current
,
SEIMessageState
*
state
)
{
CodedBitstreamH265Context
*
h265
=
ctx
->
priv_data
;
const
H265RawSPS
*
sps
=
h265
->
active_sps
;
int
err
,
c
,
i
,
j
;
HEADER
(
"Film Grain Characteristics"
);
flag
(
film_grain_characteristics_cancel_flag
);
if
(
!
current
->
film_grain_characteristics_cancel_flag
)
{
int
filmGrainBitDepth
[
3
];
u
(
2
,
film_grain_model_id
,
0
,
1
);
flag
(
separate_colour_description_present_flag
);
if
(
current
->
separate_colour_description_present_flag
)
{
ub
(
3
,
film_grain_bit_depth_luma_minus8
);
ub
(
3
,
film_grain_bit_depth_chroma_minus8
);
flag
(
film_grain_full_range_flag
);
ub
(
8
,
film_grain_colour_primaries
);
ub
(
8
,
film_grain_transfer_characteristics
);
ub
(
8
,
film_grain_matrix_coeffs
);
}
else
{
if
(
!
sps
)
{
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"No active SPS for film_grain_characteristics.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
infer
(
film_grain_bit_depth_luma_minus8
,
sps
->
bit_depth_luma_minus8
);
infer
(
film_grain_bit_depth_chroma_minus8
,
sps
->
bit_depth_chroma_minus8
);
infer
(
film_grain_full_range_flag
,
sps
->
vui
.
video_full_range_flag
);
infer
(
film_grain_colour_primaries
,
sps
->
vui
.
colour_primaries
);
infer
(
film_grain_transfer_characteristics
,
sps
->
vui
.
transfer_characteristics
);
infer
(
film_grain_matrix_coeffs
,
sps
->
vui
.
matrix_coefficients
);
}
filmGrainBitDepth
[
0
]
=
current
->
film_grain_bit_depth_luma_minus8
+
8
;
filmGrainBitDepth
[
1
]
=
filmGrainBitDepth
[
2
]
=
current
->
film_grain_bit_depth_chroma_minus8
+
8
;
u
(
2
,
blending_mode_id
,
0
,
1
);
ub
(
4
,
log2_scale_factor
);
for
(
c
=
0
;
c
<
3
;
c
++
)
flags
(
comp_model_present_flag
[
c
],
1
,
c
);
for
(
c
=
0
;
c
<
3
;
c
++
)
{
if
(
current
->
comp_model_present_flag
[
c
])
{
ubs
(
8
,
num_intensity_intervals_minus1
[
c
],
1
,
c
);
us
(
3
,
num_model_values_minus1
[
c
],
0
,
5
,
1
,
c
);
for
(
i
=
0
;
i
<=
current
->
num_intensity_intervals_minus1
[
c
];
i
++
)
{
ubs
(
8
,
intensity_interval_lower_bound
[
c
][
i
],
2
,
c
,
i
);
ubs
(
8
,
intensity_interval_upper_bound
[
c
][
i
],
2
,
c
,
i
);
for
(
j
=
0
;
j
<=
current
->
num_model_values_minus1
[
c
];
j
++
)
ses
(
comp_model_value
[
c
][
i
][
j
],
0
-
current
->
film_grain_model_id
*
(
1
<<
(
filmGrainBitDepth
[
c
]
-
1
)),
((
1
<<
filmGrainBitDepth
[
c
])
-
1
)
-
current
->
film_grain_model_id
*
(
1
<<
(
filmGrainBitDepth
[
c
]
-
1
)),
3
,
c
,
i
,
j
);
}
}
}
flag
(
film_grain_characteristics_persistence_flag
);
}
return
0
;
}
static
int
FUNC
(
sei_display_orientation
)
(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
H265RawSEIDisplayOrientation
*
current
,
SEIMessageState
*
sei
)
...
...
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