Skip to content

Commit 81fd334

Browse files
committed
vp9: move VP9Context and related structs into vp9.h
This allows accessing their definition from a hwaccel.
1 parent b6c4d33 commit 81fd334

File tree

4 files changed

+301
-292
lines changed

4 files changed

+301
-292
lines changed

libavcodec/vp9.c

Lines changed: 1 addition & 221 deletions
Original file line numberDiff line numberDiff line change
@@ -35,226 +35,6 @@
3535

3636
#define VP9_SYNCCODE 0x498342
3737

38-
enum CompPredMode {
39-
PRED_SINGLEREF,
40-
PRED_COMPREF,
41-
PRED_SWITCHABLE,
42-
};
43-
44-
enum BlockLevel {
45-
BL_64X64,
46-
BL_32X32,
47-
BL_16X16,
48-
BL_8X8,
49-
};
50-
51-
enum BlockSize {
52-
BS_64x64,
53-
BS_64x32,
54-
BS_32x64,
55-
BS_32x32,
56-
BS_32x16,
57-
BS_16x32,
58-
BS_16x16,
59-
BS_16x8,
60-
BS_8x16,
61-
BS_8x8,
62-
BS_8x4,
63-
BS_4x8,
64-
BS_4x4,
65-
N_BS_SIZES,
66-
};
67-
68-
struct VP9mvrefPair {
69-
VP56mv mv[2];
70-
int8_t ref[2];
71-
};
72-
73-
typedef struct VP9Frame {
74-
ThreadFrame tf;
75-
AVBufferRef *extradata;
76-
uint8_t *segmentation_map;
77-
struct VP9mvrefPair *mv;
78-
int uses_2pass;
79-
} VP9Frame;
80-
81-
struct VP9Filter {
82-
uint8_t level[8 * 8];
83-
uint8_t /* bit=col */ mask[2 /* 0=y, 1=uv */][2 /* 0=col, 1=row */]
84-
[8 /* rows */][4 /* 0=16, 1=8, 2=4, 3=inner4 */];
85-
};
86-
87-
typedef struct VP9Block {
88-
uint8_t seg_id, intra, comp, ref[2], mode[4], uvmode, skip;
89-
enum FilterMode filter;
90-
VP56mv mv[4 /* b_idx */][2 /* ref */];
91-
enum BlockSize bs;
92-
enum TxfmMode tx, uvtx;
93-
enum BlockLevel bl;
94-
enum BlockPartition bp;
95-
} VP9Block;
96-
97-
typedef struct VP9Context {
98-
VP9DSPContext dsp;
99-
VideoDSPContext vdsp;
100-
GetBitContext gb;
101-
VP56RangeCoder c;
102-
VP56RangeCoder *c_b;
103-
unsigned c_b_size;
104-
VP9Block *b_base, *b;
105-
int pass;
106-
int row, row7, col, col7;
107-
uint8_t *dst[3];
108-
ptrdiff_t y_stride, uv_stride;
109-
110-
// bitstream header
111-
uint8_t keyframe, last_keyframe;
112-
uint8_t last_bpp, bpp, bpp_index, bytesperpixel;
113-
uint8_t invisible;
114-
uint8_t use_last_frame_mvs;
115-
uint8_t errorres;
116-
uint8_t ss_h, ss_v;
117-
uint8_t intraonly;
118-
uint8_t resetctx;
119-
uint8_t refreshrefmask;
120-
uint8_t highprecisionmvs;
121-
enum FilterMode filtermode;
122-
uint8_t allowcompinter;
123-
uint8_t fixcompref;
124-
uint8_t refreshctx;
125-
uint8_t parallelmode;
126-
uint8_t framectxid;
127-
uint8_t refidx[3];
128-
uint8_t signbias[3];
129-
uint8_t varcompref[2];
130-
ThreadFrame refs[8], next_refs[8];
131-
#define CUR_FRAME 0
132-
#define REF_FRAME_MVPAIR 1
133-
#define REF_FRAME_SEGMAP 2
134-
VP9Frame frames[3];
135-
136-
struct {
137-
uint8_t level;
138-
int8_t sharpness;
139-
uint8_t lim_lut[64];
140-
uint8_t mblim_lut[64];
141-
} filter;
142-
struct {
143-
uint8_t enabled;
144-
int8_t mode[2];
145-
int8_t ref[4];
146-
} lf_delta;
147-
uint8_t yac_qi;
148-
int8_t ydc_qdelta, uvdc_qdelta, uvac_qdelta;
149-
uint8_t lossless;
150-
#define MAX_SEGMENT 8
151-
struct {
152-
uint8_t enabled;
153-
uint8_t temporal;
154-
uint8_t absolute_vals;
155-
uint8_t update_map;
156-
struct {
157-
uint8_t q_enabled;
158-
uint8_t lf_enabled;
159-
uint8_t ref_enabled;
160-
uint8_t skip_enabled;
161-
uint8_t ref_val;
162-
int16_t q_val;
163-
int8_t lf_val;
164-
int16_t qmul[2][2];
165-
uint8_t lflvl[4][2];
166-
} feat[MAX_SEGMENT];
167-
} segmentation;
168-
struct {
169-
unsigned log2_tile_cols, log2_tile_rows;
170-
unsigned tile_cols, tile_rows;
171-
unsigned tile_row_start, tile_row_end, tile_col_start, tile_col_end;
172-
} tiling;
173-
unsigned sb_cols, sb_rows, rows, cols;
174-
struct {
175-
prob_context p;
176-
uint8_t coef[4][2][2][6][6][3];
177-
} prob_ctx[4];
178-
struct {
179-
prob_context p;
180-
uint8_t coef[4][2][2][6][6][11];
181-
uint8_t seg[7];
182-
uint8_t segpred[3];
183-
} prob;
184-
struct {
185-
unsigned y_mode[4][10];
186-
unsigned uv_mode[10][10];
187-
unsigned filter[4][3];
188-
unsigned mv_mode[7][4];
189-
unsigned intra[4][2];
190-
unsigned comp[5][2];
191-
unsigned single_ref[5][2][2];
192-
unsigned comp_ref[5][2];
193-
unsigned tx32p[2][4];
194-
unsigned tx16p[2][3];
195-
unsigned tx8p[2][2];
196-
unsigned skip[3][2];
197-
unsigned mv_joint[4];
198-
struct {
199-
unsigned sign[2];
200-
unsigned classes[11];
201-
unsigned class0[2];
202-
unsigned bits[10][2];
203-
unsigned class0_fp[2][4];
204-
unsigned fp[4];
205-
unsigned class0_hp[2];
206-
unsigned hp[2];
207-
} mv_comp[2];
208-
unsigned partition[4][4][4];
209-
unsigned coef[4][2][2][6][6][3];
210-
unsigned eob[4][2][2][6][6][2];
211-
} counts;
212-
enum TxfmMode txfmmode;
213-
enum CompPredMode comppredmode;
214-
215-
// contextual (left/above) cache
216-
DECLARE_ALIGNED(16, uint8_t, left_y_nnz_ctx)[16];
217-
DECLARE_ALIGNED(16, uint8_t, left_mode_ctx)[16];
218-
DECLARE_ALIGNED(16, VP56mv, left_mv_ctx)[16][2];
219-
DECLARE_ALIGNED(16, uint8_t, left_uv_nnz_ctx)[2][16];
220-
DECLARE_ALIGNED(8, uint8_t, left_partition_ctx)[8];
221-
DECLARE_ALIGNED(8, uint8_t, left_skip_ctx)[8];
222-
DECLARE_ALIGNED(8, uint8_t, left_txfm_ctx)[8];
223-
DECLARE_ALIGNED(8, uint8_t, left_segpred_ctx)[8];
224-
DECLARE_ALIGNED(8, uint8_t, left_intra_ctx)[8];
225-
DECLARE_ALIGNED(8, uint8_t, left_comp_ctx)[8];
226-
DECLARE_ALIGNED(8, uint8_t, left_ref_ctx)[8];
227-
DECLARE_ALIGNED(8, uint8_t, left_filter_ctx)[8];
228-
uint8_t *above_partition_ctx;
229-
uint8_t *above_mode_ctx;
230-
// FIXME maybe merge some of the below in a flags field?
231-
uint8_t *above_y_nnz_ctx;
232-
uint8_t *above_uv_nnz_ctx[2];
233-
uint8_t *above_skip_ctx; // 1bit
234-
uint8_t *above_txfm_ctx; // 2bit
235-
uint8_t *above_segpred_ctx; // 1bit
236-
uint8_t *above_intra_ctx; // 1bit
237-
uint8_t *above_comp_ctx; // 1bit
238-
uint8_t *above_ref_ctx; // 2bit
239-
uint8_t *above_filter_ctx;
240-
VP56mv (*above_mv_ctx)[2];
241-
242-
// whole-frame cache
243-
uint8_t *intra_pred_data[3];
244-
struct VP9Filter *lflvl;
245-
DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[135 * 144 * 2];
246-
247-
// block reconstruction intermediates
248-
int block_alloc_using_2pass;
249-
int16_t *block_base, *block, *uvblock_base[2], *uvblock[2];
250-
uint8_t *eob_base, *uveob_base[2], *eob, *uveob[2];
251-
struct { int x, y; } min_mv, max_mv;
252-
DECLARE_ALIGNED(32, uint8_t, tmp_y)[64 * 64 * 2];
253-
DECLARE_ALIGNED(32, uint8_t, tmp_uv)[2][64 * 64 * 2];
254-
uint16_t mvscale[3][2];
255-
uint8_t mvstep[3][2];
256-
} VP9Context;
257-
25838
static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
25939
{
26040
{ 16, 16 }, { 16, 8 }, { 8, 16 }, { 8, 8 }, { 8, 4 }, { 4, 8 },
@@ -3742,7 +3522,7 @@ static av_always_inline void adapt_prob(uint8_t *p, unsigned ct0, unsigned ct1,
37423522
static void adapt_probs(VP9Context *s)
37433523
{
37443524
int i, j, k, l, m;
3745-
prob_context *p = &s->prob_ctx[s->framectxid].p;
3525+
VP9ProbContext *p = &s->prob_ctx[s->framectxid].p;
37463526
int uf = (s->keyframe || s->intraonly || !s->last_keyframe) ? 112 : 128;
37473527

37483528
// coefficients

0 commit comments

Comments
 (0)