Loading media/codec2/components/aom/C2SoftAomEnc.cpp +20 −3 Original line number Diff line number Diff line Loading @@ -88,6 +88,12 @@ C2SoftAomEnc::IntfImpl::IntfImpl(const std::shared_ptr<C2ReflectorHelper>& helpe .withSetter(BitrateSetter) .build()); addParameter(DefineParam(mComplexity, C2_PARAMKEY_COMPLEXITY) .withDefault(new C2StreamComplexityTuning::output(0u, 0)) .withFields({C2F(mComplexity, value).inRange(0, 5)}) .withSetter(Setter<decltype(*mComplexity)>::NonStrictValueWithNoDeps) .build()); addParameter(DefineParam(mQuality, C2_PARAMKEY_QUALITY) .withDefault(new C2StreamQualityTuning::output(0u, 80)) .withFields({C2F(mQuality, value).inRange(0, 100)}) Loading Loading @@ -306,10 +312,20 @@ static int MapC2QualityToAOMQuality (int c2Quality) { return 15 + 35 * (100 - c2Quality) / 100; } static int MapC2ComplexityToAOMSpeed (int c2Complexity) { int mapping[6] = {10, 9, 8, 7, 6, 6}; if (c2Complexity > 5 || c2Complexity < 0) { ALOGW("Wrong complexity setting. Falling back to speed 10"); return 10; } return mapping[c2Complexity]; } aom_codec_err_t C2SoftAomEnc::setupCodecParameters() { aom_codec_err_t codec_return = AOM_CODEC_OK; codec_return = aom_codec_control(mCodecContext, AOME_SET_CPUUSED, DEFAULT_SPEED); codec_return = aom_codec_control(mCodecContext, AOME_SET_CPUUSED, MapC2ComplexityToAOMSpeed(mComplexity->value)); if (codec_return != AOM_CODEC_OK) goto BailOut; codec_return = aom_codec_control(mCodecContext, AV1E_SET_ROW_MT, 1); Loading Loading @@ -461,6 +477,7 @@ status_t C2SoftAomEnc::initEncoder() { mRequestSync = mIntf->getRequestSync_l(); mColorAspects = mIntf->getCodedColorAspects_l(); mQuality = mIntf->getQuality_l(); mComplexity = mIntf->getComplexity_l(); } Loading @@ -481,9 +498,9 @@ status_t C2SoftAomEnc::initEncoder() { mCodecInterface = aom_codec_av1_cx(); if (!mCodecInterface) goto CleanUp; ALOGD("AOM: initEncoder. BRMode: %u. KF: %u. QP: %u - %u, 10Bit: %d", ALOGD("AOM: initEncoder. BRMode: %u. KF: %u. QP: %u - %u, 10Bit: %d, comlexity %d", (uint32_t)mBitrateControlMode, mIntf->getSyncFramePeriod(), mMinQuantizer, mMaxQuantizer, mIs10Bit); mIntf->getSyncFramePeriod(), mMinQuantizer, mMaxQuantizer, mIs10Bit, mComplexity->value); mCodecConfiguration = new aom_codec_enc_cfg_t; if (!mCodecConfiguration) goto CleanUp; Loading media/codec2/components/aom/C2SoftAomEnc.h +5 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ struct C2SoftAomEnc : public SimpleC2Component { std::shared_ptr<C2StreamFrameRateInfo::output> mFrameRate; std::shared_ptr<C2StreamBitrateInfo::output> mBitrate; std::shared_ptr<C2StreamQualityTuning::output> mQuality; std::shared_ptr<C2StreamComplexityTuning::output> mComplexity; std::shared_ptr<C2StreamBitrateModeTuning::output> mBitrateMode; std::shared_ptr<C2StreamRequestSyncFrameTuning::output> mRequestSync; std::shared_ptr<C2StreamColorAspectsInfo::output> mColorAspects; Loading @@ -129,6 +130,9 @@ class C2SoftAomEnc::IntfImpl : public SimpleInterface<void>::BaseParams { std::shared_ptr<C2StreamFrameRateInfo::output> getFrameRate_l() const { return mFrameRate; } std::shared_ptr<C2StreamBitrateInfo::output> getBitrate_l() const { return mBitrate; } std::shared_ptr<C2StreamQualityTuning::output> getQuality_l() const { return mQuality; } std::shared_ptr<C2StreamComplexityTuning::output> getComplexity_l() const { return mComplexity; } std::shared_ptr<C2StreamBitrateModeTuning::output> getBitrateMode_l() const { return mBitrateMode; } Loading @@ -155,6 +159,7 @@ class C2SoftAomEnc::IntfImpl : public SimpleInterface<void>::BaseParams { std::shared_ptr<C2StreamSyncFrameIntervalTuning::output> mSyncFramePeriod; std::shared_ptr<C2StreamBitrateInfo::output> mBitrate; std::shared_ptr<C2StreamQualityTuning::output> mQuality; std::shared_ptr<C2StreamComplexityTuning::output> mComplexity; std::shared_ptr<C2StreamBitrateModeTuning::output> mBitrateMode; std::shared_ptr<C2StreamProfileLevelInfo::output> mProfileLevel; std::shared_ptr<C2StreamColorAspectsInfo::input> mColorAspects; Loading media/libstagefright/data/media_codecs_sw.xml +1 −0 Original line number Diff line number Diff line Loading @@ -375,6 +375,7 @@ <Limit name="bitrate" range="1-5000000" /> </Variant> <Limit name="quality" range="0-100" default="80" /> <Limit name="complexity" range="0-5" default="0" /> <Feature name="bitrate-modes" value="VBR,CBR,CQ" /> <Attribute name="software-codec" /> </MediaCodec> Loading Loading
media/codec2/components/aom/C2SoftAomEnc.cpp +20 −3 Original line number Diff line number Diff line Loading @@ -88,6 +88,12 @@ C2SoftAomEnc::IntfImpl::IntfImpl(const std::shared_ptr<C2ReflectorHelper>& helpe .withSetter(BitrateSetter) .build()); addParameter(DefineParam(mComplexity, C2_PARAMKEY_COMPLEXITY) .withDefault(new C2StreamComplexityTuning::output(0u, 0)) .withFields({C2F(mComplexity, value).inRange(0, 5)}) .withSetter(Setter<decltype(*mComplexity)>::NonStrictValueWithNoDeps) .build()); addParameter(DefineParam(mQuality, C2_PARAMKEY_QUALITY) .withDefault(new C2StreamQualityTuning::output(0u, 80)) .withFields({C2F(mQuality, value).inRange(0, 100)}) Loading Loading @@ -306,10 +312,20 @@ static int MapC2QualityToAOMQuality (int c2Quality) { return 15 + 35 * (100 - c2Quality) / 100; } static int MapC2ComplexityToAOMSpeed (int c2Complexity) { int mapping[6] = {10, 9, 8, 7, 6, 6}; if (c2Complexity > 5 || c2Complexity < 0) { ALOGW("Wrong complexity setting. Falling back to speed 10"); return 10; } return mapping[c2Complexity]; } aom_codec_err_t C2SoftAomEnc::setupCodecParameters() { aom_codec_err_t codec_return = AOM_CODEC_OK; codec_return = aom_codec_control(mCodecContext, AOME_SET_CPUUSED, DEFAULT_SPEED); codec_return = aom_codec_control(mCodecContext, AOME_SET_CPUUSED, MapC2ComplexityToAOMSpeed(mComplexity->value)); if (codec_return != AOM_CODEC_OK) goto BailOut; codec_return = aom_codec_control(mCodecContext, AV1E_SET_ROW_MT, 1); Loading Loading @@ -461,6 +477,7 @@ status_t C2SoftAomEnc::initEncoder() { mRequestSync = mIntf->getRequestSync_l(); mColorAspects = mIntf->getCodedColorAspects_l(); mQuality = mIntf->getQuality_l(); mComplexity = mIntf->getComplexity_l(); } Loading @@ -481,9 +498,9 @@ status_t C2SoftAomEnc::initEncoder() { mCodecInterface = aom_codec_av1_cx(); if (!mCodecInterface) goto CleanUp; ALOGD("AOM: initEncoder. BRMode: %u. KF: %u. QP: %u - %u, 10Bit: %d", ALOGD("AOM: initEncoder. BRMode: %u. KF: %u. QP: %u - %u, 10Bit: %d, comlexity %d", (uint32_t)mBitrateControlMode, mIntf->getSyncFramePeriod(), mMinQuantizer, mMaxQuantizer, mIs10Bit); mIntf->getSyncFramePeriod(), mMinQuantizer, mMaxQuantizer, mIs10Bit, mComplexity->value); mCodecConfiguration = new aom_codec_enc_cfg_t; if (!mCodecConfiguration) goto CleanUp; Loading
media/codec2/components/aom/C2SoftAomEnc.h +5 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ struct C2SoftAomEnc : public SimpleC2Component { std::shared_ptr<C2StreamFrameRateInfo::output> mFrameRate; std::shared_ptr<C2StreamBitrateInfo::output> mBitrate; std::shared_ptr<C2StreamQualityTuning::output> mQuality; std::shared_ptr<C2StreamComplexityTuning::output> mComplexity; std::shared_ptr<C2StreamBitrateModeTuning::output> mBitrateMode; std::shared_ptr<C2StreamRequestSyncFrameTuning::output> mRequestSync; std::shared_ptr<C2StreamColorAspectsInfo::output> mColorAspects; Loading @@ -129,6 +130,9 @@ class C2SoftAomEnc::IntfImpl : public SimpleInterface<void>::BaseParams { std::shared_ptr<C2StreamFrameRateInfo::output> getFrameRate_l() const { return mFrameRate; } std::shared_ptr<C2StreamBitrateInfo::output> getBitrate_l() const { return mBitrate; } std::shared_ptr<C2StreamQualityTuning::output> getQuality_l() const { return mQuality; } std::shared_ptr<C2StreamComplexityTuning::output> getComplexity_l() const { return mComplexity; } std::shared_ptr<C2StreamBitrateModeTuning::output> getBitrateMode_l() const { return mBitrateMode; } Loading @@ -155,6 +159,7 @@ class C2SoftAomEnc::IntfImpl : public SimpleInterface<void>::BaseParams { std::shared_ptr<C2StreamSyncFrameIntervalTuning::output> mSyncFramePeriod; std::shared_ptr<C2StreamBitrateInfo::output> mBitrate; std::shared_ptr<C2StreamQualityTuning::output> mQuality; std::shared_ptr<C2StreamComplexityTuning::output> mComplexity; std::shared_ptr<C2StreamBitrateModeTuning::output> mBitrateMode; std::shared_ptr<C2StreamProfileLevelInfo::output> mProfileLevel; std::shared_ptr<C2StreamColorAspectsInfo::input> mColorAspects; Loading
media/libstagefright/data/media_codecs_sw.xml +1 −0 Original line number Diff line number Diff line Loading @@ -375,6 +375,7 @@ <Limit name="bitrate" range="1-5000000" /> </Variant> <Limit name="quality" range="0-100" default="80" /> <Limit name="complexity" range="0-5" default="0" /> <Feature name="bitrate-modes" value="VBR,CBR,CQ" /> <Attribute name="software-codec" /> </MediaCodec> Loading