Merge "Skip computation of distortion in vp8_pick_inter_mode if active_map is used"
[libvpx.git] / vpx_mem / memory_manager / hmm_grow.c
blob9a4b6e416eac62a050e026418da31c040afdf482
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
12 /* This code is in the public domain.
13 ** Version: 1.1 Author: Walt Karas
16 #include "hmm_intrnl.h"
18 void U(grow_chunk)(U(descriptor) *desc, void *end, U(size_bau) n_baus)
20 #undef HEAD_PTR
21 #define HEAD_PTR ((head_record *) end)
23 end = BAUS_BACKWARD(end, DUMMY_END_BLOCK_BAUS);
25 #ifdef HMM_AUDIT_FAIL
27 if (HEAD_PTR->block_size != 0)
28 /* Chunk does not have valid dummy end block. */
29 HMM_AUDIT_FAIL
31 #endif
33 /* Create a new block that absorbs the old dummy end block. */
34 HEAD_PTR->block_size = n_baus;
36 /* Set up the new dummy end block. */
38 head_record *dummy = (head_record *) BAUS_FORWARD(end, n_baus);
39 dummy->previous_block_size = n_baus;
40 dummy->block_size = 0;
43 /* Simply free the new block, allowing it to coalesce with any
44 ** free block at that was the last block in the chunk prior to
45 ** growth.
47 U(free)(desc, HEAD_TO_PTR_REC(end));
49 #undef HEAD_PTR