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