Loading media/codec2/components/flac/C2SoftFlacEnc.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -73,6 +73,14 @@ public: .withFields({C2F(mBitrate, value).inRange(1, 21000000)}) .withSetter(Setter<decltype(*mBitrate)>::NonStrictValueWithNoDeps) .build()); addParameter( DefineParam(mComplexity, C2_PARAMKEY_COMPLEXITY) .withDefault(new C2StreamComplexityTuning::output(0u, FLAC_COMPRESSION_LEVEL_DEFAULT)) .withFields({C2F(mComplexity, value).inRange( FLAC_COMPRESSION_LEVEL_MIN, FLAC_COMPRESSION_LEVEL_MAX)}) .withSetter(Setter<decltype(*mComplexity)>::NonStrictValueWithNoDeps) .build()); addParameter( DefineParam(mInputMaxBufSize, C2_PARAMKEY_INPUT_MAX_BUFFER_SIZE) .withConstValue(new C2StreamMaxBufferSizeInfo::input(0u, 4608)) Loading @@ -93,12 +101,14 @@ public: uint32_t getSampleRate() const { return mSampleRate->value; } uint32_t getChannelCount() const { return mChannelCount->value; } uint32_t getBitrate() const { return mBitrate->value; } uint32_t getComplexity() const { return mComplexity->value; } int32_t getPcmEncodingInfo() const { return mPcmEncodingInfo->value; } private: std::shared_ptr<C2StreamSampleRateInfo::input> mSampleRate; std::shared_ptr<C2StreamChannelCountInfo::input> mChannelCount; std::shared_ptr<C2StreamBitrateInfo::output> mBitrate; std::shared_ptr<C2StreamComplexityTuning::output> mComplexity; std::shared_ptr<C2StreamMaxBufferSizeInfo::input> mInputMaxBufSize; std::shared_ptr<C2StreamPcmEncodingInfo::input> mPcmEncodingInfo; }; Loading Loading @@ -127,7 +137,6 @@ c2_status_t C2SoftFlacEnc::onInit() { mSignalledError = false; mSignalledOutputEos = false; mCompressionLevel = FLAC_COMPRESSION_LEVEL_DEFAULT; mIsFirstFrame = true; mAnchorTimeStamp = 0ull; mProcessedSamples = 0u; Loading @@ -153,7 +162,6 @@ void C2SoftFlacEnc::onRelease() { } void C2SoftFlacEnc::onReset() { mCompressionLevel = FLAC_COMPRESSION_LEVEL_DEFAULT; (void) onStop(); } Loading Loading @@ -369,7 +377,8 @@ status_t C2SoftFlacEnc::configureEncoder() { ok = ok && FLAC__stream_encoder_set_channels(mFlacStreamEncoder, mIntf->getChannelCount()); ok = ok && FLAC__stream_encoder_set_sample_rate(mFlacStreamEncoder, mIntf->getSampleRate()); ok = ok && FLAC__stream_encoder_set_bits_per_sample(mFlacStreamEncoder, bitsPerSample); ok = ok && FLAC__stream_encoder_set_compression_level(mFlacStreamEncoder, mCompressionLevel); ok = ok && FLAC__stream_encoder_set_compression_level(mFlacStreamEncoder, mIntf->getComplexity()); ok = ok && FLAC__stream_encoder_set_verify(mFlacStreamEncoder, false); if (!ok) { ALOGE("unknown error when configuring encoder"); Loading media/codec2/components/flac/C2SoftFlacEnc.h +0 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,6 @@ private: std::shared_ptr<C2LinearBlock> mOutputBlock; bool mSignalledError; bool mSignalledOutputEos; uint32_t mCompressionLevel; uint32_t mBlockSize; bool mIsFirstFrame; uint64_t mAnchorTimeStamp; Loading Loading
media/codec2/components/flac/C2SoftFlacEnc.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -73,6 +73,14 @@ public: .withFields({C2F(mBitrate, value).inRange(1, 21000000)}) .withSetter(Setter<decltype(*mBitrate)>::NonStrictValueWithNoDeps) .build()); addParameter( DefineParam(mComplexity, C2_PARAMKEY_COMPLEXITY) .withDefault(new C2StreamComplexityTuning::output(0u, FLAC_COMPRESSION_LEVEL_DEFAULT)) .withFields({C2F(mComplexity, value).inRange( FLAC_COMPRESSION_LEVEL_MIN, FLAC_COMPRESSION_LEVEL_MAX)}) .withSetter(Setter<decltype(*mComplexity)>::NonStrictValueWithNoDeps) .build()); addParameter( DefineParam(mInputMaxBufSize, C2_PARAMKEY_INPUT_MAX_BUFFER_SIZE) .withConstValue(new C2StreamMaxBufferSizeInfo::input(0u, 4608)) Loading @@ -93,12 +101,14 @@ public: uint32_t getSampleRate() const { return mSampleRate->value; } uint32_t getChannelCount() const { return mChannelCount->value; } uint32_t getBitrate() const { return mBitrate->value; } uint32_t getComplexity() const { return mComplexity->value; } int32_t getPcmEncodingInfo() const { return mPcmEncodingInfo->value; } private: std::shared_ptr<C2StreamSampleRateInfo::input> mSampleRate; std::shared_ptr<C2StreamChannelCountInfo::input> mChannelCount; std::shared_ptr<C2StreamBitrateInfo::output> mBitrate; std::shared_ptr<C2StreamComplexityTuning::output> mComplexity; std::shared_ptr<C2StreamMaxBufferSizeInfo::input> mInputMaxBufSize; std::shared_ptr<C2StreamPcmEncodingInfo::input> mPcmEncodingInfo; }; Loading Loading @@ -127,7 +137,6 @@ c2_status_t C2SoftFlacEnc::onInit() { mSignalledError = false; mSignalledOutputEos = false; mCompressionLevel = FLAC_COMPRESSION_LEVEL_DEFAULT; mIsFirstFrame = true; mAnchorTimeStamp = 0ull; mProcessedSamples = 0u; Loading @@ -153,7 +162,6 @@ void C2SoftFlacEnc::onRelease() { } void C2SoftFlacEnc::onReset() { mCompressionLevel = FLAC_COMPRESSION_LEVEL_DEFAULT; (void) onStop(); } Loading Loading @@ -369,7 +377,8 @@ status_t C2SoftFlacEnc::configureEncoder() { ok = ok && FLAC__stream_encoder_set_channels(mFlacStreamEncoder, mIntf->getChannelCount()); ok = ok && FLAC__stream_encoder_set_sample_rate(mFlacStreamEncoder, mIntf->getSampleRate()); ok = ok && FLAC__stream_encoder_set_bits_per_sample(mFlacStreamEncoder, bitsPerSample); ok = ok && FLAC__stream_encoder_set_compression_level(mFlacStreamEncoder, mCompressionLevel); ok = ok && FLAC__stream_encoder_set_compression_level(mFlacStreamEncoder, mIntf->getComplexity()); ok = ok && FLAC__stream_encoder_set_verify(mFlacStreamEncoder, false); if (!ok) { ALOGE("unknown error when configuring encoder"); Loading
media/codec2/components/flac/C2SoftFlacEnc.h +0 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,6 @@ private: std::shared_ptr<C2LinearBlock> mOutputBlock; bool mSignalledError; bool mSignalledOutputEos; uint32_t mCompressionLevel; uint32_t mBlockSize; bool mIsFirstFrame; uint64_t mAnchorTimeStamp; Loading