| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | |
| 3 * | |
| 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 */ | |
| 10 | |
| 11 | |
| 12 /* This code is in the public domain. | |
| 13 ** Version: 1.1 Author: Walt Karas | |
| 14 */ | |
| 15 | |
| 16 #include "hmm_intrnl.h" | |
| 17 | |
| 18 U(size_aau) U(largest_available)(U(descriptor) *desc) { | |
| 19 U(size_bau) largest; | |
| 20 | |
| 21 if (!(desc->avl_tree_root)) | |
| 22 largest = 0; | |
| 23 else { | |
| 24 #ifdef HMM_AUDIT_FAIL | |
| 25 /* Audit root block in AVL tree. */ | |
| 26 AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root)) | |
| 27 #endif | |
| 28 | |
| 29 largest = | |
| 30 BLOCK_BAUS( | |
| 31 PTR_REC_TO_HEAD( | |
| 32 U(avl_search)( | |
| 33 (U(avl_avl) *) & (desc->avl_tree_root), | |
| 34 (U(size_bau)) ~(U(size_bau)) 0, AVL_LESS))); | |
| 35 } | |
| 36 | |
| 37 if (desc->last_freed) { | |
| 38 /* Size of last freed block. */ | |
| 39 register U(size_bau) lf_size; | |
| 40 | |
| 41 #ifdef HMM_AUDIT_FAIL | |
| 42 AUDIT_BLOCK(desc->last_freed) | |
| 43 #endif | |
| 44 | |
| 45 lf_size = BLOCK_BAUS(desc->last_freed); | |
| 46 | |
| 47 if (lf_size > largest) | |
| 48 largest = lf_size; | |
| 49 } | |
| 50 | |
| 51 /* Convert largest size to AAUs and subract head size leaving payload | |
| 52 ** size. | |
| 53 */ | |
| 54 return(largest ? | |
| 55 ((largest * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT)) - HEAD_AAUS) : | |
| 56 0); | |
| 57 } | |
| OLD | NEW |