comparison rv40.c @ 8369:45c3780b1a96 libavcodec

Merge deblocking pattern with CBP for RV30/40 loop filtering
author kostya
date Wed, 17 Dec 2008 20:00:48 +0000
parents d133e597db2d
children 18737839ed27
comparison
equal deleted inserted replaced
8368:a7c85cdc11b5 8369:45c3780b1a96
451 451
452 mb_pos = row * s->mb_stride; 452 mb_pos = row * s->mb_stride;
453 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ 453 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
454 int mbtype = s->current_picture_ptr->mb_type[mb_pos]; 454 int mbtype = s->current_picture_ptr->mb_type[mb_pos];
455 if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) 455 if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
456 r->cbp_luma [mb_pos] = 0xFFFF; 456 r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF;
457 if(IS_INTRA(mbtype)) 457 if(IS_INTRA(mbtype))
458 r->cbp_chroma[mb_pos] = 0xFF; 458 r->cbp_chroma[mb_pos] = 0xFF;
459 } 459 }
460 mb_pos = row * s->mb_stride; 460 mb_pos = row * s->mb_stride;
461 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ 461 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
491 uvcbp[i][0] = uvcbp[i][1] = 0; 491 uvcbp[i][0] = uvcbp[i][1] = 0;
492 } 492 }
493 mb_strong[i] = IS_INTRA(mbtype[i]) || IS_SEPARATE_DC(mbtype[i]); 493 mb_strong[i] = IS_INTRA(mbtype[i]) || IS_SEPARATE_DC(mbtype[i]);
494 clip[i] = rv40_filter_clip_tbl[mb_strong[i] + 1][q]; 494 clip[i] = rv40_filter_clip_tbl[mb_strong[i] + 1][q];
495 } 495 }
496 y_to_deblock = cbp[POS_CUR] 496 y_to_deblock = mvmasks[POS_CUR]
497 | (cbp[POS_BOTTOM] << 16)
498 | mvmasks[POS_CUR]
499 | (mvmasks[POS_BOTTOM] << 16); 497 | (mvmasks[POS_BOTTOM] << 16);
500 /* This pattern contains bits signalling that horizontal edges of 498 /* This pattern contains bits signalling that horizontal edges of
501 * the current block can be filtered. 499 * the current block can be filtered.
502 * That happens when either of adjacent subblocks is coded or lies on 500 * That happens when either of adjacent subblocks is coded or lies on
503 * the edge of 8x8 blocks with motion vectors differing by more than 501 * the edge of 8x8 blocks with motion vectors differing by more than
556 alpha, beta, betaY, 0, 0); 554 alpha, beta, betaY, 0, 0);
557 } 555 }
558 // filter left block edge in ordinary mode (with low filtering strength) 556 // filter left block edge in ordinary mode (with low filtering strength)
559 if(y_v_deblock & (MASK_CUR << ij) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){ 557 if(y_v_deblock & (MASK_CUR << ij) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
560 if(!i) 558 if(!i)
561 clip_left = (cbp[POS_LEFT] | mvmasks[POS_LEFT]) & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0; 559 clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
562 else 560 else
563 clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0; 561 clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
564 rv40_v_loop_filter(Y, s->linesize, dither, 562 rv40_v_loop_filter(Y, s->linesize, dither,
565 clip_cur, 563 clip_cur,
566 clip_left, 564 clip_left,
568 } 566 }
569 // filter top edge of the current macroblock when filtering strength is high 567 // filter top edge of the current macroblock when filtering strength is high
570 if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){ 568 if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
571 rv40_h_loop_filter(Y, s->linesize, dither, 569 rv40_h_loop_filter(Y, s->linesize, dither,
572 clip_cur, 570 clip_cur,
573 (cbp[POS_TOP] | mvmasks[POS_TOP]) & (MASK_TOP << i) ? clip[POS_TOP] : 0, 571 mvmasks[POS_TOP] & (MASK_TOP << i) ? clip[POS_TOP] : 0,
574 alpha, beta, betaY, 0, 1); 572 alpha, beta, betaY, 0, 1);
575 } 573 }
576 // filter left block edge in edge mode (with high filtering strength) 574 // filter left block edge in edge mode (with high filtering strength)
577 if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){ 575 if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
578 clip_left = (cbp[POS_LEFT] | mvmasks[POS_LEFT]) & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0; 576 clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
579 rv40_v_loop_filter(Y, s->linesize, dither, 577 rv40_v_loop_filter(Y, s->linesize, dither,
580 clip_cur, 578 clip_cur,
581 clip_left, 579 clip_left,
582 alpha, beta, betaY, 0, 1); 580 alpha, beta, betaY, 0, 1);
583 } 581 }