Skip to content

Commit 60fea86

Browse files
committed
Cleaning up macros
1 parent 92d7170 commit 60fea86

3 files changed

Lines changed: 14 additions & 21 deletions

File tree

src/hal/macros.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,23 @@
5353
fprintf(stderr, "\033[0m"); \
5454
} while (0)
5555

56+
#ifndef ALIGN_BACK
57+
#define ALIGN_BACK(x, a) (((x) / (a)) * (a))
58+
#endif
59+
#ifndef ALIGN_UP
60+
#define ALIGN_UP(x, a) ((((x) + ((a)-1)) / a) * a)
61+
#endif
5662
#ifndef CEILING
5763
#define CEILING_POS(x) ((x - (int)(x)) > 0 ? (int)(x + 1) : (int)(x))
5864
#define CEILING_NEG(x) (int)(x)
5965
#define CEILING(x) (((x) > 0) ? CEILING_POS(x) : CEILING_NEG(x))
6066
#endif
61-
67+
#ifndef CEILING_2_POWER
68+
#define CEILING_2_POWER(x, a) (((x) + ((a)-1)) & (~((a) - 1)))
69+
#endif
6270
#ifndef MIN
6371
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
6472
#endif
65-
6673
#ifndef MAX
6774
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
6875
#endif
@@ -73,4 +80,4 @@
7380
((strlen(a) > strlen(b)) && !strcmp(a + strlen(a) - strlen(b), b))
7481
#define EQUALS(a, b) !strcmp(a, b)
7582
#define EQUALS_CASE(a, b) !strcasecmp(a, b)
76-
#define STARTS_WITH(a, b) !strncmp(a, b, strlen(b))
83+
#define STARTS_WITH(a, b) !strncmp(a, b, strlen(b))

src/hal/plus/ak_hal.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "ak_venc.h"
77
#include "ak_vi.h"
88

9+
#include "../support.h"
10+
911
extern char audioOn, keepRunning;
1012

1113
extern hal_chnstate ak_state[AK_VENC_CHN_NUM];
@@ -36,4 +38,4 @@ int ak_video_snapshot_grab(char index, hal_jpegdata *jpeg);
3638
void *ak_video_thread(void);
3739

3840
void ak_system_deinit(void);
39-
int ak_system_init(char *snrConfig);
41+
int ak_system_init(char *snrConfig);

src/hal/types.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,6 @@
22

33
#include "macros.h"
44

5-
#ifndef ALIGN_BACK
6-
#define ALIGN_BACK(x, a) (((x) / (a)) * (a))
7-
#endif
8-
#ifndef ALIGN_UP
9-
#define ALIGN_UP(x, a) ((((x) + ((a)-1)) / a) * a)
10-
#endif
11-
#ifndef CEILING_2_POWER
12-
#define CEILING_2_POWER(x, a) (((x) + ((a)-1)) & (~((a) - 1)))
13-
#endif
14-
#ifndef MIN
15-
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
16-
#endif
17-
#ifndef MAX
18-
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
19-
#endif
20-
215
typedef enum {
226
HAL_PLATFORM_UNK,
237
HAL_PLATFORM_AK,
@@ -133,4 +117,4 @@ typedef struct {
133117
hal_vidpack *pack;
134118
unsigned int count;
135119
unsigned int seq;
136-
} hal_vidstream;
120+
} hal_vidstream;

0 commit comments

Comments
 (0)