Changeset 069e052f822e29645de86abf8a9e4ab02535b0a3

Show
Ignore:
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
  • modules/video_filter/blend.c

    r29c602f r069e052  
    593593                if( b_even ) 
    594594                { 
    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                    } 
    597605                } 
    598606            } 
     
    606614                if( b_even ) 
    607615                { 
    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 + 
    609629                        (uint16_t)p_src1[i_x * 2 + i_u_offset] * (MAX_TRANS - i_trans) ) 
    610630                        >> 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 + 
    612632                        (uint16_t)p_src1[i_x * 2 + i_v_offset] * (MAX_TRANS - i_trans) ) 
    613633                        >> TRANS_BITS; 
     
    801821                if( b_even ) 
    802822                { 
    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                    } 
    805833                } 
    806834            } 
     
    814842                if( b_even ) 
    815843                { 
    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 * 
    817858                        i_trans + (uint16_t)p_src1[i_x * 2 + i_u_offset] * 
    818859                        (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
    820861                        i_trans + (uint16_t)p_src1[i_x * 2 + i_v_offset] * 
    821862                        (MAX_TRANS - i_trans) ) >> TRANS_BITS;