[FFmpeg-cvslog] avfilter/vf_dblur: add float formats support

Paul B Mahol git at videolan.org
Mon Feb 21 18:52:38 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Feb 21 09:37:13 2022 +0100| [0aa714244235f55cb31755cbda3714971082ff7d] | committer: Paul B Mahol

avfilter/vf_dblur: add float formats support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0aa714244235f55cb31755cbda3714971082ff7d
---

 libavfilter/vf_dblur.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_dblur.c b/libavfilter/vf_dblur.c
index 05beb249b0..131a3ae30a 100644
--- a/libavfilter/vf_dblur.c
+++ b/libavfilter/vf_dblur.c
@@ -131,6 +131,7 @@ static const enum AVPixelFormat pix_fmts[] = {
     AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
     AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
     AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16,
+    AV_PIX_FMT_GRAYF32, AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32,
     AV_PIX_FMT_NONE
 };
 
@@ -214,8 +215,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         float *bptr = s->buffer;
         const uint8_t *src = in->data[plane];
         const uint16_t *src16 = (const uint16_t *)in->data[plane];
+        const float *src32 = (const float *)in->data[plane];
         uint8_t *dst = out->data[plane];
         uint16_t *dst16 = (uint16_t *)out->data[plane];
+        float *dst32 = (float *)out->data[plane];
         int y, x;
 
         if (!(s->planes & (1 << plane))) {
@@ -234,7 +237,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                 bptr += width;
                 src += in->linesize[plane];
             }
-        } else {
+        } else if (s->depth <= 16) {
             for (y = 0; y < height; y++) {
                 for (x = 0; x < width; x++) {
                     bptr[x] = src16[x];
@@ -242,6 +245,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                 bptr += width;
                 src16 += in->linesize[plane] / 2;
             }
+        } else {
+            for (y = 0; y < height; y++) {
+                for (x = 0; x < width; x++) {
+                    memcpy(bptr, src32, width * sizeof(float));
+                }
+                bptr += width;
+                src32 += in->linesize[plane] / 4;
+            }
         }
 
         diriir2d(ctx, plane);
@@ -255,7 +266,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                 bptr += width;
                 dst += out->linesize[plane];
             }
-        } else {
+        } else if (s->depth <= 16) {
             for (y = 0; y < height; y++) {
                 for (x = 0; x < width; x++) {
                     dst16[x] = av_clip_uintp2_c(lrintf(bptr[x]), s->depth);
@@ -263,6 +274,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                 bptr += width;
                 dst16 += out->linesize[plane] / 2;
             }
+        } else {
+            for (y = 0; y < height; y++) {
+                for (x = 0; x < width; x++) {
+                    memcpy(dst32, bptr, width * sizeof(float));
+                }
+                bptr += width;
+                dst32 += out->linesize[plane] / 4;
+            }
         }
     }
 



More information about the ffmpeg-cvslog mailing list