Commit 67e1d348 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Hopefully added UYVY blending for YUVA and YUVP. (Untested)

parent 4b1302d9
......@@ -51,12 +51,12 @@ static void BlendR16( filter_t *, picture_t *, picture_t *, picture_t *,
int, int, int, int, int );
static void BlendR24( filter_t *, picture_t *, picture_t *, picture_t *,
int, int, int, int, int );
static void BlendYUY2( filter_t *, picture_t *, picture_t *, picture_t *,
int, int, int, int, int );
static void BlendYUVPacked( filter_t *, picture_t *, picture_t *, picture_t *,
int, int, int, int, int );
static void BlendPalI420( filter_t *, picture_t *, picture_t *, picture_t *,
int, int, int, int, int );
static void BlendPalYUY2( filter_t *, picture_t *, picture_t *, picture_t *,
int, int, int, int, int );
static void BlendPalYUVPacked( filter_t *, picture_t *, picture_t *, picture_t *,
int, int, int, int, int );
static void BlendPalRV( filter_t *, picture_t *, picture_t *, picture_t *,
int, int, int, int, int );
......@@ -84,6 +84,7 @@ static int OpenFilter( vlc_object_t *p_this )
( p_filter->fmt_out.video.i_chroma != VLC_FOURCC('I','4','2','0') &&
p_filter->fmt_out.video.i_chroma != VLC_FOURCC('Y','U','Y','2') &&
p_filter->fmt_out.video.i_chroma != VLC_FOURCC('Y','V','1','2') &&
p_filter->fmt_out.video.i_chroma != VLC_FOURCC('U','Y','V','Y') &&
p_filter->fmt_out.video.i_chroma != VLC_FOURCC('R','V','1','6') &&
p_filter->fmt_out.video.i_chroma != VLC_FOURCC('R','V','2','4') &&
p_filter->fmt_out.video.i_chroma != VLC_FOURCC('R','V','3','2') ) )
......@@ -138,9 +139,10 @@ static void Blend( filter_t *p_filter, picture_t *p_dst,
return;
}
if( p_filter->fmt_in.video.i_chroma == VLC_FOURCC('Y','U','V','A') &&
p_filter->fmt_out.video.i_chroma == VLC_FOURCC('Y','U','Y','2') )
( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('Y','U','Y','2') ||
p_filter->fmt_out.video.i_chroma == VLC_FOURCC('U','Y','V','Y') ) )
{
BlendYUY2( p_filter, p_dst, p_dst_orig, p_src,
BlendYUVPacked( p_filter, p_dst, p_dst_orig, p_src,
i_x_offset, i_y_offset, i_width, i_height, i_alpha );
return;
}
......@@ -168,9 +170,10 @@ static void Blend( filter_t *p_filter, picture_t *p_dst,
return;
}
if( p_filter->fmt_in.video.i_chroma == VLC_FOURCC('Y','U','V','P') &&
p_filter->fmt_out.video.i_chroma == VLC_FOURCC('Y','U','Y','2') )
( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('Y','U','Y','2') ||
p_filter->fmt_out.video.i_chroma == VLC_FOURCC('U','Y','V','Y') ) )
{
BlendPalYUY2( p_filter, p_dst, p_dst_orig, p_src,
BlendPalYUVPacked( p_filter, p_dst, p_dst_orig, p_src,
i_x_offset, i_y_offset, i_width, i_height, i_alpha );
return;
}
......@@ -500,10 +503,10 @@ static void BlendR24( filter_t *p_filter, picture_t *p_dst_pic,
return;
}
static void BlendYUY2( filter_t *p_filter, picture_t *p_dst_pic,
picture_t *p_dst_orig, picture_t *p_src,
int i_x_offset, int i_y_offset,
int i_width, int i_height, int i_alpha )
static void BlendYUVPacked( filter_t *p_filter, picture_t *p_dst_pic,
picture_t *p_dst_orig, picture_t *p_src,
int i_x_offset, int i_y_offset,
int i_width, int i_height, int i_alpha )
{
int i_src1_pitch, i_src2_pitch, i_dst_pitch;
uint8_t *p_dst, *p_src1, *p_src2_y;
......@@ -511,6 +514,18 @@ static void BlendYUY2( filter_t *p_filter, picture_t *p_dst_pic,
uint8_t *p_trans;
int i_x, i_y, i_pix_pitch, i_trans;
vlc_bool_t b_even = !((i_x_offset + p_filter->fmt_out.video.i_x_offset)%2);
int i_u_offset, i_v_offset;
if( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('Y','U','Y','2') )
{
i_u_offset = 1;
i_v_offset = 3;
}
else if( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('U','Y','V','Y') )
{
i_u_offset = 0;
i_v_offset = 2;
}
i_pix_pitch = 2;
i_dst_pitch = p_dst_pic->p->i_pitch;
......@@ -566,8 +581,8 @@ static void BlendYUY2( filter_t *p_filter, picture_t *p_dst_pic,
if( b_even )
{
p_dst[i_x * 2 + 1] = p_src2_u[i_x];
p_dst[i_x * 2 + 3] = p_src2_v[i_x];
p_dst[i_x * 2 + i_u_offset] = p_src2_u[i_x];
p_dst[i_x * 2 + i_v_offset] = p_src2_v[i_x];
}
}
else
......@@ -579,11 +594,11 @@ static void BlendYUY2( filter_t *p_filter, picture_t *p_dst_pic,
if( b_even )
{
p_dst[i_x * 2 + 1] = ( (uint16_t)p_src2_u[i_x] * i_trans +
(uint16_t)p_src1[i_x * 2 + 1] * (MAX_TRANS - i_trans) )
p_dst[i_x * 2 + i_u_offset] = ( (uint16_t)p_src2_u[i_x] * i_trans +
(uint16_t)p_src1[i_x * 2 + i_u_offset] * (MAX_TRANS - i_trans) )
>> TRANS_BITS;
p_dst[i_x * 2 + 3] = ( (uint16_t)p_src2_v[i_x] * i_trans +
(uint16_t)p_src1[i_x * 2 + 3] * (MAX_TRANS - i_trans) )
p_dst[i_x * 2 + i_v_offset] = ( (uint16_t)p_src2_v[i_x] * i_trans +
(uint16_t)p_src1[i_x * 2 + i_v_offset] * (MAX_TRANS - i_trans) )
>> TRANS_BITS;
}
}
......@@ -703,15 +718,27 @@ static void BlendPalI420( filter_t *p_filter, picture_t *p_dst,
return;
}
static void BlendPalYUY2( filter_t *p_filter, picture_t *p_dst_pic,
picture_t *p_dst_orig, picture_t *p_src,
int i_x_offset, int i_y_offset,
int i_width, int i_height, int i_alpha )
static void BlendPalYUVPacked( filter_t *p_filter, picture_t *p_dst_pic,
picture_t *p_dst_orig, picture_t *p_src,
int i_x_offset, int i_y_offset,
int i_width, int i_height, int i_alpha )
{
int i_src1_pitch, i_src2_pitch, i_dst_pitch;
uint8_t *p_src1, *p_src2, *p_dst;
int i_x, i_y, i_pix_pitch, i_trans;
vlc_bool_t b_even = !((i_x_offset + p_filter->fmt_out.video.i_x_offset)%2);
int i_u_offset, i_v_offset;
if( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('Y','U','Y','2') )
{
i_u_offset = 1;
i_v_offset = 3;
}
else if( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('U','Y','V','Y') )
{
i_u_offset = 0;
i_v_offset = 2;
}
i_pix_pitch = 2;
i_dst_pitch = p_dst_pic->p->i_pitch;
......@@ -754,8 +781,8 @@ static void BlendPalYUY2( filter_t *p_filter, picture_t *p_dst_pic,
if( b_even )
{
p_dst[i_x * 2 + 1] = p_pal[p_src2[i_x]][1];
p_dst[i_x * 2 + 3] = p_pal[p_src2[i_x]][2];
p_dst[i_x * 2 + i_u_offset] = p_pal[p_src2[i_x]][1];
p_dst[i_x * 2 + i_v_offset] = p_pal[p_src2[i_x]][2];
}
}
else
......@@ -767,11 +794,11 @@ static void BlendPalYUY2( filter_t *p_filter, picture_t *p_dst_pic,
if( b_even )
{
p_dst[i_x * 2 + 1] = ( (uint16_t)p_pal[p_src2[i_x]][1] *
i_trans + (uint16_t)p_src1[i_x * 2 + 1] *
p_dst[i_x * 2 + i_u_offset] = ( (uint16_t)p_pal[p_src2[i_x]][1] *
i_trans + (uint16_t)p_src1[i_x * 2 + i_u_offset] *
(MAX_TRANS - i_trans) ) >> TRANS_BITS;
p_dst[i_x * 2 + 3] = ( (uint16_t)p_pal[p_src2[i_x]][2] *
i_trans + (uint16_t)p_src1[i_x * 2 + 3] *
p_dst[i_x * 2 + i_v_offset] = ( (uint16_t)p_pal[p_src2[i_x]][2] *
i_trans + (uint16_t)p_src1[i_x * 2 + i_v_offset] *
(MAX_TRANS - i_trans) ) >> TRANS_BITS;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment