diff options
author | Ronghua Wu <ronghuawu@google.com> | 2014-09-02 10:55:41 -0700 |
---|---|---|
committer | Ronghua Wu <ronghuawu@google.com> | 2014-09-10 10:02:46 -0700 |
commit | bf220f3e6e799f28d1599c3c5106e9e15631a91d (patch) | |
tree | e1f2f0be8d5082470b1d8b18a73694636ae24216 /media/libstagefright/codecs/on2/dec/SoftVPX.cpp | |
parent | 9007305003e689362749a264af2eafea80eb12a0 (diff) | |
download | frameworks_av-bf220f3e6e799f28d1599c3c5106e9e15631a91d.zip frameworks_av-bf220f3e6e799f28d1599c3c5106e9e15631a91d.tar.gz frameworks_av-bf220f3e6e799f28d1599c3c5106e9e15631a91d.tar.bz2 |
stagefright: add adaptive playback support to SoftAVC decoder.
Also change SoftVPX decoder to use common handlePortSettingsChanged
and copyYV12FrameToOutputBuffer method.
Bug: 17326758
Change-Id: I6fb2ee8fb9291f69c70493b8558af341adc1f4b2
Diffstat (limited to 'media/libstagefright/codecs/on2/dec/SoftVPX.cpp')
-rw-r--r-- | media/libstagefright/codecs/on2/dec/SoftVPX.cpp | 63 |
1 files changed, 11 insertions, 52 deletions
diff --git a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp index 2f63bdd..828577a 100644 --- a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp +++ b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp @@ -137,29 +137,10 @@ void SoftVPX::onQueueFilled(OMX_U32 /* portIndex */) { uint32_t width = mImg->d_w; uint32_t height = mImg->d_h; - - if (width != mWidth || height != mHeight) { - mWidth = width; - mHeight = height; - - if (!mIsAdaptive || width > mAdaptiveMaxWidth || height > mAdaptiveMaxHeight) { - if (mIsAdaptive) { - if (width > mAdaptiveMaxWidth) { - mAdaptiveMaxWidth = width; - } - if (height > mAdaptiveMaxHeight) { - mAdaptiveMaxHeight = height; - } - } - updatePortDefinitions(); - notify(OMX_EventPortSettingsChanged, kOutputPortIndex, 0, NULL); - mOutputPortSettingsChange = AWAITING_DISABLED; - return; - } else { - updatePortDefinitions(); - notify(OMX_EventPortSettingsChanged, kOutputPortIndex, - OMX_IndexConfigCommonOutputCrop, NULL); - } + bool portWillReset = false; + handlePortSettingsChange(&portWillReset, width, height); + if (portWillReset) { + return; } outHeader->nOffset = 0; @@ -167,36 +148,14 @@ void SoftVPX::onQueueFilled(OMX_U32 /* portIndex */) { outHeader->nFlags = EOSseen ? OMX_BUFFERFLAG_EOS : 0; outHeader->nTimeStamp = inHeader->nTimeStamp; - uint32_t buffer_stride = mIsAdaptive ? mAdaptiveMaxWidth : mWidth; - uint32_t buffer_height = mIsAdaptive ? mAdaptiveMaxHeight : mHeight; - - const uint8_t *srcLine = (const uint8_t *)mImg->planes[PLANE_Y]; uint8_t *dst = outHeader->pBuffer; - for (size_t i = 0; i < buffer_height; ++i) { - if (i < mImg->d_h) { - memcpy(dst, srcLine, mImg->d_w); - srcLine += mImg->stride[PLANE_Y]; - } - dst += buffer_stride; - } - - srcLine = (const uint8_t *)mImg->planes[PLANE_U]; - for (size_t i = 0; i < buffer_height / 2; ++i) { - if (i < mImg->d_h / 2) { - memcpy(dst, srcLine, mImg->d_w / 2); - srcLine += mImg->stride[PLANE_U]; - } - dst += buffer_stride / 2; - } - - srcLine = (const uint8_t *)mImg->planes[PLANE_V]; - for (size_t i = 0; i < buffer_height / 2; ++i) { - if (i < mImg->d_h / 2) { - memcpy(dst, srcLine, mImg->d_w / 2); - srcLine += mImg->stride[PLANE_V]; - } - dst += buffer_stride / 2; - } + const uint8_t *srcY = (const uint8_t *)mImg->planes[PLANE_Y]; + const uint8_t *srcU = (const uint8_t *)mImg->planes[PLANE_U]; + const uint8_t *srcV = (const uint8_t *)mImg->planes[PLANE_V]; + size_t srcYStride = mImg->stride[PLANE_Y]; + size_t srcUStride = mImg->stride[PLANE_U]; + size_t srcVStride = mImg->stride[PLANE_V]; + copyYV12FrameToOutputBuffer(dst, srcY, srcU, srcV, srcYStride, srcUStride, srcVStride); mImg = NULL; outInfo->mOwnedByUs = false; |