Revision a9c9a240 libavcodec/h264.c

View differences:

libavcodec/h264.c
544 544
        const int left_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]);
545 545
        const int curr_mb_frame_flag = !IS_INTERLACED(mb_type);
546 546
        const int bottom = (s->mb_y & 1);
547
        tprintf("fill_caches: curr_mb_frame_flag:%d, left_mb_frame_flag:%d, topleft_mb_frame_flag:%d, top_mb_frame_flag:%d, topright_mb_frame_flag:%d\n", curr_mb_frame_flag, left_mb_frame_flag, topleft_mb_frame_flag, top_mb_frame_flag, topright_mb_frame_flag);
547
        tprintf(s->avctx, "fill_caches: curr_mb_frame_flag:%d, left_mb_frame_flag:%d, topleft_mb_frame_flag:%d, top_mb_frame_flag:%d, topright_mb_frame_flag:%d\n", curr_mb_frame_flag, left_mb_frame_flag, topleft_mb_frame_flag, top_mb_frame_flag, topright_mb_frame_flag);
548 548
        if (bottom
549 549
                ? !curr_mb_frame_flag // bottom macroblock
550 550
                : (!curr_mb_frame_flag && !top_mb_frame_flag) // top macroblock
......
1060 1060
    const int top = h->intra4x4_pred_mode_cache[index8 - 8];
1061 1061
    const int min= FFMIN(left, top);
1062 1062

  
1063
    tprintf("mode:%d %d min:%d\n", left ,top, min);
1063
    tprintf(h->s.avctx, "mode:%d %d min:%d\n", left ,top, min);
1064 1064

  
1065 1065
    if(min<0) return DC_PRED;
1066 1066
    else      return min;
......
1107 1107

  
1108 1108
    if(i<64) i= (i+1)>>1;
1109 1109

  
1110
    tprintf("pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i&31);
1110
    tprintf(h->s.avctx, "pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i&31);
1111 1111

  
1112 1112
    return i&31;
1113 1113
}
1114 1114

  
1115 1115
static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, int list, int part_width){
1116 1116
    const int topright_ref= h->ref_cache[list][ i - 8 + part_width ];
1117
    MpegEncContext *s = &h->s;
1117 1118

  
1118 1119
    /* there is no consistent mapping of mvs to neighboring locations that will
1119 1120
     * make mbaff happy, so we can't move all this logic to fill_caches */
1120 1121
    if(FRAME_MBAFF){
1121
        MpegEncContext *s = &h->s;
1122 1122
        const uint32_t *mb_types = s->current_picture_ptr->mb_type;
1123 1123
        const int16_t *mv;
1124 1124
        *(uint32_t*)h->mv_cache[list][scan8[0]-2] = 0;
......
1162 1162
        *C= h->mv_cache[list][ i - 8 + part_width ];
1163 1163
        return topright_ref;
1164 1164
    }else{
1165
        tprintf("topright MV not available\n");
1165
        tprintf(s->avctx, "topright MV not available\n");
1166 1166

  
1167 1167
        *C= h->mv_cache[list][ i - 8 - 1 ];
1168 1168
        return h->ref_cache[list][ i - 8 - 1 ];
......
1197 1197

  
1198 1198
    diagonal_ref= fetch_diagonal_mv(h, &C, index8, list, part_width);
1199 1199
    match_count= (diagonal_ref==ref) + (top_ref==ref) + (left_ref==ref);
1200
    tprintf("pred_motion match_count=%d\n", match_count);
1200
    tprintf(h->s.avctx, "pred_motion match_count=%d\n", match_count);
1201 1201
    if(match_count > 1){ //most common
1202 1202
        *mx= mid_pred(A[0], B[0], C[0]);
1203 1203
        *my= mid_pred(A[1], B[1], C[1]);
......
1222 1222
        }
1223 1223
    }
1224 1224

  
1225
    tprintf("pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1],                    diagonal_ref, C[0], C[1], left_ref, A[0], A[1], ref, *mx, *my, h->s.mb_x, h->s.mb_y, n, list);
1225
    tprintf(h->s.avctx, "pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1],                    diagonal_ref, C[0], C[1], left_ref, A[0], A[1], ref, *mx, *my, h->s.mb_x, h->s.mb_y, n, list);
1226 1226
}
1227 1227

  
1228 1228
/**
......
1236 1236
        const int top_ref=      h->ref_cache[list][ scan8[0] - 8 ];
1237 1237
        const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ];
1238 1238

  
1239
        tprintf("pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], h->s.mb_x, h->s.mb_y, n, list);
1239
        tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], h->s.mb_x, h->s.mb_y, n, list);
1240 1240

  
1241 1241
        if(top_ref == ref){
1242 1242
            *mx= B[0];
......
1247 1247
        const int left_ref=     h->ref_cache[list][ scan8[8] - 1 ];
1248 1248
        const int16_t * const A= h->mv_cache[list][ scan8[8] - 1 ];
1249 1249

  
1250
        tprintf("pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
1250
        tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
1251 1251

  
1252 1252
        if(left_ref == ref){
1253 1253
            *mx= A[0];
......
1271 1271
        const int left_ref=      h->ref_cache[list][ scan8[0] - 1 ];
1272 1272
        const int16_t * const A=  h->mv_cache[list][ scan8[0] - 1 ];
1273 1273

  
1274
        tprintf("pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
1274
        tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
1275 1275

  
1276 1276
        if(left_ref == ref){
1277 1277
            *mx= A[0];
......
1284 1284

  
1285 1285
        diagonal_ref= fetch_diagonal_mv(h, &C, scan8[4], list, 2);
1286 1286

  
1287
        tprintf("pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", diagonal_ref, C[0], C[1], h->s.mb_x, h->s.mb_y, n, list);
1287
        tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", diagonal_ref, C[0], C[1], h->s.mb_x, h->s.mb_y, n, list);
1288 1288

  
1289 1289
        if(diagonal_ref == ref){
1290 1290
            *mx= C[0];
......
1301 1301
    const int top_ref = h->ref_cache[0][ scan8[0] - 8 ];
1302 1302
    const int left_ref= h->ref_cache[0][ scan8[0] - 1 ];
1303 1303

  
1304
    tprintf("pred_pskip: (%d) (%d) at %2d %2d\n", top_ref, left_ref, h->s.mb_x, h->s.mb_y);
1304
    tprintf(h->s.avctx, "pred_pskip: (%d) (%d) at %2d %2d\n", top_ref, left_ref, h->s.mb_x, h->s.mb_y);
1305 1305

  
1306 1306
    if(top_ref == PART_NOT_AVAILABLE || left_ref == PART_NOT_AVAILABLE
1307 1307
       || (top_ref == 0  && *(uint32_t*)h->mv_cache[0][ scan8[0] - 8 ] == 0)
......
1408 1408
    if(MB_FIELD)
1409 1409
        *mb_type |= MB_TYPE_INTERLACED;
1410 1410

  
1411
    tprintf("mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col);
1411
    tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col);
1412 1412

  
1413 1413
    if(h->direct_spatial_mv_pred){
1414 1414
        int ref[2];
......
1803 1803
 * identifies the exact end of the bitstream
1804 1804
 * @return the length of the trailing, or 0 if damaged
1805 1805
 */
1806
static int decode_rbsp_trailing(uint8_t *src){
1806
static int decode_rbsp_trailing(H264Context *h, uint8_t *src){
1807 1807
    int v= *src;
1808 1808
    int r;
1809 1809

  
1810
    tprintf("rbsp trailing %X\n", v);
1810
    tprintf(h->s.avctx, "rbsp trailing %X\n", v);
1811 1811

  
1812 1812
    for(r=1; r<9; r++){
1813 1813
        if(v&1) return r;
......
3452 3452
    int deblock_left = (s->mb_x > 0);
3453 3453
    int deblock_top  = (s->mb_y > 1);
3454 3454

  
3455
    tprintf("xchg_pair_border: src_y:%p src_cb:%p src_cr:%p ls:%d uvls:%d\n", src_y, src_cb, src_cr, linesize, uvlinesize);
3455
    tprintf(s->avctx, "xchg_pair_border: src_y:%p src_cb:%p src_cr:%p ls:%d uvls:%d\n", src_y, src_cb, src_cr, linesize, uvlinesize);
3456 3456

  
3457 3457
    src_y  -= 2 *   linesize + 1;
3458 3458
    src_cb -= 2 * uvlinesize + 1;
......
3752 3752
            // deblock a pair
3753 3753
            // top
3754 3754
            s->mb_y--;
3755
            tprintf("call mbaff filter_mb mb_x:%d mb_y:%d pair_dest_y = %p, dest_y = %p\n", mb_x, mb_y, pair_dest_y, dest_y);
3755
            tprintf(h->s.avctx, "call mbaff filter_mb mb_x:%d mb_y:%d pair_dest_y = %p, dest_y = %p\n", mb_x, mb_y, pair_dest_y, dest_y);
3756 3756
            fill_caches(h, mb_type_top, 1); //FIXME don't fill stuff which isn't used by filter_mb
3757 3757
            h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, s->current_picture.qscale_table[mb_xy]);
3758 3758
            filter_mb(h, mb_x, mb_y, pair_dest_y, pair_dest_cb, pair_dest_cr, linesize, uvlinesize);
3759 3759
            // bottom
3760 3760
            s->mb_y++;
3761
            tprintf("call mbaff filter_mb\n");
3761
            tprintf(h->s.avctx, "call mbaff filter_mb\n");
3762 3762
            fill_caches(h, mb_type_bottom, 1); //FIXME don't fill stuff which isn't used by filter_mb
3763 3763
            h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, s->current_picture.qscale_table[mb_xy+s->mb_stride]);
3764 3764
            filter_mb(h, mb_x, mb_y+1, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
3765 3765
        } else {
3766
            tprintf("call filter_mb\n");
3766
            tprintf(h->s.avctx, "call filter_mb\n");
3767 3767
            backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
3768 3768
            fill_caches(h, mb_type, 1); //FIXME don't fill stuff which isn't used by filter_mb
3769 3769
            filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
......
3831 3831

  
3832 3832
            limit= best_poc;
3833 3833
            sorted_short_ref[out_i]= *h->short_ref[best_i];
3834
            tprintf("sorted poc: %d->%d poc:%d fn:%d\n", best_i, out_i, sorted_short_ref[out_i].poc, sorted_short_ref[out_i].frame_num);
3834
            tprintf(h->s.avctx, "sorted poc: %d->%d poc:%d fn:%d\n", best_i, out_i, sorted_short_ref[out_i].poc, sorted_short_ref[out_i].frame_num);
3835 3835
            if (-1 == smallest_poc_greater_than_current) {
3836 3836
                if (h->short_ref[best_i]->poc >= s->current_picture_ptr->poc) {
3837 3837
                    smallest_poc_greater_than_current = out_i;
......
3843 3843
    if(s->picture_structure == PICT_FRAME){
3844 3844
        if(h->slice_type==B_TYPE){
3845 3845
            int list;
3846
            tprintf("current poc: %d, smallest_poc_greater_than_current: %d\n", s->current_picture_ptr->poc, smallest_poc_greater_than_current);
3846
            tprintf(h->s.avctx, "current poc: %d, smallest_poc_greater_than_current: %d\n", s->current_picture_ptr->poc, smallest_poc_greater_than_current);
3847 3847

  
3848 3848
            // find the largest poc
3849 3849
            for(list=0; list<2; list++){
......
3906 3906
    }
3907 3907
#ifdef TRACE
3908 3908
    for (i=0; i<h->ref_count[0]; i++) {
3909
        tprintf("List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]);
3909
        tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]);
3910 3910
    }
3911 3911
    if(h->slice_type==B_TYPE){
3912 3912
        for (i=0; i<h->ref_count[1]; i++) {
3913
            tprintf("List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[0][i].data[0]);
3913
            tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[0][i].data[0]);
3914 3914
        }
3915 3915
    }
3916 3916
#endif
......
4915 4915
    }
4916 4916

  
4917 4917
    trailing_ones= coeff_token&3;
4918
    tprintf("trailing:%d, total:%d\n", trailing_ones, total_coeff);
4918
    tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff);
4919 4919
    assert(total_coeff<=16);
4920 4920

  
4921 4921
    for(i=0; i<trailing_ones; i++){
......
5092 5092

  
5093 5093
    s->dsp.clear_blocks(h->mb); //FIXME avoid if already clear (move after skip handlong?
5094 5094

  
5095
    tprintf("pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
5095
    tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
5096 5096
    cbp = 0; /* avoid warning. FIXME: find a solution without slowing
5097 5097
                down the code */
5098 5098
    if(h->slice_type != I_TYPE && h->slice_type != SI_TYPE){
......
5163 5163
        for(y=0; y<16; y++){
5164 5164
            const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3);
5165 5165
            for(x=0; x<16; x++){
5166
                tprintf("LUMA ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8));
5166
                tprintf(s->avctx, "LUMA ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8));
5167 5167
                h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= get_bits(&s->gb, 8);
5168 5168
            }
5169 5169
        }
5170 5170
        for(y=0; y<8; y++){
5171 5171
            const int index= 256 + 4*(y&3) + 32*(y>>2);
5172 5172
            for(x=0; x<8; x++){
5173
                tprintf("CHROMA U ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8));
5173
                tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8));
5174 5174
                h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8);
5175 5175
            }
5176 5176
        }
5177 5177
        for(y=0; y<8; y++){
5178 5178
            const int index= 256 + 64 + 4*(y&3) + 32*(y>>2);
5179 5179
            for(x=0; x<8; x++){
5180
                tprintf("CHROMA V ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8));
5180
                tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8));
5181 5181
                h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8);
5182 5182
            }
5183 5183
        }
......
5314 5314
                        pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
5315 5315
                        mx += get_se_golomb(&s->gb);
5316 5316
                        my += get_se_golomb(&s->gb);
5317
                        tprintf("final mv:%d %d\n", mx, my);
5317
                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
5318 5318

  
5319 5319
                        if(IS_SUB_8X8(sub_mb_type)){
5320 5320
                            mv_cache[ 1 ][0]=
......
5363 5363
                    pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
5364 5364
                    mx += get_se_golomb(&s->gb);
5365 5365
                    my += get_se_golomb(&s->gb);
5366
                    tprintf("final mv:%d %d\n", mx, my);
5366
                    tprintf(s->avctx, "final mv:%d %d\n", mx, my);
5367 5367

  
5368 5368
                    val= pack16to32(mx,my);
5369 5369
                }else
......
5393 5393
                        pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
5394 5394
                        mx += get_se_golomb(&s->gb);
5395 5395
                        my += get_se_golomb(&s->gb);
5396
                        tprintf("final mv:%d %d\n", mx, my);
5396
                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
5397 5397

  
5398 5398
                        val= pack16to32(mx,my);
5399 5399
                    }else
......
5424 5424
                        pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
5425 5425
                        mx += get_se_golomb(&s->gb);
5426 5426
                        my += get_se_golomb(&s->gb);
5427
                        tprintf("final mv:%d %d\n", mx, my);
5427
                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
5428 5428

  
5429 5429
                        val= pack16to32(mx,my);
5430 5430
                    }else
......
5781 5781

  
5782 5782
    if( h->slice_table[h->top_mb_xy] == h->slice_num ) {
5783 5783
        cbp_b = h->top_cbp;
5784
        tprintf("cbp_b = top_cbp = %x\n", cbp_b);
5784
        tprintf(h->s.avctx, "cbp_b = top_cbp = %x\n", cbp_b);
5785 5785
    }
5786 5786

  
5787 5787
    for( i8x8 = 0; i8x8 < 4; i8x8++ ) {
......
5796 5796
            cbp_a = cbp;
5797 5797
        else if( h->slice_table[h->left_mb_xy[0]] == h->slice_num ) {
5798 5798
            cbp_a = h->left_cbp;
5799
            tprintf("cbp_a = left_cbp = %x\n", cbp_a);
5799
            tprintf(h->s.avctx, "cbp_a = left_cbp = %x\n", cbp_a);
5800 5800
        }
5801 5801

  
5802 5802
        if( y > 0 )
......
6220 6220

  
6221 6221
    s->dsp.clear_blocks(h->mb); //FIXME avoid if already clear (move after skip handlong?)
6222 6222

  
6223
    tprintf("pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
6223
    tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
6224 6224
    if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE ) {
6225 6225
        int skip;
6226 6226
        /* a skipped mb needs the aff flag from the following mb */
......
6312 6312
        for(y=0; y<16; y++){
6313 6313
            const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3);
6314 6314
            for(x=0; x<16; x++){
6315
                tprintf("LUMA ICPM LEVEL (%3d)\n", *ptr);
6315
                tprintf(s->avctx, "LUMA ICPM LEVEL (%3d)\n", *ptr);
6316 6316
                h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= *ptr++;
6317 6317
            }
6318 6318
        }
6319 6319
        for(y=0; y<8; y++){
6320 6320
            const int index= 256 + 4*(y&3) + 32*(y>>2);
6321 6321
            for(x=0; x<8; x++){
6322
                tprintf("CHROMA U ICPM LEVEL (%3d)\n", *ptr);
6322
                tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", *ptr);
6323 6323
                h->mb[index + (x&3) + 16*(x>>2)]= *ptr++;
6324 6324
            }
6325 6325
        }
6326 6326
        for(y=0; y<8; y++){
6327 6327
            const int index= 256 + 64 + 4*(y&3) + 32*(y>>2);
6328 6328
            for(x=0; x<8; x++){
6329
                tprintf("CHROMA V ICPM LEVEL (%3d)\n", *ptr);
6329
                tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", *ptr);
6330 6330
                h->mb[index + (x&3) + 16*(x>>2)]= *ptr++;
6331 6331
            }
6332 6332
        }
......
6448 6448

  
6449 6449
                        mx = mpx + decode_cabac_mb_mvd( h, list, index, 0 );
6450 6450
                        my = mpy + decode_cabac_mb_mvd( h, list, index, 1 );
6451
                        tprintf("final mv:%d %d\n", mx, my);
6451
                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
6452 6452

  
6453 6453
                        if(IS_SUB_8X8(sub_mb_type)){
6454 6454
                            mv_cache[ 1 ][0]=
......
6508 6508

  
6509 6509
                    mx = mpx + decode_cabac_mb_mvd( h, list, 0, 0 );
6510 6510
                    my = mpy + decode_cabac_mb_mvd( h, list, 0, 1 );
6511
                    tprintf("final mv:%d %d\n", mx, my);
6511
                    tprintf(s->avctx, "final mv:%d %d\n", mx, my);
6512 6512

  
6513 6513
                    fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx-mpx,my-mpy), 4);
6514 6514
                    fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
......
6532 6532
                        pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy);
6533 6533
                        mx = mpx + decode_cabac_mb_mvd( h, list, 8*i, 0 );
6534 6534
                        my = mpy + decode_cabac_mb_mvd( h, list, 8*i, 1 );
6535
                        tprintf("final mv:%d %d\n", mx, my);
6535
                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
6536 6536

  
6537 6537
                        fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx-mpx,my-mpy), 4);
6538 6538
                        fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4);
