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

Commit 0e1c2008 authored by Wonsik Kim's avatar Wonsik Kim Committed by android-build-merger
Browse files

Merge "codec2: Add support for updating output delay in avc and hevc decoders"...

Merge "codec2: Add support for updating output delay in avc and hevc decoders" into qt-qpr1-dev am: 1f1b9542
am: c2dd021e

Change-Id: Iebed581fc7e258082563febb1df70f75a57c7a2b
parents 059f7f34 c2dd021e
Loading
Loading
Loading
Loading
+26 −3
Original line number Original line Diff line number Diff line
@@ -33,7 +33,8 @@ namespace android {
namespace {
namespace {


constexpr char COMPONENT_NAME[] = "c2.android.avc.decoder";
constexpr char COMPONENT_NAME[] = "c2.android.avc.decoder";

constexpr uint32_t kDefaultOutputDelay = 8;
constexpr uint32_t kMaxOutputDelay = 16;
}  // namespace
}  // namespace


class C2SoftAvcDec::IntfImpl : public SimpleInterface<void>::BaseParams {
class C2SoftAvcDec::IntfImpl : public SimpleInterface<void>::BaseParams {
@@ -54,7 +55,9 @@ public:
        // TODO: Proper support for reorder depth.
        // TODO: Proper support for reorder depth.
        addParameter(
        addParameter(
                DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY)
                DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY)
                .withConstValue(new C2PortActualDelayTuning::output(8u))
                .withDefault(new C2PortActualDelayTuning::output(kDefaultOutputDelay))
                .withFields({C2F(mActualOutputDelay, value).inRange(0, kMaxOutputDelay)})
                .withSetter(Setter<decltype(*mActualOutputDelay)>::StrictValueWithNoDeps)
                .build());
                .build());


        // TODO: output latency and reordering
        // TODO: output latency and reordering
@@ -196,7 +199,6 @@ public:
                                     0u, HAL_PIXEL_FORMAT_YCBCR_420_888))
                                     0u, HAL_PIXEL_FORMAT_YCBCR_420_888))
                .build());
                .build());
    }
    }

    static C2R SizeSetter(bool mayBlock, const C2P<C2StreamPictureSizeInfo::output> &oldMe,
    static C2R SizeSetter(bool mayBlock, const C2P<C2StreamPictureSizeInfo::output> &oldMe,
                          C2P<C2StreamPictureSizeInfo::output> &me) {
                          C2P<C2StreamPictureSizeInfo::output> &me) {
        (void)mayBlock;
        (void)mayBlock;
@@ -333,6 +335,7 @@ C2SoftAvcDec::C2SoftAvcDec(
      mDecHandle(nullptr),
      mDecHandle(nullptr),
      mOutBufferFlush(nullptr),
      mOutBufferFlush(nullptr),
      mIvColorFormat(IV_YUV_420P),
      mIvColorFormat(IV_YUV_420P),
      mOutputDelay(kDefaultOutputDelay),
      mWidth(320),
      mWidth(320),
      mHeight(240),
      mHeight(240),
      mHeaderDecoded(false),
      mHeaderDecoded(false),
@@ -882,6 +885,26 @@ void C2SoftAvcDec::process(
            work->result = C2_CORRUPTED;
            work->result = C2_CORRUPTED;
            return;
            return;
        }
        }
        if (s_decode_op.i4_reorder_depth >= 0 && mOutputDelay != s_decode_op.i4_reorder_depth) {
            mOutputDelay = s_decode_op.i4_reorder_depth;
            ALOGV("New Output delay %d ", mOutputDelay);

            C2PortActualDelayTuning::output outputDelay(mOutputDelay);
            std::vector<std::unique_ptr<C2SettingResult>> failures;
            c2_status_t err =
                mIntf->config({&outputDelay}, C2_MAY_BLOCK, &failures);
            if (err == OK) {
                work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(outputDelay));
            } else {
                ALOGE("Cannot set output delay");
                mSignalledError = true;
                work->workletsProcessed = 1u;
                work->result = C2_CORRUPTED;
                return;
            }
            continue;
        }
        if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
        if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
            if (mHeaderDecoded == false) {
            if (mHeaderDecoded == false) {
                mHeaderDecoded = true;
                mHeaderDecoded = true;
+1 −1
Original line number Original line Diff line number Diff line
@@ -157,7 +157,7 @@ private:


    size_t mNumCores;
    size_t mNumCores;
    IV_COLOR_FORMAT_T mIvColorFormat;
    IV_COLOR_FORMAT_T mIvColorFormat;

    uint32_t mOutputDelay;
    uint32_t mWidth;
    uint32_t mWidth;
    uint32_t mHeight;
    uint32_t mHeight;
    uint32_t mStride;
    uint32_t mStride;
+26 −2
Original line number Original line Diff line number Diff line
@@ -33,7 +33,8 @@ namespace android {
namespace {
namespace {


constexpr char COMPONENT_NAME[] = "c2.android.hevc.decoder";
constexpr char COMPONENT_NAME[] = "c2.android.hevc.decoder";

constexpr uint32_t kDefaultOutputDelay = 8;
constexpr uint32_t kMaxOutputDelay = 16;
}  // namespace
}  // namespace


class C2SoftHevcDec::IntfImpl : public SimpleInterface<void>::BaseParams {
class C2SoftHevcDec::IntfImpl : public SimpleInterface<void>::BaseParams {
@@ -54,7 +55,9 @@ public:
        // TODO: Proper support for reorder depth.
        // TODO: Proper support for reorder depth.
        addParameter(
        addParameter(
                DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY)
                DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY)
                .withConstValue(new C2PortActualDelayTuning::output(8u))
                .withDefault(new C2PortActualDelayTuning::output(kDefaultOutputDelay))
                .withFields({C2F(mActualOutputDelay, value).inRange(0, kMaxOutputDelay)})
                .withSetter(Setter<decltype(*mActualOutputDelay)>::StrictValueWithNoDeps)
                .build());
                .build());


        addParameter(
        addParameter(
@@ -327,6 +330,7 @@ C2SoftHevcDec::C2SoftHevcDec(
        mDecHandle(nullptr),
        mDecHandle(nullptr),
        mOutBufferFlush(nullptr),
        mOutBufferFlush(nullptr),
        mIvColorformat(IV_YUV_420P),
        mIvColorformat(IV_YUV_420P),
        mOutputDelay(kDefaultOutputDelay),
        mWidth(320),
        mWidth(320),
        mHeight(240),
        mHeight(240),
        mHeaderDecoded(false),
        mHeaderDecoded(false),
@@ -877,6 +881,26 @@ void C2SoftHevcDec::process(
            work->result = C2_CORRUPTED;
            work->result = C2_CORRUPTED;
            return;
            return;
        }
        }
        if (s_decode_op.i4_reorder_depth >= 0 && mOutputDelay != s_decode_op.i4_reorder_depth) {
            mOutputDelay = s_decode_op.i4_reorder_depth;
            ALOGV("New Output delay %d ", mOutputDelay);

            C2PortActualDelayTuning::output outputDelay(mOutputDelay);
            std::vector<std::unique_ptr<C2SettingResult>> failures;
            c2_status_t err =
                mIntf->config({&outputDelay}, C2_MAY_BLOCK, &failures);
            if (err == OK) {
                work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(outputDelay));
            } else {
                ALOGE("Cannot set output delay");
                mSignalledError = true;
                work->workletsProcessed = 1u;
                work->result = C2_CORRUPTED;
                return;
            }
            continue;
        }
        if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
        if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
            if (mHeaderDecoded == false) {
            if (mHeaderDecoded == false) {
                mHeaderDecoded = true;
                mHeaderDecoded = true;
+1 −1
Original line number Original line Diff line number Diff line
@@ -115,7 +115,7 @@ struct C2SoftHevcDec : public SimpleC2Component {


    size_t mNumCores;
    size_t mNumCores;
    IV_COLOR_FORMAT_T mIvColorformat;
    IV_COLOR_FORMAT_T mIvColorformat;

    uint32_t mOutputDelay;
    uint32_t mWidth;
    uint32_t mWidth;
    uint32_t mHeight;
    uint32_t mHeight;
    uint32_t mStride;
    uint32_t mStride;