Skip to content

Commit

Permalink
Updated generation of c code to place code data in static array.
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Krogius committed Mar 8, 2021
1 parent b54fae7 commit a29f685
Show file tree
Hide file tree
Showing 9 changed files with 159,289 additions and 159,282 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Expand Up @@ -11,7 +11,6 @@ set(CMAKE_BUILD_TYPE Release)

# Library
file(GLOB TAG_FILES ${PROJECT_SOURCE_DIR}/tag*.c)
set_source_files_properties(SOURCE ${TAG_FILES} PROPERTIES COMPILE_FLAGS -O0)
add_library(${PROJECT_NAME} SHARED ${APRILTAG_SRCS} ${COMMON_SRC} ${TAG_FILES})
if (MSVC)
# FindThreads will not find pthread.h with MSVC
Expand Down
65 changes: 33 additions & 32 deletions tag16h5.c
Expand Up @@ -28,43 +28,45 @@ either expressed or implied, of the Regents of The University of Michigan.
#include <stdlib.h>
#include "tag16h5.h"

static uint64_t codedata[30] = {
0x00000000000027c8UL,
0x00000000000031b6UL,
0x0000000000003859UL,
0x000000000000569cUL,
0x0000000000006c76UL,
0x0000000000007ddbUL,
0x000000000000af09UL,
0x000000000000f5a1UL,
0x000000000000fb8bUL,
0x0000000000001cb9UL,
0x00000000000028caUL,
0x000000000000e8dcUL,
0x0000000000001426UL,
0x0000000000005770UL,
0x0000000000009253UL,
0x000000000000b702UL,
0x000000000000063aUL,
0x0000000000008f34UL,
0x000000000000b4c0UL,
0x00000000000051ecUL,
0x000000000000e6f0UL,
0x0000000000005fa4UL,
0x000000000000dd43UL,
0x0000000000001aaaUL,
0x000000000000e62fUL,
0x0000000000006dbcUL,
0x000000000000b6ebUL,
0x000000000000de10UL,
0x000000000000154dUL,
0x000000000000b57aUL,
};
apriltag_family_t *tag16h5_create()
{
apriltag_family_t *tf = calloc(1, sizeof(apriltag_family_t));
tf->name = strdup("tag16h5");
tf->h = 5;
tf->ncodes = 30;
tf->codes = calloc(30, sizeof(uint64_t));
tf->codes[0] = 0x00000000000027c8UL;
tf->codes[1] = 0x00000000000031b6UL;
tf->codes[2] = 0x0000000000003859UL;
tf->codes[3] = 0x000000000000569cUL;
tf->codes[4] = 0x0000000000006c76UL;
tf->codes[5] = 0x0000000000007ddbUL;
tf->codes[6] = 0x000000000000af09UL;
tf->codes[7] = 0x000000000000f5a1UL;
tf->codes[8] = 0x000000000000fb8bUL;
tf->codes[9] = 0x0000000000001cb9UL;
tf->codes[10] = 0x00000000000028caUL;
tf->codes[11] = 0x000000000000e8dcUL;
tf->codes[12] = 0x0000000000001426UL;
tf->codes[13] = 0x0000000000005770UL;
tf->codes[14] = 0x0000000000009253UL;
tf->codes[15] = 0x000000000000b702UL;
tf->codes[16] = 0x000000000000063aUL;
tf->codes[17] = 0x0000000000008f34UL;
tf->codes[18] = 0x000000000000b4c0UL;
tf->codes[19] = 0x00000000000051ecUL;
tf->codes[20] = 0x000000000000e6f0UL;
tf->codes[21] = 0x0000000000005fa4UL;
tf->codes[22] = 0x000000000000dd43UL;
tf->codes[23] = 0x0000000000001aaaUL;
tf->codes[24] = 0x000000000000e62fUL;
tf->codes[25] = 0x0000000000006dbcUL;
tf->codes[26] = 0x000000000000b6ebUL;
tf->codes[27] = 0x000000000000de10UL;
tf->codes[28] = 0x000000000000154dUL;
tf->codes[29] = 0x000000000000b57aUL;
tf->codes = codedata;
tf->nbits = 16;
tf->bit_x = calloc(16, sizeof(uint32_t));
tf->bit_y = calloc(16, sizeof(uint32_t));
Expand Down Expand Up @@ -108,7 +110,6 @@ apriltag_family_t *tag16h5_create()

void tag16h5_destroy(apriltag_family_t *tf)
{
free(tf->codes);
free(tf->bit_x);
free(tf->bit_y);
free(tf->name);
Expand Down
75 changes: 38 additions & 37 deletions tag25h9.c
Expand Up @@ -28,48 +28,50 @@ either expressed or implied, of the Regents of The University of Michigan.
#include <stdlib.h>
#include "tag25h9.h"

static uint64_t codedata[35] = {
0x000000000156f1f4UL,
0x0000000001f28cd5UL,
0x00000000016ce32cUL,
0x0000000001ea379cUL,
0x0000000001390f89UL,
0x000000000034fad0UL,
0x00000000007dcdb5UL,
0x000000000119ba95UL,
0x0000000001ae9daaUL,
0x0000000000df02aaUL,
0x000000000082fc15UL,
0x0000000000465123UL,
0x0000000000ceee98UL,
0x0000000001f17260UL,
0x00000000014429cdUL,
0x00000000017248a8UL,
0x00000000016ad452UL,
0x00000000009670adUL,
0x00000000016f65b2UL,
0x0000000000b8322bUL,
0x00000000005d715bUL,
0x0000000001a1c7e7UL,
0x0000000000d7890dUL,
0x0000000001813522UL,
0x0000000001c9c611UL,
0x000000000099e4a4UL,
0x0000000000855234UL,
0x00000000017b81c0UL,
0x0000000000c294bbUL,
0x000000000089fae3UL,
0x000000000044df5fUL,
0x0000000001360159UL,
0x0000000000ec31e8UL,
0x0000000001bcc0f6UL,
0x0000000000a64f8dUL,
};
apriltag_family_t *tag25h9_create()
{
apriltag_family_t *tf = calloc(1, sizeof(apriltag_family_t));
tf->name = strdup("tag25h9");
tf->h = 9;
tf->ncodes = 35;
tf->codes = calloc(35, sizeof(uint64_t));
tf->codes[0] = 0x000000000156f1f4UL;
tf->codes[1] = 0x0000000001f28cd5UL;
tf->codes[2] = 0x00000000016ce32cUL;
tf->codes[3] = 0x0000000001ea379cUL;
tf->codes[4] = 0x0000000001390f89UL;
tf->codes[5] = 0x000000000034fad0UL;
tf->codes[6] = 0x00000000007dcdb5UL;
tf->codes[7] = 0x000000000119ba95UL;
tf->codes[8] = 0x0000000001ae9daaUL;
tf->codes[9] = 0x0000000000df02aaUL;
tf->codes[10] = 0x000000000082fc15UL;
tf->codes[11] = 0x0000000000465123UL;
tf->codes[12] = 0x0000000000ceee98UL;
tf->codes[13] = 0x0000000001f17260UL;
tf->codes[14] = 0x00000000014429cdUL;
tf->codes[15] = 0x00000000017248a8UL;
tf->codes[16] = 0x00000000016ad452UL;
tf->codes[17] = 0x00000000009670adUL;
tf->codes[18] = 0x00000000016f65b2UL;
tf->codes[19] = 0x0000000000b8322bUL;
tf->codes[20] = 0x00000000005d715bUL;
tf->codes[21] = 0x0000000001a1c7e7UL;
tf->codes[22] = 0x0000000000d7890dUL;
tf->codes[23] = 0x0000000001813522UL;
tf->codes[24] = 0x0000000001c9c611UL;
tf->codes[25] = 0x000000000099e4a4UL;
tf->codes[26] = 0x0000000000855234UL;
tf->codes[27] = 0x00000000017b81c0UL;
tf->codes[28] = 0x0000000000c294bbUL;
tf->codes[29] = 0x000000000089fae3UL;
tf->codes[30] = 0x000000000044df5fUL;
tf->codes[31] = 0x0000000001360159UL;
tf->codes[32] = 0x0000000000ec31e8UL;
tf->codes[33] = 0x0000000001bcc0f6UL;
tf->codes[34] = 0x0000000000a64f8dUL;
tf->codes = codedata;
tf->nbits = 25;
tf->bit_x = calloc(25, sizeof(uint32_t));
tf->bit_y = calloc(25, sizeof(uint32_t));
Expand Down Expand Up @@ -131,7 +133,6 @@ apriltag_family_t *tag25h9_create()

void tag25h9_destroy(apriltag_family_t *tf)
{
free(tf->codes);
free(tf->bit_x);
free(tf->bit_y);
free(tf->name);
Expand Down

0 comments on commit a29f685

Please sign in to comment.