| 1 |
/* |
| 2 |
* wfa.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/07/18 15:44:57 $ |
| 12 |
* $Author: hafner $ |
| 13 |
* $Revision: 5.3 $ |
| 14 |
* $State: Exp $ |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef _WFA_H |
| 18 |
#define _WFA_H |
| 19 |
|
| 20 |
#define MAXEDGES 5 |
| 21 |
#define MAXSTATES 6000 |
| 22 |
#define MAXLABELS 2 /* only bintree possible anymore */ |
| 23 |
#define MAXLEVEL 22 |
| 24 |
|
| 25 |
#define FIASCO_BINFILE_RELEASE 2 |
| 26 |
#define FIASCO_MAGIC "FIASCO" /* FIASCO magic number */ |
| 27 |
#define FIASCO_BASIS_MAGIC "Fiasco" /* FIASCO initial basis */ |
| 28 |
|
| 29 |
#define NO_EDGE -1 |
| 30 |
#define RANGE -1 |
| 31 |
#define NO_RANGE 0 |
| 32 |
|
| 33 |
#define CHILD 1 |
| 34 |
#define LEAF 0 |
| 35 |
|
| 36 |
#define MAX_PROB 9 |
| 37 |
#define MIN_PROB 1 |
| 38 |
|
| 39 |
/* |
| 40 |
* WFA state types: |
| 41 |
* 0: state is not allowed to be used in an |
| 42 |
* approximation and it's image is not needed |
| 43 |
* for ip computations. |
| 44 |
* AUXILIARY_MASK: state is required for computation of ip's but is not |
| 45 |
* allowed to be used in an approximation. |
| 46 |
* USE_DOMAIN_MASK: state is allowed to be used in an approximation. |
| 47 |
*/ |
| 48 |
enum state_types {AUXILIARY_MASK = 1 << 0, USE_DOMAIN_MASK = 1 << 1}; |
| 49 |
|
| 50 |
#define isedge(x) ((x) != NO_EDGE) |
| 51 |
#define isdomain(x) ((x) != NO_EDGE) |
| 52 |
#define isrange(x) ((x) == RANGE) |
| 53 |
#define ischild(x) ((x) != RANGE) |
| 54 |
#define isauxiliary(d,wfa) ((wfa)->domain_type[d] & AUXILIARY_MASK) |
| 55 |
#define usedomain(d, wfa) ((wfa)->domain_type[d] & USE_DOMAIN_MASK) |
| 56 |
#define need_image(d,wfa) (isauxiliary ((d), (wfa)) || usedomain ((d), (wfa))) |
| 57 |
|
| 58 |
typedef enum mc_type {NONE, FORWARD, BACKWARD, INTERPOLATED} mc_type_e; |
| 59 |
typedef enum frame_type {I_FRAME, P_FRAME, B_FRAME} frame_type_e; |
| 60 |
typedef enum header {HEADER_END, HEADER_TITLE, HEADER_COMMENT} header_type_e; |
| 61 |
|
| 62 |
typedef struct mv |
| 63 |
/* |
| 64 |
* Motion vector components |
| 65 |
*/ |
| 66 |
{ |
| 67 |
mc_type_e type; /* motion compensation type */ |
| 68 |
int fx, fy; /* forward vector coordinates */ |
| 69 |
int bx, by; /* backward vector coordinates */ |
| 70 |
} mv_t; |
| 71 |
|
| 72 |
typedef struct range_info |
| 73 |
{ |
| 74 |
unsigned x, y; /* coordinates of upper left corner */ |
| 75 |
unsigned level; /* bintree level of range */ |
| 76 |
} range_info_t; |
| 77 |
|
| 78 |
#include "image.h" |
| 79 |
#include "rpf.h" |
| 80 |
#include "bit-io.h" |
| 81 |
|
| 82 |
typedef struct wfa_info |
| 83 |
{ |
| 84 |
char *wfa_name; /* filename of the WFA */ |
| 85 |
char *basis_name; /* filename of the initial basis */ |
| 86 |
char *title; /* title of FIASCO stream */ |
| 87 |
char *comment; /* comment for FIASCO stream */ |
| 88 |
|
| 89 |
unsigned max_states; /* max. cardinality of domain pool */ |
| 90 |
unsigned chroma_max_states; /* max. cardinality of domain pool for |
| 91 |
chroma band coding */ |
| 92 |
bool_t color; /* color image */ |
| 93 |
unsigned width; /* image width */ |
| 94 |
unsigned height; /* image height */ |
| 95 |
unsigned level; /* image level */ |
| 96 |
rpf_t *rpf; /* Standard reduced precision format */ |
| 97 |
rpf_t *dc_rpf; /* DC reduced precision format */ |
| 98 |
rpf_t *d_rpf; /* Delta reduced precision format */ |
| 99 |
rpf_t *d_dc_rpf; /* Delta DC reduced precision format */ |
| 100 |
unsigned frames; /* number of frames in the video */ |
| 101 |
unsigned fps; /* number of frames per second */ |
| 102 |
unsigned p_min_level; /* min. level of prediction */ |
| 103 |
unsigned p_max_level; /* max. level of prediction */ |
| 104 |
unsigned search_range; /* motion vector interval */ |
| 105 |
bool_t half_pixel; /* usage of half pixel precision */ |
| 106 |
bool_t cross_B_search; /* usage of Cross-B-Search */ |
| 107 |
bool_t B_as_past_ref; /* usage of B frames as ref's */ |
| 108 |
unsigned smoothing; /* smoothing of image along borders */ |
| 109 |
unsigned release; /* FIASCO file format release */ |
| 110 |
} wfa_info_t; |
| 111 |
|
| 112 |
typedef struct wfa |
| 113 |
/* |
| 114 |
* Used to store all information and data structures of a WFA |
| 115 |
*/ |
| 116 |
{ |
| 117 |
wfa_info_t *wfainfo; /* misc. information about the WFA */ |
| 118 |
frame_type_e frame_type; /* intra, predicted, bi-directional */ |
| 119 |
unsigned states; /* number of states */ |
| 120 |
unsigned basis_states; /* number of states in the basis */ |
| 121 |
unsigned root_state; /* root of the tree */ |
| 122 |
real_t *final_distribution; /* one pixel images */ |
| 123 |
byte_t *level_of_state; /* level of the image part which is |
| 124 |
represented by the current state */ |
| 125 |
byte_t *domain_type; /* Bit_0==1: auxiliary state |
| 126 |
Bit_1==1: used for Y compr */ |
| 127 |
mv_t (*mv_tree)[MAXLABELS]; /* motion vectors */ |
| 128 |
word_t (*tree)[MAXLABELS]; /* bintree partitioning */ |
| 129 |
u_word_t (*x)[MAXLABELS]; /* range coordinate */ |
| 130 |
u_word_t (*y)[MAXLABELS]; /* range coordinate */ |
| 131 |
word_t (*into)[MAXLABELS][MAXEDGES + 1]; /* domain references */ |
| 132 |
real_t (*weight)[MAXLABELS][MAXEDGES + 1]; /* lin.comb. coefficients */ |
| 133 |
word_t (*int_weight)[MAXLABELS][MAXEDGES + 1]; /* bin. representation */ |
| 134 |
word_t (*y_state)[MAXLABELS]; /* bintree of Y component */ |
| 135 |
byte_t (*y_column)[MAXLABELS]; /* array for Y component references */ |
| 136 |
byte_t (*prediction)[MAXLABELS]; /* DC prediction */ |
| 137 |
bool_t (*delta_state); /* delta state */ |
| 138 |
} wfa_t; |
| 139 |
|
| 140 |
#endif /* not _WFA_H */ |
| 141 |
|