/* * Copyright 2019 The libgav1 Authors * * 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. */ #ifndef LIBGAV1_SRC_BUFFER_POOL_H_ #define LIBGAV1_SRC_BUFFER_POOL_H_ #include <algorithm> #include <array> #include <cassert> #include <climits> #include <condition_variable> // NOLINT (unapproved c++11 header) #include <cstdint> #include <memory> #include <mutex> // NOLINT (unapproved c++11 header) #include "src/dsp/common.h" #include "src/gav1/decoder_buffer.h" #include "src/gav1/frame_buffer.h" #include "src/internal_frame_buffer_list.h" #include "src/symbol_decoder_context.h" #include "src/utils/compiler_attributes.h" #include "src/utils/constants.h" #include "src/utils/dynamic_buffer.h" #include "src/utils/reference_info.h" #include "src/utils/segmentation.h" #include "src/utils/segmentation_map.h" #include "src/utils/types.h" #include "src/utils/vector.h" #include "src/yuv_buffer.h" namespace libgav1 { class BufferPool; enum FrameState : uint8_t { … }; // A reference-counted frame buffer. Clients should access it via // RefCountedBufferPtr, which manages reference counting transparently. // The alignment requirement is due to the SymbolDecoderContext member // frame_context_. class RefCountedBuffer : public MaxAlignedAllocable { … }; // RefCountedBufferPtr contains a reference to a RefCountedBuffer. // // Note: For simplicity, RefCountedBufferPtr is implemented as a // std::shared_ptr<RefCountedBuffer>. This requires a heap allocation of the // control block for std::shared_ptr. To avoid that heap allocation, we can // add a |ref_count_| field to RefCountedBuffer and implement a custom // RefCountedBufferPtr class. RefCountedBufferPtr; // BufferPool maintains a pool of RefCountedBuffers. class BufferPool { … }; } // namespace libgav1 #endif // LIBGAV1_SRC_BUFFER_POOL_H_