aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2024-03-18 17:13:44 +0100
committerNiklas Haas <git@haasn.dev>2024-03-23 18:54:36 +0100
commitad7f059180e7f1dad222dccdb1ce10081aac6467 (patch)
tree4c24da89692845b7a7c770f790b718ac6496510c
parent696303359068f5721a3081c3f0cce7927277f02e (diff)
downloadffmpeg-ad7f059180e7f1dad222dccdb1ce10081aac6467.tar.gz
avcodec/h2645_sei: signal new AVFilmGrainParams members
H.274 specifies that film grain parameters are signalled as intended for 4:4:4 frames, so we always signal this, regardless of the frame's actual subsampling.
-rw-r--r--libavcodec/h2645_sei.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index e8eb15524f..20d35946b1 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -643,35 +643,45 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
h274 = &fgp->codec.h274;
fgp->seed = seed;
+ fgp->width = frame->width;
+ fgp->height = frame->height;
+
+ /* H.274 mandates film grain be applied to 4:4:4 frames */
+ fgp->subsampling_x = fgp->subsampling_y = 0;
h274->model_id = fgc->model_id;
if (fgc->separate_colour_description_present_flag) {
- h274->bit_depth_luma = fgc->bit_depth_luma;
- h274->bit_depth_chroma = fgc->bit_depth_chroma;
- h274->color_range = fgc->full_range + 1;
- h274->color_primaries = fgc->color_primaries;
- h274->color_trc = fgc->transfer_characteristics;
- h274->color_space = fgc->matrix_coeffs;
+ fgp->bit_depth_luma = fgc->bit_depth_luma;
+ fgp->bit_depth_chroma = fgc->bit_depth_chroma;
+ fgp->color_range = fgc->full_range + 1;
+ fgp->color_primaries = fgc->color_primaries;
+ fgp->color_trc = fgc->transfer_characteristics;
+ fgp->color_space = fgc->matrix_coeffs;
} else {
- h274->bit_depth_luma = bit_depth_luma;
- h274->bit_depth_chroma = bit_depth_chroma;
+ fgp->bit_depth_luma = bit_depth_luma;
+ fgp->bit_depth_chroma = bit_depth_chroma;
if (vui->video_signal_type_present_flag)
- h274->color_range = vui->video_full_range_flag + 1;
- else
- h274->color_range = AVCOL_RANGE_UNSPECIFIED;
+ fgp->color_range = vui->video_full_range_flag + 1;
if (vui->colour_description_present_flag) {
- h274->color_primaries = vui->colour_primaries;
- h274->color_trc = vui->transfer_characteristics;
- h274->color_space = vui->matrix_coeffs;
- } else {
- h274->color_primaries = AVCOL_PRI_UNSPECIFIED;
- h274->color_trc = AVCOL_TRC_UNSPECIFIED;
- h274->color_space = AVCOL_SPC_UNSPECIFIED;
+ fgp->color_primaries = vui->colour_primaries;
+ fgp->color_trc = vui->transfer_characteristics;
+ fgp->color_space = vui->matrix_coeffs;
}
}
h274->blending_mode_id = fgc->blending_mode_id;
h274->log2_scale_factor = fgc->log2_scale_factor;
+#if FF_API_H274_FILM_GRAIN_VCS
+FF_DISABLE_DEPRECATION_WARNINGS
+ h274->bit_depth_luma = fgp->bit_depth_luma;
+ h274->bit_depth_chroma = fgp->bit_depth_chroma;
+ h274->color_range = fgp->color_range;
+ h274->color_primaries = fgp->color_primaries;
+ h274->color_trc = fgp->color_trc;
+ h274->color_space = fgp->color_space;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
memcpy(&h274->component_model_present, &fgc->comp_model_present_flag,
sizeof(h274->component_model_present));
memcpy(&h274->num_intensity_intervals, &fgc->num_intensity_intervals,