loop_restoration: Cleanup allocations
Change-Id: Id3824c09cbaae814df1d8fb029215f28e8c7a6b1
This commit is contained in:
Родитель
4305e6be8e
Коммит
232e38475c
|
@ -95,11 +95,9 @@ void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
|
|||
av1_alloc_restoration_struct(
|
||||
cm, &cm->rst_info[p], ROUND_POWER_OF_TWO(cm->width, cm->subsampling_x),
|
||||
ROUND_POWER_OF_TWO(cm->height, cm->subsampling_y));
|
||||
cm->rst_internal.tmpbuf =
|
||||
(int32_t *)aom_realloc(cm->rst_internal.tmpbuf, RESTORATION_TMPBUF_SIZE);
|
||||
if (cm->rst_internal.tmpbuf == NULL)
|
||||
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to allocate internal tmpbuf for restoration");
|
||||
CHECK_MEM_ERROR(
|
||||
cm, cm->rst_internal.tmpbuf,
|
||||
(int32_t *)aom_realloc(cm->rst_internal.tmpbuf, RESTORATION_TMPBUF_SIZE));
|
||||
}
|
||||
|
||||
void av1_free_restoration_buffers(AV1_COMMON *cm) {
|
||||
|
|
|
@ -59,8 +59,10 @@ typedef void (*restore_func_highbd_type)(uint8_t *data8, int width, int height,
|
|||
int av1_alloc_restoration_struct(AV1_COMMON *cm, RestorationInfo *rst_info,
|
||||
int width, int height) {
|
||||
const int ntiles = av1_get_rest_ntiles(width, height, NULL, NULL, NULL, NULL);
|
||||
rst_info->restoration_type = (RestorationType *)aom_realloc(
|
||||
rst_info->restoration_type, sizeof(*rst_info->restoration_type) * ntiles);
|
||||
CHECK_MEM_ERROR(cm, rst_info->restoration_type,
|
||||
(RestorationType *)aom_realloc(
|
||||
rst_info->restoration_type,
|
||||
sizeof(*rst_info->restoration_type) * ntiles));
|
||||
aom_free(rst_info->wiener_info);
|
||||
CHECK_MEM_ERROR(
|
||||
cm, rst_info->wiener_info,
|
||||
|
@ -71,9 +73,6 @@ int av1_alloc_restoration_struct(AV1_COMMON *cm, RestorationInfo *rst_info,
|
|||
(SgrprojInfo *)aom_realloc(rst_info->sgrproj_info,
|
||||
sizeof(*rst_info->sgrproj_info) * ntiles));
|
||||
#if USE_DOMAINTXFMRF
|
||||
rst_info->domaintxfmrf_info = (DomaintxfmrfInfo *)aom_realloc(
|
||||
rst_info->domaintxfmrf_info,
|
||||
sizeof(*rst_info->domaintxfmrf_info) * ntiles);
|
||||
CHECK_MEM_ERROR(cm, rst_info->domaintxfmrf_info,
|
||||
(DomaintxfmrfInfo *)aom_realloc(
|
||||
rst_info->domaintxfmrf_info,
|
||||
|
|
|
@ -713,9 +713,6 @@ static void alloc_raw_frame_buffers(AV1_COMP *cpi) {
|
|||
}
|
||||
|
||||
static void alloc_util_frame_buffers(AV1_COMP *cpi) {
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
int i, extra_rstbuf_sz;
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
AV1_COMMON *const cm = &cpi->common;
|
||||
if (aom_realloc_frame_buffer(&cpi->last_frame_uf, cm->width, cm->height,
|
||||
cm->subsampling_x, cm->subsampling_y,
|
||||
|
@ -746,17 +743,14 @@ static void alloc_util_frame_buffers(AV1_COMP *cpi) {
|
|||
NULL, NULL))
|
||||
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to allocate trial restored frame buffer");
|
||||
extra_rstbuf_sz = RESTORATION_EXTBUF_SIZE;
|
||||
int extra_rstbuf_sz = RESTORATION_EXTBUF_SIZE;
|
||||
if (extra_rstbuf_sz > 0) {
|
||||
cpi->extra_rstbuf =
|
||||
(uint8_t *)aom_realloc(cpi->extra_rstbuf, extra_rstbuf_sz);
|
||||
if (!cpi->extra_rstbuf)
|
||||
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to allocate extra rstbuf for restoration");
|
||||
CHECK_MEM_ERROR(cm, cpi->extra_rstbuf,
|
||||
(uint8_t *)aom_realloc(cpi->extra_rstbuf, extra_rstbuf_sz));
|
||||
} else {
|
||||
cpi->extra_rstbuf = NULL;
|
||||
}
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i)
|
||||
for (int i = 0; i < MAX_MB_PLANE; ++i)
|
||||
av1_alloc_restoration_struct(cm, &cpi->rst_search[i], cm->width,
|
||||
cm->height);
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
|
|
Загрузка…
Ссылка в новой задаче