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"
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
;
26 const uint8_t *data_end
;
33 // scratch_buffer is used in frame parallel mode only.
34 // It is used to make a copy of the compressed data.
35 uint8_t *scratch_buffer
;
36 size_t scratch_buffer_size
;
38 #if CONFIG_MULTITHREAD
39 pthread_mutex_t stats_mutex
;
40 pthread_cond_t stats_cond
;
43 int frame_context_ready
; // Current frame's context is ready to read.
44 int frame_decoded
; // Finished decoding current frame.
47 void vp10_frameworker_lock_stats(VPxWorker
*const worker
);
48 void vp10_frameworker_unlock_stats(VPxWorker
*const worker
);
49 void vp10_frameworker_signal_stats(VPxWorker
*const worker
);
51 // Wait until ref_buf has been decoded to row in real pixel unit.
52 // Note: worker may already finish decoding ref_buf and release it in order to
53 // start decoding next frame. So need to check whether worker is still decoding
55 void vp10_frameworker_wait(VPxWorker
*const worker
, RefCntBuffer
*const ref_buf
,
58 // FrameWorker broadcasts its decoding progress so other workers that are
59 // waiting on it can resume decoding.
60 void vp10_frameworker_broadcast(RefCntBuffer
*const buf
, int row
);
62 // Copy necessary decoding context from src worker to dst worker.
63 void vp10_frameworker_copy_context(VPxWorker
*const dst_worker
,
64 VPxWorker
*const src_worker
);
66 #endif // VP10_DECODER_DTHREAD_H_