1 /*
2 * Copyright (c) 2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file     codec_def_vp9_probs.h
24 //! \brief    Defines the probs for VP9.
25 //! \details  Defines all probs required by CodecHal for VP9 decoding/encoding.
26 //!
27 
28 /*
29 * This file declares some vp9 definitions/probs
30 * that are ported from libvpx (https://github.com/webmproject/libvpx/).
31 * The original copyright and licence statement as below.
32 */
33 
34 /*
35 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
36 *
37 *  Use of this source code is governed by a BSD-style license
38 *  that can be found in the media_libvpx.LICENSE file in the root of the source
39 *  tree. An additional intellectual property rights grant can be found
40 *  in the file media_libvpx.PATENTS.  All contributing project authors may
41 *  be found in the media_libvpx.AUTHORS file in the root of the source tree.
42 */
43 
44 #ifndef __CODEC_DEF_VP9_PROBS_H__
45 #define __CODEC_DEF_VP9_PROBS_H__
46 
47 #include "stdint.h"
48 
49 #define CODEC_VP9_PROB_MAX_NUM_ELEM           2048
50 #define CODEC_VP9_SEG_PROB_OFFSET             2010
51 #define CODEC_VP9_INTER_PROB_OFFSET           1667
52 #define CODECHAL_VP9_INTER_PROB_SIZE             (CODEC_VP9_SEG_PROB_OFFSET - CODEC_VP9_INTER_PROB_OFFSET)
53 #define CODEC_VP9_MAX_PROB                    255
54 #define CODEC_VP9_TX_SIZE_CONTEXTS            2 //default probs copied from libvpx
55 
56 //!
57 //! \struct    CODEC_VP9_TX_PROBS
58 //! \brief     Codec VP9 tx probs
59 //!
60 struct CODEC_VP9_TX_PROBS {
61     uint8_t p32x32[2][3];
62     uint8_t p16x16[2][2];
63     uint8_t p8x8[2][1];
64 };
65 
66 typedef struct {
67     uint8_t sign;
68     uint8_t classes[10];
69     uint8_t class0[1];
70     uint8_t bits[10];
71     uint8_t class0_fp[2][3];
72     uint8_t fp[3];
73     uint8_t class0_hp;
74     uint8_t hp;
75 } CODEC_VP9_NMV_COMPONENT;
76 
77 typedef struct {
78     uint8_t joints[3];
79     CODEC_VP9_NMV_COMPONENT comps[2];
80 } CODEC_VP9_NMV_CONTEXT;
81 
82 typedef uint8_t CODEC_VP9_COEFF_PROBS_MODEL[2][6][6][3];
83 
84 const struct CODEC_VP9_TX_PROBS DefaultTxProbs = {
85     { { 3, 136, 37 },
86     { 5, 52, 13 } },
87 
88     { { 20, 152 },
89     { 15, 101 } },
90 
91     { { 100 },
92     { 66 } }
93 };
94 
95 const uint8_t DefaultMbskipProbs[3] = {
96     192, 128, 64
97 };
98 
99 const uint8_t DefaultInterModeProbs[7][3] = {
100     { 2, 173, 34 },  // 0 = both zero mv
101     { 7, 145, 85 },  // 1 = one zero mv + one a predicted mv
102     { 7, 166, 63 },  // 2 = two predicted motion vectors
103     { 7, 94, 66 },  // 3 = one predicted/zero and one new mv
104     { 8, 64, 46 },  // 4 = two new motion vectors
105     { 17, 81, 31 },  // 5 = one intra neighbour + x
106     { 25, 29, 30 },  // 6 = two intra neighbours
107 };
108 
109 const uint8_t DefaultIntraInterProb[4] = {
110     9, 102, 187, 225
111 };
112 
113 const uint8_t DefaultCompInterProb[5] = {
114     239, 183, 119, 96, 41
115 };
116 
117 const uint8_t DefaultSingleRefProb[5][2] = {
118     { 33, 16 },
119     { 77, 74 },
120     { 142, 142 },
121     { 172, 170 },
122     { 238, 247 }
123 };
124 
125 const uint8_t DefaultCompRefProb[5] = {
126     50, 126, 123, 221, 226
127 };
128 
129 const uint8_t DefaultKFUVModeProb[10][9] = {
130     { 144, 11, 54, 157, 195, 130, 46, 58, 108 },  // y = dc
131     { 118, 15, 123, 148, 131, 101, 44, 93, 131 },  // y = v
132     { 113, 12, 23, 188, 226, 142, 26, 32, 125 },  // y = h
133     { 120, 11, 50, 123, 163, 135, 64, 77, 103 },  // y = d45
134     { 113, 9, 36, 155, 111, 157, 32, 44, 161 },  // y = d135
135     { 116, 9, 55, 176, 76, 96, 37, 61, 149 },  // y = d117
136     { 115, 9, 28, 141, 161, 167, 21, 25, 193 },  // y = d153
137     { 120, 12, 32, 145, 195, 142, 32, 38, 86 },  // y = d207
138     { 116, 12, 64, 120, 140, 125, 49, 115, 121 },  // y = d63
139     { 102, 19, 66, 162, 182, 122, 35, 59, 128 }   // y = tm
140 };
141 
142 const uint8_t DefaultIFYProb[4][9] = {
143     { 65, 32, 18, 144, 162, 194, 41, 51, 98 },  // block_size < 8x8
144     { 132, 68, 18, 165, 217, 196, 45, 40, 78 },  // block_size < 16x16
145     { 173, 80, 19, 176, 240, 193, 64, 35, 46 },  // block_size < 32x32
146     { 221, 135, 38, 194, 248, 121, 96, 85, 29 }   // block_size >= 32x32
147 };
148 
149 const uint8_t DefaultIFUVProbs[10][9] = {
150     { 120, 7, 76, 176, 208, 126, 28, 54, 103 },  // y = dc
151     { 48, 12, 154, 155, 139, 90, 34, 117, 119 },  // y = v
152     { 67, 6, 25, 204, 243, 158, 13, 21, 96 },  // y = h
153     { 97, 5, 44, 131, 176, 139, 48, 68, 97 },  // y = d45
154     { 83, 5, 42, 156, 111, 152, 26, 49, 152 },  // y = d135
155     { 80, 5, 58, 178, 74, 83, 33, 62, 145 },  // y = d117
156     { 86, 5, 32, 154, 192, 168, 14, 22, 163 },  // y = d153
157     { 85, 5, 32, 156, 216, 148, 19, 29, 73 },  // y = d207
158     { 77, 7, 64, 116, 132, 122, 37, 126, 120 },  // y = d63
159     { 101, 21, 107, 181, 192, 103, 19, 67, 125 }   // y = tm
160 };
161 
162 const CODEC_VP9_COEFF_PROBS_MODEL DefaultCoefProbs4x4[2] =
163 {
164     {  // Y plane
165         {  // Intra
166             {  // Band 0
167                 { 195, 29, 183 },{ 84, 49, 136 },{ 8, 42, 71 }
168             },
169             {  // Band 1
170                 { 31, 107, 169 },{ 35, 99, 159 },{ 17, 82, 140 },
171                 { 8, 66, 114 },{ 2, 44, 76 },{ 1, 19, 32 }
172             },
173             {  // Band 2
174                 { 40, 132, 201 },{ 29, 114, 187 },{ 13, 91, 157 },
175                 { 7, 75, 127 },{ 3, 58, 95 },{ 1, 28, 47 }
176             },
177             {  // Band 3
178                 { 69, 142, 221 },{ 42, 122, 201 },{ 15, 91, 159 },
179                 { 6, 67, 121 },{ 1, 42, 77 },{ 1, 17, 31 }
180             },
181             {  // Band 4
182                 { 102, 148, 228 },{ 67, 117, 204 },{ 17, 82, 154 },
183                 { 6, 59, 114 },{ 2, 39, 75 },{ 1, 15, 29 }
184             },
185             {  // Band 5
186                 { 156, 57, 233 },{ 119, 57, 212 },{ 58, 48, 163 },
187                 { 29, 40, 124 },{ 12, 30, 81 },{ 3, 12, 31 }
188             }
189         },
190         {  // Inter
191             {  // Band 0
192                 { 191, 107, 226 },{ 124, 117, 204 },{ 25, 99, 155 }
193             },{  // Band 1
194                 { 29, 148, 210 },{ 37, 126, 194 },{ 8, 93, 157 },
195                 { 2, 68, 118 },{ 1, 39, 69 },{ 1, 17, 33 }
196             },{  // Band 2
197                 { 41, 151, 213 },{ 27, 123, 193 },{ 3, 82, 144 },
198                 { 1, 58, 105 },{ 1, 32, 60 },{ 1, 13, 26 }
199             },{  // Band 3
200                 { 59, 159, 220 },{ 23, 126, 198 },{ 4, 88, 151 },
201                 { 1, 66, 114 },{ 1, 38, 71 },{ 1, 18, 34 }
202             },{  // Band 4
203                 { 114, 136, 232 },{ 51, 114, 207 },{ 11, 83, 155 },
204                 { 3, 56, 105 },{ 1, 33, 65 },{ 1, 17, 34 }
205             },{  // Band 5
206                 { 149, 65, 234 },{ 121, 57, 215 },{ 61, 49, 166 },
207                 { 28, 36, 114 },{ 12, 25, 76 },{ 3, 16, 42 }
208             }
209         }
210     },
211     {  // UV plane
212         {  // Intra
213             {  // Band 0
214                 { 214, 49, 220 },{ 132, 63, 188 },{ 42, 65, 137 }
215             },
216             {  // Band 1
217                 { 85, 137, 221 },{ 104, 131, 216 },{ 49, 111, 192 },
218                 { 21, 87, 155 },{ 2, 49, 87 },{ 1, 16, 28 }
219             },
220             {  // Band 2
221                 { 89, 163, 230 },{ 90, 137, 220 },{ 29, 100, 183 },
222                 { 10, 70, 135 },{ 2, 42, 81 },{ 1, 17, 33 }
223             },
224             {  // Band 3
225                 { 108, 167, 237 },{ 55, 133, 222 },{ 15, 97, 179 },
226                 { 4, 72, 135 },{ 1, 45, 85 },{ 1, 19, 38 }
227             },
228             {  // Band 4
229                 { 124, 146, 240 },{ 66, 124, 224 },{ 17, 88, 175 },
230                 { 4, 58, 122 },{ 1, 36, 75 },{ 1, 18, 37 }
231             },
232             {  //  Band 5
233                 { 141, 79, 241 },{ 126, 70, 227 },{ 66, 58, 182 },
234                 { 30, 44, 136 },{ 12, 34, 96 },{ 2, 20, 47 }
235             }
236         },
237         {  // Inter
238             {  // Band 0
239                 { 229, 99, 249 },{ 143, 111, 235 },{ 46, 109, 192 }
240             },
241             {  // Band 1
242                 { 82, 158, 236 },{ 94, 146, 224 },{ 25, 117, 191 },
243                 { 9, 87, 149 },{ 3, 56, 99 },{ 1, 33, 57 }
244             },
245             {  // Band 2
246                 { 83, 167, 237 },{ 68, 145, 222 },{ 10, 103, 177 },
247                 { 2, 72, 131 },{ 1, 41, 79 },{ 1, 20, 39 }
248             },
249             {  // Band 3
250                 { 99, 167, 239 },{ 47, 141, 224 },{ 10, 104, 178 },
251                 { 2, 73, 133 },{ 1, 44, 85 },{ 1, 22, 47 }
252             },
253             {  // Band 4
254                 { 127, 145, 243 },{ 71, 129, 228 },{ 17, 93, 177 },
255                 { 3, 61, 124 },{ 1, 41, 84 },{ 1, 21, 52 }
256             },
257             {  // Band 5
258                 { 157, 78, 244 },{ 140, 72, 231 },{ 69, 58, 184 },
259                 { 31, 44, 137 },{ 14, 38, 105 },{ 8, 23, 61 }
260             }
261         }
262     }
263 };
264 
265 const CODEC_VP9_COEFF_PROBS_MODEL DefaultCoefPprobs8x8[2] =
266 {
267     {  // Y plane
268         {  // Intra
269             {  // Band 0
270                 { 125, 34, 187 },{ 52, 41, 133 },{ 6, 31, 56 }
271             },
272             {  // Band 1
273                 { 37, 109, 153 },{ 51, 102, 147 },{ 23, 87, 128 },
274                 { 8, 67, 101 },{ 1, 41, 63 },{ 1, 19, 29 }
275             },
276             {  // Band 2
277                 { 31, 154, 185 },{ 17, 127, 175 },{ 6, 96, 145 },
278                 { 2, 73, 114 },{ 1, 51, 82 },{ 1, 28, 45 }
279             },
280             {  // Band 3
281                 { 23, 163, 200 },{ 10, 131, 185 },{ 2, 93, 148 },
282                 { 1, 67, 111 },{ 1, 41, 69 },{ 1, 14, 24 }
283             },
284             {  // Band 4
285                 { 29, 176, 217 },{ 12, 145, 201 },{ 3, 101, 156 },
286                 { 1, 69, 111 },{ 1, 39, 63 },{ 1, 14, 23 }
287             },
288             {  // Band 5
289                 { 57, 192, 233 },{ 25, 154, 215 },{ 6, 109, 167 },
290                 { 3, 78, 118 },{ 1, 48, 69 },{ 1, 21, 29 }
291             }
292         },
293         {  // Inter
294             {  // Band 0
295                 { 202, 105, 245 },{ 108, 106, 216 },{ 18, 90, 144 }
296             },
297             {  // Band 1
298                 { 33, 172, 219 },{ 64, 149, 206 },{ 14, 117, 177 },
299                 { 5, 90, 141 },{ 2, 61, 95 },{ 1, 37, 57 }
300             },
301             {  // Band 2
302                 { 33, 179, 220 },{ 11, 140, 198 },{ 1, 89, 148 },
303                 { 1, 60, 104 },{ 1, 33, 57 },{ 1, 12, 21 }
304             },
305             {  // Band 3
306                 { 30, 181, 221 },{ 8, 141, 198 },{ 1, 87, 145 },
307                 { 1, 58, 100 },{ 1, 31, 55 },{ 1, 12, 20 }
308             },
309             {  // Band 4
310                 { 32, 186, 224 },{ 7, 142, 198 },{ 1, 86, 143 },
311                 { 1, 58, 100 },{ 1, 31, 55 },{ 1, 12, 22 }
312             },
313             {  // Band 5
314                 { 57, 192, 227 },{ 20, 143, 204 },{ 3, 96, 154 },
315                 { 1, 68, 112 },{ 1, 42, 69 },{ 1, 19, 32 }
316             }
317         }
318     },
319     {  // UV plane
320         {  // Intra
321             {  // Band 0
322                 { 212, 35, 215 },{ 113, 47, 169 },{ 29, 48, 105 }
323             },
324             {  // Band 1
325                 { 74, 129, 203 },{ 106, 120, 203 },{ 49, 107, 178 },
326                 { 19, 84, 144 },{ 4, 50, 84 },{ 1, 15, 25 }
327             },
328             {  // Band 2
329                 { 71, 172, 217 },{ 44, 141, 209 },{ 15, 102, 173 },
330                 { 6, 76, 133 },{ 2, 51, 89 },{ 1, 24, 42 }
331             },
332             {  // Band 3
333                 { 64, 185, 231 },{ 31, 148, 216 },{ 8, 103, 175 },
334                 { 3, 74, 131 },{ 1, 46, 81 },{ 1, 18, 30 }
335             },
336             {  // Band 4
337                 { 65, 196, 235 },{ 25, 157, 221 },{ 5, 105, 174 },
338                 { 1, 67, 120 },{ 1, 38, 69 },{ 1, 15, 30 }
339             },
340             {  // Band 5
341                 { 65, 204, 238 },{ 30, 156, 224 },{ 7, 107, 177 },
342                 { 2, 70, 124 },{ 1, 42, 73 },{ 1, 18, 34 }
343             }
344         },
345         {  // Inter
346             {  // Band 0
347                 { 225, 86, 251 },{ 144, 104, 235 },{ 42, 99, 181 }
348             },
349             {  // Band 1
350                 { 85, 175, 239 },{ 112, 165, 229 },{ 29, 136, 200 },
351                 { 12, 103, 162 },{ 6, 77, 123 },{ 2, 53, 84 }
352             },
353             {  // Band 2
354                 { 75, 183, 239 },{ 30, 155, 221 },{ 3, 106, 171 },
355                 { 1, 74, 128 },{ 1, 44, 76 },{ 1, 17, 28 }
356             },
357             {  // Band 3
358                 { 73, 185, 240 },{ 27, 159, 222 },{ 2, 107, 172 },
359                 { 1, 75, 127 },{ 1, 42, 73 },{ 1, 17, 29 }
360             },
361             {  // Band 4
362                 { 62, 190, 238 },{ 21, 159, 222 },{ 2, 107, 172 },
363                 { 1, 72, 122 },{ 1, 40, 71 },{ 1, 18, 32 }
364             },
365             {  // Band 5
366                 { 61, 199, 240 },{ 27, 161, 226 },{ 4, 113, 180 },
367                 { 1, 76, 129 },{ 1, 46, 80 },{ 1, 23, 41 }
368             }
369         }
370     }
371 };
372 
373 const CODEC_VP9_COEFF_PROBS_MODEL DefaultCoefProbs16x16[2] =
374 {
375     {  // Y plane
376         {  // Intra
377             {  // Band 0
378                 { 7, 27, 153 },{ 5, 30, 95 },{ 1, 16, 30 }
379             },
380             {  // Band 1
381                 { 50, 75, 127 },{ 57, 75, 124 },{ 27, 67, 108 },
382                 { 10, 54, 86 },{ 1, 33, 52 },{ 1, 12, 18 }
383             },
384             {  // Band 2
385                 { 43, 125, 151 },{ 26, 108, 148 },{ 7, 83, 122 },
386                 { 2, 59, 89 },{ 1, 38, 60 },{ 1, 17, 27 }
387             },
388             {  // Band 3
389                 { 23, 144, 163 },{ 13, 112, 154 },{ 2, 75, 117 },
390                 { 1, 50, 81 },{ 1, 31, 51 },{ 1, 14, 23 }
391             },
392             {  // Band 4
393                 { 18, 162, 185 },{ 6, 123, 171 },{ 1, 78, 125 },
394                 { 1, 51, 86 },{ 1, 31, 54 },{ 1, 14, 23 }
395             },
396             {  // Band 5
397                 { 15, 199, 227 },{ 3, 150, 204 },{ 1, 91, 146 },
398                 { 1, 55, 95 },{ 1, 30, 53 },{ 1, 11, 20 }
399             }
400         },
401         {  // Inter
402             {  // Band 0
403                 { 19, 55, 240 },{ 19, 59, 196 },{ 3, 52, 105 }
404             },
405             {  // Band 1
406                 { 41, 166, 207 },{ 104, 153, 199 },{ 31, 123, 181 },
407                 { 14, 101, 152 },{ 5, 72, 106 },{ 1, 36, 52 }
408             },
409             {  // Band 2
410                 { 35, 176, 211 },{ 12, 131, 190 },{ 2, 88, 144 },
411                 { 1, 60, 101 },{ 1, 36, 60 },{ 1, 16, 28 }
412             },
413             {  // Band 3
414                 { 28, 183, 213 },{ 8, 134, 191 },{ 1, 86, 142 },
415                 { 1, 56, 96 },{ 1, 30, 53 },{ 1, 12, 20 }
416             },
417             {  // Band 4
418                 { 20, 190, 215 },{ 4, 135, 192 },{ 1, 84, 139 },
419                 { 1, 53, 91 },{ 1, 28, 49 },{ 1, 11, 20 }
420             },
421             {  // Band 5
422                 { 13, 196, 216 },{ 2, 137, 192 },{ 1, 86, 143 },
423                 { 1, 57, 99 },{ 1, 32, 56 },{ 1, 13, 24 }
424             }
425         }
426     },
427     {  // UV plane
428         {  // Intra
429             {  // Band 0
430                 { 211, 29, 217 },{ 96, 47, 156 },{ 22, 43, 87 }
431             },
432             {  // Band 1
433                 { 78, 120, 193 },{ 111, 116, 186 },{ 46, 102, 164 },
434                 { 15, 80, 128 },{ 2, 49, 76 },{ 1, 18, 28 }
435             },
436             {  // Band 2
437                 { 71, 161, 203 },{ 42, 132, 192 },{ 10, 98, 150 },
438                 { 3, 69, 109 },{ 1, 44, 70 },{ 1, 18, 29 }
439             },
440             {  // Band 3
441                 { 57, 186, 211 },{ 30, 140, 196 },{ 4, 93, 146 },
442                 { 1, 62, 102 },{ 1, 38, 65 },{ 1, 16, 27 }
443             },
444             {  // Band 4
445                 { 47, 199, 217 },{ 14, 145, 196 },{ 1, 88, 142 },
446                 { 1, 57, 98 },{ 1, 36, 62 },{ 1, 15, 26 }
447             },
448             {  // Band 5
449                 { 26, 219, 229 },{ 5, 155, 207 },{ 1, 94, 151 },
450                 { 1, 60, 104 },{ 1, 36, 62 },{ 1, 16, 28 }
451             }
452         },
453         {  // Inter
454             {  // Band 0
455                 { 233, 29, 248 },{ 146, 47, 220 },{ 43, 52, 140 }
456             },
457             {  // Band 1
458                 { 100, 163, 232 },{ 179, 161, 222 },{ 63, 142, 204 },
459                 { 37, 113, 174 },{ 26, 89, 137 },{ 18, 68, 97 }
460             },
461             {  // Band 2
462                 { 85, 181, 230 },{ 32, 146, 209 },{ 7, 100, 164 },
463                 { 3, 71, 121 },{ 1, 45, 77 },{ 1, 18, 30 }
464             },
465             {  // Band 3
466                 { 65, 187, 230 },{ 20, 148, 207 },{ 2, 97, 159 },
467                 { 1, 68, 116 },{ 1, 40, 70 },{ 1, 14, 29 }
468             },
469             {  // Band 4
470                 { 40, 194, 227 },{ 8, 147, 204 },{ 1, 94, 155 },
471                 { 1, 65, 112 },{ 1, 39, 66 },{ 1, 14, 26 }
472             },
473             {  // Band 5
474                 { 16, 208, 228 },{ 3, 151, 207 },{ 1, 98, 160 },
475                 { 1, 67, 117 },{ 1, 41, 74 },{ 1, 17, 31 }
476             }
477         }
478     }
479 };
480 
481 const CODEC_VP9_COEFF_PROBS_MODEL DefaultCoefProbs32x32[2] =
482 {
483     {  // Y plane
484         {  // Intra
485             {  // Band 0
486                 { 17, 38, 140 },{ 7, 34, 80 },{ 1, 17, 29 }
487             },
488             {  // Band 1
489                 { 37, 75, 128 },{ 41, 76, 128 },{ 26, 66, 116 },
490                 { 12, 52, 94 },{ 2, 32, 55 },{ 1, 10, 16 }
491             },
492             {  // Band 2
493                 { 50, 127, 154 },{ 37, 109, 152 },{ 16, 82, 121 },
494                 { 5, 59, 85 },{ 1, 35, 54 },{ 1, 13, 20 }
495             },
496             {  // Band 3
497                 { 40, 142, 167 },{ 17, 110, 157 },{ 2, 71, 112 },
498                 { 1, 44, 72 },{ 1, 27, 45 },{ 1, 11, 17 }
499             },
500             {  // Band 4
501                 { 30, 175, 188 },{ 9, 124, 169 },{ 1, 74, 116 },
502                 { 1, 48, 78 },{ 1, 30, 49 },{ 1, 11, 18 }
503             },
504             {  // Band 5
505                 { 10, 222, 223 },{ 2, 150, 194 },{ 1, 83, 128 },
506                 { 1, 48, 79 },{ 1, 27, 45 },{ 1, 11, 17 }
507             }
508         },
509         {  // Inter
510             {  // Band 0
511                 { 36, 41, 235 },{ 29, 36, 193 },{ 10, 27, 111 }
512             },
513             {  // Band 1
514                 { 85, 165, 222 },{ 177, 162, 215 },{ 110, 135, 195 },
515                 { 57, 113, 168 },{ 23, 83, 120 },{ 10, 49, 61 }
516             },
517             {  // Band 2
518                 { 85, 190, 223 },{ 36, 139, 200 },{ 5, 90, 146 },
519                 { 1, 60, 103 },{ 1, 38, 65 },{ 1, 18, 30 }
520             },
521             {  // Band 3
522                 { 72, 202, 223 },{ 23, 141, 199 },{ 2, 86, 140 },
523                 { 1, 56, 97 },{ 1, 36, 61 },{ 1, 16, 27 }
524             },
525             {  // Band 4
526                 { 55, 218, 225 },{ 13, 145, 200 },{ 1, 86, 141 },
527                 { 1, 57, 99 },{ 1, 35, 61 },{ 1, 13, 22 }
528             },
529             {  // Band 5
530                 { 15, 235, 212 },{ 1, 132, 184 },{ 1, 84, 139 },
531                 { 1, 57, 97 },{ 1, 34, 56 },{ 1, 14, 23 }
532             }
533         }
534     },
535     {  // UV plane
536         {  // Intra
537             {  // Band 0
538                 { 181, 21, 201 },{ 61, 37, 123 },{ 10, 38, 71 }
539             },
540             {  // Band 1
541                 { 47, 106, 172 },{ 95, 104, 173 },{ 42, 93, 159 },
542                 { 18, 77, 131 },{ 4, 50, 81 },{ 1, 17, 23 }
543             },
544             {  // Band 2
545                 { 62, 147, 199 },{ 44, 130, 189 },{ 28, 102, 154 },
546                 { 18, 75, 115 },{ 2, 44, 65 },{ 1, 12, 19 }
547             },
548             {  // Band 3
549                 { 55, 153, 210 },{ 24, 130, 194 },{ 3, 93, 146 },
550                 { 1, 61, 97 },{ 1, 31, 50 },{ 1, 10, 16 }
551             },
552             {  // Band 4
553                 { 49, 186, 223 },{ 17, 148, 204 },{ 1, 96, 142 },
554                 { 1, 53, 83 },{ 1, 26, 44 },{ 1, 11, 17 }
555             },
556             {  // Band 5
557                 { 13, 217, 212 },{ 2, 136, 180 },{ 1, 78, 124 },
558                 { 1, 50, 83 },{ 1, 29, 49 },{ 1, 14, 23 }
559             }
560         },
561         {  // Inter
562             {  // Band 0
563                 { 197, 13, 247 },{ 82, 17, 222 },{ 25, 17, 162 }
564             },
565             {  // Band 1
566                 { 126, 186, 247 },{ 234, 191, 243 },{ 176, 177, 234 },
567                 { 104, 158, 220 },{ 66, 128, 186 },{ 55, 90, 137 }
568             },
569             {  // Band 2
570                 { 111, 197, 242 },{ 46, 158, 219 },{ 9, 104, 171 },
571                 { 2, 65, 125 },{ 1, 44, 80 },{ 1, 17, 91 }
572             },
573             {  // Band 3
574                 { 104, 208, 245 },{ 39, 168, 224 },{ 3, 109, 162 },
575                 { 1, 79, 124 },{ 1, 50, 102 },{ 1, 43, 102 }
576             },
577             {  // Band 4
578                 { 84, 220, 246 },{ 31, 177, 231 },{ 2, 115, 180 },
579                 { 1, 79, 134 },{ 1, 55, 77 },{ 1, 60, 79 }
580             },
581             {  // Band 5
582                 { 43, 243, 240 },{ 8, 180, 217 },{ 1, 115, 166 },
583                 { 1, 84, 121 },{ 1, 51, 67 },{ 1, 16, 6 }
584             }
585         }
586     }
587 };
588 
589 const uint8_t DefaultSwitchableInterpProb[4][2] = {
590     { 235, 162, },
591     { 36, 255, },
592     { 34, 3, },
593     { 149, 144, },
594 };
595 
596 const uint8_t DefaultKFPartitionProb[16][3] = {
597     // 8x8 -> 4x4
598     { 158, 97, 94 },  // a/l both not split
599     { 93, 24, 99 },  // a split, l not split
600     { 85, 119, 44 },  // l split, a not split
601     { 62, 59, 67 },  // a/l both split
602                      // 16x16 -> 8x8
603     { 149, 53, 53 },  // a/l both not split
604     { 94, 20, 48 },  // a split, l not split
605     { 83, 53, 24 },  // l split, a not split
606     { 52, 18, 18 },  // a/l both split
607                      // 32x32 -> 16x16
608     { 150, 40, 39 },  // a/l both not split
609     { 78, 12, 26 },  // a split, l not split
610     { 67, 33, 11 },  // l split, a not split
611     { 24, 7, 5 },  // a/l both split
612                    // 64x64 -> 32x32
613     { 174, 35, 49 },  // a/l both not split
614     { 68, 11, 27 },  // a split, l not split
615     { 57, 15, 9 },  // l split, a not split
616     { 12, 3, 3 },  // a/l both split
617 };
618 
619 const uint8_t DefaultPartitionProb[16][3] = {
620     // 8x8 -> 4x4
621     { 199, 122, 141 },  // a/l both not split
622     { 147, 63, 159 },  // a split, l not split
623     { 148, 133, 118 },  // l split, a not split
624     { 121, 104, 114 },  // a/l both split
625                         // 16x16 -> 8x8
626     { 174, 73, 87 },  // a/l both not split
627     { 92, 41, 83 },  // a split, l not split
628     { 82, 99, 50 },  // l split, a not split
629     { 53, 39, 39 },  // a/l both split
630                      // 32x32 -> 16x16
631     { 177, 58, 59 },  // a/l both not split
632     { 68, 26, 63 },  // a split, l not split
633     { 52, 79, 25 },  // l split, a not split
634     { 17, 14, 12 },  // a/l both split
635                      // 64x64 -> 32x32
636     { 222, 34, 30 },  // a/l both not split
637     { 72, 16, 44 },  // a split, l not split
638     { 58, 32, 12 },  // l split, a not split
639     { 10, 7, 6 },  // a/l both split
640 };
641 
642 const CODEC_VP9_NMV_CONTEXT DefaultNmvContext = {
643     { 32, 64, 96 },
644     { // NOLINT
645         { /* vert component */ // NOLINT
646             128,                                                  /* sign */
647             { 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 },   /* class */
648             { 216 },                                                /* class0 */
649             { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 },   /* bits */
650             { { 128, 128, 64 },{ 96, 112, 64 } },                      /* class0_fp */
651             { 64, 96, 64 },                                         /* fp */
652             160,                                                  /* class0_hp bit */
653             128,                                                  /* hp */
654         },
655         { /* hor component */ // NOLINT
656             128,                                                  /* sign */
657             { 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 },   /* class */
658             { 208 },                                                /* class0 */
659             { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 },   /* bits */
660             { { 128, 128, 64 },{ 96, 112, 64 } },                      /* class0_fp */
661             { 64, 96, 64 },                                         /* fp */
662             160,                                                  /* class0_hp bit */
663             128,                                                  /* hp */
664         }
665     },
666 };
667 
668 #endif  // __CODEC_DEF_VP9_PROBS_H__
669