vp9_ethread.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 VPX_VP9_ENCODER_VP9_ETHREAD_H_
  11. #define VPX_VP9_ENCODER_VP9_ETHREAD_H_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define MAX_NUM_TILE_COLS (1 << 6)
  16. #define MAX_NUM_TILE_ROWS 4
  17. #define MAX_NUM_THREADS 80
  18. struct VP9_COMP;
  19. struct ThreadData;
  20. typedef struct EncWorkerData {
  21. struct VP9_COMP *cpi;
  22. struct ThreadData *td;
  23. int start;
  24. int thread_id;
  25. int tile_completion_status[MAX_NUM_TILE_COLS];
  26. } EncWorkerData;
  27. // Encoder row synchronization
  28. typedef struct VP9RowMTSyncData {
  29. #if CONFIG_MULTITHREAD
  30. pthread_mutex_t *mutex;
  31. pthread_cond_t *cond;
  32. #endif
  33. // Allocate memory to store the sb/mb block index in each row.
  34. int *cur_col;
  35. int sync_range;
  36. int rows;
  37. } VP9RowMTSync;
  38. void vp9_encode_tiles_mt(struct VP9_COMP *cpi);
  39. void vp9_encode_tiles_row_mt(struct VP9_COMP *cpi);
  40. void vp9_encode_fp_row_mt(struct VP9_COMP *cpi);
  41. void vp9_row_mt_sync_read(VP9RowMTSync *const row_mt_sync, int r, int c);
  42. void vp9_row_mt_sync_write(VP9RowMTSync *const row_mt_sync, int r, int c,
  43. const int cols);
  44. void vp9_row_mt_sync_read_dummy(VP9RowMTSync *const row_mt_sync, int r, int c);
  45. void vp9_row_mt_sync_write_dummy(VP9RowMTSync *const row_mt_sync, int r, int c,
  46. const int cols);
  47. // Allocate memory for row based multi-threading synchronization.
  48. void vp9_row_mt_sync_mem_alloc(VP9RowMTSync *row_mt_sync, struct VP9Common *cm,
  49. int rows);
  50. // Deallocate row based multi-threading synchronization related mutex and data.
  51. void vp9_row_mt_sync_mem_dealloc(VP9RowMTSync *row_mt_sync);
  52. void vp9_temporal_filter_row_mt(struct VP9_COMP *cpi);
  53. #ifdef __cplusplus
  54. } // extern "C"
  55. #endif
  56. #endif // VPX_VP9_ENCODER_VP9_ETHREAD_H_