/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "RKSVEP.h" #include "SvepType.h" #include "Buffer.h" #include "BufferQueue.h" #include "NpuWorker.h" #include "GpuWorker.h" #include "AuthorWorker.h" #include #include #include namespace android { // SvepBackend 主要职责为申请中间缓存,调用NPU/GPU实现AIEE class SvepBackend { public: SvepBackend(); ~SvepBackend(); SvepError Init(bool async); int QueueCtxAndRun(const SvepContext &ctx); int QueueCtxAndRunAsync(const SvepContext &ctx, int *outFence); private: std::shared_ptr DequeueSvepBuffer(std::shared_ptr ctx); int QueueSvepBuffer(std::shared_ptr abCtx, const std::shared_ptr buffer); std::shared_ptr DequeueSvepDstBuffer(std::shared_ptr ctx); int QueueSvepDstBuffer(std::shared_ptr abCtx, const std::shared_ptr buffer); int ConvertByRga(const SvepImageInfo &srcBuffer, const SvepImageInfo &dstBuffer); int ConvertByRga2(const SvepImageInfo &srcBuffer, const SvepImageInfo &dstBuffer); int BufferClearByRga(std::shared_ptr ctx); // Bind all thread to Cpux int BindToCpu(); bool mInit_; std::shared_ptr mPtrBufferQueue_; std::shared_ptr mPtrBQ4320p_; std::shared_ptr mSubtitleBuffer_; NpuWorker NpuWorker_; AuthorWorker AuthorWorker_; // BufferClear parameter std::set mBufferClearCacheId_; SvepRect mLastRect_; }; } //namespace android