--- colorspace.c 2004/04/07 22:02:56 1.9.2.1 +++ colorspace.c 2006/10/30 10:52:00 1.13 @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: colorspace.c,v 1.9.2.1 2004/04/07 22:02:56 edgomez Exp $ + * $Id: colorspace.c,v 1.13 2006/10/30 10:52:00 Skal Exp $ * ****************************************************************************/ @@ -38,7 +38,6 @@ packedFuncPtr abgr_to_yv12; packedFuncPtr rgba_to_yv12; packedFuncPtr argb_to_yv12; -packedFuncPtr yuv_to_yv12; packedFuncPtr yuyv_to_yv12; packedFuncPtr uyvy_to_yv12; @@ -60,7 +59,6 @@ packedFuncPtr yv12_to_abgr; packedFuncPtr yv12_to_rgba; packedFuncPtr yv12_to_argb; -packedFuncPtr yv12_to_yuv; packedFuncPtr yv12_to_yuyv; packedFuncPtr yv12_to_uyvy; @@ -77,11 +75,11 @@ planarFuncPtr yv12_to_yv12; -int32_t RGB_Y_tab[256]; -int32_t B_U_tab[256]; -int32_t G_U_tab[256]; -int32_t G_V_tab[256]; -int32_t R_V_tab[256]; +static int32_t RGB_Y_tab[256]; +static int32_t B_U_tab[256]; +static int32_t G_U_tab[256]; +static int32_t G_V_tab[256]; +static int32_t R_V_tab[256]; @@ -474,11 +472,14 @@ int width2 = width / 2; int height2 = height / 2; int y; + const int with_uv = (u_src!=0 && v_src!=0); if (vflip) { y_src += (height - 1) * y_src_stride; - u_src += (height2 - 1) * uv_src_stride; - v_src += (height2 - 1) * uv_src_stride; + if (with_uv) { + u_src += (height2 - 1) * uv_src_stride; + v_src += (height2 - 1) * uv_src_stride; + } y_src_stride = -y_src_stride; uv_src_stride = -uv_src_stride; } @@ -489,16 +490,23 @@ y_dst += y_dst_stride; } - for (y = height2; y; y--) { - memcpy(u_dst, u_src, width2); - u_src += uv_src_stride; - u_dst += uv_dst_stride; + if (with_uv) { + for (y = height2; y; y--) { + memcpy(u_dst, u_src, width2); + memcpy(v_dst, v_src, width2); + u_src += uv_src_stride; + u_dst += uv_dst_stride; + v_src += uv_src_stride; + v_dst += uv_dst_stride; + } } - - for (y = height2; y; y--) { - memcpy(v_dst, v_src, width2); - v_src += uv_src_stride; - v_dst += uv_dst_stride; + else { + for (y = height2; y; y--) { + memset(u_dst, 0x80, width2); + memset(v_dst, 0x80, width2); + u_dst += uv_dst_stride; + v_dst += uv_dst_stride; + } } }