We can now calculate the correct Cb/Cr start addresses, and at the same time can fix the RGB24 swap that erroneously happened.
Signed-off-by: André Draszik <andre.dras...@st.com> --- src/gfx/convert.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/gfx/convert.c b/src/gfx/convert.c index 2722ce3..e2c9704 100644 --- a/src/gfx/convert.c +++ b/src/gfx/convert.c @@ -669,8 +669,6 @@ dfb_convert_to_rgb16( DFBSurfacePixelFormat format, case DSPF_YV16: { - const u8 *src_cr = src + surface_height * spitch; - const u8 *src_cb = src_cr + surface_height * spitch/2; ++height; while (--height) { const u8 * __restrict y = src; @@ -689,8 +687,8 @@ dfb_convert_to_rgb16( DFBSurfacePixelFormat format, } src += spitch; - src_cb += spitch/2; - src_cr += spitch/2; + src_cb += scbpitch; + src_cr += scrpitch; dst += dp2; } } @@ -952,8 +950,6 @@ dfb_convert_to_rgb555( DFBSurfacePixelFormat format, case DSPF_YV16: { - const u8 *src_cr = src + surface_height * spitch; - const u8 *src_cb = src_cr + surface_height * spitch/2; ++height; while (--height) { const u8 * __restrict y = src; @@ -972,8 +968,8 @@ dfb_convert_to_rgb555( DFBSurfacePixelFormat format, } src += spitch; - src_cb += spitch/2; - src_cr += spitch/2; + src_cb += scbpitch; + src_cr += scrpitch; dst += dp2; } } @@ -1260,8 +1256,6 @@ dfb_convert_to_rgb32( DFBSurfacePixelFormat format, case DSPF_YV16: { - const u8 *src_cr = src + surface_height * spitch; - const u8 *src_cb = src_cr + surface_height * spitch/2; ++height; while (--height) { const u8 * __restrict y = src; @@ -1280,8 +1274,8 @@ dfb_convert_to_rgb32( DFBSurfacePixelFormat format, } src += spitch; - src_cb += spitch/2; - src_cr += spitch/2; + src_cb += scbpitch; + src_cr += scrpitch; dst += dp4; } } @@ -1615,8 +1609,6 @@ dfb_convert_to_argb( DFBSurfacePixelFormat format, case DSPF_YV16: { - const u8 *src_cr = src + surface_height * spitch; - const u8 *src_cb = src_cr + surface_height * spitch/2; ++height; while (--height) { const u8 * __restrict y = src; @@ -1635,8 +1627,8 @@ dfb_convert_to_argb( DFBSurfacePixelFormat format, } src += spitch; - src_cb += spitch/2; - src_cr += spitch/2; + src_cb += scbpitch; + src_cr += scrpitch; dst += dp4; } } @@ -2072,8 +2064,6 @@ dfb_convert_to_rgb24( DFBSurfacePixelFormat format, break; case DSPF_YV16: { - const u8 *src_cr = src + surface_height * spitch; - const u8 *src_cb = src_cr + surface_height * spitch/2; ++height; while (--height) { const u8 * __restrict y = src; @@ -2081,13 +2071,8 @@ dfb_convert_to_rgb24( DFBSurfacePixelFormat format, const u8 * __restrict cr = src_cr; for (n=0, n3=0; n<width; n++, n3+=3) { -#ifdef WORDS_BIGENDIAN YCBCR_TO_RGB (*y, *cb, *cr, dst[n3+0], dst[n3+1], dst[n3+2]); -#else - YCBCR_TO_RGB (*y, *cb, *cr, - dst[n3+2], dst[n3+1], dst[n3+0]); -#endif ++y; cb += (n & 1); @@ -2095,8 +2080,8 @@ dfb_convert_to_rgb24( DFBSurfacePixelFormat format, } src += spitch; - src_cb += spitch/2; - src_cr += spitch/2; + src_cb += scbpitch; + src_cr += scrpitch; dst += dpitch; } } -- 1.8.2 _______________________________________________ directfb-dev mailing list directfb-dev@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev