OLD | NEW |
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 int vp9_prob_diff_update_savings_search_model(const unsigned int *ct, | 140 int vp9_prob_diff_update_savings_search_model(const unsigned int *ct, |
141 const vp9_prob *oldp, | 141 const vp9_prob *oldp, |
142 vp9_prob *bestp, | 142 vp9_prob *bestp, |
143 vp9_prob upd, | 143 vp9_prob upd, |
144 int stepsize) { | 144 int stepsize) { |
145 int i, old_b, new_b, update_b, savings, bestsavings, step; | 145 int i, old_b, new_b, update_b, savings, bestsavings, step; |
146 int newp; | 146 int newp; |
147 vp9_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES]; | 147 vp9_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES]; |
148 vp9_model_to_full_probs(oldp, oldplist); | 148 vp9_model_to_full_probs(oldp, oldplist); |
149 vpx_memcpy(newplist, oldp, sizeof(vp9_prob) * UNCONSTRAINED_NODES); | 149 memcpy(newplist, oldp, sizeof(vp9_prob) * UNCONSTRAINED_NODES); |
150 for (i = UNCONSTRAINED_NODES, old_b = 0; i < ENTROPY_NODES; ++i) | 150 for (i = UNCONSTRAINED_NODES, old_b = 0; i < ENTROPY_NODES; ++i) |
151 old_b += cost_branch256(ct + 2 * i, oldplist[i]); | 151 old_b += cost_branch256(ct + 2 * i, oldplist[i]); |
152 old_b += cost_branch256(ct + 2 * PIVOT_NODE, oldplist[PIVOT_NODE]); | 152 old_b += cost_branch256(ct + 2 * PIVOT_NODE, oldplist[PIVOT_NODE]); |
153 | 153 |
154 bestsavings = 0; | 154 bestsavings = 0; |
155 bestnewp = oldp[PIVOT_NODE]; | 155 bestnewp = oldp[PIVOT_NODE]; |
156 | 156 |
157 if (*bestp > oldp[PIVOT_NODE]) { | 157 if (*bestp > oldp[PIVOT_NODE]) { |
158 step = -stepsize; | 158 step = -stepsize; |
159 for (newp = *bestp; newp > oldp[PIVOT_NODE]; newp += step) { | 159 for (newp = *bestp; newp > oldp[PIVOT_NODE]; newp += step) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 upd); | 204 upd); |
205 assert(newp >= 1); | 205 assert(newp >= 1); |
206 if (savings > 0) { | 206 if (savings > 0) { |
207 vp9_write(w, 1, upd); | 207 vp9_write(w, 1, upd); |
208 vp9_write_prob_diff_update(w, newp, *oldp); | 208 vp9_write_prob_diff_update(w, newp, *oldp); |
209 *oldp = newp; | 209 *oldp = newp; |
210 } else { | 210 } else { |
211 vp9_write(w, 0, upd); | 211 vp9_write(w, 0, upd); |
212 } | 212 } |
213 } | 213 } |
OLD | NEW |