PR #25666 opened by romainhedouin
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25666
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25666.patch

The filter allocates two int64_t arrays with one entry per output
pixel, plane_f and plane_g, but nothing reads or writes them. Remove
them. The output is unchanged.

| compiler | size | RSS before | RSS after |
|---|---|---|---|---|---|
| clang | 1280x720 | 65.2 MiB | 50.2 MiB |
| clang | 1920x1080 | 90.9 MiB | 62.1 MiB |
| clang | 3840x2160 | 337.5 MiB | 207.0 MiB |
| GCC | 1280x720 | 64.0 MiB | 50.2 MiB |
| GCC | 1920x1080 | 93.5 MiB | 58.9 MiB |
| GCC | 3840x2160 | 333.4 MiB | 206.8 MiB |

Noticed during a review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <[email protected]>

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From e19fadf1de1000b9affb79ad0dfff36449705e26 Mon Sep 17 00:00:00 2001
From: romainhedouin <[email protected]>
Date: Sun, 1 Nov 2026 22:12:31 +0100
Subject: [PATCH] avfilter/vf_morpho: remove unused plane_f and plane_g buffers

The filter allocates two int64_t arrays with one entry per output
pixel, plane_f and plane_g, but nothing reads or writes them. Remove
them. The output is unchanged.

Noticed during a review sweep of ffmpeg using an LLM.

Signed-off-by: romainhedouin <[email protected]>
---
 libavfilter/vf_morpho.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/libavfilter/vf_morpho.c b/libavfilter/vf_morpho.c
index 342ead266cb..29aeef86338 100644
--- a/libavfilter/vf_morpho.c
+++ b/libavfilter/vf_morpho.c
@@ -121,8 +121,6 @@ typedef struct MorphoContext {
     int got_structure[4];
 
     AVFrame *temp;
-
-    int64_t *plane_f, *plane_g;
 } MorphoContext;
 
 #define OFFSET(x) offsetof(MorphoContext, x)
@@ -1024,11 +1022,6 @@ static int config_output(AVFilterLink *outlink)
     if (!s->temp)
         return AVERROR(ENOMEM);
 
-    s->plane_f = av_calloc(outlink->w * outlink->h, sizeof(*s->plane_f));
-    s->plane_g = av_calloc(outlink->w * outlink->h, sizeof(*s->plane_g));
-    if (!s->plane_f || !s->plane_g)
-        return AVERROR(ENOMEM);
-
     return 0;
 }
 
@@ -1051,8 +1044,6 @@ static av_cold void uninit(AVFilterContext *ctx)
     ff_framesync_uninit(&s->fs);
 
     av_frame_free(&s->temp);
-    av_freep(&s->plane_f);
-    av_freep(&s->plane_g);
 }
 
 static const AVFilterPad morpho_inputs[] = {
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to