1 /* 2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10 */ 11 12 #ifndef AOM_AV1_COMMON_FRAME_BUFFERS_H_ 13 #define AOM_AV1_COMMON_FRAME_BUFFERS_H_ 14 15 #include "aom/aom_frame_buffer.h" 16 #include "aom/aom_integer.h" 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 typedef struct InternalFrameBuffer { 23 uint8_t *data; 24 size_t size; 25 int in_use; 26 } InternalFrameBuffer; 27 28 typedef struct InternalFrameBufferList { 29 int num_internal_frame_buffers; 30 InternalFrameBuffer *int_fb; 31 } InternalFrameBufferList; 32 33 // Initializes |list|. Returns 0 on success. 34 int av1_alloc_internal_frame_buffers(InternalFrameBufferList *list); 35 36 // Free any data allocated to the frame buffers. 37 void av1_free_internal_frame_buffers(InternalFrameBufferList *list); 38 39 // Zeros all unused internal frame buffers. In particular, this zeros the 40 // frame borders. Call this function after a sequence header change to 41 // re-initialize the frame borders for the different width, height, or bit 42 // depth. 43 void av1_zero_unused_internal_frame_buffers(InternalFrameBufferList *list); 44 45 // Callback used by libaom to request an external frame buffer. |cb_priv| 46 // Callback private data, which points to an InternalFrameBufferList. 47 // |min_size| is the minimum size in bytes needed to decode the next frame. 48 // |fb| pointer to the frame buffer. 49 int av1_get_frame_buffer(void *cb_priv, size_t min_size, 50 aom_codec_frame_buffer_t *fb); 51 52 // Callback used by libaom when there are no references to the frame buffer. 53 // |cb_priv| is not used. |fb| pointer to the frame buffer. 54 int av1_release_frame_buffer(void *cb_priv, aom_codec_frame_buffer_t *fb); 55 56 #ifdef __cplusplus 57 } // extern "C" 58 #endif 59 60 #endif // AOM_AV1_COMMON_FRAME_BUFFERS_H_ 61