OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 3 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license | 5 * Use of this source code is governed by a BSD-style license |
6 * that can be found in the LICENSE file in the root of the source | 6 * that can be found in the LICENSE file in the root of the source |
7 * tree. An additional intellectual property rights grant can be found | 7 * tree. An additional intellectual property rights grant can be found |
8 * in the file PATENTS. All contributing project authors may | 8 * in the file PATENTS. All contributing project authors may |
9 * be found in the AUTHORS file in the root of the source tree. | 9 * be found in the AUTHORS file in the root of the source tree. |
10 */ | 10 */ |
11 | 11 |
12 #include <limits.h> | 12 #include <limits.h> |
13 | 13 |
14 #include "vp9/common/vp9_common.h" | 14 #include "vp9/common/vp9_common.h" |
15 #include "vp9/common/vp9_pred_common.h" | 15 #include "vp9/common/vp9_pred_common.h" |
16 #include "vp9/common/vp9_seg_common.h" | 16 #include "vp9/common/vp9_seg_common.h" |
17 #include "vp9/common/vp9_treecoder.h" | 17 #include "vp9/common/vp9_treecoder.h" |
18 | 18 |
| 19 static INLINE const MB_MODE_INFO *get_above_mbmi(const MODE_INFO *const above) { |
| 20 return (above != NULL) ? &above->mbmi : NULL; |
| 21 } |
| 22 |
| 23 static INLINE const MB_MODE_INFO *get_left_mbmi(const MODE_INFO *const left) { |
| 24 return (left != NULL) ? &left->mbmi : NULL; |
| 25 } |
| 26 |
19 // Returns a context number for the given MB prediction signal | 27 // Returns a context number for the given MB prediction signal |
20 unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) { | 28 unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) { |
21 const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride]; | 29 const MODE_INFO *const above_mi = get_above_mi(xd); |
22 const MODE_INFO * const left_mi = xd->mi_8x8[-1]; | 30 const MODE_INFO *const left_mi = get_left_mi(xd); |
23 const int left_in_image = xd->left_available && left_mi; | 31 const int above_in_image = above_mi != NULL; |
24 const int above_in_image = xd->up_available && above_mi; | 32 const int left_in_image = left_mi != NULL; |
25 // Note: | 33 // Note: |
26 // The mode info data structure has a one element border above and to the | 34 // The mode info data structure has a one element border above and to the |
27 // left of the entries correpsonding to real macroblocks. | 35 // left of the entries correpsonding to real macroblocks. |
28 // The prediction flags in these dummy entries are initialised to 0. | 36 // The prediction flags in these dummy entries are initialised to 0. |
29 // left | 37 // left |
30 const int left_mv_pred = left_in_image ? is_inter_mode(left_mi->mbmi.mode) | 38 const int left_mv_pred = left_in_image ? is_inter_block(&left_mi->mbmi) |
31 : 0; | 39 : 0; |
32 const int left_interp = left_in_image && left_mv_pred | 40 const int left_interp = left_in_image && left_mv_pred |
33 ? left_mi->mbmi.interp_filter | 41 ? left_mi->mbmi.interp_filter |
34 : SWITCHABLE_FILTERS; | 42 : SWITCHABLE_FILTERS; |
35 | 43 |
36 // above | 44 // above |
37 const int above_mv_pred = above_in_image ? is_inter_mode(above_mi->mbmi.mode) | 45 const int above_mv_pred = above_in_image ? is_inter_block(&above_mi->mbmi) |
38 : 0; | 46 : 0; |
39 const int above_interp = above_in_image && above_mv_pred | 47 const int above_interp = above_in_image && above_mv_pred |
40 ? above_mi->mbmi.interp_filter | 48 ? above_mi->mbmi.interp_filter |
41 : SWITCHABLE_FILTERS; | 49 : SWITCHABLE_FILTERS; |
42 | 50 |
43 if (left_interp == above_interp) | 51 if (left_interp == above_interp) |
44 return left_interp; | 52 return left_interp; |
45 else if (left_interp == SWITCHABLE_FILTERS && | 53 else if (left_interp == SWITCHABLE_FILTERS && |
46 above_interp != SWITCHABLE_FILTERS) | 54 above_interp != SWITCHABLE_FILTERS) |
47 return above_interp; | 55 return above_interp; |
48 else if (left_interp != SWITCHABLE_FILTERS && | 56 else if (left_interp != SWITCHABLE_FILTERS && |
49 above_interp == SWITCHABLE_FILTERS) | 57 above_interp == SWITCHABLE_FILTERS) |
50 return left_interp; | 58 return left_interp; |
51 else | 59 else |
52 return SWITCHABLE_FILTERS; | 60 return SWITCHABLE_FILTERS; |
53 } | 61 } |
54 // Returns a context number for the given MB prediction signal | 62 // Returns a context number for the given MB prediction signal |
55 unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd) { | 63 unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd) { |
56 const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride]; | 64 const MODE_INFO *const above_mi = get_above_mi(xd); |
57 const MODE_INFO * const left_mi = xd->mi_8x8[-1]; | 65 const MODE_INFO *const left_mi = get_left_mi(xd); |
58 const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0; | 66 const MB_MODE_INFO *const above_mbmi = get_above_mbmi(above_mi); |
59 const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0; | 67 const MB_MODE_INFO *const left_mbmi = get_left_mbmi(left_mi); |
60 const int left_in_image = xd->left_available && left_mi; | 68 const int above_in_image = above_mi != NULL; |
61 const int above_in_image = xd->up_available && above_mi; | 69 const int left_in_image = left_mi != NULL; |
| 70 const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1; |
62 const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1; | 71 const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1; |
63 const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1; | |
64 | 72 |
65 // The mode info data structure has a one element border above and to the | 73 // The mode info data structure has a one element border above and to the |
66 // left of the entries corresponding to real macroblocks. | 74 // left of the entries corresponding to real macroblocks. |
67 // The prediction flags in these dummy entries are initialized to 0. | 75 // The prediction flags in these dummy entries are initialized to 0. |
68 // 0 - inter/inter, inter/--, --/inter, --/-- | 76 // 0 - inter/inter, inter/--, --/inter, --/-- |
69 // 1 - intra/inter, inter/intra | 77 // 1 - intra/inter, inter/intra |
70 // 2 - intra/--, --/intra | 78 // 2 - intra/--, --/intra |
71 // 3 - intra/intra | 79 // 3 - intra/intra |
72 if (above_in_image && left_in_image) // both edges available | 80 if (above_in_image && left_in_image) // both edges available |
73 return left_intra && above_intra ? 3 | 81 return left_intra && above_intra ? 3 |
74 : left_intra || above_intra; | 82 : left_intra || above_intra; |
75 else if (above_in_image || left_in_image) // one edge available | 83 else if (above_in_image || left_in_image) // one edge available |
76 return 2 * (above_in_image ? above_intra : left_intra); | 84 return 2 * (above_in_image ? above_intra : left_intra); |
77 else | 85 else |
78 return 0; | 86 return 0; |
79 } | 87 } |
80 // Returns a context number for the given MB prediction signal | 88 // Returns a context number for the given MB prediction signal |
81 unsigned char vp9_get_pred_context_comp_inter_inter(const VP9_COMMON *cm, | 89 unsigned char vp9_get_pred_context_comp_inter_inter(const VP9_COMMON *cm, |
82 const MACROBLOCKD *xd) { | 90 const MACROBLOCKD *xd) { |
83 int pred_context; | 91 int pred_context; |
84 const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride]; | 92 const MODE_INFO *const above_mi = get_above_mi(xd); |
85 const MODE_INFO * const left_mi = xd->mi_8x8[-1]; | 93 const MODE_INFO *const left_mi = get_left_mi(xd); |
86 const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0; | 94 const MB_MODE_INFO *const above_mbmi = get_above_mbmi(above_mi); |
87 const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0; | 95 const MB_MODE_INFO *const left_mbmi = get_left_mbmi(left_mi); |
88 const int left_in_image = xd->left_available && left_mi; | 96 const int above_in_image = above_mi != NULL; |
89 const int above_in_image = xd->up_available && above_mi; | 97 const int left_in_image = left_mi != NULL; |
90 // Note: | 98 // Note: |
91 // The mode info data structure has a one element border above and to the | 99 // The mode info data structure has a one element border above and to the |
92 // left of the entries correpsonding to real macroblocks. | 100 // left of the entries correpsonding to real macroblocks. |
93 // The prediction flags in these dummy entries are initialised to 0. | 101 // The prediction flags in these dummy entries are initialised to 0. |
94 if (above_in_image && left_in_image) { // both edges available | 102 if (above_in_image && left_in_image) { // both edges available |
95 if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi)) | 103 if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi)) |
96 // neither edge uses comp pred (0/1) | 104 // neither edge uses comp pred (0/1) |
97 pred_context = (above_mbmi->ref_frame[0] == cm->comp_fixed_ref) ^ | 105 pred_context = (above_mbmi->ref_frame[0] == cm->comp_fixed_ref) ^ |
98 (left_mbmi->ref_frame[0] == cm->comp_fixed_ref); | 106 (left_mbmi->ref_frame[0] == cm->comp_fixed_ref); |
99 else if (!has_second_ref(above_mbmi)) | 107 else if (!has_second_ref(above_mbmi)) |
(...skipping 19 matching lines...) Expand all Loading... |
119 pred_context = 1; | 127 pred_context = 1; |
120 } | 128 } |
121 assert(pred_context >= 0 && pred_context < COMP_INTER_CONTEXTS); | 129 assert(pred_context >= 0 && pred_context < COMP_INTER_CONTEXTS); |
122 return pred_context; | 130 return pred_context; |
123 } | 131 } |
124 | 132 |
125 // Returns a context number for the given MB prediction signal | 133 // Returns a context number for the given MB prediction signal |
126 unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm, | 134 unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm, |
127 const MACROBLOCKD *xd) { | 135 const MACROBLOCKD *xd) { |
128 int pred_context; | 136 int pred_context; |
129 const MODE_INFO * const above_mi = xd->mi_8x8[-cm->mode_info_stride]; | 137 const MODE_INFO *const above_mi = get_above_mi(xd); |
130 const MODE_INFO * const left_mi = xd->mi_8x8[-1]; | 138 const MODE_INFO *const left_mi = get_left_mi(xd); |
131 const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0; | 139 const MB_MODE_INFO *const above_mbmi = get_above_mbmi(above_mi); |
132 const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0; | 140 const MB_MODE_INFO *const left_mbmi = get_left_mbmi(left_mi); |
133 const int left_in_image = xd->left_available && left_mi; | 141 const int above_in_image = above_mi != NULL; |
134 const int above_in_image = xd->up_available && above_mi; | 142 const int left_in_image = left_mi != NULL; |
| 143 const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1; |
135 const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1; | 144 const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1; |
136 const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1; | |
137 // Note: | 145 // Note: |
138 // The mode info data structure has a one element border above and to the | 146 // The mode info data structure has a one element border above and to the |
139 // left of the entries correpsonding to real macroblocks. | 147 // left of the entries correpsonding to real macroblocks. |
140 // The prediction flags in these dummy entries are initialised to 0. | 148 // The prediction flags in these dummy entries are initialised to 0. |
141 const int fix_ref_idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref]; | 149 const int fix_ref_idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref]; |
142 const int var_ref_idx = !fix_ref_idx; | 150 const int var_ref_idx = !fix_ref_idx; |
143 | 151 |
144 if (above_in_image && left_in_image) { // both edges available | 152 if (above_in_image && left_in_image) { // both edges available |
145 if (above_intra && left_intra) { // intra/intra (2) | 153 if (above_intra && left_intra) { // intra/intra (2) |
146 pred_context = 2; | 154 pred_context = 2; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 207 } |
200 } else { // no edges available (2) | 208 } else { // no edges available (2) |
201 pred_context = 2; | 209 pred_context = 2; |
202 } | 210 } |
203 assert(pred_context >= 0 && pred_context < REF_CONTEXTS); | 211 assert(pred_context >= 0 && pred_context < REF_CONTEXTS); |
204 | 212 |
205 return pred_context; | 213 return pred_context; |
206 } | 214 } |
207 unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) { | 215 unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) { |
208 int pred_context; | 216 int pred_context; |
209 const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride]; | 217 const MODE_INFO *const above_mi = get_above_mi(xd); |
210 const MODE_INFO * const left_mi = xd->mi_8x8[-1]; | 218 const MODE_INFO *const left_mi = get_left_mi(xd); |
211 const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0; | 219 const MB_MODE_INFO *const above_mbmi = get_above_mbmi(above_mi); |
212 const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0; | 220 const MB_MODE_INFO *const left_mbmi = get_left_mbmi(left_mi); |
213 const int left_in_image = xd->left_available && left_mi; | 221 const int above_in_image = above_mi != NULL; |
214 const int above_in_image = xd->up_available && above_mi; | 222 const int left_in_image = left_mi != NULL; |
| 223 const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1; |
215 const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1; | 224 const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1; |
216 const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1; | |
217 // Note: | 225 // Note: |
218 // The mode info data structure has a one element border above and to the | 226 // The mode info data structure has a one element border above and to the |
219 // left of the entries correpsonding to real macroblocks. | 227 // left of the entries correpsonding to real macroblocks. |
220 // The prediction flags in these dummy entries are initialised to 0. | 228 // The prediction flags in these dummy entries are initialised to 0. |
221 if (above_in_image && left_in_image) { // both edges available | 229 if (above_in_image && left_in_image) { // both edges available |
222 if (above_intra && left_intra) { // intra/intra | 230 if (above_intra && left_intra) { // intra/intra |
223 pred_context = 2; | 231 pred_context = 2; |
224 } else if (above_intra || left_intra) { // intra/inter or inter/intra | 232 } else if (above_intra || left_intra) { // intra/inter or inter/intra |
225 const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi; | 233 const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi; |
226 if (!has_second_ref(edge_mbmi)) | 234 if (!has_second_ref(edge_mbmi)) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } else { // no edges available | 273 } else { // no edges available |
266 pred_context = 2; | 274 pred_context = 2; |
267 } | 275 } |
268 | 276 |
269 assert(pred_context >= 0 && pred_context < REF_CONTEXTS); | 277 assert(pred_context >= 0 && pred_context < REF_CONTEXTS); |
270 return pred_context; | 278 return pred_context; |
271 } | 279 } |
272 | 280 |
273 unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) { | 281 unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) { |
274 int pred_context; | 282 int pred_context; |
275 const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride]; | 283 const MODE_INFO *const above_mi = get_above_mi(xd); |
276 const MODE_INFO * const left_mi = xd->mi_8x8[-1]; | 284 const MODE_INFO *const left_mi = get_left_mi(xd); |
277 const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0; | 285 const MB_MODE_INFO *const above_mbmi = get_above_mbmi(above_mi); |
278 const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0; | 286 const MB_MODE_INFO *const left_mbmi = get_left_mbmi(left_mi); |
279 const int left_in_image = xd->left_available && left_mi; | 287 const int above_in_image = above_mi != NULL; |
280 const int above_in_image = xd->up_available && above_mi; | 288 const int left_in_image = left_mi != NULL; |
| 289 const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1; |
281 const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1; | 290 const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1; |
282 const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1; | |
283 | 291 |
284 // Note: | 292 // Note: |
285 // The mode info data structure has a one element border above and to the | 293 // The mode info data structure has a one element border above and to the |
286 // left of the entries correpsonding to real macroblocks. | 294 // left of the entries correpsonding to real macroblocks. |
287 // The prediction flags in these dummy entries are initialised to 0. | 295 // The prediction flags in these dummy entries are initialised to 0. |
288 if (above_in_image && left_in_image) { // both edges available | 296 if (above_in_image && left_in_image) { // both edges available |
289 if (above_intra && left_intra) { // intra/intra | 297 if (above_intra && left_intra) { // intra/intra |
290 pred_context = 2; | 298 pred_context = 2; |
291 } else if (above_intra || left_intra) { // intra/inter or inter/intra | 299 } else if (above_intra || left_intra) { // intra/inter or inter/intra |
292 const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi; | 300 const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 pred_context = 2; | 362 pred_context = 2; |
355 } | 363 } |
356 assert(pred_context >= 0 && pred_context < REF_CONTEXTS); | 364 assert(pred_context >= 0 && pred_context < REF_CONTEXTS); |
357 return pred_context; | 365 return pred_context; |
358 } | 366 } |
359 // Returns a context number for the given MB prediction signal | 367 // Returns a context number for the given MB prediction signal |
360 // The mode info data structure has a one element border above and to the | 368 // The mode info data structure has a one element border above and to the |
361 // left of the entries corresponding to real blocks. | 369 // left of the entries corresponding to real blocks. |
362 // The prediction flags in these dummy entries are initialized to 0. | 370 // The prediction flags in these dummy entries are initialized to 0. |
363 unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd) { | 371 unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd) { |
364 const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride]; | 372 const MODE_INFO *const above_mi = get_above_mi(xd); |
365 const MODE_INFO * const left_mi = xd->mi_8x8[-1]; | 373 const MODE_INFO *const left_mi = get_left_mi(xd); |
366 const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0; | 374 const MB_MODE_INFO *const above_mbmi = get_above_mbmi(above_mi); |
367 const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0; | 375 const MB_MODE_INFO *const left_mbmi = get_left_mbmi(left_mi); |
368 const int left_in_image = xd->left_available && left_mi; | 376 const int above_in_image = above_mi != NULL; |
369 const int above_in_image = xd->up_available && above_mi; | 377 const int left_in_image = left_mi != NULL; |
370 const int max_tx_size = max_txsize_lookup[xd->mi_8x8[0]->mbmi.sb_type]; | 378 const int max_tx_size = max_txsize_lookup[xd->mi_8x8[0]->mbmi.sb_type]; |
371 int above_context = max_tx_size; | 379 int above_context = max_tx_size; |
372 int left_context = max_tx_size; | 380 int left_context = max_tx_size; |
373 | 381 |
374 if (above_in_image) | 382 if (above_in_image) |
375 above_context = above_mbmi->skip_coeff ? max_tx_size | 383 above_context = above_mbmi->skip_coeff ? max_tx_size |
376 : above_mbmi->tx_size; | 384 : above_mbmi->tx_size; |
377 | 385 |
378 if (left_in_image) | 386 if (left_in_image) |
379 left_context = left_mbmi->skip_coeff ? max_tx_size | 387 left_context = left_mbmi->skip_coeff ? max_tx_size |
380 : left_mbmi->tx_size; | 388 : left_mbmi->tx_size; |
381 | 389 |
382 if (!left_in_image) | 390 if (!left_in_image) |
383 left_context = above_context; | 391 left_context = above_context; |
384 | 392 |
385 if (!above_in_image) | 393 if (!above_in_image) |
386 above_context = left_context; | 394 above_context = left_context; |
387 | 395 |
388 return above_context + left_context > max_tx_size; | 396 return above_context + left_context > max_tx_size; |
389 } | 397 } |
390 | 398 |
391 void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, uint8_t pred_flag) { | 399 void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, uint8_t pred_flag) { |
392 xd->this_mi->mbmi.seg_id_predicted = pred_flag; | 400 xd->mi_8x8[0]->mbmi.seg_id_predicted = pred_flag; |
393 } | |
394 | |
395 void vp9_set_pred_flag_mbskip(MACROBLOCKD *xd, BLOCK_SIZE bsize, | |
396 uint8_t pred_flag) { | |
397 xd->this_mi->mbmi.skip_coeff = pred_flag; | |
398 } | 401 } |
399 | 402 |
400 int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids, | 403 int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids, |
401 BLOCK_SIZE bsize, int mi_row, int mi_col) { | 404 BLOCK_SIZE bsize, int mi_row, int mi_col) { |
402 const int mi_offset = mi_row * cm->mi_cols + mi_col; | 405 const int mi_offset = mi_row * cm->mi_cols + mi_col; |
403 const int bw = 1 << mi_width_log2(bsize); | 406 const int bw = 1 << mi_width_log2(bsize); |
404 const int bh = 1 << mi_height_log2(bsize); | 407 const int bh = 1 << mi_height_log2(bsize); |
405 const int xmis = MIN(cm->mi_cols - mi_col, bw); | 408 const int xmis = MIN(cm->mi_cols - mi_col, bw); |
406 const int ymis = MIN(cm->mi_rows - mi_row, bh); | 409 const int ymis = MIN(cm->mi_rows - mi_row, bh); |
407 int x, y, segment_id = INT_MAX; | 410 int x, y, segment_id = INT_MAX; |
408 | 411 |
409 for (y = 0; y < ymis; y++) | 412 for (y = 0; y < ymis; y++) |
410 for (x = 0; x < xmis; x++) | 413 for (x = 0; x < xmis; x++) |
411 segment_id = MIN(segment_id, | 414 segment_id = MIN(segment_id, |
412 segment_ids[mi_offset + y * cm->mi_cols + x]); | 415 segment_ids[mi_offset + y * cm->mi_cols + x]); |
413 | 416 |
414 assert(segment_id >= 0 && segment_id < MAX_SEGMENTS); | 417 assert(segment_id >= 0 && segment_id < MAX_SEGMENTS); |
415 return segment_id; | 418 return segment_id; |
416 } | 419 } |
OLD | NEW |