2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #ifndef AV1_DECODER_DTHREAD_H_
13 #define AV1_DECODER_DTHREAD_H_
15 #include "./aom_config.h"
16 #include "aom_util/aom_thread.h"
17 #include "aom/internal/aom_codec_internal.h"
26 // WorkerData for the FrameWorker thread. It contains all the information of
27 // the worker and decode structures for decoding a frame.
28 typedef struct FrameWorkerData
{
29 struct AV1Decoder
*pbi
;
31 const uint8_t *data_end
;
38 // scratch_buffer is used in frame parallel mode only.
39 // It is used to make a copy of the compressed data.
40 uint8_t *scratch_buffer
;
41 size_t scratch_buffer_size
;
43 #if CONFIG_MULTITHREAD
44 pthread_mutex_t stats_mutex
;
45 pthread_cond_t stats_cond
;
48 int frame_context_ready
; // Current frame's context is ready to read.
49 int frame_decoded
; // Finished decoding current frame.
52 void av1_frameworker_lock_stats(AVxWorker
*const worker
);
53 void av1_frameworker_unlock_stats(AVxWorker
*const worker
);
54 void av1_frameworker_signal_stats(AVxWorker
*const worker
);
56 // Wait until ref_buf has been decoded to row in real pixel unit.
57 // Note: worker may already finish decoding ref_buf and release it in order to
58 // start decoding next frame. So need to check whether worker is still decoding
60 void av1_frameworker_wait(AVxWorker
*const worker
, RefCntBuffer
*const ref_buf
,
63 // FrameWorker broadcasts its decoding progress so other workers that are
64 // waiting on it can resume decoding.
65 void av1_frameworker_broadcast(RefCntBuffer
*const buf
, int row
);
67 // Copy necessary decoding context from src worker to dst worker.
68 void av1_frameworker_copy_context(AVxWorker
*const dst_worker
,
69 AVxWorker
*const src_worker
);
75 #endif // AV1_DECODER_DTHREAD_H_