2020-09-09 03:39:55 +00:00
|
|
|
/*
|
|
|
|
* AV1 video decoder
|
|
|
|
* *
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AVCODEC_AV1DEC_H
|
|
|
|
#define AVCODEC_AV1DEC_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2023-03-05 23:32:23 +00:00
|
|
|
#include "libavutil/fifo.h"
|
2020-09-09 03:39:55 +00:00
|
|
|
#include "libavutil/buffer.h"
|
2022-02-06 13:49:23 +00:00
|
|
|
#include "libavutil/frame.h"
|
2020-09-09 03:39:55 +00:00
|
|
|
#include "libavutil/pixfmt.h"
|
|
|
|
#include "avcodec.h"
|
2023-05-19 22:54:49 +00:00
|
|
|
#include "packet.h"
|
2020-09-09 03:39:55 +00:00
|
|
|
#include "cbs.h"
|
|
|
|
#include "cbs_av1.h"
|
|
|
|
|
|
|
|
typedef struct AV1Frame {
|
2022-02-06 13:49:23 +00:00
|
|
|
AVFrame *f;
|
2020-09-09 03:39:55 +00:00
|
|
|
|
|
|
|
AVBufferRef *hwaccel_priv_buf;
|
|
|
|
void *hwaccel_picture_private;
|
|
|
|
|
2020-11-12 19:59:37 +00:00
|
|
|
AVBufferRef *header_ref;
|
|
|
|
AV1RawFrameHeader *raw_frame_header;
|
|
|
|
|
2020-10-16 16:34:31 +00:00
|
|
|
int temporal_id;
|
|
|
|
int spatial_id;
|
|
|
|
|
2021-10-12 08:23:58 +00:00
|
|
|
uint8_t gm_invalid[AV1_NUM_REF_FRAMES];
|
2020-09-09 03:39:55 +00:00
|
|
|
uint8_t gm_type[AV1_NUM_REF_FRAMES];
|
|
|
|
int32_t gm_params[AV1_NUM_REF_FRAMES][6];
|
2020-11-03 14:34:28 +00:00
|
|
|
|
|
|
|
uint8_t skip_mode_frame_idx[2];
|
2020-11-03 14:54:44 +00:00
|
|
|
|
2020-11-25 20:02:56 +00:00
|
|
|
AV1RawFilmGrainParams film_grain;
|
|
|
|
|
2020-11-03 14:54:44 +00:00
|
|
|
uint8_t coded_lossless;
|
2020-09-09 03:39:55 +00:00
|
|
|
} AV1Frame;
|
|
|
|
|
|
|
|
typedef struct TileGroupInfo {
|
|
|
|
uint32_t tile_offset;
|
|
|
|
uint32_t tile_size;
|
|
|
|
uint16_t tile_row;
|
|
|
|
uint16_t tile_column;
|
|
|
|
} TileGroupInfo;
|
|
|
|
|
|
|
|
typedef struct AV1DecContext {
|
|
|
|
const AVClass *class;
|
|
|
|
AVCodecContext *avctx;
|
|
|
|
|
|
|
|
enum AVPixelFormat pix_fmt;
|
|
|
|
CodedBitstreamContext *cbc;
|
|
|
|
CodedBitstreamFragment current_obu;
|
2023-05-19 22:54:49 +00:00
|
|
|
AVPacket *pkt;
|
2020-09-09 03:39:55 +00:00
|
|
|
|
|
|
|
AVBufferRef *seq_ref;
|
|
|
|
AV1RawSequenceHeader *raw_seq;
|
|
|
|
AVBufferRef *header_ref;
|
|
|
|
AV1RawFrameHeader *raw_frame_header;
|
|
|
|
TileGroupInfo *tile_group_info;
|
2023-03-05 23:32:23 +00:00
|
|
|
|
|
|
|
AVBufferRef *cll_ref;
|
|
|
|
AV1RawMetadataHDRCLL *cll;
|
|
|
|
AVBufferRef *mdcv_ref;
|
|
|
|
AV1RawMetadataHDRMDCV *mdcv;
|
|
|
|
AVFifo *itut_t35_fifo;
|
|
|
|
|
2020-09-09 03:39:55 +00:00
|
|
|
uint16_t tile_num;
|
|
|
|
uint16_t tg_start;
|
|
|
|
uint16_t tg_end;
|
|
|
|
|
2020-11-15 21:55:41 +00:00
|
|
|
int operating_point_idc;
|
|
|
|
|
2020-09-09 03:39:55 +00:00
|
|
|
AV1Frame ref[AV1_NUM_REF_FRAMES];
|
|
|
|
AV1Frame cur_frame;
|
|
|
|
|
2023-05-19 22:54:49 +00:00
|
|
|
int nb_unit;
|
|
|
|
|
2020-11-15 21:55:41 +00:00
|
|
|
// AVOptions
|
|
|
|
int operating_point;
|
2020-09-09 03:39:55 +00:00
|
|
|
} AV1DecContext;
|
|
|
|
|
|
|
|
#endif /* AVCODEC_AV1DEC_H */
|