Index: source/libvpx/vp9/decoder/vp9_decoder.h |
diff --git a/source/libvpx/vp9/decoder/vp9_decoder.h b/source/libvpx/vp9/decoder/vp9_decoder.h |
index 1415019a191226108c92d75f04e3e333b4aab518..47cce068fdea039d341fc9cb963e1b380ecc75ac 100644 |
--- a/source/libvpx/vp9/decoder/vp9_decoder.h |
+++ b/source/libvpx/vp9/decoder/vp9_decoder.h |
@@ -19,6 +19,7 @@ |
#include "vp9/common/vp9_onyxc_int.h" |
#include "vp9/common/vp9_ppflags.h" |
#include "vp9/common/vp9_thread.h" |
+#include "vp9/decoder/vp9_dthread.h" |
#include "vp9/decoder/vp9_reader.h" |
#ifdef __cplusplus |
@@ -33,7 +34,7 @@ typedef struct TileData { |
} TileData; |
typedef struct TileWorkerData { |
- VP9_COMMON *cm; |
+ struct VP9Decoder *pbi; |
vp9_reader bit_reader; |
DECLARE_ALIGNED(16, MACROBLOCKD, xd); |
struct vpx_internal_error_info error_info; |
@@ -50,6 +51,12 @@ typedef struct VP9Decoder { |
int frame_parallel_decode; // frame-based threading. |
+ // TODO(hkuang): Combine this with cur_buf in macroblockd as they are |
+ // the same. |
+ RefCntBuffer *cur_buf; // Current decoding frame buffer. |
+ RefCntBuffer *prev_buf; // Previous decoding frame buffer. |
+ |
+ VP9Worker *frame_worker_owner; // frame_worker that owns this pbi. |
VP9Worker lf_worker; |
VP9Worker *tile_workers; |
TileWorkerData *tile_worker_data; |
@@ -66,7 +73,8 @@ typedef struct VP9Decoder { |
int max_threads; |
int inv_tile_order; |
- int need_resync; // wait for key/intra-only frame |
+ int need_resync; // wait for key/intra-only frame. |
+ int hold_ref_buf; // hold the reference buffer. |
} VP9Decoder; |
int vp9_receive_compressed_data(struct VP9Decoder *pbi, |
@@ -83,10 +91,6 @@ vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm, |
VP9_REFFRAME ref_frame_flag, |
YV12_BUFFER_CONFIG *sd); |
-struct VP9Decoder *vp9_decoder_create(); |
- |
-void vp9_decoder_remove(struct VP9Decoder *pbi); |
- |
static INLINE uint8_t read_marker(vpx_decrypt_cb decrypt_cb, |
void *decrypt_state, |
const uint8_t *data) { |
@@ -106,6 +110,25 @@ vpx_codec_err_t vp9_parse_superframe_index(const uint8_t *data, |
vpx_decrypt_cb decrypt_cb, |
void *decrypt_state); |
+struct VP9Decoder *vp9_decoder_create(BufferPool *const pool); |
+ |
+void vp9_decoder_remove(struct VP9Decoder *pbi); |
+ |
+static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs, |
+ BufferPool *const pool) { |
+ if (idx >= 0) { |
+ --frame_bufs[idx].ref_count; |
+ // A worker may only get a free framebuffer index when calling get_free_fb. |
+ // But the private buffer is not set up until finish decoding header. |
+ // So any error happens during decoding header, the frame_bufs will not |
+ // have valid priv buffer. |
+ if (frame_bufs[idx].ref_count == 0 && |
+ frame_bufs[idx].raw_frame_buffer.priv) { |
+ pool->release_fb_cb(pool->cb_priv, &frame_bufs[idx].raw_frame_buffer); |
+ } |
+ } |
+} |
+ |
#ifdef __cplusplus |
} // extern "C" |
#endif |