summaryrefslogtreecommitdiff
path: root/media/libaom/src/av1/decoder/decoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/libaom/src/av1/decoder/decoder.h')
-rw-r--r--media/libaom/src/av1/decoder/decoder.h88
1 files changed, 51 insertions, 37 deletions
diff --git a/media/libaom/src/av1/decoder/decoder.h b/media/libaom/src/av1/decoder/decoder.h
index 5ca939c245..4580de2ac7 100644
--- a/media/libaom/src/av1/decoder/decoder.h
+++ b/media/libaom/src/av1/decoder/decoder.h
@@ -19,8 +19,8 @@
#include "aom_scale/yv12config.h"
#include "aom_util/aom_thread.h"
+#include "av1/common/av1_common_int.h"
#include "av1/common/thread_common.h"
-#include "av1/common/onyxc_int.h"
#include "av1/decoder/dthread.h"
#if CONFIG_ACCOUNTING
#include "av1/decoder/accounting.h"
@@ -41,18 +41,15 @@ typedef void (*decode_block_visitor_fn_t)(const AV1_COMMON *const cm,
typedef void (*predict_inter_block_visitor_fn_t)(AV1_COMMON *const cm,
MACROBLOCKD *const xd,
- int mi_row, int mi_col,
BLOCK_SIZE bsize);
typedef void (*cfl_store_inter_block_visitor_fn_t)(AV1_COMMON *const cm,
MACROBLOCKD *const xd);
typedef struct ThreadData {
- aom_reader *bit_reader;
DECLARE_ALIGNED(32, MACROBLOCKD, xd);
- /* dqcoeff are shared by all the planes. So planes must be decoded serially */
- DECLARE_ALIGNED(32, tran_low_t, dqcoeff[MAX_TX_SQUARE]);
CB_BUFFER cb_buffer_base;
+ aom_reader *bit_reader;
uint8_t *mc_buf[2];
int32_t mc_buf_size;
int mc_buf_use_highbd; // Boolean: whether the byte pointers stored in
@@ -97,9 +94,26 @@ typedef struct AV1DecRowMTInfo {
int tile_cols_end;
int start_tile;
int end_tile;
+ int mi_rows_to_decode;
+
+ // Invariant:
+ // mi_rows_parse_done >= mi_rows_decode_started.
+ // mi_rows_parse_done and mi_rows_decode_started are both initialized to 0.
+ // mi_rows_parse_done is incremented freely. mi_rows_decode_started may only
+ // be incremented to catch up with mi_rows_parse_done but is not allowed to
+ // surpass mi_rows_parse_done.
+ //
+ // When mi_rows_decode_started reaches mi_rows_to_decode, there are no more
+ // decode jobs.
+
+ // Indicates the progress of the bit-stream parsing of superblocks.
+ // Initialized to 0. Incremented by sb_mi_size when parse sb row is done.
int mi_rows_parse_done;
+ // Indicates the progress of the decoding of superblocks.
+ // Initialized to 0. Incremented by sb_mi_size when decode sb row is started.
int mi_rows_decode_started;
- int mi_rows_to_decode;
+ // Boolean: Initialized to 0 (false). Set to 1 (true) on error to abort
+ // decoding.
int row_mt_exit;
} AV1DecRowMTInfo;
@@ -146,13 +160,6 @@ typedef struct AV1Decoder {
DECLARE_ALIGNED(32, AV1_COMMON, common);
- int refresh_frame_flags;
-
- // TODO(hkuang): Combine this with cur_buf in macroblockd as they are
- // the same.
- RefCntBuffer *cur_buf; // Current decoding frame buffer.
-
- AVxWorker *frame_worker_owner; // frame_worker that owns this pbi.
AVxWorker lf_worker;
AV1LfSync lf_row_sync;
AV1LrSync lr_row_sync;
@@ -178,8 +185,7 @@ typedef struct AV1Decoder {
// Note: The saved buffers are released at the start of the next time the
// application calls aom_codec_decode().
int output_all_layers;
- YV12_BUFFER_CONFIG *output_frames[MAX_NUM_SPATIAL_LAYERS];
- size_t output_frame_index[MAX_NUM_SPATIAL_LAYERS]; // Buffer pool indices
+ RefCntBuffer *output_frames[MAX_NUM_SPATIAL_LAYERS];
size_t num_output_frames; // How many frames are queued up so far?
// In order to properly support random-access decoding, we need
@@ -190,8 +196,8 @@ typedef struct AV1Decoder {
int allow_lowbitdepth;
int max_threads;
int inv_tile_order;
- int need_resync; // wait for key/intra-only frame.
- int hold_ref_buf; // hold the reference buffer.
+ int need_resync; // wait for key/intra-only frame.
+ int reset_decoder_state;
int tile_size_bytes;
int tile_col_size_bytes;
@@ -200,9 +206,6 @@ typedef struct AV1Decoder {
int acct_enabled;
Accounting accounting;
#endif
- int tg_size; // Number of tiles in the current tilegroup
- int tg_start; // First tile in the current tilegroup
- int tg_size_bit_offset;
int sequence_header_ready;
int sequence_header_changed;
#if CONFIG_INSPECTION
@@ -212,6 +215,8 @@ typedef struct AV1Decoder {
int operating_point;
int current_operating_point;
int seen_frame_header;
+ // The expected start_tile (tg_start syntax element) of the next tile group.
+ int next_start_tile;
// State if the camera frame header is already decoded while
// large_scale_tile = 1.
@@ -225,9 +230,7 @@ typedef struct AV1Decoder {
unsigned int ext_tile_debug; // for ext-tile software debug & testing
unsigned int row_mt;
EXTERNAL_REFERENCES ext_refs;
- size_t tile_list_size;
- uint8_t *tile_list_output;
- size_t buffer_sz;
+ YV12_BUFFER_CONFIG tile_list_outbuf;
CB_BUFFER *cb_buffer_base;
int cb_buffer_alloc_size;
@@ -240,12 +243,19 @@ typedef struct AV1Decoder {
#endif
AV1DecRowMTInfo frame_row_mt_info;
+ aom_metadata_array_t *metadata;
+
+ int context_update_tile_id;
+ int skip_loop_filter;
+ int skip_film_grain;
+ int is_annexb;
+ int valid_for_referencing[REF_FRAMES];
} AV1Decoder;
// Returns 0 on success. Sets pbi->common.error.error_code to a nonzero error
// code and returns a nonzero value on failure.
int av1_receive_compressed_data(struct AV1Decoder *pbi, size_t size,
- const uint8_t **dest);
+ const uint8_t **psource);
// Get the frame at a particular index in the output queue
int av1_get_raw_frame(AV1Decoder *pbi, size_t index, YV12_BUFFER_CONFIG **sd,
@@ -266,23 +276,28 @@ aom_codec_err_t av1_copy_new_frame_dec(AV1_COMMON *cm,
struct AV1Decoder *av1_decoder_create(BufferPool *const pool);
void av1_decoder_remove(struct AV1Decoder *pbi);
-void av1_dealloc_dec_jobs(struct AV1DecTileMTData *tile_jobs_sync);
+void av1_dealloc_dec_jobs(struct AV1DecTileMTData *tile_mt_info);
void av1_dec_row_mt_dealloc(AV1DecRowMTSync *dec_row_mt_sync);
void av1_dec_free_cb_buf(AV1Decoder *pbi);
-static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs,
+static INLINE void decrease_ref_count(RefCntBuffer *const buf,
BufferPool *const pool) {
- if (idx >= 0) {
- --frame_bufs[idx].ref_count;
+ if (buf != NULL) {
+ --buf->ref_count;
+ // Reference counts should never become negative. If this assertion fails,
+ // there is a bug in our reference count management.
+ assert(buf->ref_count >= 0);
// 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);
+ // But the raw frame buffer is not set up until we finish decoding header.
+ // So if any error happens during decoding header, frame_bufs[idx] will not
+ // have a valid raw frame buffer.
+ if (buf->ref_count == 0 && buf->raw_frame_buffer.data) {
+ pool->release_fb_cb(pool->cb_priv, &buf->raw_frame_buffer);
+ buf->raw_frame_buffer.data = NULL;
+ buf->raw_frame_buffer.size = 0;
+ buf->raw_frame_buffer.priv = NULL;
}
}
}
@@ -302,9 +317,8 @@ static INLINE int av1_read_uniform(aom_reader *r, int n) {
typedef void (*palette_visitor_fn_t)(MACROBLOCKD *const xd, int plane,
aom_reader *r);
-void av1_visit_palette(AV1Decoder *const pbi, MACROBLOCKD *const xd, int mi_row,
- int mi_col, aom_reader *r, BLOCK_SIZE bsize,
- palette_visitor_fn_t visit);
+void av1_visit_palette(AV1Decoder *const pbi, MACROBLOCKD *const xd,
+ aom_reader *r, palette_visitor_fn_t visit);
typedef void (*block_visitor_fn_t)(AV1Decoder *const pbi, ThreadData *const td,
int mi_row, int mi_col, aom_reader *r,