FFmpeg
cfhd.h
Go to the documentation of this file.
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 {
38  NumFrames = 11,
42  NumSpatial = 15,
45  ImageWidth = 20,
48  NumLevels = 26,
57  NumBands = 40,
65  BandWidth = 49,
66  BandHeight = 50,
70  BandScale = 54,
71  BandHeader = 55,
75  Precision = 70,
81  ChannelWidth = 104,
84 };
85 
86 #define VLC_BITS 9
87 #define SUBBAND_COUNT 10
88 
89 typedef struct CFHD_RL_VLC_ELEM {
90  int16_t level;
91  int8_t len;
92  uint16_t run;
94 
95 #define DWT_LEVELS 3
96 
97 typedef struct SubBand {
98  int level;
100  ptrdiff_t stride;
101  int a_width;
102  int width;
103  int a_height;
104  int height;
105  int pshift;
106  int quant;
108 } SubBand;
109 
110 typedef struct Plane {
111  int width;
112  int height;
113  ptrdiff_t stride;
114 
115  int16_t *idwt_buf;
116  int16_t *idwt_tmp;
117 
118  /* TODO: merge this into SubBand structure */
119  int16_t *subband[SUBBAND_COUNT];
120  int16_t *l_h[8];
121 
122  SubBand band[DWT_LEVELS][4];
123 } Plane;
124 
125 typedef struct Peak {
126  int level;
127  int offset;
129 } Peak;
130 
131 typedef struct CFHDContext {
133 
134  CFHD_RL_VLC_ELEM table_9_rl_vlc[2088];
136 
137  CFHD_RL_VLC_ELEM table_18_rl_vlc[4572];
139 
140  int lut[2][256];
141 
143 
147  enum AVPixelFormat coded_format;
149 
150  int a_width;
151  int a_height;
152  int a_format;
153 
154  int bpc; // bits per channel/component
159  uint16_t quantisation;
161  int pshift;
162 
163  int codebook;
166  int level;
168 
169  uint8_t prescale_shift[3];
170  Plane plane[4];
172 } CFHDContext;
173 
175 
176 #endif /* AVCODEC_CFHD_H */
int quant
Definition: cfhd.h:106
int channel_cnt
Definition: cfhd.h:155
int difference_coding
Definition: cfhd.h:164
VLC vlc_18
Definition: cfhd.h:138
AVCodecContext * avctx
Definition: cfhd.h:132
Definition: cfhd.h:38
TransformType
Definition: webp.c:110
int a_height
Definition: cfhd.h:103
int level
Definition: cfhd.h:126
Definition: cfhd.h:65
int cropped_height
Definition: cfhd.h:146
int16_t * idwt_tmp
Definition: cfhd.h:116
int a_width
Definition: cfhd.h:150
ptrdiff_t stride
Definition: cfhd.h:100
int subband_num_actual
Definition: cfhd.h:167
Definition: cfhd.h:75
int width
Definition: cfhd.h:102
uint8_t
int16_t * idwt_buf
Definition: cfhd.h:115
int a_format
Definition: cfhd.h:152
bitstream reader API header.
#define SUBBAND_COUNT
Definition: cfhd.h:87
Definition: cfhd.h:97
int8_t len
Definition: cfhd.h:91
VLC vlc_9
Definition: cfhd.h:135
#define DWT_LEVELS
Definition: cfhd.h:95
simple assert() macros that are a bit more flexible than ISO C assert().
Definition: cfhd.h:125
Definition: vlc.h:26
int a_width
Definition: cfhd.h:101
int orientation
Definition: cfhd.h:99
int16_t SampleType
Definition: ac3enc.h:70
uint16_t run
Definition: cfhd.h:92
GetByteContext base
Definition: cfhd.h:128
uint8_t * ibuf
Definition: cfhd.h:107
int subband_cnt
Definition: cfhd.h:156
uint16_t quantisation
Definition: cfhd.h:159
#define s(width, name)
Definition: cbs_vp9.c:257
int channel_num
Definition: cfhd.h:157
GetBitContext gb
Definition: cfhd.h:142
int wavelet_depth
Definition: cfhd.h:160
CFHDParam
Definition: cfhd.h:33
Libavcodec external API header.
main external API structure.
Definition: avcodec.h:526
int codebook
Definition: cfhd.h:163
int subband_num
Definition: cfhd.h:165
int pshift
Definition: cfhd.h:161
Peak peak
Definition: cfhd.h:171
int level
Definition: cfhd.h:166
Definition: cfhd.h:48
int pshift
Definition: cfhd.h:105
int coded_width
Definition: cfhd.h:144
ptrdiff_t stride
Definition: cfhd.h:113
int bpc
Definition: cfhd.h:154
Definition: cfhd.h:70
int a_height
Definition: cfhd.h:151
int height
Definition: cfhd.h:104
int width
Definition: cfhd.h:111
int offset
Definition: cfhd.h:127
Definition: cfhd.h:57
int ff_cfhd_init_vlcs(CFHDContext *s)
Definition: cfhddata.c:276
int progressive
Definition: cfhd.h:148
int16_t level
Definition: cfhd.h:90
int height
Definition: cfhd.h:112
uint8_t lowpass_precision
Definition: cfhd.h:158
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
Definition: cfhd.h:110
int level
Definition: cfhd.h:98
int coded_height
Definition: cfhd.h:145