FFmpeg
vp9shared.h
Go to the documentation of this file.
1 /*
2  * VP9 compatible video decoder
3  *
4  * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
5  * Copyright (C) 2013 Clément Bœsch <u pkh me>
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #ifndef AVCODEC_VP9SHARED_H
25 #define AVCODEC_VP9SHARED_H
26 
27 #include <stddef.h>
28 #include <stdint.h>
29 
30 #include "vp9.h"
31 #include "thread.h"
32 #include "vp56.h"
33 
35  PARTITION_NONE, // [ ] <-.
36  PARTITION_H, // [-] |
37  PARTITION_V, // [|] |
38  PARTITION_SPLIT, // [+] --'
39 };
40 
42  NEARESTMV = 10,
43  NEARMV = 11,
44  ZEROMV = 12,
45  NEWMV = 13,
46 };
47 
52 };
53 
54 typedef struct VP9mvrefPair {
55  VP56mv mv[2];
56  int8_t ref[2];
57 } VP9mvrefPair;
58 
59 typedef struct VP9Frame {
62  uint8_t *segmentation_map;
65 
68 } VP9Frame;
69 
70 enum BlockLevel {
75 };
76 
77 enum BlockSize {
92 };
93 
94 typedef struct VP9BitstreamHeader {
95  // bitstream header
96  uint8_t profile;
97  uint8_t bpp;
98  uint8_t keyframe;
99  uint8_t invisible;
100  uint8_t errorres;
101  uint8_t intraonly;
102  uint8_t resetctx;
103  uint8_t refreshrefmask;
106  uint8_t allowcompinter;
107  uint8_t refreshctx;
108  uint8_t parallelmode;
109  uint8_t framectxid;
111  uint8_t refidx[3];
112  uint8_t signbias[3];
113  uint8_t fixcompref;
114  uint8_t varcompref[2];
115  struct {
116  uint8_t level;
117  int8_t sharpness;
118  } filter;
119  struct {
120  uint8_t enabled;
121  uint8_t updated;
122  int8_t mode[2];
123  int8_t ref[4];
124  } lf_delta;
125  uint8_t yac_qi;
127  uint8_t lossless;
128 #define MAX_SEGMENT 8
129  struct {
130  uint8_t enabled;
131  uint8_t temporal;
132  uint8_t absolute_vals;
133  uint8_t update_map;
134  uint8_t prob[7];
135  uint8_t pred_prob[3];
136  struct {
137  uint8_t q_enabled;
138  uint8_t lf_enabled;
139  uint8_t ref_enabled;
140  uint8_t skip_enabled;
141  uint8_t ref_val;
142  int16_t q_val;
143  int8_t lf_val;
144  int16_t qmul[2][2];
145  uint8_t lflvl[4][2];
146  } feat[MAX_SEGMENT];
147  } segmentation;
150  struct {
152  unsigned tile_cols, tile_rows;
153  } tiling;
154 
158 
159 typedef struct VP9SharedContext {
161 
163 #define CUR_FRAME 0
164 #define REF_FRAME_MVPAIR 1
165 #define REF_FRAME_SEGMAP 2
168 
169 #endif /* AVCODEC_VP9SHARED_H */
PRED_SWITCHABLE
@ PRED_SWITCHABLE
Definition: vp9shared.h:51
PRED_SINGLEREF
@ PRED_SINGLEREF
Definition: vp9shared.h:49
BS_64x64
@ BS_64x64
Definition: vp9shared.h:78
VP9BitstreamHeader::parallelmode
uint8_t parallelmode
Definition: vp9shared.h:108
BS_64x32
@ BS_64x32
Definition: vp9shared.h:79
VP9Frame::segmentation_map
uint8_t * segmentation_map
Definition: vp9shared.h:62
VP9Frame
Definition: vp9shared.h:59
BL_16X16
@ BL_16X16
Definition: vp9shared.h:73
PRED_COMPREF
@ PRED_COMPREF
Definition: vp9shared.h:50
BlockPartition
BlockPartition
Definition: vp9shared.h:34
VP9BitstreamHeader
Definition: vp9shared.h:94
VP9BitstreamHeader::refreshrefmask
uint8_t refreshrefmask
Definition: vp9shared.h:103
BL_32X32
@ BL_32X32
Definition: vp9shared.h:72
MAX_SEGMENT
#define MAX_SEGMENT
Definition: vp9shared.h:128
VP9BitstreamHeader::q_enabled
uint8_t q_enabled
Definition: vp9shared.h:137
VP9SharedContext::refs
ThreadFrame refs[8]
Definition: vp9shared.h:162
VP9BitstreamHeader::filter
struct VP9BitstreamHeader::@180 filter
VP9BitstreamHeader::qmul
int16_t qmul[2][2]
Definition: vp9shared.h:144
VP9Frame::hwaccel_priv_buf
AVBufferRef * hwaccel_priv_buf
Definition: vp9shared.h:66
BS_4x8
@ BS_4x8
Definition: vp9shared.h:89
VP9BitstreamHeader::framectxid
uint8_t framectxid
Definition: vp9shared.h:109
NEARMV
@ NEARMV
Definition: vp9shared.h:43
thread.h
VP9BitstreamHeader::allowcompinter
uint8_t allowcompinter
Definition: vp9shared.h:106
VP9Frame::tf
ThreadFrame tf
Definition: vp9shared.h:60
VP9BitstreamHeader::compressed_header_size
int compressed_header_size
Definition: vp9shared.h:156
VP9BitstreamHeader::absolute_vals
uint8_t absolute_vals
Definition: vp9shared.h:132
VP9BitstreamHeader::uncompressed_header_size
int uncompressed_header_size
Definition: vp9shared.h:155
VP9Frame::extradata
AVBufferRef * extradata
Definition: vp9shared.h:61
VP9BitstreamHeader::tile_cols
unsigned tile_cols
Definition: vp9shared.h:152
FilterMode
FilterMode
Definition: vp9.h:64
BS_8x16
@ BS_8x16
Definition: vp9shared.h:86
VP9BitstreamHeader::feat
struct VP9BitstreamHeader::@182::@184 feat[MAX_SEGMENT]
PARTITION_NONE
@ PARTITION_NONE
Definition: vp9shared.h:35
VP9Frame::hwaccel_picture_private
void * hwaccel_picture_private
Definition: vp9shared.h:67
ZEROMV
@ ZEROMV
Definition: vp9shared.h:44
VP9BitstreamHeader::ydc_qdelta
int8_t ydc_qdelta
Definition: vp9shared.h:126
BL_8X8
@ BL_8X8
Definition: vp9shared.h:74
VP9BitstreamHeader::q_val
int16_t q_val
Definition: vp9shared.h:142
BS_32x32
@ BS_32x32
Definition: vp9shared.h:81
PARTITION_V
@ PARTITION_V
Definition: vp9shared.h:37
VP9BitstreamHeader::prob
uint8_t prob[7]
Definition: vp9shared.h:134
VP9BitstreamHeader::fixcompref
uint8_t fixcompref
Definition: vp9shared.h:113
VP9BitstreamHeader::uvdc_qdelta
int8_t uvdc_qdelta
Definition: vp9shared.h:126
VP9SharedContext
Definition: vp9shared.h:159
VP9BitstreamHeader::txfmmode
enum TxfmMode txfmmode
Definition: vp9shared.h:148
VP9BitstreamHeader::keyframe
uint8_t keyframe
Definition: vp9shared.h:98
VP9BitstreamHeader::comppredmode
enum CompPredMode comppredmode
Definition: vp9shared.h:149
VP9BitstreamHeader::ref
int8_t ref[4]
Definition: vp9shared.h:123
VP56mv
Definition: vp56.h:68
VP9BitstreamHeader::sharpness
int8_t sharpness
Definition: vp9shared.h:117
BS_8x4
@ BS_8x4
Definition: vp9shared.h:88
VP9BitstreamHeader::ref_val
uint8_t ref_val
Definition: vp9shared.h:141
VP9BitstreamHeader::log2_tile_rows
unsigned log2_tile_rows
Definition: vp9shared.h:151
VP9BitstreamHeader::skip_enabled
uint8_t skip_enabled
Definition: vp9shared.h:140
vp56.h
VP9BitstreamHeader::refreshctx
uint8_t refreshctx
Definition: vp9shared.h:107
VP9BitstreamHeader::resetctx
uint8_t resetctx
Definition: vp9shared.h:102
VP9BitstreamHeader::enabled
uint8_t enabled
Definition: vp9shared.h:120
VP9BitstreamHeader::update_map
uint8_t update_map
Definition: vp9shared.h:133
VP9BitstreamHeader::temporal
uint8_t temporal
Definition: vp9shared.h:131
VP9BitstreamHeader::lf_val
int8_t lf_val
Definition: vp9shared.h:143
VP9SharedContext::frames
VP9Frame frames[3]
Definition: vp9shared.h:166
BS_32x64
@ BS_32x64
Definition: vp9shared.h:80
VP9BitstreamHeader::yac_qi
uint8_t yac_qi
Definition: vp9shared.h:125
PARTITION_SPLIT
@ PARTITION_SPLIT
Definition: vp9shared.h:38
VP9BitstreamHeader::lflvl
uint8_t lflvl[4][2]
Definition: vp9shared.h:145
VP9BitstreamHeader::highprecisionmvs
uint8_t highprecisionmvs
Definition: vp9shared.h:104
TxfmMode
TxfmMode
Definition: vp9.h:27
vp9.h
VP9Frame::uses_2pass
int uses_2pass
Definition: vp9shared.h:64
VP9BitstreamHeader::signbias
uint8_t signbias[3]
Definition: vp9shared.h:112
VP9BitstreamHeader::lf_enabled
uint8_t lf_enabled
Definition: vp9shared.h:138
VP9BitstreamHeader::lossless
uint8_t lossless
Definition: vp9shared.h:127
VP9BitstreamHeader::level
uint8_t level
Definition: vp9shared.h:116
BS_8x8
@ BS_8x8
Definition: vp9shared.h:87
VP9BitstreamHeader::filtermode
enum FilterMode filtermode
Definition: vp9shared.h:105
N_BS_SIZES
@ N_BS_SIZES
Definition: vp9shared.h:91
VP9BitstreamHeader::ref_enabled
uint8_t ref_enabled
Definition: vp9shared.h:139
BS_4x4
@ BS_4x4
Definition: vp9shared.h:90
VP9BitstreamHeader::lf_delta
struct VP9BitstreamHeader::@181 lf_delta
VP9BitstreamHeader::varcompref
uint8_t varcompref[2]
Definition: vp9shared.h:114
BS_16x32
@ BS_16x32
Definition: vp9shared.h:83
BlockSize
BlockSize
Definition: vp9shared.h:77
VP9BitstreamHeader::tiling
struct VP9BitstreamHeader::@183 tiling
VP9BitstreamHeader::tile_rows
unsigned tile_rows
Definition: vp9shared.h:152
BL_64X64
@ BL_64X64
Definition: vp9shared.h:71
VP9BitstreamHeader::uvac_qdelta
int8_t uvac_qdelta
Definition: vp9shared.h:126
VP9mvrefPair
Definition: vp9shared.h:54
VP9mvrefPair::mv
VP56mv mv[2]
Definition: vp9shared.h:55
NEWMV
@ NEWMV
Definition: vp9shared.h:45
BS_16x16
@ BS_16x16
Definition: vp9shared.h:84
VP9BitstreamHeader::profile
uint8_t profile
Definition: vp9shared.h:96
ThreadFrame
Definition: thread.h:34
BS_16x8
@ BS_16x8
Definition: vp9shared.h:85
CompPredMode
CompPredMode
Definition: vp9shared.h:48
mode
mode
Definition: ebur128.h:83
VP9SharedContext::h
VP9BitstreamHeader h
Definition: vp9shared.h:160
VP9Frame::mv
VP9mvrefPair * mv
Definition: vp9shared.h:63
VP9BitstreamHeader::updated
uint8_t updated
Definition: vp9shared.h:121
NEARESTMV
@ NEARESTMV
Definition: vp9shared.h:42
BlockLevel
BlockLevel
Definition: vp9shared.h:70
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
VP9BitstreamHeader::errorres
uint8_t errorres
Definition: vp9shared.h:100
InterPredMode
InterPredMode
Definition: vp9shared.h:41
VP9BitstreamHeader::invisible
uint8_t invisible
Definition: vp9shared.h:99
BS_32x16
@ BS_32x16
Definition: vp9shared.h:82
PARTITION_H
@ PARTITION_H
Definition: vp9shared.h:36
VP9BitstreamHeader::refidx
uint8_t refidx[3]
Definition: vp9shared.h:111
VP9BitstreamHeader::log2_tile_cols
unsigned log2_tile_cols
Definition: vp9shared.h:151
VP9BitstreamHeader::bpp
uint8_t bpp
Definition: vp9shared.h:97
VP9mvrefPair::ref
int8_t ref[2]
Definition: vp9shared.h:56
VP9BitstreamHeader::use_last_frame_mvs
uint8_t use_last_frame_mvs
Definition: vp9shared.h:110
VP9BitstreamHeader::pred_prob
uint8_t pred_prob[3]
Definition: vp9shared.h:135
VP9BitstreamHeader::segmentation
struct VP9BitstreamHeader::@182 segmentation
VP9BitstreamHeader::intraonly
uint8_t intraonly
Definition: vp9shared.h:101