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