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 {
42  NumFrames = 11,
46  NumSpatial = 15,
49  FrameType = 19,
50  ImageWidth = 20,
52  FrameIndex = 23,
54  NumLevels = 26,
63  NumBands = 40,
71  BandWidth = 49,
72  BandHeight = 50,
76  BandScale = 54,
77  BandHeader = 55,
82  Precision = 70,
85  Version = 79,
89  ChannelWidth = 104,
91 };
92 
93 #define VLC_BITS 9
94 #define SUBBAND_COUNT 10
95 #define SUBBAND_COUNT_3D 17
96 
97 typedef struct CFHD_RL_VLC_ELEM {
98  int16_t level;
99  int8_t len;
100  uint16_t run;
102 
103 #define DWT_LEVELS 3
104 #define DWT_LEVELS_3D 6
105 
106 typedef struct SubBand {
107  ptrdiff_t stride;
108  int a_width;
109  int width;
110  int a_height;
111  int height;
112 } SubBand;
113 
114 typedef struct Plane {
115  int width;
116  int height;
117  ptrdiff_t stride;
118 
119  int16_t *idwt_buf;
120  int16_t *idwt_tmp;
122 
123  /* TODO: merge this into SubBand structure */
124  int16_t *subband[SUBBAND_COUNT_3D];
125  int16_t *l_h[10];
126 
128 } Plane;
129 
130 typedef struct Peak {
131  int level;
132  int offset;
134 } Peak;
135 
136 typedef struct CFHDContext {
138 
139  CFHD_RL_VLC_ELEM table_9_rl_vlc[2088];
141 
142  CFHD_RL_VLC_ELEM table_18_rl_vlc[4572];
144 
145  int lut[2][256];
146 
148 
149  int planes;
157  enum AVPixelFormat coded_format;
159 
160  int a_width;
161  int a_height;
162  int a_format;
163 
164  int bpc; // bits per channel/component
170  uint16_t quantisation;
171 
172  int codebook;
175  int level;
177 
178  uint8_t prescale_table[8];
179  Plane plane[4];
181 } CFHDContext;
182 
184 
185 #endif /* AVCODEC_CFHD_H */
int channel_cnt
Definition: cfhd.h:165
int difference_coding
Definition: cfhd.h:173
VLC vlc_18
Definition: cfhd.h:143
AVCodecContext * avctx
Definition: cfhd.h:137
Definition: cfhd.h:42
TransformType
Definition: webp.c:110
Definition: cfhd.h:85
int a_height
Definition: cfhd.h:110
int level
Definition: cfhd.h:131
Definition: cfhd.h:71
int transform_type
Definition: cfhd.h:153
int cropped_height
Definition: cfhd.h:156
int16_t * idwt_tmp
Definition: cfhd.h:120
int a_width
Definition: cfhd.h:160
ptrdiff_t stride
Definition: cfhd.h:107
int subband_num_actual
Definition: cfhd.h:176
int sample_type
Definition: cfhd.h:152
Definition: cfhd.h:82
int width
Definition: cfhd.h:109
uint8_t
int16_t * idwt_buf
Definition: cfhd.h:119
int a_format
Definition: cfhd.h:162
bitstream reader API header.
Definition: cfhd.h:106
int8_t len
Definition: cfhd.h:99
FrameType
G723.1 frame types.
Definition: g723_1.h:63
VLC vlc_9
Definition: cfhd.h:140
simple assert() macros that are a bit more flexible than ISO C assert().
Definition: cfhd.h:130
Definition: vlc.h:26
int a_width
Definition: cfhd.h:108
int16_t SampleType
Definition: ac3enc.h:70
uint16_t run
Definition: cfhd.h:100
GetByteContext base
Definition: cfhd.h:133
int subband_cnt
Definition: cfhd.h:166
uint16_t quantisation
Definition: cfhd.h:170
#define s(width, name)
Definition: cbs_vp9.c:257
int frame_type
Definition: cfhd.h:150
int channel_num
Definition: cfhd.h:168
#define DWT_LEVELS_3D
Definition: cfhd.h:104
GetBitContext gb
Definition: cfhd.h:147
CFHDParam
Definition: cfhd.h:33
Libavcodec external API header.
main external API structure.
Definition: avcodec.h:526
int codebook
Definition: cfhd.h:172
int planes
Definition: cfhd.h:149
int idwt_size
Definition: cfhd.h:121
int subband_num
Definition: cfhd.h:174
Peak peak
Definition: cfhd.h:180
int band_encoding
Definition: cfhd.h:167
int level
Definition: cfhd.h:175
Definition: cfhd.h:54
int frame_index
Definition: cfhd.h:151
int coded_width
Definition: cfhd.h:154
ptrdiff_t stride
Definition: cfhd.h:117
int bpc
Definition: cfhd.h:164
Definition: cfhd.h:76
int a_height
Definition: cfhd.h:161
#define SUBBAND_COUNT_3D
Definition: cfhd.h:95
int height
Definition: cfhd.h:111
int width
Definition: cfhd.h:115
int offset
Definition: cfhd.h:132
Definition: cfhd.h:63
int ff_cfhd_init_vlcs(CFHDContext *s)
Definition: cfhddata.c:276
int progressive
Definition: cfhd.h:158
int16_t level
Definition: cfhd.h:98
int height
Definition: cfhd.h:116
uint8_t lowpass_precision
Definition: cfhd.h:169
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
Definition: cfhd.h:114
int coded_height
Definition: cfhd.h:155