]> git.sesse.net Git - ffmpeg/blob - libavcodec/cfhd.h
avcodec/cfhd: remove some unused or only write items
[ffmpeg] / libavcodec / cfhd.h
1 /*
2  * Copyright (c) 2015 Kieran Kunhya
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #ifndef AVCODEC_CFHD_H
22 #define AVCODEC_CFHD_H
23
24 #include <stdint.h>
25
26 #include "libavutil/avassert.h"
27
28 #include "avcodec.h"
29 #include "bytestream.h"
30 #include "get_bits.h"
31 #include "vlc.h"
32
33 enum CFHDParam {
34     SampleType       =   1,
35     SampleIndexTable =   2,
36     BitstreamMarker  =   4,
37     TransformType    =  10,
38     NumFrames        =  11,
39     ChannelCount     =  12,
40     WaveletCount     =  13,
41     SubbandCount     =  14,
42     NumSpatial       =  15,
43     FirstWavelet     =  16,
44     GroupTrailer     =  18,
45     ImageWidth       =  20,
46     ImageHeight      =  21,
47     LowpassSubband   =  25,
48     NumLevels        =  26,
49     LowpassWidth     =  27,
50     LowpassHeight    =  28,
51     PixelOffset      =  33,
52     LowpassQuantization=34,
53     LowpassPrecision =  35,
54     WaveletType      =  37,
55     WaveletNumber    =  38,
56     WaveletLevel     =  39,
57     NumBands         =  40,
58     HighpassWidth    =  41,
59     HighpassHeight   =  42,
60     LowpassBorder    =  43,
61     HighpassBorder   =  44,
62     LowpassScale     =  45,
63     LowpassDivisor   =  46,
64     SubbandNumber    =  48,
65     BandWidth        =  49,
66     BandHeight       =  50,
67     SubbandBand      =  51,
68     BandEncoding     =  52,
69     Quantization     =  53,
70     BandScale        =  54,
71     BandHeader       =  55,
72     BandTrailer      =  56,
73     ChannelNumber    =  62,
74     SampleFlags      =  68,
75     FrameNumber      =  69,
76     Precision        =  70,
77     InputFormat      =  71,
78     BandCodingFlags  =  72,
79     PrescaleTable    =  83,
80     EncodedFormat    =  84,
81     BitsPerComponent = 101,
82     ChannelWidth     = 104,
83     ChannelHeight    = 105,
84     PrescaleShift    = 109,
85 };
86
87 #define VLC_BITS       9
88 #define SUBBAND_COUNT 10
89
90 typedef struct CFHD_RL_VLC_ELEM {
91     int16_t level;
92     int8_t len;
93     uint16_t run;
94 } CFHD_RL_VLC_ELEM;
95
96 #define DWT_LEVELS 3
97
98 typedef struct SubBand {
99     ptrdiff_t stride;
100     int a_width;
101     int width;
102     int a_height;
103     int height;
104 } SubBand;
105
106 typedef struct Plane {
107     int width;
108     int height;
109     ptrdiff_t stride;
110
111     int16_t *idwt_buf;
112     int16_t *idwt_tmp;
113
114     /* TODO: merge this into SubBand structure */
115     int16_t *subband[SUBBAND_COUNT];
116     int16_t *l_h[8];
117
118     SubBand band[DWT_LEVELS][4];
119 } Plane;
120
121 typedef struct Peak {
122     int level;
123     int offset;
124     GetByteContext base;
125 } Peak;
126
127 typedef struct CFHDContext {
128     AVCodecContext *avctx;
129
130     CFHD_RL_VLC_ELEM table_9_rl_vlc[2088];
131     VLC vlc_9;
132
133     CFHD_RL_VLC_ELEM table_18_rl_vlc[4572];
134     VLC vlc_18;
135
136     int lut[2][256];
137
138     GetBitContext gb;
139
140     int coded_width;
141     int coded_height;
142     int cropped_height;
143     enum AVPixelFormat coded_format;
144     int progressive;
145
146     int a_width;
147     int a_height;
148     int a_format;
149
150     int bpc; // bits per channel/component
151     int channel_cnt;
152     int subband_cnt;
153     int channel_num;
154     uint8_t lowpass_precision;
155     uint16_t quantisation;
156
157     int codebook;
158     int difference_coding;
159     int subband_num;
160     int level;
161     int subband_num_actual;
162
163     uint8_t prescale_shift[3];
164     Plane plane[4];
165     Peak peak;
166 } CFHDContext;
167
168 int ff_cfhd_init_vlcs(CFHDContext *s);
169
170 #endif /* AVCODEC_CFHD_H */