xref: /aosp_15_r20/external/libaom/av1/common/alloccommon.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
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_ALLOCCOMMON_H_
13 #define AOM_AV1_COMMON_ALLOCCOMMON_H_
14 
15 #define INVALID_IDX -1  // Invalid buffer index.
16 
17 #include <stdbool.h>
18 
19 #include "config/aom_config.h"
20 
21 #include "av1/common/enums.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 struct AV1Common;
28 struct BufferPool;
29 struct CommonContexts;
30 struct CommonModeInfoParams;
31 struct AV1CdefWorker;
32 struct AV1CdefSyncData;
33 
34 void av1_remove_common(struct AV1Common *cm);
35 
36 int av1_alloc_above_context_buffers(struct CommonContexts *above_contexts,
37                                     int num_tile_rows, int num_mi_cols,
38                                     int num_planes);
39 void av1_free_above_context_buffers(struct CommonContexts *above_contexts);
40 int av1_alloc_context_buffers(struct AV1Common *cm, int width, int height,
41                               BLOCK_SIZE min_partition_size);
42 void av1_init_mi_buffers(struct CommonModeInfoParams *mi_params);
43 void av1_free_context_buffers(struct AV1Common *cm);
44 
45 void av1_free_ref_frame_buffers(struct BufferPool *pool);
46 void av1_alloc_cdef_buffers(struct AV1Common *const cm,
47                             struct AV1CdefWorker **cdef_worker,
48                             struct AV1CdefSyncData *cdef_sync, int num_workers,
49                             int init_worker);
50 void av1_free_cdef_buffers(struct AV1Common *const cm,
51                            struct AV1CdefWorker **cdef_worker,
52                            struct AV1CdefSyncData *cdef_sync);
53 #if !CONFIG_REALTIME_ONLY || CONFIG_AV1_DECODER
54 void av1_alloc_restoration_buffers(struct AV1Common *cm, bool is_sgr_enabled);
55 void av1_free_restoration_buffers(struct AV1Common *cm);
56 #endif  // !CONFIG_REALTIME_ONLY || CONFIG_AV1_DECODER
57 
58 int av1_alloc_state_buffers(struct AV1Common *cm, int width, int height);
59 void av1_free_state_buffers(struct AV1Common *cm);
60 
61 int av1_get_MBs(int width, int height);
62 
63 #ifdef __cplusplus
64 }  // extern "C"
65 #endif
66 
67 #endif  // AOM_AV1_COMMON_ALLOCCOMMON_H_
68