vp9_job_queue.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2018 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_DECODER_VP9_JOB_QUEUE_H_
  11. #define VPX_VP9_DECODER_VP9_JOB_QUEUE_H_
  12. #include "vpx_util/vpx_thread.h"
  13. typedef struct {
  14. // Pointer to buffer base which contains the jobs
  15. uint8_t *buf_base;
  16. // Pointer to current address where new job can be added
  17. uint8_t *volatile buf_wr;
  18. // Pointer to current address from where next job can be obtained
  19. uint8_t *volatile buf_rd;
  20. // Pointer to end of job buffer
  21. uint8_t *buf_end;
  22. int terminate;
  23. #if CONFIG_MULTITHREAD
  24. pthread_mutex_t mutex;
  25. pthread_cond_t cond;
  26. #endif
  27. } JobQueueRowMt;
  28. void vp9_jobq_init(JobQueueRowMt *jobq, uint8_t *buf, size_t buf_size);
  29. void vp9_jobq_reset(JobQueueRowMt *jobq);
  30. void vp9_jobq_deinit(JobQueueRowMt *jobq);
  31. void vp9_jobq_terminate(JobQueueRowMt *jobq);
  32. int vp9_jobq_queue(JobQueueRowMt *jobq, void *job, size_t job_size);
  33. int vp9_jobq_dequeue(JobQueueRowMt *jobq, void *job, size_t job_size,
  34. int blocking);
  35. #endif // VPX_VP9_DECODER_VP9_JOB_QUEUE_H_