summaryrefslogtreecommitdiffstats
path: root/libavcodec/cfhd.h
blob: 67a0e4c32c5a8f761262a8b8a73f5dfc3973a02b (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * Copyright (c) 2015 Kieran Kunhya
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef AVCODEC_CFHD_H
#define AVCODEC_CFHD_H

#include <stdint.h>

#include "libavutil/avassert.h"

#include "avcodec.h"
#include "get_bits.h"

#define VLC_BITS 9
#define NB_VLC_TABLE_9 (71+3)
#define NB_VLC_TABLE_18 (263+1)

typedef struct CFHD_RL_VLC_ELEM {
    int16_t level;
    int8_t len;
    uint16_t run;
} CFHD_RL_VLC_ELEM;

#define DWT_LEVELS 3

typedef struct SubBand {
    int level;
    int orientation;
    int stride;
    int a_width;
    int width;
    int a_height;
    int height;
    int pshift;
    int quant;
    uint8_t *ibuf;
} SubBand;

typedef struct Plane {
    int width;
    int height;
    ptrdiff_t stride;

    int16_t *idwt_buf;
    int16_t *idwt_tmp;

    /* TODO: merge this into SubBand structure */
    int16_t *subband[10];
    int16_t *l_h[8];

    SubBand band[DWT_LEVELS][4];
} Plane;

typedef struct CFHDContext {
    AVCodecContext *avctx;

    CFHD_RL_VLC_ELEM table_9_rl_vlc[2088];
    VLC vlc_9;

    CFHD_RL_VLC_ELEM table_18_rl_vlc[4572];
    VLC vlc_18;

    GetBitContext gb;

    int chroma_x_shift;
    int chroma_y_shift;

    int coded_width;
    int coded_height;
    int coded_format;

    int a_width;
    int a_height;
    int a_format;

    int bpc;
    int channel_cnt;
    int subband_cnt;
    int channel_num;
    uint8_t lowpass_precision;
    uint16_t quantisation;
    int wavelet_depth;
    int pshift;

    int codebook;
    int subband_num;
    int level;
    int subband_num_actual;

    uint8_t prescale_shift[3];
    Plane plane[4];

} CFHDContext;

int ff_cfhd_init_vlcs(CFHDContext *s);

#endif /* AVCODEC_CFHD_H */
OpenPOWER on IntegriCloud