| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 NULL, 0, NULL, 0, | 345 NULL, 0, NULL, 0, |
| 346 num_4x4_blocks_wide_lookup[bs] << 2, | 346 num_4x4_blocks_wide_lookup[bs] << 2, |
| 347 num_4x4_blocks_high_lookup[bs] << 2); | 347 num_4x4_blocks_high_lookup[bs] << 2); |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 | 350 |
| 351 static void copy_frame(YV12_BUFFER_CONFIG dest, const YV12_BUFFER_CONFIG src) { | 351 static void copy_frame(YV12_BUFFER_CONFIG dest, const YV12_BUFFER_CONFIG src) { |
| 352 int r; | 352 int r; |
| 353 const uint8_t *srcbuf = src.y_buffer; | 353 const uint8_t *srcbuf = src.y_buffer; |
| 354 uint8_t *destbuf = dest.y_buffer; | 354 uint8_t *destbuf = dest.y_buffer; |
| 355 |
| 355 assert(dest.y_width == src.y_width); | 356 assert(dest.y_width == src.y_width); |
| 356 assert(dest.y_height == src.y_height); | 357 assert(dest.y_height == src.y_height); |
| 357 | 358 |
| 358 for (r = 0; r < dest.y_height; ++r) { | 359 for (r = 0; r < dest.y_height; ++r) { |
| 359 vpx_memcpy(destbuf, srcbuf, dest.y_width); | 360 vpx_memcpy(destbuf, srcbuf, dest.y_width); |
| 360 destbuf += dest.y_stride; | 361 destbuf += dest.y_stride; |
| 361 srcbuf += src.y_stride; | 362 srcbuf += src.y_stride; |
| 362 } | 363 } |
| 363 } | 364 } |
| 364 | 365 |
| 365 static void swap_frame_buffer(YV12_BUFFER_CONFIG dest, | 366 static void swap_frame_buffer(YV12_BUFFER_CONFIG *dest, |
| 366 YV12_BUFFER_CONFIG src) { | 367 YV12_BUFFER_CONFIG *src) { |
| 367 uint8_t *tmp_buf = dest.y_buffer; | 368 uint8_t *tmp_buf = dest->y_buffer; |
| 368 assert(dest.y_width == src.y_width); | 369 assert(dest->y_width == src->y_width); |
| 369 assert(dest.y_height == src.y_height); | 370 assert(dest->y_height == src->y_height); |
| 370 dest.y_buffer = src.y_buffer; | 371 dest->y_buffer = src->y_buffer; |
| 371 src.y_buffer = tmp_buf; | 372 src->y_buffer = tmp_buf; |
| 372 } | 373 } |
| 373 | 374 |
| 374 void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser, | 375 void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser, |
| 375 YV12_BUFFER_CONFIG src, | 376 YV12_BUFFER_CONFIG src, |
| 376 FRAME_TYPE frame_type, | 377 FRAME_TYPE frame_type, |
| 377 int refresh_alt_ref_frame, | 378 int refresh_alt_ref_frame, |
| 378 int refresh_golden_frame, | 379 int refresh_golden_frame, |
| 379 int refresh_last_frame) { | 380 int refresh_last_frame) { |
| 380 if (frame_type == KEY_FRAME) { | 381 if (frame_type == KEY_FRAME) { |
| 381 int i; | 382 int i; |
| 382 // Start at 1 so as not to overwrite the INTRA_FRAME | 383 // Start at 1 so as not to overwrite the INTRA_FRAME |
| 383 for (i = 1; i < MAX_REF_FRAMES; ++i) | 384 for (i = 1; i < MAX_REF_FRAMES; ++i) |
| 384 copy_frame(denoiser->running_avg_y[i], src); | 385 copy_frame(denoiser->running_avg_y[i], src); |
| 385 return; | 386 return; |
| 386 } | 387 } |
| 387 | 388 |
| 388 /* For non key frames */ | 389 /* For non key frames */ |
| 389 if (refresh_alt_ref_frame) { | 390 if (refresh_alt_ref_frame) { |
| 390 swap_frame_buffer(denoiser->running_avg_y[ALTREF_FRAME], | 391 swap_frame_buffer(&denoiser->running_avg_y[ALTREF_FRAME], |
| 391 denoiser->running_avg_y[INTRA_FRAME]); | 392 &denoiser->running_avg_y[INTRA_FRAME]); |
| 392 } | 393 } |
| 393 if (refresh_golden_frame) { | 394 if (refresh_golden_frame) { |
| 394 swap_frame_buffer(denoiser->running_avg_y[GOLDEN_FRAME], | 395 swap_frame_buffer(&denoiser->running_avg_y[GOLDEN_FRAME], |
| 395 denoiser->running_avg_y[INTRA_FRAME]); | 396 &denoiser->running_avg_y[INTRA_FRAME]); |
| 396 } | 397 } |
| 397 if (refresh_last_frame) { | 398 if (refresh_last_frame) { |
| 398 swap_frame_buffer(denoiser->running_avg_y[LAST_FRAME], | 399 swap_frame_buffer(&denoiser->running_avg_y[LAST_FRAME], |
| 399 denoiser->running_avg_y[INTRA_FRAME]); | 400 &denoiser->running_avg_y[INTRA_FRAME]); |
| 400 } | 401 } |
| 401 } | 402 } |
| 402 | 403 |
| 403 void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx) { | 404 void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx) { |
| 404 ctx->zeromv_sse = UINT_MAX; | 405 ctx->zeromv_sse = UINT_MAX; |
| 405 // This should be initialized as zero since mode search stage might skip | 406 // This should be initialized as zero since mode search stage might skip |
| 406 // NEWMV mode if inferred motion vector modes provide sufficiently good | 407 // NEWMV mode if inferred motion vector modes provide sufficiently good |
| 407 // prediction quality. | 408 // prediction quality. |
| 408 ctx->newmv_sse = 0; | 409 ctx->newmv_sse = 0; |
| 409 } | 410 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 for (r = 0; r < yuv->uv_height; ++r) { | 496 for (r = 0; r < yuv->uv_height; ++r) { |
| 496 for (c = 0; c < yuv->uv_width; ++c) { | 497 for (c = 0; c < yuv->uv_width; ++c) { |
| 497 u[c] = UINT8_MAX / 2; | 498 u[c] = UINT8_MAX / 2; |
| 498 v[c] = UINT8_MAX / 2; | 499 v[c] = UINT8_MAX / 2; |
| 499 } | 500 } |
| 500 u += yuv->uv_stride; | 501 u += yuv->uv_stride; |
| 501 v += yuv->uv_stride; | 502 v += yuv->uv_stride; |
| 502 } | 503 } |
| 503 } | 504 } |
| 504 #endif | 505 #endif |
| OLD | NEW |