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

Commit fa8df28d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "C2SoftAomEnc: Configure level in the encoder" into main am: f8978deb

parents 154b0bc8 f8978deb
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -107,7 +107,7 @@ C2SoftAomEnc::IntfImpl::IntfImpl(const std::shared_ptr<C2ReflectorHelper>& helpe


    addParameter(DefineParam(mProfileLevel, C2_PARAMKEY_PROFILE_LEVEL)
    addParameter(DefineParam(mProfileLevel, C2_PARAMKEY_PROFILE_LEVEL)
                         .withDefault(new C2StreamProfileLevelInfo::output(0u, PROFILE_AV1_0,
                         .withDefault(new C2StreamProfileLevelInfo::output(0u, PROFILE_AV1_0,
                                                                           LEVEL_AV1_4_1))
                                                                           LEVEL_AV1_2))
                         .withFields({
                         .withFields({
                                 C2F(mProfileLevel, profile).equalTo(PROFILE_AV1_0),
                                 C2F(mProfileLevel, profile).equalTo(PROFILE_AV1_0),
                                 C2F(mProfileLevel, level)
                                 C2F(mProfileLevel, level)
@@ -305,6 +305,10 @@ C2R C2SoftAomEnc::IntfImpl::CodedColorAspectsSetter(
    return C2R::Ok();
    return C2R::Ok();
}
}


uint32_t C2SoftAomEnc::IntfImpl::getLevel_l() const {
        return mProfileLevel->level - LEVEL_AV1_2;
}

C2SoftAomEnc::C2SoftAomEnc(const char* name, c2_node_id_t id,
C2SoftAomEnc::C2SoftAomEnc(const char* name, c2_node_id_t id,
                           const std::shared_ptr<IntfImpl>& intfImpl)
                           const std::shared_ptr<IntfImpl>& intfImpl)
    : SimpleC2Component(std::make_shared<SimpleInterface<IntfImpl>>(name, id, intfImpl)),
    : SimpleC2Component(std::make_shared<SimpleInterface<IntfImpl>>(name, id, intfImpl)),
@@ -381,6 +385,9 @@ static int MapC2ComplexityToAOMSpeed (int c2Complexity) {
aom_codec_err_t C2SoftAomEnc::setupCodecParameters() {
aom_codec_err_t C2SoftAomEnc::setupCodecParameters() {
    aom_codec_err_t codec_return = AOM_CODEC_OK;
    aom_codec_err_t codec_return = AOM_CODEC_OK;


    codec_return = aom_codec_control(mCodecContext, AV1E_SET_TARGET_SEQ_LEVEL_IDX, mAV1EncLevel);
    if (codec_return != AOM_CODEC_OK) goto BailOut;

    codec_return = aom_codec_control(mCodecContext, AOME_SET_CPUUSED,
    codec_return = aom_codec_control(mCodecContext, AOME_SET_CPUUSED,
                                     MapC2ComplexityToAOMSpeed(mComplexity->value));
                                     MapC2ComplexityToAOMSpeed(mComplexity->value));
    if (codec_return != AOM_CODEC_OK) goto BailOut;
    if (codec_return != AOM_CODEC_OK) goto BailOut;
@@ -535,6 +542,7 @@ status_t C2SoftAomEnc::initEncoder() {
        mColorAspects = mIntf->getCodedColorAspects_l();
        mColorAspects = mIntf->getCodedColorAspects_l();
        mQuality = mIntf->getQuality_l();
        mQuality = mIntf->getQuality_l();
        mComplexity = mIntf->getComplexity_l();
        mComplexity = mIntf->getComplexity_l();
        mAV1EncLevel = mIntf->getLevel_l();
    }
    }




+3 −0
Original line number Original line Diff line number Diff line
@@ -98,6 +98,8 @@ struct C2SoftAomEnc : public SimpleC2Component {


    bool mIs10Bit;
    bool mIs10Bit;


    uint32_t mAV1EncLevel;

    std::shared_ptr<C2StreamPictureSizeInfo::input> mSize;
    std::shared_ptr<C2StreamPictureSizeInfo::input> mSize;
    std::shared_ptr<C2StreamIntraRefreshTuning::output> mIntraRefresh;
    std::shared_ptr<C2StreamIntraRefreshTuning::output> mIntraRefresh;
    std::shared_ptr<C2StreamFrameRateInfo::output> mFrameRate;
    std::shared_ptr<C2StreamFrameRateInfo::output> mFrameRate;
@@ -152,6 +154,7 @@ class C2SoftAomEnc::IntfImpl : public SimpleInterface<void>::BaseParams {
    static C2R ColorAspectsSetter(bool mayBlock, C2P<C2StreamColorAspectsInfo::input>& me);
    static C2R ColorAspectsSetter(bool mayBlock, C2P<C2StreamColorAspectsInfo::input>& me);
    static C2R CodedColorAspectsSetter(bool mayBlock, C2P<C2StreamColorAspectsInfo::output>& me,
    static C2R CodedColorAspectsSetter(bool mayBlock, C2P<C2StreamColorAspectsInfo::output>& me,
                                       const C2P<C2StreamColorAspectsInfo::input>& coded);
                                       const C2P<C2StreamColorAspectsInfo::input>& coded);
    uint32_t getLevel_l() const;


  private:
  private:
    std::shared_ptr<C2StreamUsageTuning::input> mUsage;
    std::shared_ptr<C2StreamUsageTuning::input> mUsage;