| OLD | NEW |
| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) { | 29 for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) { |
| 30 lower_mv_precision(&mvlist[i].as_mv, allow_hp); | 30 lower_mv_precision(&mvlist[i].as_mv, allow_hp); |
| 31 clamp_mv2(&mvlist[i].as_mv, xd); | 31 clamp_mv2(&mvlist[i].as_mv, xd); |
| 32 } | 32 } |
| 33 *nearest = mvlist[0]; | 33 *nearest = mvlist[0]; |
| 34 *near = mvlist[1]; | 34 *near = mvlist[1]; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd, | 37 void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 38 const TileInfo *const tile, | 38 const TileInfo *const tile, |
| 39 int_mv *dst_nearest, | 39 int block, int ref, int mi_row, int mi_col, |
| 40 int_mv *dst_near, | 40 int_mv *nearest, int_mv *near) { |
| 41 int block_idx, int ref_idx, | |
| 42 int mi_row, int mi_col) { | |
| 43 int_mv dst_list[MAX_MV_REF_CANDIDATES]; | |
| 44 int_mv mv_list[MAX_MV_REF_CANDIDATES]; | 41 int_mv mv_list[MAX_MV_REF_CANDIDATES]; |
| 45 MODE_INFO *const mi = xd->mi_8x8[0]; | 42 MODE_INFO *const mi = xd->mi_8x8[0]; |
| 43 b_mode_info *bmi = mi->bmi; |
| 44 int n; |
| 46 | 45 |
| 47 assert(ref_idx == 0 || ref_idx == 1); | 46 assert(MAX_MV_REF_CANDIDATES == 2); |
| 48 assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier | |
| 49 | 47 |
| 50 vp9_find_mv_refs_idx(cm, xd, tile, mi, xd->last_mi, | 48 vp9_find_mv_refs_idx(cm, xd, tile, mi, xd->last_mi, mi->mbmi.ref_frame[ref], |
| 51 mi->mbmi.ref_frame[ref_idx], | 49 mv_list, block, mi_row, mi_col); |
| 52 mv_list, block_idx, mi_row, mi_col); | |
| 53 | 50 |
| 54 dst_list[1].as_int = 0; | 51 near->as_int = 0; |
| 55 if (block_idx == 0) { | 52 switch (block) { |
| 56 vpx_memcpy(dst_list, mv_list, MAX_MV_REF_CANDIDATES * sizeof(int_mv)); | 53 case 0: |
| 57 } else if (block_idx == 1 || block_idx == 2) { | 54 nearest->as_int = mv_list[0].as_int; |
| 58 int dst = 0, n; | 55 near->as_int = mv_list[1].as_int; |
| 59 b_mode_info *bmi = mi->bmi; | 56 break; |
| 57 case 1: |
| 58 case 2: |
| 59 nearest->as_int = bmi[0].as_mv[ref].as_int; |
| 60 for (n = 0; n < MAX_MV_REF_CANDIDATES; ++n) |
| 61 if (nearest->as_int != mv_list[n].as_int) { |
| 62 near->as_int = mv_list[n].as_int; |
| 63 break; |
| 64 } |
| 65 break; |
| 66 case 3: { |
| 67 int_mv candidates[2 + MAX_MV_REF_CANDIDATES]; |
| 68 candidates[0] = bmi[1].as_mv[ref]; |
| 69 candidates[1] = bmi[0].as_mv[ref]; |
| 70 candidates[2] = mv_list[0]; |
| 71 candidates[3] = mv_list[1]; |
| 60 | 72 |
| 61 dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int; | 73 nearest->as_int = bmi[2].as_mv[ref].as_int; |
| 62 for (n = 0; dst < MAX_MV_REF_CANDIDATES && | 74 for (n = 0; n < 2 + MAX_MV_REF_CANDIDATES; ++n) |
| 63 n < MAX_MV_REF_CANDIDATES; n++) | 75 if (nearest->as_int != candidates[n].as_int) { |
| 64 if (mv_list[n].as_int != dst_list[0].as_int) | 76 near->as_int = candidates[n].as_int; |
| 65 dst_list[dst++].as_int = mv_list[n].as_int; | 77 break; |
| 66 } else { | 78 } |
| 67 int dst = 0, n; | 79 break; |
| 68 b_mode_info *bmi = mi->bmi; | 80 } |
| 69 | 81 default: |
| 70 assert(block_idx == 3); | 82 assert("Invalid block index."); |
| 71 dst_list[dst++].as_int = bmi[2].as_mv[ref_idx].as_int; | |
| 72 if (dst_list[0].as_int != bmi[1].as_mv[ref_idx].as_int) | |
| 73 dst_list[dst++].as_int = bmi[1].as_mv[ref_idx].as_int; | |
| 74 if (dst < MAX_MV_REF_CANDIDATES && | |
| 75 dst_list[0].as_int != bmi[0].as_mv[ref_idx].as_int) | |
| 76 dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int; | |
| 77 for (n = 0; dst < MAX_MV_REF_CANDIDATES && | |
| 78 n < MAX_MV_REF_CANDIDATES; n++) | |
| 79 if (mv_list[n].as_int != dst_list[0].as_int) | |
| 80 dst_list[dst++].as_int = mv_list[n].as_int; | |
| 81 } | 83 } |
| 82 | |
| 83 dst_nearest->as_int = dst_list[0].as_int; | |
| 84 dst_near->as_int = dst_list[1].as_int; | |
| 85 } | 84 } |
| OLD | NEW |