OSDN Git Service

libavcodec/vp9: ipred_dl_32x32_16 avx2 implementation
[android-x86/external-ffmpeg.git] / libavcodec / vp9shared.h
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
34 enum BlockPartition {
35     PARTITION_NONE,    // [ ] <-.
36     PARTITION_H,       // [-]   |
37     PARTITION_V,       // [|]   |
38     PARTITION_SPLIT,   // [+] --'
39 };
40
41 enum InterPredMode {
42     NEARESTMV = 10,
43     NEARMV    = 11,
44     ZEROMV    = 12,
45     NEWMV     = 13,
46 };
47
48 enum CompPredMode {
49     PRED_SINGLEREF,
50     PRED_COMPREF,
51     PRED_SWITCHABLE,
52 };
53
54 typedef struct VP9mvrefPair {
55     VP56mv mv[2];
56     int8_t ref[2];
57 } VP9mvrefPair;
58
59 typedef struct VP9Frame {
60     ThreadFrame tf;
61     AVBufferRef *extradata;
62     uint8_t *segmentation_map;
63     VP9mvrefPair *mv;
64     int uses_2pass;
65
66     AVBufferRef *hwaccel_priv_buf;
67     void *hwaccel_picture_private;
68 } VP9Frame;
69
70 enum BlockLevel {
71     BL_64X64,
72     BL_32X32,
73     BL_16X16,
74     BL_8X8,
75 };
76
77 enum BlockSize {
78     BS_64x64,
79     BS_64x32,
80     BS_32x64,
81     BS_32x32,
82     BS_32x16,
83     BS_16x32,
84     BS_16x16,
85     BS_16x8,
86     BS_8x16,
87     BS_8x8,
88     BS_8x4,
89     BS_4x8,
90     BS_4x4,
91     N_BS_SIZES,
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;
104     uint8_t highprecisionmvs;
105     enum FilterMode filtermode;
106     uint8_t allowcompinter;
107     uint8_t refreshctx;
108     uint8_t parallelmode;
109     uint8_t framectxid;
110     uint8_t use_last_frame_mvs;
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;
126     int8_t ydc_qdelta, uvdc_qdelta, uvac_qdelta;
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;
148     enum TxfmMode txfmmode;
149     enum CompPredMode comppredmode;
150     struct {
151         unsigned log2_tile_cols, log2_tile_rows;
152         unsigned tile_cols, tile_rows;
153     } tiling;
154
155     int uncompressed_header_size;
156     int compressed_header_size;
157 } VP9BitstreamHeader;
158
159 typedef struct VP9SharedContext {
160     VP9BitstreamHeader h;
161
162     ThreadFrame refs[8];
163 #define CUR_FRAME 0
164 #define REF_FRAME_MVPAIR 1
165 #define REF_FRAME_SEGMAP 2
166     VP9Frame frames[3];
167 } VP9SharedContext;
168
169 #endif /* AVCODEC_VP9SHARED_H */