1 /*
2  *  cwfa.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/10/28 17:39:30 $
12  *  $Author: hafner $
13  *  $Revision: 5.3 $
14  *  $State: Exp $
15  */
16 
17 #ifndef _CWFA_H
18 #define _CWFA_H
19 
20 #include "wfa.h"
21 #include "types.h"
22 #include "tiling.h"
23 #include "rpf.h"
24 #include "domain-pool.h"
25 #include "bintree.h"
26 #include "coeff.h"
27 #include "list.h"
28 #include "wfalib.h"
29 #include "options.h"
30 
31 extern const real_t MAXCOSTS;
32 
33 typedef struct motion
34 {
35    image_t	 *original;		/* Current image */
36    image_t	 *past;			/* Preceding image */
37    image_t	 *future;		/* Succeeding image */
38    frame_type_e	  frame_type;		/* frame type: B_, P_ I_FRAME */
39    unsigned	  number;		/* display number of frame */
40    real_t        *xbits;		/* # bits for mv x-component */
41    real_t        *ybits;		/* # bits for mv y-component */
42    real_t       **mc_forward_norms; 	/* norms of mcpe */
43    real_t       **mc_backward_norms; 	/* norms of mcpe */
44 } motion_t;
45 
46 typedef struct range
47 /*
48  *  Information about current range in the original image.
49  *  Approximation data (error, encoding bits, approximation type and factors
50  *  of the linear combination) are also saved.
51  */
52 {
53    unsigned global_address;             /* We need absolute image addresses
54 				           for distance calculations. */
55    unsigned x, y;			/* Coordinates of upper left corner */
56    unsigned image;			/* Position in the tree */
57    unsigned address;			/* Address of the pixel data */
58    unsigned level;			/* Level of the range */
59    real_t   weight [MAXEDGES + 1];	/* coeff. of the approximation */
60    word_t   into [MAXEDGES + 1];	/* used domains of the approximation */
61    int	    tree;			/* == domain : range is approximated
62 					   with new state 'domain'
63 					   == RANGE  :
64 					   with a linear comb. */
65    real_t   err;			/* approximation error */
66    real_t   tree_bits;			/* # bits to encode tree */
67    real_t   matrix_bits;		/* # bits to encode matrices */
68    real_t   weights_bits;		/* # bits to encode weights */
69    mv_t	    mv;				/* motion vector */
70    real_t   mv_tree_bits;		/* # bits to encode mv tree */
71    real_t   mv_coord_bits;		/* # bits to encode mv coordinates */
72    real_t   nd_tree_bits;		/* # bits to encode nd tree */
73    real_t   nd_weights_bits;		/* # bits to encode nd factors */
74    bool_t   prediction;			/* range is predicted? */
75 } range_t;
76 
77 typedef struct coding
78 /*
79  *  All parameters and variables that must be accessible through the coding
80  *  process.
81  */
82 {
83    real_t     	   price;		/* determines quality of approx. */
84    real_t   	 **images_of_state;	/* image of state i at level
85 					   0, ... , imageslevel */
86    real_t   *(*ip_states_state)[MAXLEVEL]; /* inner products between state i
87 					      and states 0, ... , i
88 					      at all image levels */
89    real_t   	 **ip_images_state;	/* inner products between all
90 					   ranges and state i */
91    real_t    	  *pixels;		/* current image pixels stored in tree
92 					   order (only leaves are stored) */
93    unsigned   	   products_level;	/* inner products are stored up to
94 					   this level */
95    tiling_t   	  *tiling;		/* tiling of the entire image */
96    tree_t     	   tree;		/* probability model */
97    tree_t     	   p_tree;		/* prediction probability model */
98    motion_t   	  *mt;			/* motion compensation information */
99    coeff_t   	  *coeff;
100    coeff_t   	  *d_coeff;
101    domain_pool_t  *domain_pool;
102    domain_pool_t  *d_domain_pool;
103    c_options_t     options;		/* global options */
104 } coding_t;
105 
106 #endif /* not _CWFA_H */
107 
108