From 34721e88c4d0fc87a20ae3ae16847f62e8b6eecb Mon Sep 17 00:00:00 2001 From: magiblot Date: Thu, 30 Dec 2021 01:50:40 +0100 Subject: [PATCH 1/2] DePanEstimate: initialize first element of 'trust' array This fixes a 'Conditional jump or move depends on uninitialised value(s)' warning from Valgrind. --- DePanEstimate/estimate_fftw.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/DePanEstimate/estimate_fftw.cpp b/DePanEstimate/estimate_fftw.cpp index 024ffb8..f37712d 100644 --- a/DePanEstimate/estimate_fftw.cpp +++ b/DePanEstimate/estimate_fftw.cpp @@ -266,6 +266,7 @@ DePanEstimate_fftw::DePanEstimate_fftw(PClip _child, int _range, float _trust, i for (i = 1; i < vi.num_frames; i++) { motionx[i] = MOTIONUNKNOWN; //set motion as unknown for all frames beside 0 } + trust[0] = 0; // set frame cache #ifdef AVS_2_5 From 5ac94f623d58c35d8bfba2c3a342ffa17ca1f7e1 Mon Sep 17 00:00:00 2001 From: magiblot Date: Thu, 30 Dec 2021 01:53:32 +0100 Subject: [PATCH 2/2] DePanEstimate: allocate 'fftcache2' and 'fftcachecomp2' only when necessary This fixes a small memory leak reported by Valgrind. --- DePanEstimate/estimate_fftw.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DePanEstimate/estimate_fftw.cpp b/DePanEstimate/estimate_fftw.cpp index f37712d..dd1650d 100644 --- a/DePanEstimate/estimate_fftw.cpp +++ b/DePanEstimate/estimate_fftw.cpp @@ -220,9 +220,11 @@ DePanEstimate_fftw::DePanEstimate_fftw(PClip _child, int _range, float _trust, i fftcache = (fftwf_complex**)fftfp.fftwf_malloc(fftcachecapacity * sizeof(uintptr_t)); // array of pointers x64: int->uintptr_t if (fftcache == NULL) env->ThrowError("DepanEstimate: FFTW Allocation Failure!\n"); - fftcache2 = (fftwf_complex**)fftfp.fftwf_malloc(fftcachecapacity * sizeof(uintptr_t)); fftcachecomp = (fftwf_complex**)fftfp.fftwf_malloc(fftcachecapacity * sizeof(uintptr_t)); - fftcachecomp2 = (fftwf_complex**)fftfp.fftwf_malloc(fftcachecapacity * sizeof(uintptr_t)); + if (zoommax != 1) { + fftcache2 = (fftwf_complex**)fftfp.fftwf_malloc(fftcachecapacity * sizeof(uintptr_t)); + fftcachecomp2 = (fftwf_complex**)fftfp.fftwf_malloc(fftcachecapacity * sizeof(uintptr_t)); + } for (i = 0; i < fftcachecapacity; i++) { fftcache[i] = (fftwf_complex*)fftfp.fftwf_malloc(sizeof(fftwf_complex) * fftsize); fftcachecomp[i] = (fftwf_complex*)fftfp.fftwf_malloc(sizeof(fftwf_complex) * fftsize); @@ -358,7 +360,7 @@ void DePanEstimate_fftw::frame_data2d(const BYTE * srcp0, int height, int src_wi pitch = pitch / sizeof(pixel_t); // PF // h0 = (height - winy)/2; // top of fft window - + if (isYUY2) { srcp += pitch*h0 + winleft * 2; // offset of window data