| * Copyright (c) 2016 The WebM project authors. All Rights Reserved. |
| * Use of this source code is governed by a BSD-style license |
| * that can be found in the LICENSE file in the root of the source |
| * tree. An additional intellectual property rights grant can be found |
| * in the file PATENTS. All contributing project authors may |
| * be found in the AUTHORS file in the root of the source tree. |
| #include "av1/common/common.h" |
| #include "av1/encoder/buf_ans.h" |
| #include "av1/encoder/encoder.h" |
| #include "aom_mem/aom_mem.h" |
| void av1_buf_ans_alloc(struct BufAnsCoder *c, struct AV1Common *cm, |
| CHECK_MEM_ERROR(cm, c->buf, aom_malloc(c->size * sizeof(*c->buf))); |
| // Initialize to overfull to trigger the assert in write. |
| void av1_buf_ans_free(struct BufAnsCoder *c) { |
| void av1_buf_ans_grow(struct BufAnsCoder *c) { |
| struct buffered_ans_symbol *new_buf = NULL; |
| int new_size = c->size * 2; |
| CHECK_MEM_ERROR(c->cm, new_buf, aom_malloc(new_size * sizeof(*new_buf))); |
| memcpy(new_buf, c->buf, c->size * sizeof(*c->buf)); |