| 1 |
/* |
| 2 |
* macros.h |
| 3 |
* |
| 4 |
* Written by: Ullrich Hafner |
| 5 |
* |
| 6 |
* This file is part of FIASCO (Fractal Image And Sequence COdec) |
| 7 |
* Copyright (C) 1994-2000 Ullrich Hafner |
| 8 |
*/ |
| 9 |
|
| 10 |
/* |
| 11 |
* $Date: 2000/06/14 20:49:37 $ |
| 12 |
* $Author: hafner $ |
| 13 |
* $Revision: 5.1 $ |
| 14 |
* $State: Exp $ |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef _MACROS_H |
| 18 |
#define _MACROS_H |
| 19 |
|
| 20 |
#include <string.h> |
| 21 |
/******************************************************************************* |
| 22 |
|
| 23 |
System configuration section |
| 24 |
|
| 25 |
*******************************************************************************/ |
| 26 |
|
| 27 |
#ifndef SEEK_CUR |
| 28 |
# define SEEK_CUR 1 |
| 29 |
#endif /* not SEEK_CUR */ |
| 30 |
|
| 31 |
/***************************************************************************** |
| 32 |
|
| 33 |
Various macros |
| 34 |
|
| 35 |
*****************************************************************************/ |
| 36 |
|
| 37 |
#define square(x) ((x) * (x)) |
| 38 |
#define first_band(color) ((unsigned) ((color) ? Y : GRAY)) |
| 39 |
#define last_band(color) ((unsigned) ((color) ? Cr : GRAY)) |
| 40 |
#define width_of_level(l) ((unsigned) (1 << ((l) >> 1))) |
| 41 |
#define height_of_level(l) ((unsigned) (1 << (((l) + 1) >> 1))) |
| 42 |
#define size_of_level(l) ((unsigned) (1 << (l))) |
| 43 |
#define address_of_level(l) ((unsigned) (size_of_level (l) - 1)) |
| 44 |
#define size_of_tree(l) ((unsigned) (address_of_level ((l) + 1))) |
| 45 |
#define is_odd(n) (abs (n) % 2) |
| 46 |
#define _(x) (x) |
| 47 |
|
| 48 |
|
| 49 |
#define MAXSTRLEN 1024 |
| 50 |
#define MAXSTRLEN_SCANF "%1024s" |
| 51 |
|
| 52 |
typedef enum color {GRAY = 0, Y = 0, Cb = 1, Cr = 2} color_e; |
| 53 |
|
| 54 |
#endif /* _MACROS_H */ |
| 55 |
|
| 56 |
|
| 57 |
|