Changeset 2edcd5be1ce653a36cce752dc4704a0edf92a311
- Timestamp:
- 22/01/05 21:35:24
(4 years ago)
- Author:
- Gildas Bazin <gbazin@videolan.org>
- git-committer:
- Gildas Bazin <gbazin@videolan.org> 1106426124 +0000
- git-parent:
[e8e8633f716bc2126688aefddc4fdac16bee734a]
- git-author:
- Gildas Bazin <gbazin@videolan.org> 1106426124 +0000
- Message:
* modules/video_filter/blend.c: chroma fixes for the YUY2 blending.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rb61d41e |
r2edcd5b |
|
| 513 | 513 | uint8_t *p_trans; |
|---|
| 514 | 514 | int i_x, i_y, i_pix_pitch, i_trans; |
|---|
| | 515 | vlc_bool_t b_even = !((i_x_offset + p_filter->fmt_out.video.i_x_offset)%2); |
|---|
| 515 | 516 | |
|---|
| 516 | 517 | i_pix_pitch = 2; |
|---|
| … | … | |
| 542 | 543 | p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 543 | 544 | |
|---|
| | 545 | i_width = (i_width >> 1) << 1; /* Needs to be a multiple of 2 */ |
|---|
| | 546 | |
|---|
| 544 | 547 | #define MAX_TRANS 255 |
|---|
| 545 | 548 | #define TRANS_BITS 8 |
|---|
| … | … | |
| 552 | 555 | { |
|---|
| 553 | 556 | /* Draw until we reach the end of the line */ |
|---|
| 554 | | for( i_x = 0; i_x < i_width; i_x += 2 ) |
|---|
| | 557 | for( i_x = 0; i_x < i_width; i_x++, b_even = !b_even ) |
|---|
| 555 | 558 | { |
|---|
| 556 | 559 | i_trans = ( p_trans[i_x] * i_alpha ) / 255; |
|---|
| … | … | |
| 563 | 566 | /* Completely opaque. Completely overwrite underlying pixel */ |
|---|
| 564 | 567 | p_dst[i_x * 2] = p_src2_y[i_x]; |
|---|
| 565 | | p_dst[i_x * 2 + 1] = p_src2_u[i_x]; |
|---|
| 566 | | p_dst[i_x * 2 + 3] = p_src2_v[i_x]; |
|---|
| | 568 | |
|---|
| | 569 | if( b_even ) |
|---|
| | 570 | { |
|---|
| | 571 | p_dst[i_x * 2 + 1] = p_src2_u[i_x]; |
|---|
| | 572 | p_dst[i_x * 2 + 3] = p_src2_v[i_x]; |
|---|
| | 573 | } |
|---|
| 567 | 574 | } |
|---|
| 568 | 575 | else |
|---|
| … | … | |
| 572 | 579 | (uint16_t)p_src1[i_x * 2] * (MAX_TRANS - i_trans) ) |
|---|
| 573 | 580 | >> TRANS_BITS; |
|---|
| 574 | | p_dst[i_x * 2 + 1] = ( (uint16_t)p_src2_u[i_x] * i_trans + |
|---|
| 575 | | (uint16_t)p_src1[i_x * 2 + 1] * (MAX_TRANS - i_trans) ) |
|---|
| 576 | | >> TRANS_BITS; |
|---|
| 577 | | p_dst[i_x * 2 + 3] = ( (uint16_t)p_src2_v[i_x] * i_trans + |
|---|
| 578 | | (uint16_t)p_src1[i_x * 2 + 3] * (MAX_TRANS - i_trans) ) |
|---|
| 579 | | >> TRANS_BITS; |
|---|
| 580 | | } |
|---|
| 581 | | |
|---|
| 582 | | i_trans = ( p_trans[i_x+1] * i_alpha ) / 255; |
|---|
| 583 | | if( !i_trans ) |
|---|
| 584 | | { |
|---|
| 585 | | /* Completely transparent. Don't change pixel */ |
|---|
| 586 | | } |
|---|
| 587 | | else if( i_trans == MAX_TRANS ) |
|---|
| 588 | | { |
|---|
| 589 | | /* Completely opaque. Completely overwrite underlying pixel */ |
|---|
| 590 | | p_dst[i_x * 2 + 2] = p_src2_y[i_x + 1]; |
|---|
| 591 | | } |
|---|
| 592 | | else |
|---|
| 593 | | { |
|---|
| 594 | | /* Blending */ |
|---|
| 595 | | p_dst[i_x * 2 + 2] = ( (uint16_t)p_src2_y[i_x+1] * i_trans + |
|---|
| 596 | | (uint16_t)p_src1[i_x * 2 + 2] * (MAX_TRANS - i_trans) ) |
|---|
| 597 | | >> TRANS_BITS; |
|---|
| | 581 | |
|---|
| | 582 | if( b_even ) |
|---|
| | 583 | { |
|---|
| | 584 | p_dst[i_x * 2 + 1] = ( (uint16_t)p_src2_u[i_x] * i_trans + |
|---|
| | 585 | (uint16_t)p_src1[i_x * 2 + 1] * (MAX_TRANS - i_trans) ) |
|---|
| | 586 | >> TRANS_BITS; |
|---|
| | 587 | p_dst[i_x * 2 + 3] = ( (uint16_t)p_src2_v[i_x] * i_trans + |
|---|
| | 588 | (uint16_t)p_src1[i_x * 2 + 3] * (MAX_TRANS - i_trans) ) |
|---|
| | 589 | >> TRANS_BITS; |
|---|
| | 590 | } |
|---|
| 598 | 591 | } |
|---|
| 599 | 592 | } |
|---|
| … | … | |
| 721 | 714 | uint8_t *p_src1, *p_src2, *p_dst; |
|---|
| 722 | 715 | int i_x, i_y, i_pix_pitch, i_trans; |
|---|
| | 716 | vlc_bool_t b_even = !((i_x_offset + p_filter->fmt_out.video.i_x_offset)%2); |
|---|
| 723 | 717 | |
|---|
| 724 | 718 | i_pix_pitch = 2; |
|---|
| … | … | |
| 737 | 731 | i_src2_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 738 | 732 | |
|---|
| | 733 | i_width = (i_width >> 1) << 1; /* Needs to be a multiple of 2 */ |
|---|
| | 734 | |
|---|
| 739 | 735 | #define MAX_TRANS 255 |
|---|
| 740 | 736 | #define TRANS_BITS 8 |
|---|
| … | … | |
| 747 | 743 | { |
|---|
| 748 | 744 | /* Draw until we reach the end of the line */ |
|---|
| 749 | | for( i_x = 0; i_x < i_width; i_x += 2 ) |
|---|
| | 745 | for( i_x = 0; i_x < i_width; i_x++, b_even = !b_even ) |
|---|
| 750 | 746 | { |
|---|
| 751 | 747 | i_trans = ( p_pal[p_trans[i_x]][3] * i_alpha ) / 255; |
|---|
| … | … | |
| 757 | 753 | { |
|---|
| 758 | 754 | /* Completely opaque. Completely overwrite underlying pixel */ |
|---|
| 759 | | /* NOTE: YUVP is actually YVUP */ |
|---|
| 760 | 755 | p_dst[i_x * 2] = p_pal[p_src2[i_x]][0]; |
|---|
| 761 | | p_dst[i_x * 2 + 1] = p_pal[p_src2[i_x]][2]; |
|---|
| 762 | | p_dst[i_x * 2 + 3] = p_pal[p_src2[i_x]][1]; |
|---|
| | 756 | |
|---|
| | 757 | if( b_even ) |
|---|
| | 758 | { |
|---|
| | 759 | p_dst[i_x * 2 + 1] = p_pal[p_src2[i_x]][1]; |
|---|
| | 760 | p_dst[i_x * 2 + 3] = p_pal[p_src2[i_x]][2]; |
|---|
| | 761 | } |
|---|
| 763 | 762 | } |
|---|
| 764 | 763 | else |
|---|
| 765 | 764 | { |
|---|
| 766 | 765 | /* Blending */ |
|---|
| 767 | | /* NOTE: YUVP is actually YVUP */ |
|---|
| 768 | 766 | p_dst[i_x * 2] = ( (uint16_t)p_pal[p_src2[i_x]][0] * |
|---|
| 769 | 767 | i_trans + (uint16_t)p_src1[i_x * 2] * |
|---|
| 770 | 768 | (MAX_TRANS - i_trans) ) >> TRANS_BITS; |
|---|
| 771 | | p_dst[i_x * 2 + 1] = ( (uint16_t)p_pal[p_src2[i_x]][2] * |
|---|
| 772 | | i_trans + (uint16_t)p_src1[i_x * 2 + 1] * |
|---|
| 773 | | (MAX_TRANS - i_trans) ) >> TRANS_BITS; |
|---|
| 774 | | p_dst[i_x * 2 + 3] = ( (uint16_t)p_pal[p_src2[i_x]][1] * |
|---|
| 775 | | i_trans + (uint16_t)p_src1[i_x * 2 + 3] * |
|---|
| 776 | | (MAX_TRANS - i_trans) ) >> TRANS_BITS; |
|---|
| 777 | | } |
|---|
| 778 | | |
|---|
| 779 | | i_trans = ( p_pal[p_trans[i_x+1]][3] * i_alpha ) / 255; |
|---|
| 780 | | if( !i_trans ) |
|---|
| 781 | | { |
|---|
| 782 | | /* Completely transparent. Don't change pixel */ |
|---|
| 783 | | } |
|---|
| 784 | | else if( i_trans == MAX_TRANS ) |
|---|
| 785 | | { |
|---|
| 786 | | /* Completely opaque. Completely overwrite underlying pixel */ |
|---|
| 787 | | p_dst[i_x * 2 + 2] = p_pal[p_src2[i_x + 1]][0]; |
|---|
| 788 | | } |
|---|
| 789 | | else |
|---|
| 790 | | { |
|---|
| 791 | | /* Blending */ |
|---|
| 792 | | p_dst[i_x * 2 + 2] = ( (uint16_t)p_pal[p_src2[i_x+1]][0] * |
|---|
| 793 | | i_trans + (uint16_t)p_src1[i_x * 2 + 2] * |
|---|
| 794 | | (MAX_TRANS - i_trans) ) >> TRANS_BITS; |
|---|
| | 769 | |
|---|
| | 770 | if( b_even ) |
|---|
| | 771 | { |
|---|
| | 772 | p_dst[i_x * 2 + 1] = ( (uint16_t)p_pal[p_src2[i_x]][1] * |
|---|
| | 773 | i_trans + (uint16_t)p_src1[i_x * 2 + 1] * |
|---|
| | 774 | (MAX_TRANS - i_trans) ) >> TRANS_BITS; |
|---|
| | 775 | p_dst[i_x * 2 + 3] = ( (uint16_t)p_pal[p_src2[i_x]][2] * |
|---|
| | 776 | i_trans + (uint16_t)p_src1[i_x * 2 + 3] * |
|---|
| | 777 | (MAX_TRANS - i_trans) ) >> TRANS_BITS; |
|---|
| | 778 | } |
|---|
| 795 | 779 | } |
|---|
| 796 | 780 | } |
|---|