/src/aom/av1/encoder/encoder_alloc.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2020, 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_ENCODER_ENCODER_ALLOC_H_ |
13 | | #define AOM_AV1_ENCODER_ENCODER_ALLOC_H_ |
14 | | |
15 | | #include "av1/encoder/block.h" |
16 | | #include "av1/encoder/encoder.h" |
17 | | #include "av1/encoder/encodetxb.h" |
18 | | #include "av1/encoder/ethread.h" |
19 | | #include "av1/encoder/intra_mode_search_utils.h" |
20 | | |
21 | | #ifdef __cplusplus |
22 | | extern "C" { |
23 | | #endif |
24 | | |
25 | | static AOM_INLINE void dealloc_context_buffers_ext( |
26 | 2.52k | MBMIExtFrameBufferInfo *mbmi_ext_info) { |
27 | 2.52k | if (mbmi_ext_info->frame_base) { |
28 | 1.26k | aom_free(mbmi_ext_info->frame_base); |
29 | 1.26k | mbmi_ext_info->frame_base = NULL; |
30 | 1.26k | mbmi_ext_info->alloc_size = 0; |
31 | 1.26k | } |
32 | 2.52k | } encoder.c:dealloc_context_buffers_ext Line | Count | Source | 26 | 2.52k | MBMIExtFrameBufferInfo *mbmi_ext_info) { | 27 | 2.52k | if (mbmi_ext_info->frame_base) { | 28 | 1.26k | aom_free(mbmi_ext_info->frame_base); | 29 | 1.26k | mbmi_ext_info->frame_base = NULL; | 30 | 1.26k | mbmi_ext_info->alloc_size = 0; | 31 | 1.26k | } | 32 | 2.52k | } |
Unexecuted instantiation: encoder_utils.c:dealloc_context_buffers_ext Unexecuted instantiation: ethread.c:dealloc_context_buffers_ext Unexecuted instantiation: superres_scale.c:dealloc_context_buffers_ext Unexecuted instantiation: svc_layercontext.c:dealloc_context_buffers_ext Unexecuted instantiation: compound_type.c:dealloc_context_buffers_ext Unexecuted instantiation: encode_strategy.c:dealloc_context_buffers_ext |
33 | | |
34 | | static AOM_INLINE void alloc_context_buffers_ext( |
35 | 10.3k | AV1_COMMON *cm, MBMIExtFrameBufferInfo *mbmi_ext_info) { |
36 | 10.3k | const CommonModeInfoParams *const mi_params = &cm->mi_params; |
37 | | |
38 | 10.3k | const int mi_alloc_size_1d = mi_size_wide[mi_params->mi_alloc_bsize]; |
39 | 10.3k | const int mi_alloc_rows = |
40 | 10.3k | (mi_params->mi_rows + mi_alloc_size_1d - 1) / mi_alloc_size_1d; |
41 | 10.3k | const int mi_alloc_cols = |
42 | 10.3k | (mi_params->mi_cols + mi_alloc_size_1d - 1) / mi_alloc_size_1d; |
43 | 10.3k | const int new_ext_mi_size = mi_alloc_rows * mi_alloc_cols; |
44 | | |
45 | 10.3k | if (new_ext_mi_size > mbmi_ext_info->alloc_size) { |
46 | 1.26k | dealloc_context_buffers_ext(mbmi_ext_info); |
47 | 1.26k | CHECK_MEM_ERROR( |
48 | 1.26k | cm, mbmi_ext_info->frame_base, |
49 | 1.26k | aom_calloc(new_ext_mi_size, sizeof(*mbmi_ext_info->frame_base))); |
50 | 1.26k | mbmi_ext_info->alloc_size = new_ext_mi_size; |
51 | 1.26k | } |
52 | | // The stride needs to be updated regardless of whether new allocation |
53 | | // happened or not. |
54 | 10.3k | mbmi_ext_info->stride = mi_alloc_cols; |
55 | 10.3k | } encoder.c:alloc_context_buffers_ext Line | Count | Source | 35 | 10.3k | AV1_COMMON *cm, MBMIExtFrameBufferInfo *mbmi_ext_info) { | 36 | 10.3k | const CommonModeInfoParams *const mi_params = &cm->mi_params; | 37 | | | 38 | 10.3k | const int mi_alloc_size_1d = mi_size_wide[mi_params->mi_alloc_bsize]; | 39 | 10.3k | const int mi_alloc_rows = | 40 | 10.3k | (mi_params->mi_rows + mi_alloc_size_1d - 1) / mi_alloc_size_1d; | 41 | 10.3k | const int mi_alloc_cols = | 42 | 10.3k | (mi_params->mi_cols + mi_alloc_size_1d - 1) / mi_alloc_size_1d; | 43 | 10.3k | const int new_ext_mi_size = mi_alloc_rows * mi_alloc_cols; | 44 | | | 45 | 10.3k | if (new_ext_mi_size > mbmi_ext_info->alloc_size) { | 46 | 1.26k | dealloc_context_buffers_ext(mbmi_ext_info); | 47 | 1.26k | CHECK_MEM_ERROR( | 48 | 1.26k | cm, mbmi_ext_info->frame_base, | 49 | 1.26k | aom_calloc(new_ext_mi_size, sizeof(*mbmi_ext_info->frame_base))); | 50 | 1.26k | mbmi_ext_info->alloc_size = new_ext_mi_size; | 51 | 1.26k | } | 52 | | // The stride needs to be updated regardless of whether new allocation | 53 | | // happened or not. | 54 | 10.3k | mbmi_ext_info->stride = mi_alloc_cols; | 55 | 10.3k | } |
Unexecuted instantiation: encoder_utils.c:alloc_context_buffers_ext Unexecuted instantiation: ethread.c:alloc_context_buffers_ext Unexecuted instantiation: superres_scale.c:alloc_context_buffers_ext Unexecuted instantiation: svc_layercontext.c:alloc_context_buffers_ext Unexecuted instantiation: compound_type.c:alloc_context_buffers_ext Unexecuted instantiation: encode_strategy.c:alloc_context_buffers_ext |
56 | | |
57 | 2.52k | static AOM_INLINE void alloc_compressor_data(AV1_COMP *cpi) { |
58 | 2.52k | AV1_COMMON *cm = &cpi->common; |
59 | 2.52k | CommonModeInfoParams *const mi_params = &cm->mi_params; |
60 | | |
61 | | // Setup mi_params |
62 | 2.52k | mi_params->set_mb_mi(mi_params, cm->width, cm->height, cpi->oxcf.mode, |
63 | 2.52k | cpi->sf.part_sf.default_min_partition_size); |
64 | | |
65 | 2.52k | if (!is_stat_generation_stage(cpi)) { |
66 | 2.52k | av1_alloc_txb_buf(cpi); |
67 | | |
68 | 2.52k | alloc_context_buffers_ext(cm, &cpi->mbmi_ext_info); |
69 | 2.52k | } |
70 | | |
71 | 2.52k | if (cpi->td.mb.mv_costs) { |
72 | 0 | aom_free(cpi->td.mb.mv_costs); |
73 | 0 | cpi->td.mb.mv_costs = NULL; |
74 | 0 | } |
75 | | // Avoid the memory allocation of 'mv_costs' for allintra encoding mode. |
76 | 2.52k | if (cpi->oxcf.kf_cfg.key_freq_max != 0) { |
77 | 0 | CHECK_MEM_ERROR(cm, cpi->td.mb.mv_costs, |
78 | 0 | (MvCosts *)aom_calloc(1, sizeof(MvCosts))); |
79 | 0 | } |
80 | | |
81 | 2.52k | if (cpi->td.mb.dv_costs) { |
82 | 1.26k | aom_free(cpi->td.mb.dv_costs); |
83 | 1.26k | cpi->td.mb.dv_costs = NULL; |
84 | 1.26k | } |
85 | 2.52k | CHECK_MEM_ERROR(cm, cpi->td.mb.dv_costs, |
86 | 2.52k | (IntraBCMVCosts *)aom_malloc(sizeof(*cpi->td.mb.dv_costs))); |
87 | | |
88 | 2.52k | av1_setup_shared_coeff_buffer(cm->seq_params, &cpi->td.shared_coeff_buf, |
89 | 2.52k | cm->error); |
90 | 2.52k | av1_setup_sms_tree(cpi, &cpi->td); |
91 | 2.52k | cpi->td.firstpass_ctx = |
92 | 2.52k | av1_alloc_pmc(cpi, BLOCK_16X16, &cpi->td.shared_coeff_buf); |
93 | 2.52k | } encoder.c:alloc_compressor_data Line | Count | Source | 57 | 2.52k | static AOM_INLINE void alloc_compressor_data(AV1_COMP *cpi) { | 58 | 2.52k | AV1_COMMON *cm = &cpi->common; | 59 | 2.52k | CommonModeInfoParams *const mi_params = &cm->mi_params; | 60 | | | 61 | | // Setup mi_params | 62 | 2.52k | mi_params->set_mb_mi(mi_params, cm->width, cm->height, cpi->oxcf.mode, | 63 | 2.52k | cpi->sf.part_sf.default_min_partition_size); | 64 | | | 65 | 2.52k | if (!is_stat_generation_stage(cpi)) { | 66 | 2.52k | av1_alloc_txb_buf(cpi); | 67 | | | 68 | 2.52k | alloc_context_buffers_ext(cm, &cpi->mbmi_ext_info); | 69 | 2.52k | } | 70 | | | 71 | 2.52k | if (cpi->td.mb.mv_costs) { | 72 | 0 | aom_free(cpi->td.mb.mv_costs); | 73 | 0 | cpi->td.mb.mv_costs = NULL; | 74 | 0 | } | 75 | | // Avoid the memory allocation of 'mv_costs' for allintra encoding mode. | 76 | 2.52k | if (cpi->oxcf.kf_cfg.key_freq_max != 0) { | 77 | 0 | CHECK_MEM_ERROR(cm, cpi->td.mb.mv_costs, | 78 | 0 | (MvCosts *)aom_calloc(1, sizeof(MvCosts))); | 79 | 0 | } | 80 | | | 81 | 2.52k | if (cpi->td.mb.dv_costs) { | 82 | 1.26k | aom_free(cpi->td.mb.dv_costs); | 83 | 1.26k | cpi->td.mb.dv_costs = NULL; | 84 | 1.26k | } | 85 | 2.52k | CHECK_MEM_ERROR(cm, cpi->td.mb.dv_costs, | 86 | 2.52k | (IntraBCMVCosts *)aom_malloc(sizeof(*cpi->td.mb.dv_costs))); | 87 | | | 88 | 2.52k | av1_setup_shared_coeff_buffer(cm->seq_params, &cpi->td.shared_coeff_buf, | 89 | 2.52k | cm->error); | 90 | 2.52k | av1_setup_sms_tree(cpi, &cpi->td); | 91 | 2.52k | cpi->td.firstpass_ctx = | 92 | 2.52k | av1_alloc_pmc(cpi, BLOCK_16X16, &cpi->td.shared_coeff_buf); | 93 | 2.52k | } |
Unexecuted instantiation: encoder_utils.c:alloc_compressor_data Unexecuted instantiation: ethread.c:alloc_compressor_data Unexecuted instantiation: superres_scale.c:alloc_compressor_data Unexecuted instantiation: svc_layercontext.c:alloc_compressor_data Unexecuted instantiation: compound_type.c:alloc_compressor_data Unexecuted instantiation: encode_strategy.c:alloc_compressor_data |
94 | | |
95 | | // Allocate mbmi buffers which are used to store mode information at block |
96 | | // level. |
97 | 1.26k | static AOM_INLINE void alloc_mb_mode_info_buffers(AV1_COMP *const cpi) { |
98 | 1.26k | AV1_COMMON *const cm = &cpi->common; |
99 | 1.26k | if (av1_alloc_context_buffers(cm, cm->width, cm->height, cpi->oxcf.mode, |
100 | 1.26k | cpi->sf.part_sf.default_min_partition_size)) { |
101 | 0 | aom_internal_error(cm->error, AOM_CODEC_MEM_ERROR, |
102 | 0 | "Failed to allocate context buffers"); |
103 | 0 | } |
104 | 1.26k | } Unexecuted instantiation: encoder.c:alloc_mb_mode_info_buffers Unexecuted instantiation: encoder_utils.c:alloc_mb_mode_info_buffers Unexecuted instantiation: ethread.c:alloc_mb_mode_info_buffers Unexecuted instantiation: superres_scale.c:alloc_mb_mode_info_buffers Unexecuted instantiation: svc_layercontext.c:alloc_mb_mode_info_buffers Unexecuted instantiation: compound_type.c:alloc_mb_mode_info_buffers encode_strategy.c:alloc_mb_mode_info_buffers Line | Count | Source | 97 | 1.26k | static AOM_INLINE void alloc_mb_mode_info_buffers(AV1_COMP *const cpi) { | 98 | 1.26k | AV1_COMMON *const cm = &cpi->common; | 99 | 1.26k | if (av1_alloc_context_buffers(cm, cm->width, cm->height, cpi->oxcf.mode, | 100 | 1.26k | cpi->sf.part_sf.default_min_partition_size)) { | 101 | 0 | aom_internal_error(cm->error, AOM_CODEC_MEM_ERROR, | 102 | 0 | "Failed to allocate context buffers"); | 103 | 0 | } | 104 | 1.26k | } |
|
105 | | |
106 | 2.52k | static AOM_INLINE void realloc_segmentation_maps(AV1_COMP *cpi) { |
107 | 2.52k | AV1_COMMON *const cm = &cpi->common; |
108 | 2.52k | CommonModeInfoParams *const mi_params = &cm->mi_params; |
109 | | |
110 | | // Create the encoder segmentation map and set all entries to 0 |
111 | 2.52k | aom_free(cpi->enc_seg.map); |
112 | 2.52k | CHECK_MEM_ERROR(cm, cpi->enc_seg.map, |
113 | 2.52k | aom_calloc(mi_params->mi_rows * mi_params->mi_cols, 1)); |
114 | | |
115 | | // Create a map used for cyclic background refresh. |
116 | 2.52k | if (cpi->cyclic_refresh) av1_cyclic_refresh_free(cpi->cyclic_refresh); |
117 | 2.52k | CHECK_MEM_ERROR( |
118 | 2.52k | cm, cpi->cyclic_refresh, |
119 | 2.52k | av1_cyclic_refresh_alloc(mi_params->mi_rows, mi_params->mi_cols)); |
120 | | |
121 | | // Create a map used to mark inactive areas. |
122 | 2.52k | aom_free(cpi->active_map.map); |
123 | 2.52k | CHECK_MEM_ERROR(cm, cpi->active_map.map, |
124 | 2.52k | aom_calloc(mi_params->mi_rows * mi_params->mi_cols, 1)); |
125 | 2.52k | } encoder.c:realloc_segmentation_maps Line | Count | Source | 106 | 2.52k | static AOM_INLINE void realloc_segmentation_maps(AV1_COMP *cpi) { | 107 | 2.52k | AV1_COMMON *const cm = &cpi->common; | 108 | 2.52k | CommonModeInfoParams *const mi_params = &cm->mi_params; | 109 | | | 110 | | // Create the encoder segmentation map and set all entries to 0 | 111 | 2.52k | aom_free(cpi->enc_seg.map); | 112 | 2.52k | CHECK_MEM_ERROR(cm, cpi->enc_seg.map, | 113 | 2.52k | aom_calloc(mi_params->mi_rows * mi_params->mi_cols, 1)); | 114 | | | 115 | | // Create a map used for cyclic background refresh. | 116 | 2.52k | if (cpi->cyclic_refresh) av1_cyclic_refresh_free(cpi->cyclic_refresh); | 117 | 2.52k | CHECK_MEM_ERROR( | 118 | 2.52k | cm, cpi->cyclic_refresh, | 119 | 2.52k | av1_cyclic_refresh_alloc(mi_params->mi_rows, mi_params->mi_cols)); | 120 | | | 121 | | // Create a map used to mark inactive areas. | 122 | 2.52k | aom_free(cpi->active_map.map); | 123 | 2.52k | CHECK_MEM_ERROR(cm, cpi->active_map.map, | 124 | 2.52k | aom_calloc(mi_params->mi_rows * mi_params->mi_cols, 1)); | 125 | 2.52k | } |
Unexecuted instantiation: encoder_utils.c:realloc_segmentation_maps Unexecuted instantiation: ethread.c:realloc_segmentation_maps Unexecuted instantiation: superres_scale.c:realloc_segmentation_maps Unexecuted instantiation: svc_layercontext.c:realloc_segmentation_maps Unexecuted instantiation: compound_type.c:realloc_segmentation_maps Unexecuted instantiation: encode_strategy.c:realloc_segmentation_maps |
126 | | |
127 | | static AOM_INLINE void alloc_obmc_buffers( |
128 | 0 | OBMCBuffer *obmc_buffer, struct aom_internal_error_info *error) { |
129 | 0 | AOM_CHECK_MEM_ERROR( |
130 | 0 | error, obmc_buffer->wsrc, |
131 | 0 | (int32_t *)aom_memalign(16, MAX_SB_SQUARE * sizeof(*obmc_buffer->wsrc))); |
132 | 0 | AOM_CHECK_MEM_ERROR( |
133 | 0 | error, obmc_buffer->mask, |
134 | 0 | (int32_t *)aom_memalign(16, MAX_SB_SQUARE * sizeof(*obmc_buffer->mask))); |
135 | 0 | AOM_CHECK_MEM_ERROR( |
136 | 0 | error, obmc_buffer->above_pred, |
137 | 0 | (uint8_t *)aom_memalign( |
138 | 0 | 16, MAX_MB_PLANE * MAX_SB_SQUARE * sizeof(*obmc_buffer->above_pred))); |
139 | 0 | AOM_CHECK_MEM_ERROR( |
140 | 0 | error, obmc_buffer->left_pred, |
141 | 0 | (uint8_t *)aom_memalign( |
142 | 0 | 16, MAX_MB_PLANE * MAX_SB_SQUARE * sizeof(*obmc_buffer->left_pred))); |
143 | 0 | } Unexecuted instantiation: encoder.c:alloc_obmc_buffers Unexecuted instantiation: encoder_utils.c:alloc_obmc_buffers Unexecuted instantiation: ethread.c:alloc_obmc_buffers Unexecuted instantiation: superres_scale.c:alloc_obmc_buffers Unexecuted instantiation: svc_layercontext.c:alloc_obmc_buffers Unexecuted instantiation: compound_type.c:alloc_obmc_buffers Unexecuted instantiation: encode_strategy.c:alloc_obmc_buffers |
144 | | |
145 | 2.09k | static AOM_INLINE void release_obmc_buffers(OBMCBuffer *obmc_buffer) { |
146 | 2.09k | aom_free(obmc_buffer->mask); |
147 | 2.09k | aom_free(obmc_buffer->above_pred); |
148 | 2.09k | aom_free(obmc_buffer->left_pred); |
149 | 2.09k | aom_free(obmc_buffer->wsrc); |
150 | | |
151 | 2.09k | obmc_buffer->mask = NULL; |
152 | 2.09k | obmc_buffer->above_pred = NULL; |
153 | 2.09k | obmc_buffer->left_pred = NULL; |
154 | 2.09k | obmc_buffer->wsrc = NULL; |
155 | 2.09k | } encoder.c:release_obmc_buffers Line | Count | Source | 145 | 2.09k | static AOM_INLINE void release_obmc_buffers(OBMCBuffer *obmc_buffer) { | 146 | 2.09k | aom_free(obmc_buffer->mask); | 147 | 2.09k | aom_free(obmc_buffer->above_pred); | 148 | 2.09k | aom_free(obmc_buffer->left_pred); | 149 | 2.09k | aom_free(obmc_buffer->wsrc); | 150 | | | 151 | 2.09k | obmc_buffer->mask = NULL; | 152 | 2.09k | obmc_buffer->above_pred = NULL; | 153 | 2.09k | obmc_buffer->left_pred = NULL; | 154 | 2.09k | obmc_buffer->wsrc = NULL; | 155 | 2.09k | } |
Unexecuted instantiation: encoder_utils.c:release_obmc_buffers Unexecuted instantiation: ethread.c:release_obmc_buffers Unexecuted instantiation: superres_scale.c:release_obmc_buffers Unexecuted instantiation: svc_layercontext.c:release_obmc_buffers Unexecuted instantiation: compound_type.c:release_obmc_buffers Unexecuted instantiation: encode_strategy.c:release_obmc_buffers |
156 | | |
157 | | static AOM_INLINE void alloc_compound_type_rd_buffers( |
158 | 0 | struct aom_internal_error_info *error, CompoundTypeRdBuffers *const bufs) { |
159 | 0 | AOM_CHECK_MEM_ERROR( |
160 | 0 | error, bufs->pred0, |
161 | 0 | (uint8_t *)aom_memalign(16, 2 * MAX_SB_SQUARE * sizeof(*bufs->pred0))); |
162 | 0 | AOM_CHECK_MEM_ERROR( |
163 | 0 | error, bufs->pred1, |
164 | 0 | (uint8_t *)aom_memalign(16, 2 * MAX_SB_SQUARE * sizeof(*bufs->pred1))); |
165 | 0 | AOM_CHECK_MEM_ERROR( |
166 | 0 | error, bufs->residual1, |
167 | 0 | (int16_t *)aom_memalign(32, MAX_SB_SQUARE * sizeof(*bufs->residual1))); |
168 | 0 | AOM_CHECK_MEM_ERROR( |
169 | 0 | error, bufs->diff10, |
170 | 0 | (int16_t *)aom_memalign(32, MAX_SB_SQUARE * sizeof(*bufs->diff10))); |
171 | 0 | AOM_CHECK_MEM_ERROR(error, bufs->tmp_best_mask_buf, |
172 | 0 | (uint8_t *)aom_malloc(2 * MAX_SB_SQUARE * |
173 | 0 | sizeof(*bufs->tmp_best_mask_buf))); |
174 | 0 | } Unexecuted instantiation: encoder.c:alloc_compound_type_rd_buffers Unexecuted instantiation: encoder_utils.c:alloc_compound_type_rd_buffers Unexecuted instantiation: ethread.c:alloc_compound_type_rd_buffers Unexecuted instantiation: superres_scale.c:alloc_compound_type_rd_buffers Unexecuted instantiation: svc_layercontext.c:alloc_compound_type_rd_buffers Unexecuted instantiation: compound_type.c:alloc_compound_type_rd_buffers Unexecuted instantiation: encode_strategy.c:alloc_compound_type_rd_buffers |
175 | | |
176 | | static AOM_INLINE void release_compound_type_rd_buffers( |
177 | 2.09k | CompoundTypeRdBuffers *const bufs) { |
178 | 2.09k | aom_free(bufs->pred0); |
179 | 2.09k | aom_free(bufs->pred1); |
180 | 2.09k | aom_free(bufs->residual1); |
181 | 2.09k | aom_free(bufs->diff10); |
182 | 2.09k | aom_free(bufs->tmp_best_mask_buf); |
183 | 2.09k | av1_zero(*bufs); // Set all pointers to NULL for safety. |
184 | 2.09k | } encoder.c:release_compound_type_rd_buffers Line | Count | Source | 177 | 2.09k | CompoundTypeRdBuffers *const bufs) { | 178 | 2.09k | aom_free(bufs->pred0); | 179 | 2.09k | aom_free(bufs->pred1); | 180 | 2.09k | aom_free(bufs->residual1); | 181 | 2.09k | aom_free(bufs->diff10); | 182 | 2.09k | aom_free(bufs->tmp_best_mask_buf); | 183 | 2.09k | av1_zero(*bufs); // Set all pointers to NULL for safety. | 184 | 2.09k | } |
Unexecuted instantiation: encoder_utils.c:release_compound_type_rd_buffers Unexecuted instantiation: ethread.c:release_compound_type_rd_buffers Unexecuted instantiation: superres_scale.c:release_compound_type_rd_buffers Unexecuted instantiation: svc_layercontext.c:release_compound_type_rd_buffers Unexecuted instantiation: compound_type.c:release_compound_type_rd_buffers Unexecuted instantiation: encode_strategy.c:release_compound_type_rd_buffers |
185 | | |
186 | 1.26k | static AOM_INLINE void dealloc_compressor_data(AV1_COMP *cpi) { |
187 | 1.26k | AV1_COMMON *const cm = &cpi->common; |
188 | 1.26k | TokenInfo *token_info = &cpi->token_info; |
189 | | |
190 | 1.26k | dealloc_context_buffers_ext(&cpi->mbmi_ext_info); |
191 | | |
192 | 1.26k | aom_free(cpi->tile_data); |
193 | 1.26k | cpi->tile_data = NULL; |
194 | | |
195 | | // Delete sementation map |
196 | 1.26k | aom_free(cpi->enc_seg.map); |
197 | 1.26k | cpi->enc_seg.map = NULL; |
198 | | |
199 | 1.26k | av1_cyclic_refresh_free(cpi->cyclic_refresh); |
200 | 1.26k | cpi->cyclic_refresh = NULL; |
201 | | |
202 | 1.26k | aom_free(cpi->active_map.map); |
203 | 1.26k | cpi->active_map.map = NULL; |
204 | | |
205 | 1.26k | aom_free(cpi->ssim_rdmult_scaling_factors); |
206 | 1.26k | cpi->ssim_rdmult_scaling_factors = NULL; |
207 | | |
208 | | #if CONFIG_TUNE_VMAF |
209 | | aom_free(cpi->vmaf_info.rdmult_scaling_factors); |
210 | | cpi->vmaf_info.rdmult_scaling_factors = NULL; |
211 | | aom_close_vmaf_model(cpi->vmaf_info.vmaf_model); |
212 | | #endif |
213 | | |
214 | | #if CONFIG_TUNE_BUTTERAUGLI |
215 | | aom_free(cpi->butteraugli_info.rdmult_scaling_factors); |
216 | | cpi->butteraugli_info.rdmult_scaling_factors = NULL; |
217 | | aom_free_frame_buffer(&cpi->butteraugli_info.source); |
218 | | aom_free_frame_buffer(&cpi->butteraugli_info.resized_source); |
219 | | #endif |
220 | | |
221 | 1.26k | release_obmc_buffers(&cpi->td.mb.obmc_buffer); |
222 | | |
223 | 1.26k | if (cpi->td.mb.mv_costs) { |
224 | 0 | aom_free(cpi->td.mb.mv_costs); |
225 | 0 | cpi->td.mb.mv_costs = NULL; |
226 | 0 | } |
227 | | |
228 | 1.26k | if (cpi->td.mb.dv_costs) { |
229 | 1.26k | aom_free(cpi->td.mb.dv_costs); |
230 | 1.26k | cpi->td.mb.dv_costs = NULL; |
231 | 1.26k | } |
232 | | |
233 | 3.78k | for (int i = 0; i < 2; i++) |
234 | 7.57k | for (int j = 0; j < 2; j++) { |
235 | 5.04k | aom_free(cpi->td.mb.intrabc_hash_info.hash_value_buffer[i][j]); |
236 | 5.04k | cpi->td.mb.intrabc_hash_info.hash_value_buffer[i][j] = NULL; |
237 | 5.04k | } |
238 | | |
239 | 1.26k | aom_free(cm->tpl_mvs); |
240 | 1.26k | cm->tpl_mvs = NULL; |
241 | | |
242 | 1.26k | if (cpi->td.pixel_gradient_info) { |
243 | 1.26k | aom_free(cpi->td.pixel_gradient_info); |
244 | 1.26k | cpi->td.pixel_gradient_info = NULL; |
245 | 1.26k | } |
246 | | |
247 | 1.26k | if (cpi->td.vt64x64) { |
248 | 0 | aom_free(cpi->td.vt64x64); |
249 | 0 | cpi->td.vt64x64 = NULL; |
250 | 0 | } |
251 | | |
252 | 1.26k | av1_free_pmc(cpi->td.firstpass_ctx, av1_num_planes(cm)); |
253 | 1.26k | cpi->td.firstpass_ctx = NULL; |
254 | | |
255 | 1.26k | av1_free_txb_buf(cpi); |
256 | 1.26k | av1_free_context_buffers(cm); |
257 | | |
258 | 1.26k | aom_free_frame_buffer(&cpi->last_frame_uf); |
259 | 1.26k | #if !CONFIG_REALTIME_ONLY |
260 | 1.26k | av1_free_restoration_buffers(cm); |
261 | 1.26k | #endif |
262 | | |
263 | 1.26k | if (!is_stat_generation_stage(cpi)) { |
264 | 1.26k | int num_cdef_workers = |
265 | 1.26k | av1_get_num_mod_workers_for_alloc(&cpi->ppi->p_mt_info, MOD_CDEF); |
266 | 1.26k | av1_free_cdef_buffers(cm, &cpi->ppi->p_mt_info.cdef_worker, |
267 | 1.26k | &cpi->mt_info.cdef_sync, num_cdef_workers); |
268 | 1.26k | } |
269 | | |
270 | 1.26k | aom_free_frame_buffer(&cpi->trial_frame_rst); |
271 | 1.26k | aom_free_frame_buffer(&cpi->scaled_source); |
272 | 1.26k | aom_free_frame_buffer(&cpi->scaled_last_source); |
273 | | |
274 | 1.26k | free_token_info(token_info); |
275 | | |
276 | 1.26k | av1_free_shared_coeff_buffer(&cpi->td.shared_coeff_buf); |
277 | 1.26k | av1_free_sms_tree(&cpi->td); |
278 | | |
279 | 1.26k | aom_free(cpi->td.mb.palette_buffer); |
280 | 1.26k | release_compound_type_rd_buffers(&cpi->td.mb.comp_rd_buffer); |
281 | 1.26k | aom_free(cpi->td.mb.tmp_conv_dst); |
282 | 3.78k | for (int j = 0; j < 2; ++j) { |
283 | 2.52k | aom_free(cpi->td.mb.tmp_pred_bufs[j]); |
284 | 2.52k | } |
285 | | |
286 | 1.26k | #if CONFIG_DENOISE |
287 | 1.26k | if (cpi->denoise_and_model) { |
288 | 0 | aom_denoise_and_model_free(cpi->denoise_and_model); |
289 | 0 | cpi->denoise_and_model = NULL; |
290 | 0 | } |
291 | 1.26k | #endif |
292 | 1.26k | if (cpi->film_grain_table) { |
293 | 0 | aom_film_grain_table_free(cpi->film_grain_table); |
294 | 0 | cpi->film_grain_table = NULL; |
295 | 0 | } |
296 | | |
297 | 1.26k | if (cpi->ppi->use_svc) av1_free_svc_cyclic_refresh(cpi); |
298 | | |
299 | 1.26k | if (cpi->consec_zero_mv) { |
300 | 1.26k | aom_free(cpi->consec_zero_mv); |
301 | 1.26k | cpi->consec_zero_mv = NULL; |
302 | 1.26k | } |
303 | | |
304 | 1.26k | aom_free(cpi->mb_weber_stats); |
305 | 1.26k | cpi->mb_weber_stats = NULL; |
306 | | |
307 | 1.26k | aom_free(cpi->mb_delta_q); |
308 | 1.26k | cpi->mb_delta_q = NULL; |
309 | 1.26k | } encoder.c:dealloc_compressor_data Line | Count | Source | 186 | 1.26k | static AOM_INLINE void dealloc_compressor_data(AV1_COMP *cpi) { | 187 | 1.26k | AV1_COMMON *const cm = &cpi->common; | 188 | 1.26k | TokenInfo *token_info = &cpi->token_info; | 189 | | | 190 | 1.26k | dealloc_context_buffers_ext(&cpi->mbmi_ext_info); | 191 | | | 192 | 1.26k | aom_free(cpi->tile_data); | 193 | 1.26k | cpi->tile_data = NULL; | 194 | | | 195 | | // Delete sementation map | 196 | 1.26k | aom_free(cpi->enc_seg.map); | 197 | 1.26k | cpi->enc_seg.map = NULL; | 198 | | | 199 | 1.26k | av1_cyclic_refresh_free(cpi->cyclic_refresh); | 200 | 1.26k | cpi->cyclic_refresh = NULL; | 201 | | | 202 | 1.26k | aom_free(cpi->active_map.map); | 203 | 1.26k | cpi->active_map.map = NULL; | 204 | | | 205 | 1.26k | aom_free(cpi->ssim_rdmult_scaling_factors); | 206 | 1.26k | cpi->ssim_rdmult_scaling_factors = NULL; | 207 | | | 208 | | #if CONFIG_TUNE_VMAF | 209 | | aom_free(cpi->vmaf_info.rdmult_scaling_factors); | 210 | | cpi->vmaf_info.rdmult_scaling_factors = NULL; | 211 | | aom_close_vmaf_model(cpi->vmaf_info.vmaf_model); | 212 | | #endif | 213 | | | 214 | | #if CONFIG_TUNE_BUTTERAUGLI | 215 | | aom_free(cpi->butteraugli_info.rdmult_scaling_factors); | 216 | | cpi->butteraugli_info.rdmult_scaling_factors = NULL; | 217 | | aom_free_frame_buffer(&cpi->butteraugli_info.source); | 218 | | aom_free_frame_buffer(&cpi->butteraugli_info.resized_source); | 219 | | #endif | 220 | | | 221 | 1.26k | release_obmc_buffers(&cpi->td.mb.obmc_buffer); | 222 | | | 223 | 1.26k | if (cpi->td.mb.mv_costs) { | 224 | 0 | aom_free(cpi->td.mb.mv_costs); | 225 | 0 | cpi->td.mb.mv_costs = NULL; | 226 | 0 | } | 227 | | | 228 | 1.26k | if (cpi->td.mb.dv_costs) { | 229 | 1.26k | aom_free(cpi->td.mb.dv_costs); | 230 | 1.26k | cpi->td.mb.dv_costs = NULL; | 231 | 1.26k | } | 232 | | | 233 | 3.78k | for (int i = 0; i < 2; i++) | 234 | 7.57k | for (int j = 0; j < 2; j++) { | 235 | 5.04k | aom_free(cpi->td.mb.intrabc_hash_info.hash_value_buffer[i][j]); | 236 | 5.04k | cpi->td.mb.intrabc_hash_info.hash_value_buffer[i][j] = NULL; | 237 | 5.04k | } | 238 | | | 239 | 1.26k | aom_free(cm->tpl_mvs); | 240 | 1.26k | cm->tpl_mvs = NULL; | 241 | | | 242 | 1.26k | if (cpi->td.pixel_gradient_info) { | 243 | 1.26k | aom_free(cpi->td.pixel_gradient_info); | 244 | 1.26k | cpi->td.pixel_gradient_info = NULL; | 245 | 1.26k | } | 246 | | | 247 | 1.26k | if (cpi->td.vt64x64) { | 248 | 0 | aom_free(cpi->td.vt64x64); | 249 | 0 | cpi->td.vt64x64 = NULL; | 250 | 0 | } | 251 | | | 252 | 1.26k | av1_free_pmc(cpi->td.firstpass_ctx, av1_num_planes(cm)); | 253 | 1.26k | cpi->td.firstpass_ctx = NULL; | 254 | | | 255 | 1.26k | av1_free_txb_buf(cpi); | 256 | 1.26k | av1_free_context_buffers(cm); | 257 | | | 258 | 1.26k | aom_free_frame_buffer(&cpi->last_frame_uf); | 259 | 1.26k | #if !CONFIG_REALTIME_ONLY | 260 | 1.26k | av1_free_restoration_buffers(cm); | 261 | 1.26k | #endif | 262 | | | 263 | 1.26k | if (!is_stat_generation_stage(cpi)) { | 264 | 1.26k | int num_cdef_workers = | 265 | 1.26k | av1_get_num_mod_workers_for_alloc(&cpi->ppi->p_mt_info, MOD_CDEF); | 266 | 1.26k | av1_free_cdef_buffers(cm, &cpi->ppi->p_mt_info.cdef_worker, | 267 | 1.26k | &cpi->mt_info.cdef_sync, num_cdef_workers); | 268 | 1.26k | } | 269 | | | 270 | 1.26k | aom_free_frame_buffer(&cpi->trial_frame_rst); | 271 | 1.26k | aom_free_frame_buffer(&cpi->scaled_source); | 272 | 1.26k | aom_free_frame_buffer(&cpi->scaled_last_source); | 273 | | | 274 | 1.26k | free_token_info(token_info); | 275 | | | 276 | 1.26k | av1_free_shared_coeff_buffer(&cpi->td.shared_coeff_buf); | 277 | 1.26k | av1_free_sms_tree(&cpi->td); | 278 | | | 279 | 1.26k | aom_free(cpi->td.mb.palette_buffer); | 280 | 1.26k | release_compound_type_rd_buffers(&cpi->td.mb.comp_rd_buffer); | 281 | 1.26k | aom_free(cpi->td.mb.tmp_conv_dst); | 282 | 3.78k | for (int j = 0; j < 2; ++j) { | 283 | 2.52k | aom_free(cpi->td.mb.tmp_pred_bufs[j]); | 284 | 2.52k | } | 285 | | | 286 | 1.26k | #if CONFIG_DENOISE | 287 | 1.26k | if (cpi->denoise_and_model) { | 288 | 0 | aom_denoise_and_model_free(cpi->denoise_and_model); | 289 | 0 | cpi->denoise_and_model = NULL; | 290 | 0 | } | 291 | 1.26k | #endif | 292 | 1.26k | if (cpi->film_grain_table) { | 293 | 0 | aom_film_grain_table_free(cpi->film_grain_table); | 294 | 0 | cpi->film_grain_table = NULL; | 295 | 0 | } | 296 | | | 297 | 1.26k | if (cpi->ppi->use_svc) av1_free_svc_cyclic_refresh(cpi); | 298 | | | 299 | 1.26k | if (cpi->consec_zero_mv) { | 300 | 1.26k | aom_free(cpi->consec_zero_mv); | 301 | 1.26k | cpi->consec_zero_mv = NULL; | 302 | 1.26k | } | 303 | | | 304 | 1.26k | aom_free(cpi->mb_weber_stats); | 305 | 1.26k | cpi->mb_weber_stats = NULL; | 306 | | | 307 | 1.26k | aom_free(cpi->mb_delta_q); | 308 | 1.26k | cpi->mb_delta_q = NULL; | 309 | 1.26k | } |
Unexecuted instantiation: encoder_utils.c:dealloc_compressor_data Unexecuted instantiation: ethread.c:dealloc_compressor_data Unexecuted instantiation: superres_scale.c:dealloc_compressor_data Unexecuted instantiation: svc_layercontext.c:dealloc_compressor_data Unexecuted instantiation: compound_type.c:dealloc_compressor_data Unexecuted instantiation: encode_strategy.c:dealloc_compressor_data |
310 | | |
311 | | static AOM_INLINE void allocate_gradient_info_for_hog( |
312 | 1.26k | PixelLevelGradientInfo **pixel_gradient_info, AV1_COMP *cpi) { |
313 | 1.26k | if (!is_gradient_caching_for_hog_enabled(cpi)) return; |
314 | 1.26k | const AV1_COMMON *const cm = &cpi->common; |
315 | | |
316 | 1.26k | if (!*pixel_gradient_info) { |
317 | 1.26k | const int plane_types = PLANE_TYPES >> cm->seq_params->monochrome; |
318 | 1.26k | CHECK_MEM_ERROR(cm, *pixel_gradient_info, |
319 | 1.26k | aom_malloc(sizeof(**pixel_gradient_info) * plane_types * |
320 | 1.26k | MAX_SB_SQUARE)); |
321 | 1.26k | } |
322 | | |
323 | 1.26k | cpi->td.mb.pixel_gradient_info = *pixel_gradient_info; |
324 | 1.26k | } encoder.c:allocate_gradient_info_for_hog Line | Count | Source | 312 | 1.26k | PixelLevelGradientInfo **pixel_gradient_info, AV1_COMP *cpi) { | 313 | 1.26k | if (!is_gradient_caching_for_hog_enabled(cpi)) return; | 314 | 1.26k | const AV1_COMMON *const cm = &cpi->common; | 315 | | | 316 | 1.26k | if (!*pixel_gradient_info) { | 317 | 1.26k | const int plane_types = PLANE_TYPES >> cm->seq_params->monochrome; | 318 | 1.26k | CHECK_MEM_ERROR(cm, *pixel_gradient_info, | 319 | 1.26k | aom_malloc(sizeof(**pixel_gradient_info) * plane_types * | 320 | 1.26k | MAX_SB_SQUARE)); | 321 | 1.26k | } | 322 | | | 323 | 1.26k | cpi->td.mb.pixel_gradient_info = *pixel_gradient_info; | 324 | 1.26k | } |
Unexecuted instantiation: encoder_utils.c:allocate_gradient_info_for_hog Unexecuted instantiation: ethread.c:allocate_gradient_info_for_hog Unexecuted instantiation: superres_scale.c:allocate_gradient_info_for_hog Unexecuted instantiation: svc_layercontext.c:allocate_gradient_info_for_hog Unexecuted instantiation: compound_type.c:allocate_gradient_info_for_hog Unexecuted instantiation: encode_strategy.c:allocate_gradient_info_for_hog |
325 | | |
326 | 0 | static AOM_INLINE void variance_partition_alloc(AV1_COMP *cpi) { |
327 | 0 | AV1_COMMON *const cm = &cpi->common; |
328 | 0 | const int num_64x64_blocks = (cm->seq_params->sb_size == BLOCK_64X64) ? 1 : 4; |
329 | 0 | if (cpi->td.vt64x64) { |
330 | 0 | if (num_64x64_blocks != cpi->td.num_64x64_blocks) { |
331 | 0 | aom_free(cpi->td.vt64x64); |
332 | 0 | cpi->td.vt64x64 = NULL; |
333 | 0 | } |
334 | 0 | } |
335 | 0 | if (!cpi->td.vt64x64) { |
336 | 0 | CHECK_MEM_ERROR(cm, cpi->td.vt64x64, |
337 | 0 | aom_malloc(sizeof(*cpi->td.vt64x64) * num_64x64_blocks)); |
338 | 0 | cpi->td.num_64x64_blocks = num_64x64_blocks; |
339 | 0 | } |
340 | 0 | } Unexecuted instantiation: encoder.c:variance_partition_alloc Unexecuted instantiation: encoder_utils.c:variance_partition_alloc Unexecuted instantiation: ethread.c:variance_partition_alloc Unexecuted instantiation: superres_scale.c:variance_partition_alloc Unexecuted instantiation: svc_layercontext.c:variance_partition_alloc Unexecuted instantiation: compound_type.c:variance_partition_alloc Unexecuted instantiation: encode_strategy.c:variance_partition_alloc |
341 | | |
342 | | static AOM_INLINE YV12_BUFFER_CONFIG *realloc_and_scale_source( |
343 | 0 | AV1_COMP *cpi, int scaled_width, int scaled_height) { |
344 | 0 | AV1_COMMON *cm = &cpi->common; |
345 | 0 | const int num_planes = av1_num_planes(cm); |
346 | |
|
347 | 0 | if (scaled_width == cpi->unscaled_source->y_crop_width && |
348 | 0 | scaled_height == cpi->unscaled_source->y_crop_height) { |
349 | 0 | return cpi->unscaled_source; |
350 | 0 | } |
351 | | |
352 | 0 | if (aom_realloc_frame_buffer( |
353 | 0 | &cpi->scaled_source, scaled_width, scaled_height, |
354 | 0 | cm->seq_params->subsampling_x, cm->seq_params->subsampling_y, |
355 | 0 | cm->seq_params->use_highbitdepth, AOM_BORDER_IN_PIXELS, |
356 | 0 | cm->features.byte_alignment, NULL, NULL, NULL, |
357 | 0 | cpi->oxcf.tool_cfg.enable_global_motion)) |
358 | 0 | aom_internal_error(cm->error, AOM_CODEC_MEM_ERROR, |
359 | 0 | "Failed to reallocate scaled source buffer"); |
360 | 0 | assert(cpi->scaled_source.y_crop_width == scaled_width); |
361 | 0 | assert(cpi->scaled_source.y_crop_height == scaled_height); |
362 | 0 | av1_resize_and_extend_frame_nonnormative( |
363 | 0 | cpi->unscaled_source, &cpi->scaled_source, (int)cm->seq_params->bit_depth, |
364 | 0 | num_planes); |
365 | 0 | return &cpi->scaled_source; |
366 | 0 | } Unexecuted instantiation: encoder.c:realloc_and_scale_source Unexecuted instantiation: encoder_utils.c:realloc_and_scale_source Unexecuted instantiation: ethread.c:realloc_and_scale_source Unexecuted instantiation: superres_scale.c:realloc_and_scale_source Unexecuted instantiation: svc_layercontext.c:realloc_and_scale_source Unexecuted instantiation: compound_type.c:realloc_and_scale_source Unexecuted instantiation: encode_strategy.c:realloc_and_scale_source |
367 | | |
368 | | #ifdef __cplusplus |
369 | | } // extern "C" |
370 | | #endif |
371 | | |
372 | | #endif // AOM_AV1_ENCODER_ENCODER_ALLOC_H_ |