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

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

Snap for 6224475 from d294ed9a to rvc-release

Change-Id: Ic90e78180831b77d1071b896dfec2c4d9d5d01e4
parents ebdd98e8 d294ed9a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -50,6 +50,15 @@ CameraMetadata::CameraMetadata(const CameraMetadata &other) :
    mBuffer = clone_camera_metadata(other.mBuffer);
}

CameraMetadata::CameraMetadata(CameraMetadata &&other) :mBuffer(NULL),  mLocked(false) {
    acquire(other);
}

CameraMetadata &CameraMetadata::operator=(CameraMetadata &&other) {
    acquire(other);
    return *this;
}

CameraMetadata::CameraMetadata(camera_metadata_t *buffer) :
        mBuffer(NULL), mLocked(false) {
    acquire(buffer);
+6 −0
Original line number Diff line number Diff line
@@ -117,6 +117,12 @@ CaptureResult::CaptureResult() :
        mMetadata(), mResultExtras() {
}

CaptureResult::CaptureResult(CaptureResult &&otherResult) {
    mMetadata = std::move(otherResult.mMetadata);
    mResultExtras = otherResult.mResultExtras;
    mPhysicalMetadatas = std::move(otherResult.mPhysicalMetadatas);
}

CaptureResult::CaptureResult(const CaptureResult &otherResult) {
    mResultExtras = otherResult.mResultExtras;
    mMetadata = otherResult.mMetadata;
+10 −0
Original line number Diff line number Diff line
@@ -40,6 +40,11 @@ class CameraMetadata: public Parcelable {
     * dataCapacity extra storage */
    CameraMetadata(size_t entryCapacity, size_t dataCapacity = 10);

    /**
     * Move constructor, acquires other's metadata buffer
     */
    CameraMetadata(CameraMetadata &&other);

    ~CameraMetadata();

    /** Takes ownership of passed-in buffer */
@@ -53,6 +58,11 @@ class CameraMetadata: public Parcelable {
    CameraMetadata &operator=(const CameraMetadata &other);
    CameraMetadata &operator=(const camera_metadata_t *buffer);

    /**
     * Move assignment operator, acquires other's metadata buffer
     */
    CameraMetadata &operator=(CameraMetadata &&other);

    /**
     * Get reference to the underlying metadata buffer. Ownership remains with
     * the CameraMetadata object, but non-const CameraMetadata methods will not
+2 −0
Original line number Diff line number Diff line
@@ -135,6 +135,8 @@ struct CaptureResult : public virtual LightRefBase<CaptureResult> {

    CaptureResult(const CaptureResult& otherResult);

    CaptureResult(CaptureResult &&captureResult);

    status_t                readFromParcel(android::Parcel* parcel);
    status_t                writeToParcel(android::Parcel* parcel) const;
};
+85 −1
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@
#define DRC_DEFAULT_MOBILE_DRC_BOOST 1.0 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_HEAVY C2Config::DRC_COMPRESSION_HEAVY   /* switch for heavy compression for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_EFFECT 3  /* MPEG-D DRC effect type; 3 => Limited playback range */
#define DRC_DEFAULT_MOBILE_DRC_ALBUM  0  /* MPEG-D DRC album mode; 0 => album mode is disabled, 1 => album mode is enabled */
#define DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS (0.25) /* decoder output loudness; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define DRC_DEFAULT_MOBILE_ENC_LEVEL (0.25) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define MAX_CHANNEL_COUNT            8  /* maximum number of audio channels that can be decoded */
// names of properties that can be used to override the default DRC settings
@@ -190,6 +192,24 @@ public:
                })
                .withSetter(Setter<decltype(*mDrcEffectType)>::StrictValueWithNoDeps)
                .build());

        addParameter(
                DefineParam(mDrcAlbumMode, C2_PARAMKEY_DRC_ALBUM_MODE)
                .withDefault(new C2StreamDrcAlbumModeTuning::input(0u, C2Config::DRC_ALBUM_MODE_OFF))
                .withFields({
                    C2F(mDrcAlbumMode, value).oneOf({
                            C2Config::DRC_ALBUM_MODE_OFF,
                            C2Config::DRC_ALBUM_MODE_ON})
                })
                .withSetter(Setter<decltype(*mDrcAlbumMode)>::StrictValueWithNoDeps)
                .build());

        addParameter(
                DefineParam(mDrcOutputLoudness, C2_PARAMKEY_DRC_OUTPUT_LOUDNESS)
                .withDefault(new C2StreamDrcOutputLoudnessTuning::output(0u, DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS))
                .withFields({C2F(mDrcOutputLoudness, value).inRange(-57.75, 0.25)})
                .withSetter(Setter<decltype(*mDrcOutputLoudness)>::StrictValueWithNoDeps)
                .build());
    }

    bool isAdts() const { return mAacFormat->value == C2Config::AAC_PACKAGING_ADTS; }
@@ -204,6 +224,8 @@ public:
    int32_t getDrcBoostFactor() const { return mDrcBoostFactor->value * 127. + 0.5; }
    int32_t getDrcAttenuationFactor() const { return mDrcAttenuationFactor->value * 127. + 0.5; }
    int32_t getDrcEffectType() const { return mDrcEffectType->value; }
    int32_t getDrcAlbumMode() const { return mDrcAlbumMode->value; }
    int32_t getDrcOutputLoudness() const { return (mDrcOutputLoudness->value <= 0 ? -mDrcOutputLoudness->value * 4. + 0.5 : -1); }

private:
    std::shared_ptr<C2StreamSampleRateInfo::output> mSampleRate;
