From d1943b39e59c1f679acfafeeb46916157f7ff3d7 Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Thu, 19 Jan 2012 21:24:15 +0000 Subject: [PATCH] add dest alignment check for NV12ToARGB BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/360003 git-svn-id: http://libyuv.googlecode.com/svn/trunk@143 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/planar_functions.h | 2 +- source/planar_functions.cc | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.chromium b/README.chromium index bb4810c3e..d41c158e6 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 142 +Version: 143 License: BSD License File: LICENSE diff --git a/include/libyuv/planar_functions.h b/include/libyuv/planar_functions.h index 9b0522f58..72f030608 100644 --- a/include/libyuv/planar_functions.h +++ b/include/libyuv/planar_functions.h @@ -79,7 +79,7 @@ int I400ToI420(const uint8* src_y, int src_stride_y, uint8* dst_v, int dst_stride_v, int width, int height); -// Convert NV12 to ARGB. +// Convert NV12 to ARGB. Also used for NV21. int NV12ToARGB(const uint8* src_y, int src_stride_y, const uint8* src_uv, int src_stride_uv, uint8* dst_frame, int dst_stride_frame, diff --git a/source/planar_functions.cc b/source/planar_functions.cc index 026fedc7d..5b3b17c10 100644 --- a/source/planar_functions.cc +++ b/source/planar_functions.cc @@ -2248,25 +2248,27 @@ int ARGBToRAW(const uint8* src_argb, int src_stride_argb, // Convert NV12 to ARGB. int NV12ToARGB(const uint8* src_y, int src_stride_y, const uint8* src_uv, int src_stride_uv, - uint8* dst_rgb, int dst_stride_rgb, + uint8* dst_argb, int dst_stride_argb, int width, int height) { // Negative height means invert the image. if (height < 0) { height = -height; - dst_rgb = dst_rgb + (height - 1) * dst_stride_rgb; - dst_stride_rgb = -dst_stride_rgb; + dst_argb = dst_argb + (height - 1) * dst_stride_argb; + dst_stride_argb = -dst_stride_argb; } void (*FastConvertYUVToARGBRow)(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, - uint8* rgb_buf, + uint8* argb_buf, int width); #if defined(HAS_FASTCONVERTYUVTOARGBROW_NEON) if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 16)) { FastConvertYUVToARGBRow = FastConvertYUVToARGBRow_NEON; } else #elif defined(HAS_FASTCONVERTYUVTOARGBROW_SSSE3) - if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 8)) { + if (TestCpuFlag(kCpuHasSSSE3) && + IS_ALIGNED(width, 8) && + IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) { FastConvertYUVToARGBRow = FastConvertYUVToARGBRow_SSSE3; } else #endif @@ -2298,8 +2300,8 @@ int NV12ToARGB(const uint8* src_y, int src_stride_y, SplitUV(src_uv, rowuv, rowuv + kMaxStride, halfwidth); src_uv += src_stride_uv; } - FastConvertYUVToARGBRow(src_y, rowuv, rowuv + kMaxStride, dst_rgb, width); - dst_rgb += dst_stride_rgb; + FastConvertYUVToARGBRow(src_y, rowuv, rowuv + kMaxStride, dst_argb, width); + dst_argb += dst_stride_argb; src_y += src_stride_y; } return 0;