Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: source/libvpx/vpx_mem/memory_manager/hmm_largest.c

Issue 11555023: libvpx: Add VP9 decoder. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 11
12 /* This code is in the public domain. 12 /* This code is in the public domain.
13 ** Version: 1.1 Author: Walt Karas 13 ** Version: 1.1 Author: Walt Karas
14 */ 14 */
15 15
16 #include "hmm_intrnl.h" 16 #include "hmm_intrnl.h"
17 17
18 U(size_aau) U(largest_available)(U(descriptor) *desc) 18 U(size_aau) U(largest_available)(U(descriptor) *desc) {
19 { 19 U(size_bau) largest;
20 U(size_bau) largest;
21 20
22 if (!(desc->avl_tree_root)) 21 if (!(desc->avl_tree_root))
23 largest = 0; 22 largest = 0;
24 else 23 else {
25 {
26 #ifdef HMM_AUDIT_FAIL 24 #ifdef HMM_AUDIT_FAIL
27 /* Audit root block in AVL tree. */ 25 /* Audit root block in AVL tree. */
28 AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root)) 26 AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
29 #endif 27 #endif
30 28
31 largest = 29 largest =
32 BLOCK_BAUS( 30 BLOCK_BAUS(
33 PTR_REC_TO_HEAD( 31 PTR_REC_TO_HEAD(
34 U(avl_search)( 32 U(avl_search)(
35 (U(avl_avl) *) & (desc->avl_tree_root), 33 (U(avl_avl) *) & (desc->avl_tree_root),
36 (U(size_bau)) ~(U(size_bau)) 0, AVL_LESS))); 34 (U(size_bau)) ~(U(size_bau)) 0, AVL_LESS)));
37 } 35 }
38 36
39 if (desc->last_freed) 37 if (desc->last_freed) {
40 { 38 /* Size of last freed block. */
41 /* Size of last freed block. */ 39 register U(size_bau) lf_size;
42 register U(size_bau) lf_size;
43 40
44 #ifdef HMM_AUDIT_FAIL 41 #ifdef HMM_AUDIT_FAIL
45 AUDIT_BLOCK(desc->last_freed) 42 AUDIT_BLOCK(desc->last_freed)
46 #endif 43 #endif
47 44
48 lf_size = BLOCK_BAUS(desc->last_freed); 45 lf_size = BLOCK_BAUS(desc->last_freed);
49 46
50 if (lf_size > largest) 47 if (lf_size > largest)
51 largest = lf_size; 48 largest = lf_size;
52 } 49 }
53 50
54 /* Convert largest size to AAUs and subract head size leaving payload 51 /* Convert largest size to AAUs and subract head size leaving payload
55 ** size. 52 ** size.
56 */ 53 */
57 return(largest ? 54 return(largest ?
58 ((largest * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT)) - HEAD_AAUS) : 55 ((largest * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT)) - HEAD_AAUS) :
59 0); 56 0);
60 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698