diff options
author | hkuang <hkuang@google.com> | 2014-09-15 23:56:40 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-15 23:56:41 +0000 |
commit | db8556baf10baefd286f7654c822fd0b648e71ef (patch) | |
tree | 6ede74d256db97b519622b02b0fa961c9522bc65 | |
parent | 60a89850fdbb71fd48bdef3712b340cc2fa5a722 (diff) | |
parent | 58c4cf4540e3f23847196bd4b45d82613e238821 (diff) | |
download | frameworks_av-db8556baf10baefd286f7654c822fd0b648e71ef.zip frameworks_av-db8556baf10baefd286f7654c822fd0b648e71ef.tar.gz frameworks_av-db8556baf10baefd286f7654c822fd0b648e71ef.tar.bz2 |
Merge "Optimize the YUV buffer copy a little bit to skip unnecessary operation." into lmp-dev
-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 741ac96..1cb1859 100644 --- a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp +++ b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp @@ -202,29 +202,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; } } |