aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/av1dec.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2024-03-15 11:44:28 +0100
committerNiklas Haas <git@haasn.dev>2024-03-23 18:54:36 +0100
commit511f2976801c195bec1f0e7bc105f319692f7cdd (patch)
tree3d8085266b7b2de0675ff813e07f672eab3d77ad /libavcodec/av1dec.c
parentad7f059180e7f1dad222dccdb1ce10081aac6467 (diff)
downloadffmpeg-511f2976801c195bec1f0e7bc105f319692f7cdd.tar.gz
avcodec/av1dec: signal new AVFilmGrainParams members
Not directly signalled by AV1, but we should still set this accordingly so that users will know what the original intended video characteristics and chroma resolution were.
Diffstat (limited to 'libavcodec/av1dec.c')
-rw-r--r--libavcodec/av1dec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 4d074c3908..32a795e758 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -1074,9 +1074,11 @@ static int export_film_grain(AVCodecContext *avctx, AVFrame *frame)
{
AV1DecContext *s = avctx->priv_data;
const AV1RawFilmGrainParams *film_grain = &s->cur_frame.film_grain;
+ const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(frame->format);
AVFilmGrainParams *fgp;
AVFilmGrainAOMParams *aom;
+ av_assert0(pixdesc);
if (!film_grain->apply_grain)
return 0;
@@ -1086,6 +1088,14 @@ static int export_film_grain(AVCodecContext *avctx, AVFrame *frame)
fgp->type = AV_FILM_GRAIN_PARAMS_AV1;
fgp->seed = film_grain->grain_seed;
+ fgp->width = frame->width;
+ fgp->height = frame->height;
+ fgp->color_range = frame->color_range;
+ fgp->color_primaries = frame->color_primaries;
+ fgp->color_trc = frame->color_trc;
+ fgp->color_space = frame->colorspace;
+ fgp->subsampling_x = pixdesc->log2_chroma_w;
+ fgp->subsampling_y = pixdesc->log2_chroma_h;
aom = &fgp->codec.aom;
aom->chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma;