Commit 19a454cf authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

modules: use plane_SwapUV()

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent c8f75523
......@@ -989,9 +989,7 @@ static void CopyPicture( picture_t *p_pic, uint8_t *p_in )
int i_plane, i_line, i_width, i_dst_stride;
uint8_t *p_dst, *p_src = p_in;
p_dst = p_pic->p[1].p_pixels;
p_pic->p[1].p_pixels = p_pic->p[2].p_pixels;
p_pic->p[2].p_pixels = p_dst;
plane_SwapUV( p_pic->p );
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
......@@ -1007,9 +1005,7 @@ static void CopyPicture( picture_t *p_pic, uint8_t *p_in )
}
}
p_dst = p_pic->p[1].p_pixels;
p_pic->p[1].p_pixels = p_pic->p[2].p_pixels;
p_pic->p[2].p_pixels = p_dst;
plane_SwapUV( p_pic->p );
}
static void *DecoderThread( void *data )
......
......@@ -346,11 +346,8 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
return;
}
if (dst->format.i_chroma == VLC_CODEC_I420) {
uint8_t *tmp = dst->p[1].p_pixels;
dst->p[1].p_pixels = dst->p[2].p_pixels;
dst->p[2].p_pixels = tmp;
}
if (dst->format.i_chroma == VLC_CODEC_I420)
plane_SwapUV( dst->p );
ID3D11Texture2D_GetDesc(sys->staging, &desc);
......@@ -389,11 +386,8 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
msg_Err(p_filter, "Unsupported D3D11VA conversion from 0x%08X to YV12", desc.Format);
}
if (dst->format.i_chroma == VLC_CODEC_I420) {
uint8_t *tmp = dst->p[1].p_pixels;
dst->p[1].p_pixels = dst->p[2].p_pixels;
dst->p[2].p_pixels = tmp;
}
if (dst->format.i_chroma == VLC_CODEC_I420)
plane_SwapUV( dst->p );
/* */
ID3D11DeviceContext_Unmap(p_sys->context, sys->staging_resource, 0);
......
......@@ -81,11 +81,8 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
if (desc.Format == MAKEFOURCC('Y','V','1','2') ||
desc.Format == MAKEFOURCC('I','M','C','3')) {
if (dst->format.i_chroma == VLC_CODEC_I420) {
uint8_t *tmp = dst->p[1].p_pixels;
dst->p[1].p_pixels = dst->p[2].p_pixels;
dst->p[2].p_pixels = tmp;
}
if (dst->format.i_chroma == VLC_CODEC_I420)
plane_SwapUV( dst->p );
bool imc3 = desc.Format == MAKEFOURCC('I','M','C','3');
size_t chroma_pitch = imc3 ? lock.Pitch : (lock.Pitch / 2);
......@@ -110,11 +107,8 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
}
Copy420_P_to_P(dst, plane, pitch, src->format.i_height, p_copy_cache);
if (dst->format.i_chroma == VLC_CODEC_I420) {
uint8_t *tmp = dst->p[1].p_pixels;
dst->p[1].p_pixels = dst->p[2].p_pixels;
dst->p[2].p_pixels = tmp;
}
if (dst->format.i_chroma == VLC_CODEC_I420)
plane_SwapUV( dst->p );
} else if (desc.Format == MAKEFOURCC('N','V','1','2')) {
const uint8_t *plane[2] = {
lock.pBits,
......
......@@ -883,11 +883,8 @@ int picture_UpdatePlanes(picture_t *picture, uint8_t *data, unsigned pitch)
p->i_lines = picture->format.i_height / 2;
}
/* The dx/d3d buffer is always allocated as YV12 */
if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) {
uint8_t *p_tmp = picture->p[1].p_pixels;
picture->p[1].p_pixels = picture->p[2].p_pixels;
picture->p[2].p_pixels = p_tmp;
}
if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12))
plane_SwapUV( picture->p );
}
return VLC_SUCCESS;
}
......
......@@ -316,11 +316,8 @@ static void SetupPictureYV12(picture_t *p_picture, uint32_t i_in_stride)
}
if (vlc_fourcc_AreUVPlanesSwapped(p_picture->format.i_chroma,
VLC_CODEC_YV12)) {
uint8_t *p_tmp = p_picture->p[1].p_pixels;
p_picture->p[1].p_pixels = p_picture->p[2].p_pixels;
p_picture->p[2].p_pixels = p_tmp;
}
VLC_CODEC_YV12))
plane_SwapUV( p_picture->p );
}
static void AndroidWindow_DisconnectSurface(vout_display_sys_t *sys,
......
......@@ -628,11 +628,8 @@ static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
res.p[i].p_pixels = res.p[0].p_pixels + offsets[i];
if (p_sys->swap_uv)
{ /* YVU: swap U and V planes */
uint8_t *buf = res.p[2].p_pixels;
res.p[2].p_pixels = res.p[1].p_pixels;
res.p[1].p_pixels = buf;
}
/* YVU: swap U and V planes */
plane_SwapUV( res.p );
pic_array[count] = XCB_picture_NewFromResource (&vd->fmt, &res,
p_sys->conn);
......
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