00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #define CABAC 0
00029
00030 #include "internal.h"
00031 #include "avcodec.h"
00032 #include "mpegvideo.h"
00033 #include "h264.h"
00034 #include "h264data.h"
00035 #include "h264_mvpred.h"
00036 #include "golomb.h"
00037
00038
00039 #include <assert.h>
00040
00041 static const uint8_t golomb_to_inter_cbp_gray[16]={
00042 0, 1, 2, 4, 8, 3, 5,10,12,15, 7,11,13,14, 6, 9,
00043 };
00044
00045 static const uint8_t golomb_to_intra4x4_cbp_gray[16]={
00046 15, 0, 7,11,13,14, 3, 5,10,12, 1, 2, 4, 8, 6, 9,
00047 };
00048
00049 static const uint8_t chroma_dc_coeff_token_len[4*5]={
00050 2, 0, 0, 0,
00051 6, 1, 0, 0,
00052 6, 6, 3, 0,
00053 6, 7, 7, 6,
00054 6, 8, 8, 7,
00055 };
00056
00057 static const uint8_t chroma_dc_coeff_token_bits[4*5]={
00058 1, 0, 0, 0,
00059 7, 1, 0, 0,
00060 4, 6, 1, 0,
00061 3, 3, 2, 5,
00062 2, 3, 2, 0,
00063 };
00064
00065 static const uint8_t coeff_token_len[4][4*17]={
00066 {
00067 1, 0, 0, 0,
00068 6, 2, 0, 0, 8, 6, 3, 0, 9, 8, 7, 5, 10, 9, 8, 6,
00069 11,10, 9, 7, 13,11,10, 8, 13,13,11, 9, 13,13,13,10,
00070 14,14,13,11, 14,14,14,13, 15,15,14,14, 15,15,15,14,
00071 16,15,15,15, 16,16,16,15, 16,16,16,16, 16,16,16,16,
00072 },
00073 {
00074 2, 0, 0, 0,
00075 6, 2, 0, 0, 6, 5, 3, 0, 7, 6, 6, 4, 8, 6, 6, 4,
00076 8, 7, 7, 5, 9, 8, 8, 6, 11, 9, 9, 6, 11,11,11, 7,
00077 12,11,11, 9, 12,12,12,11, 12,12,12,11, 13,13,13,12,
00078 13,13,13,13, 13,14,13,13, 14,14,14,13, 14,14,14,14,
00079 },
00080 {
00081 4, 0, 0, 0,
00082 6, 4, 0, 0, 6, 5, 4, 0, 6, 5, 5, 4, 7, 5, 5, 4,
00083 7, 5, 5, 4, 7, 6, 6, 4, 7, 6, 6, 4, 8, 7, 7, 5,
00084 8, 8, 7, 6, 9, 8, 8, 7, 9, 9, 8, 8, 9, 9, 9, 8,
00085 10, 9, 9, 9, 10,10,10,10, 10,10,10,10, 10,10,10,10,
00086 },
00087 {
00088 6, 0, 0, 0,
00089 6, 6, 0, 0, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6,
00090 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
00091 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
00092 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
00093 }
00094 };
00095
00096 static const uint8_t coeff_token_bits[4][4*17]={
00097 {
00098 1, 0, 0, 0,
00099 5, 1, 0, 0, 7, 4, 1, 0, 7, 6, 5, 3, 7, 6, 5, 3,
00100 7, 6, 5, 4, 15, 6, 5, 4, 11,14, 5, 4, 8,10,13, 4,
00101 15,14, 9, 4, 11,10,13,12, 15,14, 9,12, 11,10,13, 8,
00102 15, 1, 9,12, 11,14,13, 8, 7,10, 9,12, 4, 6, 5, 8,
00103 },
00104 {
00105 3, 0, 0, 0,
00106 11, 2, 0, 0, 7, 7, 3, 0, 7,10, 9, 5, 7, 6, 5, 4,
00107 4, 6, 5, 6, 7, 6, 5, 8, 15, 6, 5, 4, 11,14,13, 4,
00108 15,10, 9, 4, 11,14,13,12, 8,10, 9, 8, 15,14,13,12,
00109 11,10, 9,12, 7,11, 6, 8, 9, 8,10, 1, 7, 6, 5, 4,
00110 },
00111 {
00112 15, 0, 0, 0,
00113 15,14, 0, 0, 11,15,13, 0, 8,12,14,12, 15,10,11,11,
00114 11, 8, 9,10, 9,14,13, 9, 8,10, 9, 8, 15,14,13,13,
00115 11,14,10,12, 15,10,13,12, 11,14, 9,12, 8,10,13, 8,
00116 13, 7, 9,12, 9,12,11,10, 5, 8, 7, 6, 1, 4, 3, 2,
00117 },
00118 {
00119 3, 0, 0, 0,
00120 0, 1, 0, 0, 4, 5, 6, 0, 8, 9,10,11, 12,13,14,15,
00121 16,17,18,19, 20,21,22,23, 24,25,26,27, 28,29,30,31,
00122 32,33,34,35, 36,37,38,39, 40,41,42,43, 44,45,46,47,
00123 48,49,50,51, 52,53,54,55, 56,57,58,59, 60,61,62,63,
00124 }
00125 };
00126
00127 static const uint8_t total_zeros_len[16][16]= {
00128 {1,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9},
00129 {3,3,3,3,3,4,4,4,4,5,5,6,6,6,6},
00130 {4,3,3,3,4,4,3,3,4,5,5,6,5,6},
00131 {5,3,4,4,3,3,3,4,3,4,5,5,5},
00132 {4,4,4,3,3,3,3,3,4,5,4,5},
00133 {6,5,3,3,3,3,3,3,4,3,6},
00134 {6,5,3,3,3,2,3,4,3,6},
00135 {6,4,5,3,2,2,3,3,6},
00136 {6,6,4,2,2,3,2,5},
00137 {5,5,3,2,2,2,4},
00138 {4,4,3,3,1,3},
00139 {4,4,2,1,3},
00140 {3,3,1,2},
00141 {2,2,1},
00142 {1,1},
00143 };
00144
00145 static const uint8_t total_zeros_bits[16][16]= {
00146 {1,3,2,3,2,3,2,3,2,3,2,3,2,3,2,1},
00147 {7,6,5,4,3,5,4,3,2,3,2,3,2,1,0},
00148 {5,7,6,5,4,3,4,3,2,3,2,1,1,0},
00149 {3,7,5,4,6,5,4,3,3,2,2,1,0},
00150 {5,4,3,7,6,5,4,3,2,1,1,0},
00151 {1,1,7,6,5,4,3,2,1,1,0},
00152 {1,1,5,4,3,3,2,1,1,0},
00153 {1,1,1,3,3,2,2,1,0},
00154 {1,0,1,3,2,1,1,1},
00155 {1,0,1,3,2,1,1},
00156 {0,1,1,2,1,3},
00157 {0,1,1,1,1},
00158 {0,1,1,1},
00159 {0,1,1},
00160 {0,1},
00161 };
00162
00163 static const uint8_t chroma_dc_total_zeros_len[3][4]= {
00164 { 1, 2, 3, 3,},
00165 { 1, 2, 2, 0,},
00166 { 1, 1, 0, 0,},
00167 };
00168
00169 static const uint8_t chroma_dc_total_zeros_bits[3][4]= {
00170 { 1, 1, 1, 0,},
00171 { 1, 1, 0, 0,},
00172 { 1, 0, 0, 0,},
00173 };
00174
00175 static const uint8_t run_len[7][16]={
00176 {1,1},
00177 {1,2,2},
00178 {2,2,2,2},
00179 {2,2,2,3,3},
00180 {2,2,3,3,3,3},
00181 {2,3,3,3,3,3,3},
00182 {3,3,3,3,3,3,3,4,5,6,7,8,9,10,11},
00183 };
00184
00185 static const uint8_t run_bits[7][16]={
00186 {1,0},
00187 {1,1,0},
00188 {3,2,1,0},
00189 {3,2,1,1,0},
00190 {3,2,3,2,1,0},
00191 {3,0,1,3,2,5,4},
00192 {7,6,5,4,3,2,1,1,1,1,1,1,1,1,1},
00193 };
00194
00195 static VLC coeff_token_vlc[4];
00196 static VLC_TYPE coeff_token_vlc_tables[520+332+280+256][2];
00197 static const int coeff_token_vlc_tables_size[4]={520,332,280,256};
00198
00199 static VLC chroma_dc_coeff_token_vlc;
00200 static VLC_TYPE chroma_dc_coeff_token_vlc_table[256][2];
00201 static const int chroma_dc_coeff_token_vlc_table_size = 256;
00202
00203 static VLC total_zeros_vlc[15];
00204 static VLC_TYPE total_zeros_vlc_tables[15][512][2];
00205 static const int total_zeros_vlc_tables_size = 512;
00206
00207 static VLC chroma_dc_total_zeros_vlc[3];
00208 static VLC_TYPE chroma_dc_total_zeros_vlc_tables[3][8][2];
00209 static const int chroma_dc_total_zeros_vlc_tables_size = 8;
00210
00211 static VLC run_vlc[6];
00212 static VLC_TYPE run_vlc_tables[6][8][2];
00213 static const int run_vlc_tables_size = 8;
00214
00215 static VLC run7_vlc;
00216 static VLC_TYPE run7_vlc_table[96][2];
00217 static const int run7_vlc_table_size = 96;
00218
00219 #define LEVEL_TAB_BITS 8
00220 static int8_t cavlc_level_tab[7][1<<LEVEL_TAB_BITS][2];
00221
00222
00227 static inline int pred_non_zero_count(H264Context *h, int n){
00228 const int index8= scan8[n];
00229 const int left= h->non_zero_count_cache[index8 - 1];
00230 const int top = h->non_zero_count_cache[index8 - 8];
00231 int i= left + top;
00232
00233 if(i<64) i= (i+1)>>1;
00234
00235 tprintf(h->s.avctx, "pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i&31);
00236
00237 return i&31;
00238 }
00239
00240 static av_cold void init_cavlc_level_tab(void){
00241 int suffix_length;
00242 unsigned int i;
00243
00244 for(suffix_length=0; suffix_length<7; suffix_length++){
00245 for(i=0; i<(1<<LEVEL_TAB_BITS); i++){
00246 int prefix= LEVEL_TAB_BITS - av_log2(2*i);
00247
00248 if(prefix + 1 + suffix_length <= LEVEL_TAB_BITS){
00249 int level_code = (prefix << suffix_length) +
00250 (i >> (av_log2(i) - suffix_length)) - (1 << suffix_length);
00251 int mask = -(level_code&1);
00252 level_code = (((2 + level_code) >> 1) ^ mask) - mask;
00253 cavlc_level_tab[suffix_length][i][0]= level_code;
00254 cavlc_level_tab[suffix_length][i][1]= prefix + 1 + suffix_length;
00255 }else if(prefix + 1 <= LEVEL_TAB_BITS){
00256 cavlc_level_tab[suffix_length][i][0]= prefix+100;
00257 cavlc_level_tab[suffix_length][i][1]= prefix + 1;
00258 }else{
00259 cavlc_level_tab[suffix_length][i][0]= LEVEL_TAB_BITS+100;
00260 cavlc_level_tab[suffix_length][i][1]= LEVEL_TAB_BITS;
00261 }
00262 }
00263 }
00264 }
00265
00266 av_cold void ff_h264_decode_init_vlc(void){
00267 static int done = 0;
00268
00269 if (!done) {
00270 int i;
00271 int offset;
00272 done = 1;
00273
00274 chroma_dc_coeff_token_vlc.table = chroma_dc_coeff_token_vlc_table;
00275 chroma_dc_coeff_token_vlc.table_allocated = chroma_dc_coeff_token_vlc_table_size;
00276 init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5,
00277 &chroma_dc_coeff_token_len [0], 1, 1,
00278 &chroma_dc_coeff_token_bits[0], 1, 1,
00279 INIT_VLC_USE_NEW_STATIC);
00280
00281 offset = 0;
00282 for(i=0; i<4; i++){
00283 coeff_token_vlc[i].table = coeff_token_vlc_tables+offset;
00284 coeff_token_vlc[i].table_allocated = coeff_token_vlc_tables_size[i];
00285 init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17,
00286 &coeff_token_len [i][0], 1, 1,
00287 &coeff_token_bits[i][0], 1, 1,
00288 INIT_VLC_USE_NEW_STATIC);
00289 offset += coeff_token_vlc_tables_size[i];
00290 }
00291
00292
00293
00294
00295
00296 assert(offset == FF_ARRAY_ELEMS(coeff_token_vlc_tables));
00297
00298 for(i=0; i<3; i++){
00299 chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i];
00300 chroma_dc_total_zeros_vlc[i].table_allocated = chroma_dc_total_zeros_vlc_tables_size;
00301 init_vlc(&chroma_dc_total_zeros_vlc[i],
00302 CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 4,
00303 &chroma_dc_total_zeros_len [i][0], 1, 1,
00304 &chroma_dc_total_zeros_bits[i][0], 1, 1,
00305 INIT_VLC_USE_NEW_STATIC);
00306 }
00307 for(i=0; i<15; i++){
00308 total_zeros_vlc[i].table = total_zeros_vlc_tables[i];
00309 total_zeros_vlc[i].table_allocated = total_zeros_vlc_tables_size;
00310 init_vlc(&total_zeros_vlc[i],
00311 TOTAL_ZEROS_VLC_BITS, 16,
00312 &total_zeros_len [i][0], 1, 1,
00313 &total_zeros_bits[i][0], 1, 1,
00314 INIT_VLC_USE_NEW_STATIC);
00315 }
00316
00317 for(i=0; i<6; i++){
00318 run_vlc[i].table = run_vlc_tables[i];
00319 run_vlc[i].table_allocated = run_vlc_tables_size;
00320 init_vlc(&run_vlc[i],
00321 RUN_VLC_BITS, 7,
00322 &run_len [i][0], 1, 1,
00323 &run_bits[i][0], 1, 1,
00324 INIT_VLC_USE_NEW_STATIC);
00325 }
00326 run7_vlc.table = run7_vlc_table,
00327 run7_vlc.table_allocated = run7_vlc_table_size;
00328 init_vlc(&run7_vlc, RUN7_VLC_BITS, 16,
00329 &run_len [6][0], 1, 1,
00330 &run_bits[6][0], 1, 1,
00331 INIT_VLC_USE_NEW_STATIC);
00332
00333 init_cavlc_level_tab();
00334 }
00335 }
00336
00340 static inline int get_level_prefix(GetBitContext *gb){
00341 unsigned int buf;
00342 int log;
00343
00344 OPEN_READER(re, gb);
00345 UPDATE_CACHE(re, gb);
00346 buf=GET_CACHE(re, gb);
00347
00348 log= 32 - av_log2(buf);
00349 #ifdef TRACE
00350 print_bin(buf>>(32-log), log);
00351 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d lpr @%5d in %s get_level_prefix\n", buf>>(32-log), log, log-1, get_bits_count(gb), __FILE__);
00352 #endif
00353
00354 LAST_SKIP_BITS(re, gb, log);
00355 CLOSE_READER(re, gb);
00356
00357 return log-1;
00358 }
00359
00367 static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){
00368 MpegEncContext * const s = &h->s;
00369 static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};
00370 int level[16];
00371 int zeros_left, coeff_token, total_coeff, i, trailing_ones, run_before;
00372
00373
00374
00375 if(max_coeff <= 8){
00376 coeff_token= get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1);
00377 total_coeff= coeff_token>>2;
00378 }else{
00379 if(n >= LUMA_DC_BLOCK_INDEX){
00380 total_coeff= pred_non_zero_count(h, (n - LUMA_DC_BLOCK_INDEX)*16);
00381 coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
00382 total_coeff= coeff_token>>2;
00383 }else{
00384 total_coeff= pred_non_zero_count(h, n);
00385 coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
00386 total_coeff= coeff_token>>2;
00387 }
00388 }
00389 h->non_zero_count_cache[ scan8[n] ]= total_coeff;
00390
00391
00392
00393 if(total_coeff==0)
00394 return 0;
00395 if(total_coeff > (unsigned)max_coeff) {
00396 av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", s->mb_x, s->mb_y, total_coeff);
00397 return -1;
00398 }
00399
00400 trailing_ones= coeff_token&3;
00401 tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff);
00402 assert(total_coeff<=16);
00403
00404 i = show_bits(gb, 3);
00405 skip_bits(gb, trailing_ones);
00406 level[0] = 1-((i&4)>>1);
00407 level[1] = 1-((i&2) );
00408 level[2] = 1-((i&1)<<1);
00409
00410 if(trailing_ones<total_coeff) {
00411 int mask, prefix;
00412 int suffix_length = total_coeff > 10 & trailing_ones < 3;
00413 int bitsi= show_bits(gb, LEVEL_TAB_BITS);
00414 int level_code= cavlc_level_tab[suffix_length][bitsi][0];
00415
00416 skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);
00417 if(level_code >= 100){
00418 prefix= level_code - 100;
00419 if(prefix == LEVEL_TAB_BITS)
00420 prefix += get_level_prefix(gb);
00421
00422
00423 if(prefix<14){
00424 if(suffix_length)
00425 level_code= (prefix<<1) + get_bits1(gb);
00426 else
00427 level_code= prefix;
00428 }else if(prefix==14){
00429 if(suffix_length)
00430 level_code= (prefix<<1) + get_bits1(gb);
00431 else
00432 level_code= prefix + get_bits(gb, 4);
00433 }else{
00434 level_code= 30 + get_bits(gb, prefix-3);
00435 if(prefix>=16){
00436 if(prefix > 25+3){
00437 av_log(h->s.avctx, AV_LOG_ERROR, "Invalid level prefix\n");
00438 return -1;
00439 }
00440 level_code += (1<<(prefix-3))-4096;
00441 }
00442 }
00443
00444 if(trailing_ones < 3) level_code += 2;
00445
00446 suffix_length = 2;
00447 mask= -(level_code&1);
00448 level[trailing_ones]= (((2+level_code)>>1) ^ mask) - mask;
00449 }else{
00450 level_code += ((level_code>>31)|1) & -(trailing_ones < 3);
00451
00452 suffix_length = 1 + (level_code + 3U > 6U);
00453 level[trailing_ones]= level_code;
00454 }
00455
00456
00457 for(i=trailing_ones+1;i<total_coeff;i++) {
00458 static const unsigned int suffix_limit[7] = {0,3,6,12,24,48,INT_MAX };
00459 int bitsi= show_bits(gb, LEVEL_TAB_BITS);
00460 level_code= cavlc_level_tab[suffix_length][bitsi][0];
00461
00462 skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);
00463 if(level_code >= 100){
00464 prefix= level_code - 100;
00465 if(prefix == LEVEL_TAB_BITS){
00466 prefix += get_level_prefix(gb);
00467 }
00468 if(prefix<15){
00469 level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length);
00470 }else{
00471 level_code = (15<<suffix_length) + get_bits(gb, prefix-3);
00472 if(prefix>=16)
00473 level_code += (1<<(prefix-3))-4096;
00474 }
00475 mask= -(level_code&1);
00476 level_code= (((2+level_code)>>1) ^ mask) - mask;
00477 }
00478 level[i]= level_code;
00479 suffix_length+= suffix_limit[suffix_length] + level_code > 2U*suffix_limit[suffix_length];
00480 }
00481 }
00482
00483 if(total_coeff == max_coeff)
00484 zeros_left=0;
00485 else{
00486
00487 if(max_coeff <= 8)
00488 zeros_left= get_vlc2(gb, (chroma_dc_total_zeros_vlc-1)[ total_coeff ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1);
00489 else
00490 zeros_left= get_vlc2(gb, (total_zeros_vlc-1)[ total_coeff ].table, TOTAL_ZEROS_VLC_BITS, 1);
00491 }
00492
00493 #define STORE_BLOCK(type) \
00494 scantable += zeros_left + total_coeff - 1; \
00495 if(n >= LUMA_DC_BLOCK_INDEX){ \
00496 ((type*)block)[*scantable] = level[0]; \
00497 for(i=1;i<total_coeff && zeros_left > 0;i++) { \
00498 if(zeros_left < 7) \
00499 run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1); \
00500 else \
00501 run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); \
00502 zeros_left -= run_before; \
00503 scantable -= 1 + run_before; \
00504 ((type*)block)[*scantable]= level[i]; \
00505 } \
00506 for(;i<total_coeff;i++) { \
00507 scantable--; \
00508 ((type*)block)[*scantable]= level[i]; \
00509 } \
00510 }else{ \
00511 ((type*)block)[*scantable] = ((int)(level[0] * qmul[*scantable] + 32))>>6; \
00512 for(i=1;i<total_coeff && zeros_left > 0;i++) { \
00513 if(zeros_left < 7) \
00514 run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1); \
00515 else \
00516 run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); \
00517 zeros_left -= run_before; \
00518 scantable -= 1 + run_before; \
00519 ((type*)block)[*scantable]= ((int)(level[i] * qmul[*scantable] + 32))>>6; \
00520 } \
00521 for(;i<total_coeff;i++) { \
00522 scantable--; \
00523 ((type*)block)[*scantable]= ((int)(level[i] * qmul[*scantable] + 32))>>6; \
00524 } \
00525 }
00526
00527 if (h->pixel_shift) {
00528 STORE_BLOCK(int32_t)
00529 } else {
00530 STORE_BLOCK(int16_t)
00531 }
00532
00533 if(zeros_left<0){
00534 av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);
00535 return -1;
00536 }
00537
00538 return 0;
00539 }
00540
00541 static av_always_inline int decode_luma_residual(H264Context *h, GetBitContext *gb, const uint8_t *scan, const uint8_t *scan8x8, int pixel_shift, int mb_type, int cbp, int p){
00542 int i4x4, i8x8;
00543 MpegEncContext * const s = &h->s;
00544 int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1];
00545 if(IS_INTRA16x16(mb_type)){
00546 AV_ZERO128(h->mb_luma_dc[p]+0);
00547 AV_ZERO128(h->mb_luma_dc[p]+8);
00548 AV_ZERO128(h->mb_luma_dc[p]+16);
00549 AV_ZERO128(h->mb_luma_dc[p]+24);
00550 if( decode_residual(h, h->intra_gb_ptr, h->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX+p, scan, NULL, 16) < 0){
00551 return -1;
00552 }
00553
00554 assert((cbp&15) == 0 || (cbp&15) == 15);
00555
00556 if(cbp&15){
00557 for(i8x8=0; i8x8<4; i8x8++){
00558 for(i4x4=0; i4x4<4; i4x4++){
00559 const int index= i4x4 + 4*i8x8 + p*16;
00560 if( decode_residual(h, h->intra_gb_ptr, h->mb + (16*index << pixel_shift),
00561 index, scan + 1, h->dequant4_coeff[p][qscale], 15) < 0 ){
00562 return -1;
00563 }
00564 }
00565 }
00566 return 0xf;
00567 }else{
00568 fill_rectangle(&h->non_zero_count_cache[scan8[p*16]], 4, 4, 8, 0, 1);
00569 return 0;
00570 }
00571 }else{
00572 int cqm = (IS_INTRA( mb_type ) ? 0:3)+p;
00573
00574 int new_cbp = 0;
00575 for(i8x8=0; i8x8<4; i8x8++){
00576 if(cbp & (1<<i8x8)){
00577 if(IS_8x8DCT(mb_type)){
00578 DCTELEM *buf = &h->mb[64*i8x8+256*p << pixel_shift];
00579 uint8_t *nnz;
00580 for(i4x4=0; i4x4<4; i4x4++){
00581 const int index= i4x4 + 4*i8x8 + p*16;
00582 if( decode_residual(h, gb, buf, index, scan8x8+16*i4x4,
00583 h->dequant8_coeff[cqm][qscale], 16) < 0 )
00584 return -1;
00585 }
00586 nnz= &h->non_zero_count_cache[ scan8[4*i8x8+p*16] ];
00587 nnz[0] += nnz[1] + nnz[8] + nnz[9];
00588 new_cbp |= !!nnz[0] << i8x8;
00589 }else{
00590 for(i4x4=0; i4x4<4; i4x4++){
00591 const int index= i4x4 + 4*i8x8 + p*16;
00592 if( decode_residual(h, gb, h->mb + (16*index << pixel_shift), index,
00593 scan, h->dequant4_coeff[cqm][qscale], 16) < 0 ){
00594 return -1;
00595 }
00596 new_cbp |= h->non_zero_count_cache[ scan8[index] ] << i8x8;
00597 }
00598 }
00599 }else{
00600 uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8+p*16] ];
00601 nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
00602 }
00603 }
00604 return new_cbp;
00605 }
00606 }
00607
00608 int ff_h264_decode_mb_cavlc(H264Context *h){
00609 MpegEncContext * const s = &h->s;
00610 int mb_xy;
00611 int partition_count;
00612 unsigned int mb_type, cbp;
00613 int dct8x8_allowed= h->pps.transform_8x8_mode;
00614 int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2;
00615 const int pixel_shift = h->pixel_shift;
00616
00617 mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
00618
00619 tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
00620 cbp = 0;
00621
00622 if(h->slice_type_nos != AV_PICTURE_TYPE_I){
00623 if(s->mb_skip_run==-1)
00624 s->mb_skip_run= get_ue_golomb(&s->gb);
00625
00626 if (s->mb_skip_run--) {
00627 if(FRAME_MBAFF && (s->mb_y&1) == 0){
00628 if(s->mb_skip_run==0)
00629 h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb);
00630 }
00631 decode_mb_skip(h);
00632 return 0;
00633 }
00634 }
00635 if(FRAME_MBAFF){
00636 if( (s->mb_y&1) == 0 )
00637 h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb);
00638 }
00639
00640 h->prev_mb_skipped= 0;
00641
00642 mb_type= get_ue_golomb(&s->gb);
00643 if(h->slice_type_nos == AV_PICTURE_TYPE_B){
00644 if(mb_type < 23){
00645 partition_count= b_mb_type_info[mb_type].partition_count;
00646 mb_type= b_mb_type_info[mb_type].type;
00647 }else{
00648 mb_type -= 23;
00649 goto decode_intra_mb;
00650 }
00651 }else if(h->slice_type_nos == AV_PICTURE_TYPE_P){
00652 if(mb_type < 5){
00653 partition_count= p_mb_type_info[mb_type].partition_count;
00654 mb_type= p_mb_type_info[mb_type].type;
00655 }else{
00656 mb_type -= 5;
00657 goto decode_intra_mb;
00658 }
00659 }else{
00660 assert(h->slice_type_nos == AV_PICTURE_TYPE_I);
00661 if(h->slice_type == AV_PICTURE_TYPE_SI && mb_type)
00662 mb_type--;
00663 decode_intra_mb:
00664 if(mb_type > 25){
00665 av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_picture_type_char(h->slice_type), s->mb_x, s->mb_y);
00666 return -1;
00667 }
00668 partition_count=0;
00669 cbp= i_mb_type_info[mb_type].cbp;
00670 h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode;
00671 mb_type= i_mb_type_info[mb_type].type;
00672 }
00673
00674 if(MB_FIELD)
00675 mb_type |= MB_TYPE_INTERLACED;
00676
00677 h->slice_table[ mb_xy ]= h->slice_num;
00678
00679 if(IS_INTRA_PCM(mb_type)){
00680 unsigned int x;
00681 static const uint16_t mb_sizes[4] = {256,384,512,768};
00682 const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3;
00683
00684
00685 align_get_bits(&s->gb);
00686
00687
00688 for(x=0; x < mb_size; x++){
00689 ((uint8_t*)h->mb)[x]= get_bits(&s->gb, 8);
00690 }
00691
00692
00693 s->current_picture.qscale_table[mb_xy]= 0;
00694
00695 memset(h->non_zero_count[mb_xy], 16, 48);
00696
00697 s->current_picture.mb_type[mb_xy]= mb_type;
00698 return 0;
00699 }
00700
00701 if(MB_MBAFF){
00702 h->ref_count[0] <<= 1;
00703 h->ref_count[1] <<= 1;
00704 }
00705
00706 fill_decode_neighbors(h, mb_type);
00707 fill_decode_caches(h, mb_type);
00708
00709
00710 if(IS_INTRA(mb_type)){
00711 int pred_mode;
00712
00713 if(IS_INTRA4x4(mb_type)){
00714 int i;
00715 int di = 1;
00716 if(dct8x8_allowed && get_bits1(&s->gb)){
00717 mb_type |= MB_TYPE_8x8DCT;
00718 di = 4;
00719 }
00720
00721
00722 for(i=0; i<16; i+=di){
00723 int mode= pred_intra_mode(h, i);
00724
00725 if(!get_bits1(&s->gb)){
00726 const int rem_mode= get_bits(&s->gb, 3);
00727 mode = rem_mode + (rem_mode >= mode);
00728 }
00729
00730 if(di==4)
00731 fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
00732 else
00733 h->intra4x4_pred_mode_cache[ scan8[i] ] = mode;
00734 }
00735 ff_h264_write_back_intra_pred_mode(h);
00736 if( ff_h264_check_intra4x4_pred_mode(h) < 0)
00737 return -1;
00738 }else{
00739 h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode, 0);
00740 if(h->intra16x16_pred_mode < 0)
00741 return -1;
00742 }
00743 if(decode_chroma){
00744 pred_mode= ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb), 1);
00745 if(pred_mode < 0)
00746 return -1;
00747 h->chroma_pred_mode= pred_mode;
00748 } else {
00749 h->chroma_pred_mode = DC_128_PRED8x8;
00750 }
00751 }else if(partition_count==4){
00752 int i, j, sub_partition_count[4], list, ref[2][4];
00753
00754 if(h->slice_type_nos == AV_PICTURE_TYPE_B){
00755 for(i=0; i<4; i++){
00756 h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
00757 if(h->sub_mb_type[i] >=13){
00758 av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
00759 return -1;
00760 }
00761 sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
00762 h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
00763 }
00764 if( IS_DIRECT(h->sub_mb_type[0]|h->sub_mb_type[1]|h->sub_mb_type[2]|h->sub_mb_type[3])) {
00765 ff_h264_pred_direct_motion(h, &mb_type);
00766 h->ref_cache[0][scan8[4]] =
00767 h->ref_cache[1][scan8[4]] =
00768 h->ref_cache[0][scan8[12]] =
00769 h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
00770 }
00771 }else{
00772 assert(h->slice_type_nos == AV_PICTURE_TYPE_P);
00773 for(i=0; i<4; i++){
00774 h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
00775 if(h->sub_mb_type[i] >=4){
00776 av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
00777 return -1;
00778 }
00779 sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
00780 h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
00781 }
00782 }
00783
00784 for(list=0; list<h->list_count; list++){
00785 int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list];
00786 for(i=0; i<4; i++){
00787 if(IS_DIRECT(h->sub_mb_type[i])) continue;
00788 if(IS_DIR(h->sub_mb_type[i], 0, list)){
00789 unsigned int tmp;
00790 if(ref_count == 1){
00791 tmp= 0;
00792 }else if(ref_count == 2){
00793 tmp= get_bits1(&s->gb)^1;
00794 }else{
00795 tmp= get_ue_golomb_31(&s->gb);
00796 if(tmp>=ref_count){
00797 av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp);
00798 return -1;
00799 }
00800 }
00801 ref[list][i]= tmp;
00802 }else{
00803
00804 ref[list][i] = -1;
00805 }
00806 }
00807 }
00808
00809 if(dct8x8_allowed)
00810 dct8x8_allowed = get_dct8x8_allowed(h);
00811
00812 for(list=0; list<h->list_count; list++){
00813 for(i=0; i<4; i++){
00814 if(IS_DIRECT(h->sub_mb_type[i])) {
00815 h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ];
00816 continue;
00817 }
00818 h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]=
00819 h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i];
00820
00821 if(IS_DIR(h->sub_mb_type[i], 0, list)){
00822 const int sub_mb_type= h->sub_mb_type[i];
00823 const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;
00824 for(j=0; j<sub_partition_count[i]; j++){
00825 int mx, my;
00826 const int index= 4*i + block_width*j;
00827 int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
00828 pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
00829 mx += get_se_golomb(&s->gb);
00830 my += get_se_golomb(&s->gb);
00831 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
00832
00833 if(IS_SUB_8X8(sub_mb_type)){
00834 mv_cache[ 1 ][0]=
00835 mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
00836 mv_cache[ 1 ][1]=
00837 mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;
00838 }else if(IS_SUB_8X4(sub_mb_type)){
00839 mv_cache[ 1 ][0]= mx;
00840 mv_cache[ 1 ][1]= my;
00841 }else if(IS_SUB_4X8(sub_mb_type)){
00842 mv_cache[ 8 ][0]= mx;
00843 mv_cache[ 8 ][1]= my;
00844 }
00845 mv_cache[ 0 ][0]= mx;
00846 mv_cache[ 0 ][1]= my;
00847 }
00848 }else{
00849 uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0];
00850 p[0] = p[1]=
00851 p[8] = p[9]= 0;
00852 }
00853 }
00854 }
00855 }else if(IS_DIRECT(mb_type)){
00856 ff_h264_pred_direct_motion(h, &mb_type);
00857 dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
00858 }else{
00859 int list, mx, my, i;
00860
00861 if(IS_16X16(mb_type)){
00862 for(list=0; list<h->list_count; list++){
00863 unsigned int val;
00864 if(IS_DIR(mb_type, 0, list)){
00865 if(h->ref_count[list]==1){
00866 val= 0;
00867 }else if(h->ref_count[list]==2){
00868 val= get_bits1(&s->gb)^1;
00869 }else{
00870 val= get_ue_golomb_31(&s->gb);
00871 if(val >= h->ref_count[list]){
00872 av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
00873 return -1;
00874 }
00875 }
00876 fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1);
00877 }
00878 }
00879 for(list=0; list<h->list_count; list++){
00880 if(IS_DIR(mb_type, 0, list)){
00881 pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
00882 mx += get_se_golomb(&s->gb);
00883 my += get_se_golomb(&s->gb);
00884 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
00885
00886 fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
00887 }
00888 }
00889 }
00890 else if(IS_16X8(mb_type)){
00891 for(list=0; list<h->list_count; list++){
00892 for(i=0; i<2; i++){
00893 unsigned int val;
00894 if(IS_DIR(mb_type, i, list)){
00895 if(h->ref_count[list] == 1){
00896 val= 0;
00897 }else if(h->ref_count[list] == 2){
00898 val= get_bits1(&s->gb)^1;
00899 }else{
00900 val= get_ue_golomb_31(&s->gb);
00901 if(val >= h->ref_count[list]){
00902 av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
00903 return -1;
00904 }
00905 }
00906 }else
00907 val= LIST_NOT_USED&0xFF;
00908 fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1);
00909 }
00910 }
00911 for(list=0; list<h->list_count; list++){
00912 for(i=0; i<2; i++){
00913 unsigned int val;
00914 if(IS_DIR(mb_type, i, list)){
00915 pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
00916 mx += get_se_golomb(&s->gb);
00917 my += get_se_golomb(&s->gb);
00918 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
00919
00920 val= pack16to32(mx,my);
00921 }else
00922 val=0;
00923 fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4);
00924 }
00925 }
00926 }else{
00927 assert(IS_8X16(mb_type));
00928 for(list=0; list<h->list_count; list++){
00929 for(i=0; i<2; i++){
00930 unsigned int val;
00931 if(IS_DIR(mb_type, i, list)){
00932 if(h->ref_count[list]==1){
00933 val= 0;
00934 }else if(h->ref_count[list]==2){
00935 val= get_bits1(&s->gb)^1;
00936 }else{
00937 val= get_ue_golomb_31(&s->gb);
00938 if(val >= h->ref_count[list]){
00939 av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
00940 return -1;
00941 }
00942 }
00943 }else
00944 val= LIST_NOT_USED&0xFF;
00945 fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1);
00946 }
00947 }
00948 for(list=0; list<h->list_count; list++){
00949 for(i=0; i<2; i++){
00950 unsigned int val;
00951 if(IS_DIR(mb_type, i, list)){
00952 pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
00953 mx += get_se_golomb(&s->gb);
00954 my += get_se_golomb(&s->gb);
00955 tprintf(s->avctx, "final mv:%d %d\n", mx, my);
00956
00957 val= pack16to32(mx,my);
00958 }else
00959 val=0;
00960 fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4);
00961 }
00962 }
00963 }
00964 }
00965
00966 if(IS_INTER(mb_type))
00967 write_back_motion(h, mb_type);
00968
00969 if(!IS_INTRA16x16(mb_type)){
00970 cbp= get_ue_golomb(&s->gb);
00971
00972 if(decode_chroma){
00973 if(cbp > 47){
00974 av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y);
00975 return -1;
00976 }
00977 if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp];
00978 else cbp= golomb_to_inter_cbp [cbp];
00979 }else{
00980 if(cbp > 15){
00981 av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y);
00982 return -1;
00983 }
00984 if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp_gray[cbp];
00985 else cbp= golomb_to_inter_cbp_gray[cbp];
00986 }
00987 }
00988
00989 if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){
00990 mb_type |= MB_TYPE_8x8DCT*get_bits1(&s->gb);
00991 }
00992 h->cbp=
00993 h->cbp_table[mb_xy]= cbp;
00994 s->current_picture.mb_type[mb_xy]= mb_type;
00995
00996 if(cbp || IS_INTRA16x16(mb_type)){
00997 int i4x4, chroma_idx;
00998 int dquant;
00999 int ret;
01000 GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr;
01001 const uint8_t *scan, *scan8x8;
01002 const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
01003
01004 if(IS_INTERLACED(mb_type)){
01005 scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
01006 scan= s->qscale ? h->field_scan : h->field_scan_q0;
01007 }else{
01008 scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0;
01009 scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
01010 }
01011
01012 dquant= get_se_golomb(&s->gb);
01013
01014 s->qscale += dquant;
01015
01016 if(((unsigned)s->qscale) > max_qp){
01017 if(s->qscale<0) s->qscale+= max_qp+1;
01018 else s->qscale-= max_qp+1;
01019 if(((unsigned)s->qscale) > max_qp){
01020 av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
01021 return -1;
01022 }
01023 }
01024
01025 h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale);
01026 h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale);
01027
01028 if( (ret = decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 0)) < 0 ){
01029 return -1;
01030 }
01031 h->cbp_table[mb_xy] |= ret << 12;
01032 if(CHROMA444){
01033 if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 1) < 0 ){
01034 return -1;
01035 }
01036 if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 2) < 0 ){
01037 return -1;
01038 }
01039 } else {
01040 if(cbp&0x30){
01041 for(chroma_idx=0; chroma_idx<2; chroma_idx++)
01042 if( decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){
01043 return -1;
01044 }
01045 }
01046
01047 if(cbp&0x20){
01048 for(chroma_idx=0; chroma_idx<2; chroma_idx++){
01049 const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]];
01050 for(i4x4=0; i4x4<4; i4x4++){
01051 const int index= 16 + 16*chroma_idx + i4x4;
01052 if( decode_residual(h, gb, h->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){
01053 return -1;
01054 }
01055 }
01056 }
01057 }else{
01058 fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
01059 fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
01060 }
01061 }
01062 }else{
01063 fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1);
01064 fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
01065 fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
01066 }
01067 s->current_picture.qscale_table[mb_xy]= s->qscale;
01068 write_back_non_zero_count(h);
01069
01070 if(MB_MBAFF){
01071 h->ref_count[0] >>= 1;
01072 h->ref_count[1] >>= 1;
01073 }
01074
01075 return 0;
01076 }
01077