......
6560 6560
                        mx = mpx + decode_cabac_mb_mvd( h, list, 4*i, 0 );
6561 6561
                        my = mpy + decode_cabac_mb_mvd( h, list, 4*i, 1 );
6562 6562

  
6563
                        tprintf("final mv:%d %d\n", mx, my);
6563
                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
6564 6564
                        fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx-mpx,my-mpy), 4);
6565 6565
                        fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4);
6566 6566
                    }else{
......
6753 6753
                        pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
6754 6754
                        pix[ 0] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
6755 6755
                    }
6756
                    tprintf("filter_mb_edgev i:%d d:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, d, p2, p1, p0, q0, q1, q2, pix[-2], pix[-1], pix[0], pix[1]);
6756
                    tprintf(h->s.avctx, "filter_mb_edgev i:%d d:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, d, p2, p1, p0, q0, q1, q2, pix[-2], pix[-1], pix[0], pix[1]);
6757 6757
                }
6758 6758
                pix += stride;
6759 6759
            }
......
6825 6825
                i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
6826 6826
                pix[-1] = av_clip_uint8( p0 + i_delta );    /* p0' */
6827 6827
                pix[0]  = av_clip_uint8( q0 - i_delta );    /* q0' */
6828
                tprintf("filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
6828
                tprintf(h->s.avctx, "filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
6829 6829
            }
6830 6830
        }else{
6831 6831
            const int p0 = pix[-1];
......
6868 6868
                    pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
6869 6869
                    pix[ 0] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
6870 6870
                }
