diff --git a/Makefile b/Makefile index 7ea30b5..5da152d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC=gcc CFLAGS=-g -Wall -LDFLAGS=-g +LDFLAGS=-g -lm ssdv: main.o ssdv.o rs8.o $(CC) $(LDFLAGS) main.o ssdv.o rs8.o -o ssdv diff --git a/ssdv.c b/ssdv.c index e8e89ff..9741491 100644 --- a/ssdv.c +++ b/ssdv.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "ssdv.h" #include "rs8.h" @@ -123,9 +124,9 @@ static uint8_t *dht_ac[3] = { std_dht10, std_dht11, std_dht11 }; #define DDQT (dqt[s->component][1 + s->acpart]) /* Helpers for converting between DQT tables */ -#define AADJ(i) (SDQT == DDQT ? (i) : (i / DDQT)) -#define UADJ(i) (SDQT == DDQT ? (i) : (i * SDQT)) -#define BADJ(i) (SDQT == DDQT ? (i) : (i * SDQT / DDQT)) +#define AADJ(i) (SDQT == DDQT ? (i) : round((double) i / DDQT)) +#define UADJ(i) (SDQT == DDQT ? (i) : round((double) i * SDQT)) +#define BADJ(i) (SDQT == DDQT ? (i) : round((double) i * SDQT / DDQT)) /* static char *strbits(uint32_t value, uint8_t bits)