| 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 23 matching lines...) Expand all Loading... |
| 34 uint8_t *u_mb_ptr, | 34 uint8_t *u_mb_ptr, |
| 35 uint8_t *v_mb_ptr, | 35 uint8_t *v_mb_ptr, |
| 36 int stride, | 36 int stride, |
| 37 int uv_block_size, | 37 int uv_block_size, |
| 38 int mv_row, | 38 int mv_row, |
| 39 int mv_col, | 39 int mv_col, |
| 40 uint8_t *pred, | 40 uint8_t *pred, |
| 41 struct scale_factors *scale, | 41 struct scale_factors *scale, |
| 42 int x, int y) { | 42 int x, int y) { |
| 43 const int which_mv = 0; | 43 const int which_mv = 0; |
| 44 MV mv = { mv_row, mv_col }; | 44 const MV mv = { mv_row, mv_col }; |
| 45 const InterpKernel *const kernel = |
| 46 vp9_get_interp_kernel(xd->mi[0]->mbmi.interp_filter); |
| 47 |
| 45 enum mv_precision mv_precision_uv; | 48 enum mv_precision mv_precision_uv; |
| 46 int uv_stride; | 49 int uv_stride; |
| 47 if (uv_block_size == 8) { | 50 if (uv_block_size == 8) { |
| 48 uv_stride = (stride + 1) >> 1; | 51 uv_stride = (stride + 1) >> 1; |
| 49 mv_precision_uv = MV_PRECISION_Q4; | 52 mv_precision_uv = MV_PRECISION_Q4; |
| 50 } else { | 53 } else { |
| 51 uv_stride = stride; | 54 uv_stride = stride; |
| 52 mv_precision_uv = MV_PRECISION_Q3; | 55 mv_precision_uv = MV_PRECISION_Q3; |
| 53 } | 56 } |
| 54 | 57 |
| 55 vp9_build_inter_predictor(y_mb_ptr, stride, | 58 vp9_build_inter_predictor(y_mb_ptr, stride, |
| 56 &pred[0], 16, | 59 &pred[0], 16, |
| 57 &mv, | 60 &mv, |
| 58 scale, | 61 scale, |
| 59 16, 16, | 62 16, 16, |
| 60 which_mv, | 63 which_mv, |
| 61 xd->interp_kernel, MV_PRECISION_Q3, x, y); | 64 kernel, MV_PRECISION_Q3, x, y); |
| 62 | 65 |
| 63 vp9_build_inter_predictor(u_mb_ptr, uv_stride, | 66 vp9_build_inter_predictor(u_mb_ptr, uv_stride, |
| 64 &pred[256], uv_block_size, | 67 &pred[256], uv_block_size, |
| 65 &mv, | 68 &mv, |
| 66 scale, | 69 scale, |
| 67 uv_block_size, uv_block_size, | 70 uv_block_size, uv_block_size, |
| 68 which_mv, | 71 which_mv, |
| 69 xd->interp_kernel, mv_precision_uv, x, y); | 72 kernel, mv_precision_uv, x, y); |
| 70 | 73 |
| 71 vp9_build_inter_predictor(v_mb_ptr, uv_stride, | 74 vp9_build_inter_predictor(v_mb_ptr, uv_stride, |
| 72 &pred[512], uv_block_size, | 75 &pred[512], uv_block_size, |
| 73 &mv, | 76 &mv, |
| 74 scale, | 77 scale, |
| 75 uv_block_size, uv_block_size, | 78 uv_block_size, uv_block_size, |
| 76 which_mv, | 79 which_mv, |
| 77 xd->interp_kernel, mv_precision_uv, x, y); | 80 kernel, mv_precision_uv, x, y); |
| 78 } | 81 } |
| 79 | 82 |
| 80 void vp9_temporal_filter_apply_c(uint8_t *frame1, | 83 void vp9_temporal_filter_apply_c(uint8_t *frame1, |
| 81 unsigned int stride, | 84 unsigned int stride, |
| 82 uint8_t *frame2, | 85 uint8_t *frame2, |
| 83 unsigned int block_size, | 86 unsigned int block_size, |
| 84 int strength, | 87 int strength, |
| 85 int filter_weight, | 88 int filter_weight, |
| 86 unsigned int *accumulator, | 89 unsigned int *accumulator, |
| 87 uint16_t *count) { | 90 uint16_t *count) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 uint8_t *frame_ptr_buf, | 129 uint8_t *frame_ptr_buf, |
| 127 int stride) { | 130 int stride) { |
| 128 MACROBLOCK *x = &cpi->mb; | 131 MACROBLOCK *x = &cpi->mb; |
| 129 MACROBLOCKD* const xd = &x->e_mbd; | 132 MACROBLOCKD* const xd = &x->e_mbd; |
| 130 int step_param; | 133 int step_param; |
| 131 int sadpb = x->sadperbit16; | 134 int sadpb = x->sadperbit16; |
| 132 int bestsme = INT_MAX; | 135 int bestsme = INT_MAX; |
| 133 | 136 |
| 134 MV best_ref_mv1 = {0, 0}; | 137 MV best_ref_mv1 = {0, 0}; |
| 135 MV best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */ | 138 MV best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */ |
| 136 MV *ref_mv = &x->e_mbd.mi_8x8[0]->bmi[0].as_mv[0].as_mv; | 139 MV *ref_mv = &x->e_mbd.mi[0]->bmi[0].as_mv[0].as_mv; |
| 137 | 140 |
| 138 // Save input state | 141 // Save input state |
| 139 struct buf_2d src = x->plane[0].src; | 142 struct buf_2d src = x->plane[0].src; |
| 140 struct buf_2d pre = xd->plane[0].pre[0]; | 143 struct buf_2d pre = xd->plane[0].pre[0]; |
| 141 | 144 |
| 142 best_ref_mv1_full.col = best_ref_mv1.col >> 3; | 145 best_ref_mv1_full.col = best_ref_mv1.col >> 3; |
| 143 best_ref_mv1_full.row = best_ref_mv1.row >> 3; | 146 best_ref_mv1_full.row = best_ref_mv1.row >> 3; |
| 144 | 147 |
| 145 // Setup frame pointers | 148 // Setup frame pointers |
| 146 x->plane[0].src.buf = arf_frame_buf; | 149 x->plane[0].src.buf = arf_frame_buf; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 #if ALT_REF_MC_ENABLED | 246 #if ALT_REF_MC_ENABLED |
| 244 cpi->mb.mv_col_min = -((mb_col * 16) + (17 - 2 * VP9_INTERP_EXTEND)); | 247 cpi->mb.mv_col_min = -((mb_col * 16) + (17 - 2 * VP9_INTERP_EXTEND)); |
| 245 cpi->mb.mv_col_max = ((cpi->common.mb_cols - 1 - mb_col) * 16) | 248 cpi->mb.mv_col_max = ((cpi->common.mb_cols - 1 - mb_col) * 16) |
| 246 + (17 - 2 * VP9_INTERP_EXTEND); | 249 + (17 - 2 * VP9_INTERP_EXTEND); |
| 247 #endif | 250 #endif |
| 248 | 251 |
| 249 for (frame = 0; frame < frame_count; frame++) { | 252 for (frame = 0; frame < frame_count; frame++) { |
| 250 if (cpi->frames[frame] == NULL) | 253 if (cpi->frames[frame] == NULL) |
| 251 continue; | 254 continue; |
| 252 | 255 |
| 253 mbd->mi_8x8[0]->bmi[0].as_mv[0].as_mv.row = 0; | 256 mbd->mi[0]->bmi[0].as_mv[0].as_mv.row = 0; |
| 254 mbd->mi_8x8[0]->bmi[0].as_mv[0].as_mv.col = 0; | 257 mbd->mi[0]->bmi[0].as_mv[0].as_mv.col = 0; |
| 255 | 258 |
| 256 if (frame == alt_ref_index) { | 259 if (frame == alt_ref_index) { |
| 257 filter_weight = 2; | 260 filter_weight = 2; |
| 258 } else { | 261 } else { |
| 259 int err = 0; | 262 int err = 0; |
| 260 #if ALT_REF_MC_ENABLED | 263 #if ALT_REF_MC_ENABLED |
| 261 #define THRESH_LOW 10000 | 264 #define THRESH_LOW 10000 |
| 262 #define THRESH_HIGH 20000 | 265 #define THRESH_HIGH 20000 |
| 263 | 266 |
| 264 // Find best match in this frame by MC | 267 // Find best match in this frame by MC |
| (...skipping 12 matching lines...) Expand all Loading... |
| 277 | 280 |
| 278 if (filter_weight != 0) { | 281 if (filter_weight != 0) { |
| 279 // Construct the predictors | 282 // Construct the predictors |
| 280 temporal_filter_predictors_mb_c | 283 temporal_filter_predictors_mb_c |
| 281 (mbd, | 284 (mbd, |
| 282 cpi->frames[frame]->y_buffer + mb_y_offset, | 285 cpi->frames[frame]->y_buffer + mb_y_offset, |
| 283 cpi->frames[frame]->u_buffer + mb_uv_offset, | 286 cpi->frames[frame]->u_buffer + mb_uv_offset, |
| 284 cpi->frames[frame]->v_buffer + mb_uv_offset, | 287 cpi->frames[frame]->v_buffer + mb_uv_offset, |
| 285 cpi->frames[frame]->y_stride, | 288 cpi->frames[frame]->y_stride, |
| 286 mb_uv_height, | 289 mb_uv_height, |
| 287 mbd->mi_8x8[0]->bmi[0].as_mv[0].as_mv.row, | 290 mbd->mi[0]->bmi[0].as_mv[0].as_mv.row, |
| 288 mbd->mi_8x8[0]->bmi[0].as_mv[0].as_mv.col, | 291 mbd->mi[0]->bmi[0].as_mv[0].as_mv.col, |
| 289 predictor, scale, | 292 predictor, scale, |
| 290 mb_col * 16, mb_row * 16); | 293 mb_col * 16, mb_row * 16); |
| 291 | 294 |
| 292 // Apply the filter (YUV) | 295 // Apply the filter (YUV) |
| 293 vp9_temporal_filter_apply(f->y_buffer + mb_y_offset, f->y_stride, | 296 vp9_temporal_filter_apply(f->y_buffer + mb_y_offset, f->y_stride, |
| 294 predictor, 16, strength, filter_weight, | 297 predictor, 16, strength, filter_weight, |
| 295 accumulator, count); | 298 accumulator, count); |
| 296 | 299 |
| 297 vp9_temporal_filter_apply(f->u_buffer + mb_uv_offset, f->uv_stride, | 300 vp9_temporal_filter_apply(f->u_buffer + mb_uv_offset, f->uv_stride, |
| 298 predictor + 256, mb_uv_height, strength, | 301 predictor + 256, mb_uv_height, strength, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 532 |
| 530 // Adjust number of frames in filter and strength based on gf boost level. | 533 // Adjust number of frames in filter and strength based on gf boost level. |
| 531 if (cpi->active_arnr_frames > (group_boost / 150)) { | 534 if (cpi->active_arnr_frames > (group_boost / 150)) { |
| 532 cpi->active_arnr_frames = (group_boost / 150); | 535 cpi->active_arnr_frames = (group_boost / 150); |
| 533 cpi->active_arnr_frames += !(cpi->active_arnr_frames & 1); | 536 cpi->active_arnr_frames += !(cpi->active_arnr_frames & 1); |
| 534 } | 537 } |
| 535 if (cpi->active_arnr_strength > (group_boost / 300)) { | 538 if (cpi->active_arnr_strength > (group_boost / 300)) { |
| 536 cpi->active_arnr_strength = (group_boost / 300); | 539 cpi->active_arnr_strength = (group_boost / 300); |
| 537 } | 540 } |
| 538 } | 541 } |
| OLD | NEW |