av1dec.h (3630B)
1 /* 2 * AV1 video decoder 3 * * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef AVCODEC_AV1DEC_H 22 #define AVCODEC_AV1DEC_H 23 24 #include <stdint.h> 25 26 #include "libavutil/buffer.h" 27 #include "libavutil/fifo.h" 28 #include "libavutil/frame.h" 29 #include "libavutil/pixfmt.h" 30 #include "avcodec.h" 31 #include "packet.h" 32 #include "cbs.h" 33 #include "cbs_av1.h" 34 #include "dovi_rpu.h" 35 #include "progressframe.h" 36 37 typedef struct AV1Frame { 38 union { 39 struct { 40 struct AVFrame *f; 41 }; 42 ProgressFrame pf; 43 }; 44 45 void *hwaccel_picture_private; ///< RefStruct reference 46 47 AV1RawOBU *header_ref; ///< RefStruct reference backing raw_frame_header. 48 AV1RawFrameHeader *raw_frame_header; 49 50 int temporal_id; 51 int spatial_id; 52 53 uint8_t gm_invalid[AV1_NUM_REF_FRAMES]; 54 uint8_t gm_type[AV1_NUM_REF_FRAMES]; 55 int32_t gm_params[AV1_NUM_REF_FRAMES][6]; 56 57 uint8_t skip_mode_frame_idx[2]; 58 59 AV1RawFilmGrainParams film_grain; 60 61 uint8_t coded_lossless; 62 63 // OrderHint for this frame. 64 uint8_t order_hint; 65 // RefFrameSignBias[] used when decoding this frame. 66 uint8_t ref_frame_sign_bias[AV1_TOTAL_REFS_PER_FRAME]; 67 // OrderHints[] when this is the current frame, otherwise 68 // SavedOrderHints[s][] when is the reference frame in slot s. 69 uint8_t order_hints[AV1_TOTAL_REFS_PER_FRAME]; 70 71 // force_integer_mv value at the end of the frame header parsing. 72 // This is not the same as the syntax element value in 73 // raw_frame_header because the specification parsing tables 74 // override the value on intra frames. 75 uint8_t force_integer_mv; 76 } AV1Frame; 77 78 typedef struct TileGroupInfo { 79 uint32_t tile_offset; 80 uint32_t tile_size; 81 uint16_t tile_row; 82 uint16_t tile_column; 83 } TileGroupInfo; 84 85 typedef struct AV1DecContext { 86 const AVClass *class; 87 AVCodecContext *avctx; 88 89 enum AVPixelFormat pix_fmt; 90 CodedBitstreamContext *cbc; 91 CodedBitstreamFragment current_obu; 92 AVPacket *pkt; 93 94 AVBufferRef *seq_data_ref; 95 AV1RawOBU *seq_ref; ///< RefStruct reference backing raw_seq 96 AV1RawSequenceHeader *raw_seq; 97 AV1RawOBU *header_ref; ///< RefStruct reference backing raw_frame_header 98 AV1RawFrameHeader *raw_frame_header; 99 TileGroupInfo *tile_group_info; 100 101 AV1RawOBU *cll_ref; ///< RefStruct reference backing cll 102 AV1RawMetadataHDRCLL *cll; 103 AV1RawOBU *mdcv_ref; ///< RefStruct reference backing mdcv 104 AV1RawMetadataHDRMDCV *mdcv; 105 DOVIContext dovi; 106 AVFifo *itut_t35_fifo; 107 108 uint16_t tile_num; 109 uint16_t tg_start; 110 uint16_t tg_end; 111 112 int operating_point_idc; 113 114 AV1Frame ref[AV1_NUM_REF_FRAMES]; 115 AV1Frame cur_frame; 116 117 int nb_unit; ///< The index of the next OBU to be processed. 118 int start_unit; ///< The index of the first OBU of the current frame. 119 120 // AVOptions 121 int operating_point; 122 } AV1DecContext; 123 124 #endif /* AVCODEC_AV1DEC_H */