1 /*
2  *  coeff.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:50:51 $
12  *  $Author: hafner $
13  *  $Revision: 5.1 $
14  *  $State: Exp $
15  */
16 
17 #ifndef _COEFF_H
18 #define _COEFF_H
19 
20 #include "types.h"
21 #include "rpf.h"
22 #include "wfa.h"
23 
24 typedef struct coeff
25 {
26    rpf_t    *rpf;			/* reduced precision format */
27    rpf_t    *dc_rpf;			/* RPF of DC (state 0) component */
28    unsigned min_level, max_level;	/* allocate memory for [min,..,max] */
29    void	    *model;			/* generic pointer to prob. model */
30    real_t (*bits) (const real_t *used_coeff, const word_t *used_domains,
31 		   unsigned level, const struct coeff *coeff);
32    /*
33     *  Compute bit-rate of a range approximation with coefficients given by
34     *  -1 terminated list 'used_domains'.
35     */
36    void   (*update) (const real_t *used_coeff, const word_t *used_domains,
37 		       unsigned level, struct coeff *coeff);
38    /*
39     *  Update the probability model according to the chosen approximation.
40     *  (given by the -1 terminated list 'used_domains').
41     */
42    void	  (*free) (struct coeff *coeff);
43    /*
44     *  Discard the given coefficients struct.
45     */
46    void   (*model_free) (void *model);
47    /*
48     *  Free given probability model.
49     */
50    void   *(*model_duplicate) (const struct coeff *coeff, const void *model);
51    /*
52     *  Duplicate the given probability model (i.e. alloc and copy).
53     */
54 } coeff_t;
55 
56 coeff_t *
57 alloc_coeff_model (const char *coeff_model_name, rpf_t *rpf, rpf_t *dc_rpf,
58 		   unsigned min_level, unsigned max_level);
59 
60 #endif /* not _COEFF_H */
61 
62