00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #define CABAC 1
00029
00030 #include "internal.h"
00031 #include "dsputil.h"
00032 #include "avcodec.h"
00033 #include "h264.h"
00034 #include "h264data.h"
00035 #include "h264_mvpred.h"
00036 #include "golomb.h"
00037
00038 #include "cabac.h"
00039 #if ARCH_X86
00040 #include "x86/h264_i386.h"
00041 #endif
00042
00043
00044 #include <assert.h>
00045
00046
00047
00048 static const int8_t cabac_context_init_I[1024][2] =
00049 {
00050
00051 { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
00052 { 2, 54 }, { 3, 74 }, { -28,127 }, { -23, 104 },
00053 { -6, 53 }, { -1, 54 }, { 7, 51 },
00054
00055
00056 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00057 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00058 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00059 { 0, 0 },
00060
00061
00062 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00063 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00064 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00065 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00066
00067
00068 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00069 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00070 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00071 { 0, 0 }, { 0, 0 },
00072
00073
00074 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
00075 { 0, 0 }, { 0, 0 },
00076
00077
00078 { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
00079 { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
00080 { 13, 41 }, { 3, 62 },
00081
00082
00083 { 0, 11 }, { 1, 55 }, { 0, 69 }, { -17, 127 },
00084 { -13, 102 },{ 0, 82 }, { -7, 74 }, { -21, 107 },
00085 { -27, 127 },{ -31, 127 },{ -24, 127 }, { -18, 95 },
00086 { -27, 127 },{ -21, 114 },{ -30, 127 }, { -17, 123 },
00087 { -12, 115 },{ -16, 122 },
00088
00089
00090 { -11, 115 },{ -12, 63 }, { -2, 68 }, { -15, 84 },
00091 { -13, 104 },{ -3, 70 }, { -8, 93 }, { -10, 90 },
00092 { -30, 127 },{ -1, 74 }, { -6, 97 }, { -7, 91 },
00093 { -20, 127 },{ -4, 56 }, { -5, 82 }, { -7, 76 },
00094 { -22, 125 },
00095
00096
00097 { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
00098 { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
00099 { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
00100 { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
00101 { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
00102 { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
00103 { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
00104 { 14, 62 }, { -13, 108 },{ -15, 100 },
00105
00106
00107 { -13, 101 },{ -13, 91 }, { -12, 94 }, { -10, 88 },
00108 { -16, 84 }, { -10, 86 }, { -7, 83 }, { -13, 87 },
00109 { -19, 94 }, { 1, 70 }, { 0, 72 }, { -5, 74 },
00110 { 18, 59 }, { -8, 102 }, { -15, 100 }, { 0, 95 },
00111 { -4, 75 }, { 2, 72 }, { -11, 75 }, { -3, 71 },
00112 { 15, 46 }, { -13, 69 }, { 0, 62 }, { 0, 65 },
00113 { 21, 37 }, { -15, 72 }, { 9, 57 }, { 16, 54 },
00114 { 0, 62 }, { 12, 72 },
00115
00116
00117 { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
00118 { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
00119 { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
00120 { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
00121 { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
00122 { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
00123 { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
00124 { 0, 89 }, { 26, -19 }, { 22, -17 },
00125
00126
00127 { 26, -17 }, { 30, -25 }, { 28, -20 }, { 33, -23 },
00128 { 37, -27 }, { 33, -23 }, { 40, -28 }, { 38, -17 },
00129 { 33, -11 }, { 40, -15 }, { 41, -6 }, { 38, 1 },
00130 { 41, 17 }, { 30, -6 }, { 27, 3 }, { 26, 22 },
00131 { 37, -16 }, { 35, -4 }, { 38, -8 }, { 38, -3 },
00132 { 37, 3 }, { 38, 5 }, { 42, 0 }, { 35, 16 },
00133 { 39, 22 }, { 14, 48 }, { 27, 37 }, { 21, 60 },
00134 { 12, 68 }, { 2, 97 },
00135
00136
00137 { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 },
00138 { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 },
00139 { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 },
00140 { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 },
00141 { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 },
00142 { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 },
00143 { -4, 65 },
00144
00145
00146 { -12, 73 }, { -8, 76 }, { -7, 80 }, { -9, 88 },
00147 { -17, 110 },{ -11, 97 }, { -20, 84 }, { -11, 79 },
00148 { -6, 73 }, { -4, 74 }, { -13, 86 }, { -13, 96 },
00149 { -11, 97 }, { -19, 117 },{ -8, 78 }, { -5, 33 },
00150 { -4, 48 }, { -2, 53 }, { -3, 62 }, { -13, 71 },
00151 { -10, 79 }, { -12, 86 }, { -13, 90 }, { -14, 97 },
00152
00153
00154 { 0, 0 },
00155
00156
00157 { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
00158 { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
00159 { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
00160 { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
00161 { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
00162 { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
00163 { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
00164 { 9, 64 }, { -12, 104 },{ -11, 97 },
00165
00166
00167 { -16, 96 }, { -7, 88 }, { -8, 85 }, { -7, 85 },
00168 { -9, 85 }, { -13, 88 }, { 4, 66 }, { -3, 77 },
00169 { -3, 76 }, { -6, 76 }, { 10, 58 }, { -1, 76 },
00170 { -1, 83 }, { -7, 99 }, { -14, 95 }, { 2, 95 },
00171 { 0, 76 }, { -5, 74 }, { 0, 70 }, { -11, 75 },
00172 { 1, 68 }, { 0, 65 }, { -14, 73 }, { 3, 62 },
00173 { 4, 62 }, { -1, 68 }, { -13, 75 }, { 11, 55 },
00174 { 5, 64 }, { 12, 70 },
00175
00176
00177 { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
00178 { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
00179 { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
00180 { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
00181 { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
00182 { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
00183 { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
00184 { -12, 109 },{ 36, -35 }, { 36, -34 },
00185
00186
00187 { 32, -26 }, { 37, -30 }, { 44, -32 }, { 34, -18 },
00188 { 34, -15 }, { 40, -15 }, { 33, -7 }, { 35, -5 },
00189 { 33, 0 }, { 38, 2 }, { 33, 13 }, { 23, 35 },
00190 { 13, 58 }, { 29, -3 }, { 26, 0 }, { 22, 30 },
00191 { 31, -7 }, { 35, -15 }, { 34, -3 }, { 34, 3 },
00192 { 36, -1 }, { 34, 5 }, { 32, 11 }, { 35, 5 },
00193 { 34, 12 }, { 39, 11 }, { 30, 29 }, { 34, 26 },
00194 { 29, 39 }, { 19, 66 },
00195
00196
00197 { 31, 21 }, { 31, 31 }, { 25, 50 },
00198 { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 },
00199 { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 },
00200 { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 },
00201 { -23, 68 }, { -24, 50 }, { -11, 74 }, { 23, -13 },
00202 { 26, -13 }, { 40, -15 }, { 49, -14 }, { 44, 3 },
00203 { 45, 6 }, { 44, 34 }, { 33, 54 }, { 19, 82 },
00204 { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 },
00205 { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 },
00206 { 0, 68 }, { -9, 92 },
00207
00208
00209 { -14, 106 }, { -13, 97 }, { -15, 90 }, { -12, 90 },
00210 { -18, 88 }, { -10, 73 }, { -9, 79 }, { -14, 86 },
00211 { -10, 73 }, { -10, 70 }, { -10, 69 }, { -5, 66 },
00212 { -9, 64 }, { -5, 58 }, { 2, 59 }, { 21, -10 },
00213 { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 },
00214 { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 },
00215
00216
00217 { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 },
00218 { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 },
00219 { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
00220 { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 },
00221 { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 },
00222 { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
00223 { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
00224 { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
00225 { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
00226 { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
00227 { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
00228 { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
00229 { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
00230 { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 },
00231 { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 },
00232 { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 },
00233 { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 },
00234 { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
00235 { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
00236 { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
00237 { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
00238 { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
00239 { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
00240 { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
00241 { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 },
00242 { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 },
00243 { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 },
00244 { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 },
00245 { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
00246 { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
00247 { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
00248 { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
00249 { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
00250 { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
00251 { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
00252 { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 },
00253 { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 },
00254 { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 },
00255 { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 },
00256 { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
00257 { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
00258 { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
00259 { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
00260 { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
00261 { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
00262 { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
00263 { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 },
00264 { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 },
00265 { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 },
00266 { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 },
00267 { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 },
00268 { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 },
00269 { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 },
00270 { -23, 68 }, { -24, 50 }, { -11, 74 }, { -14, 106 },
00271 { -13, 97 }, { -15, 90 }, { -12, 90 }, { -18, 88 },
00272 { -10, 73 }, { -9, 79 }, { -14, 86 }, { -10, 73 },
00273 { -10, 70 }, { -10, 69 }, { -5, 66 }, { -9, 64 },
00274 { -5, 58 }, { 2, 59 }, { 23, -13 }, { 26, -13 },
00275 { 40, -15 }, { 49, -14 }, { 44, 3 }, { 45, 6 },
00276 { 44, 34 }, { 33, 54 }, { 19, 82 }, { 21, -10 },
00277 { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 },
00278 { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 },
00279 { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 },
00280 { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 },
00281 { 0, 68 }, { -9, 92 }, { -17, 120 }, { -20, 112 },
00282 { -18, 114 }, { -11, 85 }, { -15, 92 }, { -14, 89 },
00283 { -26, 71 }, { -15, 81 }, { -14, 80 }, { 0, 68 },
00284 { -14, 70 }, { -24, 56 }, { -23, 68 }, { -24, 50 },
00285 { -11, 74 }, { -14, 106 }, { -13, 97 }, { -15, 90 },
00286 { -12, 90 }, { -18, 88 }, { -10, 73 }, { -9, 79 },
00287 { -14, 86 }, { -10, 73 }, { -10, 70 }, { -10, 69 },
00288 { -5, 66 }, { -9, 64 }, { -5, 58 }, { 2, 59 },
00289 { 23, -13 }, { 26, -13 }, { 40, -15 }, { 49, -14 },
00290 { 44, 3 }, { 45, 6 }, { 44, 34 }, { 33, 54 },
00291 { 19, 82 }, { 21, -10 }, { 24, -11 }, { 28, -8 },
00292 { 28, -1 }, { 29, 3 }, { 29, 9 }, { 35, 20 },
00293 { 29, 36 }, { 14, 67 }, { -3, 75 }, { -1, 23 },
00294 { 1, 34 }, { 1, 43 }, { 0, 54 }, { -2, 55 },
00295 { 0, 61 }, { 1, 64 }, { 0, 68 }, { -9, 92 },
00296 { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
00297 { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
00298 { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
00299 { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
00300 { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
00301 { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
00302 { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
00303 { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 },
00304 { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 },
00305 { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 },
00306 { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 },
00307 { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
00308 { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
00309 { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
00310 { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
00311 { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
00312 { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
00313 { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
00314 { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 },
00315 { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 },
00316 { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 },
00317 { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 },
00318 { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
00319 { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
00320 { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
00321 { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
00322 { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
00323 { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
00324 { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
00325 { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 },
00326 { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 },
00327 { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 },
00328 { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 },
00329 { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
00330 { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
00331 { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
00332 { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
00333 { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
00334 { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
00335 { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
00336 { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 },
00337 { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 },
00338 { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 },
00339 { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 },
00340 { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 },
00341 { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 },
00342 { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 },
00343 { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 },
00344 { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 },
00345 { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 },
00346 { -4, 65 }, { -12, 73 }, { -8, 76 }, { -7, 80 },
00347 { -9, 88 }, { -17, 110 }, { -3, 71 }, { -6, 42 },
00348 { -5, 50 }, { -3, 54 }, { -2, 62 }, { 0, 58 },
00349 { 1, 63 }, { -2, 72 }, { -1, 74 }, { -9, 91 },
00350 { -5, 67 }, { -5, 27 }, { -3, 39 }, { -2, 44 },
00351 { 0, 46 }, { -16, 64 }, { -8, 68 }, { -10, 78 },
00352 { -6, 77 }, { -10, 86 }, { -12, 92 }, { -15, 55 },
00353 { -10, 60 }, { -6, 62 }, { -4, 65 }, { -12, 73 },
00354 { -8, 76 }, { -7, 80 }, { -9, 88 }, { -17, 110 },
00355 { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
00356 { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
00357 { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 }
00358 };
00359
00360 static const int8_t cabac_context_init_PB[3][1024][2] =
00361 {
00362
00363 {
00364
00365 { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
00366 { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
00367 { -6, 53 }, { -1, 54 }, { 7, 51 },
00368
00369
00370 { 23, 33 }, { 23, 2 }, { 21, 0 }, { 1, 9 },
00371 { 0, 49 }, { -37, 118 }, { 5, 57 }, { -13, 78 },
00372 { -11, 65 }, { 1, 62 }, { 12, 49 }, { -4, 73 },
00373 { 17, 50 },
00374
00375
00376 { 18, 64 }, { 9, 43 }, { 29, 0 }, { 26, 67 },
00377 { 16, 90 }, { 9, 104 }, { -46, 127 }, { -20, 104 },
00378 { 1, 67 }, { -13, 78 }, { -11, 65 }, { 1, 62 },
00379 { -6, 86 }, { -17, 95 }, { -6, 61 }, { 9, 45 },
00380
00381
00382 { -3, 69 }, { -6, 81 }, { -11, 96 }, { 6, 55 },
00383 { 7, 67 }, { -5, 86 }, { 2, 88 }, { 0, 58 },
00384 { -3, 76 }, { -10, 94 }, { 5, 54 }, { 4, 69 },
00385 { -3, 81 }, { 0, 88 },
00386
00387
00388 { -7, 67 }, { -5, 74 }, { -4, 74 }, { -5, 80 },
00389 { -7, 72 }, { 1, 58 },
00390
00391
00392 { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
00393 { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
00394 { 13, 41 }, { 3, 62 },
00395
00396
00397 { 0, 45 }, { -4, 78 }, { -3, 96 }, { -27, 126 },
00398 { -28, 98 }, { -25, 101 }, { -23, 67 }, { -28, 82 },
00399 { -20, 94 }, { -16, 83 }, { -22, 110 }, { -21, 91 },
00400 { -18, 102 }, { -13, 93 }, { -29, 127 }, { -7, 92 },
00401 { -5, 89 }, { -7, 96 }, { -13, 108 }, { -3, 46 },
00402 { -1, 65 }, { -1, 57 }, { -9, 93 }, { -3, 74 },
00403 { -9, 92 }, { -8, 87 }, { -23, 126 }, { 5, 54 },
00404 { 6, 60 }, { 6, 59 }, { 6, 69 }, { -1, 48 },
00405 { 0, 68 }, { -4, 69 }, { -8, 88 },
00406
00407
00408 { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
00409 { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
00410 { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
00411 { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
00412 { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
00413 { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
00414 { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
00415 { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
00416 { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
00417 { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
00418 { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
00419 { 3, 64 }, { 1, 61 }, { 9, 63 }, { 7, 50 },
00420 { 16, 39 }, { 5, 44 }, { 4, 52 }, { 11, 48 },
00421 { -5, 60 }, { -1, 59 }, { 0, 59 }, { 22, 33 },
00422 { 5, 44 }, { 14, 43 }, { -1, 78 }, { 0, 60 },
00423 { 9, 69 },
00424
00425
00426 { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
00427 { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
00428 { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
00429 { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
00430 { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
00431 { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
00432 { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
00433 { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
00434 { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
00435 { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
00436 { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
00437 { 1, 67 }, { 5, 59 }, { 9, 67 }, { 16, 30 },
00438 { 18, 32 }, { 18, 35 }, { 22, 29 }, { 24, 31 },
00439 { 23, 38 }, { 18, 43 }, { 20, 41 }, { 11, 63 },
00440 { 9, 59 }, { 9, 64 }, { -1, 94 }, { -2, 89 },
00441 { -9, 108 },
00442
00443
00444 { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 },
00445 { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 },
00446 { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 },
00447 { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 },
00448 { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 },
00449 { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 },
00450 { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 },
00451 { -3, 74 }, { -10, 90 }, { 0, 70 }, { -4, 29 },
00452 { 5, 31 }, { 7, 42 }, { 1, 59 }, { -2, 58 },
00453 { -3, 72 }, { -3, 81 }, { -11, 97 }, { 0, 58 },
00454 { 8, 5 }, { 10, 14 }, { 14, 18 }, { 13, 27 },
00455 { 2, 40 }, { 0, 58 }, { -3, 70 }, { -6, 79 },
00456 { -8, 85 },
00457
00458
00459 { 0, 0 },
00460
00461
00462 { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
00463 { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
00464 { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
00465 { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
00466 { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
00467 { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
00468 { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
00469 { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
00470 { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
00471 { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
00472 { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
00473 { -2, 69 }, { -2, 59 }, { 6, 70 }, { 10, 44 },
00474 { 9, 31 }, { 12, 43 }, { 3, 53 }, { 14, 34 },
00475 { 10, 38 }, { -3, 52 }, { 13, 40 }, { 17, 32 },
00476 { 7, 44 }, { 7, 38 }, { 13, 50 }, { 10, 57 },
00477 { 26, 43 },
00478
00479
00480 { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
00481 { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
00482 { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
00483 { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
00484 { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
00485 { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
00486 { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
00487 { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
00488 { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
00489 { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
00490 { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
00491 { 8, 60 }, { 6, 63 }, { 17, 65 }, { 21, 24 },
00492 { 23, 20 }, { 26, 23 }, { 27, 32 }, { 28, 23 },
00493 { 28, 24 }, { 23, 40 }, { 24, 32 }, { 28, 29 },
00494 { 23, 42 }, { 19, 57 }, { 22, 53 }, { 22, 61 },
00495 { 11, 86 },
00496
00497
00498 { 12, 40 }, { 11, 51 }, { 14, 59 },
00499 { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 },
00500 { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 },
00501 { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 },
00502 { -16, 66 }, { -22, 65 }, { -20, 63 }, { 9, -2 },
00503 { 26, -9 }, { 33, -9 }, { 39, -7 }, { 41, -2 },
00504 { 45, 3 }, { 49, 9 }, { 45, 27 }, { 36, 59 },
00505 { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 },
00506 { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 },
00507 { -8, 66 }, { -8, 76 },
00508
00509
00510 { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
00511 { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
00512 { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
00513 { -14, 66 }, { 0, 59 }, { 2, 59 }, { 21, -13 },
00514 { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 },
00515 { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 },
00516
00517
00518 { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 },
00519 { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 },
00520 { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
00521 { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 },
00522 { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 },
00523 { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
00524 { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
00525 { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
00526 { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
00527 { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
00528 { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
00529 { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
00530 { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
00531 { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
00532 { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
00533 { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
00534 { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
00535 { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
00536 { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
00537 { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
00538 { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
00539 { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
00540 { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
00541 { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
00542 { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
00543 { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
00544 { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
00545 { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
00546 { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
00547 { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
00548 { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
00549 { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
00550 { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
00551 { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
00552 { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
00553 { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
00554 { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
00555 { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
00556 { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
00557 { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
00558 { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
00559 { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
00560 { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
00561 { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
00562 { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
00563 { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
00564 { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
00565 { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
00566 { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
00567 { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
00568 { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 },
00569 { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 },
00570 { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 },
00571 { -16, 66 }, { -22, 65 }, { -20, 63 }, { -5, 85 },
00572 { -6, 81 }, { -10, 77 }, { -7, 81 }, { -17, 80 },
00573 { -18, 73 }, { -4, 74 }, { -10, 83 }, { -9, 71 },
00574 { -9, 67 }, { -1, 61 }, { -8, 66 }, { -14, 66 },
00575 { 0, 59 }, { 2, 59 }, { 9, -2 }, { 26, -9 },
00576 { 33, -9 }, { 39, -7 }, { 41, -2 }, { 45, 3 },
00577 { 49, 9 }, { 45, 27 }, { 36, 59 }, { 21, -13 },
00578 { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 },
00579 { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 },
00580 { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 },
00581 { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 },
00582 { -8, 66 }, { -8, 76 }, { -4, 79 }, { -7, 71 },
00583 { -5, 69 }, { -9, 70 }, { -8, 66 }, { -10, 68 },
00584 { -19, 73 }, { -12, 69 }, { -16, 70 }, { -15, 67 },
00585 { -20, 62 }, { -19, 70 }, { -16, 66 }, { -22, 65 },
00586 { -20, 63 }, { -5, 85 }, { -6, 81 }, { -10, 77 },
00587 { -7, 81 }, { -17, 80 }, { -18, 73 }, { -4, 74 },
00588 { -10, 83 }, { -9, 71 }, { -9, 67 }, { -1, 61 },
00589 { -8, 66 }, { -14, 66 }, { 0, 59 }, { 2, 59 },
00590 { 9, -2 }, { 26, -9 }, { 33, -9 }, { 39, -7 },
00591 { 41, -2 }, { 45, 3 }, { 49, 9 }, { 45, 27 },
00592 { 36, 59 }, { 21, -13 }, { 33, -14 }, { 39, -7 },
00593 { 46, -2 }, { 51, 2 }, { 60, 6 }, { 61, 17 },
00594 { 55, 34 }, { 42, 62 }, { -6, 66 }, { -7, 35 },
00595 { -7, 42 }, { -8, 45 }, { -5, 48 }, { -12, 56 },
00596 { -6, 60 }, { -5, 62 }, { -8, 66 }, { -8, 76 },
00597 { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
00598 { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
00599 { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
00600 { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
00601 { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
00602 { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
00603 { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
00604 { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
00605 { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
00606 { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
00607 { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
00608 { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
00609 { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
00610 { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
00611 { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
00612 { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
00613 { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
00614 { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
00615 { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
00616 { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
00617 { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
00618 { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
00619 { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
00620 { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
00621 { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
00622 { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
00623 { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
00624 { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
00625 { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
00626 { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
00627 { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
00628 { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
00629 { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
00630 { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
00631 { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
00632 { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
00633 { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
00634 { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
00635 { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
00636 { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
00637 { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
00638 { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
00639 { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
00640 { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
00641 { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 },
00642 { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 },
00643 { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 },
00644 { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 },
00645 { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 },
00646 { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 },
00647 { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 },
00648 { -3, 74 }, { -10, 90 }, { -6, 76 }, { -2, 44 },
00649 { 0, 45 }, { 0, 52 }, { -3, 64 }, { -2, 59 },
00650 { -4, 70 }, { -4, 75 }, { -8, 82 }, { -17, 102 },
00651 { -9, 77 }, { 3, 24 }, { 0, 42 }, { 0, 48 },
00652 { 0, 55 }, { -6, 59 }, { -7, 71 }, { -12, 83 },
00653 { -11, 87 }, { -30, 119 }, { 1, 58 }, { -3, 29 },
00654 { -1, 36 }, { 1, 38 }, { 2, 43 }, { -6, 55 },
00655 { 0, 58 }, { 0, 64 }, { -3, 74 }, { -10, 90 },
00656 { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
00657 { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
00658 { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 }
00659 },
00660
00661
00662 {
00663
00664 { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
00665 { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
00666 { -6, 53 }, { -1, 54 }, { 7, 51 },
00667
00668
00669 { 22, 25 }, { 34, 0 }, { 16, 0 }, { -2, 9 },
00670 { 4, 41 }, { -29, 118 }, { 2, 65 }, { -6, 71 },
00671 { -13, 79 }, { 5, 52 }, { 9, 50 }, { -3, 70 },
00672 { 10, 54 },
00673
00674
00675 { 26, 34 }, { 19, 22 }, { 40, 0 }, { 57, 2 },
00676 { 41, 36 }, { 26, 69 }, { -45, 127 }, { -15, 101 },
00677 { -4, 76 }, { -6, 71 }, { -13, 79 }, { 5, 52 },
00678 { 6, 69 }, { -13, 90 }, { 0, 52 }, { 8, 43 },
00679
00680
00681 { -2, 69 },{ -5, 82 },{ -10, 96 },{ 2, 59 },
00682 { 2, 75 },{ -3, 87 },{ -3, 100 },{ 1, 56 },
00683 { -3, 74 },{ -6, 85 },{ 0, 59 },{ -3, 81 },
00684 { -7, 86 },{ -5, 95 },
00685
00686
00687 { -1, 66 },{ -1, 77 },{ 1, 70 },{ -2, 86 },
00688 { -5, 72 },{ 0, 61 },
00689
00690
00691 { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
00692 { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
00693 { 13, 41 }, { 3, 62 },
00694
00695
00696 { 13, 15 }, { 7, 51 }, { 2, 80 }, { -39, 127 },
00697 { -18, 91 }, { -17, 96 }, { -26, 81 }, { -35, 98 },
00698 { -24, 102 }, { -23, 97 }, { -27, 119 }, { -24, 99 },
00699 { -21, 110 }, { -18, 102 }, { -36, 127 }, { 0, 80 },
00700 { -5, 89 }, { -7, 94 }, { -4, 92 }, { 0, 39 },
00701 { 0, 65 }, { -15, 84 }, { -35, 127 }, { -2, 73 },
00702 { -12, 104 }, { -9, 91 }, { -31, 127 }, { 3, 55 },
00703 { 7, 56 }, { 7, 55 }, { 8, 61 }, { -3, 53 },
00704 { 0, 68 }, { -7, 74 }, { -9, 88 },
00705
00706
00707 { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
00708 { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
00709 { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
00710 { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
00711 { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
00712 { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
00713 { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
00714 { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
00715 { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
00716 { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
00717 { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
00718 { -4, 71 }, { 0, 58 }, { 7, 61 }, { 9, 41 },
00719 { 18, 25 }, { 9, 32 }, { 5, 43 }, { 9, 47 },
00720 { 0, 44 }, { 0, 51 }, { 2, 46 }, { 19, 38 },
00721 { -4, 66 }, { 15, 38 }, { 12, 42 }, { 9, 34 },
00722 { 0, 89 },
00723
00724
00725 { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
00726 { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
00727 { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
00728 { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
00729 { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
00730 { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
00731 { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
00732 { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
00733 { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
00734 { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
00735 { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
00736 { 0, 75 }, { 2, 72 }, { 8, 77 }, { 14, 35 },
00737 { 18, 31 }, { 17, 35 }, { 21, 30 }, { 17, 45 },
00738 { 20, 42 }, { 18, 45 }, { 27, 26 }, { 16, 54 },
00739 { 7, 66 }, { 16, 56 }, { 11, 73 }, { 10, 67 },
00740 { -10, 116 },
00741
00742
00743 { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 },
00744 { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 },
00745 { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 },
00746 { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 },
00747 { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
00748 { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 },
00749 { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 },
00750 { -5, 74 }, { -9, 86 }, { 2, 66 }, { -9, 34 },
00751 { 1, 32 }, { 11, 31 }, { 5, 52 }, { -2, 55 },
00752 { -2, 67 }, { 0, 73 }, { -8, 89 }, { 3, 52 },
00753 { 7, 4 }, { 10, 8 }, { 17, 8 }, { 16, 19 },
00754 { 3, 37 }, { -1, 61 }, { -5, 73 }, { -1, 70 },
00755 { -4, 78 },
00756
00757
00758 { 0, 0 },
00759
00760
00761 { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
00762 { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
00763 { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
00764 { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
00765 { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
00766 { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
00767 { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
00768 { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
00769 { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
00770 { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
00771 { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
00772 { -1, 70 }, { -9, 72 }, { 14, 60 }, { 16, 37 },
00773 { 0, 47 }, { 18, 35 }, { 11, 37 }, { 12, 41 },
00774 { 10, 41 }, { 2, 48 }, { 12, 41 }, { 13, 41 },
00775 { 0, 59 }, { 3, 50 }, { 19, 40 }, { 3, 66 },
00776 { 18, 50 },
00777
00778
00779 { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
00780 { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
00781 { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
00782 { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
00783 { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
00784 { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
00785 { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
00786 { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
00787 { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
00788 { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
00789 { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
00790 { 12, 48 }, { 11, 49 }, { 26, 45 }, { 22, 22 },
00791 { 23, 22 }, { 27, 21 }, { 33, 20 }, { 26, 28 },
00792 { 30, 24 }, { 27, 34 }, { 18, 42 }, { 25, 39 },
00793 { 18, 50 }, { 12, 70 }, { 21, 54 }, { 14, 71 },
00794 { 11, 83 },
00795
00796
00797 { 25, 32 }, { 21, 49 }, { 21, 54 },
00798 { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
00799 { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
00800 { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
00801 { -14, 66 }, { 0, 59 }, { 2, 59 }, { 17, -10 },
00802 { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
00803 { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
00804 { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 },
00805 { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 },
00806 { -4, 67 }, { -7, 82 },
00807
00808
00809 { -3, 81 }, { -3, 76 }, { -7, 72 }, { -6, 78 },
00810 { -12, 72 }, { -14, 68 }, { -3, 70 }, { -6, 76 },
00811 { -5, 66 }, { -5, 62 }, { 0, 57 }, { -4, 61 },
00812 { -9, 60 }, { 1, 54 }, { 2, 58 }, { 17, -10 },
00813 { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
00814 { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
00815
00816
00817 { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 },
00818 { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 },
00819 { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
00820 { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 },
00821 { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 },
00822 { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
00823 { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
00824 { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
00825 { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
00826 { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
00827 { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
00828 { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
00829 { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
00830 { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
00831 { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
00832 { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
00833 { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
00834 { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
00835 { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
00836 { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
00837 { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
00838 { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
00839 { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
00840 { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
00841 { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
00842 { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
00843 { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
00844 { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
00845 { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
00846 { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
00847 { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
00848 { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
00849 { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
00850 { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
00851 { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
00852 { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
00853 { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
00854 { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
00855 { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
00856 { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
00857 { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
00858 { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
00859 { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
00860 { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
00861 { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
00862 { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
00863 { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
00864 { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
00865 { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
00866 { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
00867 { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
00868 { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
00869 { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
00870 { -14, 66 }, { 0, 59 }, { 2, 59 }, { -3, 81 },
00871 { -3, 76 }, { -7, 72 }, { -6, 78 }, { -12, 72 },
00872 { -14, 68 }, { -3, 70 }, { -6, 76 }, { -5, 66 },
00873 { -5, 62 }, { 0, 57 }, { -4, 61 }, { -9, 60 },
00874 { 1, 54 }, { 2, 58 }, { 17, -10 }, { 32, -13 },
00875 { 42, -9 }, { 49, -5 }, { 53, 0 }, { 64, 3 },
00876 { 68, 10 }, { 66, 27 }, { 47, 57 }, { 17, -10 },
00877 { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
00878 { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
00879 { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 },
00880 { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 },
00881 { -4, 67 }, { -7, 82 }, { -5, 85 }, { -6, 81 },
00882 { -10, 77 }, { -7, 81 }, { -17, 80 }, { -18, 73 },
00883 { -4, 74 }, { -10, 83 }, { -9, 71 }, { -9, 67 },
00884 { -1, 61 }, { -8, 66 }, { -14, 66 }, { 0, 59 },
00885 { 2, 59 }, { -3, 81 }, { -3, 76 }, { -7, 72 },
00886 { -6, 78 }, { -12, 72 }, { -14, 68 }, { -3, 70 },
00887 { -6, 76 }, { -5, 66 }, { -5, 62 }, { 0, 57 },
00888 { -4, 61 }, { -9, 60 }, { 1, 54 }, { 2, 58 },
00889 { 17, -10 }, { 32, -13 }, { 42, -9 }, { 49, -5 },
00890 { 53, 0 }, { 64, 3 }, { 68, 10 }, { 66, 27 },
00891 { 47, 57 }, { 17, -10 }, { 32, -13 }, { 42, -9 },
00892 { 49, -5 }, { 53, 0 }, { 64, 3 }, { 68, 10 },
00893 { 66, 27 }, { 47, 57 }, { -5, 71 }, { 0, 24 },
00894 { -1, 36 }, { -2, 42 }, { -2, 52 }, { -9, 57 },
00895 { -6, 63 }, { -4, 65 }, { -4, 67 }, { -7, 82 },
00896 { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
00897 { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
00898 { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
00899 { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
00900 { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
00901 { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
00902 { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
00903 { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
00904 { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
00905 { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
00906 { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
00907 { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
00908 { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
00909 { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
00910 { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
00911 { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
00912 { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
00913 { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
00914 { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
00915 { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
00916 { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
00917 { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
00918 { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
00919 { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
00920 { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
00921 { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
00922 { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
00923 { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
00924 { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
00925 { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
00926 { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
00927 { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
00928 { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
00929 { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
00930 { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
00931 { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
00932 { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
00933 { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
00934 { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
00935 { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
00936 { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
00937 { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
00938 { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
00939 { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
00940 { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 },
00941 { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 },
00942 { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 },
00943 { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 },
00944 { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
00945 { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 },
00946 { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 },
00947 { -5, 74 }, { -9, 86 }, { -23, 112 }, { -15, 71 },
00948 { -7, 61 }, { 0, 53 }, { -5, 66 }, { -11, 77 },
00949 { -9, 80 }, { -9, 84 }, { -10, 87 }, { -34, 127 },
00950 { -21, 101 }, { -3, 39 }, { -5, 53 }, { -7, 61 },
00951 { -11, 75 }, { -15, 77 }, { -17, 91 }, { -25, 107 },
00952 { -25, 111 }, { -28, 122 }, { -11, 76 }, { -10, 44 },
00953 { -10, 52 }, { -10, 57 }, { -9, 58 }, { -16, 72 },
00954 { -7, 69 }, { -4, 69 }, { -5, 74 }, { -9, 86 },
00955 { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
00956 { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
00957 { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 }
00958 },
00959
00960
00961 {
00962
00963 { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
00964 { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
00965 { -6, 53 }, { -1, 54 }, { 7, 51 },
00966
00967
00968 { 29, 16 }, { 25, 0 }, { 14, 0 }, { -10, 51 },
00969 { -3, 62 }, { -27, 99 }, { 26, 16 }, { -4, 85 },
00970 { -24, 102 }, { 5, 57 }, { 6, 57 }, { -17, 73 },
00971 { 14, 57 },
00972
00973
00974 { 20, 40 }, { 20, 10 }, { 29, 0 }, { 54, 0 },
00975 { 37, 42 }, { 12, 97 }, { -32, 127 }, { -22, 117 },
00976 { -2, 74 }, { -4, 85 }, { -24, 102 }, { 5, 57 },
00977 { -6, 93 }, { -14, 88 }, { -6, 44 }, { 4, 55 },
00978
00979
00980 { -11, 89 },{ -15, 103 },{ -21, 116 },{ 19, 57 },
00981 { 20, 58 },{ 4, 84 },{ 6, 96 },{ 1, 63 },
00982 { -5, 85 },{ -13, 106 },{ 5, 63 },{ 6, 75 },
00983 { -3, 90 },{ -1, 101 },
00984
00985
00986 { 3, 55 },{ -4, 79 },{ -2, 75 },{ -12, 97 },
00987 { -7, 50 },{ 1, 60 },
00988
00989
00990 { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
00991 { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
00992 { 13, 41 }, { 3, 62 },
00993
00994
00995 { 7, 34 }, { -9, 88 }, { -20, 127 }, { -36, 127 },
00996 { -17, 91 }, { -14, 95 }, { -25, 84 }, { -25, 86 },
00997 { -12, 89 }, { -17, 91 }, { -31, 127 }, { -14, 76 },
00998 { -18, 103 }, { -13, 90 }, { -37, 127 }, { 11, 80 },
00999 { 5, 76 }, { 2, 84 }, { 5, 78 }, { -6, 55 },
01000 { 4, 61 }, { -14, 83 }, { -37, 127 }, { -5, 79 },
01001 { -11, 104 }, { -11, 91 }, { -30, 127 }, { 0, 65 },
01002 { -2, 79 }, { 0, 72 }, { -4, 92 }, { -6, 56 },
01003 { 3, 68 }, { -8, 71 }, { -13, 98 },
01004
01005
01006 { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
01007 { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
01008 { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
01009 { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
01010 { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
01011 { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
01012 { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
01013 { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
01014 { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
01015 { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
01016 { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
01017 { 3, 65 }, { -7, 69 }, { 8, 77 }, { -10, 66 },
01018 { 3, 62 }, { -3, 68 }, { -20, 81 }, { 0, 30 },
01019 { 1, 7 }, { -3, 23 }, { -21, 74 }, { 16, 66 },
01020 { -23, 124 }, { 17, 37 }, { 44, -18 }, { 50, -34 },
01021 { -22, 127 },
01022
01023
01024 { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
01025 { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
01026 { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
01027 { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
01028 { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
01029 { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
01030 { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
01031 { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
01032 { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
01033 { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
01034 { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
01035 { 20, 34 }, { 19, 31 }, { 27, 44 }, { 19, 16 },
01036 { 15, 36 }, { 15, 36 }, { 21, 28 }, { 25, 21 },
01037 { 30, 20 }, { 31, 12 }, { 27, 16 }, { 24, 42 },
01038 { 0, 93 }, { 14, 56 }, { 15, 57 }, { 26, 38 },
01039 { -24, 127 },
01040
01041
01042 { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 },
01043 { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 },
01044 { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 },
01045 { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 },
01046 { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 },
01047 { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 },
01048 { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 },
01049 { -12, 92 }, { -18, 108 }, { -4, 79 }, { -22, 69 },
01050 { -16, 75 }, { -2, 58 }, { 1, 58 }, { -13, 78 },
01051 { -9, 83 }, { -4, 81 }, { -13, 99 }, { -13, 81 },
01052 { -6, 38 }, { -13, 62 }, { -6, 58 }, { -2, 59 },
01053 { -16, 73 }, { -10, 76 }, { -13, 86 }, { -9, 83 },
01054 { -10, 87 },
01055
01056
01057 { 0, 0 },
01058
01059
01060 { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
01061 { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
01062 { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
01063 { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
01064 { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
01065 { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
01066 { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
01067 { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
01068 { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
01069 { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
01070 { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
01071 { -2, 76 }, { -18, 86 }, { 12, 70 }, { 5, 64 },
01072 { -12, 70 }, { 11, 55 }, { 5, 56 }, { 0, 69 },
01073 { 2, 65 }, { -6, 74 }, { 5, 54 }, { 7, 54 },
01074 { -6, 76 }, { -11, 82 }, { -2, 77 }, { -2, 77 },
01075 { 25, 42 },
01076
01077
01078 { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
01079 { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
01080 { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
01081 { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
01082 { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
01083 { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
01084 { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
01085 { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
01086 { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
01087 { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
01088 { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
01089 { 18, 31 }, { 19, 26 }, { 36, 24 }, { 24, 23 },
01090 { 27, 16 }, { 24, 30 }, { 31, 29 }, { 22, 41 },
01091 { 22, 42 }, { 16, 60 }, { 15, 52 }, { 14, 60 },
01092 { 3, 78 }, { -16, 123 }, { 21, 53 }, { 22, 56 },
01093 { 25, 61 },
01094
01095
01096 { 21, 33 }, { 19, 50 }, { 17, 61 },
01097 { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
01098 { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
01099 { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
01100 { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 },
01101 { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
01102 { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
01103 { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 },
01104 { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 },
01105 { -6, 68 }, { -10, 79 },
01106
01107
01108 { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
01109 { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
01110 { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
01111 { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 },
01112 { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
01113 { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
01114
01115
01116 { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 },
01117 { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 },
01118 { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
01119 { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 },
01120 { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 },
01121 { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
01122 { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
01123 { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
01124 { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
01125 { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
01126 { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
01127 { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
01128 { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
01129 { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
01130 { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
01131 { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
01132 { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
01133 { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
01134 { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
01135 { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
01136 { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
01137 { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
01138 { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
01139 { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
01140 { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
01141 { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
01142 { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
01143 { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
01144 { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
01145 { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
01146 { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
01147 { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
01148 { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
01149 { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
01150 { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
01151 { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
01152 { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
01153 { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
01154 { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
01155 { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
01156 { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
01157 { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
01158 { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
01159 { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
01160 { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
01161 { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
01162 { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
01163 { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
01164 { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
01165 { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
01166 { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
01167 { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
01168 { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
01169 { -14, 59 }, { -9, 52 }, { -11, 68 }, { -3, 78 },
01170 { -8, 74 }, { -9, 72 }, { -10, 72 }, { -18, 75 },
01171 { -12, 71 }, { -11, 63 }, { -5, 70 }, { -17, 75 },
01172 { -14, 72 }, { -16, 67 }, { -8, 53 }, { -14, 59 },
01173 { -9, 52 }, { -11, 68 }, { 9, -2 }, { 30, -10 },
01174 { 31, -4 }, { 33, -1 }, { 33, 7 }, { 31, 12 },
01175 { 37, 23 }, { 31, 38 }, { 20, 64 }, { 9, -2 },
01176 { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
01177 { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
01178 { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 },
01179 { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 },
01180 { -6, 68 }, { -10, 79 }, { -3, 78 }, { -8, 74 },
01181 { -9, 72 }, { -10, 72 }, { -18, 75 }, { -12, 71 },
01182 { -11, 63 }, { -5, 70 }, { -17, 75 }, { -14, 72 },
01183 { -16, 67 }, { -8, 53 }, { -14, 59 }, { -9, 52 },
01184 { -11, 68 }, { -3, 78 }, { -8, 74 }, { -9, 72 },
01185 { -10, 72 }, { -18, 75 }, { -12, 71 }, { -11, 63 },
01186 { -5, 70 }, { -17, 75 }, { -14, 72 }, { -16, 67 },
01187 { -8, 53 }, { -14, 59 }, { -9, 52 }, { -11, 68 },
01188 { 9, -2 }, { 30, -10 }, { 31, -4 }, { 33, -1 },
01189 { 33, 7 }, { 31, 12 }, { 37, 23 }, { 31, 38 },
01190 { 20, 64 }, { 9, -2 }, { 30, -10 }, { 31, -4 },
01191 { 33, -1 }, { 33, 7 }, { 31, 12 }, { 37, 23 },
01192 { 31, 38 }, { 20, 64 }, { -9, 71 }, { -7, 37 },
01193 { -8, 44 }, { -11, 49 }, { -10, 56 }, { -12, 59 },
01194 { -8, 63 }, { -9, 67 }, { -6, 68 }, { -10, 79 },
01195 { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
01196 { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
01197 { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
01198 { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
01199 { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
01200 { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
01201 { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
01202 { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
01203 { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
01204 { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
01205 { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
01206 { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
01207 { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
01208 { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
01209 { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
01210 { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
01211 { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
01212 { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
01213 { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
01214 { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
01215 { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
01216 { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
01217 { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
01218 { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
01219 { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
01220 { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
01221 { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
01222 { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
01223 { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
01224 { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
01225 { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
01226 { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
01227 { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
01228 { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
01229 { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
01230 { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
01231 { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
01232 { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
01233 { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
01234 { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
01235 { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
01236 { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
01237 { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
01238 { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
01239 { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 },
01240 { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 },
01241 { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 },
01242 { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 },
01243 { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 },
01244 { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 },
01245 { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 },
01246 { -12, 92 }, { -18, 108 }, { -24, 115 }, { -22, 82 },
01247 { -9, 62 }, { 0, 53 }, { 0, 59 }, { -14, 85 },
01248 { -13, 89 }, { -13, 94 }, { -11, 92 }, { -29, 127 },
01249 { -21, 100 }, { -14, 57 }, { -12, 67 }, { -11, 71 },
01250 { -10, 77 }, { -21, 85 }, { -16, 88 }, { -23, 104 },
01251 { -15, 98 }, { -37, 127 }, { -10, 82 }, { -8, 48 },
01252 { -8, 61 }, { -8, 66 }, { -7, 70 }, { -14, 75 },
01253 { -10, 79 }, { -9, 83 }, { -12, 92 }, { -18, 108 },
01254 { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
01255 { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
01256 { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 }
01257 }
01258 };
01259
01260 void ff_h264_init_cabac_states(H264Context *h) {
01261 MpegEncContext * const s = &h->s;
01262 int i;
01263 const int8_t (*tab)[2];
01264 const int slice_qp = av_clip(s->qscale - 6*(h->sps.bit_depth_luma-8), 0, 51);
01265
01266 if( h->slice_type_nos == AV_PICTURE_TYPE_I ) tab = cabac_context_init_I;
01267 else tab = cabac_context_init_PB[h->cabac_init_idc];
01268
01269
01270 for( i= 0; i < 1024; i++ ) {
01271 int pre = 2*(((tab[i][0] * slice_qp) >>4 ) + tab[i][1]) - 127;
01272
01273 pre^= pre>>31;
01274 if(pre > 124)
01275 pre= 124 + (pre&1);
01276
01277 h->cabac_state[i] = pre;
01278 }
01279 }
01280
01281 static int decode_cabac_field_decoding_flag(H264Context *h) {
01282 MpegEncContext * const s = &h->s;
01283 const long mbb_xy = h->mb_xy - 2L*s->mb_stride;
01284
01285 unsigned long ctx = 0;
01286
01287 ctx += h->mb_field_decoding_flag & !!s->mb_x;
01288 ctx += (s->current_picture.mb_type[mbb_xy]>>7)&(h->slice_table[mbb_xy] == h->slice_num);
01289
01290 return get_cabac_noinline( &h->cabac, &(h->cabac_state+70)[ctx] );
01291 }
01292
01293 static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) {
01294 uint8_t *state= &h->cabac_state[ctx_base];
01295 int mb_type;
01296
01297 if(intra_slice){
01298 int ctx=0;
01299 if( h->left_type[0] & (MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM))
01300 ctx++;
01301 if( h->top_type & (MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM))
01302 ctx++;
01303 if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 )
01304 return 0;
01305 state += 2;
01306 }else{
01307 if( get_cabac_noinline( &h->cabac, state ) == 0 )
01308 return 0;
01309 }
01310
01311 if( get_cabac_terminate( &h->cabac ) )
01312 return 25;
01313
01314 mb_type = 1;
01315 mb_type += 12 * get_cabac_noinline( &h->cabac, &state[1] );
01316 if( get_cabac_noinline( &h->cabac, &state[2] ) )
01317 mb_type += 4 + 4 * get_cabac_noinline( &h->cabac, &state[2+intra_slice] );
01318 mb_type += 2 * get_cabac_noinline( &h->cabac, &state[3+intra_slice] );
01319 mb_type += 1 * get_cabac_noinline( &h->cabac, &state[3+2*intra_slice] );
01320 return mb_type;
01321 }
01322
01323 static int decode_cabac_mb_skip( H264Context *h, int mb_x, int mb_y ) {
01324 MpegEncContext * const s = &h->s;
01325 int mba_xy, mbb_xy;
01326 int ctx = 0;
01327
01328 if(FRAME_MBAFF){
01329 int mb_xy = mb_x + (mb_y&~1)*s->mb_stride;
01330 mba_xy = mb_xy - 1;
01331 if( (mb_y&1)
01332 && h->slice_table[mba_xy] == h->slice_num
01333 && MB_FIELD == !!IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) )
01334 mba_xy += s->mb_stride;
01335 if( MB_FIELD ){
01336 mbb_xy = mb_xy - s->mb_stride;
01337 if( !(mb_y&1)
01338 && h->slice_table[mbb_xy] == h->slice_num
01339 && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) )
01340 mbb_xy -= s->mb_stride;
01341 }else
01342 mbb_xy = mb_x + (mb_y-1)*s->mb_stride;
01343 }else{
01344 int mb_xy = h->mb_xy;
01345 mba_xy = mb_xy - 1;
01346 mbb_xy = mb_xy - (s->mb_stride << FIELD_PICTURE);
01347 }
01348
01349 if( h->slice_table[mba_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mba_xy] ))
01350 ctx++;
01351 if( h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mbb_xy] ))
01352 ctx++;
01353
01354 if( h->slice_type_nos == AV_PICTURE_TYPE_B )
01355 ctx += 13;
01356 return get_cabac_noinline( &h->cabac, &h->cabac_state[11+ctx] );
01357 }
01358
01359 static int decode_cabac_mb_intra4x4_pred_mode( H264Context *h, int pred_mode ) {
01360 int mode = 0;
01361
01362 if( get_cabac( &h->cabac, &h->cabac_state[68] ) )
01363 return pred_mode;
01364
01365 mode += 1 * get_cabac( &h->cabac, &h->cabac_state[69] );
01366 mode += 2 * get_cabac( &h->cabac, &h->cabac_state[69] );
01367 mode += 4 * get_cabac( &h->cabac, &h->cabac_state[69] );
01368
01369 return mode + ( mode >= pred_mode );
01370 }
01371
01372 static int decode_cabac_mb_chroma_pre_mode( H264Context *h) {
01373 const int mba_xy = h->left_mb_xy[0];
01374 const int mbb_xy = h->top_mb_xy;
01375
01376 int ctx = 0;
01377
01378
01379 if( h->left_type[0] && h->chroma_pred_mode_table[mba_xy] != 0 )
01380 ctx++;
01381
01382 if( h->top_type && h->chroma_pred_mode_table[mbb_xy] != 0 )
01383 ctx++;
01384
01385 if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+ctx] ) == 0 )
01386 return 0;
01387
01388 if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+3] ) == 0 )
01389 return 1;
01390 if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+3] ) == 0 )
01391 return 2;
01392 else
01393 return 3;
01394 }
01395
01396 static int decode_cabac_mb_cbp_luma( H264Context *h) {
01397 int cbp_b, cbp_a, ctx, cbp = 0;
01398
01399 cbp_a = h->left_cbp;
01400 cbp_b = h->top_cbp;
01401
01402 ctx = !(cbp_a & 0x02) + 2 * !(cbp_b & 0x04);
01403 cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]);
01404 ctx = !(cbp & 0x01) + 2 * !(cbp_b & 0x08);
01405 cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 1;
01406 ctx = !(cbp_a & 0x08) + 2 * !(cbp & 0x01);
01407 cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 2;
01408 ctx = !(cbp & 0x04) + 2 * !(cbp & 0x02);
01409 cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 3;
01410 return cbp;
01411 }
01412 static int decode_cabac_mb_cbp_chroma( H264Context *h) {
01413 int ctx;
01414 int cbp_a, cbp_b;
01415
01416 cbp_a = (h->left_cbp>>4)&0x03;
01417 cbp_b = (h-> top_cbp>>4)&0x03;
01418
01419 ctx = 0;
01420 if( cbp_a > 0 ) ctx++;
01421 if( cbp_b > 0 ) ctx += 2;
01422 if( get_cabac_noinline( &h->cabac, &h->cabac_state[77 + ctx] ) == 0 )
01423 return 0;
01424
01425 ctx = 4;
01426 if( cbp_a == 2 ) ctx++;
01427 if( cbp_b == 2 ) ctx += 2;
01428 return 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[77 + ctx] );
01429 }
01430
01431 static int decode_cabac_p_mb_sub_type( H264Context *h ) {
01432 if( get_cabac( &h->cabac, &h->cabac_state[21] ) )
01433 return 0;
01434 if( !get_cabac( &h->cabac, &h->cabac_state[22] ) )
01435 return 1;
01436 if( get_cabac( &h->cabac, &h->cabac_state[23] ) )
01437 return 2;
01438 return 3;
01439 }
01440 static int decode_cabac_b_mb_sub_type( H264Context *h ) {
01441 int type;
01442 if( !get_cabac( &h->cabac, &h->cabac_state[36] ) )
01443 return 0;
01444 if( !get_cabac( &h->cabac, &h->cabac_state[37] ) )
01445 return 1 + get_cabac( &h->cabac, &h->cabac_state[39] );
01446 type = 3;
01447 if( get_cabac( &h->cabac, &h->cabac_state[38] ) ) {
01448 if( get_cabac( &h->cabac, &h->cabac_state[39] ) )
01449 return 11 + get_cabac( &h->cabac, &h->cabac_state[39] );
01450 type += 4;
01451 }
01452 type += 2*get_cabac( &h->cabac, &h->cabac_state[39] );
01453 type += get_cabac( &h->cabac, &h->cabac_state[39] );
01454 return type;
01455 }
01456
01457 static int decode_cabac_mb_ref( H264Context *h, int list, int n ) {
01458 int refa = h->ref_cache[list][scan8[n] - 1];
01459 int refb = h->ref_cache[list][scan8[n] - 8];
01460 int ref = 0;
01461 int ctx = 0;
01462
01463 if( h->slice_type_nos == AV_PICTURE_TYPE_B) {
01464 if( refa > 0 && !(h->direct_cache[scan8[n] - 1]&(MB_TYPE_DIRECT2>>1)) )
01465 ctx++;
01466 if( refb > 0 && !(h->direct_cache[scan8[n] - 8]&(MB_TYPE_DIRECT2>>1)) )
01467 ctx += 2;
01468 } else {
01469 if( refa > 0 )
01470 ctx++;
01471 if( refb > 0 )
01472 ctx += 2;
01473 }
01474
01475 while( get_cabac( &h->cabac, &h->cabac_state[54+ctx] ) ) {
01476 ref++;
01477 ctx = (ctx>>2)+4;
01478 if(ref >= 32 ){
01479 return -1;
01480 }
01481 }
01482 return ref;
01483 }
01484
01485 static int decode_cabac_mb_mvd( H264Context *h, int ctxbase, int amvd, int *mvda) {
01486 int mvd;
01487
01488 if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+((amvd-3)>>(INT_BIT-1))+((amvd-33)>>(INT_BIT-1))+2])){
01489
01490 *mvda= 0;
01491 return 0;
01492 }
01493
01494 mvd= 1;
01495 ctxbase+= 3;
01496 while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase] ) ) {
01497 if( mvd < 4 )
01498 ctxbase++;
01499 mvd++;
01500 }
01501
01502 if( mvd >= 9 ) {
01503 int k = 3;
01504 while( get_cabac_bypass( &h->cabac ) ) {
01505 mvd += 1 << k;
01506 k++;
01507 if(k>24){
01508 av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_mvd\n");
01509 return INT_MIN;
01510 }
01511 }
01512 while( k-- ) {
01513 mvd += get_cabac_bypass( &h->cabac )<<k;
01514 }
01515 *mvda=mvd < 70 ? mvd : 70;
01516 }else
01517 *mvda=mvd;
01518 return get_cabac_bypass_sign( &h->cabac, -mvd );
01519 }
01520
01521 #define DECODE_CABAC_MB_MVD( h, list, n )\
01522 {\
01523 int amvd0 = h->mvd_cache[list][scan8[n] - 1][0] +\
01524 h->mvd_cache[list][scan8[n] - 8][0];\
01525 int amvd1 = h->mvd_cache[list][scan8[n] - 1][1] +\
01526 h->mvd_cache[list][scan8[n] - 8][1];\
01527 \
01528 mx += decode_cabac_mb_mvd( h, 40, amvd0, &mpx );\
01529 my += decode_cabac_mb_mvd( h, 47, amvd1, &mpy );\
01530 }
01531
01532 static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx, int max_coeff, int is_dc ) {
01533 int nza, nzb;
01534 int ctx = 0;
01535 static const uint16_t base_ctx[14] = {85,89,93,97,101,1012,460,464,468,1016,472,476,480,1020};
01536
01537 if( is_dc ) {
01538 if( cat == 3 ) {
01539 idx -= CHROMA_DC_BLOCK_INDEX;
01540 nza = (h->left_cbp>>(6+idx))&0x01;
01541 nzb = (h-> top_cbp>>(6+idx))&0x01;
01542 } else {
01543 idx -= LUMA_DC_BLOCK_INDEX;
01544 nza = h->left_cbp&(0x100<<idx);
01545 nzb = h-> top_cbp&(0x100<<idx);
01546 }
01547 } else {
01548 nza = h->non_zero_count_cache[scan8[idx] - 1];
01549 nzb = h->non_zero_count_cache[scan8[idx] - 8];
01550 }
01551
01552 if( nza > 0 )
01553 ctx++;
01554
01555 if( nzb > 0 )
01556 ctx += 2;
01557
01558 return base_ctx[cat] + ctx;
01559 }
01560
01561 DECLARE_ASM_CONST(1, uint8_t, last_coeff_flag_offset_8x8)[63] = {
01562 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
01563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01564 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
01565 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8
01566 };
01567
01568 static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff, int is_dc ) {
01569 static const int significant_coeff_flag_offset[2][14] = {
01570 { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 },
01571 { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 }
01572 };
01573 static const int last_coeff_flag_offset[2][14] = {
01574 { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 },
01575 { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 }
01576 };
01577 static const int coeff_abs_level_m1_offset[14] = {
01578 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766
01579 };
01580 static const uint8_t significant_coeff_flag_offset_8x8[2][63] = {
01581 { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,
01582 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,
01583 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,
01584 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },
01585 { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,
01586 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,
01587 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,
01588 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }
01589 };
01590
01591
01592
01593 static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 };
01594
01595 static const uint8_t coeff_abs_levelgt1_ctx[8] = { 5, 5, 5, 5, 6, 7, 8, 9 };
01596 static const uint8_t coeff_abs_level_transition[2][8] = {
01597
01598 { 1, 2, 3, 3, 4, 5, 6, 7 },
01599
01600 { 4, 4, 4, 4, 5, 6, 7, 7 }
01601 };
01602
01603 int index[64];
01604
01605 int av_unused last;
01606 int coeff_count = 0;
01607 int node_ctx = 0;
01608
01609 uint8_t *significant_coeff_ctx_base;
01610 uint8_t *last_coeff_ctx_base;
01611 uint8_t *abs_level_m1_ctx_base;
01612
01613 #if !ARCH_X86
01614 #define CABAC_ON_STACK
01615 #endif
01616 #ifdef CABAC_ON_STACK
01617 #define CC &cc
01618 CABACContext cc;
01619 cc.range = h->cabac.range;
01620 cc.low = h->cabac.low;
01621 cc.bytestream= h->cabac.bytestream;
01622 #else
01623 #define CC &h->cabac
01624 #endif
01625
01626 significant_coeff_ctx_base = h->cabac_state
01627 + significant_coeff_flag_offset[MB_FIELD][cat];
01628 last_coeff_ctx_base = h->cabac_state
01629 + last_coeff_flag_offset[MB_FIELD][cat];
01630 abs_level_m1_ctx_base = h->cabac_state
01631 + coeff_abs_level_m1_offset[cat];
01632
01633 if( !is_dc && max_coeff == 64 ) {
01634 #define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \
01635 for(last= 0; last < coefs; last++) { \
01636 uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \
01637 if( get_cabac( CC, sig_ctx )) { \
01638 uint8_t *last_ctx = last_coeff_ctx_base + last_off; \
01639 index[coeff_count++] = last; \
01640 if( get_cabac( CC, last_ctx ) ) { \
01641 last= max_coeff; \
01642 break; \
01643 } \
01644 } \
01645 }\
01646 if( last == max_coeff -1 ) {\
01647 index[coeff_count++] = last;\
01648 }
01649 const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
01650 #if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
01651 coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index,
01652 last_coeff_ctx_base-significant_coeff_ctx_base, sig_off);
01653 } else {
01654 coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index,
01655 last_coeff_ctx_base-significant_coeff_ctx_base);
01656 #else
01657 DECODE_SIGNIFICANCE( 63, sig_off[last], last_coeff_flag_offset_8x8[last] );
01658 } else {
01659 DECODE_SIGNIFICANCE( max_coeff - 1, last, last );
01660 #endif
01661 }
01662 assert(coeff_count > 0);
01663
01664 if( is_dc ) {
01665 if( cat == 3 )
01666 h->cbp_table[h->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX);
01667 else
01668 h->cbp_table[h->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX);
01669 h->non_zero_count_cache[scan8[n]] = coeff_count;
01670 } else {
01671 if( max_coeff == 64 )
01672 fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
01673 else {
01674 assert( cat == 1 || cat == 2 || cat == 4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 );
01675 h->non_zero_count_cache[scan8[n]] = coeff_count;
01676 }
01677 }
01678
01679
01680 #define STORE_BLOCK(type) \
01681 do { \
01682 uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \
01683 \
01684 int j= scantable[index[--coeff_count]]; \
01685 \
01686 if( get_cabac( CC, ctx ) == 0 ) { \
01687 node_ctx = coeff_abs_level_transition[0][node_ctx]; \
01688 if( is_dc ) { \
01689 ((type*)block)[j] = get_cabac_bypass_sign( CC, -1); \
01690 }else{ \
01691 ((type*)block)[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6; \
01692 } \
01693 } else { \
01694 int coeff_abs = 2; \
01695 ctx = coeff_abs_levelgt1_ctx[node_ctx] + abs_level_m1_ctx_base; \
01696 node_ctx = coeff_abs_level_transition[1][node_ctx]; \
01697 \
01698 while( coeff_abs < 15 && get_cabac( CC, ctx ) ) { \
01699 coeff_abs++; \
01700 } \
01701 \
01702 if( coeff_abs >= 15 ) { \
01703 int j = 0; \
01704 while( get_cabac_bypass( CC ) ) { \
01705 j++; \
01706 } \
01707 \
01708 coeff_abs=1; \
01709 while( j-- ) { \
01710 coeff_abs += coeff_abs + get_cabac_bypass( CC ); \
01711 } \
01712 coeff_abs+= 14; \
01713 } \
01714 \
01715 if( is_dc ) { \
01716 ((type*)block)[j] = get_cabac_bypass_sign( CC, -coeff_abs ); \
01717 }else{ \
01718 ((type*)block)[j] = ((int)(get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32)) >> 6; \
01719 } \
01720 } \
01721 } while ( coeff_count );
01722
01723 if (h->pixel_shift) {
01724 STORE_BLOCK(int32_t)
01725 } else {
01726 STORE_BLOCK(int16_t)
01727 }
01728 #ifdef CABAC_ON_STACK
01729 h->cabac.range = cc.range ;
01730 h->cabac.low = cc.low ;
01731 h->cabac.bytestream= cc.bytestream;
01732 #endif
01733
01734 }
01735
01736 static void decode_cabac_residual_dc_internal( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, int max_coeff ) {
01737 decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1);
01738 }
01739
01740 static void decode_cabac_residual_nondc_internal( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
01741 decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0);
01742 }
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756 static av_always_inline void decode_cabac_residual_dc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, int max_coeff ) {
01757
01758 if( get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 1 ) ] ) == 0 ) {
01759 h->non_zero_count_cache[scan8[n]] = 0;
01760 return;
01761 }
01762 decode_cabac_residual_dc_internal( h, block, cat, n, scantable, max_coeff );
01763 }
01764
01765 static av_always_inline void decode_cabac_residual_nondc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
01766
01767 if( (cat != 5 || CHROMA444) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) {
01768 if( max_coeff == 64 ) {
01769 fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, 0, 1);
01770 } else {
01771 h->non_zero_count_cache[scan8[n]] = 0;
01772 }
01773 return;
01774 }
01775 decode_cabac_residual_nondc_internal( h, block, cat, n, scantable, qmul, max_coeff );
01776 }
01777
01778 static av_always_inline void decode_cabac_luma_residual( H264Context *h, const uint8_t *scan, const uint8_t *scan8x8, int pixel_shift, int mb_type, int cbp, int p )
01779 {
01780 static const uint8_t ctx_cat[4][3] = {{0,6,10},{1,7,11},{2,8,12},{5,9,13}};
01781 const uint32_t *qmul;
01782 int i8x8, i4x4;
01783 MpegEncContext * const s = &h->s;
01784 int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1];
01785 if( IS_INTRA16x16( mb_type ) ) {
01786
01787 AV_ZERO128(h->mb_luma_dc[p]+0);
01788 AV_ZERO128(h->mb_luma_dc[p]+8);
01789 AV_ZERO128(h->mb_luma_dc[p]+16);
01790 AV_ZERO128(h->mb_luma_dc[p]+24);
01791 decode_cabac_residual_dc(h, h->mb_luma_dc[p], ctx_cat[0][p], LUMA_DC_BLOCK_INDEX+p, scan, 16);
01792
01793 if( cbp&15 ) {
01794 qmul = h->dequant4_coeff[p][qscale];
01795 for( i4x4 = 0; i4x4 < 16; i4x4++ ) {
01796 const int index = 16*p + i4x4;
01797
01798 decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15);
01799 }
01800 } else {
01801 fill_rectangle(&h->non_zero_count_cache[scan8[16*p]], 4, 4, 8, 0, 1);
01802 }
01803 } else {
01804 int cqm = (IS_INTRA( mb_type ) ? 0:3) + p;
01805 for( i8x8 = 0; i8x8 < 4; i8x8++ ) {
01806 if( cbp & (1<<i8x8) ) {
01807 if( IS_8x8DCT(mb_type) ) {
01808 const int index = 16*p + 4*i8x8;
01809 decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[3][p], index,
01810 scan8x8, h->dequant8_coeff[cqm][qscale], 64);
01811 } else {
01812 qmul = h->dequant4_coeff[cqm][qscale];
01813 for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
01814 const int index = 16*p + 4*i8x8 + i4x4;
01815
01816
01817 decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16);
01818
01819 }
01820 }
01821 } else {
01822 uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8+16*p] ];
01823 nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
01824 }
01825 }
01826 }
01827 }
01828
01833 int ff_h264_decode_mb_cabac(H264Context *h) {
01834 MpegEncContext * const s = &h->s;
01835 int mb_xy;
01836 int mb_type, partition_count, cbp = 0;
01837 int dct8x8_allowed= h->pps.transform_8x8_mode;
01838 int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2;
01839 const int pixel_shift = h->pixel_shift;
01840
01841 mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
01842
01843 tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
01844 if( h->slice_type_nos != AV_PICTURE_TYPE_I ) {
01845 int skip;
01846
01847 if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped )
01848 skip = h->next_mb_skipped;
01849 else
01850 skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y );
01851
01852 if( skip ) {
01853 if( FRAME_MBAFF && (s->mb_y&1)==0 ){
01854 s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP;
01855 h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 );
01856 if(!h->next_mb_skipped)
01857 h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
01858 }
01859
01860 decode_mb_skip(h);
01861
01862 h->cbp_table[mb_xy] = 0;
01863 h->chroma_pred_mode_table[mb_xy] = 0;
01864 h->last_qscale_diff = 0;
01865
01866 return 0;
01867
01868 }
01869 }
01870 if(FRAME_MBAFF){
01871 if( (s->mb_y&1) == 0 )
01872 h->mb_mbaff =
01873 h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
01874 }
01875
01876 h->prev_mb_skipped = 0;
01877
01878 fill_decode_neighbors(h, -(MB_FIELD));
01879
01880 if( h->slice_type_nos == AV_PICTURE_TYPE_B ) {
01881 int ctx = 0;
01882 assert(h->slice_type_nos == AV_PICTURE_TYPE_B);
01883
01884 if( !IS_DIRECT( h->left_type[0]-1 ) )
01885 ctx++;
01886 if( !IS_DIRECT( h->top_type-1 ) )
01887 ctx++;
01888
01889 if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) ){
01890 mb_type= 0;
01891 }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) {
01892 mb_type= 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
01893 }else{
01894 int bits;
01895 bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3;
01896 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2;
01897 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1;
01898 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
01899 if( bits < 8 ){
01900 mb_type= bits + 3;
01901 }else if( bits == 13 ){
01902 mb_type= decode_cabac_intra_mb_type(h, 32, 0);
01903 goto decode_intra_mb;
01904 }else if( bits == 14 ){
01905 mb_type= 11;
01906 }else if( bits == 15 ){
01907 mb_type= 22;
01908 }else{
01909 bits= ( bits<<1 ) + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
01910 mb_type= bits - 4;
01911 }
01912 }
01913 partition_count= b_mb_type_info[mb_type].partition_count;
01914 mb_type= b_mb_type_info[mb_type].type;
01915 } else if( h->slice_type_nos == AV_PICTURE_TYPE_P ) {
01916 if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) {
01917
01918 if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) {
01919
01920 mb_type= 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] );
01921 } else {
01922
01923 mb_type= 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] );
01924 }
01925 partition_count= p_mb_type_info[mb_type].partition_count;
01926 mb_type= p_mb_type_info[mb_type].type;
01927 } else {
01928 mb_type= decode_cabac_intra_mb_type(h, 17, 0);
01929 goto decode_intra_mb;
01930 }
01931 } else {
01932 mb_type= decode_cabac_intra_mb_type(h, 3, 1);
01933 if(h->slice_type == AV_PICTURE_TYPE_SI && mb_type)
01934 mb_type--;
01935 assert(h->slice_type_nos == AV_PICTURE_TYPE_I);
01936 decode_intra_mb:
01937 partition_count = 0;
01938 cbp= i_mb_type_info[mb_type].cbp;
01939 h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode;
01940 mb_type= i_mb_type_info[mb_type].type;
01941 }
01942 if(MB_FIELD)
01943 mb_type |= MB_TYPE_INTERLACED;
01944
01945 h->slice_table[ mb_xy ]= h->slice_num;
01946
01947 if(IS_INTRA_PCM(mb_type)) {
01948 static const uint16_t mb_sizes[4] = {256,384,512,768};
01949 const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3;
01950 const uint8_t *ptr;
01951
01952
01953
01954
01955 ptr= h->cabac.bytestream;
01956 if(h->cabac.low&0x1) ptr--;
01957 if(CABAC_BITS==16){
01958 if(h->cabac.low&0x1FF) ptr--;
01959 }
01960
01961
01962 if ((int) (h->cabac.bytestream_end - ptr) < mb_size)
01963 return -1;
01964 memcpy(h->mb, ptr, mb_size); ptr+=mb_size;
01965
01966 ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);
01967
01968
01969 h->cbp_table[mb_xy] = 0xf7ef;
01970 h->chroma_pred_mode_table[mb_xy] = 0;
01971
01972 s->current_picture.qscale_table[mb_xy]= 0;
01973
01974 memset(h->non_zero_count[mb_xy], 16, 48);
01975 s->current_picture.mb_type[mb_xy]= mb_type;
01976 h->last_qscale_diff = 0;
01977 return 0;
01978 }
01979
01980 if(MB_MBAFF){
01981 h->ref_count[0] <<= 1;
01982 h->ref_count[1] <<= 1;
01983 }
01984
01985 fill_decode_caches(h, mb_type);
01986
01987 if( IS_INTRA( mb_type ) ) {
01988 int i, pred_mode;
01989 if( IS_INTRA4x4( mb_type ) ) {
01990 if( dct8x8_allowed && get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ) ) {
01991 mb_type |= MB_TYPE_8x8DCT;
01992 for( i = 0; i < 16; i+=4 ) {
01993 int pred = pred_intra_mode( h, i );
01994 int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred );
01995 fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
01996 }
01997 } else {
01998 for( i = 0; i < 16; i++ ) {
01999 int pred = pred_intra_mode( h, i );
02000 h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred );
02001
02002
02003 }
02004 }
02005 ff_h264_write_back_intra_pred_mode(h);
02006 if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1;
02007 } else {
02008 h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode, 0 );
02009 if( h->intra16x16_pred_mode < 0 ) return -1;
02010 }
02011 if(decode_chroma){
02012 h->chroma_pred_mode_table[mb_xy] =
02013 pred_mode = decode_cabac_mb_chroma_pre_mode( h );
02014
02015 pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode, 1 );
02016 if( pred_mode < 0 ) return -1;
02017 h->chroma_pred_mode= pred_mode;
02018 } else {
02019 h->chroma_pred_mode= DC_128_PRED8x8;
02020 }
02021 } else if( partition_count == 4 ) {
02022 int i, j, sub_partition_count[4], list, ref[2][4];
02023
02024 if( h->slice_type_nos == AV_PICTURE_TYPE_B ) {
02025 for( i = 0; i < 4; i++ ) {
02026 h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h );
02027 sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
02028 h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
02029 }
02030 if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] |
02031 h->sub_mb_type[2] | h->sub_mb_type[3]) ) {
02032 ff_h264_pred_direct_motion(h, &mb_type);
02033 h->ref_cache[0][scan8[4]] =
02034 h->ref_cache[1][scan8[4]] =
02035 h->ref_cache[0][scan8[12]] =
02036 h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
02037 for( i = 0; i < 4; i++ )
02038 fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, (h->sub_mb_type[i]>>1)&0xFF, 1 );
02039 }
02040 } else {
02041 for( i = 0; i < 4; i++ ) {
02042 h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h );
02043 sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
02044 h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
02045 }
02046 }
02047
02048 for( list = 0; list < h->list_count; list++ ) {
02049 for( i = 0; i < 4; i++ ) {
02050 if(IS_DIRECT(h->sub_mb_type[i])) continue;
02051 if(IS_DIR(h->sub_mb_type[i], 0, list)){
02052 if( h->ref_count[list] > 1 ){
02053 ref[list][i] = decode_cabac_mb_ref( h, list, 4*i );
02054 if(ref[list][i] >= (unsigned)h->ref_count[list]){
02055 av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], h->ref_count[list]);
02056 return -1;
02057 }
02058 }else
02059 ref[list][i] = 0;
02060 } else {
02061 ref[list][i] = -1;
02062 }
02063 h->ref_cache[list][ scan8[4*i]+1 ]=
02064 h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i];
02065 }
02066 }
02067
02068 if(dct8x8_allowed)
02069 dct8x8_allowed = get_dct8x8_allowed(h);
02070
02071 for(list=0; list<h->list_count; list++){
02072 for(i=0; i<4; i++){
02073 h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ];
02074 if(IS_DIRECT(h->sub_mb_type[i])){
02075 fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 2);
02076 continue;
02077 }
02078
02079 if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){
02080 const int sub_mb_type= h->sub_mb_type[i];
02081 const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;
02082 for(j=0; j<sub_partition_count[i]; j++){
02083 int mpx, mpy;
02084 int mx, my;
02085 const int index= 4*i + block_width*j;
02086 int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
02087 uint8_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ];
02088 pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
02089 DECODE_CABAC_MB_MVD( h, list, index)
02090 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
02091
02092 if(IS_SUB_8X8(sub_mb_type)){
02093 mv_cache[ 1 ][0]=
02094 mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
02095 mv_cache[ 1 ][1]=
02096 mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;
02097
02098 mvd_cache[ 1 ][0]=
02099 mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mpx;
02100 mvd_cache[ 1 ][1]=
02101 mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= mpy;
02102 }else if(IS_SUB_8X4(sub_mb_type)){
02103 mv_cache[ 1 ][0]= mx;
02104 mv_cache[ 1 ][1]= my;
02105
02106 mvd_cache[ 1 ][0]= mpx;
02107 mvd_cache[ 1 ][1]= mpy;
02108 }else if(IS_SUB_4X8(sub_mb_type)){
02109 mv_cache[ 8 ][0]= mx;
02110 mv_cache[ 8 ][1]= my;
02111
02112 mvd_cache[ 8 ][0]= mpx;
02113 mvd_cache[ 8 ][1]= mpy;
02114 }
02115 mv_cache[ 0 ][0]= mx;
02116 mv_cache[ 0 ][1]= my;
02117
02118 mvd_cache[ 0 ][0]= mpx;
02119 mvd_cache[ 0 ][1]= mpy;
02120 }
02121 }else{
02122 fill_rectangle(h->mv_cache [list][ scan8[4*i] ], 2, 2, 8, 0, 4);
02123 fill_rectangle(h->mvd_cache[list][ scan8[4*i] ], 2, 2, 8, 0, 2);
02124 }
02125 }
02126 }
02127 } else if( IS_DIRECT(mb_type) ) {
02128 ff_h264_pred_direct_motion(h, &mb_type);
02129 fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 2);
02130 fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 2);
02131 dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
02132 } else {
02133 int list, i;
02134 if(IS_16X16(mb_type)){
02135 for(list=0; list<h->list_count; list++){
02136 if(IS_DIR(mb_type, 0, list)){
02137 int ref;
02138 if(h->ref_count[list] > 1){
02139 ref= decode_cabac_mb_ref(h, list, 0);
02140 if(ref >= (unsigned)h->ref_count[list]){
02141 av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
02142 return -1;
02143 }
02144 }else
02145 ref=0;
02146 fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1);
02147 }
02148 }
02149 for(list=0; list<h->list_count; list++){
02150 if(IS_DIR(mb_type, 0, list)){
02151 int mx,my,mpx,mpy;
02152 pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
02153 DECODE_CABAC_MB_MVD( h, list, 0)
02154 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
02155
02156 fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack8to16(mpx,mpy), 2);
02157 fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
02158 }
02159 }
02160 }
02161 else if(IS_16X8(mb_type)){
02162 for(list=0; list<h->list_count; list++){
02163 for(i=0; i<2; i++){
02164 if(IS_DIR(mb_type, i, list)){
02165 int ref;
02166 if(h->ref_count[list] > 1){
02167 ref= decode_cabac_mb_ref( h, list, 8*i );
02168 if(ref >= (unsigned)h->ref_count[list]){
02169 av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
02170 return -1;
02171 }
02172 }else
02173 ref=0;
02174 fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1);
02175 }else
02176 fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1);
02177 }
02178 }
02179 for(list=0; list<h->list_count; list++){
02180 for(i=0; i<2; i++){
02181 if(IS_DIR(mb_type, i, list)){
02182 int mx,my,mpx,mpy;
02183 pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
02184 DECODE_CABAC_MB_MVD( h, list, 8*i)
02185 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
02186
02187 fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack8to16(mpx,mpy), 2);
02188 fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4);
02189 }else{
02190 fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 2);
02191 fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4);
02192 }
02193 }
02194 }
02195 }else{
02196 assert(IS_8X16(mb_type));
02197 for(list=0; list<h->list_count; list++){
02198 for(i=0; i<2; i++){
02199 if(IS_DIR(mb_type, i, list)){
02200 int ref;
02201 if(h->ref_count[list] > 1){
02202 ref= decode_cabac_mb_ref( h, list, 4*i );
02203 if(ref >= (unsigned)h->ref_count[list]){
02204 av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
02205 return -1;
02206 }
02207 }else
02208 ref=0;
02209 fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1);
02210 }else
02211 fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1);
02212 }
02213 }
02214 for(list=0; list<h->list_count; list++){
02215 for(i=0; i<2; i++){
02216 if(IS_DIR(mb_type, i, list)){
02217 int mx,my,mpx,mpy;
02218 pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
02219 DECODE_CABAC_MB_MVD( h, list, 4*i)
02220
02221 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
02222 fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack8to16(mpx,mpy), 2);
02223 fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4);
02224 }else{
02225 fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 2);
02226 fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4);
02227 }
02228 }
02229 }
02230 }
02231 }
02232
02233 if( IS_INTER( mb_type ) ) {
02234 h->chroma_pred_mode_table[mb_xy] = 0;
02235 write_back_motion( h, mb_type );
02236 }
02237
02238 if( !IS_INTRA16x16( mb_type ) ) {
02239 cbp = decode_cabac_mb_cbp_luma( h );
02240 if(decode_chroma)
02241 cbp |= decode_cabac_mb_cbp_chroma( h ) << 4;
02242 }
02243
02244 h->cbp_table[mb_xy] = h->cbp = cbp;
02245
02246 if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) {
02247 mb_type |= MB_TYPE_8x8DCT * get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] );
02248 }
02249
02250
02251
02252 if (CHROMA444 && IS_8x8DCT(mb_type)){
02253 int i;
02254 for (i = 0; i < 2; i++){
02255 if (h->left_type[i] && !IS_8x8DCT(h->left_type[i])){
02256 h->non_zero_count_cache[3+8* 1 + 2*8*i]=
02257 h->non_zero_count_cache[3+8* 2 + 2*8*i]=
02258 h->non_zero_count_cache[3+8* 6 + 2*8*i]=
02259 h->non_zero_count_cache[3+8* 7 + 2*8*i]=
02260 h->non_zero_count_cache[3+8*11 + 2*8*i]=
02261 h->non_zero_count_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0;
02262 }
02263 }
02264 if (h->top_type && !IS_8x8DCT(h->top_type)){
02265 uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
02266 AV_WN32A(&h->non_zero_count_cache[4+8* 0], top_empty);
02267 AV_WN32A(&h->non_zero_count_cache[4+8* 5], top_empty);
02268 AV_WN32A(&h->non_zero_count_cache[4+8*10], top_empty);
02269 }
02270 }
02271 s->current_picture.mb_type[mb_xy]= mb_type;
02272
02273 if( cbp || IS_INTRA16x16( mb_type ) ) {
02274 const uint8_t *scan, *scan8x8;
02275 const uint32_t *qmul;
02276
02277 if(IS_INTERLACED(mb_type)){
02278 scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0;
02279 scan= s->qscale ? h->field_scan : h->field_scan_q0;
02280 }else{
02281 scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0;
02282 scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
02283 }
02284
02285
02286 if(get_cabac_noinline( &h->cabac, &h->cabac_state[60 + (h->last_qscale_diff != 0)])){
02287 int val = 1;
02288 int ctx= 2;
02289 const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
02290
02291 while( get_cabac_noinline( &h->cabac, &h->cabac_state[60 + ctx] ) ) {
02292 ctx= 3;
02293 val++;
02294 if(val > 2*max_qp){
02295 av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y);
02296 return -1;
02297 }
02298 }
02299
02300 if( val&0x01 )
02301 val= (val + 1)>>1 ;
02302 else
02303 val= -((val + 1)>>1);
02304 h->last_qscale_diff = val;
02305 s->qscale += val;
02306 if(((unsigned)s->qscale) > max_qp){
02307 if(s->qscale<0) s->qscale+= max_qp+1;
02308 else s->qscale-= max_qp+1;
02309 }
02310 h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
02311 h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
02312 }else
02313 h->last_qscale_diff=0;
02314
02315 decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 0);
02316 if(CHROMA444){
02317 decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 1);
02318 decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 2);
02319 } else {
02320 if( cbp&0x30 ){
02321 int c;
02322 for( c = 0; c < 2; c++ ) {
02323
02324 decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
02325 }
02326 }
02327
02328 if( cbp&0x20 ) {
02329 int c, i;
02330 for( c = 0; c < 2; c++ ) {
02331 qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
02332 for( i = 0; i < 4; i++ ) {
02333 const int index = 16 + 16 * c + i;
02334
02335 decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15);
02336 }
02337 }
02338 } else {
02339 fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
02340 fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
02341 }
02342 }
02343 } else {
02344 fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1);
02345 fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
02346 fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
02347 h->last_qscale_diff = 0;
02348 }
02349
02350 s->current_picture.qscale_table[mb_xy]= s->qscale;
02351 write_back_non_zero_count(h);
02352
02353 if(MB_MBAFF){
02354 h->ref_count[0] >>= 1;
02355 h->ref_count[1] >>= 1;
02356 }
02357
02358 return 0;
02359 }