Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4478feb authored by Ronghua Wu's avatar Ronghua Wu Committed by Android (Google) Code Review
Browse files

Merge "Add adaptive playback support to VPX decoder." into lmp-dev

parents e7494680 031be0f3
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -67,10 +67,6 @@ private:
        kNumBuffers = 2,
    };

    enum {
        kStoreMetaDataExtensionIndex = OMX_IndexVendorStartUnused + 1
    };

    // OMX input buffer's timestamp and flags
    typedef struct {
        int64_t mTimeUs;
+0 −4
Original line number Diff line number Diff line
@@ -56,10 +56,6 @@ private:
        kNumBuffers = 2,
    };

    enum {
        kStoreMetaDataExtensionIndex = OMX_IndexVendorStartUnused + 1
    };

    // OMX input buffer's timestamp and flags
    typedef struct {
        int64_t mTimeUs;
+39 −20
Original line number Diff line number Diff line
@@ -143,11 +143,24 @@ void SoftVPX::onQueueFilled(OMX_U32 /* portIndex */) {
                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, 1, 0, NULL);
                    notify(OMX_EventPortSettingsChanged, kOutputPortIndex, 0, NULL);
                    mOutputPortSettingsChange = AWAITING_DISABLED;
                    return;
                } else {
                    updatePortDefinitions();
                    notify(OMX_EventPortSettingsChanged, kOutputPortIndex,
                           OMX_IndexConfigCommonOutputCrop, NULL);
                }
            }

            outHeader->nOffset = 0;
@@ -155,29 +168,35 @@ 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 *)img->planes[PLANE_Y];
            uint8_t *dst = outHeader->pBuffer;
            for (size_t i = 0; i < img->d_h; ++i) {
            for (size_t i = 0; i < buffer_height; ++i) {
                if (i < img->d_h) {
                    memcpy(dst, srcLine, img->d_w);

                    srcLine += img->stride[PLANE_Y];
                dst += img->d_w;
                }
                dst += buffer_stride;
            }

            srcLine = (const uint8_t *)img->planes[PLANE_U];
            for (size_t i = 0; i < img->d_h / 2; ++i) {
            for (size_t i = 0; i < buffer_height / 2; ++i) {
                if (i < img->d_h / 2) {
                    memcpy(dst, srcLine, img->d_w / 2);

                    srcLine += img->stride[PLANE_U];
                dst += img->d_w / 2;
                }
                dst += buffer_stride / 2;
            }

            srcLine = (const uint8_t *)img->planes[PLANE_V];
            for (size_t i = 0; i < img->d_h / 2; ++i) {
            for (size_t i = 0; i < buffer_height / 2; ++i) {
                if (i < img->d_h / 2) {
                    memcpy(dst, srcLine, img->d_w / 2);

                    srcLine += img->stride[PLANE_V];
                dst += img->d_w / 2;
                }
                dst += buffer_stride / 2;
            }

            outInfo->mOwnedByUs = false;
+0 −4
Original line number Diff line number Diff line
@@ -91,10 +91,6 @@ protected:
            const char *name, OMX_INDEXTYPE *index);

private:
    enum {
        kStoreMetaDataExtensionIndex = OMX_IndexVendorStartUnused + 1,
    };

    enum TemporalReferences {
        // For 1 layer case: reference all (last, golden, and alt ref), but only
        // update last.
+5 −0
Original line number Diff line number Diff line
@@ -58,6 +58,11 @@ protected:
        } mTransition;
    };

    enum {
        kStoreMetaDataExtensionIndex = OMX_IndexVendorStartUnused + 1,
        kPrepareForAdaptivePlaybackIndex,
    };

    void addPort(const OMX_PARAM_PORTDEFINITIONTYPE &def);

    virtual OMX_ERRORTYPE internalGetParameter(
Loading