Coverage Report

Created: 2022-08-24 06:11

/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
0
    MBMIExtFrameBufferInfo *mbmi_ext_info) {
27
0
  if (mbmi_ext_info->frame_base) {
28
0
    aom_free(mbmi_ext_info->frame_base);
29
0
    mbmi_ext_info->frame_base = NULL;
30
0
    mbmi_ext_info->alloc_size = 0;
31
0
  }
32
0
}
Unexecuted instantiation: encoder.c:dealloc_context_buffers_ext
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
0
    AV1_COMMON *cm, MBMIExtFrameBufferInfo *mbmi_ext_info) {
36
0
  const CommonModeInfoParams *const mi_params = &cm->mi_params;
37
38
0
  const int mi_alloc_size_1d = mi_size_wide[mi_params->mi_alloc_bsize];
39
0
  const int mi_alloc_rows =
40
0
      (mi_params->mi_rows + mi_alloc_size_1d - 1) / mi_alloc_size_1d;
41
0
  const int mi_alloc_cols =
42
0
      (mi_params->mi_cols + mi_alloc_size_1d - 1) / mi_alloc_size_1d;
43
0
  const int new_ext_mi_size = mi_alloc_rows * mi_alloc_cols;
44
45
0
  if (new_ext_mi_size > mbmi_ext_info->alloc_size) {
46
0
    dealloc_context_buffers_ext(mbmi_ext_info);
47
0
    CHECK_MEM_ERROR(
48
0
        cm, mbmi_ext_info->frame_base,
49
0
        aom_calloc(new_ext_mi_size, sizeof(*mbmi_ext_info->frame_base)));
50
0
    mbmi_ext_info->alloc_size = new_ext_mi_size;
51
0
  }
52
  // The stride needs to be updated regardless of whether new allocation
53
  // happened or not.
54
0
  mbmi_ext_info->stride = mi_alloc_cols;
55
0
}
Unexecuted instantiation: encoder.c:alloc_context_buffers_ext
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
0
static AOM_INLINE void alloc_compressor_data(AV1_COMP *cpi) {
58
0
  AV1_COMMON *cm = &cpi->common;
59
0
  CommonModeInfoParams *const mi_params = &cm->mi_params;
60
61
  // Setup mi_params
62
0
  mi_params->set_mb_mi(mi_params, cm->width, cm->height, cpi->oxcf.mode,
63
0
                       cpi->sf.part_sf.default_min_partition_size);
64
65
0
  if (!is_stat_generation_stage(cpi)) {
66
0
    av1_alloc_txb_buf(cpi);
67
68
0
    alloc_context_buffers_ext(cm, &cpi->mbmi_ext_info);
69
0
  }
70
71
0
  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
0
  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
0
  if (cpi->td.mb.dv_costs) {
82
0
    aom_free(cpi->td.mb.dv_costs);
83
0
    cpi->td.mb.dv_costs = NULL;
84
0
  }
85
0
  CHECK_MEM_ERROR(cm, cpi->td.mb.dv_costs,
86
0
                  (IntraBCMVCosts *)aom_malloc(sizeof(*cpi->td.mb.dv_costs)));
87
88
0
  av1_setup_shared_coeff_buffer(cm->seq_params, &cpi->td.shared_coeff_buf,
89
0
                                cm->error);
90
0
  av1_setup_sms_tree(cpi, &cpi->td);
91
0
  cpi->td.firstpass_ctx =
92
0
      av1_alloc_pmc(cpi, BLOCK_16X16, &cpi->td.shared_coeff_buf);
93
0
}
Unexecuted instantiation: encoder.c:alloc_compressor_data
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
0
static AOM_INLINE void alloc_mb_mode_info_buffers(AV1_COMP *const cpi) {
98
0
  AV1_COMMON *const cm = &cpi->common;
99
0
  if (av1_alloc_context_buffers(cm, cm->width, cm->height, cpi->oxcf.mode,
100
0
                                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
0
}
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
Unexecuted instantiation: encode_strategy.c:alloc_mb_mode_info_buffers
105
106
0
static AOM_INLINE void realloc_segmentation_maps(AV1_COMP *cpi) {
107
0
  AV1_COMMON *const cm = &cpi->common;
108
0
  CommonModeInfoParams *const mi_params = &cm->mi_params;
109
110
  // Create the encoder segmentation map and set all entries to 0
111
0
  aom_free(cpi->enc_seg.map);
112
0
  CHECK_MEM_ERROR(cm, cpi->enc_seg.map,
113
0
                  aom_calloc(mi_params->mi_rows * mi_params->mi_cols, 1));
114
115
  // Create a map used for cyclic background refresh.
116
0
  if (cpi->cyclic_refresh) av1_cyclic_refresh_free(cpi->cyclic_refresh);
117
0
  CHECK_MEM_ERROR(
118
0
      cm, cpi->cyclic_refresh,
119
0
      av1_cyclic_refresh_alloc(mi_params->mi_rows, mi_params->mi_cols));
120
121
  // Create a map used to mark inactive areas.
122
0
  aom_free(cpi->active_map.map);
123
0
  CHECK_MEM_ERROR(cm, cpi->active_map.map,
124
0
                  aom_calloc(mi_params->mi_rows * mi_params->mi_cols, 1));
125
0
}
Unexecuted instantiation: encoder.c:realloc_segmentation_maps
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
0
static AOM_INLINE void release_obmc_buffers(OBMCBuffer *obmc_buffer) {
146
0
  aom_free(obmc_buffer->mask);
147
0
  aom_free(obmc_buffer->above_pred);
148
0
  aom_free(obmc_buffer->left_pred);
149
0
  aom_free(obmc_buffer->wsrc);
150
151
0
  obmc_buffer->mask = NULL;
152
0
  obmc_buffer->above_pred = NULL;
153
0
  obmc_buffer->left_pred = NULL;
154
0
  obmc_buffer->wsrc = NULL;
155
0
}
Unexecuted instantiation: encoder.c:release_obmc_buffers
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
0
    CompoundTypeRdBuffers *const bufs) {
178
0
  aom_free(bufs->pred0);
179
0
  aom_free(bufs->pred1);
180
0
  aom_free(bufs->residual1);
181
0
  aom_free(bufs->diff10);
182
0
  aom_free(bufs->tmp_best_mask_buf);
183
0
  av1_zero(*bufs);  // Set all pointers to NULL for safety.
184
0
}
Unexecuted instantiation: encoder.c:release_compound_type_rd_buffers
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
0
static AOM_INLINE void dealloc_compressor_data(AV1_COMP *cpi) {
187
0
  AV1_COMMON *const cm = &cpi->common;
188
0
  TokenInfo *token_info = &cpi->token_info;
189
190
0
  dealloc_context_buffers_ext(&cpi->mbmi_ext_info);
191
192
0
  aom_free(cpi->tile_data);
193
0
  cpi->tile_data = NULL;
194
195
  // Delete sementation map
196
0
  aom_free(cpi->enc_seg.map);
197
0
  cpi->enc_seg.map = NULL;
198
199
0
  av1_cyclic_refresh_free(cpi->cyclic_refresh);
200
0
  cpi->cyclic_refresh = NULL;
201
202
0
  aom_free(cpi->active_map.map);
203
0
  cpi->active_map.map = NULL;
204
205
0
  aom_free(cpi->ssim_rdmult_scaling_factors);
206
0
  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
0
  release_obmc_buffers(&cpi->td.mb.obmc_buffer);
222
223
0
  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
0
  if (cpi->td.mb.dv_costs) {
229
0
    aom_free(cpi->td.mb.dv_costs);
230
0
    cpi->td.mb.dv_costs = NULL;
231
0
  }
232
233
0
  for (int i = 0; i < 2; i++)
234
0
    for (int j = 0; j < 2; j++) {
235
0
      aom_free(cpi->td.mb.intrabc_hash_info.hash_value_buffer[i][j]);
236
0
      cpi->td.mb.intrabc_hash_info.hash_value_buffer[i][j] = NULL;
237
0
    }
238
239
0
  aom_free(cm->tpl_mvs);
240
0
  cm->tpl_mvs = NULL;
241
242
0
  if (cpi->td.pixel_gradient_info) {
243
0
    aom_free(cpi->td.pixel_gradient_info);
244
0
    cpi->td.pixel_gradient_info = NULL;
245
0
  }
246
247
0
  if (cpi->td.vt64x64) {
248
0
    aom_free(cpi->td.vt64x64);
249
0
    cpi->td.vt64x64 = NULL;
250
0
  }
251
252
0
  av1_free_pmc(cpi->td.firstpass_ctx, av1_num_planes(cm));
253
0
  cpi->td.firstpass_ctx = NULL;
254
255
0
  av1_free_txb_buf(cpi);
256
0
  av1_free_context_buffers(cm);
257
258
0
  aom_free_frame_buffer(&cpi->last_frame_uf);
259
0
#if !CONFIG_REALTIME_ONLY
260
0
  av1_free_restoration_buffers(cm);
261
0
#endif
262
263
0
  if (!is_stat_generation_stage(cpi)) {
264
0
    int num_cdef_workers =
265
0
        av1_get_num_mod_workers_for_alloc(&cpi->ppi->p_mt_info, MOD_CDEF);
266
0
    av1_free_cdef_buffers(cm, &cpi->ppi->p_mt_info.cdef_worker,
267
0
                          &cpi->mt_info.cdef_sync, num_cdef_workers);
268
0
  }
269
270
0
  aom_free_frame_buffer(&cpi->trial_frame_rst);
271
0
  aom_free_frame_buffer(&cpi->scaled_source);
272
0
  aom_free_frame_buffer(&cpi->scaled_last_source);
273
274
0
  free_token_info(token_info);
275
276
0
  av1_free_shared_coeff_buffer(&cpi->td.shared_coeff_buf);
277
0
  av1_free_sms_tree(&cpi->td);
278
279
0
  aom_free(cpi->td.mb.palette_buffer);
280
0
  release_compound_type_rd_buffers(&cpi->td.mb.comp_rd_buffer);
281
0
  aom_free(cpi->td.mb.tmp_conv_dst);
282
0
  for (int j = 0; j < 2; ++j) {
283
0
    aom_free(cpi->td.mb.tmp_pred_bufs[j]);
284
0
  }
285
286
0
#if CONFIG_DENOISE
287
0
  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
0
#endif
292
0
  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
0
  if (cpi->ppi->use_svc) av1_free_svc_cyclic_refresh(cpi);
298
299
0
  if (cpi->consec_zero_mv) {
300
0
    aom_free(cpi->consec_zero_mv);
301
0
    cpi->consec_zero_mv = NULL;
302
0
  }
303
304
0
  aom_free(cpi->mb_weber_stats);
305
0
  cpi->mb_weber_stats = NULL;
306
307
0
  aom_free(cpi->mb_delta_q);
308
0
  cpi->mb_delta_q = NULL;
309
0
}
Unexecuted instantiation: encoder.c:dealloc_compressor_data
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
0
    PixelLevelGradientInfo **pixel_gradient_info, AV1_COMP *cpi) {
313
0
  if (!is_gradient_caching_for_hog_enabled(cpi)) return;
314
0
  const AV1_COMMON *const cm = &cpi->common;
315
316
0
  if (!*pixel_gradient_info) {
317
0
    const int plane_types = PLANE_TYPES >> cm->seq_params->monochrome;
318
0
    CHECK_MEM_ERROR(cm, *pixel_gradient_info,
319
0
                    aom_malloc(sizeof(**pixel_gradient_info) * plane_types *
320
0
                               MAX_SB_SQUARE));
321
0
  }
322
323
0
  cpi->td.mb.pixel_gradient_info = *pixel_gradient_info;
324
0
}
Unexecuted instantiation: encoder.c:allocate_gradient_info_for_hog
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_