| OLD | NEW |
| 1 /* | 1 /* |
| 2 * H.26L/H.264/AVC/JVT/14496-10/... cavlc bitstream decoding | 2 * H.26L/H.264/AVC/JVT/14496-10/... cavlc bitstream decoding |
| 3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> | 3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 cbp = 0; /* avoid warning. FIXME: find a solution without slowing | 540 cbp = 0; /* avoid warning. FIXME: find a solution without slowing |
| 541 down the code */ | 541 down the code */ |
| 542 if(h->slice_type_nos != FF_I_TYPE){ | 542 if(h->slice_type_nos != FF_I_TYPE){ |
| 543 if(s->mb_skip_run==-1) | 543 if(s->mb_skip_run==-1) |
| 544 s->mb_skip_run= get_ue_golomb(&s->gb); | 544 s->mb_skip_run= get_ue_golomb(&s->gb); |
| 545 | 545 |
| 546 if (s->mb_skip_run--) { | 546 if (s->mb_skip_run--) { |
| 547 if(FRAME_MBAFF && (s->mb_y&1) == 0){ | 547 if(FRAME_MBAFF && (s->mb_y&1) == 0){ |
| 548 if(s->mb_skip_run==0) | 548 if(s->mb_skip_run==0) |
| 549 h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); | 549 h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); |
| 550 else | |
| 551 predict_field_decoding_flag(h); | |
| 552 } | 550 } |
| 553 decode_mb_skip(h); | 551 decode_mb_skip(h); |
| 554 return 0; | 552 return 0; |
| 555 } | 553 } |
| 556 } | 554 } |
| 557 if(FRAME_MBAFF){ | 555 if(FRAME_MBAFF){ |
| 558 if( (s->mb_y&1) == 0 ) | 556 if( (s->mb_y&1) == 0 ) |
| 559 h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); | 557 h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); |
| 560 } | 558 } |
| 561 | 559 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 614 |
| 617 s->current_picture.mb_type[mb_xy]= mb_type; | 615 s->current_picture.mb_type[mb_xy]= mb_type; |
| 618 return 0; | 616 return 0; |
| 619 } | 617 } |
| 620 | 618 |
| 621 if(MB_MBAFF){ | 619 if(MB_MBAFF){ |
| 622 h->ref_count[0] <<= 1; | 620 h->ref_count[0] <<= 1; |
| 623 h->ref_count[1] <<= 1; | 621 h->ref_count[1] <<= 1; |
| 624 } | 622 } |
| 625 | 623 |
| 624 fill_decode_neighbors(h, mb_type); |
| 626 fill_decode_caches(h, mb_type); | 625 fill_decode_caches(h, mb_type); |
| 627 | 626 |
| 628 //mb_pred | 627 //mb_pred |
| 629 if(IS_INTRA(mb_type)){ | 628 if(IS_INTRA(mb_type)){ |
| 630 int pred_mode; | 629 int pred_mode; |
| 631 // init_top_left_availability(h); | 630 // init_top_left_availability(h); |
| 632 if(IS_INTRA4x4(mb_type)){ | 631 if(IS_INTRA4x4(mb_type)){ |
| 633 int i; | 632 int i; |
| 634 int di = 1; | 633 int di = 1; |
| 635 if(dct8x8_allowed && get_bits1(&s->gb)){ | 634 if(dct8x8_allowed && get_bits1(&s->gb)){ |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 val= 0; | 782 val= 0; |
| 784 }else if(h->ref_count[list]==2){ | 783 }else if(h->ref_count[list]==2){ |
| 785 val= get_bits1(&s->gb)^1; | 784 val= get_bits1(&s->gb)^1; |
| 786 }else{ | 785 }else{ |
| 787 val= get_ue_golomb_31(&s->gb); | 786 val= get_ue_golomb_31(&s->gb); |
| 788 if(val >= h->ref_count[list]){ | 787 if(val >= h->ref_count[list]){ |
| 789 av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflo
w\n", val); | 788 av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflo
w\n", val); |
| 790 return -1; | 789 return -1; |
| 791 } | 790 } |
| 792 } | 791 } |
| 793 }else | |
| 794 val= LIST_NOT_USED&0xFF; | |
| 795 fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val
, 1); | 792 fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val
, 1); |
| 793 } |
| 796 } | 794 } |
| 797 for(list=0; list<h->list_count; list++){ | 795 for(list=0; list<h->list_count; list++){ |
| 798 unsigned int val; | |
| 799 if(IS_DIR(mb_type, 0, list)){ | 796 if(IS_DIR(mb_type, 0, list)){ |
| 800 pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &
mx, &my); | 797 pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &
mx, &my); |
| 801 mx += get_se_golomb(&s->gb); | 798 mx += get_se_golomb(&s->gb); |
| 802 my += get_se_golomb(&s->gb); | 799 my += get_se_golomb(&s->gb); |
| 803 tprintf(s->avctx, "final mv:%d %d\n", mx, my); | 800 tprintf(s->avctx, "final mv:%d %d\n", mx, my); |
| 804 | 801 |
| 805 val= pack16to32(mx,my); | 802 fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack1
6to32(mx,my), 4); |
| 806 }else | 803 } |
| 807 val=0; | |
| 808 fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, val, 4); | |
| 809 } | 804 } |
| 810 } | 805 } |
| 811 else if(IS_16X8(mb_type)){ | 806 else if(IS_16X8(mb_type)){ |
| 812 for(list=0; list<h->list_count; list++){ | 807 for(list=0; list<h->list_count; list++){ |
| 813 for(i=0; i<2; i++){ | 808 for(i=0; i<2; i++){ |
| 814 unsigned int val; | 809 unsigned int val; |
| 815 if(IS_DIR(mb_type, i, list)){ | 810 if(IS_DIR(mb_type, i, list)){ |
| 816 if(h->ref_count[list] == 1){ | 811 if(h->ref_count[list] == 1){ |
| 817 val= 0; | 812 val= 0; |
| 818 }else if(h->ref_count[list] == 2){ | 813 }else if(h->ref_count[list] == 2){ |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 write_back_non_zero_count(h); | 1016 write_back_non_zero_count(h); |
| 1022 | 1017 |
| 1023 if(MB_MBAFF){ | 1018 if(MB_MBAFF){ |
| 1024 h->ref_count[0] >>= 1; | 1019 h->ref_count[0] >>= 1; |
| 1025 h->ref_count[1] >>= 1; | 1020 h->ref_count[1] >>= 1; |
| 1026 } | 1021 } |
| 1027 | 1022 |
| 1028 return 0; | 1023 return 0; |
| 1029 } | 1024 } |
| 1030 | 1025 |
| OLD | NEW |