summaryrefslogtreecommitdiff
path: root/ext/tarkin/wavelet.h
blob: 13d84e8b5bb939bb0c5f23de2617d9d84aea28fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef __WAVELET_H
#define __WAVELET_H

#include <stdint.h>


typedef struct
{
  TYPE *data;
  uint32_t width;
  uint32_t height;
  uint32_t frames;
  uint32_t scales;
  uint32_t *w;
  uint32_t *h;
  uint32_t *f;
    uint32_t (*offset)[8];
  TYPE *scratchbuf;
} Wavelet3DBuf;


extern Wavelet3DBuf *wavelet_3d_buf_new (uint32_t width, uint32_t height,
    uint32_t frames);

extern void wavelet_3d_buf_destroy (Wavelet3DBuf * buf);

/**
 *  transform buf->data
 *  a_moments is the number of vanishing moments of the analyzing
 *  highpass filter,
 *  s_moments the one of the synthesizing lowpass filter.
 */
extern void wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf,
    int a_moments, int s_moments);
extern void wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf,
    int a_moments, int s_moments);

extern int wavelet_3d_buf_encode_coeff (const Wavelet3DBuf * buf,
    uint8_t * bitstream, uint32_t limit);

extern void wavelet_3d_buf_decode_coeff (Wavelet3DBuf * buf,
    uint8_t * bitstream, uint32_t limit);

#if defined(DBG_XFORM)
extern void wavelet_3d_buf_dump (char *fmt,
    uint32_t first_frame_in_buf,
    uint32_t id, Wavelet3DBuf * buf, int16_t offset);
#else
#define wavelet_3d_buf_dump(x...)
#endif

#endif