aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/nvdec_av1.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-11-25 20:28:42 -0300
committerJames Almer <jamrial@gmail.com>2020-12-16 13:34:11 -0300
commit1a8e719f36f09a4e85db4d3e37c546adecd31fee (patch)
treeb27df928fecb7b9fa7381c73c499e63688335ac1 /libavcodec/nvdec_av1.c
parent32586a42da8c9dedd30c6e4c0417c9da91c1f283 (diff)
downloadffmpeg-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/nvdec_av1.c')
-rw-r--r--libavcodec/nvdec_av1.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/nvdec_av1.c b/libavcodec/nvdec_av1.c
index bd920d814a..1ce846a60d 100644
--- a/libavcodec/nvdec_av1.c
+++ b/libavcodec/nvdec_av1.c
@@ -53,9 +53,10 @@ static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u
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;
int ret, i, j;
- ret = ff_nvdec_start_frame_sep_ref(avctx, cur_frame, film_grain->apply_grain);
+ ret = ff_nvdec_start_frame_sep_ref(avctx, cur_frame, apply_grain);
if (ret < 0)
return ret;
@@ -95,7 +96,8 @@ static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u
.enable_superres = seq->enable_superres,
.enable_cdef = seq->enable_cdef,
.enable_restoration = seq->enable_restoration,
- .enable_fgs = seq->film_grain_params_present,
+ .enable_fgs = seq->film_grain_params_present &&
+ !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN),
/* Frame Header */
.frame_type = frame_header->frame_type,
@@ -182,7 +184,7 @@ static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u
.spatial_layer_id = s->cur_frame.spatial_id,
/* Film Grain Params */
- .apply_grain = film_grain->apply_grain,
+ .apply_grain = apply_grain,
.overlap_flag = film_grain->overlap_flag,
.scaling_shift_minus8 = film_grain->grain_scaling_minus_8,
.chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma,
@@ -259,7 +261,7 @@ static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u
}
/* Film Grain Params */
- if (film_grain->apply_grain) {
+ if (apply_grain) {
for (i = 0; i < 14; ++i) {
ppc->scaling_points_y[i][0] = film_grain->point_y_value[i];
ppc->scaling_points_y[i][1] = film_grain->point_y_scaling[i];