6871
                tprintf("filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, p2, p1, p0, q0, q1, q2, pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
6871
                tprintf(h->s.avctx, "filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, p2, p1, p0, q0, q1, q2, pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
6872 6872
            }
6873 6873
        }
6874 6874
    }
......
6906 6906

  
6907 6907
                pix[-1] = av_clip_uint8( p0 + i_delta );    /* p0' */
6908 6908
                pix[0]  = av_clip_uint8( q0 - i_delta );    /* q0' */
6909
                tprintf("filter_mb_mbaff_edgecv i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
6909
                tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
6910 6910
            }
6911 6911
        }else{
6912 6912
            const int p0 = pix[-1];
......
6920 6920

  
6921 6921
                pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;   /* p0' */
6922 6922
                pix[0]  = ( 2*q1 + q0 + p1 + 2 ) >> 2;   /* q0' */
6923
                tprintf("filter_mb_mbaff_edgecv i:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, pix[-3], p1, p0, q0, q1, pix[2], pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
6923
                tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, pix[-3], p1, p0, q0, q1, pix[2], pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
6924 6924
            }
6925 6925
        }
6926 6926
    }
......
6979 6979
                        pix[-1*pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
6980 6980
                        pix[ 0*pix_next] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
6981 6981
                    }
6982
                    tprintf("filter_mb_edgeh i:%d d:%d, qp:%d, indexA:%d, alpha:%d, beta:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, d, qp, index_a, alpha, beta, bS[i], p2, p1, p0, q0, q1, q2, pix[-2*pix_next], pix[-pix_next], pix[0], pix[pix_next]);
6982
                    tprintf(h->s.avctx, "filter_mb_edgeh i:%d d:%d, qp:%d, indexA:%d, alpha:%d, beta:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, d, qp, index_a, alpha, beta, bS[i], p2, p1, p0, q0, q1, q2, pix[-2*pix_next], pix[-pix_next], pix[0], pix[pix_next]);
6983 6983
                }
6984 6984
                pix++;
6985 6985
            }