@@ -218,6 +240,8 @@ private:
    std::shared_ptr<C2StreamDrcBoostFactorTuning::input> mDrcBoostFactor;
    std::shared_ptr<C2StreamDrcAttenuationFactorTuning::input> mDrcAttenuationFactor;
    std::shared_ptr<C2StreamDrcEffectTypeTuning::input> mDrcEffectType;
    std::shared_ptr<C2StreamDrcAlbumModeTuning::input> mDrcAlbumMode;
    std::shared_ptr<C2StreamDrcOutputLoudnessTuning::output> mDrcOutputLoudness;
    // TODO Add : C2StreamAacSbrModeTuning
};

@@ -324,7 +348,7 @@ status_t C2SoftAacDec::initDecoder() {

    //  DRC_PRES_MODE_WRAP_DESIRED_HEAVY
    int32_t compressMode = mIntf->getDrcCompressMode();
    ALOGV("AAC decoder using desried DRC heavy compression switch of %d", compressMode);
    ALOGV("AAC decoder using desired DRC heavy compression switch of %d", compressMode);
    mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_HEAVY, (unsigned)compressMode);

    // DRC_PRES_MODE_WRAP_ENCODER_TARGET
@@ -337,6 +361,11 @@ status_t C2SoftAacDec::initDecoder() {
    ALOGV("AAC decoder using MPEG-D DRC effect type %d", effectType);
    aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, effectType);

    // AAC_UNIDRC_ALBUM_MODE
    int32_t albumMode = mIntf->getDrcAlbumMode();
    ALOGV("AAC decoder using MPEG-D DRC album mode %d", albumMode);
    aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);

    // By default, the decoder creates a 5.1 channel downmix signal.
    // For seven and eight channel input streams, enable 6.1 and 7.1 channel output
    aacDecoder_SetParam(mAACDecoder, AAC_PCM_MAX_OUTPUT_CHANNELS, -1);
@@ -632,6 +661,7 @@ void C2SoftAacDec::process(

        INT prevSampleRate = mStreamInfo->sampleRate;
        INT prevNumChannels = mStreamInfo->numChannels;
        INT prevOutLoudness = mStreamInfo->outputLoudness;

        aacDecoder_Fill(mAACDecoder,
                        inBuffer,
@@ -640,6 +670,43 @@ void C2SoftAacDec::process(

        // run DRC check
        mDrcWrap.submitStreamData(mStreamInfo);

        // apply runtime updates
        //  DRC_PRES_MODE_WRAP_DESIRED_TARGET
        int32_t targetRefLevel = mIntf->getDrcTargetRefLevel();
        ALOGV("AAC decoder using desired DRC target reference level of %d", targetRefLevel);
        mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_TARGET, (unsigned)targetRefLevel);

        //  DRC_PRES_MODE_WRAP_DESIRED_ATT_FACTOR
        int32_t attenuationFactor = mIntf->getDrcAttenuationFactor();
        ALOGV("AAC decoder using desired DRC attenuation factor of %d", attenuationFactor);
        mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_ATT_FACTOR, (unsigned)attenuationFactor);

        //  DRC_PRES_MODE_WRAP_DESIRED_BOOST_FACTOR
        int32_t boostFactor = mIntf->getDrcBoostFactor();
        ALOGV("AAC decoder using desired DRC boost factor of %d", boostFactor);
        mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_BOOST_FACTOR, (unsigned)boostFactor);

        //  DRC_PRES_MODE_WRAP_DESIRED_HEAVY
        int32_t compressMode = mIntf->getDrcCompressMode();
        ALOGV("AAC decoder using desried DRC heavy compression switch of %d", compressMode);
        mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_HEAVY, (unsigned)compressMode);

        // DRC_PRES_MODE_WRAP_ENCODER_TARGET
        int32_t encTargetLevel = mIntf->getDrcEncTargetLevel();
        ALOGV("AAC decoder using encoder-side DRC reference level of %d", encTargetLevel);
        mDrcWrap.setParam(DRC_PRES_MODE_WRAP_ENCODER_TARGET, (unsigned)encTargetLevel);

        // AAC_UNIDRC_SET_EFFECT
        int32_t effectType = mIntf->getDrcEffectType();
        ALOGV("AAC decoder using MPEG-D DRC effect type %d", effectType);
        aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, effectType);

        // AAC_UNIDRC_ALBUM_MODE
        int32_t albumMode = mIntf->getDrcAlbumMode();
        ALOGV("AAC decoder using MPEG-D DRC album mode %d", albumMode);
        aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);

        mDrcWrap.update();

        UINT inBufferUsedLength = inBufferLength[0] - bytesValid[0];
@@ -763,6 +830,23 @@ void C2SoftAacDec::process(
                }
            }
            ALOGV("size = %zu", size);

            if (mStreamInfo->outputLoudness != prevOutLoudness) {
                C2StreamDrcOutputLoudnessTuning::output
                        drcOutLoudness(0u, (float) (mStreamInfo->outputLoudness*-0.25));

                std::vector<std::unique_ptr<C2SettingResult>> failures;
                c2_status_t err = mIntf->config(
                                    { &drcOutLoudness },
                                    C2_MAY_BLOCK,
                                    &failures);
                if (err == OK) {
                    work->worklets.front()->output.configUpdate.push_back(
                        C2Param::Copy(drcOutLoudness));
                } else {
                    ALOGE("Getting output loudness failed");
                }
            }
        } while (decoderErr == AAC_DEC_OK);
    }

Loading