summaryrefslogtreecommitdiff
path: root/libavfilter/vf_lagfun.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-02-21 09:11:17 +0100
committerPaul B Mahol <onemda@gmail.com>2022-02-21 17:52:20 +0100
commit6a9cb5a7ba984139dad24078060e04861fcc246d (patch)
treeb8de74081f077b84cf0aa027d0baac2fb13311d6 /libavfilter/vf_lagfun.c
parent58492ce443a5a1f80b56fe1cd7ffa6cf449f4da9 (diff)
downloadffmpeg-6a9cb5a7ba984139dad24078060e04861fcc246d.tar.gz
avfilter/vf_lagfun: add float formats support
Diffstat (limited to 'libavfilter/vf_lagfun.c')
-rw-r--r--libavfilter/vf_lagfun.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavfilter/vf_lagfun.c b/libavfilter/vf_lagfun.c
index c2e0f7383d..e3aa45c419 100644
--- a/libavfilter/vf_lagfun.c
+++ b/libavfilter/vf_lagfun.c
@@ -63,6 +63,7 @@ static const enum AVPixelFormat pixel_fmts[] = {
AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
+ AV_PIX_FMT_GRAYF32, AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32,
AV_PIX_FMT_NONE
};
@@ -70,7 +71,7 @@ typedef struct ThreadData {
AVFrame *in, *out;
} ThreadData;
-#define LAGFUN(name, type) \
+#define LAGFUN(name, type, round) \
static int lagfun_frame##name(AVFilterContext *ctx, void *arg, \
int jobnr, int nb_jobs) \
{ \
@@ -104,7 +105,7 @@ static int lagfun_frame##name(AVFilterContext *ctx, void *arg, \
if (ctx->is_disabled) { \
dst[x] = src[x]; \
} else { \
- dst[x] = lrintf(v); \
+ dst[x] = round(v); \
} \
} \
\
@@ -117,8 +118,9 @@ static int lagfun_frame##name(AVFilterContext *ctx, void *arg, \
return 0; \
}
-LAGFUN(8, uint8_t)
-LAGFUN(16, uint16_t)
+LAGFUN(8, uint8_t, lrintf)
+LAGFUN(16, uint16_t, lrintf)
+LAGFUN(32, float, )
static int config_output(AVFilterLink *outlink)
{
@@ -133,7 +135,7 @@ static int config_output(AVFilterLink *outlink)
return AVERROR_BUG;
s->nb_planes = av_pix_fmt_count_planes(outlink->format);
s->depth = desc->comp[0].depth;
- s->lagfun = s->depth <= 8 ? lagfun_frame8 : lagfun_frame16;
+ s->lagfun = s->depth <= 8 ? lagfun_frame8 : s->depth <= 16 ? lagfun_frame16 : lagfun_frame32;
if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
return ret;