diff --git a/Makefile b/Makefile index f43742b..8a93cad 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,22 @@ CC = gcc -CFLAGS = -Wall -g -L. -lm -O3 -march=native +CFLAGS = -Wall -L. -lm -O3 -march=native +CDEBUGFLAGS = -Wall -L. -lm -g SOURCE = main.c TARGET = enhancer # Default target -all: $(TARGET) +all: release # Rule to build the executable -$(TARGET): $(SOURCE) - $(CC) $(CFLAGS) -o $@ $< +release: $(SOURCE) + $(CC) $(CFLAGS) -o $(TARGET) $< + +debug: $(SOURCE) + $(CC) $(CDEBUGFLAGS) -o $(TARGET)_debug $< # Rule to clean up object files and the executable clean: - rm -f $(TARGET) *.o + rm -f $(TARGET) $(TARGET)_debug *.o # Phony targets -.PHONY: all clean \ No newline at end of file +.PHONY: all clean diff --git a/main.c b/main.c index 7208fd7..ecf641e 100644 --- a/main.c +++ b/main.c @@ -76,6 +76,8 @@ void vibrancer(unsigned char *pixel) { g = pixel[1], b = pixel[2]; + printf("%d %d %d\n", r, g, b); + // TODO remove unnecessary calculations int min_rgb = min3(r, g, b); int max_rgb = max3(r, g, b); @@ -99,7 +101,6 @@ void vibrancer(unsigned char *pixel) { pixel[0] = clamp(r, 0, 255); pixel[1] = clamp(g, 0, 255); pixel[2] = clamp(b, 0, 255); - } int main(int argc, char **argv) { @@ -118,7 +119,9 @@ int main(int argc, char **argv) { int width, height, channels; - unsigned char *img = stbi_load(input, &width, &height, &channels, 3); + unsigned char *img = stbi_load(input, &width, &height, &channels, 0); + + printf("Width: %d, Height: %d, Channels: %d\n", width, height, channels); if (img == NULL) { printf("Error loading image\n");