diff options
author | hkuang <hkuang@google.com> | 2014-09-12 13:38:04 -0700 |
---|---|---|
committer | Hangyu Kuang <hkuang@google.com> | 2014-09-15 23:02:53 +0000 |
commit | 58c4cf4540e3f23847196bd4b45d82613e238821 (patch) | |
tree | 55c1341a04010c5708464834f9b1d9f479e67d13 /media/libstagefright/omx | |
parent | f2a74aad5efc01e5b9939c7cbbfde058ce64bfec (diff) | |
download | frameworks_av-58c4cf4540e3f23847196bd4b45d82613e238821.zip frameworks_av-58c4cf4540e3f23847196bd4b45d82613e238821.tar.gz frameworks_av-58c4cf4540e3f23847196bd4b45d82613e238821.tar.bz2 |
Optimize the YUV buffer copy a little bit to skip unnecessary operation.
Bug: 17326758
Change-Id: I2505751cb40a53242ceeb3be8f362c3754c2ee3f
Diffstat (limited to 'media/libstagefright/omx')
-rw-r--r-- | media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp index e533fdd..37535ce 100644 --- a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp +++ b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp @@ -189,29 +189,26 @@ void SoftVideoDecoderOMXComponent::copyYV12FrameToOutputBuffer( size_t dstYStride = mIsAdaptive ? mAdaptiveMaxWidth : mWidth; size_t dstUVStride = dstYStride / 2; size_t dstHeight = mIsAdaptive ? mAdaptiveMaxHeight : mHeight; + uint8_t *dstStart = dst; - for (size_t i = 0; i < dstHeight; ++i) { - if (i < mHeight) { - memcpy(dst, srcY, mWidth); - srcY += srcYStride; - } - dst += dstYStride; + for (size_t i = 0; i < mHeight; ++i) { + memcpy(dst, srcY, mWidth); + srcY += srcYStride; + dst += dstYStride; } - for (size_t i = 0; i < dstHeight / 2; ++i) { - if (i < mHeight / 2) { - memcpy(dst, srcU, mWidth / 2); - srcU += srcUStride; - } - dst += dstUVStride; + dst = dstStart + dstYStride * dstHeight; + for (size_t i = 0; i < mHeight / 2; ++i) { + memcpy(dst, srcU, mWidth / 2); + srcU += srcUStride; + dst += dstUVStride; } - for (size_t i = 0; i < dstHeight / 2; ++i) { - if (i < mHeight / 2) { - memcpy(dst, srcV, mWidth / 2); - srcV += srcVStride; - } - dst += dstUVStride; + dst = dstStart + (5 * dstYStride * dstHeight) / 4; + for (size_t i = 0; i < mHeight / 2; ++i) { + memcpy(dst, srcV, mWidth / 2); + srcV += srcVStride; + dst += dstUVStride; } } |