/src/aom/av1/decoder/decoder.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2016, Alliance for Open Media. All rights reserved. |
3 | | * |
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. |
10 | | */ |
11 | | |
12 | | #ifndef AOM_AV1_DECODER_DECODER_H_ |
13 | | #define AOM_AV1_DECODER_DECODER_H_ |
14 | | |
15 | | #include "config/aom_config.h" |
16 | | |
17 | | #include "aom/aom_codec.h" |
18 | | #include "aom_dsp/bitreader.h" |
19 | | #include "aom_scale/yv12config.h" |
20 | | #include "aom_util/aom_thread.h" |
21 | | |
22 | | #include "av1/common/av1_common_int.h" |
23 | | #include "av1/common/thread_common.h" |
24 | | #include "av1/decoder/dthread.h" |
25 | | #if CONFIG_ACCOUNTING |
26 | | #include "av1/decoder/accounting.h" |
27 | | #endif |
28 | | #if CONFIG_INSPECTION |
29 | | #include "av1/decoder/inspection.h" |
30 | | #endif |
31 | | |
32 | | #ifdef __cplusplus |
33 | | extern "C" { |
34 | | #endif |
35 | | |
36 | | /*! |
37 | | * \brief Contains coding block data required by the decoder. |
38 | | * |
39 | | * This includes: |
40 | | * - Coding block info that is common between encoder and decoder. |
41 | | * - Other coding block info only needed by the decoder. |
42 | | * Contrast this with a similar struct MACROBLOCK on encoder side. |
43 | | * This data is also common between ThreadData and AV1Decoder structs. |
44 | | */ |
45 | | typedef struct DecoderCodingBlock { |
46 | | /*! |
47 | | * Coding block info that is common between encoder and decoder. |
48 | | */ |
49 | | DECLARE_ALIGNED(32, MACROBLOCKD, xd); |
50 | | /*! |
51 | | * True if the at least one of the coding blocks decoded was corrupted. |
52 | | */ |
53 | | int corrupted; |
54 | | /*! |
55 | | * Pointer to 'mc_buf' inside 'pbi->td' (single-threaded decoding) or |
56 | | * 'pbi->thread_data[i].td' (multi-threaded decoding). |
57 | | */ |
58 | | uint8_t *mc_buf[2]; |
59 | | /*! |
60 | | * Pointer to 'dqcoeff' inside 'td->cb_buffer_base' or 'pbi->cb_buffer_base' |
61 | | * with appropriate offset for the current superblock, for each plane. |
62 | | */ |
63 | | tran_low_t *dqcoeff_block[MAX_MB_PLANE]; |
64 | | /*! |
65 | | * cb_offset[p] is the offset into the dqcoeff_block[p] for the current coding |
66 | | * block, for each plane 'p'. |
67 | | */ |
68 | | uint16_t cb_offset[MAX_MB_PLANE]; |
69 | | /*! |
70 | | * Pointer to 'eob_data' inside 'td->cb_buffer_base' or 'pbi->cb_buffer_base' |
71 | | * with appropriate offset for the current superblock, for each plane. |
72 | | */ |
73 | | eob_info *eob_data[MAX_MB_PLANE]; |
74 | | /*! |
75 | | * txb_offset[p] is the offset into the eob_data[p] for the current coding |
76 | | * block, for each plane 'p'. |
77 | | */ |
78 | | uint16_t txb_offset[MAX_MB_PLANE]; |
79 | | /*! |
80 | | * ref_mv_count[i] specifies the number of number of motion vector candidates |
81 | | * in xd->ref_mv_stack[i]. |
82 | | */ |
83 | | uint8_t ref_mv_count[MODE_CTX_REF_FRAMES]; |
84 | | } DecoderCodingBlock; |
85 | | |
86 | | /*!\cond */ |
87 | | |
88 | | typedef void (*decode_block_visitor_fn_t)(const AV1_COMMON *const cm, |
89 | | DecoderCodingBlock *dcb, |
90 | | aom_reader *const r, const int plane, |
91 | | const int row, const int col, |
92 | | const TX_SIZE tx_size); |
93 | | |
94 | | typedef void (*predict_inter_block_visitor_fn_t)(AV1_COMMON *const cm, |
95 | | DecoderCodingBlock *dcb, |
96 | | BLOCK_SIZE bsize); |
97 | | |
98 | | typedef void (*cfl_store_inter_block_visitor_fn_t)(AV1_COMMON *const cm, |
99 | | MACROBLOCKD *const xd); |
100 | | |
101 | | typedef struct ThreadData { |
102 | | DecoderCodingBlock dcb; |
103 | | |
104 | | // Coding block buffer for the current superblock. |
105 | | // Used only for single-threaded decoding and multi-threaded decoding with |
106 | | // row_mt == 1 cases. |
107 | | // See also: similar buffer in 'AV1Decoder'. |
108 | | CB_BUFFER cb_buffer_base; |
109 | | |
110 | | aom_reader *bit_reader; |
111 | | |
112 | | // Motion compensation buffer used to get a prediction buffer with extended |
113 | | // borders. One buffer for each of the two possible references. |
114 | | uint8_t *mc_buf[2]; |
115 | | // Mask for this block used for compound prediction. |
116 | | uint8_t *seg_mask; |
117 | | // Allocated size of 'mc_buf'. |
118 | | int32_t mc_buf_size; |
119 | | // If true, the pointers in 'mc_buf' were converted from highbd pointers. |
120 | | int mc_buf_use_highbd; // Boolean: whether the byte pointers stored in |
121 | | // mc_buf were converted from highbd pointers. |
122 | | |
123 | | CONV_BUF_TYPE *tmp_conv_dst; |
124 | | uint8_t *tmp_obmc_bufs[2]; |
125 | | |
126 | | decode_block_visitor_fn_t read_coeffs_tx_intra_block_visit; |
127 | | decode_block_visitor_fn_t predict_and_recon_intra_block_visit; |
128 | | decode_block_visitor_fn_t read_coeffs_tx_inter_block_visit; |
129 | | decode_block_visitor_fn_t inverse_tx_inter_block_visit; |
130 | | predict_inter_block_visitor_fn_t predict_inter_block_visit; |
131 | | cfl_store_inter_block_visitor_fn_t cfl_store_inter_block_visit; |
132 | | } ThreadData; |
133 | | |
134 | | typedef struct AV1DecRowMTJobInfo { |
135 | | int tile_row; |
136 | | int tile_col; |
137 | | int mi_row; |
138 | | } AV1DecRowMTJobInfo; |
139 | | |
140 | | typedef struct AV1DecRowMTSyncData { |
141 | | #if CONFIG_MULTITHREAD |
142 | | pthread_mutex_t *mutex_; |
143 | | pthread_cond_t *cond_; |
144 | | #endif |
145 | | int allocated_sb_rows; |
146 | | int *cur_sb_col; |
147 | | // Denotes the superblock interval at which conditional signalling should |
148 | | // happen. Also denotes the minimum number of extra superblocks of the top row |
149 | | // to be complete to start decoding the current superblock. A value of 1 |
150 | | // indicates top-right dependency. |
151 | | int sync_range; |
152 | | // Denotes the additional number of superblocks in the previous row to be |
153 | | // complete to start decoding the current superblock when intraBC tool is |
154 | | // enabled. This additional top-right delay is required to satisfy the |
155 | | // hardware constraints for intraBC tool when row multithreading is enabled. |
156 | | int intrabc_extra_top_right_sb_delay; |
157 | | int mi_rows; |
158 | | int mi_cols; |
159 | | int mi_rows_parse_done; |
160 | | int mi_rows_decode_started; |
161 | | int num_threads_working; |
162 | | } AV1DecRowMTSync; |
163 | | |
164 | | typedef struct AV1DecRowMTInfo { |
165 | | int tile_rows_start; |
166 | | int tile_rows_end; |
167 | | int tile_cols_start; |
168 | | int tile_cols_end; |
169 | | int start_tile; |
170 | | int end_tile; |
171 | | int mi_rows_to_decode; |
172 | | |
173 | | // Invariant: |
174 | | // mi_rows_parse_done >= mi_rows_decode_started. |
175 | | // mi_rows_parse_done and mi_rows_decode_started are both initialized to 0. |
176 | | // mi_rows_parse_done is incremented freely. mi_rows_decode_started may only |
177 | | // be incremented to catch up with mi_rows_parse_done but is not allowed to |
178 | | // surpass mi_rows_parse_done. |
179 | | // |
180 | | // When mi_rows_decode_started reaches mi_rows_to_decode, there are no more |
181 | | // decode jobs. |
182 | | |
183 | | // Indicates the progress of the bit-stream parsing of superblocks. |
184 | | // Initialized to 0. Incremented by sb_mi_size when parse sb row is done. |
185 | | int mi_rows_parse_done; |
186 | | // Indicates the progress of the decoding of superblocks. |
187 | | // Initialized to 0. Incremented by sb_mi_size when decode sb row is started. |
188 | | int mi_rows_decode_started; |
189 | | // Boolean: Initialized to 0 (false). Set to 1 (true) on error to abort |
190 | | // decoding. |
191 | | int row_mt_exit; |
192 | | } AV1DecRowMTInfo; |
193 | | |
194 | | typedef struct TileDataDec { |
195 | | TileInfo tile_info; |
196 | | aom_reader bit_reader; |
197 | | DECLARE_ALIGNED(16, FRAME_CONTEXT, tctx); |
198 | | AV1DecRowMTSync dec_row_mt_sync; |
199 | | } TileDataDec; |
200 | | |
201 | | typedef struct TileBufferDec { |
202 | | const uint8_t *data; |
203 | | size_t size; |
204 | | } TileBufferDec; |
205 | | |
206 | | typedef struct DataBuffer { |
207 | | const uint8_t *data; |
208 | | size_t size; |
209 | | } DataBuffer; |
210 | | |
211 | | typedef struct EXTERNAL_REFERENCES { |
212 | | YV12_BUFFER_CONFIG refs[MAX_EXTERNAL_REFERENCES]; |
213 | | int num; |
214 | | } EXTERNAL_REFERENCES; |
215 | | |
216 | | typedef struct TileJobsDec { |
217 | | TileBufferDec *tile_buffer; |
218 | | TileDataDec *tile_data; |
219 | | } TileJobsDec; |
220 | | |
221 | | typedef struct AV1DecTileMTData { |
222 | | #if CONFIG_MULTITHREAD |
223 | | pthread_mutex_t *job_mutex; |
224 | | #endif |
225 | | TileJobsDec *job_queue; |
226 | | int jobs_enqueued; |
227 | | int jobs_dequeued; |
228 | | int alloc_tile_rows; |
229 | | int alloc_tile_cols; |
230 | | } AV1DecTileMT; |
231 | | |
232 | | #if CONFIG_COLLECT_COMPONENT_TIMING |
233 | | #include "aom_ports/aom_timer.h" |
234 | | // Adjust the following to add new components. |
235 | | enum { |
236 | | decode_mbmi_block_time, |
237 | | decode_token_recon_block_intra_time, |
238 | | predict_inter_block_time, |
239 | | decode_reconstruct_tx_inter_time, |
240 | | decode_token_recon_block_inter_time, |
241 | | decode_token_recon_block_time, |
242 | | parse_decode_block_time, |
243 | | decode_tile_time, |
244 | | decode_tiles_time, |
245 | | av1_loop_filter_frame_time, |
246 | | cdef_and_lr_time, |
247 | | av1_decode_tg_tiles_and_wrapup_time, |
248 | | aom_decode_frame_from_obus_time, |
249 | | kTimingComponents, |
250 | | } UENUM1BYTE(TIMING_COMPONENT); |
251 | | |
252 | | static inline char const *get_component_name(int index) { |
253 | | switch (index) { |
254 | | case decode_mbmi_block_time: return "decode_mbmi_block_time"; |
255 | | case decode_token_recon_block_intra_time: |
256 | | return "decode_token_recon_block_intra_time"; |
257 | | case predict_inter_block_time: return "predict_inter_block_time"; |
258 | | case decode_reconstruct_tx_inter_time: |
259 | | return "decode_reconstruct_tx_inter_time"; |
260 | | case decode_token_recon_block_inter_time: |
261 | | return "decode_token_recon_block_inter_time"; |
262 | | case decode_token_recon_block_time: return "decode_token_recon_block_time"; |
263 | | case parse_decode_block_time: return "parse_decode_block_time"; |
264 | | case decode_tile_time: return "decode_tile_time"; |
265 | | case decode_tiles_time: return "decode_tiles_time"; |
266 | | case av1_loop_filter_frame_time: return "av1_loop_filter_frame_time"; |
267 | | case cdef_and_lr_time: return "cdef_and_lr_time"; |
268 | | case av1_decode_tg_tiles_and_wrapup_time: |
269 | | return "av1_decode_tg_tiles_and_wrapup_time"; |
270 | | case aom_decode_frame_from_obus_time: |
271 | | return "aom_decode_frame_from_obus_time"; |
272 | | |
273 | | default: assert(0); |
274 | | } |
275 | | return "error"; |
276 | | } |
277 | | #endif |
278 | | |
279 | | typedef struct AV1Decoder { |
280 | | DecoderCodingBlock dcb; |
281 | | |
282 | | DECLARE_ALIGNED(32, AV1_COMMON, common); |
283 | | |
284 | | AVxWorker lf_worker; |
285 | | AV1LfSync lf_row_sync; |
286 | | AV1LrSync lr_row_sync; |
287 | | AV1LrStruct lr_ctxt; |
288 | | AV1CdefSync cdef_sync; |
289 | | AV1CdefWorkerData *cdef_worker; |
290 | | AVxWorker *tile_workers; |
291 | | int num_workers; |
292 | | DecWorkerData *thread_data; |
293 | | ThreadData td; |
294 | | TileDataDec *tile_data; |
295 | | int allocated_tiles; |
296 | | |
297 | | TileBufferDec tile_buffers[MAX_TILE_ROWS][MAX_TILE_COLS]; |
298 | | AV1DecTileMT tile_mt_info; |
299 | | |
300 | | // Each time the decoder is called, we expect to receive a full temporal unit. |
301 | | // This can contain up to one shown frame per spatial layer in the current |
302 | | // operating point (note that some layers may be entirely omitted). |
303 | | // If the 'output_all_layers' option is true, we save all of these shown |
304 | | // frames so that they can be returned to the application. If the |
305 | | // 'output_all_layers' option is false, then we only output one image per |
306 | | // temporal unit. |
307 | | // |
308 | | // Note: The saved buffers are released at the start of the next time the |
309 | | // application calls aom_codec_decode(). |
310 | | int output_all_layers; |
311 | | RefCntBuffer *output_frames[MAX_NUM_SPATIAL_LAYERS]; |
312 | | size_t num_output_frames; // How many frames are queued up so far? |
313 | | |
314 | | // In order to properly support random-access decoding, we need |
315 | | // to behave slightly differently for the very first frame we decode. |
316 | | // So we track whether this is the first frame or not. |
317 | | int decoding_first_frame; |
318 | | |
319 | | int allow_lowbitdepth; |
320 | | int max_threads; |
321 | | int inv_tile_order; |
322 | | int need_resync; // wait for key/intra-only frame. |
323 | | int reset_decoder_state; |
324 | | |
325 | | int tile_size_bytes; |
326 | | int tile_col_size_bytes; |
327 | | int dec_tile_row, dec_tile_col; // always -1 for non-VR tile encoding |
328 | | #if CONFIG_ACCOUNTING |
329 | | int acct_enabled; |
330 | | Accounting accounting; |
331 | | #endif |
332 | | int sequence_header_ready; |
333 | | int sequence_header_changed; |
334 | | #if CONFIG_INSPECTION |
335 | | aom_inspect_cb inspect_cb; |
336 | | void *inspect_ctx; |
337 | | #endif |
338 | | int operating_point; |
339 | | int current_operating_point; |
340 | | int seen_frame_header; |
341 | | // The expected start_tile (tg_start syntax element) of the next tile group. |
342 | | int next_start_tile; |
343 | | |
344 | | // State if the camera frame header is already decoded while |
345 | | // large_scale_tile = 1. |
346 | | int camera_frame_header_ready; |
347 | | size_t frame_header_size; |
348 | | DataBuffer obu_size_hdr; |
349 | | int output_frame_width_in_tiles_minus_1; |
350 | | int output_frame_height_in_tiles_minus_1; |
351 | | int tile_count_minus_1; |
352 | | uint32_t coded_tile_data_size; |
353 | | unsigned int ext_tile_debug; // for ext-tile software debug & testing |
354 | | |
355 | | // Decoder has 3 modes of operation: |
356 | | // (1) Single-threaded decoding. |
357 | | // (2) Multi-threaded decoding with each tile decoded in parallel. |
358 | | // (3) In addition to (2), each thread decodes 1 superblock row in parallel. |
359 | | // row_mt = 1 triggers mode (3) above, while row_mt = 0, will trigger mode (1) |
360 | | // or (2) depending on 'max_threads'. |
361 | | unsigned int row_mt; |
362 | | |
363 | | EXTERNAL_REFERENCES ext_refs; |
364 | | YV12_BUFFER_CONFIG tile_list_outbuf; |
365 | | |
366 | | // Coding block buffer for the current frame. |
367 | | // Allocated and used only for multi-threaded decoding with 'row_mt == 0'. |
368 | | // See also: similar buffer in 'ThreadData' struct. |
369 | | CB_BUFFER *cb_buffer_base; |
370 | | // Allocated size of 'cb_buffer_base'. Currently same as the number of |
371 | | // superblocks in the coded frame. |
372 | | int cb_buffer_alloc_size; |
373 | | |
374 | | int allocated_row_mt_sync_rows; |
375 | | |
376 | | #if CONFIG_MULTITHREAD |
377 | | pthread_mutex_t *row_mt_mutex_; |
378 | | pthread_cond_t *row_mt_cond_; |
379 | | #endif |
380 | | |
381 | | AV1DecRowMTInfo frame_row_mt_info; |
382 | | aom_metadata_array_t *metadata; |
383 | | |
384 | | int context_update_tile_id; |
385 | | int skip_loop_filter; |
386 | | int skip_film_grain; |
387 | | int is_annexb; |
388 | | int valid_for_referencing[REF_FRAMES]; |
389 | | int is_fwd_kf_present; |
390 | | int is_arf_frame_present; |
391 | | int num_tile_groups; |
392 | | aom_s_frame_info sframe_info; |
393 | | |
394 | | /*! |
395 | | * Elements part of the sequence header, that are applicable for all the |
396 | | * frames in the video. |
397 | | */ |
398 | | SequenceHeader seq_params; |
399 | | |
400 | | /*! |
401 | | * If true, buffer removal times are present. |
402 | | */ |
403 | | bool buffer_removal_time_present; |
404 | | |
405 | | /*! |
406 | | * Code and details about current error status. |
407 | | */ |
408 | | struct aom_internal_error_info error; |
409 | | |
410 | | /*! |
411 | | * Number of temporal layers: may be > 1 for SVC (scalable vector coding). |
412 | | */ |
413 | | unsigned int number_temporal_layers; |
414 | | |
415 | | /*! |
416 | | * Number of spatial layers: may be > 1 for SVC (scalable vector coding). |
417 | | */ |
418 | | unsigned int number_spatial_layers; |
419 | | |
420 | | #if CONFIG_COLLECT_COMPONENT_TIMING |
421 | | /*! |
422 | | * component_time[] are initialized to zero while decoder starts. |
423 | | */ |
424 | | uint64_t component_time[kTimingComponents]; |
425 | | struct aom_usec_timer component_timer[kTimingComponents]; |
426 | | /*! |
427 | | * frame_component_time[] are initialized to zero at beginning of each frame. |
428 | | */ |
429 | | uint64_t frame_component_time[kTimingComponents]; |
430 | | #endif |
431 | | } AV1Decoder; |
432 | | |
433 | | // Returns 0 on success. Sets pbi->common.error.error_code to a nonzero error |
434 | | // code and returns a nonzero value on failure. |
435 | | int av1_receive_compressed_data(struct AV1Decoder *pbi, size_t size, |
436 | | const uint8_t **psource); |
437 | | |
438 | | // Get the frame at a particular index in the output queue |
439 | | int av1_get_raw_frame(AV1Decoder *pbi, size_t index, YV12_BUFFER_CONFIG **sd, |
440 | | aom_film_grain_t **grain_params); |
441 | | |
442 | | int av1_get_frame_to_show(struct AV1Decoder *pbi, YV12_BUFFER_CONFIG *frame); |
443 | | |
444 | | aom_codec_err_t av1_copy_reference_dec(struct AV1Decoder *pbi, int idx, |
445 | | YV12_BUFFER_CONFIG *sd); |
446 | | |
447 | | aom_codec_err_t av1_set_reference_dec(AV1_COMMON *cm, int idx, |
448 | | int use_external_ref, |
449 | | YV12_BUFFER_CONFIG *sd); |
450 | | aom_codec_err_t av1_copy_new_frame_dec(AV1_COMMON *cm, |
451 | | YV12_BUFFER_CONFIG *new_frame, |
452 | | YV12_BUFFER_CONFIG *sd); |
453 | | |
454 | | struct AV1Decoder *av1_decoder_create(BufferPool *const pool); |
455 | | |
456 | | void av1_decoder_remove(struct AV1Decoder *pbi); |
457 | | void av1_dealloc_dec_jobs(struct AV1DecTileMTData *tile_mt_info); |
458 | | |
459 | | void av1_dec_row_mt_dealloc(AV1DecRowMTSync *dec_row_mt_sync); |
460 | | |
461 | | void av1_dec_free_cb_buf(AV1Decoder *pbi); |
462 | | |
463 | | static inline void decrease_ref_count(RefCntBuffer *const buf, |
464 | 736k | BufferPool *const pool) { |
465 | 736k | if (buf != NULL) { |
466 | 379k | --buf->ref_count; |
467 | | // Reference counts should never become negative. If this assertion fails, |
468 | | // there is a bug in our reference count management. |
469 | 379k | assert(buf->ref_count >= 0); |
470 | | // A worker may only get a free framebuffer index when calling get_free_fb. |
471 | | // But the raw frame buffer is not set up until we finish decoding header. |
472 | | // So if any error happens during decoding header, frame_bufs[idx] will not |
473 | | // have a valid raw frame buffer. |
474 | 379k | if (buf->ref_count == 0 && buf->raw_frame_buffer.data) { |
475 | 182k | pool->release_fb_cb(pool->cb_priv, &buf->raw_frame_buffer); |
476 | 182k | buf->raw_frame_buffer.data = NULL; |
477 | 182k | buf->raw_frame_buffer.size = 0; |
478 | 182k | buf->raw_frame_buffer.priv = NULL; |
479 | 182k | } |
480 | 379k | } |
481 | 736k | } av1_dx_iface.c:decrease_ref_count Line | Count | Source | 464 | 28.6k | BufferPool *const pool) { | 465 | 28.6k | if (buf != NULL) { | 466 | 28.6k | --buf->ref_count; | 467 | | // Reference counts should never become negative. If this assertion fails, | 468 | | // there is a bug in our reference count management. | 469 | 28.6k | assert(buf->ref_count >= 0); | 470 | | // A worker may only get a free framebuffer index when calling get_free_fb. | 471 | | // But the raw frame buffer is not set up until we finish decoding header. | 472 | | // So if any error happens during decoding header, frame_bufs[idx] will not | 473 | | // have a valid raw frame buffer. | 474 | 28.6k | if (buf->ref_count == 0 && buf->raw_frame_buffer.data) { | 475 | 4.85k | pool->release_fb_cb(pool->cb_priv, &buf->raw_frame_buffer); | 476 | 4.85k | buf->raw_frame_buffer.data = NULL; | 477 | 4.85k | buf->raw_frame_buffer.size = 0; | 478 | | buf->raw_frame_buffer.priv = NULL; | 479 | 4.85k | } | 480 | 28.6k | } | 481 | 28.6k | } |
decodeframe.c:decrease_ref_count Line | Count | Source | 464 | 446k | BufferPool *const pool) { | 465 | 446k | if (buf != NULL) { | 466 | 163k | --buf->ref_count; | 467 | | // Reference counts should never become negative. If this assertion fails, | 468 | | // there is a bug in our reference count management. | 469 | 163k | assert(buf->ref_count >= 0); | 470 | | // A worker may only get a free framebuffer index when calling get_free_fb. | 471 | | // But the raw frame buffer is not set up until we finish decoding header. | 472 | | // So if any error happens during decoding header, frame_bufs[idx] will not | 473 | | // have a valid raw frame buffer. | 474 | 163k | if (buf->ref_count == 0 && buf->raw_frame_buffer.data) { | 475 | 100k | pool->release_fb_cb(pool->cb_priv, &buf->raw_frame_buffer); | 476 | 100k | buf->raw_frame_buffer.data = NULL; | 477 | 100k | buf->raw_frame_buffer.size = 0; | 478 | | buf->raw_frame_buffer.priv = NULL; | 479 | 100k | } | 480 | 163k | } | 481 | 446k | } |
Unexecuted instantiation: decodemv.c:decrease_ref_count decoder.c:decrease_ref_count Line | Count | Source | 464 | 260k | BufferPool *const pool) { | 465 | 260k | if (buf != NULL) { | 466 | 187k | --buf->ref_count; | 467 | | // Reference counts should never become negative. If this assertion fails, | 468 | | // there is a bug in our reference count management. | 469 | 187k | assert(buf->ref_count >= 0); | 470 | | // A worker may only get a free framebuffer index when calling get_free_fb. | 471 | | // But the raw frame buffer is not set up until we finish decoding header. | 472 | | // So if any error happens during decoding header, frame_bufs[idx] will not | 473 | | // have a valid raw frame buffer. | 474 | 187k | if (buf->ref_count == 0 && buf->raw_frame_buffer.data) { | 475 | 77.0k | pool->release_fb_cb(pool->cb_priv, &buf->raw_frame_buffer); | 476 | 77.0k | buf->raw_frame_buffer.data = NULL; | 477 | 77.0k | buf->raw_frame_buffer.size = 0; | 478 | | buf->raw_frame_buffer.priv = NULL; | 479 | 77.0k | } | 480 | 187k | } | 481 | 260k | } |
Unexecuted instantiation: decodetxb.c:decrease_ref_count Unexecuted instantiation: detokenize.c:decrease_ref_count Unexecuted instantiation: obu.c:decrease_ref_count |
482 | | |
483 | | #define ACCT_STR __func__ |
484 | 39.3k | static inline int av1_read_uniform(aom_reader *r, int n) { |
485 | 39.3k | const int l = get_unsigned_bits(n); |
486 | 39.3k | const int m = (1 << l) - n; |
487 | 39.3k | const int v = aom_read_literal(r, l - 1, ACCT_STR); |
488 | 39.3k | assert(l != 0); |
489 | 39.1k | if (v < m) |
490 | 28.8k | return v; |
491 | 10.3k | else |
492 | 10.3k | return (v << 1) - m + aom_read_literal(r, 1, ACCT_STR); |
493 | 39.1k | } Unexecuted instantiation: av1_dx_iface.c:av1_read_uniform Unexecuted instantiation: decodeframe.c:av1_read_uniform Unexecuted instantiation: decodemv.c:av1_read_uniform Unexecuted instantiation: decoder.c:av1_read_uniform Unexecuted instantiation: decodetxb.c:av1_read_uniform detokenize.c:av1_read_uniform Line | Count | Source | 484 | 39.3k | static inline int av1_read_uniform(aom_reader *r, int n) { | 485 | 39.3k | const int l = get_unsigned_bits(n); | 486 | 39.3k | const int m = (1 << l) - n; | 487 | 39.3k | const int v = aom_read_literal(r, l - 1, ACCT_STR); | 488 | 39.3k | assert(l != 0); | 489 | 39.1k | if (v < m) | 490 | 28.8k | return v; | 491 | 10.3k | else | 492 | 10.3k | return (v << 1) - m + aom_read_literal(r, 1, ACCT_STR); | 493 | 39.1k | } |
Unexecuted instantiation: obu.c:av1_read_uniform |
494 | | |
495 | | typedef void (*palette_visitor_fn_t)(MACROBLOCKD *const xd, int plane, |
496 | | aom_reader *r); |
497 | | |
498 | | void av1_visit_palette(AV1Decoder *const pbi, MACROBLOCKD *const xd, |
499 | | aom_reader *r, palette_visitor_fn_t visit); |
500 | | |
501 | | typedef void (*block_visitor_fn_t)(AV1Decoder *const pbi, ThreadData *const td, |
502 | | int mi_row, int mi_col, aom_reader *r, |
503 | | PARTITION_TYPE partition, BLOCK_SIZE bsize); |
504 | | |
505 | | /*!\endcond */ |
506 | | |
507 | | #if CONFIG_COLLECT_COMPONENT_TIMING |
508 | | static inline void start_timing(AV1Decoder *pbi, int component) { |
509 | | aom_usec_timer_start(&pbi->component_timer[component]); |
510 | | } |
511 | | static inline void end_timing(AV1Decoder *pbi, int component) { |
512 | | aom_usec_timer_mark(&pbi->component_timer[component]); |
513 | | pbi->frame_component_time[component] += |
514 | | aom_usec_timer_elapsed(&pbi->component_timer[component]); |
515 | | } |
516 | | |
517 | | static inline char const *get_frame_type_enum(int type) { |
518 | | switch (type) { |
519 | | case 0: return "KEY_FRAME"; |
520 | | case 1: return "INTER_FRAME"; |
521 | | case 2: return "INTRA_ONLY_FRAME"; |
522 | | case 3: return "S_FRAME"; |
523 | | default: assert(0); |
524 | | } |
525 | | return "error"; |
526 | | } |
527 | | #endif |
528 | | |
529 | | #ifdef __cplusplus |
530 | | } // extern "C" |
531 | | #endif |
532 | | |
533 | | #endif // AOM_AV1_DECODER_DECODER_H_ |