vp9_denoiser.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
  3. *
  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
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef VP9_ENCODER_DENOISER_H_
  11. #define VP9_ENCODER_DENOISER_H_
  12. #include "vp9/encoder/vp9_block.h"
  13. #include "vpx_scale/yv12config.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #define MOTION_MAGNITUDE_THRESHOLD (8 * 3)
  18. typedef enum vp9_denoiser_decision {
  19. COPY_BLOCK,
  20. FILTER_BLOCK
  21. } VP9_DENOISER_DECISION;
  22. typedef struct vp9_denoiser {
  23. YV12_BUFFER_CONFIG running_avg_y[MAX_REF_FRAMES];
  24. YV12_BUFFER_CONFIG mc_running_avg_y;
  25. int increase_denoising;
  26. int frame_buffer_initialized;
  27. } VP9_DENOISER;
  28. void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
  29. YV12_BUFFER_CONFIG src,
  30. FRAME_TYPE frame_type,
  31. int refresh_alt_ref_frame,
  32. int refresh_golden_frame,
  33. int refresh_last_frame);
  34. void vp9_denoiser_denoise(VP9_DENOISER *denoiser, MACROBLOCK *mb,
  35. int mi_row, int mi_col, BLOCK_SIZE bs,
  36. PICK_MODE_CONTEXT *ctx);
  37. void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx);
  38. void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi,
  39. unsigned int sse, PREDICTION_MODE mode,
  40. PICK_MODE_CONTEXT *ctx);
  41. int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
  42. int ssx, int ssy,
  43. #if CONFIG_VP9_HIGHBITDEPTH
  44. int use_highbitdepth,
  45. #endif
  46. int border);
  47. #if CONFIG_VP9_TEMPORAL_DENOISING
  48. int total_adj_strong_thresh(BLOCK_SIZE bs, int increase_denoising);
  49. #endif
  50. void vp9_denoiser_free(VP9_DENOISER *denoiser);
  51. #ifdef __cplusplus
  52. } // extern "C"
  53. #endif
  54. #endif // VP9_ENCODER_DENOISER_H_