| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 clamp_mv(&clamped_mv, | 145 clamp_mv(&clamped_mv, |
| 146 xd->mb_to_left_edge * (1 << (1 - ss_x)) - spel_left, | 146 xd->mb_to_left_edge * (1 << (1 - ss_x)) - spel_left, |
| 147 xd->mb_to_right_edge * (1 << (1 - ss_x)) + spel_right, | 147 xd->mb_to_right_edge * (1 << (1 - ss_x)) + spel_right, |
| 148 xd->mb_to_top_edge * (1 << (1 - ss_y)) - spel_top, | 148 xd->mb_to_top_edge * (1 << (1 - ss_y)) - spel_top, |
| 149 xd->mb_to_bottom_edge * (1 << (1 - ss_y)) + spel_bottom); | 149 xd->mb_to_bottom_edge * (1 << (1 - ss_y)) + spel_bottom); |
| 150 | 150 |
| 151 return clamped_mv; | 151 return clamped_mv; |
| 152 } | 152 } |
| 153 | 153 |
| 154 static MV average_split_mvs(const struct macroblockd_plane *pd, int plane, | 154 static MV average_split_mvs(const struct macroblockd_plane *pd, |
| 155 const MODE_INFO *mi, int ref, int block) { | 155 const MODE_INFO *mi, int ref, int block) { |
| 156 const int ss_idx = ((pd->subsampling_x > 0) << 1) | (pd->subsampling_y > 0); | 156 const int ss_idx = ((pd->subsampling_x > 0) << 1) | (pd->subsampling_y > 0); |
| 157 MV res = {0, 0}; | 157 MV res = {0, 0}; |
| 158 switch (ss_idx) { | 158 switch (ss_idx) { |
| 159 case 0: | 159 case 0: |
| 160 res = mi->bmi[block].as_mv[ref].as_mv; | 160 res = mi->bmi[block].as_mv[ref].as_mv; |
| 161 break; | 161 break; |
| 162 case 1: | 162 case 1: |
| 163 res = mi_mv_pred_q2(mi, ref, block, block + 2); | 163 res = mi_mv_pred_q2(mi, ref, block, block + 2); |
| 164 break; | 164 break; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 183 const int is_compound = has_second_ref(&mi->mbmi); | 183 const int is_compound = has_second_ref(&mi->mbmi); |
| 184 const InterpKernel *kernel = vp9_get_interp_kernel(mi->mbmi.interp_filter); | 184 const InterpKernel *kernel = vp9_get_interp_kernel(mi->mbmi.interp_filter); |
| 185 int ref; | 185 int ref; |
| 186 | 186 |
| 187 for (ref = 0; ref < 1 + is_compound; ++ref) { | 187 for (ref = 0; ref < 1 + is_compound; ++ref) { |
| 188 const struct scale_factors *const sf = &xd->block_refs[ref]->sf; | 188 const struct scale_factors *const sf = &xd->block_refs[ref]->sf; |
| 189 struct buf_2d *const pre_buf = &pd->pre[ref]; | 189 struct buf_2d *const pre_buf = &pd->pre[ref]; |
| 190 struct buf_2d *const dst_buf = &pd->dst; | 190 struct buf_2d *const dst_buf = &pd->dst; |
| 191 uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x; | 191 uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x; |
| 192 const MV mv = mi->mbmi.sb_type < BLOCK_8X8 | 192 const MV mv = mi->mbmi.sb_type < BLOCK_8X8 |
| 193 ? average_split_mvs(pd, plane, mi, ref, block) | 193 ? average_split_mvs(pd, mi, ref, block) |
| 194 : mi->mbmi.mv[ref].as_mv; | 194 : mi->mbmi.mv[ref].as_mv; |
| 195 | 195 |
| 196 // TODO(jkoleszar): This clamping is done in the incorrect place for the | 196 // TODO(jkoleszar): This clamping is done in the incorrect place for the |
| 197 // scaling case. It needs to be done on the scaled MV, not the pre-scaling | 197 // scaling case. It needs to be done on the scaled MV, not the pre-scaling |
| 198 // MV. Note however that it performs the subsampling aware scaling so | 198 // MV. Note however that it performs the subsampling aware scaling so |
| 199 // that the result is always q4. | 199 // that the result is always q4. |
| 200 // mv_precision precision is MV_PRECISION_Q4. | 200 // mv_precision precision is MV_PRECISION_Q4. |
| 201 const MV mv_q4 = clamp_mv_to_umv_border_sb(xd, &mv, bw, bh, | 201 const MV mv_q4 = clamp_mv_to_umv_border_sb(xd, &mv, bw, bh, |
| 202 pd->subsampling_x, | 202 pd->subsampling_x, |
| 203 pd->subsampling_y); | 203 pd->subsampling_y); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 const int is_compound = has_second_ref(&mi->mbmi); | 281 const int is_compound = has_second_ref(&mi->mbmi); |
| 282 const InterpKernel *kernel = vp9_get_interp_kernel(mi->mbmi.interp_filter); | 282 const InterpKernel *kernel = vp9_get_interp_kernel(mi->mbmi.interp_filter); |
| 283 int ref; | 283 int ref; |
| 284 | 284 |
| 285 for (ref = 0; ref < 1 + is_compound; ++ref) { | 285 for (ref = 0; ref < 1 + is_compound; ++ref) { |
| 286 const struct scale_factors *const sf = &xd->block_refs[ref]->sf; | 286 const struct scale_factors *const sf = &xd->block_refs[ref]->sf; |
| 287 struct buf_2d *const pre_buf = &pd->pre[ref]; | 287 struct buf_2d *const pre_buf = &pd->pre[ref]; |
| 288 struct buf_2d *const dst_buf = &pd->dst; | 288 struct buf_2d *const dst_buf = &pd->dst; |
| 289 uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x; | 289 uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x; |
| 290 const MV mv = mi->mbmi.sb_type < BLOCK_8X8 | 290 const MV mv = mi->mbmi.sb_type < BLOCK_8X8 |
| 291 ? average_split_mvs(pd, plane, mi, ref, block) | 291 ? average_split_mvs(pd, mi, ref, block) |
| 292 : mi->mbmi.mv[ref].as_mv; | 292 : mi->mbmi.mv[ref].as_mv; |
| 293 | 293 |
| 294 | 294 |
| 295 // TODO(jkoleszar): This clamping is done in the incorrect place for the | 295 // TODO(jkoleszar): This clamping is done in the incorrect place for the |
| 296 // scaling case. It needs to be done on the scaled MV, not the pre-scaling | 296 // scaling case. It needs to be done on the scaled MV, not the pre-scaling |
| 297 // MV. Note however that it performs the subsampling aware scaling so | 297 // MV. Note however that it performs the subsampling aware scaling so |
| 298 // that the result is always q4. | 298 // that the result is always q4. |
| 299 // mv_precision precision is MV_PRECISION_Q4. | 299 // mv_precision precision is MV_PRECISION_Q4. |
| 300 const MV mv_q4 = clamp_mv_to_umv_border_sb(xd, &mv, bw, bh, | 300 const MV mv_q4 = clamp_mv_to_umv_border_sb(xd, &mv, bw, bh, |
| 301 pd->subsampling_x, | 301 pd->subsampling_x, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 x_pad = 1; | 382 x_pad = 1; |
| 383 } | 383 } |
| 384 | 384 |
| 385 if (subpel_y || (sf->y_step_q4 & SUBPEL_MASK)) { | 385 if (subpel_y || (sf->y_step_q4 & SUBPEL_MASK)) { |
| 386 y0 -= VP9_INTERP_EXTEND - 1; | 386 y0 -= VP9_INTERP_EXTEND - 1; |
| 387 y1 += VP9_INTERP_EXTEND; | 387 y1 += VP9_INTERP_EXTEND; |
| 388 y_pad = 1; | 388 y_pad = 1; |
| 389 } | 389 } |
| 390 | 390 |
| 391 // Skip border extension if block is inside the frame. | 391 // Skip border extension if block is inside the frame. |
| 392 if (x0 < 0 || x0 > frame_width - 1 || x1 < 0 || x1 > frame_width || | 392 if (x0 < 0 || x0 > frame_width - 1 || x1 < 0 || x1 > frame_width - 1 || |
| 393 y0 < 0 || y0 > frame_height - 1 || y1 < 0 || y1 > frame_height - 1) { | 393 y0 < 0 || y0 > frame_height - 1 || y1 < 0 || y1 > frame_height - 1) { |
| 394 uint8_t *buf_ptr1 = ref_frame + y0 * pre_buf->stride + x0; | 394 uint8_t *buf_ptr1 = ref_frame + y0 * pre_buf->stride + x0; |
| 395 // Extend the border. | 395 // Extend the border. |
| 396 build_mc_border(buf_ptr1, pre_buf->stride, xd->mc_buf, x1 - x0 + 1, | 396 build_mc_border(buf_ptr1, pre_buf->stride, xd->mc_buf, x1 - x0 + 1, |
| 397 x0, y0, x1 - x0 + 1, y1 - y0 + 1, frame_width, | 397 x0, y0, x1 - x0 + 1, y1 - y0 + 1, frame_width, |
| 398 frame_height); | 398 frame_height); |
| 399 buf_stride = x1 - x0 + 1; | 399 buf_stride = x1 - x0 + 1; |
| 400 buf_ptr = xd->mc_buf + y_pad * 3 * buf_stride + x_pad * 3; | 400 buf_ptr = xd->mc_buf + y_pad * 3 * buf_stride + x_pad * 3; |
| 401 } | 401 } |
| 402 } | 402 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 const int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride, | 460 const int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride, |
| 461 src->alpha_stride}; | 461 src->alpha_stride}; |
| 462 | 462 |
| 463 for (i = 0; i < MAX_MB_PLANE; ++i) { | 463 for (i = 0; i < MAX_MB_PLANE; ++i) { |
| 464 struct macroblockd_plane *const pd = &xd->plane[i]; | 464 struct macroblockd_plane *const pd = &xd->plane[i]; |
| 465 setup_pred_plane(&pd->pre[idx], buffers[i], strides[i], mi_row, mi_col, | 465 setup_pred_plane(&pd->pre[idx], buffers[i], strides[i], mi_row, mi_col, |
| 466 sf, pd->subsampling_x, pd->subsampling_y); | 466 sf, pd->subsampling_x, pd->subsampling_y); |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 } | 469 } |
| OLD | NEW |