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

Commit d60ba351 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7189849 from a1f7f557 to sc-release

Change-Id: I5ad3bfdbd6b8cd6a07ebd4b292898127f63fbec4
parents ed88ddc5 a1f7f557
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -338,7 +338,7 @@ void DrmHal::cleanup() {
}

std::vector<sp<IDrmFactory>> DrmHal::makeDrmFactories() {
    std::vector<sp<IDrmFactory>> factories(DrmUtils::MakeDrmFactories());
    static std::vector<sp<IDrmFactory>> factories(DrmUtils::MakeDrmFactories());
    if (factories.size() == 0) {
        // must be in passthrough mode, load the default passthrough service
        auto passthrough = IDrmFactory::getService();
+21 −8
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@
#include <mediadrm/ICrypto.h>
#include <mediadrm/IDrm.h>

#include <map>
#include <string>

using HServiceManager = ::android::hidl::manager::V1_2::IServiceManager;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
@@ -66,8 +69,8 @@ Hal *MakeObject(status_t *pstatus) {
    return obj;
}

template <typename Hal, typename V>
void MakeHidlFactories(const uint8_t uuid[16], V &factories) {
template <typename Hal, typename V, typename M>
void MakeHidlFactories(const uint8_t uuid[16], V &factories, M& instances) {
    sp<HServiceManager> serviceManager = HServiceManager::getService();
    if (serviceManager == nullptr) {
        LOG2BE("Failed to get service manager");
@@ -78,7 +81,7 @@ void MakeHidlFactories(const uint8_t uuid[16], V &factories) {
        for (const auto &instance : registered) {
            auto factory = Hal::getService(instance);
            if (factory != nullptr) {
                LOG2BI("found %s %s", Hal::descriptor, instance.c_str());
                instances[instance.c_str()] = Hal::descriptor;
                if (!uuid || factory->isCryptoSchemeSupported(uuid)) {
                    factories.push_back(factory);
                }
@@ -87,6 +90,12 @@ void MakeHidlFactories(const uint8_t uuid[16], V &factories) {
    });
}

template <typename Hal, typename V>
void MakeHidlFactories(const uint8_t uuid[16], V &factories) {
    std::map<std::string, std::string> instances;
    MakeHidlFactories<Hal>(uuid, factories, instances);
}

hidl_vec<uint8_t> toHidlVec(const void *ptr, size_t size) {
    hidl_vec<uint8_t> vec(size);
    if (ptr != nullptr) {
@@ -147,11 +156,15 @@ sp<ICrypto> MakeCrypto(status_t *pstatus) {

std::vector<sp<::V1_0::IDrmFactory>> MakeDrmFactories(const uint8_t uuid[16]) {
    std::vector<sp<::V1_0::IDrmFactory>> drmFactories;
    MakeHidlFactories<::V1_0::IDrmFactory>(uuid, drmFactories);
    MakeHidlFactories<::V1_1::IDrmFactory>(uuid, drmFactories);
    MakeHidlFactories<::V1_2::IDrmFactory>(uuid, drmFactories);
    MakeHidlFactories<::V1_3::IDrmFactory>(uuid, drmFactories);
    MakeHidlFactories<::V1_4::IDrmFactory>(uuid, drmFactories);
    std::map<std::string, std::string> instances;
    MakeHidlFactories<::V1_0::IDrmFactory>(uuid, drmFactories, instances);
    MakeHidlFactories<::V1_1::IDrmFactory>(uuid, drmFactories, instances);
    MakeHidlFactories<::V1_2::IDrmFactory>(uuid, drmFactories, instances);
    MakeHidlFactories<::V1_3::IDrmFactory>(uuid, drmFactories, instances);
    MakeHidlFactories<::V1_4::IDrmFactory>(uuid, drmFactories, instances);
    for (auto const& entry : instances) {
        LOG2BI("found instance=%s version=%s", entry.first.c_str(), entry.second.c_str());
    }
    return drmFactories;
}

+101 −0
Original line number Diff line number Diff line
@@ -185,6 +185,23 @@ public:
                .withSetter(ProfileLevelSetter, mSize, mFrameRate, mBitrate)
                .build());

        addParameter(
                DefineParam(mQuantization, C2_PARAMKEY_QUANTIZATION)
                .withDefault(new C2StreamQuantizationInfo::output(0u,
                                      DEFAULT_QP_MAX, DEFAULT_QP_MIN,
                                      DEFAULT_QP_MAX, DEFAULT_QP_MIN,
                                      DEFAULT_QP_MAX, DEFAULT_QP_MIN))
                .withFields({
                        C2F(mQuantization, iMax).inRange(1, 51),
                        C2F(mQuantization, iMin).inRange(1, 51),
                        C2F(mQuantization, pMax).inRange(1, 51),
                        C2F(mQuantization, pMin).inRange(1, 51),
                        C2F(mQuantization, bMax).inRange(1, 51),
                        C2F(mQuantization, bMin).inRange(1, 51),
                 })
                .withSetter(QuantizationSetter)
                .build());

        addParameter(
                DefineParam(mRequestSync, C2_PARAMKEY_REQUEST_SYNC_FRAME)
                .withDefault(new C2StreamRequestSyncFrameTuning::output(0u, C2_FALSE))
@@ -220,6 +237,71 @@ public:
        return res;
    }

    static C2R QuantizationSetter(bool mayBlock, C2P<C2StreamQuantizationInfo::output> &me) {
        (void)mayBlock;
        (void)me;
        C2R res = C2R::Ok();

        ALOGV("QuantizationSetter enters max/min i %d/%d p %d/%d b %d/%d",
              me.v.iMax, me.v.iMin, me.v.pMax, me.v.pMin, me.v.bMax, me.v.bMin);

        // bounds checking
        constexpr int qp_lowest = 1;
        constexpr int qp_highest = 51;

        if (me.v.iMax < qp_lowest) {
            me.set().iMax = qp_lowest;
        } else if (me.v.iMax > qp_highest) {
            me.set().iMax = qp_highest;
        }

        if (me.v.iMin < qp_lowest) {
            me.set().iMin = qp_lowest;
        } else if (me.v.iMin > qp_highest) {
            me.set().iMin = qp_highest;
        }

        if (me.v.pMax < qp_lowest) {
            me.set().pMax = qp_lowest;
        } else if (me.v.pMax > qp_highest) {
            me.set().pMax = qp_highest;
        }

        if (me.v.pMin < qp_lowest) {
            me.set().pMin = qp_lowest;
        } else if (me.v.pMin > qp_highest) {
            me.set().pMin = qp_highest;
        }

        if (me.v.bMax < qp_lowest) {
            me.set().bMax = qp_lowest;
        } else if (me.v.bMax > qp_highest) {
            me.set().bMax = qp_highest;
        }

        if (me.v.bMin < qp_lowest) {
            me.set().bMin = qp_lowest;
        } else if (me.v.bMin > qp_highest) {
            me.set().bMin = qp_highest;
        }

        // consistency checking, e.g. min<max
        //
        if (me.v.iMax < me.v.iMin) {
            me.set().iMax = me.v.iMin;
        }
        if (me.v.pMax < me.v.pMin) {
            me.set().pMax = me.v.pMin;
        }
        if (me.v.bMax < me.v.bMin) {
            me.set().bMax = me.v.bMin;
        }

        // TODO: enforce any sort of i_max < p_max < b_max?

        return res;
    }

    static C2R SizeSetter(bool mayBlock, const C2P<C2StreamPictureSizeInfo::input> &oldMe,
                          C2P<C2StreamPictureSizeInfo::input> &me) {
        (void)mayBlock;
@@ -393,6 +475,7 @@ public:
    std::shared_ptr<C2StreamBitrateInfo::output> getBitrate_l() const { return mBitrate; }
    std::shared_ptr<C2StreamRequestSyncFrameTuning::output> getRequestSync_l() const { return mRequestSync; }
    std::shared_ptr<C2StreamGopTuning::output> getGop_l() const { return mGop; }
    std::shared_ptr<C2StreamQuantizationInfo::output> getQuantization_l() const { return mQuantization; }

private:
    std::shared_ptr<C2StreamUsageTuning::input> mUsage;
@@ -404,6 +487,7 @@ private:
    std::shared_ptr<C2StreamProfileLevelInfo::output> mProfileLevel;
    std::shared_ptr<C2StreamSyncFrameIntervalTuning::output> mSyncFramePeriod;
    std::shared_ptr<C2StreamGopTuning::output> mGop;
    std::shared_ptr<C2StreamQuantizationInfo::output> mQuantization;
};

#define ive_api_function  ih264e_api_function
@@ -664,6 +748,7 @@ c2_status_t C2SoftAvcEnc::setQp() {
    ive_ctl_set_qp_op_t s_qp_op;
    IV_STATUS_T status;

    // set the defaults
    s_qp_ip.e_cmd = IVE_CMD_VIDEO_CTL;
    s_qp_ip.e_sub_cmd = IVE_CMD_CTL_SET_QP;

@@ -679,6 +764,21 @@ c2_status_t C2SoftAvcEnc::setQp() {
    s_qp_ip.u4_b_qp_max = DEFAULT_QP_MAX;
    s_qp_ip.u4_b_qp_min = DEFAULT_QP_MIN;

    // parameter parsing ensured proper range 1..51, so only worry about ordering
    bool valid = true;
    if (mQuantization->iMax < mQuantization->iMin) valid = false;
    if (mQuantization->pMax < mQuantization->pMin) valid = false;
    if (mQuantization->bMax < mQuantization->bMin) valid = false;

    if (valid) {
        s_qp_ip.u4_i_qp_max = mQuantization->iMax;
        s_qp_ip.u4_i_qp_min = mQuantization->iMin;
        s_qp_ip.u4_p_qp_max = mQuantization->pMax;
        s_qp_ip.u4_p_qp_min = mQuantization->pMin;
        s_qp_ip.u4_b_qp_max = mQuantization->bMax;
        s_qp_ip.u4_b_qp_min = mQuantization->bMin;
    }

    s_qp_ip.u4_timestamp_high = -1;
    s_qp_ip.u4_timestamp_low = -1;

@@ -926,6 +1026,7 @@ c2_status_t C2SoftAvcEnc::initEncoder() {
        mIInterval = mIntf->getSyncFramePeriod_l();
        mIDRInterval = mIntf->getSyncFramePeriod_l();
        gop = mIntf->getGop_l();
        mQuantization = mIntf->getQuantization_l();
    }
    if (gop && gop->flexCount() > 0) {
        uint32_t syncInterval = 1;
+1 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ private:
    std::shared_ptr<C2StreamFrameRateInfo::output> mFrameRate;
    std::shared_ptr<C2StreamBitrateInfo::output> mBitrate;
    std::shared_ptr<C2StreamRequestSyncFrameTuning::output> mRequestSync;
    std::shared_ptr<C2StreamQuantizationInfo::output> mQuantization;

    uint32_t mOutBufferSize;
    UWORD32 mHeaderGenerated;
+6 −0
Original line number Diff line number Diff line
// mappings for frameworks/av/media/codec2/components/mpeg4_h263
{
  "presubmit": [
    { "name": "C2SoftMpeg4DecTest" }
  ]
}
Loading