OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
11 #include <assert.h> | 11 #include <assert.h> |
12 #include <limits.h> | 12 #include <limits.h> |
13 #include <math.h> | 13 #include <math.h> |
14 #include <stdio.h> | 14 #include <stdio.h> |
15 | 15 |
16 #include "./vp9_rtcd.h" | 16 #include "./vp9_rtcd.h" |
17 | 17 |
18 #include "vpx_mem/vpx_mem.h" | 18 #include "vpx_mem/vpx_mem.h" |
19 | 19 |
20 #include "vp9/common/vp9_common.h" | 20 #include "vp9/common/vp9_common.h" |
21 #include "vp9/common/vp9_mvref_common.h" | 21 #include "vp9/common/vp9_mvref_common.h" |
22 #include "vp9/common/vp9_reconinter.h" | 22 #include "vp9/common/vp9_reconinter.h" |
23 #include "vp9/common/vp9_reconintra.h" | 23 #include "vp9/common/vp9_reconintra.h" |
24 | 24 |
25 #include "vp9/encoder/vp9_encoder.h" | 25 #include "vp9/encoder/vp9_encoder.h" |
| 26 #include "vp9/encoder/vp9_pickmode.h" |
26 #include "vp9/encoder/vp9_ratectrl.h" | 27 #include "vp9/encoder/vp9_ratectrl.h" |
27 #include "vp9/encoder/vp9_rdopt.h" | 28 #include "vp9/encoder/vp9_rd.h" |
| 29 |
| 30 static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCKD *xd, |
| 31 const TileInfo *const tile, |
| 32 MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, |
| 33 int_mv *mv_ref_list, |
| 34 int mi_row, int mi_col) { |
| 35 const int *ref_sign_bias = cm->ref_frame_sign_bias; |
| 36 int i, refmv_count = 0; |
| 37 |
| 38 const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type]; |
| 39 |
| 40 int different_ref_found = 0; |
| 41 int context_counter = 0; |
| 42 int const_motion = 0; |
| 43 |
| 44 // Blank the reference vector list |
| 45 vpx_memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES); |
| 46 |
| 47 // The nearest 2 blocks are treated differently |
| 48 // if the size < 8x8 we get the mv from the bmi substructure, |
| 49 // and we also need to keep a mode count. |
| 50 for (i = 0; i < 2; ++i) { |
| 51 const POSITION *const mv_ref = &mv_ref_search[i]; |
| 52 if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) { |
| 53 const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row * |
| 54 xd->mi_stride]; |
| 55 const MB_MODE_INFO *const candidate = &candidate_mi->mbmi; |
| 56 // Keep counts for entropy encoding. |
| 57 context_counter += mode_2_counter[candidate->mode]; |
| 58 different_ref_found = 1; |
| 59 |
| 60 if (candidate->ref_frame[0] == ref_frame) |
| 61 ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, -1)); |
| 62 } |
| 63 } |
| 64 |
| 65 const_motion = 1; |
| 66 |
| 67 // Check the rest of the neighbors in much the same way |
| 68 // as before except we don't need to keep track of sub blocks or |
| 69 // mode counts. |
| 70 for (; i < MVREF_NEIGHBOURS && !refmv_count; ++i) { |
| 71 const POSITION *const mv_ref = &mv_ref_search[i]; |
| 72 if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) { |
| 73 const MB_MODE_INFO *const candidate = &xd->mi[mv_ref->col + mv_ref->row * |
| 74 xd->mi_stride]->mbmi; |
| 75 different_ref_found = 1; |
| 76 |
| 77 if (candidate->ref_frame[0] == ref_frame) |
| 78 ADD_MV_REF_LIST(candidate->mv[0]); |
| 79 } |
| 80 } |
| 81 |
| 82 // Since we couldn't find 2 mvs from the same reference frame |
| 83 // go back through the neighbors and find motion vectors from |
| 84 // different reference frames. |
| 85 if (different_ref_found && !refmv_count) { |
| 86 for (i = 0; i < MVREF_NEIGHBOURS; ++i) { |
| 87 const POSITION *mv_ref = &mv_ref_search[i]; |
| 88 if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) { |
| 89 const MB_MODE_INFO *const candidate = &xd->mi[mv_ref->col + mv_ref->row |
| 90 * xd->mi_stride]->mbmi; |
| 91 |
| 92 // If the candidate is INTRA we don't want to consider its mv. |
| 93 IF_DIFF_REF_FRAME_ADD_MV(candidate); |
| 94 } |
| 95 } |
| 96 } |
| 97 |
| 98 Done: |
| 99 |
| 100 mi->mbmi.mode_context[ref_frame] = counter_to_context[context_counter]; |
| 101 |
| 102 // Clamp vectors |
| 103 for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) |
| 104 clamp_mv_ref(&mv_ref_list[i].as_mv, xd); |
| 105 |
| 106 return const_motion; |
| 107 } |
28 | 108 |
29 static void full_pixel_motion_search(VP9_COMP *cpi, MACROBLOCK *x, | 109 static void full_pixel_motion_search(VP9_COMP *cpi, MACROBLOCK *x, |
30 BLOCK_SIZE bsize, int mi_row, int mi_col, | 110 BLOCK_SIZE bsize, int mi_row, int mi_col, |
31 int_mv *tmp_mv, int *rate_mv) { | 111 int_mv *tmp_mv, int *rate_mv) { |
32 MACROBLOCKD *xd = &x->e_mbd; | 112 MACROBLOCKD *xd = &x->e_mbd; |
33 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; | 113 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; |
34 struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0, 0}}; | 114 struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0, 0}}; |
35 int step_param; | 115 int step_param; |
36 int sadpb = x->sadperbit16; | 116 int sadpb = x->sadperbit16; |
37 MV mvp_full; | 117 MV mvp_full; |
(...skipping 16 matching lines...) Expand all Loading... |
54 for (i = 0; i < MAX_MB_PLANE; i++) | 134 for (i = 0; i < MAX_MB_PLANE; i++) |
55 backup_yv12[i] = xd->plane[i].pre[0]; | 135 backup_yv12[i] = xd->plane[i].pre[0]; |
56 | 136 |
57 vp9_setup_pre_planes(xd, 0, scaled_ref_frame, mi_row, mi_col, NULL); | 137 vp9_setup_pre_planes(xd, 0, scaled_ref_frame, mi_row, mi_col, NULL); |
58 } | 138 } |
59 | 139 |
60 vp9_set_mv_search_range(x, &ref_mv); | 140 vp9_set_mv_search_range(x, &ref_mv); |
61 | 141 |
62 // TODO(jingning) exploiting adaptive motion search control in non-RD | 142 // TODO(jingning) exploiting adaptive motion search control in non-RD |
63 // mode decision too. | 143 // mode decision too. |
64 step_param = 6; | 144 step_param = cpi->sf.mv.fullpel_search_step_param; |
65 | 145 |
66 for (i = LAST_FRAME; i <= LAST_FRAME && cpi->common.show_frame; ++i) { | 146 for (i = LAST_FRAME; i <= LAST_FRAME && cpi->common.show_frame; ++i) { |
67 if ((x->pred_mv_sad[ref] >> 3) > x->pred_mv_sad[i]) { | 147 if ((x->pred_mv_sad[ref] >> 3) > x->pred_mv_sad[i]) { |
68 tmp_mv->as_int = INVALID_MV; | 148 tmp_mv->as_int = INVALID_MV; |
69 | 149 |
70 if (scaled_ref_frame) { | 150 if (scaled_ref_frame) { |
71 int i; | 151 int i; |
72 for (i = 0; i < MAX_MB_PLANE; i++) | 152 for (i = 0; i < MAX_MB_PLANE; i++) |
73 xd->plane[i].pre[0] = backup_yv12[i]; | 153 xd->plane[i].pre[0] = backup_yv12[i]; |
74 } | 154 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 *var_y = var; | 245 *var_y = var; |
166 *sse_y = sse; | 246 *sse_y = sse; |
167 | 247 |
168 if (sse < dc_quant * dc_quant >> 6) | 248 if (sse < dc_quant * dc_quant >> 6) |
169 x->skip_txfm = 1; | 249 x->skip_txfm = 1; |
170 else if (var < ac_quant * ac_quant >> 6) | 250 else if (var < ac_quant * ac_quant >> 6) |
171 x->skip_txfm = 2; | 251 x->skip_txfm = 2; |
172 else | 252 else |
173 x->skip_txfm = 0; | 253 x->skip_txfm = 0; |
174 | 254 |
| 255 if (cpi->common.tx_mode == TX_MODE_SELECT) { |
| 256 if (sse > (var << 2)) |
| 257 xd->mi[0]->mbmi.tx_size = MIN(max_txsize_lookup[bsize], |
| 258 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); |
| 259 else |
| 260 xd->mi[0]->mbmi.tx_size = TX_8X8; |
| 261 } else { |
| 262 xd->mi[0]->mbmi.tx_size = MIN(max_txsize_lookup[bsize], |
| 263 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); |
| 264 } |
| 265 |
175 vp9_model_rd_from_var_lapndz(sse - var, 1 << num_pels_log2_lookup[bsize], | 266 vp9_model_rd_from_var_lapndz(sse - var, 1 << num_pels_log2_lookup[bsize], |
176 dc_quant >> 3, &rate, &dist); | 267 dc_quant >> 3, &rate, &dist); |
177 *out_rate_sum = rate >> 1; | 268 *out_rate_sum = rate >> 1; |
178 *out_dist_sum = dist << 3; | 269 *out_dist_sum = dist << 3; |
179 | 270 |
180 vp9_model_rd_from_var_lapndz(var, 1 << num_pels_log2_lookup[bsize], | 271 vp9_model_rd_from_var_lapndz(var, 1 << num_pels_log2_lookup[bsize], |
181 ac_quant >> 3, &rate, &dist); | 272 ac_quant >> 3, &rate, &dist); |
182 *out_rate_sum += rate; | 273 *out_rate_sum += rate; |
183 *out_dist_sum += dist << 4; | 274 *out_dist_sum += dist << 4; |
184 } | 275 } |
185 | 276 |
| 277 static int get_pred_buffer(PRED_BUFFER *p, int len) { |
| 278 int i; |
| 279 |
| 280 for (i = 0; i < len; i++) { |
| 281 if (!p[i].in_use) { |
| 282 p[i].in_use = 1; |
| 283 return i; |
| 284 } |
| 285 } |
| 286 return -1; |
| 287 } |
| 288 |
| 289 static void free_pred_buffer(PRED_BUFFER *p) { |
| 290 p->in_use = 0; |
| 291 } |
| 292 |
| 293 static void encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x, |
| 294 BLOCK_SIZE bsize, int mi_row, int mi_col, |
| 295 MV_REFERENCE_FRAME ref_frame, |
| 296 PREDICTION_MODE this_mode, |
| 297 unsigned int var_y, unsigned int sse_y, |
| 298 struct buf_2d yv12_mb[][MAX_MB_PLANE], |
| 299 int *rate, int64_t *dist) { |
| 300 MACROBLOCKD *xd = &x->e_mbd; |
| 301 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; |
| 302 |
| 303 const BLOCK_SIZE uv_size = get_plane_block_size(bsize, &xd->plane[1]); |
| 304 unsigned int var = var_y, sse = sse_y; |
| 305 // Skipping threshold for ac. |
| 306 unsigned int thresh_ac; |
| 307 // Skipping threshold for dc. |
| 308 unsigned int thresh_dc; |
| 309 if (x->encode_breakout > 0) { |
| 310 // Set a maximum for threshold to avoid big PSNR loss in low bit rate |
| 311 // case. Use extreme low threshold for static frames to limit |
| 312 // skipping. |
| 313 const unsigned int max_thresh = 36000; |
| 314 // The encode_breakout input |
| 315 const unsigned int min_thresh = |
| 316 MIN(((unsigned int)x->encode_breakout << 4), max_thresh); |
| 317 |
| 318 // Calculate threshold according to dequant value. |
| 319 thresh_ac = (xd->plane[0].dequant[1] * xd->plane[0].dequant[1]) / 9; |
| 320 thresh_ac = clamp(thresh_ac, min_thresh, max_thresh); |
| 321 |
| 322 // Adjust ac threshold according to partition size. |
| 323 thresh_ac >>= |
| 324 8 - (b_width_log2_lookup[bsize] + b_height_log2_lookup[bsize]); |
| 325 |
| 326 thresh_dc = (xd->plane[0].dequant[0] * xd->plane[0].dequant[0] >> 6); |
| 327 } else { |
| 328 thresh_ac = 0; |
| 329 thresh_dc = 0; |
| 330 } |
| 331 |
| 332 // Y skipping condition checking for ac and dc. |
| 333 if (var <= thresh_ac && (sse - var) <= thresh_dc) { |
| 334 unsigned int sse_u, sse_v; |
| 335 unsigned int var_u, var_v; |
| 336 |
| 337 // Skip UV prediction unless breakout is zero (lossless) to save |
| 338 // computation with low impact on the result |
| 339 if (x->encode_breakout == 0) { |
| 340 xd->plane[1].pre[0] = yv12_mb[ref_frame][1]; |
| 341 xd->plane[2].pre[0] = yv12_mb[ref_frame][2]; |
| 342 vp9_build_inter_predictors_sbuv(xd, mi_row, mi_col, bsize); |
| 343 } |
| 344 |
| 345 var_u = cpi->fn_ptr[uv_size].vf(x->plane[1].src.buf, |
| 346 x->plane[1].src.stride, |
| 347 xd->plane[1].dst.buf, |
| 348 xd->plane[1].dst.stride, &sse_u); |
| 349 |
| 350 // U skipping condition checking |
| 351 if ((var_u * 4 <= thresh_ac) && (sse_u - var_u <= thresh_dc)) { |
| 352 var_v = cpi->fn_ptr[uv_size].vf(x->plane[2].src.buf, |
| 353 x->plane[2].src.stride, |
| 354 xd->plane[2].dst.buf, |
| 355 xd->plane[2].dst.stride, &sse_v); |
| 356 |
| 357 // V skipping condition checking |
| 358 if ((var_v * 4 <= thresh_ac) && (sse_v - var_v <= thresh_dc)) { |
| 359 x->skip = 1; |
| 360 |
| 361 // The cost of skip bit needs to be added. |
| 362 *rate = cpi->inter_mode_cost[mbmi->mode_context[ref_frame]] |
| 363 [INTER_OFFSET(this_mode)]; |
| 364 |
| 365 // More on this part of rate |
| 366 // rate += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1); |
| 367 |
| 368 // Scaling factor for SSE from spatial domain to frequency |
| 369 // domain is 16. Adjust distortion accordingly. |
| 370 // TODO(yunqingwang): In this function, only y-plane dist is |
| 371 // calculated. |
| 372 *dist = (sse << 4); // + ((sse_u + sse_v) << 4); |
| 373 |
| 374 // *disable_skip = 1; |
| 375 } |
| 376 } |
| 377 } |
| 378 } |
| 379 |
186 // TODO(jingning) placeholder for inter-frame non-RD mode decision. | 380 // TODO(jingning) placeholder for inter-frame non-RD mode decision. |
187 // this needs various further optimizations. to be continued.. | 381 // this needs various further optimizations. to be continued.. |
188 int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, | 382 int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, |
189 const TileInfo *const tile, | 383 const TileInfo *const tile, |
190 int mi_row, int mi_col, | 384 int mi_row, int mi_col, |
191 int *returnrate, | 385 int *returnrate, |
192 int64_t *returndistortion, | 386 int64_t *returndistortion, |
193 BLOCK_SIZE bsize) { | 387 BLOCK_SIZE bsize) { |
194 MACROBLOCKD *xd = &x->e_mbd; | 388 MACROBLOCKD *xd = &x->e_mbd; |
195 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; | 389 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; |
196 struct macroblock_plane *const p = &x->plane[0]; | 390 struct macroblock_plane *const p = &x->plane[0]; |
197 struct macroblockd_plane *const pd = &xd->plane[0]; | 391 struct macroblockd_plane *const pd = &xd->plane[0]; |
198 PREDICTION_MODE this_mode, best_mode = ZEROMV; | 392 PREDICTION_MODE this_mode, best_mode = ZEROMV; |
199 MV_REFERENCE_FRAME ref_frame, best_ref_frame = LAST_FRAME; | 393 MV_REFERENCE_FRAME ref_frame, best_ref_frame = LAST_FRAME; |
| 394 TX_SIZE best_tx_size = MIN(max_txsize_lookup[bsize], |
| 395 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); |
200 INTERP_FILTER best_pred_filter = EIGHTTAP; | 396 INTERP_FILTER best_pred_filter = EIGHTTAP; |
201 int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; | 397 int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; |
202 struct buf_2d yv12_mb[4][MAX_MB_PLANE]; | 398 struct buf_2d yv12_mb[4][MAX_MB_PLANE]; |
203 static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, | 399 static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, |
204 VP9_ALT_FLAG }; | 400 VP9_ALT_FLAG }; |
205 int64_t best_rd = INT64_MAX; | 401 int64_t best_rd = INT64_MAX; |
206 int64_t this_rd = INT64_MAX; | 402 int64_t this_rd = INT64_MAX; |
207 int skip_txfm = 0; | 403 int skip_txfm = 0; |
208 | 404 |
209 int rate = INT_MAX; | 405 int rate = INT_MAX; |
210 int64_t dist = INT64_MAX; | 406 int64_t dist = INT64_MAX; |
211 // var_y and sse_y are saved to be used in skipping checking | 407 // var_y and sse_y are saved to be used in skipping checking |
212 unsigned int var_y = UINT_MAX; | 408 unsigned int var_y = UINT_MAX; |
213 unsigned int sse_y = UINT_MAX; | 409 unsigned int sse_y = UINT_MAX; |
214 | 410 |
215 VP9_COMMON *cm = &cpi->common; | 411 VP9_COMMON *cm = &cpi->common; |
216 int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); | 412 int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); |
217 | 413 |
218 const int64_t inter_mode_thresh = RDCOST(x->rdmult, x->rddiv, | 414 const int64_t inter_mode_thresh = RDCOST(x->rdmult, x->rddiv, |
219 intra_cost_penalty, 0); | 415 intra_cost_penalty, 0); |
220 const int64_t intra_mode_cost = 50; | 416 const int64_t intra_mode_cost = 50; |
221 | 417 |
222 unsigned char segment_id = mbmi->segment_id; | 418 unsigned char segment_id = mbmi->segment_id; |
223 const int *const rd_threshes = cpi->rd.threshes[segment_id][bsize]; | 419 const int *const rd_threshes = cpi->rd.threshes[segment_id][bsize]; |
224 const int *const rd_thresh_freq_fact = cpi->rd.thresh_freq_fact[bsize]; | 420 const int *const rd_thresh_freq_fact = cpi->rd.thresh_freq_fact[bsize]; |
225 // Mode index conversion form THR_MODES to PREDICTION_MODE for a ref frame. | 421 // Mode index conversion form THR_MODES to PREDICTION_MODE for a ref frame. |
226 int mode_idx[MB_MODE_COUNT] = {0}; | 422 int mode_idx[MB_MODE_COUNT] = {0}; |
227 INTERP_FILTER filter_ref = SWITCHABLE; | 423 INTERP_FILTER filter_ref = cm->interp_filter; |
228 int bsl = mi_width_log2_lookup[bsize]; | 424 int bsl = mi_width_log2_lookup[bsize]; |
229 const int pred_filter_search = (((mi_row + mi_col) >> bsl) + | 425 const int pred_filter_search = cm->interp_filter == SWITCHABLE ? |
230 get_chessboard_index(cm)) % 2; | 426 (((mi_row + mi_col) >> bsl) + get_chessboard_index(cm)) % 2 : 0; |
| 427 int const_motion[MAX_REF_FRAMES] = { 0 }; |
| 428 |
| 429 // For speed 6, the result of interp filter is reused later in actual encoding |
| 430 // process. |
| 431 int bh = num_4x4_blocks_high_lookup[bsize] << 2; |
| 432 int bw = num_4x4_blocks_wide_lookup[bsize] << 2; |
| 433 int pixels_in_block = bh * bw; |
| 434 // tmp[3] points to dst buffer, and the other 3 point to allocated buffers. |
| 435 PRED_BUFFER tmp[4]; |
| 436 DECLARE_ALIGNED_ARRAY(16, uint8_t, pred_buf, 3 * 64 * 64); |
| 437 struct buf_2d orig_dst = pd->dst; |
| 438 PRED_BUFFER *best_pred = NULL; |
| 439 PRED_BUFFER *this_mode_pred = NULL; |
| 440 int i; |
| 441 |
| 442 #if CONFIG_DENOISING |
| 443 if (cpi->oxcf.noise_sensitivity > 0) { |
| 444 vp9_denoiser_reset_frame_stats(&cpi->denoiser); |
| 445 } |
| 446 #endif |
| 447 |
| 448 if (cpi->sf.reuse_inter_pred_sby) { |
| 449 for (i = 0; i < 3; i++) { |
| 450 tmp[i].data = &pred_buf[pixels_in_block * i]; |
| 451 tmp[i].stride = bw; |
| 452 tmp[i].in_use = 0; |
| 453 } |
| 454 |
| 455 tmp[3].data = pd->dst.buf; |
| 456 tmp[3].stride = pd->dst.stride; |
| 457 tmp[3].in_use = 0; |
| 458 } |
231 | 459 |
232 x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; | 460 x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; |
233 | 461 |
234 x->skip = 0; | 462 x->skip = 0; |
235 | 463 |
236 // initialize mode decisions | 464 // initialize mode decisions |
237 *returnrate = INT_MAX; | 465 *returnrate = INT_MAX; |
238 *returndistortion = INT64_MAX; | 466 *returndistortion = INT64_MAX; |
239 vpx_memset(mbmi, 0, sizeof(MB_MODE_INFO)); | 467 vpx_memset(mbmi, 0, sizeof(MB_MODE_INFO)); |
240 mbmi->sb_type = bsize; | 468 mbmi->sb_type = bsize; |
241 mbmi->ref_frame[0] = NONE; | 469 mbmi->ref_frame[0] = NONE; |
242 mbmi->ref_frame[1] = NONE; | 470 mbmi->ref_frame[1] = NONE; |
243 mbmi->tx_size = MIN(max_txsize_lookup[bsize], | 471 mbmi->tx_size = MIN(max_txsize_lookup[bsize], |
244 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); | 472 tx_mode_to_biggest_tx_size[cm->tx_mode]); |
245 mbmi->interp_filter = cpi->common.interp_filter == SWITCHABLE ? | 473 mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? |
246 EIGHTTAP : cpi->common.interp_filter; | 474 EIGHTTAP : cm->interp_filter; |
247 mbmi->skip = 0; | 475 mbmi->skip = 0; |
248 mbmi->segment_id = segment_id; | 476 mbmi->segment_id = segment_id; |
249 | 477 |
250 for (ref_frame = LAST_FRAME; ref_frame <= LAST_FRAME ; ++ref_frame) { | 478 for (ref_frame = LAST_FRAME; ref_frame <= LAST_FRAME ; ++ref_frame) { |
251 x->pred_mv_sad[ref_frame] = INT_MAX; | 479 x->pred_mv_sad[ref_frame] = INT_MAX; |
252 if (cpi->ref_frame_flags & flag_list[ref_frame]) { | 480 if (cpi->ref_frame_flags & flag_list[ref_frame]) { |
253 vp9_setup_buffer_inter(cpi, x, tile, | 481 const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, ref_frame); |
254 ref_frame, bsize, mi_row, mi_col, | 482 int_mv *const candidates = mbmi->ref_mvs[ref_frame]; |
255 frame_mv[NEARESTMV], frame_mv[NEARMV], yv12_mb); | 483 const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf; |
| 484 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, |
| 485 sf, sf); |
| 486 |
| 487 if (cm->coding_use_prev_mi) |
| 488 vp9_find_mv_refs(cm, xd, tile, xd->mi[0], ref_frame, |
| 489 candidates, mi_row, mi_col); |
| 490 else |
| 491 const_motion[ref_frame] = mv_refs_rt(cm, xd, tile, xd->mi[0], |
| 492 ref_frame, candidates, |
| 493 mi_row, mi_col); |
| 494 |
| 495 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates, |
| 496 &frame_mv[NEARESTMV][ref_frame], |
| 497 &frame_mv[NEARMV][ref_frame]); |
| 498 |
| 499 if (!vp9_is_scaled(sf) && bsize >= BLOCK_8X8) |
| 500 vp9_mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12->y_stride, |
| 501 ref_frame, bsize); |
256 } | 502 } |
257 frame_mv[NEWMV][ref_frame].as_int = INVALID_MV; | 503 frame_mv[NEWMV][ref_frame].as_int = INVALID_MV; |
258 frame_mv[ZEROMV][ref_frame].as_int = 0; | 504 frame_mv[ZEROMV][ref_frame].as_int = 0; |
259 } | 505 } |
260 | 506 |
261 if (xd->up_available) | 507 if (xd->up_available) |
262 filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter; | 508 filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter; |
263 else if (xd->left_available) | 509 else if (xd->left_available) |
264 filter_ref = xd->mi[-1]->mbmi.interp_filter; | 510 filter_ref = xd->mi[-1]->mbmi.interp_filter; |
265 | 511 |
(...skipping 13 matching lines...) Expand all Loading... |
279 if (ref_frame == LAST_FRAME) { | 525 if (ref_frame == LAST_FRAME) { |
280 mode_idx[NEARESTMV] = THR_NEARESTMV; // LAST_FRAME, NEARESTMV | 526 mode_idx[NEARESTMV] = THR_NEARESTMV; // LAST_FRAME, NEARESTMV |
281 mode_idx[NEARMV] = THR_NEARMV; // LAST_FRAME, NEARMV | 527 mode_idx[NEARMV] = THR_NEARMV; // LAST_FRAME, NEARMV |
282 mode_idx[ZEROMV] = THR_ZEROMV; // LAST_FRAME, ZEROMV | 528 mode_idx[ZEROMV] = THR_ZEROMV; // LAST_FRAME, ZEROMV |
283 mode_idx[NEWMV] = THR_NEWMV; // LAST_FRAME, NEWMV | 529 mode_idx[NEWMV] = THR_NEWMV; // LAST_FRAME, NEWMV |
284 } | 530 } |
285 | 531 |
286 for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) { | 532 for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) { |
287 int rate_mv = 0; | 533 int rate_mv = 0; |
288 | 534 |
| 535 if (const_motion[ref_frame] && |
| 536 (this_mode == NEARMV || this_mode == ZEROMV)) |
| 537 continue; |
| 538 |
289 if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode))) | 539 if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode))) |
290 continue; | 540 continue; |
291 | 541 |
292 if (rd_less_than_thresh(best_rd, rd_threshes[mode_idx[this_mode]], | 542 if (rd_less_than_thresh(best_rd, rd_threshes[mode_idx[this_mode]], |
293 rd_thresh_freq_fact[this_mode])) | 543 rd_thresh_freq_fact[this_mode])) |
294 continue; | 544 continue; |
295 | 545 |
296 if (this_mode == NEWMV) { | 546 if (this_mode == NEWMV) { |
297 int rate_mode = 0; | 547 int rate_mode = 0; |
298 if (this_rd < (int64_t)(1 << num_pels_log2_lookup[bsize])) | 548 if (this_rd < (int64_t)(1 << num_pels_log2_lookup[bsize])) |
(...skipping 18 matching lines...) Expand all Loading... |
317 if (frame_mv[this_mode][ref_frame].as_int == | 567 if (frame_mv[this_mode][ref_frame].as_int == |
318 frame_mv[NEARESTMV][ref_frame].as_int) | 568 frame_mv[NEARESTMV][ref_frame].as_int) |
319 continue; | 569 continue; |
320 | 570 |
321 mbmi->mode = this_mode; | 571 mbmi->mode = this_mode; |
322 mbmi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int; | 572 mbmi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int; |
323 | 573 |
324 // Search for the best prediction filter type, when the resulting | 574 // Search for the best prediction filter type, when the resulting |
325 // motion vector is at sub-pixel accuracy level for luma component, i.e., | 575 // motion vector is at sub-pixel accuracy level for luma component, i.e., |
326 // the last three bits are all zeros. | 576 // the last three bits are all zeros. |
| 577 if (cpi->sf.reuse_inter_pred_sby) { |
| 578 if (this_mode == NEARESTMV) { |
| 579 this_mode_pred = &tmp[3]; |
| 580 } else { |
| 581 this_mode_pred = &tmp[get_pred_buffer(tmp, 3)]; |
| 582 pd->dst.buf = this_mode_pred->data; |
| 583 pd->dst.stride = bw; |
| 584 } |
| 585 } |
| 586 |
327 if ((this_mode == NEWMV || filter_ref == SWITCHABLE) && | 587 if ((this_mode == NEWMV || filter_ref == SWITCHABLE) && |
328 pred_filter_search && | 588 pred_filter_search && |
329 ((mbmi->mv[0].as_mv.row & 0x07) != 0 || | 589 ((mbmi->mv[0].as_mv.row & 0x07) != 0 || |
330 (mbmi->mv[0].as_mv.col & 0x07) != 0)) { | 590 (mbmi->mv[0].as_mv.col & 0x07) != 0)) { |
331 int pf_rate[3]; | 591 int pf_rate[3]; |
332 int64_t pf_dist[3]; | 592 int64_t pf_dist[3]; |
333 unsigned int pf_var[3]; | 593 unsigned int pf_var[3]; |
334 unsigned int pf_sse[3]; | 594 unsigned int pf_sse[3]; |
| 595 TX_SIZE pf_tx_size[3]; |
335 int64_t best_cost = INT64_MAX; | 596 int64_t best_cost = INT64_MAX; |
336 INTERP_FILTER best_filter = SWITCHABLE, filter; | 597 INTERP_FILTER best_filter = SWITCHABLE, filter; |
| 598 PRED_BUFFER *current_pred = this_mode_pred; |
337 | 599 |
338 for (filter = EIGHTTAP; filter <= EIGHTTAP_SHARP; ++filter) { | 600 for (filter = EIGHTTAP; filter <= EIGHTTAP_SHARP; ++filter) { |
339 int64_t cost; | 601 int64_t cost; |
340 mbmi->interp_filter = filter; | 602 mbmi->interp_filter = filter; |
341 vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize); | 603 vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize); |
342 model_rd_for_sb_y(cpi, bsize, x, xd, &pf_rate[filter], | 604 model_rd_for_sb_y(cpi, bsize, x, xd, &pf_rate[filter], |
343 &pf_dist[filter], &pf_var[filter], &pf_sse[filter]); | 605 &pf_dist[filter], &pf_var[filter], &pf_sse[filter]); |
344 cost = RDCOST(x->rdmult, x->rddiv, | 606 cost = RDCOST(x->rdmult, x->rddiv, |
345 vp9_get_switchable_rate(cpi) + pf_rate[filter], | 607 vp9_get_switchable_rate(cpi) + pf_rate[filter], |
346 pf_dist[filter]); | 608 pf_dist[filter]); |
| 609 pf_tx_size[filter] = mbmi->tx_size; |
347 if (cost < best_cost) { | 610 if (cost < best_cost) { |
348 best_filter = filter; | 611 best_filter = filter; |
349 best_cost = cost; | 612 best_cost = cost; |
350 skip_txfm = x->skip_txfm; | 613 skip_txfm = x->skip_txfm; |
| 614 |
| 615 if (cpi->sf.reuse_inter_pred_sby) { |
| 616 if (this_mode_pred != current_pred) { |
| 617 free_pred_buffer(this_mode_pred); |
| 618 this_mode_pred = current_pred; |
| 619 } |
| 620 |
| 621 if (filter < EIGHTTAP_SHARP) { |
| 622 current_pred = &tmp[get_pred_buffer(tmp, 3)]; |
| 623 pd->dst.buf = current_pred->data; |
| 624 pd->dst.stride = bw; |
| 625 } |
| 626 } |
351 } | 627 } |
352 } | 628 } |
353 | 629 |
| 630 if (cpi->sf.reuse_inter_pred_sby && this_mode_pred != current_pred) |
| 631 free_pred_buffer(current_pred); |
| 632 |
354 mbmi->interp_filter = best_filter; | 633 mbmi->interp_filter = best_filter; |
| 634 mbmi->tx_size = pf_tx_size[mbmi->interp_filter]; |
355 rate = pf_rate[mbmi->interp_filter]; | 635 rate = pf_rate[mbmi->interp_filter]; |
356 dist = pf_dist[mbmi->interp_filter]; | 636 dist = pf_dist[mbmi->interp_filter]; |
357 var_y = pf_var[mbmi->interp_filter]; | 637 var_y = pf_var[mbmi->interp_filter]; |
358 sse_y = pf_sse[mbmi->interp_filter]; | 638 sse_y = pf_sse[mbmi->interp_filter]; |
359 x->skip_txfm = skip_txfm; | 639 x->skip_txfm = skip_txfm; |
360 } else { | 640 } else { |
361 mbmi->interp_filter = (filter_ref == SWITCHABLE) ? EIGHTTAP: filter_ref; | 641 mbmi->interp_filter = (filter_ref == SWITCHABLE) ? EIGHTTAP: filter_ref; |
362 vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize); | 642 vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize); |
363 model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist, &var_y, &sse_y); | 643 model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist, &var_y, &sse_y); |
364 } | 644 } |
365 | 645 |
366 rate += rate_mv; | 646 rate += rate_mv; |
367 rate += cpi->inter_mode_cost[mbmi->mode_context[ref_frame]] | 647 rate += cpi->inter_mode_cost[mbmi->mode_context[ref_frame]] |
368 [INTER_OFFSET(this_mode)]; | 648 [INTER_OFFSET(this_mode)]; |
369 this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist); | 649 this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist); |
370 | 650 |
371 // Skipping checking: test to see if this block can be reconstructed by | 651 // Skipping checking: test to see if this block can be reconstructed by |
372 // prediction only. | 652 // prediction only. |
373 if (!x->in_active_map) { | 653 if (cpi->allow_encode_breakout) { |
374 x->skip = 1; | 654 encode_breakout_test(cpi, x, bsize, mi_row, mi_col, ref_frame, |
375 } else if (cpi->allow_encode_breakout && x->encode_breakout) { | 655 this_mode, var_y, sse_y, yv12_mb, &rate, &dist); |
376 const BLOCK_SIZE uv_size = get_plane_block_size(bsize, &xd->plane[1]); | 656 if (x->skip) { |
377 unsigned int var = var_y, sse = sse_y; | 657 rate += rate_mv; |
378 // Skipping threshold for ac. | 658 this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist); |
379 unsigned int thresh_ac; | |
380 // Skipping threshold for dc. | |
381 unsigned int thresh_dc; | |
382 // Set a maximum for threshold to avoid big PSNR loss in low bit rate | |
383 // case. Use extreme low threshold for static frames to limit skipping. | |
384 const unsigned int max_thresh = 36000; | |
385 // The encode_breakout input | |
386 const unsigned int min_thresh = | |
387 MIN(((unsigned int)x->encode_breakout << 4), max_thresh); | |
388 | |
389 // Calculate threshold according to dequant value. | |
390 thresh_ac = (xd->plane[0].dequant[1] * xd->plane[0].dequant[1]) / 9; | |
391 thresh_ac = clamp(thresh_ac, min_thresh, max_thresh); | |
392 | |
393 // Adjust ac threshold according to partition size. | |
394 thresh_ac >>= 8 - (b_width_log2_lookup[bsize] + | |
395 b_height_log2_lookup[bsize]); | |
396 | |
397 thresh_dc = (xd->plane[0].dequant[0] * xd->plane[0].dequant[0] >> 6); | |
398 | |
399 // Y skipping condition checking for ac and dc. | |
400 if (var <= thresh_ac && (sse - var) <= thresh_dc) { | |
401 unsigned int sse_u, sse_v; | |
402 unsigned int var_u, var_v; | |
403 | |
404 // Skip u v prediction for less calculation, that won't affect | |
405 // result much. | |
406 var_u = cpi->fn_ptr[uv_size].vf(x->plane[1].src.buf, | |
407 x->plane[1].src.stride, | |
408 xd->plane[1].dst.buf, | |
409 xd->plane[1].dst.stride, &sse_u); | |
410 | |
411 // U skipping condition checking | |
412 if ((var_u * 4 <= thresh_ac) && (sse_u - var_u <= thresh_dc)) { | |
413 var_v = cpi->fn_ptr[uv_size].vf(x->plane[2].src.buf, | |
414 x->plane[2].src.stride, | |
415 xd->plane[2].dst.buf, | |
416 xd->plane[2].dst.stride, &sse_v); | |
417 | |
418 // V skipping condition checking | |
419 if ((var_v * 4 <= thresh_ac) && (sse_v - var_v <= thresh_dc)) { | |
420 x->skip = 1; | |
421 | |
422 // The cost of skip bit needs to be added. | |
423 rate = rate_mv; | |
424 rate += cpi->inter_mode_cost[mbmi->mode_context[ref_frame]] | |
425 [INTER_OFFSET(this_mode)]; | |
426 | |
427 // More on this part of rate | |
428 // rate += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1); | |
429 | |
430 // Scaling factor for SSE from spatial domain to frequency | |
431 // domain is 16. Adjust distortion accordingly. | |
432 // TODO(yunqingwang): In this function, only y-plane dist is | |
433 // calculated. | |
434 dist = (sse << 4); // + ((sse_u + sse_v) << 4); | |
435 this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist); | |
436 // *disable_skip = 1; | |
437 } | |
438 } | |
439 } | 659 } |
440 } | 660 } |
441 | 661 |
442 #if CONFIG_DENOISING | 662 #if CONFIG_DENOISING |
443 vp9_denoiser_update_frame_stats(); | 663 if (cpi->oxcf.noise_sensitivity > 0) { |
| 664 vp9_denoiser_update_frame_stats(&cpi->denoiser, mbmi, sse_y, this_mode); |
| 665 } |
444 #endif | 666 #endif |
445 | 667 |
446 if (this_rd < best_rd || x->skip) { | 668 if (this_rd < best_rd || x->skip) { |
447 best_rd = this_rd; | 669 best_rd = this_rd; |
448 *returnrate = rate; | 670 *returnrate = rate; |
449 *returndistortion = dist; | 671 *returndistortion = dist; |
450 best_mode = this_mode; | 672 best_mode = this_mode; |
451 best_pred_filter = mbmi->interp_filter; | 673 best_pred_filter = mbmi->interp_filter; |
| 674 best_tx_size = mbmi->tx_size; |
452 best_ref_frame = ref_frame; | 675 best_ref_frame = ref_frame; |
453 skip_txfm = x->skip_txfm; | 676 skip_txfm = x->skip_txfm; |
| 677 |
| 678 if (cpi->sf.reuse_inter_pred_sby) { |
| 679 if (best_pred != NULL) |
| 680 free_pred_buffer(best_pred); |
| 681 |
| 682 best_pred = this_mode_pred; |
| 683 } |
| 684 } else { |
| 685 if (cpi->sf.reuse_inter_pred_sby) |
| 686 free_pred_buffer(this_mode_pred); |
454 } | 687 } |
455 | 688 |
456 if (x->skip) | 689 if (x->skip) |
457 break; | 690 break; |
458 } | 691 } |
459 } | 692 } |
460 | 693 |
| 694 // If best prediction is not in dst buf, then copy the prediction block from |
| 695 // temp buf to dst buf. |
| 696 if (cpi->sf.reuse_inter_pred_sby && best_pred->data != orig_dst.buf) { |
| 697 uint8_t *copy_from, *copy_to; |
461 | 698 |
462 mbmi->mode = best_mode; | 699 pd->dst = orig_dst; |
| 700 copy_to = pd->dst.buf; |
| 701 |
| 702 copy_from = best_pred->data; |
| 703 |
| 704 vp9_convolve_copy(copy_from, bw, copy_to, pd->dst.stride, NULL, 0, NULL, 0, |
| 705 bw, bh); |
| 706 } |
| 707 |
| 708 mbmi->mode = best_mode; |
463 mbmi->interp_filter = best_pred_filter; | 709 mbmi->interp_filter = best_pred_filter; |
464 mbmi->ref_frame[0] = best_ref_frame; | 710 mbmi->tx_size = best_tx_size; |
465 mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int; | 711 mbmi->ref_frame[0] = best_ref_frame; |
| 712 mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int; |
466 xd->mi[0]->bmi[0].as_mv[0].as_int = mbmi->mv[0].as_int; | 713 xd->mi[0]->bmi[0].as_mv[0].as_int = mbmi->mv[0].as_int; |
467 x->skip_txfm = skip_txfm; | 714 x->skip_txfm = skip_txfm; |
468 | 715 |
469 // Perform intra prediction search, if the best SAD is above a certain | 716 // Perform intra prediction search, if the best SAD is above a certain |
470 // threshold. | 717 // threshold. |
471 if (!x->skip && best_rd > inter_mode_thresh && | 718 if (!x->skip && best_rd > inter_mode_thresh && |
472 bsize <= cpi->sf.max_intra_bsize) { | 719 bsize <= cpi->sf.max_intra_bsize) { |
| 720 int i, j; |
| 721 const int width = num_4x4_blocks_wide_lookup[bsize]; |
| 722 const int height = num_4x4_blocks_high_lookup[bsize]; |
| 723 |
| 724 int rate2 = 0; |
| 725 int64_t dist2 = 0; |
| 726 const int dst_stride = pd->dst.stride; |
| 727 const int src_stride = p->src.stride; |
| 728 int block_idx = 0; |
| 729 |
| 730 TX_SIZE tmp_tx_size = MIN(max_txsize_lookup[bsize], |
| 731 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); |
| 732 const int step = 1 << tmp_tx_size; |
| 733 |
473 for (this_mode = DC_PRED; this_mode <= DC_PRED; ++this_mode) { | 734 for (this_mode = DC_PRED; this_mode <= DC_PRED; ++this_mode) { |
474 vp9_predict_intra_block(xd, 0, b_width_log2(bsize), | 735 if (cpi->sf.reuse_inter_pred_sby) { |
475 mbmi->tx_size, this_mode, | 736 pd->dst.buf = tmp[0].data; |
476 &p->src.buf[0], p->src.stride, | 737 pd->dst.stride = bw; |
477 &pd->dst.buf[0], pd->dst.stride, 0, 0, 0); | 738 } |
478 | 739 |
479 model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist, &var_y, &sse_y); | 740 for (j = 0; j < height; j += step) { |
| 741 for (i = 0; i < width; i += step) { |
| 742 vp9_predict_intra_block(xd, block_idx, b_width_log2(bsize), |
| 743 tmp_tx_size, this_mode, |
| 744 &p->src.buf[4 * (j * dst_stride + i)], |
| 745 src_stride, |
| 746 &pd->dst.buf[4 * (j * dst_stride + i)], |
| 747 dst_stride, i, j, 0); |
| 748 model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist, &var_y, &sse_y); |
| 749 rate2 += rate; |
| 750 dist2 += dist; |
| 751 ++block_idx; |
| 752 } |
| 753 } |
| 754 |
| 755 rate = rate2; |
| 756 dist = dist2; |
| 757 |
480 rate += cpi->mbmode_cost[this_mode]; | 758 rate += cpi->mbmode_cost[this_mode]; |
481 rate += intra_cost_penalty; | 759 rate += intra_cost_penalty; |
482 this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist); | 760 this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist); |
483 | 761 |
| 762 if (cpi->sf.reuse_inter_pred_sby) |
| 763 pd->dst = orig_dst; |
| 764 |
484 if (this_rd + intra_mode_cost < best_rd) { | 765 if (this_rd + intra_mode_cost < best_rd) { |
485 best_rd = this_rd; | 766 best_rd = this_rd; |
486 *returnrate = rate; | 767 *returnrate = rate; |
487 *returndistortion = dist; | 768 *returndistortion = dist; |
488 mbmi->mode = this_mode; | 769 mbmi->mode = this_mode; |
| 770 mbmi->tx_size = tmp_tx_size; |
489 mbmi->ref_frame[0] = INTRA_FRAME; | 771 mbmi->ref_frame[0] = INTRA_FRAME; |
490 mbmi->uv_mode = this_mode; | 772 mbmi->uv_mode = this_mode; |
491 mbmi->mv[0].as_int = INVALID_MV; | 773 mbmi->mv[0].as_int = INVALID_MV; |
492 } else { | 774 } else { |
493 x->skip_txfm = skip_txfm; | 775 x->skip_txfm = skip_txfm; |
494 } | 776 } |
495 } | 777 } |
496 } | 778 } |
| 779 |
497 #if CONFIG_DENOISING | 780 #if CONFIG_DENOISING |
498 vp9_denoiser_denoise(&cpi->denoiser, x, mi_row, mi_col, bsize); | 781 if (cpi->oxcf.noise_sensitivity > 0) { |
| 782 vp9_denoiser_denoise(&cpi->denoiser, x, mi_row, mi_col, bsize); |
| 783 } |
499 #endif | 784 #endif |
500 | 785 |
501 return INT64_MAX; | 786 return INT64_MAX; |
502 } | 787 } |
OLD | NEW |