Imported Upstream version 6.1
[platform/upstream/ffmpeg.git] / libavcodec / av1dec.h
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/fifo.h"
27 #include "libavutil/frame.h"
28 #include "libavutil/pixfmt.h"
29 #include "avcodec.h"
30 #include "packet.h"
31 #include "cbs.h"
32 #include "cbs_av1.h"
33
34 typedef struct AV1Frame {
35     AVFrame *f;
36
37     void *hwaccel_picture_private; ///< RefStruct reference
38
39     AV1RawOBU *header_ref; ///< RefStruct reference backing raw_frame_header.
40     AV1RawFrameHeader *raw_frame_header;
41
42     int temporal_id;
43     int spatial_id;
44
45     uint8_t gm_invalid[AV1_NUM_REF_FRAMES];
46     uint8_t gm_type[AV1_NUM_REF_FRAMES];
47     int32_t gm_params[AV1_NUM_REF_FRAMES][6];
48
49     uint8_t skip_mode_frame_idx[2];
50
51     AV1RawFilmGrainParams film_grain;
52
53     uint8_t coded_lossless;
54 } AV1Frame;
55
56 typedef struct TileGroupInfo {
57     uint32_t tile_offset;
58     uint32_t tile_size;
59     uint16_t tile_row;
60     uint16_t tile_column;
61 } TileGroupInfo;
62
63 typedef struct AV1DecContext {
64     const AVClass *class;
65     AVCodecContext *avctx;
66
67     enum AVPixelFormat pix_fmt;
68     CodedBitstreamContext *cbc;
69     CodedBitstreamFragment current_obu;
70     AVPacket *pkt;
71
72     AV1RawOBU *seq_ref;    ///< RefStruct reference backing raw_seq
73     AV1RawSequenceHeader *raw_seq;
74     AV1RawOBU *header_ref; ///< RefStruct reference backing raw_frame_header
75     AV1RawFrameHeader *raw_frame_header;
76     TileGroupInfo *tile_group_info;
77
78     AV1RawOBU *cll_ref;    ///< RefStruct reference backing cll
79     AV1RawMetadataHDRCLL *cll;
80     AV1RawOBU *mdcv_ref;   ///< RefStruct reference backing mdcv
81     AV1RawMetadataHDRMDCV *mdcv;
82     AVFifo *itut_t35_fifo;
83
84     uint16_t tile_num;
85     uint16_t tg_start;
86     uint16_t tg_end;
87
88     int operating_point_idc;
89
90     AV1Frame ref[AV1_NUM_REF_FRAMES];
91     AV1Frame cur_frame;
92
93     int nb_unit;
94
95     // AVOptions
96     int operating_point;
97 } AV1DecContext;
98
99 #endif /* AVCODEC_AV1DEC_H */