diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-23 00:46:04 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-09-26 21:06:14 +0200 |
commit | 14015b9e157014b24c74098daee9c6eab15cb6c8 (patch) | |
tree | 3c8e6bb38ade6ee7de0082b40bace348547ec2ad /libavcodec/hevcdec.h | |
parent | 378f1b6a393e7bf0ceb50a9454e3664a599d84d1 (diff) |
avcodec/hevcdec: Check early whether film grain is supported, fix race
Applying film grain happens after ff_thread_finish_setup(),
so the parameters synced in hevc_update_thread_context() must not
be modified. But this is exactly what happens in case applying
film grain fails. (The likely result is that in case of frame threading
an uninitialized frame is output.)
Given that it is actually very easy to know in advance whether
ff_h274_apply_film_grain() supports a given set of parameters,
one can check for this before ff_thread_finish_setup()
and avoid allocating an unused buffer lateron.
Reviewed-by: Niklas Haas <ffmpeg@haasn.xyz>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/hevcdec.h')
-rw-r--r-- | libavcodec/hevcdec.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 94609e4699..9b232df68c 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -596,6 +596,8 @@ typedef struct HEVCContext { int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4) int nuh_layer_id; + int film_grain_warning_shown; + AVBufferRef *rpu_buf; ///< 0 or 1 Dolby Vision RPUs. DOVIContext dovi_ctx; ///< Dolby Vision decoding context } HEVCContext; |