vpxdec: parallel execution of 10bit format conversion
Bug: 132046952
Test: manual
Change-Id: I210bbfb0de63200c1355fb7d6e4bc7b3cbdc4d0b
diff --git a/media/codec2/components/vpx/C2SoftVpxDec.h b/media/codec2/components/vpx/C2SoftVpxDec.h
index 60c8484..e51bcee 100644
--- a/media/codec2/components/vpx/C2SoftVpxDec.h
+++ b/media/codec2/components/vpx/C2SoftVpxDec.h
@@ -50,6 +50,19 @@
MODE_VP9,
} mMode;
+ struct ConversionQueue;
+
+ class ConverterThread : public Thread {
+ public:
+ explicit ConverterThread(
+ const std::shared_ptr<Mutexed<ConversionQueue>> &queue);
+ ~ConverterThread() override = default;
+ bool threadLoop() override;
+
+ private:
+ std::shared_ptr<Mutexed<ConversionQueue>> mQueue;
+ };
+
std::shared_ptr<IntfImpl> mIntf;
vpx_codec_ctx_t *mCodecCtx;
bool mFrameParallelMode; // Frame parallel is only supported by VP9 decoder.
@@ -59,6 +72,15 @@
bool mSignalledOutputEos;
bool mSignalledError;
+ int mCoreCount;
+ struct ConversionQueue {
+ std::list<std::function<void()>> entries;
+ Condition cond;
+ size_t numPending{0u};
+ };
+ std::shared_ptr<Mutexed<ConversionQueue>> mQueue;
+ std::vector<sp<ConverterThread>> mConverterThreads;
+
status_t initDecoder();
status_t destroyDecoder();
void finishWork(uint64_t index, const std::unique_ptr<C2Work> &work,