xref: /aosp_15_r20/external/libaom/av1/common/alloccommon.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker  * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3*77c1e3ccSAndroid Build Coastguard Worker  *
4*77c1e3ccSAndroid Build Coastguard Worker  * This source code is subject to the terms of the BSD 2 Clause License and
5*77c1e3ccSAndroid Build Coastguard Worker  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6*77c1e3ccSAndroid Build Coastguard Worker  * was not distributed with this source code in the LICENSE file, you can
7*77c1e3ccSAndroid Build Coastguard Worker  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8*77c1e3ccSAndroid Build Coastguard Worker  * Media Patent License 1.0 was not distributed with this source code in the
9*77c1e3ccSAndroid Build Coastguard Worker  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10*77c1e3ccSAndroid Build Coastguard Worker  */
11*77c1e3ccSAndroid Build Coastguard Worker 
12*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_AV1_COMMON_ALLOCCOMMON_H_
13*77c1e3ccSAndroid Build Coastguard Worker #define AOM_AV1_COMMON_ALLOCCOMMON_H_
14*77c1e3ccSAndroid Build Coastguard Worker 
15*77c1e3ccSAndroid Build Coastguard Worker #define INVALID_IDX -1  // Invalid buffer index.
16*77c1e3ccSAndroid Build Coastguard Worker 
17*77c1e3ccSAndroid Build Coastguard Worker #include <stdbool.h>
18*77c1e3ccSAndroid Build Coastguard Worker 
19*77c1e3ccSAndroid Build Coastguard Worker #include "config/aom_config.h"
20*77c1e3ccSAndroid Build Coastguard Worker 
21*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/enums.h"
22*77c1e3ccSAndroid Build Coastguard Worker 
23*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus
24*77c1e3ccSAndroid Build Coastguard Worker extern "C" {
25*77c1e3ccSAndroid Build Coastguard Worker #endif
26*77c1e3ccSAndroid Build Coastguard Worker 
27*77c1e3ccSAndroid Build Coastguard Worker struct AV1Common;
28*77c1e3ccSAndroid Build Coastguard Worker struct BufferPool;
29*77c1e3ccSAndroid Build Coastguard Worker struct CommonContexts;
30*77c1e3ccSAndroid Build Coastguard Worker struct CommonModeInfoParams;
31*77c1e3ccSAndroid Build Coastguard Worker struct AV1CdefWorker;
32*77c1e3ccSAndroid Build Coastguard Worker struct AV1CdefSyncData;
33*77c1e3ccSAndroid Build Coastguard Worker 
34*77c1e3ccSAndroid Build Coastguard Worker void av1_remove_common(struct AV1Common *cm);
35*77c1e3ccSAndroid Build Coastguard Worker 
36*77c1e3ccSAndroid Build Coastguard Worker int av1_alloc_above_context_buffers(struct CommonContexts *above_contexts,
37*77c1e3ccSAndroid Build Coastguard Worker                                     int num_tile_rows, int num_mi_cols,
38*77c1e3ccSAndroid Build Coastguard Worker                                     int num_planes);
39*77c1e3ccSAndroid Build Coastguard Worker void av1_free_above_context_buffers(struct CommonContexts *above_contexts);
40*77c1e3ccSAndroid Build Coastguard Worker int av1_alloc_context_buffers(struct AV1Common *cm, int width, int height,
41*77c1e3ccSAndroid Build Coastguard Worker                               BLOCK_SIZE min_partition_size);
42*77c1e3ccSAndroid Build Coastguard Worker void av1_init_mi_buffers(struct CommonModeInfoParams *mi_params);
43*77c1e3ccSAndroid Build Coastguard Worker void av1_free_context_buffers(struct AV1Common *cm);
44*77c1e3ccSAndroid Build Coastguard Worker 
45*77c1e3ccSAndroid Build Coastguard Worker void av1_free_ref_frame_buffers(struct BufferPool *pool);
46*77c1e3ccSAndroid Build Coastguard Worker void av1_alloc_cdef_buffers(struct AV1Common *const cm,
47*77c1e3ccSAndroid Build Coastguard Worker                             struct AV1CdefWorker **cdef_worker,
48*77c1e3ccSAndroid Build Coastguard Worker                             struct AV1CdefSyncData *cdef_sync, int num_workers,
49*77c1e3ccSAndroid Build Coastguard Worker                             int init_worker);
50*77c1e3ccSAndroid Build Coastguard Worker void av1_free_cdef_buffers(struct AV1Common *const cm,
51*77c1e3ccSAndroid Build Coastguard Worker                            struct AV1CdefWorker **cdef_worker,
52*77c1e3ccSAndroid Build Coastguard Worker                            struct AV1CdefSyncData *cdef_sync);
53*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY || CONFIG_AV1_DECODER
54*77c1e3ccSAndroid Build Coastguard Worker void av1_alloc_restoration_buffers(struct AV1Common *cm, bool is_sgr_enabled);
55*77c1e3ccSAndroid Build Coastguard Worker void av1_free_restoration_buffers(struct AV1Common *cm);
56*77c1e3ccSAndroid Build Coastguard Worker #endif  // !CONFIG_REALTIME_ONLY || CONFIG_AV1_DECODER
57*77c1e3ccSAndroid Build Coastguard Worker 
58*77c1e3ccSAndroid Build Coastguard Worker int av1_alloc_state_buffers(struct AV1Common *cm, int width, int height);
59*77c1e3ccSAndroid Build Coastguard Worker void av1_free_state_buffers(struct AV1Common *cm);
60*77c1e3ccSAndroid Build Coastguard Worker 
61*77c1e3ccSAndroid Build Coastguard Worker int av1_get_MBs(int width, int height);
62*77c1e3ccSAndroid Build Coastguard Worker 
63*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus
64*77c1e3ccSAndroid Build Coastguard Worker }  // extern "C"
65*77c1e3ccSAndroid Build Coastguard Worker #endif
66*77c1e3ccSAndroid Build Coastguard Worker 
67*77c1e3ccSAndroid Build Coastguard Worker #endif  // AOM_AV1_COMMON_ALLOCCOMMON_H_
68