Fixed bug when freeing distanceArrays

This commit is contained in:
2026-02-12 23:16:09 -06:00
parent 39f3513241
commit 1495453f7d
3 changed files with 18 additions and 4 deletions

14
.gitignore vendored
View File

@@ -2,4 +2,16 @@
esc-50-audio/
# executable
soundknn.exe
soundknn.exe
cltest.exe
# opencl lib
OpenCL.lib
CL/
#vscode stuff
.vscode
#extrastuff
src/testcl.c
src/starterkernel.cl

View File

@@ -16,7 +16,7 @@ With loudnorm to try to improve performance by normalizing loudness
Used for gathering the image data
## Building
`clang src/main.c -Iexternal -O3 -fopenmp -march=native -o soundknn.exe`
`clang src/main.c -Iexternal -Lexternal -lOpenCL -O3 -fopenmp -march=native -o soundknn.exe`
### Todo
- [x] Load all images from directory

View File

@@ -4,6 +4,8 @@
#include <windows.h>
#include <time.h>
#include <omp.h>
#define CL_TARGET_OPENCL_VERSION 120
#include <CL/cl.h>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
@@ -131,7 +133,7 @@ int main(){
time_t now = time(NULL);
computeDistanceMatrixOMP(audioData, distanceArrays,nfiles, counter);
printf("Time it took to compute matrix: %lld\n seconds",time(NULL)-now);
printf("Time it took to compute matrix: %lld seconds\n",time(NULL)-now);
// Searches for index of specific image
char img[]="esc-50-audio/img/4-189838-A-22.png";
@@ -167,7 +169,7 @@ int main(){
}
// Freeing memeing of distance arrays
for(int i=0;i<2000;i++){
for(int i=0;i<nfiles;i++){
free(distanceArrays[i]);
}
free(distanceArrays);