Changeset 069e052f822e29645de86abf8a9e4ab02535b0a3
- Timestamp:
- 11/02/06 04:04:42
(3 years ago)
- Author:
- Derk-Jan Hartman <hartman@videolan.org>
- git-committer:
- Derk-Jan Hartman <hartman@videolan.org> 1139627082 +0000
- git-parent:
[b7d2846e63f846a0f4c0d5a9db7df5af4e01ae48]
- git-author:
- Derk-Jan Hartman <hartman@videolan.org> 1139627082 +0000
- Message:
* Improved renderering of YUVA/P onto YUV variants. refs #539
I420 still not fixed for this bug.
A simple average of the UV pixels, wasn't giving satisfying results, so I added a bit more logic, to decide based on the transparency value if UY averaging is desireable for the pixels. Produces nice results now, with a very slight shadow somtimes to the right side of the images/glyphs. Looks quite good.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r29c602f |
r069e052 |
|
| 593 | 593 | if( b_even ) |
|---|
| 594 | 594 | { |
|---|
| 595 | | p_dst[i_x * 2 + i_u_offset] = p_src2_u[i_x]; |
|---|
| 596 | | p_dst[i_x * 2 + i_v_offset] = p_src2_v[i_x]; |
|---|
| | 595 | if( p_trans[i_x+1] > 0xaa ) |
|---|
| | 596 | { |
|---|
| | 597 | p_dst[i_x * 2 + i_u_offset] = (p_src2_u[i_x]+p_src2_u[i_x+1])>>1; |
|---|
| | 598 | p_dst[i_x * 2 + i_v_offset] = (p_src2_v[i_x]+p_src2_v[i_x+1])>>1; |
|---|
| | 599 | } |
|---|
| | 600 | else |
|---|
| | 601 | { |
|---|
| | 602 | p_dst[i_x * 2 + i_u_offset] = p_src2_u[i_x]; |
|---|
| | 603 | p_dst[i_x * 2 + i_v_offset] = p_src2_v[i_x]; |
|---|
| | 604 | } |
|---|
| 597 | 605 | } |
|---|
| 598 | 606 | } |
|---|
| … | … | |
| 606 | 614 | if( b_even ) |
|---|
| 607 | 615 | { |
|---|
| 608 | | p_dst[i_x * 2 + i_u_offset] = ( (uint16_t)p_src2_u[i_x] * i_trans + |
|---|
| | 616 | uint16_t i_u = 0; |
|---|
| | 617 | uint16_t i_v = 0; |
|---|
| | 618 | if( p_trans[i_x+1] > 0xaa ) |
|---|
| | 619 | { |
|---|
| | 620 | i_u = (p_src2_u[i_x]+p_src2_u[i_x+1])>>1; |
|---|
| | 621 | i_v = (p_src2_v[i_x]+p_src2_v[i_x+1])>>1; |
|---|
| | 622 | } |
|---|
| | 623 | else |
|---|
| | 624 | { |
|---|
| | 625 | i_u = p_src2_u[i_x]; |
|---|
| | 626 | i_v = p_src2_v[i_x]; |
|---|
| | 627 | } |
|---|
| | 628 | p_dst[i_x * 2 + i_u_offset] = ( (uint16_t)i_u * i_trans + |
|---|
| 609 | 629 | (uint16_t)p_src1[i_x * 2 + i_u_offset] * (MAX_TRANS - i_trans) ) |
|---|
| 610 | 630 | >> TRANS_BITS; |
|---|
| 611 | | p_dst[i_x * 2 + i_v_offset] = ( (uint16_t)p_src2_v[i_x] * i_trans + |
|---|
| | 631 | p_dst[i_x * 2 + i_v_offset] = ( (uint16_t)i_v * i_trans + |
|---|
| 612 | 632 | (uint16_t)p_src1[i_x * 2 + i_v_offset] * (MAX_TRANS - i_trans) ) |
|---|
| 613 | 633 | >> TRANS_BITS; |
|---|
| … | … | |
| 801 | 821 | if( b_even ) |
|---|
| 802 | 822 | { |
|---|
| 803 | | p_dst[i_x * 2 + i_u_offset] = p_pal[p_src2[i_x]][1]; |
|---|
| 804 | | p_dst[i_x * 2 + i_v_offset] = p_pal[p_src2[i_x]][2]; |
|---|
| | 823 | if( p_trans[i_x+1] > 0xaa ) |
|---|
| | 824 | { |
|---|
| | 825 | p_dst[i_x * 2 + i_u_offset] = (p_pal[p_src2[i_x]][1] + p_pal[p_src2[i_x+1]][1]) >> 1; |
|---|
| | 826 | p_dst[i_x * 2 + i_v_offset] = (p_pal[p_src2[i_x]][2] + p_pal[p_src2[i_x+1]][2]) >> 1; |
|---|
| | 827 | } |
|---|
| | 828 | else |
|---|
| | 829 | { |
|---|
| | 830 | p_dst[i_x * 2 + i_u_offset] = p_pal[p_src2[i_x]][1]; |
|---|
| | 831 | p_dst[i_x * 2 + i_v_offset] = p_pal[p_src2[i_x]][2]; |
|---|
| | 832 | } |
|---|
| 805 | 833 | } |
|---|
| 806 | 834 | } |
|---|
| … | … | |
| 814 | 842 | if( b_even ) |
|---|
| 815 | 843 | { |
|---|
| 816 | | p_dst[i_x * 2 + i_u_offset] = ( (uint16_t)p_pal[p_src2[i_x]][1] * |
|---|
| | 844 | uint16_t i_u = 0; |
|---|
| | 845 | uint16_t i_v = 0; |
|---|
| | 846 | if( p_trans[i_x+1] > 0xaa ) |
|---|
| | 847 | { |
|---|
| | 848 | i_u = (p_pal[p_src2[i_x]][1] + p_pal[p_src2[i_x+1]][1]) >> 1; |
|---|
| | 849 | i_v = (p_pal[p_src2[i_x]][2] + p_pal[p_src2[i_x+1]][2]) >> 1; |
|---|
| | 850 | } |
|---|
| | 851 | else |
|---|
| | 852 | { |
|---|
| | 853 | i_u = p_pal[p_src2[i_x]][1]; |
|---|
| | 854 | i_v = p_pal[p_src2[i_x]][2]; |
|---|
| | 855 | } |
|---|
| | 856 | |
|---|
| | 857 | p_dst[i_x * 2 + i_u_offset] = ( (uint16_t)i_u * |
|---|
| 817 | 858 | i_trans + (uint16_t)p_src1[i_x * 2 + i_u_offset] * |
|---|
| 818 | 859 | (MAX_TRANS - i_trans) ) >> TRANS_BITS; |
|---|
| 819 | | p_dst[i_x * 2 + i_v_offset] = ( (uint16_t)p_pal[p_src2[i_x]][2] * |
|---|
| | 860 | p_dst[i_x * 2 + i_v_offset] = ( (uint16_t)i_v * |
|---|
| 820 | 861 | i_trans + (uint16_t)p_src1[i_x * 2 + i_v_offset] * |
|---|
| 821 | 862 | (MAX_TRANS - i_trans) ) >> TRANS_BITS; |
|---|