rename tans to tANS
authorGeoffrey Allott <geoffrey@allott.email>
Tue, 2 Aug 2022 07:50:21 +0000 (08:50 +0100)
committerGeoffrey Allott <geoffrey@allott.email>
Tue, 2 Aug 2022 07:50:21 +0000 (08:50 +0100)
20 files changed:
Makefile
src/tANS_constants.h [moved from src/tans_constants.h with 100% similarity]
src/tANS_decode_st.c [moved from src/tans_decode_st.c with 73% similarity]
src/tANS_decode_st.h [new file with mode: 0644]
src/tANS_decode_tbl.c [moved from src/tans_decode_tbl.c with 78% similarity]
src/tANS_decode_tbl.h [new file with mode: 0644]
src/tANS_encode_st.c [moved from src/tans_encode_st.c with 83% similarity]
src/tANS_encode_st.h [new file with mode: 0644]
src/tANS_encode_tbl.c [moved from src/tans_encode_tbl.c with 71% similarity]
src/tANS_encode_tbl.h [new file with mode: 0644]
src/tANS_freq_tbl.c [moved from src/tans_freq_tbl.c with 92% similarity]
src/tANS_freq_tbl.h [moved from src/tans_freq_tbl.h with 59% similarity]
src/tANS_symbol_tbl.c [moved from src/tans_symbol_tbl.c with 87% similarity]
src/tANS_symbol_tbl.h [new file with mode: 0644]
src/tans_decode_st.h [deleted file]
src/tans_decode_tbl.h [deleted file]
src/tans_encode_st.h [deleted file]
src/tans_encode_tbl.h [deleted file]
src/tans_symbol_tbl.h [deleted file]
test/test_tANS.c

index 86ae62b3c838400e52e8cb1c47373a70036b6cf1..71ec0bd689ca98b395bc0d457ac472aadf8915e3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,11 +13,11 @@ $(RUN_TESTS): run_%: %
 
 all: $(OBJS)
 
-$(OBJS): %.o: %.h src/tans_constants.h
+$(OBJS): %.o: %.h src/tANS_constants.h
 $(TEST_OBJS): test/test.h $(OBJS)
 
-test/test_tans_encode_decode.o: src/tans_decode_st.h src/tans_decode_tbl.h src/tans_encode_st.h src/tans_encode_tbl.h src/tans_symbol_tbl.h src/tans_freq_tbl.h
-test/test_tans_encode_decode: src/tans_decode_st.o src/tans_decode_tbl.o src/tans_encode_st.o src/tans_encode_tbl.o src/tans_symbol_tbl.o src/tans_freq_tbl.o
+test/test_tANS_encode_decode.o: src/tANS_decode_st.h src/tANS_decode_tbl.h src/tANS_encode_st.h src/tANS_encode_tbl.h src/tANS_symbol_tbl.h src/tANS_freq_tbl.h
+test/test_tANS_encode_decode: src/tANS_decode_st.o src/tANS_decode_tbl.o src/tANS_encode_st.o src/tANS_encode_tbl.o src/tANS_symbol_tbl.o src/tANS_freq_tbl.o
 
 clean:
        rm -f $(OBJS)
similarity index 100%
rename from src/tans_constants.h
rename to src/tANS_constants.h
similarity index 73%
rename from src/tans_decode_st.c
rename to src/tANS_decode_st.c
index 0f61ec87a6f40f207980b80dbc61367b4c452e37..2a51c0f480ddc09c4552b8f481a71f154c17e57b 100644 (file)
@@ -1,8 +1,8 @@
-#include "tans_decode_st.h"
+#include "tANS_decode_st.h"
 
-void tans_decode_st_init(struct tans_decode_st *self, struct tans_symbol_tbl *symbol_tbl)
+void tANS_decode_st_init(struct tANS_decode_st *self, struct tANS_symbol_tbl *symbol_tbl)
 {
-    tans_decode_tbl_init(&self->decode_tbl, symbol_tbl);
+    tANS_decode_tbl_init(&self->decode_tbl, symbol_tbl);
     self->x = 0;
 }
 
