Commit d0734d50 authored by Thomas Guillem's avatar Thomas Guillem

hw:d3d9:dxa9: swap UV only when the source is YV12

parent 4ef1d5a2
...@@ -78,14 +78,15 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst) ...@@ -78,14 +78,15 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
if (!GetLock(p_filter, p_sys->surface, &lock, &desc)) if (!GetLock(p_filter, p_sys->surface, &lock, &desc))
return; 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 (desc.Format == MAKEFOURCC('Y','V','1','2') || if (desc.Format == MAKEFOURCC('Y','V','1','2') ||
desc.Format == MAKEFOURCC('I','M','C','3')) { 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;
}
bool imc3 = desc.Format == MAKEFOURCC('I','M','C','3'); bool imc3 = desc.Format == MAKEFOURCC('I','M','C','3');
size_t chroma_pitch = imc3 ? lock.Pitch : (lock.Pitch / 2); size_t chroma_pitch = imc3 ? lock.Pitch : (lock.Pitch / 2);
...@@ -108,6 +109,12 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst) ...@@ -108,6 +109,12 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
plane[2] = V; plane[2] = V;
} }
Copy420_P_to_P(dst, plane, pitch, src->format.i_height, p_copy_cache); 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;
}
} else if (desc.Format == MAKEFOURCC('N','V','1','2')) { } else if (desc.Format == MAKEFOURCC('N','V','1','2')) {
const uint8_t *plane[2] = { const uint8_t *plane[2] = {
lock.pBits, lock.pBits,
...@@ -124,12 +131,6 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst) ...@@ -124,12 +131,6 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
msg_Err(p_filter, "Unsupported DXA9 conversion from 0x%08X to YV12", desc.Format); msg_Err(p_filter, "Unsupported DXA9 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;
}
/* */ /* */
IDirect3DSurface9_UnlockRect(p_sys->surface); IDirect3DSurface9_UnlockRect(p_sys->surface);
} }
......
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