LCOV - code coverage report
Current view: top level - third_party/aom/av1/decoder - decoder.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 AV1_DECODER_DECODER_H_
      13             : #define AV1_DECODER_DECODER_H_
      14             : 
      15             : #include "./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/thread_common.h"
      23             : #include "av1/common/onyxc_int.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             : #if CONFIG_PVQ
      33             : #include "aom_dsp/entdec.h"
      34             : #include "av1/decoder/decint.h"
      35             : #include "av1/encoder/encodemb.h"
      36             : #endif
      37             : 
      38             : #ifdef __cplusplus
      39             : extern "C" {
      40             : #endif
      41             : 
      42             : // TODO(hkuang): combine this with TileWorkerData.
      43             : typedef struct TileData {
      44             :   AV1_COMMON *cm;
      45             :   aom_reader bit_reader;
      46             :   DECLARE_ALIGNED(16, MACROBLOCKD, xd);
      47             :   /* dqcoeff are shared by all the planes. So planes must be decoded serially */
      48             :   DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_TX_SQUARE]);
      49             : #if CONFIG_PVQ
      50             :   /* forward transformed predicted image, a reference for PVQ */
      51             :   DECLARE_ALIGNED(16, tran_low_t, pvq_ref_coeff[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
      52             : #endif
      53             : #if CONFIG_CFL
      54             :   CFL_CTX cfl;
      55             : #endif
      56             : #if CONFIG_EC_ADAPT
      57             :   DECLARE_ALIGNED(16, FRAME_CONTEXT, tctx);
      58             : #endif
      59             : #if CONFIG_PALETTE
      60             :   DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]);
      61             : #endif  // CONFIG_PALETTE
      62             : } TileData;
      63             : 
      64             : typedef struct TileWorkerData {
      65             :   struct AV1Decoder *pbi;
      66             :   aom_reader bit_reader;
      67             :   FRAME_COUNTS counts;
      68             :   DECLARE_ALIGNED(16, MACROBLOCKD, xd);
      69             :   /* dqcoeff are shared by all the planes. So planes must be decoded serially */
      70             :   DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_TX_SQUARE]);
      71             : #if CONFIG_PVQ
      72             :   /* forward transformed predicted image, a reference for PVQ */
      73             :   DECLARE_ALIGNED(16, tran_low_t, pvq_ref_coeff[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
      74             : #endif
      75             : #if CONFIG_CFL
      76             :   CFL_CTX cfl;
      77             : #endif
      78             : #if CONFIG_EC_ADAPT
      79             :   FRAME_CONTEXT tctx;
      80             : #endif
      81             : #if CONFIG_PALETTE
      82             :   DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]);
      83             : #endif  // CONFIG_PALETTE
      84             :   struct aom_internal_error_info error_info;
      85             : } TileWorkerData;
      86             : 
      87             : typedef struct TileBufferDec {
      88             :   const uint8_t *data;
      89             :   size_t size;
      90             :   const uint8_t *raw_data_end;  // The end of the raw tile buffer in the
      91             :                                 // bit stream.
      92             :   int col;                      // only used with multi-threaded decoding
      93             : } TileBufferDec;
      94             : 
      95             : typedef struct AV1Decoder {
      96             :   DECLARE_ALIGNED(16, MACROBLOCKD, mb);
      97             : 
      98             :   DECLARE_ALIGNED(16, AV1_COMMON, common);
      99             : 
     100             :   int ready_for_new_data;
     101             : 
     102             :   int refresh_frame_flags;
     103             : 
     104             :   // TODO(hkuang): Combine this with cur_buf in macroblockd as they are
     105             :   // the same.
     106             :   RefCntBuffer *cur_buf;  //  Current decoding frame buffer.
     107             : 
     108             :   AVxWorker *frame_worker_owner;  // frame_worker that owns this pbi.
     109             :   AVxWorker lf_worker;
     110             :   AVxWorker *tile_workers;
     111             :   TileWorkerData *tile_worker_data;
     112             :   TileInfo *tile_worker_info;
     113             :   int num_tile_workers;
     114             : 
     115             :   TileData *tile_data;
     116             :   int allocated_tiles;
     117             : 
     118             :   TileBufferDec tile_buffers[MAX_TILE_ROWS][MAX_TILE_COLS];
     119             : 
     120             :   AV1LfSync lf_row_sync;
     121             : 
     122             :   aom_decrypt_cb decrypt_cb;
     123             :   void *decrypt_state;
     124             : 
     125             :   int max_threads;
     126             :   int inv_tile_order;
     127             :   int need_resync;   // wait for key/intra-only frame.
     128             :   int hold_ref_buf;  // hold the reference buffer.
     129             : 
     130             :   int tile_size_bytes;
     131             : #if CONFIG_EXT_TILE
     132             :   int tile_col_size_bytes;
     133             :   int dec_tile_row, dec_tile_col;
     134             : #endif  // CONFIG_EXT_TILE
     135             : #if CONFIG_ACCOUNTING
     136             :   int acct_enabled;
     137             :   Accounting accounting;
     138             : #endif
     139             :   size_t uncomp_hdr_size;       // Size of the uncompressed header
     140             :   size_t first_partition_size;  // Size of the compressed header
     141             : #if CONFIG_TILE_GROUPS
     142             :   int tg_size;   // Number of tiles in the current tilegroup
     143             :   int tg_start;  // First tile in the current tilegroup
     144             :   int tg_size_bit_offset;
     145             : #endif
     146             : #if CONFIG_REFERENCE_BUFFER
     147             :   SequenceHeader seq_params;
     148             : #endif
     149             : #if CONFIG_INSPECTION
     150             :   aom_inspect_cb inspect_cb;
     151             :   void *inspect_ctx;
     152             : #endif
     153             : } AV1Decoder;
     154             : 
     155             : int av1_receive_compressed_data(struct AV1Decoder *pbi, size_t size,
     156             :                                 const uint8_t **dest);
     157             : 
     158             : int av1_get_raw_frame(struct AV1Decoder *pbi, YV12_BUFFER_CONFIG *sd);
     159             : 
     160             : int av1_get_frame_to_show(struct AV1Decoder *pbi, YV12_BUFFER_CONFIG *frame);
     161             : 
     162             : aom_codec_err_t av1_copy_reference_dec(struct AV1Decoder *pbi,
     163             :                                        AOM_REFFRAME ref_frame_flag,
     164             :                                        YV12_BUFFER_CONFIG *sd);
     165             : 
     166             : aom_codec_err_t av1_set_reference_dec(AV1_COMMON *cm,
     167             :                                       AOM_REFFRAME ref_frame_flag,
     168             :                                       YV12_BUFFER_CONFIG *sd);
     169             : 
     170           0 : static INLINE uint8_t read_marker(aom_decrypt_cb decrypt_cb,
     171             :                                   void *decrypt_state, const uint8_t *data) {
     172           0 :   if (decrypt_cb) {
     173             :     uint8_t marker;
     174           0 :     decrypt_cb(decrypt_state, data, &marker, 1);
     175           0 :     return marker;
     176             :   }
     177           0 :   return *data;
     178             : }
     179             : 
     180             : // This function is exposed for use in tests, as well as the inlined function
     181             : // "read_marker".
     182             : aom_codec_err_t av1_parse_superframe_index(const uint8_t *data, size_t data_sz,
     183             :                                            uint32_t sizes[8], int *count,
     184             :                                            aom_decrypt_cb decrypt_cb,
     185             :                                            void *decrypt_state);
     186             : 
     187             : struct AV1Decoder *av1_decoder_create(BufferPool *const pool);
     188             : 
     189             : void av1_decoder_remove(struct AV1Decoder *pbi);
     190             : 
     191           0 : static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs,
     192             :                                       BufferPool *const pool) {
     193           0 :   if (idx >= 0) {
     194           0 :     --frame_bufs[idx].ref_count;
     195             :     // A worker may only get a free framebuffer index when calling get_free_fb.
     196             :     // But the private buffer is not set up until finish decoding header.
     197             :     // So any error happens during decoding header, the frame_bufs will not
     198             :     // have valid priv buffer.
     199           0 :     if (frame_bufs[idx].ref_count == 0 &&
     200           0 :         frame_bufs[idx].raw_frame_buffer.priv) {
     201           0 :       pool->release_fb_cb(pool->cb_priv, &frame_bufs[idx].raw_frame_buffer);
     202             :     }
     203             :   }
     204           0 : }
     205             : 
     206             : #if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
     207           0 : static INLINE int dec_is_ref_frame_buf(AV1Decoder *const pbi,
     208             :                                        RefCntBuffer *frame_buf) {
     209           0 :   AV1_COMMON *const cm = &pbi->common;
     210             :   int i;
     211           0 :   for (i = 0; i < INTER_REFS_PER_FRAME; ++i) {
     212           0 :     RefBuffer *const ref_frame = &cm->frame_refs[i];
     213           0 :     if (ref_frame->idx == INVALID_IDX) continue;
     214           0 :     if (frame_buf == &cm->buffer_pool->frame_bufs[ref_frame->idx]) break;
     215             :   }
     216           0 :   return (i < INTER_REFS_PER_FRAME);
     217             : }
     218             : #endif  // CONFIG_EXT_REFS
     219             : 
     220             : #ifdef __cplusplus
     221             : }  // extern "C"
     222             : #endif
     223             : 
     224             : #endif  // AV1_DECODER_DECODER_H_

Generated by: LCOV version 1.13