diff options
author | James Almer <jamrial@gmail.com> | 2020-11-25 20:28:42 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-12-16 13:34:11 -0300 |
commit | 1a8e719f36f09a4e85db4d3e37c546adecd31fee (patch) | |
tree | b27df928fecb7b9fa7381c73c499e63688335ac1 /libavcodec/dxva2_av1.c | |
parent | 32586a42da8c9dedd30c6e4c0417c9da91c1f283 (diff) | |
download | ffmpeg-1a8e719f36f09a4e85db4d3e37c546adecd31fee.tar.gz |
avcodec/av1dec: support exporting Film Grain params as frame side data
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/dxva2_av1.c')
-rw-r--r-- | libavcodec/dxva2_av1.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/dxva2_av1.c b/libavcodec/dxva2_av1.c index 72c38f5d12..aa14e473df 100644 --- a/libavcodec/dxva2_av1.c +++ b/libavcodec/dxva2_av1.c @@ -62,6 +62,7 @@ static int fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *c const AV1RawFilmGrainParams *film_grain = &h->cur_frame.film_grain; unsigned char remap_lr_type[4] = { AV1_RESTORE_NONE, AV1_RESTORE_SWITCHABLE, AV1_RESTORE_WIENER, AV1_RESTORE_SGRPROJ }; + int apply_grain = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) && film_grain->apply_grain; memset(pp, 0, sizeof(*pp)); @@ -99,7 +100,7 @@ static int fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *c pp->coding.integer_mv = frame_header->force_integer_mv || !(frame_header->frame_type & 1); pp->coding.cdef = seq->enable_cdef; pp->coding.restoration = seq->enable_restoration; - pp->coding.film_grain = seq->film_grain_params_present; + pp->coding.film_grain = seq->film_grain_params_present && !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN); pp->coding.intrabc = frame_header->allow_intrabc; pp->coding.high_precision_mv = frame_header->allow_high_precision_mv; pp->coding.switchable_motion_mode = frame_header->is_motion_mode_switchable; @@ -215,7 +216,7 @@ static int fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *c } /* Film grain */ - if (film_grain->apply_grain) { + if (apply_grain) { pp->film_grain.apply_grain = 1; pp->film_grain.scaling_shift_minus8 = film_grain->grain_scaling_minus_8; pp->film_grain.chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma; |