@@ -11,10 +11,10 @@ static inline uint32_t get_uint32(uint8_t buf[const static 4])
     return (uint32_t) buf[0] | (uint32_t) buf[1] << 8 | (uint32_t) buf[2] << 16 | (uint32_t) buf[3] << 24;
 }
 
-uint32_t tans_decode_st_decode(struct tans_decode_st *self, uint8_t *data, uint32_t len, uint8_t *buf, uint32_t bits)
+uint32_t tANS_decode_st_decode(struct tANS_decode_st *self, uint8_t *data, uint32_t len, uint8_t *buf, uint32_t bits)
 {
     uint32_t i;
-    struct tans_decode_tbl_entry t;
+    struct tANS_decode_tbl_entry t;
     uint32_t bit, byte, value;
 
     for (i = 0; i < len; ++i) {
diff --git a/src/tANS_decode_st.h b/src/tANS_decode_st.h
new file mode 100644 (file)
index 0000000..c576f4f
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "tANS_decode_tbl.h"
+
+struct tANS_decode_st {
+    struct tANS_decode_tbl decode_tbl;
+    uint16_t x;
+};
+
+void tANS_decode_st_init(struct tANS_decode_st *self, struct tANS_symbol_tbl *symbol_tbl);
+uint32_t tANS_decode_st_decode(struct tANS_decode_st *self, uint8_t *data, uint32_t len, uint8_t *buf, uint32_t bits);
similarity index 78%
rename from src/tans_decode_tbl.c
rename to src/tANS_decode_tbl.c
index 784ddac65bc154ebffb42689819cfb322eacff4b..4f813c673529abc9ce441bf9ecc652da92212f0c 100644 (file)
@@ -1,8 +1,8 @@
-#include "tans_decode_tbl.h"
+#include "tANS_decode_tbl.h"
 
 #include "floor_log2.h"
 
-void tans_decode_tbl_init(struct tans_decode_tbl *self, struct tans_symbol_tbl *symbol_tbl)
+void tANS_decode_tbl_init(struct tANS_decode_tbl *self, struct tANS_symbol_tbl *symbol_tbl)
 {
     uint16_t i;
     uint16_t x;
diff --git a/src/tANS_decode_tbl.h b/src/tANS_decode_tbl.h
new file mode 100644 (file)
index 0000000..734d0f4
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "tANS_symbol_tbl.h"
+
+struct tANS_decode_tbl_entry {
+    uint8_t symbol;
+    uint8_t nb_bits;
+    uint16_t new_x;
+};
+
+struct tANS_decode_tbl {
+    uint16_t tblsz;
+    struct tANS_decode_tbl_entry entries[TANS_MAX_TBLSZ];
+};
+
+void tANS_decode_tbl_init(struct tANS_decode_tbl *self, struct tANS_symbol_tbl *symbol_tbl);
similarity index 83%
rename from src/tans_encode_st.c
rename to src/tANS_encode_st.c
index eab6a8e3feca8be8fc2c8390392c70c8f7af2f90..7fab5088a55795d42be5774435be325b9d671e94 100644 (file)
@@ -1,9 +1,9 @@
-#include "tans_encode_st.h"
+#include "tANS_encode_st.h"
 
-void tans_encode_st_init(struct tans_encode_st *self, const struct tans_symbol_tbl *symbol_tbl)
+void tANS_encode_st_init(struct tANS_encode_st *self, const struct tANS_symbol_tbl *symbol_tbl)
 {
     self->symbol_tbl = *symbol_tbl;
-    tans_encode_tbl_init(&self->encode_tbl, &self->symbol_tbl);
+    tANS_encode_tbl_init(&self->encode_tbl, &self->symbol_tbl);
     self->x = self->encode_tbl.tblsz;
 }
 
@@ -20,7 +20,7 @@ static inline void set_uint32(uint8_t buf[static 4], uint32_t value)
     buf[3] = (uint8_t) (value >> 24);
 }
 
-uint32_t tans_encode_st_encode(struct tans_encode_st *self, uint8_t *data, uint32_t len, uint8_t *buf)
+uint32_t tANS_encode_st_encode(struct tANS_encode_st *self, uint8_t *data, uint32_t len, uint8_t *buf)
 {
     uint8_t nb_bits;
     uint32_t i, written = 0;
diff --git a/src/tANS_encode_st.h b/src/tANS_encode_st.h
new file mode 100644 (file)
index 0000000..e0078c6
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "tANS_encode_tbl.h"
+
+struct tANS_encode_st {
+    struct tANS_symbol_tbl symbol_tbl;
+    struct tANS_encode_tbl encode_tbl;
+    uint16_t x;
+};
+
+void tANS_encode_st_init(struct tANS_encode_st *self, const struct tANS_symbol_tbl *symbol_tbl);
+uint32_t tANS_encode_st_encode(struct tANS_encode_st *self, uint8_t *data, uint32_t len, uint8_t *buf);
similarity index 71%
rename from src/tans_encode_tbl.c
rename to src/tANS_encode_tbl.c
index 6c01b756f0906df86a3f8467431b7311b1620774..7be8889ffafe8053426b580ab8c05199df8a11c5 100644 (file)
@@ -1,6 +1,6 @@
-#include "tans_encode_tbl.h"
+#include "tANS_encode_tbl.h"
 
-void tans_encode_tbl_init(struct tans_encode_tbl *self, struct tans_symbol_tbl *symbol_tbl)
+void tANS_encode_tbl_init(struct tANS_encode_tbl *self, struct tANS_symbol_tbl *symbol_tbl)
 {
     uint8_t s;
     uint16_t i, x;
diff --git a/src/tANS_encode_tbl.h b/src/tANS_encode_tbl.h
new file mode 100644 (file)
index 0000000..1be51d0
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "tANS_constants.h"
+#include "tANS_symbol_tbl.h"
+
+struct tANS_encode_tbl_entry {
+    uint16_t x;
+};
+
+struct tANS_encode_tbl {
+    uint16_t tblsz;
+    struct tANS_encode_tbl_entry entries[TANS_MAX_TBLSZ];
+};
+
+void tANS_encode_tbl_init(struct tANS_encode_tbl *self, struct tANS_symbol_tbl *symbol_tbl);
similarity index 92%
rename from src/tans_freq_tbl.c
rename to src/tANS_freq_tbl.c
index 6d55485c88c54e2721a64e4c7a36f924cb40809f..841b4f9df22c2a2d717602ca1be77f3ec26706e8 100644 (file)
@@ -1,6 +1,6 @@
-#include "tans_freq_tbl.h"
+#include "tANS_freq_tbl.h"
 
-int tans_freq_tbl_init(struct tans_freq_tbl *self, uint16_t n_symbols, double *p, uint16_t log2_tblsz)
+int tANS_freq_tbl_init(struct tANS_freq_tbl *self, uint16_t n_symbols, double *p, uint16_t log2_tblsz)
 {
     uint16_t i, tblsz, total;
     double total_p;
similarity index 59%
rename from src/tans_freq_tbl.h
rename to src/tANS_freq_tbl.h
index 168067c5580d95212427d17459922402e4a626aa..f52538e1cea32e41f23345b7d309b7b6eba5bbb9 100644 (file)
@@ -1,13 +1,13 @@
 #pragma once
 
-#include "tans_constants.h"
+#include "tANS_constants.h"
 
 #include <stdint.h>
 
-struct tans_freq_tbl {
+struct tANS_freq_tbl {
     uint16_t n_symbols;
     uint16_t log2_tblsz;
     uint16_t freq[TANS_MAX_SYMBOLS];
 };
 
-int tans_freq_tbl_init(struct tans_freq_tbl *self, uint16_t n_symbols, double *p, uint16_t log2_tblsz);
+int tANS_freq_tbl_init(struct tANS_freq_tbl *self, uint16_t n_symbols, double *p, uint16_t log2_tblsz);
similarity index 87%
rename from src/tans_symbol_tbl.c
rename to src/tANS_symbol_tbl.c
index 46a9356f9558dbb6a4c94f62b675ec8f2e035ffb..22a4b8d5bb9d2fda615844cea1b59cf4442a3ee3 100644 (file)
@@ -1,8 +1,8 @@
-#include "tans_symbol_tbl.h"
+#include "tANS_symbol_tbl.h"
 
 #include "floor_log2.h"
 
-int tans_symbol_tbl_init(struct tans_symbol_tbl *self, const struct tans_freq_tbl *freq_tbl)
+int tANS_symbol_tbl_init(struct tANS_symbol_tbl *self, const struct tANS_freq_tbl *freq_tbl)
 {
     uint16_t x, step, s, i, start, freq, k;
 
diff --git a/src/tANS_symbol_tbl.h b/src/tANS_symbol_tbl.h
new file mode 100644 (file)
index 0000000..78c06e9
--- /dev/null
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "tANS_constants.h"
+#include "tANS_freq_tbl.h"
+
+struct tANS_symbol_tbl_entry {
+    uint32_t nb;
+    uint16_t start;
+    uint16_t next;
+};
+
+struct tANS_symbol_tbl {
+    uint16_t n_symbols;
+    uint16_t log2_tblsz;
+    uint16_t tblsz;
+    uint8_t symbol[TANS_MAX_TBLSZ];
+    struct tANS_symbol_tbl_entry entries[TANS_MAX_SYMBOLS];
+};
+
+int tANS_symbol_tbl_init(struct tANS_symbol_tbl *self, const struct tANS_freq_tbl *freq_tbl);
diff --git a/src/tans_decode_st.h b/src/tans_decode_st.h
deleted file mode 100644 (file)
index c4ccfbc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include "tans_decode_tbl.h"
-
-struct tans_decode_st {
-    struct tans_decode_tbl decode_tbl;
-    uint16_t x;
-};
-
-void tans_decode_st_init(struct tans_decode_st *self, struct tans_symbol_tbl *symbol_tbl);
-uint32_t tans_decode_st_decode(struct tans_decode_st *self, uint8_t *data, uint32_t len, uint8_t *buf, uint32_t bits);
diff --git a/src/tans_decode_tbl.h b/src/tans_decode_tbl.h
deleted file mode 100644 (file)
index 7c374a3..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include "tans_symbol_tbl.h"
-
-struct tans_decode_tbl_entry {
-    uint8_t symbol;
-    uint8_t nb_bits;
-    uint16_t new_x;
-};
-
-struct tans_decode_tbl {
-    uint16_t tblsz;
-    struct tans_decode_tbl_entry entries[TANS_MAX_TBLSZ];
-};
-
-void tans_decode_tbl_init(struct tans_decode_tbl *self, struct tans_symbol_tbl *symbol_tbl);
diff --git a/src/tans_encode_st.h b/src/tans_encode_st.h
deleted file mode 100644 (file)
index 4859be6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#pragma once
-
-#include "tans_encode_tbl.h"
-
-struct tans_encode_st {
-    struct tans_symbol_tbl symbol_tbl;
-    struct tans_encode_tbl encode_tbl;
-    uint16_t x;
-};
-
-void tans_encode_st_init(struct tans_encode_st *self, const struct tans_symbol_tbl *symbol_tbl);
-uint32_t tans_encode_st_encode(struct tans_encode_st *self, uint8_t *data, uint32_t len, uint8_t *buf);
diff --git a/src/tans_encode_tbl.h b/src/tans_encode_tbl.h
deleted file mode 100644 (file)
index fbae420..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#include "tans_constants.h"
-#include "tans_symbol_tbl.h"
-
-struct tans_encode_tbl_entry {
-    uint16_t x;
-};
-
-struct tans_encode_tbl {
-    uint16_t tblsz;
-    struct tans_encode_tbl_entry entries[TANS_MAX_TBLSZ];
-};
-
-void tans_encode_tbl_init(struct tans_encode_tbl *self, struct tans_symbol_tbl *symbol_tbl);
diff --git a/src/tans_symbol_tbl.h b/src/tans_symbol_tbl.h
deleted file mode 100644 (file)
index 1392b5a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#pragma once
-
-#include "tans_constants.h"
-#include "tans_freq_tbl.h"
-
-struct tans_symbol_tbl_entry {
-    uint32_t nb;
-    uint16_t start;
-    uint16_t next;
-};
-
-struct tans_symbol_tbl {
-    uint16_t n_symbols;
-    uint16_t log2_tblsz;
-    uint16_t tblsz;
-    uint8_t symbol[TANS_MAX_TBLSZ];
-    struct tans_symbol_tbl_entry entries[TANS_MAX_SYMBOLS];
-};
-
-int tans_symbol_tbl_init(struct tans_symbol_tbl *self, const struct tans_freq_tbl *freq_tbl);
index f551daffd32b7d0f099281dc7c24e26afea37ba2..f8e98652fba7fef6f078593cfd4d4e1786f64911 100644 (file)
@@ -1,14 +1,14 @@
 #include "test.h"
 
 #include "floor_log2.h"
-#include "tans_decode_st.h"
-#include "tans_encode_st.h"
+#include "tANS_decode_st.h"
+#include "tANS_encode_st.h"
 
-enum test_result test_tans_encode_equal_freq(void)
+enum test_result test_tANS_encode_equal_freq(void)
 {
-    struct tans_freq_tbl freq_tbl;
-    struct tans_symbol_tbl symbol_tbl;
-    struct tans_encode_st encode_st;
+    struct tANS_freq_tbl freq_tbl;
+    struct tANS_symbol_tbl symbol_tbl;
+    struct tANS_encode_st encode_st;
     uint8_t data[8] = {0x01, 0xfe, 0x32, 0x12, 0x06, 0x07, 0x88, 0x00};
     double p[256];
     uint8_t buf[4 + 8 + 4] = {0};
@@ -17,21 +17,21 @@ enum test_result test_tans_encode_equal_freq(void)
     uint16_t log2_tblsz = 10;
 
     for (i = 0; i < n_symbols; ++i) p[i] = 1.0 / n_symbols;
-    ASSERT_NE(tans_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
-    ASSERT_EQ(tans_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
-    tans_encode_st_init(&encode_st, &symbol_tbl);
+    ASSERT_NE(tANS_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
+    ASSERT_EQ(tANS_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
+    tANS_encode_st_init(&encode_st, &symbol_tbl);
 
-    ASSERT_EQ(tans_encode_st_encode(&encode_st, data, sizeof data, buf + 4), sizeof data * 8);
+    ASSERT_EQ(tANS_encode_st_encode(&encode_st, data, sizeof data, buf + 4), sizeof data * 8);
 
 
     return TEST_SUCCESS;
 }
 
-enum test_result test_tans_encode_high_zero_probability(void)
+enum test_result test_tANS_encode_high_zero_probability(void)
 {
-    struct tans_freq_tbl freq_tbl;
-    struct tans_symbol_tbl symbol_tbl;
-    struct tans_encode_st encode_st;
+    struct tANS_freq_tbl freq_tbl;
+    struct tANS_symbol_tbl symbol_tbl;
+    struct tANS_encode_st encode_st;
     uint8_t data[8] = {0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x23};
     double p[256];
     uint8_t buf[16] = {0};
@@ -41,21 +41,21 @@ enum test_result test_tans_encode_high_zero_probability(void)
 
     p[0] = 0.75;
     for (i = 1; i < n_symbols; ++i) p[i] = 0.25 / n_symbols;
-    ASSERT_NE(tans_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
-    ASSERT_EQ(tans_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
-    tans_encode_st_init(&encode_st, &symbol_tbl);
+    ASSERT_NE(tANS_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
+    ASSERT_EQ(tANS_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
+    tANS_encode_st_init(&encode_st, &symbol_tbl);
 
-    ASSERT_LT(tans_encode_st_encode(&encode_st, data, sizeof data, buf + 4), 24);
+    ASSERT_LT(tANS_encode_st_encode(&encode_st, data, sizeof data, buf + 4), 24);
 
     return TEST_SUCCESS;
 }
 
-enum test_result test_tans_encode_decode_equal_freq(void)
+enum test_result test_tANS_encode_decode_equal_freq(void)
 {
-    struct tans_freq_tbl freq_tbl;
-    struct tans_symbol_tbl symbol_tbl;
-    struct tans_encode_st encode_st;
-    struct tans_decode_st decode_st;
+    struct tANS_freq_tbl freq_tbl;
+    struct tANS_symbol_tbl symbol_tbl;
+    struct tANS_encode_st encode_st;
+    struct tANS_decode_st decode_st;
     uint8_t data[8] = {0x01, 0xfe, 0x32, 0x12, 0x06, 0x07, 0x88, 0x00};
     double p[256];
     uint8_t buf[4 + 8 + 4] = {0};
@@ -65,15 +65,15 @@ enum test_result test_tans_encode_decode_equal_freq(void)
     uint16_t log2_tblsz = 10;
 
     for (i = 0; i < n_symbols; ++i) p[i] = 1.0 / n_symbols;
-    ASSERT_NE(tans_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
-    ASSERT_EQ(tans_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
-    tans_encode_st_init(&encode_st, &symbol_tbl);
-    tans_decode_st_init(&decode_st, &symbol_tbl);
+    ASSERT_NE(tANS_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
+    ASSERT_EQ(tANS_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
+    tANS_encode_st_init(&encode_st, &symbol_tbl);
+    tANS_decode_st_init(&decode_st, &symbol_tbl);
 
-    ASSERT_EQ(tans_encode_st_encode(&encode_st, data, sizeof data, buf + 4), 64);
+    ASSERT_EQ(tANS_encode_st_encode(&encode_st, data, sizeof data, buf + 4), 64);
     decode_st.x = (uint16_t) (encode_st.x - (1 << log2_tblsz));
 
-    ASSERT_EQ(tans_decode_st_decode(&decode_st, rec, sizeof rec, buf + 4, 64), 0);
+    ASSERT_EQ(tANS_decode_st_decode(&decode_st, rec, sizeof rec, buf + 4, 64), 0);
 
     for (i = 0; i < sizeof rec; ++i) {
         ASSERT_EQ(data[i], rec[i]);
@@ -82,12 +82,12 @@ enum test_result test_tans_encode_decode_equal_freq(void)
     return TEST_SUCCESS;
 }
 
-enum test_result test_tans_encode_decode_high_zero_probability(void)
+enum test_result test_tANS_encode_decode_high_zero_probability(void)
 {
-    struct tans_freq_tbl freq_tbl;
-    struct tans_symbol_tbl symbol_tbl;
-    struct tans_encode_st encode_st;
-    struct tans_decode_st decode_st;
+    struct tANS_freq_tbl freq_tbl;
+    struct tANS_symbol_tbl symbol_tbl;
+    struct tANS_encode_st encode_st;
+    struct tANS_decode_st decode_st;
     uint8_t data[8] = {0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x23};
     double p[256];
     uint8_t buf[4 + 8 + 4] = {0};
@@ -99,16 +99,16 @@ enum test_result test_tans_encode_decode_high_zero_probability(void)
 
     p[0] = 0.75;
     for (i = 1; i < n_symbols; ++i) p[i] = 0.25 / n_symbols;
-    ASSERT_NE(tans_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
-    ASSERT_EQ(tans_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
-    tans_encode_st_init(&encode_st, &symbol_tbl);
-    tans_decode_st_init(&decode_st, &symbol_tbl);
+    ASSERT_NE(tANS_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
+    ASSERT_EQ(tANS_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
+    tANS_encode_st_init(&encode_st, &symbol_tbl);
+    tANS_decode_st_init(&decode_st, &symbol_tbl);
 
-    bits = tans_encode_st_encode(&encode_st, data, sizeof data, buf + 4);
+    bits = tANS_encode_st_encode(&encode_st, data, sizeof data, buf + 4);
 
     decode_st.x = (uint16_t) (encode_st.x - (1 << log2_tblsz));
 
-    ASSERT_EQ(tans_decode_st_decode(&decode_st, rec, sizeof rec, buf + 4, bits), 0);
+    ASSERT_EQ(tANS_decode_st_decode(&decode_st, rec, sizeof rec, buf + 4, bits), 0);
 
     for (i = 0; i < sizeof rec; ++i) {
         ASSERT_EQ(data[i], rec[i]);
@@ -117,12 +117,12 @@ enum test_result test_tans_encode_decode_high_zero_probability(void)
     return TEST_SUCCESS;
 }
 
-enum test_result test_tans_encode_decode_long_stream(void)
+enum test_result test_tANS_encode_decode_long_stream(void)
 {
-    struct tans_freq_tbl freq_tbl;
-    struct tans_symbol_tbl symbol_tbl;
-    struct tans_encode_st encode_st;
-    struct tans_decode_st decode_st;
+    struct tANS_freq_tbl freq_tbl;
+    struct tANS_symbol_tbl symbol_tbl;
+    struct tANS_encode_st encode_st;
+    struct tANS_decode_st decode_st;
     uint8_t data[65536];
     double p[256];
     uint8_t rec[65536];
@@ -134,19 +134,19 @@ enum test_result test_tans_encode_decode_long_stream(void)
 
     p[0] = 0.75;
     for (i = 1; i < n_symbols; ++i) p[i] = 0.25 / n_symbols;
-    ASSERT_NE(tans_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
-    ASSERT_EQ(tans_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
-    tans_encode_st_init(&encode_st, &symbol_tbl);
-    tans_decode_st_init(&decode_st, &symbol_tbl);
+    ASSERT_NE(tANS_freq_tbl_init(&freq_tbl, n_symbols, p, log2_tblsz), -1);
+    ASSERT_EQ(tANS_symbol_tbl_init(&symbol_tbl, &freq_tbl), 0);
+    tANS_encode_st_init(&encode_st, &symbol_tbl);
+    tANS_decode_st_init(&decode_st, &symbol_tbl);
 
     for (i = 0; i < 65536; ++i) {
         data[i] = (uint8_t) (i % 4 == 3 ? i / 4 : 0);
     }
 
-    bits = (uint32_t) tans_encode_st_encode(&encode_st, data, sizeof data, buf + 4);
+    bits = (uint32_t) tANS_encode_st_encode(&encode_st, data, sizeof data, buf + 4);
     decode_st.x = (uint16_t) (encode_st.x - (1 << log2_tblsz));
 
-    ASSERT_EQ(tans_decode_st_decode(&decode_st, rec, sizeof rec, buf + 4, bits), 0);
+    ASSERT_EQ(tANS_decode_st_decode(&decode_st, rec, sizeof rec, buf + 4, bits), 0);
 
     for (i = 0; i < sizeof rec; ++i) {
         ASSERT_EQ(data[i], rec[i]);
@@ -157,9 +157,9 @@ enum test_result test_tans_encode_decode_long_stream(void)
 
 int main(void)
 {
-    RUN_TEST(test_tans_encode_equal_freq);
-    RUN_TEST(test_tans_encode_high_zero_probability);
-    RUN_TEST(test_tans_encode_decode_equal_freq);
-    RUN_TEST(test_tans_encode_decode_high_zero_probability);
-    RUN_TEST(test_tans_encode_decode_long_stream);
+    RUN_TEST(test_tANS_encode_equal_freq);
+    RUN_TEST(test_tANS_encode_high_zero_probability);
+    RUN_TEST(test_tANS_encode_decode_equal_freq);
+    RUN_TEST(test_tANS_encode_decode_high_zero_probability);
+    RUN_TEST(test_tANS_encode_decode_long_stream);
 }