| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 &denoiser->running_avg_y[INTRA_FRAME]); | 396 &denoiser->running_avg_y[INTRA_FRAME]); |
| 397 } | 397 } |
| 398 if (refresh_last_frame) { | 398 if (refresh_last_frame) { |
| 399 swap_frame_buffer(&denoiser->running_avg_y[LAST_FRAME], | 399 swap_frame_buffer(&denoiser->running_avg_y[LAST_FRAME], |
| 400 &denoiser->running_avg_y[INTRA_FRAME]); | 400 &denoiser->running_avg_y[INTRA_FRAME]); |
| 401 } | 401 } |
| 402 } | 402 } |
| 403 | 403 |
| 404 void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx) { | 404 void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx) { |
| 405 ctx->zeromv_sse = UINT_MAX; | 405 ctx->zeromv_sse = UINT_MAX; |
| 406 ctx->newmv_sse = UINT_MAX; | 406 // This should be initialized as zero since mode search stage might skip |
| 407 // NEWMV mode if inferred motion vector modes provide sufficiently good |
| 408 // prediction quality. |
| 409 ctx->newmv_sse = 0; |
| 407 } | 410 } |
| 408 | 411 |
| 409 void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi, unsigned int sse, | 412 void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi, unsigned int sse, |
| 410 PREDICTION_MODE mode, | 413 PREDICTION_MODE mode, |
| 411 PICK_MODE_CONTEXT *ctx) { | 414 PICK_MODE_CONTEXT *ctx) { |
| 412 // TODO(tkopp): Use both MVs if possible | 415 // TODO(tkopp): Use both MVs if possible |
| 413 if (mbmi->mv[0].as_int == 0 && sse < ctx->zeromv_sse) { | 416 if (mbmi->mv[0].as_int == 0 && sse < ctx->zeromv_sse) { |
| 414 ctx->zeromv_sse = sse; | 417 ctx->zeromv_sse = sse; |
| 415 ctx->best_zeromv_reference_frame = mbmi->ref_frame[0]; | 418 ctx->best_zeromv_reference_frame = mbmi->ref_frame[0]; |
| 416 } | 419 } |
| 417 | 420 |
| 418 if (mbmi->mv[0].as_int != 0 && sse < ctx->newmv_sse) { | 421 if (mode == NEWMV) { |
| 419 ctx->newmv_sse = sse; | 422 ctx->newmv_sse = sse; |
| 420 ctx->best_sse_inter_mode = mode; | 423 ctx->best_sse_inter_mode = mode; |
| 421 ctx->best_sse_mv = mbmi->mv[0]; | 424 ctx->best_sse_mv = mbmi->mv[0]; |
| 422 ctx->best_reference_frame = mbmi->ref_frame[0]; | 425 ctx->best_reference_frame = mbmi->ref_frame[0]; |
| 423 } | 426 } |
| 424 } | 427 } |
| 425 | 428 |
| 426 int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height, | 429 int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height, |
| 427 int ssx, int ssy, | 430 int ssx, int ssy, |
| 428 #if CONFIG_VP9_HIGHBITDEPTH | 431 #if CONFIG_VP9_HIGHBITDEPTH |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 for (r = 0; r < yuv->uv_height; ++r) { | 492 for (r = 0; r < yuv->uv_height; ++r) { |
| 490 for (c = 0; c < yuv->uv_width; ++c) { | 493 for (c = 0; c < yuv->uv_width; ++c) { |
| 491 u[c] = UINT8_MAX / 2; | 494 u[c] = UINT8_MAX / 2; |
| 492 v[c] = UINT8_MAX / 2; | 495 v[c] = UINT8_MAX / 2; |
| 493 } | 496 } |
| 494 u += yuv->uv_stride; | 497 u += yuv->uv_stride; |
| 495 v += yuv->uv_stride; | 498 v += yuv->uv_stride; |
| 496 } | 499 } |
| 497 } | 500 } |
| 498 #endif | 501 #endif |
| OLD | NEW |