......
7182 7182
                         get_chroma_qp( h->pps.chroma_qp_index_offset, mbn1_qp ) + 1 ) >> 1;
7183 7183

  
7184 7184
        /* Filter edge */
7185
        tprintf("filter mb:%d/%d MBAFF, QPy:%d/%d, QPc:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], chroma_qp[0], chroma_qp[1], linesize, uvlinesize);
7186
        { int i; for (i = 0; i < 8; i++) tprintf(" bS[%d]:%d", i, bS[i]); tprintf("\n"); }
7185
        tprintf(s->avctx, "filter mb:%d/%d MBAFF, QPy:%d/%d, QPc:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], chroma_qp[0], chroma_qp[1], linesize, uvlinesize);
7186
        { int i; for (i = 0; i < 8; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
7187 7187
        filter_mb_mbaff_edgev ( h, &img_y [0], linesize,   bS, qp );
7188 7188
        filter_mb_mbaff_edgecv( h, &img_cb[0], uvlinesize, bS, chroma_qp );
7189 7189
        filter_mb_mbaff_edgecv( h, &img_cr[0], uvlinesize, bS, chroma_qp );
......
7245 7245
                // Do not use s->qscale as luma quantizer because it has not the same
7246 7246
                // value in IPCM macroblocks.
7247 7247
                qp = ( s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbn_xy] + 1 ) >> 1;
7248
                tprintf("filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize);
7249
                { int i; for (i = 0; i < 4; i++) tprintf(" bS[%d]:%d", i, bS[i]); tprintf("\n"); }
7248
                tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize);
7249
                { int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
7250 7250
                filter_mb_edgeh( h, &img_y[j*linesize], tmp_linesize, bS, qp );
7251 7251
                chroma_qp = ( h->chroma_qp +
7252 7252
                              get_chroma_qp( h->pps.chroma_qp_index_offset, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1;
......
7342 7342
            // Do not use s->qscale as luma quantizer because it has not the same
7343 7343
            // value in IPCM macroblocks.
7344 7344
            qp = ( s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbn_xy] + 1 ) >> 1;
7345
            //tprintf("filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp, s->current_picture.qscale_table[mbn_xy]);
7346
            tprintf("filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);
7347
            { int i; for (i = 0; i < 4; i++) tprintf(" bS[%d]:%d", i, bS[i]); tprintf("\n"); }
7345
            //tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp, s->current_picture.qscale_table[mbn_xy]);
7346
            tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);
7347
            { int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
7348 7348
            if( dir == 0 ) {
7349 7349
                filter_mb_edgev( h, &img_y[4*edge], linesize, bS, qp );
7350 7350
                if( (edge&1) == 0 ) {
......
7431 7431
            }
7432 7432

  
7433 7433
            if( eos || s->mb_y >= s->mb_height ) {
7434
                tprintf("slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
7434
                tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
7435 7435
                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
7436 7436
                return 0;
7437 7437
            }
......
7466 7466
                    ++s->mb_y;
7467 7467
                }
7468 7468
                if(s->mb_y >= s->mb_height){
7469
                    tprintf("slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
7469
                    tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
7470 7470

  
7471 7471
                    if(get_bits_count(&s->gb) == s->gb.size_in_bits ) {
7472 7472
                        ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
......
7481 7481
            }
7482 7482

  
7483 7483
            if(get_bits_count(&s->gb) >= s->gb.size_in_bits && s->mb_skip_run<=0){
7484
                tprintf("slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
7484
                tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
7485 7485
                if(get_bits_count(&s->gb) == s->gb.size_in_bits ){
7486 7486
                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
7487 7487

  
......
8137 8137
        }
8138 8138
        while(ptr[dst_length - 1] == 0 && dst_length > 1)
8139 8139
            dst_length--;
8140
        bit_length= 8*dst_length - decode_rbsp_trailing(ptr + dst_length - 1);
8140
        bit_length= 8*dst_length - decode_rbsp_trailing(h, ptr + dst_length - 1);
8141 8141

  
8142 8142
        if(s->avctx->debug&FF_DEBUG_STARTCODE){
8143 8143
            av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d at %d/%d length %d\n", h->nal_unit_type, buf_index, buf_size, dst_length);

Also available in: Unified diff