FFmpeg  4.4.7
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 #include "cfhddsp.h"
33 
34 enum CFHDParam {
43  NumFrames = 11,
47  NumSpatial = 15,
50  FrameType = 19,
51  ImageWidth = 20,
53  FrameIndex = 23,
55  NumLevels = 26,
64  NumBands = 40,
72  BandWidth = 49,
73  BandHeight = 50,
77  BandScale = 54,
78  BandHeader = 55,
83  Precision = 70,
86  PeakLevel = 74,
89  Version = 79,
94  ChannelWidth = 104,
96 };
97 
99  LowPassSegment = 0x1a4a,
101  HighPassSegment = 0x0d0d,
102  BandSegment = 0x0e0e,
105 };
106 
107 #define VLC_BITS 9
108 #define SUBBAND_COUNT 10
109 #define SUBBAND_COUNT_3D 17
110 
111 typedef struct CFHD_RL_VLC_ELEM {
112  int16_t level;
113  int8_t len;
114  uint16_t run;
116 
117 #define DWT_LEVELS 3
118 #define DWT_LEVELS_3D 6
119 
120 typedef struct SubBand {
121  ptrdiff_t stride;
122  int a_width;
123  int width;
124  int a_height;
125  int height;
126  int8_t read_ok;
127 } SubBand;
128 
129 typedef struct Plane {
130  int width;
131  int height;
132  ptrdiff_t stride;
133 
134  int16_t *idwt_buf;
135  int16_t *idwt_tmp;
137 
138  /* TODO: merge this into SubBand structure */
140  int16_t *l_h[10];
141 
143 } Plane;
144 
145 typedef struct Peak {
146  int level;
147  int offset;
149 } Peak;
150 
151 typedef struct CFHDContext {
153 
156 
159 
160  int lut[2][256];
161 
163 
164  int planes;
174 
175  int a_width;
176  int a_height;
177  int a_format;
179 
180  int bpc; // bits per channel/component
186  uint16_t quantisation;
187 
188  int codebook;
191  int level;
193 
197 
199 } CFHDContext;
200 
202 
203 #endif /* AVCODEC_CFHD_H */
int32_t SampleType
Definition: ac3enc.h:63
uint8_t
simple assert() macros that are a bit more flexible than ISO C assert().
Libavcodec external API header.
#define s(width, name)
Definition: cbs_vp9.c:257
CFHDSegment
Definition: cfhd.h:98
@ CoefficientSegment
Definition: cfhd.h:104
@ HighPassSegment
Definition: cfhd.h:101
@ LowPassSegment
Definition: cfhd.h:99
@ HighPassEndSegment
Definition: cfhd.h:103
@ BandSegment
Definition: cfhd.h:102
@ LowPassEndSegment
Definition: cfhd.h:100
int ff_cfhd_init_vlcs(CFHDContext *s)
Definition: cfhddata.c:276
CFHDParam
Definition: cfhd.h:34
@ Quantization
Definition: cfhd.h:76
@ FrameNumber
Definition: cfhd.h:82
@ SampleFlags
Definition: cfhd.h:81
@ BandHeight
Definition: cfhd.h:73
@ NumSpatial
Definition: cfhd.h:47
@ NumLevels
Definition: cfhd.h:55
@ HighpassWidth
Definition: cfhd.h:65
@ SampleIndexTable
Definition: cfhd.h:36
@ VersionMajor
Definition: cfhd.h:38
@ FirstWavelet
Definition: cfhd.h:48
@ EncodedFormat
Definition: cfhd.h:92
@ BandWidth
Definition: cfhd.h:72
@ PeakOffsetLow
Definition: cfhd.h:87
@ LowpassHeight
Definition: cfhd.h:57
@ WaveletCount
Definition: cfhd.h:45
@ BandSecondPass
Definition: cfhd.h:90
@ LowpassPrecision
Definition: cfhd.h:60
@ SubbandNumber
Definition: cfhd.h:71
@ BandHeader
Definition: cfhd.h:78
@ BitstreamMarker
Definition: cfhd.h:37
@ LowpassScale
Definition: cfhd.h:69
@ PeakLevel
Definition: cfhd.h:86
@ PrescaleTable
Definition: cfhd.h:91
@ HighpassHeight
Definition: cfhd.h:66
@ BandTrailer
Definition: cfhd.h:79
@ LowpassSubband
Definition: cfhd.h:54
@ PixelOffset
Definition: cfhd.h:58
@ VersionEdit
Definition: cfhd.h:41
@ BandScale
Definition: cfhd.h:77
@ ImageWidth
Definition: cfhd.h:51
@ LowpassWidth
Definition: cfhd.h:56
@ BandEncoding
Definition: cfhd.h:75
@ LowpassBorder
Definition: cfhd.h:67
@ DisplayHeight
Definition: cfhd.h:93
@ NumFrames
Definition: cfhd.h:43
@ PeakOffsetHigh
Definition: cfhd.h:88
@ WaveletType
Definition: cfhd.h:61
@ WaveletNumber
Definition: cfhd.h:62
@ BandCodingFlags
Definition: cfhd.h:85
@ HighpassBorder
Definition: cfhd.h:68
@ Version
Definition: cfhd.h:89
@ Precision
Definition: cfhd.h:83
@ GroupTrailer
Definition: cfhd.h:49
@ VersionRevision
Definition: cfhd.h:40
@ ChannelCount
Definition: cfhd.h:44
@ NumBands
Definition: cfhd.h:64
@ LowpassDivisor
Definition: cfhd.h:70
@ ChannelWidth
Definition: cfhd.h:94
@ ChannelHeight
Definition: cfhd.h:95
@ ImageHeight
Definition: cfhd.h:52
@ SubbandBand
Definition: cfhd.h:74
@ ChannelNumber
Definition: cfhd.h:80
@ VersionMinor
Definition: cfhd.h:39
@ SubbandCount
Definition: cfhd.h:46
@ InputFormat
Definition: cfhd.h:84
@ FrameIndex
Definition: cfhd.h:53
@ LowpassQuantization
Definition: cfhd.h:59
@ WaveletLevel
Definition: cfhd.h:63
#define DWT_LEVELS_3D
Definition: cfhd.h:118
#define SUBBAND_COUNT_3D
Definition: cfhd.h:109
FrameType
G723.1 frame types.
Definition: g723_1.h:63
bitstream reader API header.
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
main external API structure.
Definition: avcodec.h:536
uint8_t prescale_table[8]
Definition: cfhd.h:194
int frame_index
Definition: cfhd.h:166
enum AVPixelFormat coded_format
Definition: cfhd.h:172
int cropped_height
Definition: cfhd.h:171
int channel_cnt
Definition: cfhd.h:181
int channel_num
Definition: cfhd.h:184
int a_format
Definition: cfhd.h:177
Plane plane[4]
Definition: cfhd.h:195
int bpc
Definition: cfhd.h:180
int coded_width
Definition: cfhd.h:169
int codebook
Definition: cfhd.h:188
int subband_cnt
Definition: cfhd.h:182
VLC vlc_9
Definition: cfhd.h:155
int planes
Definition: cfhd.h:164
int a_transform_type
Definition: cfhd.h:178
int progressive
Definition: cfhd.h:173
int transform_type
Definition: cfhd.h:168
VLC vlc_18
Definition: cfhd.h:158
Peak peak
Definition: cfhd.h:196
int frame_type
Definition: cfhd.h:165
int a_height
Definition: cfhd.h:176
int subband_num_actual
Definition: cfhd.h:192
GetBitContext gb
Definition: cfhd.h:162
int band_encoding
Definition: cfhd.h:183
int subband_num
Definition: cfhd.h:190
uint16_t quantisation
Definition: cfhd.h:186
int a_width
Definition: cfhd.h:175
int sample_type
Definition: cfhd.h:167
int lut[2][256]
Definition: cfhd.h:160
int difference_coding
Definition: cfhd.h:189
uint8_t lowpass_precision
Definition: cfhd.h:185
int level
Definition: cfhd.h:191
CFHD_RL_VLC_ELEM table_18_rl_vlc[4572]
Definition: cfhd.h:157
CFHDDSPContext dsp
Definition: cfhd.h:198
CFHD_RL_VLC_ELEM table_9_rl_vlc[2088]
Definition: cfhd.h:154
int coded_height
Definition: cfhd.h:170
AVCodecContext * avctx
Definition: cfhd.h:152
uint16_t run
Definition: cfhd.h:114
int8_t len
Definition: cfhd.h:113
int16_t level
Definition: cfhd.h:112
Definition: cfhd.h:145
GetByteContext base
Definition: cfhd.h:148
int offset
Definition: cfhd.h:147
int level
Definition: cfhd.h:146
Definition: cfhd.h:129
int idwt_size
Definition: cfhd.h:136
SubBand band[DWT_LEVELS_3D][4]
Definition: cfhd.h:142
int16_t * subband[SUBBAND_COUNT_3D]
Definition: cfhd.h:139
ptrdiff_t stride
Definition: cfhd.h:132
int width
Definition: cfhd.h:130
int height
Definition: cfhd.h:131
int16_t * idwt_buf
Definition: cfhd.h:134
int16_t * l_h[10]
Definition: cfhd.h:140
int16_t * idwt_tmp
Definition: cfhd.h:135
Definition: cfhd.h:120
ptrdiff_t stride
Definition: cfhd.h:121
int a_height
Definition: cfhd.h:124
int8_t read_ok
Definition: cfhd.h:126
int width
Definition: cfhd.h:123
int a_width
Definition: cfhd.h:122
int height
Definition: cfhd.h:125
Definition: vlc.h:26
TransformType
Definition: webp.c:110