OLD | NEW |
(Empty) | |
| 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 |
| 11 #ifndef VP9_DECODER_VP9_DTHREAD_H_ |
| 12 #define VP9_DECODER_VP9_DTHREAD_H_ |
| 13 |
| 14 #include "./vpx_config.h" |
| 15 #include "vp9/common/vp9_thread.h" |
| 16 #include "vpx/internal/vpx_codec_internal.h" |
| 17 |
| 18 struct VP9Common; |
| 19 struct VP9Decoder; |
| 20 |
| 21 // WorkerData for the FrameWorker thread. It contains all the information of |
| 22 // the worker and decode structures for decoding a frame. |
| 23 typedef struct FrameWorkerData { |
| 24 struct VP9Decoder *pbi; |
| 25 const uint8_t *data; |
| 26 const uint8_t *data_end; |
| 27 size_t data_size; |
| 28 void *user_priv; |
| 29 int result; |
| 30 int worker_id; |
| 31 |
| 32 // scratch_buffer is used in frame parallel mode only. |
| 33 // It is used to make a copy of the compressed data. |
| 34 uint8_t *scratch_buffer; |
| 35 size_t scratch_buffer_size; |
| 36 |
| 37 #if CONFIG_MULTITHREAD |
| 38 pthread_mutex_t stats_mutex; |
| 39 pthread_cond_t stats_cond; |
| 40 #endif |
| 41 |
| 42 int frame_context_ready; // Current frame's context is ready to read. |
| 43 int frame_decoded; // Finished decoding current frame. |
| 44 } FrameWorkerData; |
| 45 |
| 46 void vp9_frameworker_lock_stats(VP9Worker *const worker); |
| 47 void vp9_frameworker_unlock_stats(VP9Worker *const worker); |
| 48 void vp9_frameworker_signal_stats(VP9Worker *const worker); |
| 49 |
| 50 // Wait until ref_buf has been decoded to row in real pixel unit. |
| 51 // Note: worker may already finish decoding ref_buf and release it in order to |
| 52 // start decoding next frame. So need to check whether worker is still decoding |
| 53 // ref_buf. |
| 54 void vp9_frameworker_wait(VP9Worker *const worker, RefCntBuffer *const ref_buf, |
| 55 int row); |
| 56 |
| 57 // FrameWorker broadcasts its decoding progress so other workers that are |
| 58 // waiting on it can resume decoding. |
| 59 void vp9_frameworker_broadcast(RefCntBuffer *const buf, int row); |
| 60 |
| 61 // Copy necessary decoding context from src worker to dst worker. |
| 62 void vp9_frameworker_copy_context(VP9Worker *const dst_worker, |
| 63 VP9Worker *const src_worker); |
| 64 |
| 65 #endif // VP9_DECODER_VP9_DTHREAD_H_ |
OLD | NEW |