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 #define VLC_BITS 9
34 #define SUBBAND_COUNT 10
35 
36 typedef struct CFHD_RL_VLC_ELEM {
37  int16_t level;
38  int8_t len;
39  uint16_t run;
41 
42 #define DWT_LEVELS 3
43 
44 typedef struct SubBand {
45  int level;
47  ptrdiff_t stride;
48  int a_width;
49  int width;
50  int a_height;
51  int height;
52  int pshift;
53  int quant;
55 } SubBand;
56 
57 typedef struct Plane {
58  int width;
59  int height;
60  ptrdiff_t stride;
61 
62  int16_t *idwt_buf;
63  int16_t *idwt_tmp;
64 
65  /* TODO: merge this into SubBand structure */
67  int16_t *l_h[8];
68 
70 } Plane;
71 
72 typedef struct Peak {
73  int level;
74  int offset;
76 } Peak;
77 
78 typedef struct CFHDContext {
80 
83 
86 
88 
94 
95  int a_width;
96  int a_height;
97  int a_format;
98 
99  int bpc; // bits per channel/component
104  uint16_t quantisation;
106  int pshift;
107 
108  int codebook;
111  int level;
113 
117 } CFHDContext;
118 
120 
121 #endif /* AVCODEC_CFHD_H */
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
CFHDContext::channel_cnt
int channel_cnt
Definition: cfhd.h:100
Peak::level
int level
Definition: cfhd.h:73
GetByteContext
Definition: bytestream.h:33
CFHDContext::progressive
int progressive
Definition: cfhd.h:93
CFHDContext::lowpass_precision
uint8_t lowpass_precision
Definition: cfhd.h:103
CFHDContext::table_9_rl_vlc
CFHD_RL_VLC_ELEM table_9_rl_vlc[2088]
Definition: cfhd.h:81
CFHDContext::subband_cnt
int subband_cnt
Definition: cfhd.h:101
CFHDContext::prescale_shift
uint8_t prescale_shift[3]
Definition: cfhd.h:114
SubBand::width
int width
Definition: cfhd.h:49
SubBand::level
int level
Definition: cfhd.h:45
CFHDContext::a_format
int a_format
Definition: cfhd.h:97
CFHDContext::bpc
int bpc
Definition: cfhd.h:99
ff_cfhd_init_vlcs
int ff_cfhd_init_vlcs(CFHDContext *s)
Definition: cfhddata.c:276
CFHDContext::quantisation
uint16_t quantisation
Definition: cfhd.h:104
CFHDContext::channel_num
int channel_num
Definition: cfhd.h:102
CFHDContext::wavelet_depth
int wavelet_depth
Definition: cfhd.h:105
CFHDContext::level
int level
Definition: cfhd.h:111
Plane::l_h
int16_t * l_h[8]
Definition: cfhd.h:67
GetBitContext
Definition: get_bits.h:61
Plane::band
SubBand band[DWT_LEVELS][4]
Definition: cfhd.h:69
DWT_LEVELS
#define DWT_LEVELS
Definition: cfhd.h:42
Plane::idwt_tmp
int16_t * idwt_tmp
Definition: cfhd.h:63
avassert.h
CFHDContext::peak
Peak peak
Definition: cfhd.h:116
s
#define s(width, name)
Definition: cbs_vp9.c:257
CFHDContext::codebook
int codebook
Definition: cfhd.h:108
get_bits.h
SubBand::ibuf
uint8_t * ibuf
Definition: cfhd.h:54
CFHDContext::subband_num
int subband_num
Definition: cfhd.h:110
Peak
Definition: cfhd.h:72
CFHD_RL_VLC_ELEM
Definition: cfhd.h:36
Plane::subband
int16_t * subband[SUBBAND_COUNT]
Definition: cfhd.h:66
CFHDContext::avctx
AVCodecContext * avctx
Definition: cfhd.h:79
SUBBAND_COUNT
#define SUBBAND_COUNT
Definition: cfhd.h:34
Peak::base
GetByteContext base
Definition: cfhd.h:75
SubBand::stride
ptrdiff_t stride
Definition: cfhd.h:47
Plane::height
int height
Definition: cfhd.h:59
CFHD_RL_VLC_ELEM::level
int16_t level
Definition: cfhd.h:37
CFHDContext::pshift
int pshift
Definition: cfhd.h:106
CFHDContext::gb
GetBitContext gb
Definition: cfhd.h:87
SubBand
Definition: cfhd.h:44
CFHDContext::a_width
int a_width
Definition: cfhd.h:95
Plane::width
int width
Definition: cfhd.h:58
CFHDContext::coded_height
int coded_height
Definition: cfhd.h:90
CFHDContext::difference_coding
int difference_coding
Definition: cfhd.h:109
Plane::stride
ptrdiff_t stride
Definition: cfhd.h:60
CFHDContext::coded_format
enum AVPixelFormat coded_format
Definition: cfhd.h:92
CFHDContext::plane
Plane plane[4]
Definition: cfhd.h:115
CFHDContext
Definition: cfhd.h:78
CFHDContext::vlc_9
VLC vlc_9
Definition: cfhd.h:82
uint8_t
uint8_t
Definition: audio_convert.c:194
CFHDContext::cropped_height
int cropped_height
Definition: cfhd.h:91
avcodec.h
CFHDContext::coded_width
int coded_width
Definition: cfhd.h:89
SubBand::pshift
int pshift
Definition: cfhd.h:52
SubBand::quant
int quant
Definition: cfhd.h:53
CFHDContext::vlc_18
VLC vlc_18
Definition: cfhd.h:85
AVCodecContext
main external API structure.
Definition: avcodec.h:1565
VLC
Definition: vlc.h:26
Plane
Definition: cfhd.h:57
Plane::idwt_buf
int16_t * idwt_buf
Definition: cfhd.h:62
CFHDContext::subband_num_actual
int subband_num_actual
Definition: cfhd.h:112
vlc.h
bytestream.h
CFHD_RL_VLC_ELEM::run
uint16_t run
Definition: cfhd.h:39
CFHDContext::table_18_rl_vlc
CFHD_RL_VLC_ELEM table_18_rl_vlc[4572]
Definition: cfhd.h:84
Peak::offset
int offset
Definition: cfhd.h:74
SubBand::a_height
int a_height
Definition: cfhd.h:50
SubBand::a_width
int a_width
Definition: cfhd.h:48
CFHDContext::a_height
int a_height
Definition: cfhd.h:96
SubBand::height
int height
Definition: cfhd.h:51
SubBand::orientation
int orientation
Definition: cfhd.h:46
CFHD_RL_VLC_ELEM::len
int8_t len
Definition: cfhd.h:38