2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
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.
11 #ifndef VP10_DECODER_DTHREAD_H_
12 #define VP10_DECODER_DTHREAD_H_
14 #include "./vpx_config.h"
15 #include "vpx_util/vpx_thread.h"
16 #include "vpx/internal/vpx_codec_internal.h"
25 // WorkerData for the FrameWorker thread. It contains all the information of
26 // the worker and decode structures for decoding a frame.
27 typedef struct FrameWorkerData {
28 struct VP10Decoder *pbi;
30 const uint8_t *data_end;
37 // scratch_buffer is used in frame parallel mode only.
38 // It is used to make a copy of the compressed data.
39 uint8_t *scratch_buffer;
40 size_t scratch_buffer_size;
42 #if CONFIG_MULTITHREAD
43 pthread_mutex_t stats_mutex;
44 pthread_cond_t stats_cond;
47 int frame_context_ready; // Current frame's context is ready to read.
48 int frame_decoded; // Finished decoding current frame.
51 void vp10_frameworker_lock_stats(VPxWorker *const worker);
52 void vp10_frameworker_unlock_stats(VPxWorker *const worker);
53 void vp10_frameworker_signal_stats(VPxWorker *const worker);
55 // Wait until ref_buf has been decoded to row in real pixel unit.
56 // Note: worker may already finish decoding ref_buf and release it in order to
57 // start decoding next frame. So need to check whether worker is still decoding
59 void vp10_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
62 // FrameWorker broadcasts its decoding progress so other workers that are
63 // waiting on it can resume decoding.
64 void vp10_frameworker_broadcast(RefCntBuffer *const buf, int row);
66 // Copy necessary decoding context from src worker to dst worker.
67 void vp10_frameworker_copy_context(VPxWorker *const dst_worker,
68 VPxWorker *const src_worker);
74 #endif // VP10_DECODER_DTHREAD_H_