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

Side by Side Diff: source/libvpx/vp8/common/findnearmv.c

Issue 7671004: Update libvpx snapshot to v0.9.7-p1 (Cayuga). (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: '' Created 9 years, 4 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 | 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 #include "findnearmv.h" 12 #include "findnearmv.h"
13 13
14 const unsigned char vp8_mbsplit_offset[4][16] = { 14 const unsigned char vp8_mbsplit_offset[4][16] = {
15 { 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 15 { 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
16 { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 16 { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
17 { 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 17 { 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
18 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} 18 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
19 }; 19 };
20 20
21 /* Predict motion vectors using those from already-decoded nearby blocks. 21 /* Predict motion vectors using those from already-decoded nearby blocks.
22 Note that we only consider one 4x4 subblock from each candidate 16x16 22 Note that we only consider one 4x4 subblock from each candidate 16x16
23 macroblock. */ 23 macroblock. */
24 void vp8_find_near_mvs 24 void vp8_find_near_mvs
25 ( 25 (
26 MACROBLOCKD *xd, 26 MACROBLOCKD *xd,
27 const MODE_INFO *here, 27 const MODE_INFO *here,
28 MV *nearest, 28 int_mv *nearest,
29 MV *nearby, 29 int_mv *nearby,
30 MV *best_mv, 30 int_mv *best_mv,
31 int cnt[4], 31 int cnt[4],
32 int refframe, 32 int refframe,
33 int *ref_frame_sign_bias 33 int *ref_frame_sign_bias
34 ) 34 )
35 { 35 {
36 const MODE_INFO *above = here - xd->mode_info_stride; 36 const MODE_INFO *above = here - xd->mode_info_stride;
37 const MODE_INFO *left = here - 1; 37 const MODE_INFO *left = here - 1;
38 const MODE_INFO *aboveleft = above - 1; 38 const MODE_INFO *aboveleft = above - 1;
39 int_mv near_mvs[4]; 39 int_mv near_mvs[4];
40 int_mv *mv = near_mvs; 40 int_mv *mv = near_mvs;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 tmp = near_mvs[CNT_NEAREST].as_int; 124 tmp = near_mvs[CNT_NEAREST].as_int;
125 near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int; 125 near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
126 near_mvs[CNT_NEAR].as_int = tmp; 126 near_mvs[CNT_NEAR].as_int = tmp;
127 } 127 }
128 128
129 /* Use near_mvs[0] to store the "best" MV */ 129 /* Use near_mvs[0] to store the "best" MV */
130 if (cnt[CNT_NEAREST] >= cnt[CNT_INTRA]) 130 if (cnt[CNT_NEAREST] >= cnt[CNT_INTRA])
131 near_mvs[CNT_INTRA] = near_mvs[CNT_NEAREST]; 131 near_mvs[CNT_INTRA] = near_mvs[CNT_NEAREST];
132 132
133 /* Set up return values */ 133 /* Set up return values */
134 *best_mv = near_mvs[0].as_mv; 134 best_mv->as_int = near_mvs[0].as_int;
135 *nearest = near_mvs[CNT_NEAREST].as_mv; 135 nearest->as_int = near_mvs[CNT_NEAREST].as_int;
136 *nearby = near_mvs[CNT_NEAR].as_mv; 136 nearby->as_int = near_mvs[CNT_NEAR].as_int;
137 137
138 vp8_clamp_mv(nearest, xd); 138 //TODO: move clamp outside findnearmv
139 vp8_clamp_mv(nearby, xd); 139 vp8_clamp_mv2(nearest, xd);
140 vp8_clamp_mv(best_mv, xd); /*TODO: move this up before the copy*/ 140 vp8_clamp_mv2(nearby, xd);
141 vp8_clamp_mv2(best_mv, xd);
141 } 142 }
142 143
143 vp8_prob *vp8_mv_ref_probs( 144 vp8_prob *vp8_mv_ref_probs(
144 vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4] 145 vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
145 ) 146 )
146 { 147 {
147 p[0] = vp8_mode_contexts [near_mv_ref_ct[0]] [0]; 148 p[0] = vp8_mode_contexts [near_mv_ref_ct[0]] [0];
148 p[1] = vp8_mode_contexts [near_mv_ref_ct[1]] [1]; 149 p[1] = vp8_mode_contexts [near_mv_ref_ct[1]] [1];
149 p[2] = vp8_mode_contexts [near_mv_ref_ct[2]] [2]; 150 p[2] = vp8_mode_contexts [near_mv_ref_ct[2]] [2];
150 p[3] = vp8_mode_contexts [near_mv_ref_ct[3]] [3]; 151 p[3] = vp8_mode_contexts [near_mv_ref_ct[3]] [3];
151 /*p[3] = vp8_mode_contexts [near_mv_ref_ct[1] + near_mv_ref_ct[2] + near_mv_ ref_ct[3]] [3];*/ 152 /*p[3] = vp8_mode_contexts [near_mv_ref_ct[1] + near_mv_ref_ct[2] + near_mv_ ref_ct[3]] [3];*/
152 return p; 153 return p;
153 } 154 }
154 155
155 const B_MODE_INFO *vp8_left_bmi(const MODE_INFO *cur_mb, int b)
156 {
157 if (!(b & 3))
158 {
159 /* On L edge, get from MB to left of us */
160 --cur_mb;
161 b += 4;
162 }
163
164 return cur_mb->bmi + b - 1;
165 }
166
167 const B_MODE_INFO *vp8_above_bmi(const MODE_INFO *cur_mb, int b, int mi_stride)
168 {
169 if (!(b >> 2))
170 {
171 /* On top edge, get from MB above us */
172 cur_mb -= mi_stride;
173 b += 16;
174 }
175
176 return cur_mb->bmi + b - 4;
177 }
OLDNEW
« no previous file with comments | « source/libvpx/vp8/common/findnearmv.h ('k') | source/libvpx/vp8/common/generic/systemdependent.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698