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 */ |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // Returns a context number for the given MB prediction signal | 346 // Returns a context number for the given MB prediction signal |
347 // The mode info data structure has a one element border above and to the | 347 // The mode info data structure has a one element border above and to the |
348 // left of the entries corresponding to real blocks. | 348 // left of the entries corresponding to real blocks. |
349 // The prediction flags in these dummy entries are initialized to 0. | 349 // The prediction flags in these dummy entries are initialized to 0. |
350 int vp9_get_tx_size_context(const MACROBLOCKD *xd) { | 350 int vp9_get_tx_size_context(const MACROBLOCKD *xd) { |
351 const int max_tx_size = max_txsize_lookup[xd->mi[0]->mbmi.sb_type]; | 351 const int max_tx_size = max_txsize_lookup[xd->mi[0]->mbmi.sb_type]; |
352 const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); | 352 const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); |
353 const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); | 353 const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); |
354 const int has_above = above_mbmi != NULL; | 354 const int has_above = above_mbmi != NULL; |
355 const int has_left = left_mbmi != NULL; | 355 const int has_left = left_mbmi != NULL; |
356 int above_ctx = (has_above && !above_mbmi->skip) ? above_mbmi->tx_size | 356 int above_ctx = (has_above && !above_mbmi->skip) ? (int)above_mbmi->tx_size |
357 : max_tx_size; | 357 : max_tx_size; |
358 int left_ctx = (has_left && !left_mbmi->skip) ? left_mbmi->tx_size | 358 int left_ctx = (has_left && !left_mbmi->skip) ? (int)left_mbmi->tx_size |
359 : max_tx_size; | 359 : max_tx_size; |
360 if (!has_left) | 360 if (!has_left) |
361 left_ctx = above_ctx; | 361 left_ctx = above_ctx; |
362 | 362 |
363 if (!has_above) | 363 if (!has_above) |
364 above_ctx = left_ctx; | 364 above_ctx = left_ctx; |
365 | 365 |
366 return (above_ctx + left_ctx) > max_tx_size; | 366 return (above_ctx + left_ctx) > max_tx_size; |
367 } | 367 } |
368 | 368 |
369 int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids, | 369 int vp9_get_segment_id(const VP9_COMMON *cm, const uint8_t *segment_ids, |
370 BLOCK_SIZE bsize, int mi_row, int mi_col) { | 370 BLOCK_SIZE bsize, int mi_row, int mi_col) { |
371 const int mi_offset = mi_row * cm->mi_cols + mi_col; | 371 const int mi_offset = mi_row * cm->mi_cols + mi_col; |
372 const int bw = num_8x8_blocks_wide_lookup[bsize]; | 372 const int bw = num_8x8_blocks_wide_lookup[bsize]; |
373 const int bh = num_8x8_blocks_high_lookup[bsize]; | 373 const int bh = num_8x8_blocks_high_lookup[bsize]; |
374 const int xmis = MIN(cm->mi_cols - mi_col, bw); | 374 const int xmis = MIN(cm->mi_cols - mi_col, bw); |
375 const int ymis = MIN(cm->mi_rows - mi_row, bh); | 375 const int ymis = MIN(cm->mi_rows - mi_row, bh); |
376 int x, y, segment_id = INT_MAX; | 376 int x, y, segment_id = INT_MAX; |
377 | 377 |
378 for (y = 0; y < ymis; y++) | 378 for (y = 0; y < ymis; y++) |
379 for (x = 0; x < xmis; x++) | 379 for (x = 0; x < xmis; x++) |
380 segment_id = MIN(segment_id, | 380 segment_id = MIN(segment_id, |
381 segment_ids[mi_offset + y * cm->mi_cols + x]); | 381 segment_ids[mi_offset + y * cm->mi_cols + x]); |
382 | 382 |
383 assert(segment_id >= 0 && segment_id < MAX_SEGMENTS); | 383 assert(segment_id >= 0 && segment_id < MAX_SEGMENTS); |
384 return segment_id; | 384 return segment_id; |
385 } | 385 } |
OLD | NEW |