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 "libavutil/mem_internal.h"
31 
32 #include "vp9.h"
33 #include "threadframe.h"
34 
36  PARTITION_NONE, // [ ] <-.
37  PARTITION_H, // [-] |
38  PARTITION_V, // [|] |
39  PARTITION_SPLIT, // [+] --'
40 };
41 
43  NEARESTMV = 10,
44  NEARMV = 11,
45  ZEROMV = 12,
46  NEWMV = 13,
47 };
48 
53 };
54 
55 typedef struct VP9mv {
56  DECLARE_ALIGNED(4, int16_t, x);
57  int16_t y;
58 } VP9mv;
59 
60 typedef struct VP9mvrefPair {
61  VP9mv mv[2];
62  int8_t ref[2];
63 } VP9mvrefPair;
64 
65 typedef struct VP9Frame {
68  uint8_t *segmentation_map;
71 
74 } VP9Frame;
75 
76 enum BlockLevel {
81 };
82 
83 enum BlockSize {
98 };
99 
100 typedef struct VP9BitstreamHeader {
101  // bitstream header
102  uint8_t profile;
103  uint8_t bpp;
104  uint8_t keyframe;
105  uint8_t invisible;
106  uint8_t errorres;
107  uint8_t intraonly;
108  uint8_t resetctx;
109  uint8_t refreshrefmask;
112  uint8_t allowcompinter;
113  uint8_t refreshctx;
114  uint8_t parallelmode;
115  uint8_t framectxid;
117  uint8_t refidx[3];
118  uint8_t signbias[3];
119  uint8_t fixcompref;
120  uint8_t varcompref[2];
121  struct {
122  uint8_t level;
123  int8_t sharpness;
124  } filter;
125  struct {
126  uint8_t enabled;
127  uint8_t updated;
128  int8_t mode[2];
129  int8_t ref[4];
130  } lf_delta;
131  uint8_t yac_qi;
133  uint8_t lossless;
134 #define MAX_SEGMENT 8
135  struct {
136  uint8_t enabled;
137  uint8_t temporal;
138  uint8_t absolute_vals;
139  uint8_t update_map;
140  uint8_t prob[7];
141  uint8_t pred_prob[3];
142  struct {
143  uint8_t q_enabled;
144  uint8_t lf_enabled;
145  uint8_t ref_enabled;
146  uint8_t skip_enabled;
147  uint8_t ref_val;
148  int16_t q_val;
149  int8_t lf_val;
150  int16_t qmul[2][2];
151  uint8_t lflvl[4][2];
152  } feat[MAX_SEGMENT];
153  } segmentation;
156  struct {
158  unsigned tile_cols, tile_rows;
159  } tiling;
160 
164 
165 typedef struct VP9SharedContext {
167 
169 #define CUR_FRAME 0
170 #define REF_FRAME_MVPAIR 1
171 #define REF_FRAME_SEGMAP 2
174 
175 #endif /* AVCODEC_VP9SHARED_H */
PRED_SWITCHABLE
@ PRED_SWITCHABLE
Definition: vp9shared.h:52
PRED_SINGLEREF
@ PRED_SINGLEREF
Definition: vp9shared.h:50
mem_internal.h
BS_64x64
@ BS_64x64
Definition: vp9shared.h:84
VP9BitstreamHeader::parallelmode
uint8_t parallelmode
Definition: vp9shared.h:114
BS_64x32
@ BS_64x32
Definition: vp9shared.h:85
VP9Frame::segmentation_map
uint8_t * segmentation_map
Definition: vp9shared.h:68
VP9Frame
Definition: vp9shared.h:65
BL_16X16
@ BL_16X16
Definition: vp9shared.h:79
PRED_COMPREF
@ PRED_COMPREF
Definition: vp9shared.h:51
BlockPartition
BlockPartition
Definition: vp9shared.h:35
VP9BitstreamHeader
Definition: vp9shared.h:100
VP9BitstreamHeader::refreshrefmask
uint8_t refreshrefmask
Definition: vp9shared.h:109
BL_32X32
@ BL_32X32
Definition: vp9shared.h:78
MAX_SEGMENT
#define MAX_SEGMENT
Definition: vp9shared.h:134
VP9BitstreamHeader::q_enabled
uint8_t q_enabled
Definition: vp9shared.h:143
VP9SharedContext::refs
ThreadFrame refs[8]
Definition: vp9shared.h:168
VP9BitstreamHeader::qmul
int16_t qmul[2][2]
Definition: vp9shared.h:150
VP9Frame::hwaccel_priv_buf
AVBufferRef * hwaccel_priv_buf
Definition: vp9shared.h:72
BS_4x8
@ BS_4x8
Definition: vp9shared.h:95
VP9BitstreamHeader::framectxid
uint8_t framectxid
Definition: vp9shared.h:115
NEARMV
@ NEARMV
Definition: vp9shared.h:44
VP9BitstreamHeader::allowcompinter
uint8_t allowcompinter
Definition: vp9shared.h:112
VP9Frame::tf
ThreadFrame tf
Definition: vp9shared.h:66
VP9BitstreamHeader::compressed_header_size
int compressed_header_size
Definition: vp9shared.h:162
VP9BitstreamHeader::absolute_vals
uint8_t absolute_vals
Definition: vp9shared.h:138
VP9BitstreamHeader::uncompressed_header_size
int uncompressed_header_size
Definition: vp9shared.h:161
VP9Frame::extradata
AVBufferRef * extradata
Definition: vp9shared.h:67
VP9BitstreamHeader::tile_cols
unsigned tile_cols
Definition: vp9shared.h:158
FilterMode
FilterMode
Definition: vp9.h:64
BS_8x16
@ BS_8x16
Definition: vp9shared.h:92
PARTITION_NONE
@ PARTITION_NONE
Definition: vp9shared.h:36
VP9Frame::hwaccel_picture_private
void * hwaccel_picture_private
Definition: vp9shared.h:73
ZEROMV
@ ZEROMV
Definition: vp9shared.h:45
VP9BitstreamHeader::ydc_qdelta
int8_t ydc_qdelta
Definition: vp9shared.h:132
BL_8X8
@ BL_8X8
Definition: vp9shared.h:80
VP9mv::y
int16_t y
Definition: vp9shared.h:57
VP9BitstreamHeader::q_val
int16_t q_val
Definition: vp9shared.h:148
BS_32x32
@ BS_32x32
Definition: vp9shared.h:87
PARTITION_V
@ PARTITION_V
Definition: vp9shared.h:38
VP9BitstreamHeader::prob
uint8_t prob[7]
Definition: vp9shared.h:140
VP9BitstreamHeader::fixcompref
uint8_t fixcompref
Definition: vp9shared.h:119
VP9BitstreamHeader::uvdc_qdelta
int8_t uvdc_qdelta
Definition: vp9shared.h:132
VP9SharedContext
Definition: vp9shared.h:165
VP9BitstreamHeader::txfmmode
enum TxfmMode txfmmode
Definition: vp9shared.h:154
VP9mvrefPair::mv
VP9mv mv[2]
Definition: vp9shared.h:61
VP9BitstreamHeader::keyframe
uint8_t keyframe
Definition: vp9shared.h:104
VP9BitstreamHeader::comppredmode
enum CompPredMode comppredmode
Definition: vp9shared.h:155
VP9BitstreamHeader::ref
int8_t ref[4]
Definition: vp9shared.h:129
VP9BitstreamHeader::sharpness
int8_t sharpness
Definition: vp9shared.h:123
BS_8x4
@ BS_8x4
Definition: vp9shared.h:94
VP9BitstreamHeader::ref_val
uint8_t ref_val
Definition: vp9shared.h:147
VP9BitstreamHeader::log2_tile_rows
unsigned log2_tile_rows
Definition: vp9shared.h:157
VP9BitstreamHeader::skip_enabled
uint8_t skip_enabled
Definition: vp9shared.h:146
threadframe.h
VP9BitstreamHeader::refreshctx
uint8_t refreshctx
Definition: vp9shared.h:113
VP9BitstreamHeader::resetctx
uint8_t resetctx
Definition: vp9shared.h:108
VP9BitstreamHeader::segmentation
struct VP9BitstreamHeader::@201 segmentation
VP9BitstreamHeader::enabled
uint8_t enabled
Definition: vp9shared.h:126
VP9BitstreamHeader::tiling
struct VP9BitstreamHeader::@202 tiling
VP9BitstreamHeader::update_map
uint8_t update_map
Definition: vp9shared.h:139
VP9BitstreamHeader::temporal
uint8_t temporal
Definition: vp9shared.h:137
VP9BitstreamHeader::lf_val
int8_t lf_val
Definition: vp9shared.h:149
VP9SharedContext::frames
VP9Frame frames[3]
Definition: vp9shared.h:172
BS_32x64
@ BS_32x64
Definition: vp9shared.h:86
VP9mv
Definition: vp9shared.h:55
VP9BitstreamHeader::yac_qi
uint8_t yac_qi
Definition: vp9shared.h:131
PARTITION_SPLIT
@ PARTITION_SPLIT
Definition: vp9shared.h:39
VP9BitstreamHeader::lflvl
uint8_t lflvl[4][2]
Definition: vp9shared.h:151
VP9BitstreamHeader::highprecisionmvs
uint8_t highprecisionmvs
Definition: vp9shared.h:110
TxfmMode
TxfmMode
Definition: vp9.h:27
vp9.h
VP9Frame::uses_2pass
int uses_2pass
Definition: vp9shared.h:70
VP9BitstreamHeader::signbias
uint8_t signbias[3]
Definition: vp9shared.h:118
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:87
VP9BitstreamHeader::lf_enabled
uint8_t lf_enabled
Definition: vp9shared.h:144
VP9BitstreamHeader::lossless
uint8_t lossless
Definition: vp9shared.h:133
VP9BitstreamHeader::level
uint8_t level
Definition: vp9shared.h:122
BS_8x8
@ BS_8x8
Definition: vp9shared.h:93
VP9BitstreamHeader::filtermode
enum FilterMode filtermode
Definition: vp9shared.h:111
N_BS_SIZES
@ N_BS_SIZES
Definition: vp9shared.h:97
VP9BitstreamHeader::ref_enabled
uint8_t ref_enabled
Definition: vp9shared.h:145
BS_4x4
@ BS_4x4
Definition: vp9shared.h:96
VP9BitstreamHeader::varcompref
uint8_t varcompref[2]
Definition: vp9shared.h:120
BS_16x32
@ BS_16x32
Definition: vp9shared.h:89
BlockSize
BlockSize
Definition: vp9shared.h:83
VP9BitstreamHeader::feat
struct VP9BitstreamHeader::@201::@203 feat[MAX_SEGMENT]
VP9BitstreamHeader::tile_rows
unsigned tile_rows
Definition: vp9shared.h:158
BL_64X64
@ BL_64X64
Definition: vp9shared.h:77
VP9BitstreamHeader::uvac_qdelta
int8_t uvac_qdelta
Definition: vp9shared.h:132
VP9mvrefPair
Definition: vp9shared.h:60
NEWMV
@ NEWMV
Definition: vp9shared.h:46
BS_16x16
@ BS_16x16
Definition: vp9shared.h:90
VP9BitstreamHeader::profile
uint8_t profile
Definition: vp9shared.h:102
ThreadFrame
Definition: threadframe.h:27
BS_16x8
@ BS_16x8
Definition: vp9shared.h:91
CompPredMode
CompPredMode
Definition: vp9shared.h:49
mode
mode
Definition: ebur128.h:83
VP9SharedContext::h
VP9BitstreamHeader h
Definition: vp9shared.h:166
VP9Frame::mv
VP9mvrefPair * mv
Definition: vp9shared.h:69
VP9BitstreamHeader::updated
uint8_t updated
Definition: vp9shared.h:127
NEARESTMV
@ NEARESTMV
Definition: vp9shared.h:43
BlockLevel
BlockLevel
Definition: vp9shared.h:76
VP9BitstreamHeader::lf_delta
struct VP9BitstreamHeader::@200 lf_delta
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
VP9BitstreamHeader::errorres
uint8_t errorres
Definition: vp9shared.h:106
InterPredMode
InterPredMode
Definition: vp9shared.h:42
VP9BitstreamHeader::invisible
uint8_t invisible
Definition: vp9shared.h:105
BS_32x16
@ BS_32x16
Definition: vp9shared.h:88
PARTITION_H
@ PARTITION_H
Definition: vp9shared.h:37
VP9BitstreamHeader::refidx
uint8_t refidx[3]
Definition: vp9shared.h:117
VP9BitstreamHeader::log2_tile_cols
unsigned log2_tile_cols
Definition: vp9shared.h:157
VP9BitstreamHeader::bpp
uint8_t bpp
Definition: vp9shared.h:103
VP9mvrefPair::ref
int8_t ref[2]
Definition: vp9shared.h:62
VP9BitstreamHeader::use_last_frame_mvs
uint8_t use_last_frame_mvs
Definition: vp9shared.h:116
VP9BitstreamHeader::pred_prob
uint8_t pred_prob[3]
Definition: vp9shared.h:141
VP9mv::x
int16_t x
Definition: vp9shared.h:56
VP9BitstreamHeader::intraonly
uint8_t intraonly
Definition: vp9shared.h:107
VP9BitstreamHeader::filter
struct VP9BitstreamHeader::@199 filter