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