/* * Copyright (c) 2020, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
if (new_ext_mi_size > mbmi_ext_info->alloc_size) {
dealloc_context_buffers_ext(mbmi_ext_info);
CHECK_MEM_ERROR(
cm, mbmi_ext_info->frame_base,
aom_malloc(new_ext_mi_size * sizeof(*mbmi_ext_info->frame_base)));
mbmi_ext_info->alloc_size = new_ext_mi_size;
} // The stride needs to be updated regardless of whether new allocation // happened or not.
mbmi_ext_info->stride = mi_alloc_cols;
}
if (!is_stat_generation_stage(cpi)) av1_alloc_txb_buf(cpi);
aom_free(cpi->td.mv_costs_alloc);
cpi->td.mv_costs_alloc = NULL; // Avoid the memory allocation of 'mv_costs_alloc' for allintra encoding // mode. if (cpi->oxcf.kf_cfg.key_freq_max != 0) {
CHECK_MEM_ERROR(cm, cpi->td.mv_costs_alloc,
(MvCosts *)aom_calloc(1, sizeof(*cpi->td.mv_costs_alloc)));
cpi->td.mb.mv_costs = cpi->td.mv_costs_alloc;
}
av1_setup_shared_coeff_buffer(cm->seq_params, &cpi->td.shared_coeff_buf,
cm->error); if (av1_setup_sms_tree(cpi, &cpi->td)) {
aom_internal_error(cm->error, AOM_CODEC_MEM_ERROR, "Failed to allocate SMS tree");
}
cpi->td.firstpass_ctx =
av1_alloc_pmc(cpi, BLOCK_16X16, &cpi->td.shared_coeff_buf); if (!cpi->td.firstpass_ctx)
aom_internal_error(cm->error, AOM_CODEC_MEM_ERROR, "Failed to allocate PICK_MODE_CONTEXT");
}
// Allocate mbmi buffers which are used to store mode information at block // level. staticinlinevoid alloc_mb_mode_info_buffers(AV1_COMP *const cpi) {
AV1_COMMON *const cm = &cpi->common; if (av1_alloc_context_buffers(cm, cm->width, cm->height,
cpi->sf.part_sf.default_min_partition_size)) {
aom_internal_error(cm->error, AOM_CODEC_MEM_ERROR, "Failed to allocate context buffers");
}
if (!is_stat_generation_stage(cpi))
alloc_context_buffers_ext(cm, &cpi->mbmi_ext_info);
}
// Create the encoder segmentation map and set all entries to 0
aom_free(cpi->enc_seg.map);
CHECK_MEM_ERROR(cm, cpi->enc_seg.map,
aom_calloc(mi_params->mi_rows * mi_params->mi_cols, 1));
// Create a map used for cyclic background refresh. if (cpi->cyclic_refresh) av1_cyclic_refresh_free(cpi->cyclic_refresh);
CHECK_MEM_ERROR(
cm, cpi->cyclic_refresh,
av1_cyclic_refresh_alloc(mi_params->mi_rows, mi_params->mi_cols));
// Create a map used to mark inactive areas.
aom_free(cpi->active_map.map);
CHECK_MEM_ERROR(cm, cpi->active_map.map,
aom_calloc(mi_params->mi_rows * mi_params->mi_cols, 1));
}
constint is_highbitdepth = cpi->tf_ctx.is_highbitdepth; // This call ensures that the buffers allocated by tf_alloc_and_reset_data() // in av1_temporal_filter() for single-threaded encode are freed in case an // error is encountered during temporal filtering (due to early termination // tf_dealloc_data() in av1_temporal_filter() would not be invoked).
tf_dealloc_data(&cpi->td.tf_data, is_highbitdepth);
// This call ensures that tpl_tmp_buffers for single-threaded encode are freed // in case of an error during tpl.
tpl_dealloc_temp_buffers(&cpi->td.tpl_tmp_buffers);
// This call ensures that the global motion (gm) data buffers for // single-threaded encode are freed in case of an error during gm.
gm_dealloc_data(&cpi->td.gm_data);
// This call ensures that CDEF search context buffers are deallocated in case // of an error during cdef search.
av1_cdef_dealloc_data(cpi->cdef_search_ctx);
aom_free(cpi->cdef_search_ctx);
cpi->cdef_search_ctx = NULL;
for (int x = 0; x < 2; x++) { for (int y = 0; y < 2; y++) {
aom_free(td->hash_value_buffer[x][y]);
td->hash_value_buffer[x][y] = NULL;
}
}
aom_free(td->mv_costs_alloc);
td->mv_costs_alloc = NULL;
aom_free(td->dv_costs_alloc);
td->dv_costs_alloc = NULL;
aom_free(td->counts);
av1_free_pmc(td->firstpass_ctx, num_planes);
td->firstpass_ctx = NULL;
av1_free_shared_coeff_buffer(&td->shared_coeff_buf);
av1_free_sms_tree(td); // This call ensures that the buffers allocated by tf_alloc_and_reset_data() // in prepare_tf_workers() for MT encode are freed in case an error is // encountered during temporal filtering (due to early termination // tf_dealloc_thread_data() in av1_tf_do_filtering_mt() would not be // invoked). if (t < num_tf_workers) tf_dealloc_data(&td->tf_data, is_highbitdepth); // This call ensures that tpl_tmp_buffers for MT encode are freed in case of // an error during tpl. if (t < num_tpl_workers) tpl_dealloc_temp_buffers(&td->tpl_tmp_buffers); // This call ensures that the buffers in gm_data for MT encode are freed in // case of an error during gm.
gm_dealloc_data(&td->gm_data);
av1_dealloc_mb_data(&td->mb, num_planes);
aom_free(td->mb.sb_stats_cache);
td->mb.sb_stats_cache = NULL;
aom_free(td->mb.sb_fp_stats);
td->mb.sb_fp_stats = NULL; #if CONFIG_PARTITION_SEARCH_ORDER
aom_free(td->mb.rdcost);
td->mb.rdcost = NULL; #endif
av1_free_pc_tree_recursive(td->pc_root, num_planes, 0, 0, SEARCH_PARTITION);
td->pc_root = NULL;
av1_dealloc_mb_wiener_var_pred_buf(td);
aom_free(td);
thread_data->td = NULL;
thread_data->original_td = NULL;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.