vp9_thread_common.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2014 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_COMMON_VP9_THREAD_COMMON_H_
  11. #define VP9_COMMON_VP9_THREAD_COMMON_H_
  12. #include "./vpx_config.h"
  13. #include "vp9/common/vp9_loopfilter.h"
  14. #include "vpx_util/vpx_thread.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. struct VP9Common;
  19. struct FRAME_COUNTS;
  20. // Loopfilter row synchronization
  21. typedef struct VP9LfSyncData {
  22. #if CONFIG_MULTITHREAD
  23. pthread_mutex_t *mutex_;
  24. pthread_cond_t *cond_;
  25. #endif
  26. // Allocate memory to store the loop-filtered superblock index in each row.
  27. int *cur_sb_col;
  28. // The optimal sync_range for different resolution and platform should be
  29. // determined by testing. Currently, it is chosen to be a power-of-2 number.
  30. int sync_range;
  31. int rows;
  32. // Row-based parallel loopfilter data
  33. LFWorkerData *lfdata;
  34. int num_workers;
  35. } VP9LfSync;
  36. // Allocate memory for loopfilter row synchronization.
  37. void vp9_loop_filter_alloc(VP9LfSync *lf_sync, struct VP9Common *cm, int rows,
  38. int width, int num_workers);
  39. // Deallocate loopfilter synchronization related mutex and data.
  40. void vp9_loop_filter_dealloc(VP9LfSync *lf_sync);
  41. // Multi-threaded loopfilter that uses the tile threads.
  42. void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
  43. struct VP9Common *cm,
  44. struct macroblockd_plane planes[MAX_MB_PLANE],
  45. int frame_filter_level,
  46. int y_only, int partial_frame,
  47. VPxWorker *workers, int num_workers,
  48. VP9LfSync *lf_sync);
  49. void vp9_accumulate_frame_counts(struct FRAME_COUNTS *accum,
  50. const struct FRAME_COUNTS *counts, int is_dec);
  51. #ifdef __cplusplus
  52. } // extern "C"
  53. #endif
  54. #endif // VP9_COMMON_VP9_THREAD_COMMON_H_