summaryrefslogtreecommitdiffstats
path: root/third_party/aom/av1/common/alloccommon.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/av1/common/alloccommon.c')
-rw-r--r--third_party/aom/av1/common/alloccommon.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/third_party/aom/av1/common/alloccommon.c b/third_party/aom/av1/common/alloccommon.c
index 79d41a9c8..80f6b095f 100644
--- a/third_party/aom/av1/common/alloccommon.c
+++ b/third_party/aom/av1/common/alloccommon.c
@@ -125,6 +125,11 @@ void av1_free_context_buffers(AV1_COMMON *cm) {
#if CONFIG_VAR_TX
aom_free(cm->above_txfm_context);
cm->above_txfm_context = NULL;
+
+ for (i = 0; i < MAX_MB_PLANE; ++i) {
+ aom_free(cm->top_txfm_context[i]);
+ cm->top_txfm_context[i] = NULL;
+ }
#endif
}
@@ -155,7 +160,8 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
for (i = 0; i < MAX_MB_PLANE; i++) {
aom_free(cm->above_context[i]);
cm->above_context[i] = (ENTROPY_CONTEXT *)aom_calloc(
- 2 * aligned_mi_cols, sizeof(*cm->above_context[0]));
+ aligned_mi_cols << (MI_SIZE_LOG2 - tx_size_wide_log2[0]),
+ sizeof(*cm->above_context[0]));
if (!cm->above_context[i]) goto fail;
}
@@ -167,8 +173,16 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
#if CONFIG_VAR_TX
aom_free(cm->above_txfm_context);
cm->above_txfm_context = (TXFM_CONTEXT *)aom_calloc(
- aligned_mi_cols, sizeof(*cm->above_txfm_context));
+ aligned_mi_cols << TX_UNIT_WIDE_LOG2, sizeof(*cm->above_txfm_context));
if (!cm->above_txfm_context) goto fail;
+
+ for (i = 0; i < MAX_MB_PLANE; ++i) {
+ aom_free(cm->top_txfm_context[i]);
+ cm->top_txfm_context[i] =
+ (TXFM_CONTEXT *)aom_calloc(aligned_mi_cols << TX_UNIT_WIDE_LOG2,
+ sizeof(*cm->top_txfm_context[0]));
+ if (!cm->top_txfm_context[i]) goto fail;
+ }
#endif
cm->above_context_alloc_cols = aligned_mi_cols;