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

Side by Side Diff: source/libvpx/vp9/common/vp9_prob.c

Issue 896343003: Cherry-pick potential divide-by-zero fix (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@m41-2272
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « source/libvpx/vp9/common/vp9_prob.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
(...skipping 11 matching lines...) Expand all
22 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
23 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
24 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
26 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
28 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
29 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 29 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
30 }; 30 };
31 31
32
33 static unsigned int tree_merge_probs_impl(unsigned int i, 32 static unsigned int tree_merge_probs_impl(unsigned int i,
34 const vp9_tree_index *tree, 33 const vp9_tree_index *tree,
35 const vp9_prob *pre_probs, 34 const vp9_prob *pre_probs,
36 const unsigned int *counts, 35 const unsigned int *counts,
37 unsigned int count_sat,
38 unsigned int max_update,
39 vp9_prob *probs) { 36 vp9_prob *probs) {
40 const int l = tree[i]; 37 const int l = tree[i];
41 const unsigned int left_count = (l <= 0) 38 const unsigned int left_count = (l <= 0)
42 ? counts[-l] 39 ? counts[-l]
43 : tree_merge_probs_impl(l, tree, pre_probs, counts, 40 : tree_merge_probs_impl(l, tree, pre_probs, counts, probs);
44 count_sat, max_update, probs);
45 const int r = tree[i + 1]; 41 const int r = tree[i + 1];
46 const unsigned int right_count = (r <= 0) 42 const unsigned int right_count = (r <= 0)
47 ? counts[-r] 43 ? counts[-r]
48 : tree_merge_probs_impl(r, tree, pre_probs, counts, 44 : tree_merge_probs_impl(r, tree, pre_probs, counts, probs);
49 count_sat, max_update, probs);
50 const unsigned int ct[2] = { left_count, right_count }; 45 const unsigned int ct[2] = { left_count, right_count };
51 probs[i >> 1] = merge_probs(pre_probs[i >> 1], ct, 46 probs[i >> 1] = mode_mv_merge_probs(pre_probs[i >> 1], ct);
52 count_sat, max_update);
53 return left_count + right_count; 47 return left_count + right_count;
54 } 48 }
55 49
56 void vp9_tree_merge_probs(const vp9_tree_index *tree, const vp9_prob *pre_probs, 50 void vp9_tree_merge_probs(const vp9_tree_index *tree, const vp9_prob *pre_probs,
57 const unsigned int *counts, unsigned int count_sat, 51 const unsigned int *counts, vp9_prob *probs) {
58 unsigned int max_update_factor, vp9_prob *probs) { 52 tree_merge_probs_impl(0, tree, pre_probs, counts, probs);
59 tree_merge_probs_impl(0, tree, pre_probs, counts, count_sat,
60 max_update_factor, probs);
61 } 53 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_prob.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698