Vignesh Venkatasubramanian | 46e0639 | 2019-06-10 15:11:58 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_C2_SOFT_GAV1_DEC_H_ |
| 18 | #define ANDROID_C2_SOFT_GAV1_DEC_H_ |
| 19 | |
| 20 | #include <SimpleC2Component.h> |
| 21 | |
| 22 | namespace android { |
| 23 | |
| 24 | struct C2SoftGav1Dec : public SimpleC2Component { |
| 25 | class IntfImpl; |
| 26 | |
| 27 | C2SoftGav1Dec(const char* name, c2_node_id_t id, |
| 28 | const std::shared_ptr<IntfImpl>& intfImpl); |
| 29 | |
| 30 | // Begin SimpleC2Component overrides. |
| 31 | c2_status_t onInit() override; |
| 32 | c2_status_t onStop() override; |
| 33 | void onReset() override; |
| 34 | void onRelease() override; |
| 35 | c2_status_t onFlush_sm() override; |
| 36 | void process(const std::unique_ptr<C2Work>& work, |
| 37 | const std::shared_ptr<C2BlockPool>& pool) override; |
| 38 | c2_status_t drain(uint32_t drainMode, |
| 39 | const std::shared_ptr<C2BlockPool>& pool) override; |
| 40 | // End SimpleC2Component overrides. |
| 41 | |
| 42 | private: |
| 43 | std::shared_ptr<IntfImpl> mIntf; |
| 44 | |
| 45 | uint32_t mWidth; |
| 46 | uint32_t mHeight; |
| 47 | bool mSignalledOutputEos; |
| 48 | bool mSignalledError; |
| 49 | |
| 50 | struct timeval mTimeStart; // Time at the start of decode() |
| 51 | struct timeval mTimeEnd; // Time at the end of decode() |
| 52 | |
| 53 | bool initDecoder(); |
| 54 | void destroyDecoder(); |
| 55 | void finishWork(uint64_t index, const std::unique_ptr<C2Work>& work, |
| 56 | const std::shared_ptr<C2GraphicBlock>& block); |
| 57 | bool outputBuffer(const std::shared_ptr<C2BlockPool>& pool, |
| 58 | const std::unique_ptr<C2Work>& work); |
| 59 | c2_status_t drainInternal(uint32_t drainMode, |
| 60 | const std::shared_ptr<C2BlockPool>& pool, |
| 61 | const std::unique_ptr<C2Work>& work); |
| 62 | |
| 63 | C2_DO_NOT_COPY(C2SoftGav1Dec); |
| 64 | }; |
| 65 | |
| 66 | } // namespace android |
| 67 | |
| 68 | #endif // ANDROID_C2_SOFT_GAV1_DEC_H_ |