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 "config.h"
00032 #include "cabac.h"
00033 #include "cabac_functions.h"
00034 #include "internal.h"
00035 #include "dsputil.h"
00036 #include "avcodec.h"
00037 #include "h264.h"
00038 #include "h264data.h"
00039 #include "h264_mvpred.h"
00040 #include "golomb.h"
00041 #include "libavutil/avassert.h"
00042
00043 #if ARCH_X86
00044 #include "x86/h264_i386.h"
00045 #endif
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 static av_always_inline void
01563 decode_cabac_residual_internal(H264Context *h, DCTELEM *block,
01564 int cat, int n, const uint8_t *scantable,
01565 const uint32_t *qmul, int max_coeff,
01566 int is_dc, int chroma422)
01567 {
01568 static const int significant_coeff_flag_offset[2][14] = {
01569 { 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 },
01570 { 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 }
01571 };
01572 static const int last_coeff_flag_offset[2][14] = {
01573 { 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 },
01574 { 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 }
01575 };
01576 static const int coeff_abs_level_m1_offset[14] = {
01577 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
01578 };
01579 static const uint8_t significant_coeff_flag_offset_8x8[2][63] = {
01580 { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,
01581 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,
01582 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,
01583 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },
01584 { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,
01585 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,
01586 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,
01587 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }
01588 };
01589 static const uint8_t sig_coeff_offset_dc[7] = { 0, 0, 1, 1, 2, 2, 2 };
01590
01591
01592
01593 static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 };
01594
01595 static const uint8_t coeff_abs_levelgt1_ctx[2][8] = {
01596 { 5, 5, 5, 5, 6, 7, 8, 9 },
01597 { 5, 5, 5, 5, 6, 7, 8, 8 },
01598 };
01599 static const uint8_t coeff_abs_level_transition[2][8] = {
01600
01601 { 1, 2, 3, 3, 4, 5, 6, 7 },
01602
01603 { 4, 4, 4, 4, 5, 6, 7, 7 }
01604 };
01605
01606 int index[64];
01607
01608 int av_unused last;
01609 int coeff_count = 0;
01610 int node_ctx = 0;
01611
01612 uint8_t *significant_coeff_ctx_base;
01613 uint8_t *last_coeff_ctx_base;
01614 uint8_t *abs_level_m1_ctx_base;
01615
01616 #if !ARCH_X86
01617 #define CABAC_ON_STACK
01618 #endif
01619 #ifdef CABAC_ON_STACK
01620 #define CC &cc
01621 CABACContext cc;
01622 cc.range = h->cabac.range;
01623 cc.low = h->cabac.low;
01624 cc.bytestream= h->cabac.bytestream;
01625 #else
01626 #define CC &h->cabac
01627 #endif
01628
01629 significant_coeff_ctx_base = h->cabac_state
01630 + significant_coeff_flag_offset[MB_FIELD][cat];
01631 last_coeff_ctx_base = h->cabac_state
01632 + last_coeff_flag_offset[MB_FIELD][cat];
01633 abs_level_m1_ctx_base = h->cabac_state
01634 + coeff_abs_level_m1_offset[cat];
01635
01636 if( !is_dc && max_coeff == 64 ) {
01637 #define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \
01638 for(last= 0; last < coefs; last++) { \
01639 uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \
01640 if( get_cabac( CC, sig_ctx )) { \
01641 uint8_t *last_ctx = last_coeff_ctx_base + last_off; \
01642 index[coeff_count++] = last; \
01643 if( get_cabac( CC, last_ctx ) ) { \
01644 last= max_coeff; \
01645 break; \
01646 } \
01647 } \
01648 }\
01649 if( last == max_coeff -1 ) {\
01650 index[coeff_count++] = last;\
01651 }
01652 const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
01653 #ifdef decode_significance
01654 coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index,
01655 last_coeff_ctx_base, sig_off);
01656 } else {
01657 if (is_dc && chroma422) {
01658 DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);
01659 } else {
01660 coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index,
01661 last_coeff_ctx_base-significant_coeff_ctx_base);
01662 }
01663 #else
01664 DECODE_SIGNIFICANCE( 63, sig_off[last], ff_h264_last_coeff_flag_offset_8x8[last] );
01665 } else {
01666 if (is_dc && chroma422) {
01667 DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);
01668 } else {
01669 DECODE_SIGNIFICANCE(max_coeff - 1, last, last);
01670 }
01671 #endif
01672 }
01673 av_assert2(coeff_count > 0);
01674
01675 if( is_dc ) {
01676 if( cat == 3 )
01677 h->cbp_table[h->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX);
01678 else
01679 h->cbp_table[h->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX);
01680 h->non_zero_count_cache[scan8[n]] = coeff_count;
01681 } else {
01682 if( max_coeff == 64 )
01683 fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
01684 else {
01685 av_assert2( cat == 1 || cat == 2 || cat == 4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 );
01686 h->non_zero_count_cache[scan8[n]] = coeff_count;
01687 }
01688 }
01689
01690
01691 #define STORE_BLOCK(type) \
01692 do { \
01693 uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \
01694 \
01695 int j= scantable[index[--coeff_count]]; \
01696 \
01697 if( get_cabac( CC, ctx ) == 0 ) { \
01698 node_ctx = coeff_abs_level_transition[0][node_ctx]; \
01699 if( is_dc ) { \
01700 ((type*)block)[j] = get_cabac_bypass_sign( CC, -1); \
01701 }else{ \
01702 ((type*)block)[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6; \
01703 } \
01704 } else { \
01705 int coeff_abs = 2; \
01706 ctx = coeff_abs_levelgt1_ctx[is_dc && chroma422][node_ctx] + abs_level_m1_ctx_base; \
01707 node_ctx = coeff_abs_level_transition[1][node_ctx]; \
01708 \
01709 while( coeff_abs < 15 && get_cabac( CC, ctx ) ) { \
01710 coeff_abs++; \
01711 } \
01712 \
01713 if( coeff_abs >= 15 ) { \
01714 int j = 0; \
01715 while( get_cabac_bypass( CC ) ) { \
01716 j++; \
01717 } \
01718 \
01719 coeff_abs=1; \
01720 while( j-- ) { \
01721 coeff_abs += coeff_abs + get_cabac_bypass( CC ); \
01722 } \
01723 coeff_abs+= 14; \
01724 } \
01725 \
01726 if( is_dc ) { \
01727 ((type*)block)[j] = get_cabac_bypass_sign( CC, -coeff_abs ); \
01728 }else{ \
01729 ((type*)block)[j] = ((int)(get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32)) >> 6; \
01730 } \
01731 } \
01732 } while ( coeff_count );
01733
01734 if (h->pixel_shift) {
01735 STORE_BLOCK(int32_t)
01736 } else {
01737 STORE_BLOCK(int16_t)
01738 }
01739 #ifdef CABAC_ON_STACK
01740 h->cabac.range = cc.range ;
01741 h->cabac.low = cc.low ;
01742 h->cabac.bytestream= cc.bytestream;
01743 #endif
01744
01745 }
01746
01747 static void decode_cabac_residual_dc_internal( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, int max_coeff ) {
01748 decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 0);
01749 }
01750
01751 static void decode_cabac_residual_dc_internal_422(H264Context *h, DCTELEM *block,
01752 int cat, int n, const uint8_t *scantable,
01753 int max_coeff)
01754 {
01755 decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 1);
01756 }
01757
01758 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 ) {
01759 decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0, 0);
01760 }
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774 static av_always_inline void decode_cabac_residual_dc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, int max_coeff ) {
01775
01776 if( get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 1 ) ] ) == 0 ) {
01777 h->non_zero_count_cache[scan8[n]] = 0;
01778 return;
01779 }
01780 decode_cabac_residual_dc_internal( h, block, cat, n, scantable, max_coeff );
01781 }
01782
01783 static av_always_inline void
01784 decode_cabac_residual_dc_422(H264Context *h, DCTELEM *block,
01785 int cat, int n, const uint8_t *scantable,
01786 int max_coeff)
01787 {
01788
01789 if (get_cabac(&h->cabac, &h->cabac_state[get_cabac_cbf_ctx(h, cat, n, max_coeff, 1)]) == 0) {
01790 h->non_zero_count_cache[scan8[n]] = 0;
01791 return;
01792 }
01793 decode_cabac_residual_dc_internal_422(h, block, cat, n, scantable, max_coeff);
01794 }
01795
01796 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 ) {
01797
01798 if( (cat != 5 || CHROMA444) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) {
01799 if( max_coeff == 64 ) {
01800 fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, 0, 1);
01801 } else {
01802 h->non_zero_count_cache[scan8[n]] = 0;
01803 }
01804 return;
01805 }
01806 decode_cabac_residual_nondc_internal( h, block, cat, n, scantable, qmul, max_coeff );
01807 }
01808
01809 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 )
01810 {
01811 static const uint8_t ctx_cat[4][3] = {{0,6,10},{1,7,11},{2,8,12},{5,9,13}};
01812 const uint32_t *qmul;
01813 int i8x8, i4x4;
01814 MpegEncContext * const s = &h->s;
01815 int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1];
01816 if( IS_INTRA16x16( mb_type ) ) {
01817 AV_ZERO128(h->mb_luma_dc[p]+0);
01818 AV_ZERO128(h->mb_luma_dc[p]+8);
01819 AV_ZERO128(h->mb_luma_dc[p]+16);
01820 AV_ZERO128(h->mb_luma_dc[p]+24);
01821 decode_cabac_residual_dc(h, h->mb_luma_dc[p], ctx_cat[0][p], LUMA_DC_BLOCK_INDEX+p, scan, 16);
01822
01823 if( cbp&15 ) {
01824 qmul = h->dequant4_coeff[p][qscale];
01825 for( i4x4 = 0; i4x4 < 16; i4x4++ ) {
01826 const int index = 16*p + i4x4;
01827 decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15);
01828 }
01829 } else {
01830 fill_rectangle(&h->non_zero_count_cache[scan8[16*p]], 4, 4, 8, 0, 1);
01831 }
01832 } else {
01833 int cqm = (IS_INTRA( mb_type ) ? 0:3) + p;
01834 for( i8x8 = 0; i8x8 < 4; i8x8++ ) {
01835 if( cbp & (1<<i8x8) ) {
01836 if( IS_8x8DCT(mb_type) ) {
01837 const int index = 16*p + 4*i8x8;
01838 decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[3][p], index,
01839 scan8x8, h->dequant8_coeff[cqm][qscale], 64);
01840 } else {
01841 qmul = h->dequant4_coeff[cqm][qscale];
01842 for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
01843 const int index = 16*p + 4*i8x8 + i4x4;
01844
01845 decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16);
01846
01847 }
01848 }
01849 } else {
01850 fill_rectangle(&h->non_zero_count_cache[scan8[4*i8x8+16*p]], 2, 2, 8, 0, 1);
01851 }
01852 }
01853 }
01854 }
01855
01860 int ff_h264_decode_mb_cabac(H264Context *h) {
01861 MpegEncContext * const s = &h->s;
01862 int mb_xy;
01863 int mb_type, partition_count, cbp = 0;
01864 int dct8x8_allowed= h->pps.transform_8x8_mode;
01865 int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2;
01866 const int pixel_shift = h->pixel_shift;
01867 unsigned local_ref_count[2];
01868
01869 mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
01870
01871 tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
01872 if( h->slice_type_nos != AV_PICTURE_TYPE_I ) {
01873 int skip;
01874
01875 if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped )
01876 skip = h->next_mb_skipped;
01877 else
01878 skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y );
01879
01880 if( skip ) {
01881 if( FRAME_MBAFF && (s->mb_y&1)==0 ){
01882 s->current_picture.f.mb_type[mb_xy] = MB_TYPE_SKIP;
01883 h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 );
01884 if(!h->next_mb_skipped)
01885 h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
01886 }
01887
01888 decode_mb_skip(h);
01889
01890 h->cbp_table[mb_xy] = 0;
01891 h->chroma_pred_mode_table[mb_xy] = 0;
01892 h->last_qscale_diff = 0;
01893
01894 return 0;
01895
01896 }
01897 }
01898 if(FRAME_MBAFF){
01899 if( (s->mb_y&1) == 0 )
01900 h->mb_mbaff =
01901 h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
01902 }
01903
01904 h->prev_mb_skipped = 0;
01905
01906 fill_decode_neighbors(h, -(MB_FIELD));
01907
01908 if( h->slice_type_nos == AV_PICTURE_TYPE_B ) {
01909 int ctx = 0;
01910 av_assert2(h->slice_type_nos == AV_PICTURE_TYPE_B);
01911
01912 if( !IS_DIRECT( h->left_type[LTOP]-1 ) )
01913 ctx++;
01914 if( !IS_DIRECT( h->top_type-1 ) )
01915 ctx++;
01916
01917 if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) ){
01918 mb_type= 0;
01919 }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) {
01920 mb_type= 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
01921 }else{
01922 int bits;
01923 bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3;
01924 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2;
01925 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1;
01926 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
01927 if( bits < 8 ){
01928 mb_type= bits + 3;
01929 }else if( bits == 13 ){
01930 mb_type= decode_cabac_intra_mb_type(h, 32, 0);
01931 goto decode_intra_mb;
01932 }else if( bits == 14 ){
01933 mb_type= 11;
01934 }else if( bits == 15 ){
01935 mb_type= 22;
01936 }else{
01937 bits= ( bits<<1 ) + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
01938 mb_type= bits - 4;
01939 }
01940 }
01941 partition_count= b_mb_type_info[mb_type].partition_count;
01942 mb_type= b_mb_type_info[mb_type].type;
01943 } else if( h->slice_type_nos == AV_PICTURE_TYPE_P ) {
01944 if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) {
01945
01946 if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) {
01947
01948 mb_type= 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] );
01949 } else {
01950
01951 mb_type= 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] );
01952 }
01953 partition_count= p_mb_type_info[mb_type].partition_count;
01954 mb_type= p_mb_type_info[mb_type].type;
01955 } else {
01956 mb_type= decode_cabac_intra_mb_type(h, 17, 0);
01957 goto decode_intra_mb;
01958 }
01959 } else {
01960 mb_type= decode_cabac_intra_mb_type(h, 3, 1);
01961 if(h->slice_type == AV_PICTURE_TYPE_SI && mb_type)
01962 mb_type--;
01963 av_assert2(h->slice_type_nos == AV_PICTURE_TYPE_I);
01964 decode_intra_mb:
01965 partition_count = 0;
01966 cbp= i_mb_type_info[mb_type].cbp;
01967 h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode;
01968 mb_type= i_mb_type_info[mb_type].type;
01969 }
01970 if(MB_FIELD)
01971 mb_type |= MB_TYPE_INTERLACED;
01972
01973 h->slice_table[ mb_xy ]= h->slice_num;
01974
01975 if(IS_INTRA_PCM(mb_type)) {
01976 const int mb_size = ff_h264_mb_sizes[h->sps.chroma_format_idc] *
01977 h->sps.bit_depth_luma >> 3;
01978 const uint8_t *ptr;
01979
01980
01981
01982
01983 ptr= h->cabac.bytestream;
01984 if(h->cabac.low&0x1) ptr--;
01985 if(CABAC_BITS==16){
01986 if(h->cabac.low&0x1FF) ptr--;
01987 }
01988
01989
01990 if ((int) (h->cabac.bytestream_end - ptr) < mb_size)
01991 return -1;
01992 memcpy(h->mb, ptr, mb_size); ptr+=mb_size;
01993
01994 ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);
01995
01996
01997 h->cbp_table[mb_xy] = 0xf7ef;
01998 h->chroma_pred_mode_table[mb_xy] = 0;
01999
02000 s->current_picture.f.qscale_table[mb_xy] = 0;
02001
02002 memset(h->non_zero_count[mb_xy], 16, 48);
02003 s->current_picture.f.mb_type[mb_xy] = mb_type;
02004 h->last_qscale_diff = 0;
02005 return 0;
02006 }
02007
02008 local_ref_count[0] = h->ref_count[0] << MB_MBAFF;
02009 local_ref_count[1] = h->ref_count[1] << MB_MBAFF;
02010
02011 fill_decode_caches(h, mb_type);
02012
02013 if( IS_INTRA( mb_type ) ) {
02014 int i, pred_mode;
02015 if( IS_INTRA4x4( mb_type ) ) {
02016 if( dct8x8_allowed && get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ) ) {
02017 mb_type |= MB_TYPE_8x8DCT;
02018 for( i = 0; i < 16; i+=4 ) {
02019 int pred = pred_intra_mode( h, i );
02020 int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred );
02021 fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
02022 }
02023 } else {
02024 for( i = 0; i < 16; i++ ) {
02025 int pred = pred_intra_mode( h, i );
02026 h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred );
02027
02028 av_dlog(s->avctx, "i4x4 pred=%d mode=%d\n", pred,
02029 h->intra4x4_pred_mode_cache[scan8[i]]);
02030 }
02031 }
02032 write_back_intra_pred_mode(h);
02033 if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1;
02034 } else {
02035 h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode, 0 );
02036 if( h->intra16x16_pred_mode < 0 ) return -1;
02037 }
02038 if(decode_chroma){
02039 h->chroma_pred_mode_table[mb_xy] =
02040 pred_mode = decode_cabac_mb_chroma_pre_mode( h );
02041
02042 pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode, 1 );
02043 if( pred_mode < 0 ) return -1;
02044 h->chroma_pred_mode= pred_mode;
02045 } else {
02046 h->chroma_pred_mode= DC_128_PRED8x8;
02047 }
02048 } else if( partition_count == 4 ) {
02049 int i, j, sub_partition_count[4], list, ref[2][4];
02050
02051 if( h->slice_type_nos == AV_PICTURE_TYPE_B ) {
02052 for( i = 0; i < 4; i++ ) {
02053 h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h );
02054 sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
02055 h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
02056 }
02057 if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] |
02058 h->sub_mb_type[2] | h->sub_mb_type[3]) ) {
02059 ff_h264_pred_direct_motion(h, &mb_type);
02060 h->ref_cache[0][scan8[4]] =
02061 h->ref_cache[1][scan8[4]] =
02062 h->ref_cache[0][scan8[12]] =
02063 h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
02064 for( i = 0; i < 4; i++ )
02065 fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, (h->sub_mb_type[i]>>1)&0xFF, 1 );
02066 }
02067 } else {
02068 for( i = 0; i < 4; i++ ) {
02069 h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h );
02070 sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
02071 h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
02072 }
02073 }
02074
02075 for( list = 0; list < h->list_count; list++ ) {
02076 for( i = 0; i < 4; i++ ) {
02077 if(IS_DIRECT(h->sub_mb_type[i])) continue;
02078 if(IS_DIR(h->sub_mb_type[i], 0, list)){
02079 if (local_ref_count[list] > 1) {
02080 ref[list][i] = decode_cabac_mb_ref( h, list, 4*i );
02081 if (ref[list][i] >= (unsigned)local_ref_count[list]) {
02082 av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], local_ref_count[list]);
02083 return -1;
02084 }
02085 }else
02086 ref[list][i] = 0;
02087 } else {
02088 ref[list][i] = -1;
02089 }
02090 h->ref_cache[list][ scan8[4*i]+1 ]=
02091 h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i];
02092 }
02093 }
02094
02095 if(dct8x8_allowed)
02096 dct8x8_allowed = get_dct8x8_allowed(h);
02097
02098 for(list=0; list<h->list_count; list++){
02099 for(i=0; i<4; i++){
02100 h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ];
02101 if(IS_DIRECT(h->sub_mb_type[i])){
02102 fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 2);
02103 continue;
02104 }
02105
02106 if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){
02107 const int sub_mb_type= h->sub_mb_type[i];
02108 const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;
02109 for(j=0; j<sub_partition_count[i]; j++){
02110 int mpx, mpy;
02111 int mx, my;
02112 const int index= 4*i + block_width*j;
02113 int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
02114 uint8_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ];
02115 pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
02116 DECODE_CABAC_MB_MVD( h, list, index)
02117 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
02118
02119 if(IS_SUB_8X8(sub_mb_type)){
02120 mv_cache[ 1 ][0]=
02121 mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
02122 mv_cache[ 1 ][1]=
02123 mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;
02124
02125 mvd_cache[ 1 ][0]=
02126 mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mpx;
02127 mvd_cache[ 1 ][1]=
02128 mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= mpy;
02129 }else if(IS_SUB_8X4(sub_mb_type)){
02130 mv_cache[ 1 ][0]= mx;
02131 mv_cache[ 1 ][1]= my;
02132
02133 mvd_cache[ 1 ][0]= mpx;
02134 mvd_cache[ 1 ][1]= mpy;
02135 }else if(IS_SUB_4X8(sub_mb_type)){
02136 mv_cache[ 8 ][0]= mx;
02137 mv_cache[ 8 ][1]= my;
02138
02139 mvd_cache[ 8 ][0]= mpx;
02140 mvd_cache[ 8 ][1]= mpy;
02141 }
02142 mv_cache[ 0 ][0]= mx;
02143 mv_cache[ 0 ][1]= my;
02144
02145 mvd_cache[ 0 ][0]= mpx;
02146 mvd_cache[ 0 ][1]= mpy;
02147 }
02148 }else{
02149 fill_rectangle(h->mv_cache [list][ scan8[4*i] ], 2, 2, 8, 0, 4);
02150 fill_rectangle(h->mvd_cache[list][ scan8[4*i] ], 2, 2, 8, 0, 2);
02151 }
02152 }
02153 }
02154 } else if( IS_DIRECT(mb_type) ) {
02155 ff_h264_pred_direct_motion(h, &mb_type);
02156 fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 2);
02157 fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 2);
02158 dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
02159 } else {
02160 int list, i;
02161 if(IS_16X16(mb_type)){
02162 for(list=0; list<h->list_count; list++){
02163 if(IS_DIR(mb_type, 0, list)){
02164 int ref;
02165 if (local_ref_count[list] > 1) {
02166 ref= decode_cabac_mb_ref(h, list, 0);
02167 if (ref >= (unsigned)local_ref_count[list]) {
02168 av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
02169 return -1;
02170 }
02171 }else
02172 ref=0;
02173 fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1);
02174 }
02175 }
02176 for(list=0; list<h->list_count; list++){
02177 if(IS_DIR(mb_type, 0, list)){
02178 int mx,my,mpx,mpy;
02179 pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
02180 DECODE_CABAC_MB_MVD( h, list, 0)
02181 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
02182
02183 fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack8to16(mpx,mpy), 2);
02184 fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
02185 }
02186 }
02187 }
02188 else if(IS_16X8(mb_type)){
02189 for(list=0; list<h->list_count; list++){
02190 for(i=0; i<2; i++){
02191 if(IS_DIR(mb_type, i, list)){
02192 int ref;
02193 if (local_ref_count[list] > 1) {
02194 ref= decode_cabac_mb_ref( h, list, 8*i );
02195 if (ref >= (unsigned)local_ref_count[list]) {
02196 av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
02197 return -1;
02198 }
02199 }else
02200 ref=0;
02201 fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1);
02202 }else
02203 fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1);
02204 }
02205 }
02206 for(list=0; list<h->list_count; list++){
02207 for(i=0; i<2; i++){
02208 if(IS_DIR(mb_type, i, list)){
02209 int mx,my,mpx,mpy;
02210 pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
02211 DECODE_CABAC_MB_MVD( h, list, 8*i)
02212 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
02213
02214 fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack8to16(mpx,mpy), 2);
02215 fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4);
02216 }else{
02217 fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 2);
02218 fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4);
02219 }
02220 }
02221 }
02222 }else{
02223 av_assert2(IS_8X16(mb_type));
02224 for(list=0; list<h->list_count; list++){
02225 for(i=0; i<2; i++){
02226 if(IS_DIR(mb_type, i, list)){
02227 int ref;
02228 if (local_ref_count[list] > 1) {
02229 ref= decode_cabac_mb_ref( h, list, 4*i );
02230 if (ref >= (unsigned)local_ref_count[list]) {
02231 av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, local_ref_count[list]);
02232 return -1;
02233 }
02234 }else
02235 ref=0;
02236 fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1);
02237 }else
02238 fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1);
02239 }
02240 }
02241 for(list=0; list<h->list_count; list++){
02242 for(i=0; i<2; i++){
02243 if(IS_DIR(mb_type, i, list)){
02244 int mx,my,mpx,mpy;
02245 pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
02246 DECODE_CABAC_MB_MVD( h, list, 4*i)
02247
02248 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
02249 fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack8to16(mpx,mpy), 2);
02250 fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4);
02251 }else{
02252 fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 2);
02253 fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4);
02254 }
02255 }
02256 }
02257 }
02258 }
02259
02260 if( IS_INTER( mb_type ) ) {
02261 h->chroma_pred_mode_table[mb_xy] = 0;
02262 write_back_motion( h, mb_type );
02263 }
02264
02265 if( !IS_INTRA16x16( mb_type ) ) {
02266 cbp = decode_cabac_mb_cbp_luma( h );
02267 if(decode_chroma)
02268 cbp |= decode_cabac_mb_cbp_chroma( h ) << 4;
02269 } else {
02270 if (!decode_chroma && cbp>15) {
02271 av_log(s->avctx, AV_LOG_ERROR, "gray chroma\n");
02272 return AVERROR_INVALIDDATA;
02273 }
02274 }
02275
02276 h->cbp_table[mb_xy] = h->cbp = cbp;
02277
02278 if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) {
02279 mb_type |= MB_TYPE_8x8DCT * get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] );
02280 }
02281
02282
02283
02284 if (CHROMA444 && IS_8x8DCT(mb_type)){
02285 int i;
02286 uint8_t *nnz_cache = h->non_zero_count_cache;
02287 for (i = 0; i < 2; i++){
02288 if (h->left_type[LEFT(i)] && !IS_8x8DCT(h->left_type[LEFT(i)])){
02289 nnz_cache[3+8* 1 + 2*8*i]=
02290 nnz_cache[3+8* 2 + 2*8*i]=
02291 nnz_cache[3+8* 6 + 2*8*i]=
02292 nnz_cache[3+8* 7 + 2*8*i]=
02293 nnz_cache[3+8*11 + 2*8*i]=
02294 nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0;
02295 }
02296 }
02297 if (h->top_type && !IS_8x8DCT(h->top_type)){
02298 uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
02299 AV_WN32A(&nnz_cache[4+8* 0], top_empty);
02300 AV_WN32A(&nnz_cache[4+8* 5], top_empty);
02301 AV_WN32A(&nnz_cache[4+8*10], top_empty);
02302 }
02303 }
02304 s->current_picture.f.mb_type[mb_xy] = mb_type;
02305
02306 if( cbp || IS_INTRA16x16( mb_type ) ) {
02307 const uint8_t *scan, *scan8x8;
02308 const uint32_t *qmul;
02309
02310 if(IS_INTERLACED(mb_type)){
02311 scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0;
02312 scan= s->qscale ? h->field_scan : h->field_scan_q0;
02313 }else{
02314 scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0;
02315 scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
02316 }
02317
02318
02319 if(get_cabac_noinline( &h->cabac, &h->cabac_state[60 + (h->last_qscale_diff != 0)])){
02320 int val = 1;
02321 int ctx= 2;
02322 const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
02323
02324 while( get_cabac_noinline( &h->cabac, &h->cabac_state[60 + ctx] ) ) {
02325 ctx= 3;
02326 val++;
02327 if(val > 2*max_qp){
02328 av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y);
02329 return -1;
02330 }
02331 }
02332
02333 if( val&0x01 )
02334 val= (val + 1)>>1 ;
02335 else
02336 val= -((val + 1)>>1);
02337 h->last_qscale_diff = val;
02338 s->qscale += val;
02339 if(((unsigned)s->qscale) > max_qp){
02340 if(s->qscale<0) s->qscale+= max_qp+1;
02341 else s->qscale-= max_qp+1;
02342 }
02343 h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
02344 h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
02345 }else
02346 h->last_qscale_diff=0;
02347
02348 decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 0);
02349 if(CHROMA444){
02350 decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 1);
02351 decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 2);
02352 } else if (CHROMA422) {
02353 if( cbp&0x30 ){
02354 int c;
02355 for (c = 0; c < 2; c++)
02356 decode_cabac_residual_dc_422(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3,
02357 CHROMA_DC_BLOCK_INDEX + c,
02358 chroma422_dc_scan, 8);
02359 }
02360
02361 if( cbp&0x20 ) {
02362 int c, i, i8x8;
02363 for( c = 0; c < 2; c++ ) {
02364 DCTELEM *mb = h->mb + (16*(16 + 16*c) << pixel_shift);
02365 qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
02366 for (i8x8 = 0; i8x8 < 2; i8x8++) {
02367 for (i = 0; i < 4; i++) {
02368 const int index = 16 + 16 * c + 8*i8x8 + i;
02369 decode_cabac_residual_nondc(h, mb, 4, index, scan + 1, qmul, 15);
02370 mb += 16<<pixel_shift;
02371 }
02372 }
02373 }
02374 } else {
02375 fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
02376 fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
02377 }
02378 } else {
02379 if( cbp&0x30 ){
02380 int c;
02381 for (c = 0; c < 2; c++)
02382 decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
02383 }
02384
02385 if( cbp&0x20 ) {
02386 int c, i;
02387 for( c = 0; c < 2; c++ ) {
02388 qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
02389 for( i = 0; i < 4; i++ ) {
02390 const int index = 16 + 16 * c + i;
02391 decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15);
02392 }
02393 }
02394 } else {
02395 fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
02396 fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
02397 }
02398 }
02399 } else {
02400 fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1);
02401 fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
02402 fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
02403 h->last_qscale_diff = 0;
02404 }
02405
02406 s->current_picture.f.qscale_table[mb_xy] = s->qscale;
02407 write_back_non_zero_count(h);
02408
02409 return 0;
02410 }