summaryrefslogtreecommitdiff
path: root/libavcodec/hevcdec.h
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2021-09-29 01:06:02 +0200
committerJames Almer <jamrial@gmail.com>2021-10-15 11:55:45 -0300
commit3cc3f5de2afda5b8f880c0817e9d67c2dafbfe1e (patch)
treeb6b31494a972106f66ebb8219bfce5fbed40ceb9 /libavcodec/hevcdec.h
parent5d16660598dd9409c1028204cac3a966a939b719 (diff)
avcodec/hevcdec: apply H.274 film grain
Similar in spirit and design to 66845cffc3bbb, but slightly simpler due to the lack of interlaced frames in HEVC. See that commit for more details. For the seed value, since no specification for this appears to exist, I semi-arbitrarily decided to base it off the POC id alone, since there's no analog of the idr_pic_id in HEVC's I-frames. This design is stable across remuxes and seeks, but changes for adjacent frames with a period that's typically long enough not to be noticeable, which makes it satisfy all of the requirements that a film grain seed should have. Tested with and without threading, using a patch to insert film grain metadata artificially (for lack of real files containing film grain).
Diffstat (limited to 'libavcodec/hevcdec.h')
-rw-r--r--libavcodec/hevcdec.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 482638a8e5..8963aa83ae 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -39,6 +39,7 @@
#include "hevc_ps.h"
#include "hevc_sei.h"
#include "hevcdsp.h"
+#include "h274.h"
#include "internal.h"
#include "thread.h"
#include "videodsp.h"
@@ -395,7 +396,10 @@ typedef struct DBParams {
typedef struct HEVCFrame {
AVFrame *frame;
+ AVFrame *frame_grain;
ThreadFrame tf;
+ ThreadFrame tf_grain;
+ int needs_fg; /* 1 if grain needs to be applied by the decoder */
MvField *tab_mvf;
RefPicList *refPicList;
RefPicListTab **rpl_tab;
@@ -525,6 +529,7 @@ typedef struct HEVCContext {
HEVCDSPContext hevcdsp;
VideoDSPContext vdsp;
BswapDSPContext bdsp;
+ H274FilmGrainDatabase h274db;
int8_t *qp_y_tab;
uint8_t *horizontal_bs;
uint8_t *vertical_bs;