History

cavs: Move data tables used in only one place to that file

Diego Biurrun committed 14 years ago

Commit ef07ac11 parent 09bd0ea4 files · +467 −479Browse files

Unified · Split

4 files
  1. libavcodec/cavs.c +49 −19
  2. libavcodec/cavs.h +0 −12
  3. libavcodec/cavsdata.h +0 −438
  4. libavcodec/cavsdec.c +418 −10
libavcodec/cavs.c+49−19
@@ -32,6 +32,36 @@ · 31 unmodified lines
32#include "cavs.h"32#include "cavs.h"
33#include "cavsdata.h"33#include "cavsdata.h"
34 34
35static const uint8_t alpha_tab[64] = {
36 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3,
37 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 18, 20,
38 22, 24, 26, 28, 30, 33, 33, 35, 35, 36, 37, 37, 39, 39, 42, 44,
39 46, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
40};
41
42static const uint8_t beta_tab[64] = {
43 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
44 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,
45 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14,
46 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27
47};
48
49static const uint8_t tc_tab[64] = {
50 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
51 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
52 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
53 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
54};
55
56/** mark block as unavailable, i.e. out of picture
57 or not yet decoded */
58static const cavs_vector un_mv = { 0, 0, 1, NOT_AVAIL };
59
60static const int8_t left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 };
61static const int8_t top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 };
62static const int8_t left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 };
63static const int8_t top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 };
64
35/*****************************************************************************65/*****************************************************************************
36 *66 *
37 * in-loop deblocking filter67 * in-loop deblocking filter
@@ -307,14 +337,14 @@ void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) { · 269 unmodified lines
307 337
308 /* modify pred modes according to availability of neighbour samples */338 /* modify pred modes according to availability of neighbour samples */
309 if(!(h->flags & A_AVAIL)) {339 if(!(h->flags & A_AVAIL)) {
310 modify_pred(ff_left_modifier_l, &h->pred_mode_Y[4] );340 modify_pred(left_modifier_l, &h->pred_mode_Y[4]);
311 modify_pred(ff_left_modifier_l, &h->pred_mode_Y[7] );341 modify_pred(left_modifier_l, &h->pred_mode_Y[7]);
312 modify_pred(ff_left_modifier_c, pred_mode_uv );342 modify_pred(left_modifier_c, pred_mode_uv);
313 }343 }
314 if(!(h->flags & B_AVAIL)) {344 if(!(h->flags & B_AVAIL)) {
315 modify_pred(ff_top_modifier_l, &h->pred_mode_Y[4] );345 modify_pred(top_modifier_l, &h->pred_mode_Y[4]);
316 modify_pred(ff_top_modifier_l, &h->pred_mode_Y[5] );346 modify_pred(top_modifier_l, &h->pred_mode_Y[5]);
317 modify_pred(ff_top_modifier_c, pred_mode_uv );347 modify_pred(top_modifier_c, pred_mode_uv);
318 }348 }
319}349}
320 350
@@ -496,7 +526,7 @@ void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, · 175 unmodified lines
496 ((mvA->ref == NOT_AVAIL) || (mvB->ref == NOT_AVAIL) ||526 ((mvA->ref == NOT_AVAIL) || (mvB->ref == NOT_AVAIL) ||
497 ((mvA->x | mvA->y | mvA->ref) == 0) ||527 ((mvA->x | mvA->y | mvA->ref) == 0) ||
498 ((mvB->x | mvB->y | mvB->ref) == 0) )) {528 ((mvB->x | mvB->y | mvB->ref) == 0) )) {
499 mvP2 = &ff_cavs_un_mv;529 mvP2 = &un_mv;
500 /* if there is only one suitable candidate, take it */530 /* if there is only one suitable candidate, take it */
501 } else if((mvA->ref >= 0) && (mvB->ref < 0) && (mvC->ref < 0)) {531 } else if((mvA->ref >= 0) && (mvB->ref < 0) && (mvC->ref < 0)) {
502 mvP2= mvA;532 mvP2= mvA;
@@ -545,10 +575,10 @@ void ff_cavs_init_mb(AVSContext *h) { · 42 unmodified lines
545 h->pred_mode_Y[2] = h->top_pred_Y[h->mbx*2+1];575 h->pred_mode_Y[2] = h->top_pred_Y[h->mbx*2+1];
546 /* clear top predictors if MB B is not available */576 /* clear top predictors if MB B is not available */
547 if(!(h->flags & B_AVAIL)) {577 if(!(h->flags & B_AVAIL)) {
548 h->mv[MV_FWD_B2] = ff_cavs_un_mv;578 h->mv[MV_FWD_B2] = un_mv;
549 h->mv[MV_FWD_B3] = ff_cavs_un_mv;579 h->mv[MV_FWD_B3] = un_mv;
550 h->mv[MV_BWD_B2] = ff_cavs_un_mv;580 h->mv[MV_BWD_B2] = un_mv;
551 h->mv[MV_BWD_B3] = ff_cavs_un_mv;581 h->mv[MV_BWD_B3] = un_mv;
552 h->pred_mode_Y[1] = h->pred_mode_Y[2] = NOT_AVAIL;582 h->pred_mode_Y[1] = h->pred_mode_Y[2] = NOT_AVAIL;
553 h->flags &= ~(C_AVAIL|D_AVAIL);583 h->flags &= ~(C_AVAIL|D_AVAIL);
554 } else if(h->mbx) {584 } else if(h->mbx) {
@@ -558,13 +588,13 @@ void ff_cavs_init_mb(AVSContext *h) { · 3 unmodified lines
558 h->flags &= ~C_AVAIL;588 h->flags &= ~C_AVAIL;
559 /* clear top-right predictors if MB C is not available */589 /* clear top-right predictors if MB C is not available */
560 if(!(h->flags & C_AVAIL)) {590 if(!(h->flags & C_AVAIL)) {
561 h->mv[MV_FWD_C2] = ff_cavs_un_mv;591 h->mv[MV_FWD_C2] = un_mv;
562 h->mv[MV_BWD_C2] = ff_cavs_un_mv;592 h->mv[MV_BWD_C2] = un_mv;
563 }593 }
564 /* clear top-left predictors if MB D is not available */594 /* clear top-left predictors if MB D is not available */
565 if(!(h->flags & D_AVAIL)) {595 if(!(h->flags & D_AVAIL)) {
566 h->mv[MV_FWD_D3] = ff_cavs_un_mv;596 h->mv[MV_FWD_D3] = un_mv;
567 h->mv[MV_BWD_D3] = ff_cavs_un_mv;597 h->mv[MV_BWD_D3] = un_mv;
568 }598 }
569}599}
570 600
@@ -597,7 +627,7 @@ int ff_cavs_next_mb(AVSContext *h) { · 26 unmodified lines
597 h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;627 h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
598 /* clear left mv predictors */628 /* clear left mv predictors */
599 for(i=0;i<=20;i+=4)629 for(i=0;i<=20;i+=4)
600 h->mv[i] = ff_cavs_un_mv;630 h->mv[i] = un_mv;
601 h->mbx = 0;631 h->mbx = 0;
602 h->mby++;632 h->mby++;
603 /* re-calculate sample pointers */633 /* re-calculate sample pointers */
@@ -622,7 +652,7 @@ void ff_cavs_init_pic(AVSContext *h) { · 18 unmodified lines
622 652
623 /* clear some predictors */653 /* clear some predictors */
624 for(i=0;i<=20;i+=4)654 for(i=0;i<=20;i+=4)
625 h->mv[i] = ff_cavs_un_mv;655 h->mv[i] = un_mv;
626 h->mv[MV_BWD_X0] = ff_cavs_dir_mv;656 h->mv[MV_BWD_X0] = ff_cavs_dir_mv;
627 set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);657 set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
628 h->mv[MV_FWD_X0] = ff_cavs_dir_mv;658 h->mv[MV_FWD_X0] = ff_cavs_dir_mv;
@@ -693,8 +723,8 @@ av_cold int ff_cavs_init(AVCodecContext *avctx) { · 64 unmodified lines
693 h->intra_pred_c[ INTRA_C_LP_LEFT] = intra_pred_lp_left;723 h->intra_pred_c[ INTRA_C_LP_LEFT] = intra_pred_lp_left;
694 h->intra_pred_c[ INTRA_C_LP_TOP] = intra_pred_lp_top;724 h->intra_pred_c[ INTRA_C_LP_TOP] = intra_pred_lp_top;
695 h->intra_pred_c[ INTRA_C_DC_128] = intra_pred_dc_128;725 h->intra_pred_c[ INTRA_C_DC_128] = intra_pred_dc_128;
696 h->mv[ 7] = ff_cavs_un_mv;726 h->mv[ 7] = un_mv;
697 h->mv[19] = ff_cavs_un_mv;727 h->mv[19] = un_mv;
698 return 0;728 return 0;
699}729}
700 730
libavcodec/cavs.h+0−12
@@ -225,20 +225,8 @@ typedef struct { · 224 unmodified lines
225 DCTELEM *block;225 DCTELEM *block;
226} AVSContext;226} AVSContext;
227 227
228extern const uint8_t ff_cavs_dequant_shift[64];
229extern const uint16_t ff_cavs_dequant_mul[64];
230extern const struct dec_2dvlc ff_cavs_intra_dec[7];
231extern const struct dec_2dvlc ff_cavs_inter_dec[7];
232extern const struct dec_2dvlc ff_cavs_chroma_dec[5];
233extern const uint8_t ff_cavs_chroma_qp[64];
234extern const uint8_t ff_cavs_scan3x3[4];
235extern const uint8_t ff_cavs_partition_flags[30];228extern const uint8_t ff_cavs_partition_flags[30];
236extern const int8_t ff_left_modifier_l[8];
237extern const int8_t ff_top_modifier_l[8];
238extern const int8_t ff_left_modifier_c[7];
239extern const int8_t ff_top_modifier_c[7];
240extern const cavs_vector ff_cavs_intra_mv;229extern const cavs_vector ff_cavs_intra_mv;
241extern const cavs_vector ff_cavs_un_mv;
242extern const cavs_vector ff_cavs_dir_mv;230extern const cavs_vector ff_cavs_dir_mv;
243 231
244static inline void modify_pred(const int8_t *mod_table, int *mode)232static inline void modify_pred(const int8_t *mod_table, int *mode)
libavcodec/cavsdata.h+0−438
@@ -57,41 +57,6 @@ const uint8_t ff_cavs_partition_flags[30] = { · 56 unmodified lines
57 SPLITH|SPLITV, //B_8X8 = 2957 SPLITH|SPLITV, //B_8X8 = 29
58};58};
59 59
60const uint8_t ff_cavs_scan3x3[4] = {4,5,7,8};
61
62const uint8_t ff_cavs_chroma_qp[64] = {
63 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
64 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
65 32,33,34,35,36,37,38,39,40,41,42,42,43,43,44,44,
66 45,45,46,46,47,47,48,48,48,49,49,49,50,50,50,51
67};
68
69const uint8_t ff_cavs_dequant_shift[64] = {
70 14,14,14,14,14,14,14,14,
71 13,13,13,13,13,13,13,13,
72 13,12,12,12,12,12,12,12,
73 11,11,11,11,11,11,11,11,
74 11,10,10,10,10,10,10,10,
75 10, 9, 9, 9, 9, 9, 9, 9,
76 9, 8, 8, 8, 8, 8, 8, 8,
77 7, 7, 7, 7, 7, 7, 7, 7
78};
79
80const uint16_t ff_cavs_dequant_mul[64] = {
81 32768,36061,38968,42495,46341,50535,55437,60424,
82 32932,35734,38968,42495,46177,50535,55109,59933,
83 65535,35734,38968,42577,46341,50617,55027,60097,
84 32809,35734,38968,42454,46382,50576,55109,60056,
85 65535,35734,38968,42495,46320,50515,55109,60076,
86 65535,35744,38968,42495,46341,50535,55099,60087,
87 65535,35734,38973,42500,46341,50535,55109,60097,
88 32771,35734,38965,42497,46341,50535,55109,60099
89};
90
91/** mark block as unavailable, i.e. out of picture
92 or not yet decoded */
93const cavs_vector ff_cavs_un_mv = {0,0,1,NOT_AVAIL};
94
95/** mark block as "no prediction from this direction"60/** mark block as "no prediction from this direction"
96 e.g. forward motion vector in BWD partition */61 e.g. forward motion vector in BWD partition */
97const cavs_vector ff_cavs_dir_mv = {0,0,1,REF_DIR};62const cavs_vector ff_cavs_dir_mv = {0,0,1,REF_DIR};
@@ -99,407 +64,4 @@ const cavs_vector ff_cavs_dir_mv = {0,0,1,REF_DIR}; · 1 unmodified line
99/** mark block as using intra prediction */64/** mark block as using intra prediction */
100const cavs_vector ff_cavs_intra_mv = {0,0,1,REF_INTRA};65const cavs_vector ff_cavs_intra_mv = {0,0,1,REF_INTRA};
101 66
102#define EOB 0,0,0
103
104const struct dec_2dvlc ff_cavs_intra_dec[7] = {
105 {
106 { //level / run / table_inc
107 { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
108 { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
109 { 1, 7, 1},{ -1, 7, 1},{ 1, 8, 1},{ -1, 8, 1},{ 1, 9, 1},{ -1, 9, 1},
110 { 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},{ 2, 1, 2},{ -2, 1, 2},
111 { 1,12, 1},{ -1,12, 1},{ 1,13, 1},{ -1,13, 1},{ 1,14, 1},{ -1,14, 1},
112 { 1,15, 1},{ -1,15, 1},{ 2, 2, 2},{ -2, 2, 2},{ 1,16, 1},{ -1,16, 1},
113 { 1,17, 1},{ -1,17, 1},{ 3, 1, 3},{ -3, 1, 3},{ 1,18, 1},{ -1,18, 1},
114 { 1,19, 1},{ -1,19, 1},{ 2, 3, 2},{ -2, 3, 2},{ 1,20, 1},{ -1,20, 1},
115 { 1,21, 1},{ -1,21, 1},{ 2, 4, 2},{ -2, 4, 2},{ 1,22, 1},{ -1,22, 1},
116 { 2, 5, 2},{ -2, 5, 2},{ 1,23, 1},{ -1,23, 1},{ EOB }
117 },
118 //level_add
119 { 0, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120 2, 2, 2, 2, 2, 2, 2,-1,-1,-1},
121 2, //golomb_order
122 0, //inc_limit
123 23, //max_run
124 },{
125 { //level / run
126 { 1, 1, 0},{ -1, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 1},{ -2, 1, 1},
127 { 1, 3, 0},{ -1, 3, 0},{ EOB },{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},
128 { -1, 5, 0},{ 1, 6, 0},{ -1, 6, 0},{ 3, 1, 2},{ -3, 1, 2},{ 2, 2, 1},
129 { -2, 2, 1},{ 1, 7, 0},{ -1, 7, 0},{ 1, 8, 0},{ -1, 8, 0},{ 1, 9, 0},
130 { -1, 9, 0},{ 2, 3, 1},{ -2, 3, 1},{ 4, 1, 2},{ -4, 1, 2},{ 1,10, 0},
131 { -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 2, 4, 1},{ -2, 4, 1},{ 3, 2, 2},
132 { -3, 2, 2},{ 1,12, 0},{ -1,12, 0},{ 2, 5, 1},{ -2, 5, 1},{ 5, 1, 3},
133 { -5, 1, 3},{ 1,13, 0},{ -1,13, 0},{ 2, 6, 1},{ -2, 6, 1},{ 1,14, 0},
134 { -1,14, 0},{ 2, 7, 1},{ -2, 7, 1},{ 2, 8, 1},{ -2, 8, 1},{ 3, 3, 2},
135 { -3, 3, 2},{ 6, 1, 3},{ -6, 1, 3},{ 1,15, 0},{ -1,15, 0}
136 },
137 //level_add
138 { 0, 7, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,
139 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
140 2, //golomb_order
141 1, //inc_limit
142 15, //max_run
143 },{
144 { //level / run
145 { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},{ -1, 2, 0},
146 { 3, 1, 1},{ -3, 1, 1},{ EOB },{ 1, 3, 0},{ -1, 3, 0},{ 2, 2, 0},
147 { -2, 2, 0},{ 4, 1, 1},{ -4, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 2},
148 { -5, 1, 2},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 3, 0},
149 { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 2},{ -6, 1, 2},{ 2, 4, 0},
150 { -2, 4, 0},{ 1, 7, 0},{ -1, 7, 0},{ 4, 2, 1},{ -4, 2, 1},{ 7, 1, 2},
151 { -7, 1, 2},{ 3, 3, 1},{ -3, 3, 1},{ 2, 5, 0},{ -2, 5, 0},{ 1, 8, 0},
152 { -1, 8, 0},{ 2, 6, 0},{ -2, 6, 0},{ 8, 1, 3},{ -8, 1, 3},{ 1, 9, 0},
153 { -1, 9, 0},{ 5, 2, 2},{ -5, 2, 2},{ 3, 4, 1},{ -3, 4, 1},{ 2, 7, 0},
154 { -2, 7, 0},{ 9, 1, 3},{ -9, 1, 3},{ 1,10, 0},{ -1,10, 0}
155 },
156 //level_add
157 { 0,10, 6, 4, 4, 3, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,
158 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
159 2, //golomb_order
160 2, //inc_limit
161 10, //max_run
162 },{
163 { //level / run
164 { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},{ -3, 1, 0},
165 { 1, 2, 0},{ -1, 2, 0},{ EOB },{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 1},
166 { -5, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 3, 0},{ -1, 3, 0},{ 6, 1, 1},
167 { -6, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 7, 1, 1},{ -7, 1, 1},{ 1, 4, 0},
168 { -1, 4, 0},{ 8, 1, 2},{ -8, 1, 2},{ 2, 3, 0},{ -2, 3, 0},{ 4, 2, 0},
169 { -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 9, 1, 2},{ -9, 1, 2},{ 5, 2, 1},
170 { -5, 2, 1},{ 2, 4, 0},{ -2, 4, 0},{ 10, 1, 2},{-10, 1, 2},{ 3, 3, 0},
171 { -3, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 11, 1, 3},{-11, 1, 3},{ 6, 2, 1},
172 { -6, 2, 1},{ 1, 7, 0},{ -1, 7, 0},{ 2, 5, 0},{ -2, 5, 0},{ 3, 4, 0},
173 { -3, 4, 0},{ 12, 1, 3},{-12, 1, 3},{ 4, 3, 0},{ -4, 3, 0}
174 },
175 //level_add
176 { 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1 -1,-1,-1,-1,-1,-1,
177 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
178 2, //golomb_order
179 4, //inc_limit
180 7, //max_run
181 },{
182 { //level / run
183 { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},{ -3, 1, 0},
184 { EOB },{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
185 { -6, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 1},
186 { -8, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 9, 1, 1},{ -9, 1, 1},{ 10, 1, 1},
187 {-10, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 3, 2, 0},{ -3, 2, 0},{ 11, 1, 2},
188 {-11, 1, 2},{ 4, 2, 0},{ -4, 2, 0},{ 12, 1, 2},{-12, 1, 2},{ 13, 1, 2},
189 {-13, 1, 2},{ 5, 2, 0},{ -5, 2, 0},{ 1, 4, 0},{ -1, 4, 0},{ 2, 3, 0},
190 { -2, 3, 0},{ 14, 1, 2},{-14, 1, 2},{ 6, 2, 0},{ -6, 2, 0},{ 15, 1, 2},
191 {-15, 1, 2},{ 16, 1, 2},{-16, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 1, 5, 0},
192 { -1, 5, 0},{ 7, 2, 0},{ -7, 2, 0},{ 17, 1, 2},{-17, 1, 2}
193 },
194 //level_add
195 { 0,18, 8, 4, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
196 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
197 2, //golomb_order
198 7, //inc_limit
199 5, //max_run
200 },{
201 { //level / run
202 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
203 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
204 { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 9, 1, 0},
205 { -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 11, 1, 1},
206 {-11, 1, 1},{ 12, 1, 1},{-12, 1, 1},{ 13, 1, 1},{-13, 1, 1},{ 2, 2, 0},
207 { -2, 2, 0},{ 14, 1, 1},{-14, 1, 1},{ 15, 1, 1},{-15, 1, 1},{ 3, 2, 0},
208 { -3, 2, 0},{ 16, 1, 1},{-16, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 17, 1, 1},
209 {-17, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 18, 1, 1},{-18, 1, 1},{ 5, 2, 0},
210 { -5, 2, 0},{ 19, 1, 1},{-19, 1, 1},{ 20, 1, 1},{-20, 1, 1},{ 6, 2, 0},
211 { -6, 2, 0},{ 21, 1, 1},{-21, 1, 1},{ 2, 3, 0},{ -2, 3, 0}
212 },
213 //level_add
214 { 0,22, 7, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
215 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
216 2, //golomb_order
217 10, //inc_limit
218 3, //max_run
219 },{
220 { //level / run
221 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
222 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
223 { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 9, 1, 0},
224 { -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},{-11, 1, 0},{ 12, 1, 0},
225 {-12, 1, 0},{ 13, 1, 0},{-13, 1, 0},{ 14, 1, 0},{-14, 1, 0},{ 15, 1, 0},
226 {-15, 1, 0},{ 16, 1, 0},{-16, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 17, 1, 0},
227 {-17, 1, 0},{ 18, 1, 0},{-18, 1, 0},{ 19, 1, 0},{-19, 1, 0},{ 20, 1, 0},
228 {-20, 1, 0},{ 21, 1, 0},{-21, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 22, 1, 0},
229 {-22, 1, 0},{ 23, 1, 0},{-23, 1, 0},{ 24, 1, 0},{-24, 1, 0},{ 25, 1, 0},
230 {-25, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 26, 1, 0},{-26, 1, 0}
231 },
232 //level_add
233 { 0,27, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
234 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
235 2, //golomb_order
236 INT_MAX, //inc_limit
237 2, //max_run
238 }
239};
240
241const struct dec_2dvlc ff_cavs_inter_dec[7] = {
242 {
243 { //level / run
244 { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
245 { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
246 { 1, 7, 1},{ -1, 7, 1},{ 1, 8, 1},{ -1, 8, 1},{ 1, 9, 1},{ -1, 9, 1},
247 { 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},{ 1,12, 1},{ -1,12, 1},
248 { 1,13, 1},{ -1,13, 1},{ 2, 1, 2},{ -2, 1, 2},{ 1,14, 1},{ -1,14, 1},
249 { 1,15, 1},{ -1,15, 1},{ 1,16, 1},{ -1,16, 1},{ 1,17, 1},{ -1,17, 1},
250 { 1,18, 1},{ -1,18, 1},{ 1,19, 1},{ -1,19, 1},{ 3, 1, 3},{ -3, 1, 3},
251 { 1,20, 1},{ -1,20, 1},{ 1,21, 1},{ -1,21, 1},{ 2, 2, 2},{ -2, 2, 2},
252 { 1,22, 1},{ -1,22, 1},{ 1,23, 1},{ -1,23, 1},{ 1,24, 1},{ -1,24, 1},
253 { 1,25, 1},{ -1,25, 1},{ 1,26, 1},{ -1,26, 1},{ EOB }
254 },
255 //level_add
256 { 0, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
257 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
258 3, //golomb_order
259 0, //inc_limit
260 26 //max_run
261 },{
262 { //level / run
263 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 1, 2, 0},{ -1, 2, 0},{ 1, 3, 0},
264 { -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},{ -1, 5, 0},{ 1, 6, 0},
265 { -1, 6, 0},{ 2, 1, 1},{ -2, 1, 1},{ 1, 7, 0},{ -1, 7, 0},{ 1, 8, 0},
266 { -1, 8, 0},{ 1, 9, 0},{ -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 2, 2, 1},
267 { -2, 2, 1},{ 1,11, 0},{ -1,11, 0},{ 1,12, 0},{ -1,12, 0},{ 3, 1, 2},
268 { -3, 1, 2},{ 1,13, 0},{ -1,13, 0},{ 1,14, 0},{ -1,14, 0},{ 2, 3, 1},
269 { -2, 3, 1},{ 1,15, 0},{ -1,15, 0},{ 2, 4, 1},{ -2, 4, 1},{ 1,16, 0},
270 { -1,16, 0},{ 2, 5, 1},{ -2, 5, 1},{ 1,17, 0},{ -1,17, 0},{ 4, 1, 3},
271 { -4, 1, 3},{ 2, 6, 1},{ -2, 6, 1},{ 1,18, 0},{ -1,18, 0},{ 1,19, 0},
272 { -1,19, 0},{ 2, 7, 1},{ -2, 7, 1},{ 3, 2, 2},{ -3, 2, 2}
273 },
274 //level_add
275 { 0, 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
276 2, 2, 2,-1,-1,-1,-1,-1,-1,-1},
277 2, //golomb_order
278 1, //inc_limit
279 19 //max_run
280 },{
281 { //level / run
282 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 0},
283 { -2, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 3, 1, 1},
284 { -3, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 1, 6, 0},
285 { -1, 6, 0},{ 1, 7, 0},{ -1, 7, 0},{ 2, 3, 0},{ -2, 3, 0},{ 4, 1, 2},
286 { -4, 1, 2},{ 1, 8, 0},{ -1, 8, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 4, 0},
287 { -2, 4, 0},{ 1, 9, 0},{ -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 5, 1, 2},
288 { -5, 1, 2},{ 2, 5, 0},{ -2, 5, 0},{ 1,11, 0},{ -1,11, 0},{ 2, 6, 0},
289 { -2, 6, 0},{ 1,12, 0},{ -1,12, 0},{ 3, 3, 1},{ -3, 3, 1},{ 6, 1, 2},
290 { -6, 1, 2},{ 4, 2, 2},{ -4, 2, 2},{ 1,13, 0},{ -1,13, 0},{ 2, 7, 0},
291 { -2, 7, 0},{ 3, 4, 1},{ -3, 4, 1},{ 1,14, 0},{ -1,14, 0}
292 },
293 //level_add
294 { 0, 7, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,-1,
295 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
296 2, //golomb_order
297 2, //inc_limit
298 14 //max_run
299 },{
300 { //level / run
301 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},
302 { -1, 2, 0},{ 3, 1, 0},{ -3, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 2, 2, 0},
303 { -2, 2, 0},{ 4, 1, 1},{ -4, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 1},
304 { -5, 1, 1},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 0},{ -3, 2, 0},{ 2, 3, 0},
305 { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 1},{ -6, 1, 1},{ 2, 4, 0},
306 { -2, 4, 0},{ 1, 7, 0},{ -1, 7, 0},{ 4, 2, 1},{ -4, 2, 1},{ 7, 1, 2},
307 { -7, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 1, 8, 0},{ -1, 8, 0},{ 2, 5, 0},
308 { -2, 5, 0},{ 8, 1, 2},{ -8, 1, 2},{ 1, 9, 0},{ -1, 9, 0},{ 3, 4, 0},
309 { -3, 4, 0},{ 2, 6, 0},{ -2, 6, 0},{ 5, 2, 1},{ -5, 2, 1},{ 1,10, 0},
310 { -1,10, 0},{ 9, 1, 2},{ -9, 1, 2},{ 4, 3, 1},{ -4, 3, 1}
311 },
312 //level_add
313 { 0,10, 6, 5, 4, 3, 3, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,
314 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
315 2, //golomb_order
316 3, //inc_limit
317 10 //max_run
318 },{
319 { //level / run
320 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
321 { -3, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},
322 { -5, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 1, 3, 0},{ -1, 3, 0},{ 6, 1, 0},
323 { -6, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 7, 1, 1},{ -7, 1, 1},{ 1, 4, 0},
324 { -1, 4, 0},{ 8, 1, 1},{ -8, 1, 1},{ 2, 3, 0},{ -2, 3, 0},{ 4, 2, 0},
325 { -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 9, 1, 1},{ -9, 1, 1},{ 5, 2, 0},
326 { -5, 2, 0},{ 2, 4, 0},{ -2, 4, 0},{ 1, 6, 0},{ -1, 6, 0},{ 10, 1, 2},
327 {-10, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 11, 1, 2},{-11, 1, 2},{ 1, 7, 0},
328 { -1, 7, 0},{ 6, 2, 0},{ -6, 2, 0},{ 3, 4, 0},{ -3, 4, 0},{ 2, 5, 0},
329 { -2, 5, 0},{ 12, 1, 2},{-12, 1, 2},{ 4, 3, 0},{ -4, 3, 0}
330 },
331 //level_add
332 { 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,
333 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
334 2, //golomb_order
335 6, //inc_limit
336 7 //max_run
337 },{
338 { //level / run
339 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
340 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 1, 2, 0},
341 { -1, 2, 0},{ 6, 1, 0},{ -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},
342 { -8, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 9, 1, 0},{ -9, 1, 0},{ 1, 3, 0},
343 { -1, 3, 0},{ 10, 1, 1},{-10, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 11, 1, 1},
344 {-11, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 12, 1, 1},{-12, 1, 1},{ 1, 4, 0},
345 { -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 13, 1, 1},{-13, 1, 1},{ 5, 2, 0},
346 { -5, 2, 0},{ 14, 1, 1},{-14, 1, 1},{ 6, 2, 0},{ -6, 2, 0},{ 1, 5, 0},
347 { -1, 5, 0},{ 15, 1, 1},{-15, 1, 1},{ 3, 3, 0},{ -3, 3, 0},{ 16, 1, 1},
348 {-16, 1, 1},{ 2, 4, 0},{ -2, 4, 0},{ 7, 2, 0},{ -7, 2, 0}
349 },
350 //level_add
351 { 0,17, 8, 4, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
352 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
353 2, //golomb_order
354 9, //inc_limit
355 5 //max_run
356 },{
357 { //level / run
358 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
359 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
360 { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 8, 1, 0},
361 { -8, 1, 0},{ 9, 1, 0},{ -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},
362 {-11, 1, 0},{ 12, 1, 0},{-12, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 13, 1, 0},
363 {-13, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 14, 1, 0},{-14, 1, 0},{ 15, 1, 0},
364 {-15, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 16, 1, 0},{-16, 1, 0},{ 17, 1, 0},
365 {-17, 1, 0},{ 18, 1, 0},{-18, 1, 0},{ 4, 2, 0},{ -4, 2, 0},{ 19, 1, 0},
366 {-19, 1, 0},{ 20, 1, 0},{-20, 1, 0},{ 2, 3, 0},{ -2, 3, 0},{ 1, 4, 0},
367 { -1, 4, 0},{ 5, 2, 0},{ -5, 2, 0},{ 21, 1, 0},{-21, 1, 0}
368 },
369 //level_add
370 { 0,22, 6, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
371 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
372 2, //golomb_order
373 INT_MAX, //inc_limit
374 4 //max_run
375 }
376};
377
378const struct dec_2dvlc ff_cavs_chroma_dec[5] = {
379 {
380 { //level / run
381 { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
382 { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
383 { 1, 7, 1},{ -1, 7, 1},{ 2, 1, 2},{ -2, 1, 2},{ 1, 8, 1},{ -1, 8, 1},
384 { 1, 9, 1},{ -1, 9, 1},{ 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},
385 { 1,12, 1},{ -1,12, 1},{ 1,13, 1},{ -1,13, 1},{ 1,14, 1},{ -1,14, 1},
386 { 1,15, 1},{ -1,15, 1},{ 3, 1, 3},{ -3, 1, 3},{ 1,16, 1},{ -1,16, 1},
387 { 1,17, 1},{ -1,17, 1},{ 1,18, 1},{ -1,18, 1},{ 1,19, 1},{ -1,19, 1},
388 { 1,20, 1},{ -1,20, 1},{ 1,21, 1},{ -1,21, 1},{ 1,22, 1},{ -1,22, 1},
389 { 2, 2, 2},{ -2, 2, 2},{ 1,23, 1},{ -1,23, 1},{ 1,24, 1},{ -1,24, 1},
390 { 1,25, 1},{ -1,25, 1},{ 4, 1, 3},{ -4, 1, 3},{ EOB }
391 },
392 //level_add
393 { 0, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2,-1},
395 2, //golomb_order
396 0, //inc_limit
397 25 //max_run
398 },{
399 { //level / run
400 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 1},
401 { -2, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},
402 { -1, 5, 0},{ 1, 6, 0},{ -1, 6, 0},{ 3, 1, 2},{ -3, 1, 2},{ 1, 7, 0},
403 { -1, 7, 0},{ 1, 8, 0},{ -1, 8, 0},{ 2, 2, 1},{ -2, 2, 1},{ 1, 9, 0},
404 { -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 4, 1, 2},
405 { -4, 1, 2},{ 1,12, 0},{ -1,12, 0},{ 1,13, 0},{ -1,13, 0},{ 1,14, 0},
406 { -1,14, 0},{ 2, 3, 1},{ -2, 3, 1},{ 1,15, 0},{ -1,15, 0},{ 2, 4, 1},
407 { -2, 4, 1},{ 5, 1, 3},{ -5, 1, 3},{ 3, 2, 2},{ -3, 2, 2},{ 1,16, 0},
408 { -1,16, 0},{ 1,17, 0},{ -1,17, 0},{ 1,18, 0},{ -1,18, 0},{ 2, 5, 1},
409 { -2, 5, 1},{ 1,19, 0},{ -1,19, 0},{ 1,20, 0},{ -1,20, 0}
410 },
411 //level_add
412 { 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2,-1,-1,-1,-1,-1,-1},
414 0, //golomb_order
415 1, //inc_limit
416 20 //max_run
417 },{
418 { //level / run
419 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},
420 { -1, 2, 0},{ 3, 1, 1},{ -3, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 4, 1, 1},
421 { -4, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 2},
422 { -5, 1, 2},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 3, 0},
423 { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 2},{ -6, 1, 2},{ 1, 7, 0},
424 { -1, 7, 0},{ 2, 4, 0},{ -2, 4, 0},{ 7, 1, 2},{ -7, 1, 2},{ 1, 8, 0},
425 { -1, 8, 0},{ 4, 2, 1},{ -4, 2, 1},{ 1, 9, 0},{ -1, 9, 0},{ 3, 3, 1},
426 { -3, 3, 1},{ 2, 5, 0},{ -2, 5, 0},{ 2, 6, 0},{ -2, 6, 0},{ 8, 1, 2},
427 { -8, 1, 2},{ 1,10, 0},{ -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 9, 1, 2},
428 { -9, 1, 2},{ 5, 2, 2},{ -5, 2, 2},{ 3, 4, 1},{ -3, 4, 1},
429 },
430 //level_add
431 { 0,10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,
432 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
433 1, //golomb_order
434 2, //inc_limit
435 11 //max_run
436 },{
437 { //level / run
438 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
439 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 5, 1, 1},
440 { -5, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 6, 1, 1},{ -6, 1, 1},{ 1, 3, 0},
441 { -1, 3, 0},{ 7, 1, 1},{ -7, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 8, 1, 1},
442 { -8, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 9, 1, 1},
443 { -9, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 10, 1, 1},
444 {-10, 1, 1},{ 3, 3, 0},{ -3, 3, 0},{ 5, 2, 1},{ -5, 2, 1},{ 2, 4, 0},
445 { -2, 4, 0},{ 11, 1, 1},{-11, 1, 1},{ 1, 6, 0},{ -1, 6, 0},{ 12, 1, 1},
446 {-12, 1, 1},{ 1, 7, 0},{ -1, 7, 0},{ 6, 2, 1},{ -6, 2, 1},{ 13, 1, 1},
447 {-13, 1, 1},{ 2, 5, 0},{ -2, 5, 0},{ 1, 8, 0},{ -1, 8, 0},
448 },
449 //level_add
450 { 0,14, 7, 4, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,
451 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
452 1, //golomb_order
453 4, //inc_limit
454 8 //max_run
455 },{
456 { //level / run
457 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
458 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
459 { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 1, 2, 0},
460 { -1, 2, 0},{ 9, 1, 0},{ -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},
461 {-11, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 12, 1, 0},{-12, 1, 0},{ 13, 1, 0},
462 {-13, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 14, 1, 0},{-14, 1, 0},{ 1, 3, 0},
463 { -1, 3, 0},{ 15, 1, 0},{-15, 1, 0},{ 4, 2, 0},{ -4, 2, 0},{ 16, 1, 0},
464 {-16, 1, 0},{ 17, 1, 0},{-17, 1, 0},{ 5, 2, 0},{ -5, 2, 0},{ 1, 4, 0},
465 { -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 18, 1, 0},{-18, 1, 0},{ 6, 2, 0},
466 { -6, 2, 0},{ 19, 1, 0},{-19, 1, 0},{ 1, 5, 0},{ -1, 5, 0},
467 },
468 //level_add
469 { 0,20, 7, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
470 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
471 0, //golomb_order
472 INT_MAX, //inc_limit
473 5, //max_run
474 }
475};
476
477#undef EOB
478
479static const uint8_t alpha_tab[64] = {
480 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3,
481 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 18, 20,
482 22, 24, 26, 28, 30, 33, 33, 35, 35, 36, 37, 37, 39, 39, 42, 44,
483 46, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
484};
485
486static const uint8_t beta_tab[64] = {
487 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
488 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,
489 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14,
490 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27
491};
492
493static const uint8_t tc_tab[64] = {
494 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
495 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
496 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
497 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
498};
499
500const int8_t ff_left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 };
501const int8_t ff_top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 };
502const int8_t ff_left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 };
503const int8_t ff_top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 };
504
505#endif /* AVCODEC_CAVSDATA_H */67#endif /* AVCODEC_CAVSDATA_H */
libavcodec/cavsdec.c+418−10
@@ -46,6 +46,414 @@ static const uint8_t cbp_tab[64][2] = { · 45 unmodified lines
46 {34,50},{50,56},{52,25},{54,22},{41,54},{56,57},{38,41},{57,38}46 {34,50},{50,56},{52,25},{54,22},{41,54},{56,57},{38,41},{57,38}
47};47};
48 48
49static const uint8_t scan3x3[4] = { 4, 5, 7, 8 };
50
51static const uint8_t cavs_chroma_qp[64] = {
52 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
53 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
54 32,33,34,35,36,37,38,39,40,41,42,42,43,43,44,44,
55 45,45,46,46,47,47,48,48,48,49,49,49,50,50,50,51
56};
57
58static const uint8_t dequant_shift[64] = {
59 14,14,14,14,14,14,14,14,
60 13,13,13,13,13,13,13,13,
61 13,12,12,12,12,12,12,12,
62 11,11,11,11,11,11,11,11,
63 11,10,10,10,10,10,10,10,
64 10, 9, 9, 9, 9, 9, 9, 9,
65 9, 8, 8, 8, 8, 8, 8, 8,
66 7, 7, 7, 7, 7, 7, 7, 7
67};
68
69static const uint16_t dequant_mul[64] = {
70 32768,36061,38968,42495,46341,50535,55437,60424,
71 32932,35734,38968,42495,46177,50535,55109,59933,
72 65535,35734,38968,42577,46341,50617,55027,60097,
73 32809,35734,38968,42454,46382,50576,55109,60056,
74 65535,35734,38968,42495,46320,50515,55109,60076,
75 65535,35744,38968,42495,46341,50535,55099,60087,
76 65535,35734,38973,42500,46341,50535,55109,60097,
77 32771,35734,38965,42497,46341,50535,55109,60099
78};
79
80#define EOB 0,0,0
81
82static const struct dec_2dvlc intra_dec[7] = {
83 {
84 { //level / run / table_inc
85 { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
86 { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
87 { 1, 7, 1},{ -1, 7, 1},{ 1, 8, 1},{ -1, 8, 1},{ 1, 9, 1},{ -1, 9, 1},
88 { 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},{ 2, 1, 2},{ -2, 1, 2},
89 { 1,12, 1},{ -1,12, 1},{ 1,13, 1},{ -1,13, 1},{ 1,14, 1},{ -1,14, 1},
90 { 1,15, 1},{ -1,15, 1},{ 2, 2, 2},{ -2, 2, 2},{ 1,16, 1},{ -1,16, 1},
91 { 1,17, 1},{ -1,17, 1},{ 3, 1, 3},{ -3, 1, 3},{ 1,18, 1},{ -1,18, 1},
92 { 1,19, 1},{ -1,19, 1},{ 2, 3, 2},{ -2, 3, 2},{ 1,20, 1},{ -1,20, 1},
93 { 1,21, 1},{ -1,21, 1},{ 2, 4, 2},{ -2, 4, 2},{ 1,22, 1},{ -1,22, 1},
94 { 2, 5, 2},{ -2, 5, 2},{ 1,23, 1},{ -1,23, 1},{ EOB }
95 },
96 //level_add
97 { 0, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
98 2, 2, 2, 2, 2, 2, 2,-1,-1,-1},
99 2, //golomb_order
100 0, //inc_limit
101 23, //max_run
102 },{
103 { //level / run
104 { 1, 1, 0},{ -1, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 1},{ -2, 1, 1},
105 { 1, 3, 0},{ -1, 3, 0},{ EOB },{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},
106 { -1, 5, 0},{ 1, 6, 0},{ -1, 6, 0},{ 3, 1, 2},{ -3, 1, 2},{ 2, 2, 1},
107 { -2, 2, 1},{ 1, 7, 0},{ -1, 7, 0},{ 1, 8, 0},{ -1, 8, 0},{ 1, 9, 0},
108 { -1, 9, 0},{ 2, 3, 1},{ -2, 3, 1},{ 4, 1, 2},{ -4, 1, 2},{ 1,10, 0},
109 { -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 2, 4, 1},{ -2, 4, 1},{ 3, 2, 2},
110 { -3, 2, 2},{ 1,12, 0},{ -1,12, 0},{ 2, 5, 1},{ -2, 5, 1},{ 5, 1, 3},
111 { -5, 1, 3},{ 1,13, 0},{ -1,13, 0},{ 2, 6, 1},{ -2, 6, 1},{ 1,14, 0},
112 { -1,14, 0},{ 2, 7, 1},{ -2, 7, 1},{ 2, 8, 1},{ -2, 8, 1},{ 3, 3, 2},
113 { -3, 3, 2},{ 6, 1, 3},{ -6, 1, 3},{ 1,15, 0},{ -1,15, 0}
114 },
115 //level_add
116 { 0, 7, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,
117 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
118 2, //golomb_order
119 1, //inc_limit
120 15, //max_run
121 },{
122 { //level / run
123 { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},{ -1, 2, 0},
124 { 3, 1, 1},{ -3, 1, 1},{ EOB },{ 1, 3, 0},{ -1, 3, 0},{ 2, 2, 0},
125 { -2, 2, 0},{ 4, 1, 1},{ -4, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 2},
126 { -5, 1, 2},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 3, 0},
127 { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 2},{ -6, 1, 2},{ 2, 4, 0},
128 { -2, 4, 0},{ 1, 7, 0},{ -1, 7, 0},{ 4, 2, 1},{ -4, 2, 1},{ 7, 1, 2},
129 { -7, 1, 2},{ 3, 3, 1},{ -3, 3, 1},{ 2, 5, 0},{ -2, 5, 0},{ 1, 8, 0},
130 { -1, 8, 0},{ 2, 6, 0},{ -2, 6, 0},{ 8, 1, 3},{ -8, 1, 3},{ 1, 9, 0},
131 { -1, 9, 0},{ 5, 2, 2},{ -5, 2, 2},{ 3, 4, 1},{ -3, 4, 1},{ 2, 7, 0},
132 { -2, 7, 0},{ 9, 1, 3},{ -9, 1, 3},{ 1,10, 0},{ -1,10, 0}
133 },
134 //level_add
135 { 0,10, 6, 4, 4, 3, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,
136 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
137 2, //golomb_order
138 2, //inc_limit
139 10, //max_run
140 },{
141 { //level / run
142 { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},{ -3, 1, 0},
143 { 1, 2, 0},{ -1, 2, 0},{ EOB },{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 1},
144 { -5, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 3, 0},{ -1, 3, 0},{ 6, 1, 1},
145 { -6, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 7, 1, 1},{ -7, 1, 1},{ 1, 4, 0},
146 { -1, 4, 0},{ 8, 1, 2},{ -8, 1, 2},{ 2, 3, 0},{ -2, 3, 0},{ 4, 2, 0},
147 { -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 9, 1, 2},{ -9, 1, 2},{ 5, 2, 1},
148 { -5, 2, 1},{ 2, 4, 0},{ -2, 4, 0},{ 10, 1, 2},{-10, 1, 2},{ 3, 3, 0},
149 { -3, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 11, 1, 3},{-11, 1, 3},{ 6, 2, 1},
150 { -6, 2, 1},{ 1, 7, 0},{ -1, 7, 0},{ 2, 5, 0},{ -2, 5, 0},{ 3, 4, 0},
151 { -3, 4, 0},{ 12, 1, 3},{-12, 1, 3},{ 4, 3, 0},{ -4, 3, 0}
152 },
153 //level_add
154 { 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1 -1,-1,-1,-1,-1,-1,
155 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
156 2, //golomb_order
157 4, //inc_limit
158 7, //max_run
159 },{
160 { //level / run
161 { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},{ -3, 1, 0},
162 { EOB },{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
163 { -6, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 1},
164 { -8, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 9, 1, 1},{ -9, 1, 1},{ 10, 1, 1},
165 {-10, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 3, 2, 0},{ -3, 2, 0},{ 11, 1, 2},
166 {-11, 1, 2},{ 4, 2, 0},{ -4, 2, 0},{ 12, 1, 2},{-12, 1, 2},{ 13, 1, 2},
167 {-13, 1, 2},{ 5, 2, 0},{ -5, 2, 0},{ 1, 4, 0},{ -1, 4, 0},{ 2, 3, 0},
168 { -2, 3, 0},{ 14, 1, 2},{-14, 1, 2},{ 6, 2, 0},{ -6, 2, 0},{ 15, 1, 2},
169 {-15, 1, 2},{ 16, 1, 2},{-16, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 1, 5, 0},
170 { -1, 5, 0},{ 7, 2, 0},{ -7, 2, 0},{ 17, 1, 2},{-17, 1, 2}
171 },
172 //level_add
173 { 0,18, 8, 4, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
174 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
175 2, //golomb_order
176 7, //inc_limit
177 5, //max_run
178 },{
179 { //level / run
180 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
181 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
182 { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 9, 1, 0},
183 { -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 11, 1, 1},
184 {-11, 1, 1},{ 12, 1, 1},{-12, 1, 1},{ 13, 1, 1},{-13, 1, 1},{ 2, 2, 0},
185 { -2, 2, 0},{ 14, 1, 1},{-14, 1, 1},{ 15, 1, 1},{-15, 1, 1},{ 3, 2, 0},
186 { -3, 2, 0},{ 16, 1, 1},{-16, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 17, 1, 1},
187 {-17, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 18, 1, 1},{-18, 1, 1},{ 5, 2, 0},
188 { -5, 2, 0},{ 19, 1, 1},{-19, 1, 1},{ 20, 1, 1},{-20, 1, 1},{ 6, 2, 0},
189 { -6, 2, 0},{ 21, 1, 1},{-21, 1, 1},{ 2, 3, 0},{ -2, 3, 0}
190 },
191 //level_add
192 { 0,22, 7, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
193 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
194 2, //golomb_order
195 10, //inc_limit
196 3, //max_run
197 },{
198 { //level / run
199 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
200 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
201 { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 9, 1, 0},
202 { -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},{-11, 1, 0},{ 12, 1, 0},
203 {-12, 1, 0},{ 13, 1, 0},{-13, 1, 0},{ 14, 1, 0},{-14, 1, 0},{ 15, 1, 0},
204 {-15, 1, 0},{ 16, 1, 0},{-16, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 17, 1, 0},
205 {-17, 1, 0},{ 18, 1, 0},{-18, 1, 0},{ 19, 1, 0},{-19, 1, 0},{ 20, 1, 0},
206 {-20, 1, 0},{ 21, 1, 0},{-21, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 22, 1, 0},
207 {-22, 1, 0},{ 23, 1, 0},{-23, 1, 0},{ 24, 1, 0},{-24, 1, 0},{ 25, 1, 0},
208 {-25, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 26, 1, 0},{-26, 1, 0}
209 },
210 //level_add
211 { 0,27, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
212 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
213 2, //golomb_order
214 INT_MAX, //inc_limit
215 2, //max_run
216 }
217};
218
219static const struct dec_2dvlc inter_dec[7] = {
220 {
221 { //level / run
222 { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
223 { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
224 { 1, 7, 1},{ -1, 7, 1},{ 1, 8, 1},{ -1, 8, 1},{ 1, 9, 1},{ -1, 9, 1},
225 { 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},{ 1,12, 1},{ -1,12, 1},
226 { 1,13, 1},{ -1,13, 1},{ 2, 1, 2},{ -2, 1, 2},{ 1,14, 1},{ -1,14, 1},
227 { 1,15, 1},{ -1,15, 1},{ 1,16, 1},{ -1,16, 1},{ 1,17, 1},{ -1,17, 1},
228 { 1,18, 1},{ -1,18, 1},{ 1,19, 1},{ -1,19, 1},{ 3, 1, 3},{ -3, 1, 3},
229 { 1,20, 1},{ -1,20, 1},{ 1,21, 1},{ -1,21, 1},{ 2, 2, 2},{ -2, 2, 2},
230 { 1,22, 1},{ -1,22, 1},{ 1,23, 1},{ -1,23, 1},{ 1,24, 1},{ -1,24, 1},
231 { 1,25, 1},{ -1,25, 1},{ 1,26, 1},{ -1,26, 1},{ EOB }
232 },
233 //level_add
234 { 0, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
235 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
236 3, //golomb_order
237 0, //inc_limit
238 26 //max_run
239 },{
240 { //level / run
241 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 1, 2, 0},{ -1, 2, 0},{ 1, 3, 0},
242 { -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},{ -1, 5, 0},{ 1, 6, 0},
243 { -1, 6, 0},{ 2, 1, 1},{ -2, 1, 1},{ 1, 7, 0},{ -1, 7, 0},{ 1, 8, 0},
244 { -1, 8, 0},{ 1, 9, 0},{ -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 2, 2, 1},
245 { -2, 2, 1},{ 1,11, 0},{ -1,11, 0},{ 1,12, 0},{ -1,12, 0},{ 3, 1, 2},
246 { -3, 1, 2},{ 1,13, 0},{ -1,13, 0},{ 1,14, 0},{ -1,14, 0},{ 2, 3, 1},
247 { -2, 3, 1},{ 1,15, 0},{ -1,15, 0},{ 2, 4, 1},{ -2, 4, 1},{ 1,16, 0},
248 { -1,16, 0},{ 2, 5, 1},{ -2, 5, 1},{ 1,17, 0},{ -1,17, 0},{ 4, 1, 3},
249 { -4, 1, 3},{ 2, 6, 1},{ -2, 6, 1},{ 1,18, 0},{ -1,18, 0},{ 1,19, 0},
250 { -1,19, 0},{ 2, 7, 1},{ -2, 7, 1},{ 3, 2, 2},{ -3, 2, 2}
251 },
252 //level_add
253 { 0, 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
254 2, 2, 2,-1,-1,-1,-1,-1,-1,-1},
255 2, //golomb_order
256 1, //inc_limit
257 19 //max_run
258 },{
259 { //level / run
260 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 0},
261 { -2, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 3, 1, 1},
262 { -3, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 1, 6, 0},
263 { -1, 6, 0},{ 1, 7, 0},{ -1, 7, 0},{ 2, 3, 0},{ -2, 3, 0},{ 4, 1, 2},
264 { -4, 1, 2},{ 1, 8, 0},{ -1, 8, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 4, 0},
265 { -2, 4, 0},{ 1, 9, 0},{ -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 5, 1, 2},
266 { -5, 1, 2},{ 2, 5, 0},{ -2, 5, 0},{ 1,11, 0},{ -1,11, 0},{ 2, 6, 0},
267 { -2, 6, 0},{ 1,12, 0},{ -1,12, 0},{ 3, 3, 1},{ -3, 3, 1},{ 6, 1, 2},
268 { -6, 1, 2},{ 4, 2, 2},{ -4, 2, 2},{ 1,13, 0},{ -1,13, 0},{ 2, 7, 0},
269 { -2, 7, 0},{ 3, 4, 1},{ -3, 4, 1},{ 1,14, 0},{ -1,14, 0}
270 },
271 //level_add
272 { 0, 7, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,-1,
273 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
274 2, //golomb_order
275 2, //inc_limit
276 14 //max_run
277 },{
278 { //level / run
279 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},
280 { -1, 2, 0},{ 3, 1, 0},{ -3, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 2, 2, 0},
281 { -2, 2, 0},{ 4, 1, 1},{ -4, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 1},
282 { -5, 1, 1},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 0},{ -3, 2, 0},{ 2, 3, 0},
283 { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 1},{ -6, 1, 1},{ 2, 4, 0},
284 { -2, 4, 0},{ 1, 7, 0},{ -1, 7, 0},{ 4, 2, 1},{ -4, 2, 1},{ 7, 1, 2},
285 { -7, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 1, 8, 0},{ -1, 8, 0},{ 2, 5, 0},
286 { -2, 5, 0},{ 8, 1, 2},{ -8, 1, 2},{ 1, 9, 0},{ -1, 9, 0},{ 3, 4, 0},
287 { -3, 4, 0},{ 2, 6, 0},{ -2, 6, 0},{ 5, 2, 1},{ -5, 2, 1},{ 1,10, 0},
288 { -1,10, 0},{ 9, 1, 2},{ -9, 1, 2},{ 4, 3, 1},{ -4, 3, 1}
289 },
290 //level_add
291 { 0,10, 6, 5, 4, 3, 3, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,
292 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
293 2, //golomb_order
294 3, //inc_limit
295 10 //max_run
296 },{
297 { //level / run
298 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
299 { -3, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},
300 { -5, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 1, 3, 0},{ -1, 3, 0},{ 6, 1, 0},
301 { -6, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 7, 1, 1},{ -7, 1, 1},{ 1, 4, 0},
302 { -1, 4, 0},{ 8, 1, 1},{ -8, 1, 1},{ 2, 3, 0},{ -2, 3, 0},{ 4, 2, 0},
303 { -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 9, 1, 1},{ -9, 1, 1},{ 5, 2, 0},
304 { -5, 2, 0},{ 2, 4, 0},{ -2, 4, 0},{ 1, 6, 0},{ -1, 6, 0},{ 10, 1, 2},
305 {-10, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 11, 1, 2},{-11, 1, 2},{ 1, 7, 0},
306 { -1, 7, 0},{ 6, 2, 0},{ -6, 2, 0},{ 3, 4, 0},{ -3, 4, 0},{ 2, 5, 0},
307 { -2, 5, 0},{ 12, 1, 2},{-12, 1, 2},{ 4, 3, 0},{ -4, 3, 0}
308 },
309 //level_add
310 { 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,
311 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
312 2, //golomb_order
313 6, //inc_limit
314 7 //max_run
315 },{
316 { //level / run
317 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
318 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 1, 2, 0},
319 { -1, 2, 0},{ 6, 1, 0},{ -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},
320 { -8, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 9, 1, 0},{ -9, 1, 0},{ 1, 3, 0},
321 { -1, 3, 0},{ 10, 1, 1},{-10, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 11, 1, 1},
322 {-11, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 12, 1, 1},{-12, 1, 1},{ 1, 4, 0},
323 { -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 13, 1, 1},{-13, 1, 1},{ 5, 2, 0},
324 { -5, 2, 0},{ 14, 1, 1},{-14, 1, 1},{ 6, 2, 0},{ -6, 2, 0},{ 1, 5, 0},
325 { -1, 5, 0},{ 15, 1, 1},{-15, 1, 1},{ 3, 3, 0},{ -3, 3, 0},{ 16, 1, 1},
326 {-16, 1, 1},{ 2, 4, 0},{ -2, 4, 0},{ 7, 2, 0},{ -7, 2, 0}
327 },
328 //level_add
329 { 0,17, 8, 4, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
330 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
331 2, //golomb_order
332 9, //inc_limit
333 5 //max_run
334 },{
335 { //level / run
336 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
337 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
338 { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 8, 1, 0},
339 { -8, 1, 0},{ 9, 1, 0},{ -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},
340 {-11, 1, 0},{ 12, 1, 0},{-12, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 13, 1, 0},
341 {-13, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 14, 1, 0},{-14, 1, 0},{ 15, 1, 0},
342 {-15, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 16, 1, 0},{-16, 1, 0},{ 17, 1, 0},
343 {-17, 1, 0},{ 18, 1, 0},{-18, 1, 0},{ 4, 2, 0},{ -4, 2, 0},{ 19, 1, 0},
344 {-19, 1, 0},{ 20, 1, 0},{-20, 1, 0},{ 2, 3, 0},{ -2, 3, 0},{ 1, 4, 0},
345 { -1, 4, 0},{ 5, 2, 0},{ -5, 2, 0},{ 21, 1, 0},{-21, 1, 0}
346 },
347 //level_add
348 { 0,22, 6, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
349 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
350 2, //golomb_order
351 INT_MAX, //inc_limit
352 4 //max_run
353 }
354};
355
356static const struct dec_2dvlc chroma_dec[5] = {
357 {
358 { //level / run
359 { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
360 { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
361 { 1, 7, 1},{ -1, 7, 1},{ 2, 1, 2},{ -2, 1, 2},{ 1, 8, 1},{ -1, 8, 1},
362 { 1, 9, 1},{ -1, 9, 1},{ 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},
363 { 1,12, 1},{ -1,12, 1},{ 1,13, 1},{ -1,13, 1},{ 1,14, 1},{ -1,14, 1},
364 { 1,15, 1},{ -1,15, 1},{ 3, 1, 3},{ -3, 1, 3},{ 1,16, 1},{ -1,16, 1},
365 { 1,17, 1},{ -1,17, 1},{ 1,18, 1},{ -1,18, 1},{ 1,19, 1},{ -1,19, 1},
366 { 1,20, 1},{ -1,20, 1},{ 1,21, 1},{ -1,21, 1},{ 1,22, 1},{ -1,22, 1},
367 { 2, 2, 2},{ -2, 2, 2},{ 1,23, 1},{ -1,23, 1},{ 1,24, 1},{ -1,24, 1},
368 { 1,25, 1},{ -1,25, 1},{ 4, 1, 3},{ -4, 1, 3},{ EOB }
369 },
370 //level_add
371 { 0, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
372 2, 2, 2, 2, 2, 2, 2, 2, 2,-1},
373 2, //golomb_order
374 0, //inc_limit
375 25 //max_run
376 },{
377 { //level / run
378 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 1},
379 { -2, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},
380 { -1, 5, 0},{ 1, 6, 0},{ -1, 6, 0},{ 3, 1, 2},{ -3, 1, 2},{ 1, 7, 0},
381 { -1, 7, 0},{ 1, 8, 0},{ -1, 8, 0},{ 2, 2, 1},{ -2, 2, 1},{ 1, 9, 0},
382 { -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 4, 1, 2},
383 { -4, 1, 2},{ 1,12, 0},{ -1,12, 0},{ 1,13, 0},{ -1,13, 0},{ 1,14, 0},
384 { -1,14, 0},{ 2, 3, 1},{ -2, 3, 1},{ 1,15, 0},{ -1,15, 0},{ 2, 4, 1},
385 { -2, 4, 1},{ 5, 1, 3},{ -5, 1, 3},{ 3, 2, 2},{ -3, 2, 2},{ 1,16, 0},
386 { -1,16, 0},{ 1,17, 0},{ -1,17, 0},{ 1,18, 0},{ -1,18, 0},{ 2, 5, 1},
387 { -2, 5, 1},{ 1,19, 0},{ -1,19, 0},{ 1,20, 0},{ -1,20, 0}
388 },
389 //level_add
390 { 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2,-1,-1,-1,-1,-1,-1},
392 0, //golomb_order
393 1, //inc_limit
394 20 //max_run
395 },{
396 { //level / run
397 { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},
398 { -1, 2, 0},{ 3, 1, 1},{ -3, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 4, 1, 1},
399 { -4, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 2},
400 { -5, 1, 2},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 3, 0},
401 { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 2},{ -6, 1, 2},{ 1, 7, 0},
402 { -1, 7, 0},{ 2, 4, 0},{ -2, 4, 0},{ 7, 1, 2},{ -7, 1, 2},{ 1, 8, 0},
403 { -1, 8, 0},{ 4, 2, 1},{ -4, 2, 1},{ 1, 9, 0},{ -1, 9, 0},{ 3, 3, 1},
404 { -3, 3, 1},{ 2, 5, 0},{ -2, 5, 0},{ 2, 6, 0},{ -2, 6, 0},{ 8, 1, 2},
405 { -8, 1, 2},{ 1,10, 0},{ -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 9, 1, 2},
406 { -9, 1, 2},{ 5, 2, 2},{ -5, 2, 2},{ 3, 4, 1},{ -3, 4, 1},
407 },
408 //level_add
409 { 0,10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,
410 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
411 1, //golomb_order
412 2, //inc_limit
413 11 //max_run
414 },{
415 { //level / run
416 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
417 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 5, 1, 1},
418 { -5, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 6, 1, 1},{ -6, 1, 1},{ 1, 3, 0},
419 { -1, 3, 0},{ 7, 1, 1},{ -7, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 8, 1, 1},
420 { -8, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 9, 1, 1},
421 { -9, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 10, 1, 1},
422 {-10, 1, 1},{ 3, 3, 0},{ -3, 3, 0},{ 5, 2, 1},{ -5, 2, 1},{ 2, 4, 0},
423 { -2, 4, 0},{ 11, 1, 1},{-11, 1, 1},{ 1, 6, 0},{ -1, 6, 0},{ 12, 1, 1},
424 {-12, 1, 1},{ 1, 7, 0},{ -1, 7, 0},{ 6, 2, 1},{ -6, 2, 1},{ 13, 1, 1},
425 {-13, 1, 1},{ 2, 5, 0},{ -2, 5, 0},{ 1, 8, 0},{ -1, 8, 0},
426 },
427 //level_add
428 { 0,14, 7, 4, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,
429 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
430 1, //golomb_order
431 4, //inc_limit
432 8 //max_run
433 },{
434 { //level / run
435 { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
436 { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
437 { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 1, 2, 0},
438 { -1, 2, 0},{ 9, 1, 0},{ -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},
439 {-11, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 12, 1, 0},{-12, 1, 0},{ 13, 1, 0},
440 {-13, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 14, 1, 0},{-14, 1, 0},{ 1, 3, 0},
441 { -1, 3, 0},{ 15, 1, 0},{-15, 1, 0},{ 4, 2, 0},{ -4, 2, 0},{ 16, 1, 0},
442 {-16, 1, 0},{ 17, 1, 0},{-17, 1, 0},{ 5, 2, 0},{ -5, 2, 0},{ 1, 4, 0},
443 { -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 18, 1, 0},{-18, 1, 0},{ 6, 2, 0},
444 { -6, 2, 0},{ 19, 1, 0},{-19, 1, 0},{ 1, 5, 0},{ -1, 5, 0},
445 },
446 //level_add
447 { 0,20, 7, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
448 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
449 0, //golomb_order
450 INT_MAX, //inc_limit
451 5, //max_run
452 }
453};
454
455#undef EOB
456
49/*****************************************************************************457/*****************************************************************************
50 *458 *
51 * motion vector prediction459 * motion vector prediction
@@ -142,8 +550,8 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb, · 90 unmodified lines
142 level_buf[i] = level;550 level_buf[i] = level;
143 run_buf[i] = run;551 run_buf[i] = run;
144 }552 }
145 if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp],553 if (dequant(h, level_buf, run_buf, block, dequant_mul[qp],
146 ff_cavs_dequant_shift[qp], i))554 dequant_shift[qp], i))
147 return -1;555 return -1;
148 h->cdsp.cavs_idct8_add(dst,block,stride);556 h->cdsp.cavs_idct8_add(dst,block,stride);
149 h->s.dsp.clear_block(block);557 h->s.dsp.clear_block(block);
@@ -153,11 +561,11 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb, · 3 unmodified lines
153 561
154static inline void decode_residual_chroma(AVSContext *h) {562static inline void decode_residual_chroma(AVSContext *h) {
155 if(h->cbp & (1<<4))563 if(h->cbp & (1<<4))
156 decode_residual_block(h,&h->s.gb,ff_cavs_chroma_dec,0,564 decode_residual_block(h, &h->s.gb, chroma_dec, 0,
157 ff_cavs_chroma_qp[h->qp],h->cu,h->c_stride);565 cavs_chroma_qp[h->qp], h->cu, h->c_stride);
158 if(h->cbp & (1<<5))566 if(h->cbp & (1<<5))
159 decode_residual_block(h,&h->s.gb,ff_cavs_chroma_dec,0,567 decode_residual_block(h, &h->s.gb, chroma_dec, 0,
160 ff_cavs_chroma_qp[h->qp],h->cv,h->c_stride);568 cavs_chroma_qp[h->qp], h->cv, h->c_stride);
161}569}
162 570
163static inline int decode_residual_inter(AVSContext *h) {571static inline int decode_residual_inter(AVSContext *h) {
@@ -176,7 +584,7 @@ static inline int decode_residual_inter(AVSContext *h) { · 12 unmodified lines
176 h->qp = (h->qp + get_se_golomb(&h->s.gb)) & 63;584 h->qp = (h->qp + get_se_golomb(&h->s.gb)) & 63;
177 for(block=0;block<4;block++)585 for(block=0;block<4;block++)
178 if(h->cbp & (1<<block))586 if(h->cbp & (1<<block))
179 decode_residual_block(h,&h->s.gb,ff_cavs_inter_dec,0,h->qp,587 decode_residual_block(h, &h->s.gb, inter_dec, 0, h->qp,
180 h->cy + h->luma_scan[block], h->l_stride);588 h->cy + h->luma_scan[block], h->l_stride);
181 decode_residual_chroma(h);589 decode_residual_chroma(h);
182 590
@@ -202,7 +610,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code) { · 19 unmodified lines
202 /* get intra prediction modes from stream */610 /* get intra prediction modes from stream */
203 for(block=0;block<4;block++) {611 for(block=0;block<4;block++) {
204 int nA,nB,predpred;612 int nA,nB,predpred;
205 int pos = ff_cavs_scan3x3[block];613 int pos = scan3x3[block];
206 614
207 nA = h->pred_mode_Y[pos-1];615 nA = h->pred_mode_Y[pos-1];
208 nB = h->pred_mode_Y[pos-3];616 nB = h->pred_mode_Y[pos-3];
@@ -237,10 +645,10 @@ static int decode_mb_i(AVSContext *h, int cbp_code) { · 28 unmodified lines
237 for(block=0;block<4;block++) {645 for(block=0;block<4;block++) {
238 d = h->cy + h->luma_scan[block];646 d = h->cy + h->luma_scan[block];
239 ff_cavs_load_intra_pred_luma(h, top, &left, block);647 ff_cavs_load_intra_pred_luma(h, top, &left, block);
240 h->intra_pred_l[h->pred_mode_Y[ff_cavs_scan3x3[block]]]648 h->intra_pred_l[h->pred_mode_Y[scan3x3[block]]]
241 (d, top, left, h->l_stride);649 (d, top, left, h->l_stride);
242 if(h->cbp & (1<<block))650 if(h->cbp & (1<<block))
243 decode_residual_block(h,gb,ff_cavs_intra_dec,1,h->qp,d,h->l_stride);651 decode_residual_block(h, gb, intra_dec, 1, h->qp, d, h->l_stride);
244 }652 }
245 653
246 /* chroma intra prediction */654 /* chroma intra prediction */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t