Commit e695b0be authored by James Almer's avatar James Almer

avcodec/libdav1d: add an option to toggle Film Grain

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 0fca2f60
...@@ -34,6 +34,7 @@ typedef struct Libdav1dContext { ...@@ -34,6 +34,7 @@ typedef struct Libdav1dContext {
Dav1dData data; Dav1dData data;
int tile_threads; int tile_threads;
int apply_grain;
} Libdav1dContext; } Libdav1dContext;
static av_cold int libdav1d_init(AVCodecContext *c) static av_cold int libdav1d_init(AVCodecContext *c)
...@@ -46,6 +47,7 @@ static av_cold int libdav1d_init(AVCodecContext *c) ...@@ -46,6 +47,7 @@ static av_cold int libdav1d_init(AVCodecContext *c)
dav1d_default_settings(&s); dav1d_default_settings(&s);
s.n_tile_threads = dav1d->tile_threads; s.n_tile_threads = dav1d->tile_threads;
s.apply_grain = dav1d->apply_grain;
s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), DAV1D_MAX_FRAME_THREADS); s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), DAV1D_MAX_FRAME_THREADS);
res = dav1d_open(&dav1d->c, &s); res = dav1d_open(&dav1d->c, &s);
...@@ -216,6 +218,7 @@ static av_cold int libdav1d_close(AVCodecContext *c) ...@@ -216,6 +218,7 @@ static av_cold int libdav1d_close(AVCodecContext *c)
#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption libdav1d_options[] = { static const AVOption libdav1d_options[] = {
{ "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, DAV1D_MAX_TILE_THREADS, VD }, { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, DAV1D_MAX_TILE_THREADS, VD },
{ "filmgrain", "Apply Film Grain", OFFSET(apply_grain), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VD },
{ NULL } { NULL }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment