/* This file was generated by scramble.py. */
#ifndef _PCODE_HEADER_GUARD_WAVELETS_WPTREE_
#define _PCODE_HEADER_GUARD_WAVELETS_WPTREE_
typedef struct Wavelet Wavelet;
typedef struct WPNode WPNode;
#include "config.h"
#include "image.h"
#include "random.h"
struct Wavelet
{
    /* Interface for a wavelet transform. */
    char *name;
    /* Method to transform a one-dimensional signal. */
    void (*transform)(V const *indata, int n, int instep, V *outlow, int lowstep, V *outhigh, int highstep, char const *key);
    /* For parameterized transform */
    char *key;
};
struct WPNode
{
    /* 
     * One node in a wavelet packets tree. Each node can use a different wavelet
     * transform. */
    WPNode *parent;
    /* The order for the children is: */
    /* _____________ */
    /* | 0 LL | 1 HL | */
    /* |______|______| */
    /* | 2 LH | 3 HH | */
    /* |______|______| */
    /*  */
    /* A leaf has no children. */
    /* in this case, child is ignored */
    bool is_leaf;
    /* in this case, only child[0, 1] are valid */
    bool is_1d;
    WPNode *child[4];
    Wavelet *hwavelet, *vwavelet;
    /* For leafs, level means: */
    /* 0 - the leaf is the original, untransformed image */
    /* 1 - the leaf is the result of 1 decomposition (4 possible subbands) */
    /* and so on.. */
    int level;
    int x, y, w, h;
};
WPNode * wptree_create_pyramidal_tree_with_callback(int max_level, int w, int h, bool is_1d, Wavelet *(*callback)(int level, bool vertical, void *data), void *data);
WPNode * wptree_create_pyramidal_tree(Wavelet *wavelet, int max_level, int w, int h, bool is_1d);
WPNode * wptree_create_random_tree_with_callback(int w, int h, int min_ll_depth, int max_ll_depth, int max_depth, double base_value, double change_factor, bool is_1d, Wavelet *(*callback)(int level, bool vertical, void *data), void *data);
WPNode * wptree_create_random_tree(Wavelet *wavelet, int w, int h, int min_ll_depth, int max_ll_depth, int max_depth, double base_value, double change_factor, bool is_1d);
void wptree_plot(WPNode *root, char const *filename);
Image * wptree_transform(WPNode *root, Image *v);
int wptree_count_leafs(WPNode *root);
WPNode * _select_leaf(WPNode *root, int n, int *c);
WPNode * wptree_select_leaf(WPNode *root, int n);
#endif
/* This file was generated by scramble.py. */
