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