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