mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-15 14:47:30 +00:00
Rebuild FFmpeg with AV1 CBS compiled in
This commit is contained in:
191
libs/FFmpeg/include/libavcodec/av1.h
Normal file
191
libs/FFmpeg/include/libavcodec/av1.h
Normal file
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* AV1 common definitions
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AV1_H
|
||||
#define AVCODEC_AV1_H
|
||||
|
||||
// OBU types (section 6.2.2).
|
||||
typedef enum {
|
||||
// 0 reserved.
|
||||
AV1_OBU_SEQUENCE_HEADER = 1,
|
||||
AV1_OBU_TEMPORAL_DELIMITER = 2,
|
||||
AV1_OBU_FRAME_HEADER = 3,
|
||||
AV1_OBU_TILE_GROUP = 4,
|
||||
AV1_OBU_METADATA = 5,
|
||||
AV1_OBU_FRAME = 6,
|
||||
AV1_OBU_REDUNDANT_FRAME_HEADER = 7,
|
||||
AV1_OBU_TILE_LIST = 8,
|
||||
// 9-14 reserved.
|
||||
AV1_OBU_PADDING = 15,
|
||||
} AV1_OBU_Type;
|
||||
|
||||
// Metadata types (section 6.7.1).
|
||||
enum {
|
||||
AV1_METADATA_TYPE_HDR_CLL = 1,
|
||||
AV1_METADATA_TYPE_HDR_MDCV = 2,
|
||||
AV1_METADATA_TYPE_SCALABILITY = 3,
|
||||
AV1_METADATA_TYPE_ITUT_T35 = 4,
|
||||
AV1_METADATA_TYPE_TIMECODE = 5,
|
||||
};
|
||||
|
||||
// Frame types (section 6.8.2).
|
||||
enum {
|
||||
AV1_FRAME_KEY = 0,
|
||||
AV1_FRAME_INTER = 1,
|
||||
AV1_FRAME_INTRA_ONLY = 2,
|
||||
AV1_FRAME_SWITCH = 3,
|
||||
};
|
||||
|
||||
// Reference frames (section 6.10.24).
|
||||
enum {
|
||||
AV1_REF_FRAME_INTRA = 0,
|
||||
AV1_REF_FRAME_LAST = 1,
|
||||
AV1_REF_FRAME_LAST2 = 2,
|
||||
AV1_REF_FRAME_LAST3 = 3,
|
||||
AV1_REF_FRAME_GOLDEN = 4,
|
||||
AV1_REF_FRAME_BWDREF = 5,
|
||||
AV1_REF_FRAME_ALTREF2 = 6,
|
||||
AV1_REF_FRAME_ALTREF = 7,
|
||||
};
|
||||
|
||||
// Constants (section 3).
|
||||
enum {
|
||||
AV1_MAX_OPERATING_POINTS = 32,
|
||||
|
||||
AV1_MAX_SB_SIZE = 128,
|
||||
AV1_MI_SIZE = 4,
|
||||
|
||||
AV1_MAX_TILE_WIDTH = 4096,
|
||||
AV1_MAX_TILE_AREA = 4096 * 2304,
|
||||
AV1_MAX_TILE_ROWS = 64,
|
||||
AV1_MAX_TILE_COLS = 64,
|
||||
|
||||
AV1_NUM_REF_FRAMES = 8,
|
||||
AV1_REFS_PER_FRAME = 7,
|
||||
AV1_TOTAL_REFS_PER_FRAME = 8,
|
||||
AV1_PRIMARY_REF_NONE = 7,
|
||||
|
||||
AV1_MAX_SEGMENTS = 8,
|
||||
AV1_SEG_LVL_MAX = 8,
|
||||
|
||||
AV1_SEG_LVL_ALT_Q = 0,
|
||||
AV1_SEG_LVL_ALT_LF_Y_V = 1,
|
||||
AV1_SEG_LVL_REF_FRAME = 5,
|
||||
AV1_SEG_LVL_SKIP = 6,
|
||||
AV1_SEG_LVL_GLOBAL_MV = 7,
|
||||
|
||||
AV1_SELECT_SCREEN_CONTENT_TOOLS = 2,
|
||||
AV1_SELECT_INTEGER_MV = 2,
|
||||
|
||||
AV1_SUPERRES_NUM = 8,
|
||||
AV1_SUPERRES_DENOM_MIN = 9,
|
||||
|
||||
AV1_INTERPOLATION_FILTER_SWITCHABLE = 4,
|
||||
|
||||
AV1_GM_ABS_ALPHA_BITS = 12,
|
||||
AV1_GM_ALPHA_PREC_BITS = 15,
|
||||
AV1_GM_ABS_TRANS_ONLY_BITS = 9,
|
||||
AV1_GM_TRANS_ONLY_PREC_BITS = 3,
|
||||
AV1_GM_ABS_TRANS_BITS = 12,
|
||||
AV1_GM_TRANS_PREC_BITS = 6,
|
||||
AV1_WARPEDMODEL_PREC_BITS = 16,
|
||||
|
||||
AV1_WARP_MODEL_IDENTITY = 0,
|
||||
AV1_WARP_MODEL_TRANSLATION = 1,
|
||||
AV1_WARP_MODEL_ROTZOOM = 2,
|
||||
AV1_WARP_MODEL_AFFINE = 3,
|
||||
AV1_WARP_PARAM_REDUCE_BITS = 6,
|
||||
|
||||
AV1_DIV_LUT_BITS = 8,
|
||||
AV1_DIV_LUT_PREC_BITS = 14,
|
||||
AV1_DIV_LUT_NUM = 257,
|
||||
|
||||
AV1_MAX_LOOP_FILTER = 63,
|
||||
};
|
||||
|
||||
|
||||
// The main colour configuration information uses the same ISO/IEC 23001-8
|
||||
// (H.273) enums as FFmpeg does, so separate definitions are not required.
|
||||
|
||||
// Chroma sample position.
|
||||
enum {
|
||||
AV1_CSP_UNKNOWN = 0,
|
||||
AV1_CSP_VERTICAL = 1, // -> AVCHROMA_LOC_LEFT.
|
||||
AV1_CSP_COLOCATED = 2, // -> AVCHROMA_LOC_TOPLEFT.
|
||||
};
|
||||
|
||||
// Scalability modes (section 6.7.5)
|
||||
enum {
|
||||
AV1_SCALABILITY_L1T2 = 0,
|
||||
AV1_SCALABILITY_L1T3 = 1,
|
||||
AV1_SCALABILITY_L2T1 = 2,
|
||||
AV1_SCALABILITY_L2T2 = 3,
|
||||
AV1_SCALABILITY_L2T3 = 4,
|
||||
AV1_SCALABILITY_S2T1 = 5,
|
||||
AV1_SCALABILITY_S2T2 = 6,
|
||||
AV1_SCALABILITY_S2T3 = 7,
|
||||
AV1_SCALABILITY_L2T1h = 8,
|
||||
AV1_SCALABILITY_L2T2h = 9,
|
||||
AV1_SCALABILITY_L2T3h = 10,
|
||||
AV1_SCALABILITY_S2T1h = 11,
|
||||
AV1_SCALABILITY_S2T2h = 12,
|
||||
AV1_SCALABILITY_S2T3h = 13,
|
||||
AV1_SCALABILITY_SS = 14,
|
||||
AV1_SCALABILITY_L3T1 = 15,
|
||||
AV1_SCALABILITY_L3T2 = 16,
|
||||
AV1_SCALABILITY_L3T3 = 17,
|
||||
AV1_SCALABILITY_S3T1 = 18,
|
||||
AV1_SCALABILITY_S3T2 = 19,
|
||||
AV1_SCALABILITY_S3T3 = 20,
|
||||
AV1_SCALABILITY_L3T2_KEY = 21,
|
||||
AV1_SCALABILITY_L3T3_KEY = 22,
|
||||
AV1_SCALABILITY_L4T5_KEY = 23,
|
||||
AV1_SCALABILITY_L4T7_KEY = 24,
|
||||
AV1_SCALABILITY_L3T2_KEY_SHIFT = 25,
|
||||
AV1_SCALABILITY_L3T3_KEY_SHIFT = 26,
|
||||
AV1_SCALABILITY_L4T5_KEY_SHIFT = 27,
|
||||
AV1_SCALABILITY_L4T7_KEY_SHIFT = 28,
|
||||
};
|
||||
|
||||
// Frame Restoration types (section 6.10.15)
|
||||
enum {
|
||||
AV1_RESTORE_NONE = 0,
|
||||
AV1_RESTORE_WIENER = 1,
|
||||
AV1_RESTORE_SGRPROJ = 2,
|
||||
AV1_RESTORE_SWITCHABLE = 3,
|
||||
};
|
||||
|
||||
// TX mode (section 6.8.21)
|
||||
enum {
|
||||
AV1_ONLY_4X4 = 0,
|
||||
AV1_TX_MODE_LARGEST = 1,
|
||||
AV1_TX_MODE_SELECT = 2,
|
||||
};
|
||||
|
||||
// Sequence Headers are actually unbounded because one can use
|
||||
// an arbitrary number of leading zeroes when encoding via uvlc.
|
||||
// The following estimate is based around using the lowest number
|
||||
// of bits for uvlc encoding.
|
||||
#define AV1_SANE_SEQUENCE_HEADER_MAX_BITS 3138
|
||||
|
||||
#endif /* AVCODEC_AV1_H */
|
||||
541
libs/FFmpeg/include/libavcodec/cbs.h
Normal file
541
libs/FFmpeg/include/libavcodec/cbs.h
Normal file
@@ -0,0 +1,541 @@
|
||||
/*
|
||||
* 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_CBS_H
|
||||
#define AVCODEC_CBS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/buffer.h"
|
||||
|
||||
#include "codec_id.h"
|
||||
#include "codec_par.h"
|
||||
#include "defs.h"
|
||||
#include "packet.h"
|
||||
|
||||
|
||||
/*
|
||||
* This defines a framework for converting between a coded bitstream
|
||||
* and structures defining all individual syntax elements found in
|
||||
* such a stream.
|
||||
*
|
||||
* Conversion in both directions is possible. Given a coded bitstream
|
||||
* (any meaningful fragment), it can be parsed and decomposed into
|
||||
* syntax elements stored in a set of codec-specific structures.
|
||||
* Similarly, given a set of those same codec-specific structures the
|
||||
* syntax elements can be serialised and combined to create a coded
|
||||
* bitstream.
|
||||
*/
|
||||
|
||||
struct AVCodecContext;
|
||||
struct CodedBitstreamType;
|
||||
|
||||
/**
|
||||
* The codec-specific type of a bitstream unit.
|
||||
*
|
||||
* AV1: obu_type
|
||||
* H.264 / AVC: nal_unit_type
|
||||
* H.265 / HEVC: nal_unit_type
|
||||
* JPEG: marker value (without 0xff prefix)
|
||||
* MPEG-2: start code value (without prefix)
|
||||
* VP9: unused, set to zero (every unit is a frame)
|
||||
*/
|
||||
typedef uint32_t CodedBitstreamUnitType;
|
||||
|
||||
/**
|
||||
* Coded bitstream unit structure.
|
||||
*
|
||||
* A bitstream unit the smallest element of a bitstream which
|
||||
* is meaningful on its own. For example, an H.264 NAL unit.
|
||||
*
|
||||
* See the codec-specific header for the meaning of this for any
|
||||
* particular codec.
|
||||
*/
|
||||
typedef struct CodedBitstreamUnit {
|
||||
/**
|
||||
* Codec-specific type of this unit.
|
||||
*/
|
||||
CodedBitstreamUnitType type;
|
||||
|
||||
/**
|
||||
* Pointer to the directly-parsable bitstream form of this unit.
|
||||
*
|
||||
* May be NULL if the unit currently only exists in decomposed form.
|
||||
*/
|
||||
uint8_t *data;
|
||||
/**
|
||||
* The number of bytes in the bitstream (including any padding bits
|
||||
* in the final byte).
|
||||
*/
|
||||
size_t data_size;
|
||||
/**
|
||||
* The number of bits which should be ignored in the final byte.
|
||||
*
|
||||
* This supports non-byte-aligned bitstreams.
|
||||
*/
|
||||
size_t data_bit_padding;
|
||||
/**
|
||||
* A reference to the buffer containing data.
|
||||
*
|
||||
* Must be set if data is not NULL.
|
||||
*/
|
||||
AVBufferRef *data_ref;
|
||||
|
||||
/**
|
||||
* Pointer to the decomposed form of this unit.
|
||||
*
|
||||
* The type of this structure depends on both the codec and the
|
||||
* type of this unit. May be NULL if the unit only exists in
|
||||
* bitstream form.
|
||||
*/
|
||||
void *content;
|
||||
/**
|
||||
* If content is reference counted, a RefStruct reference backing content.
|
||||
* NULL if content is not reference counted.
|
||||
*/
|
||||
void *content_ref;
|
||||
} CodedBitstreamUnit;
|
||||
|
||||
/**
|
||||
* Coded bitstream fragment structure, combining one or more units.
|
||||
*
|
||||
* This is any sequence of units. It need not form some greater whole,
|
||||
* though in many cases it will. For example, an H.264 access unit,
|
||||
* which is composed of a sequence of H.264 NAL units.
|
||||
*/
|
||||
typedef struct CodedBitstreamFragment {
|
||||
/**
|
||||
* Pointer to the bitstream form of this fragment.
|
||||
*
|
||||
* May be NULL if the fragment only exists as component units.
|
||||
*/
|
||||
uint8_t *data;
|
||||
/**
|
||||
* The number of bytes in the bitstream.
|
||||
*
|
||||
* The number of bytes in the bitstream (including any padding bits
|
||||
* in the final byte).
|
||||
*/
|
||||
size_t data_size;
|
||||
/**
|
||||
* The number of bits which should be ignored in the final byte.
|
||||
*/
|
||||
size_t data_bit_padding;
|
||||
/**
|
||||
* A reference to the buffer containing data.
|
||||
*
|
||||
* Must be set if data is not NULL.
|
||||
*/
|
||||
AVBufferRef *data_ref;
|
||||
|
||||
/**
|
||||
* Number of units in this fragment.
|
||||
*
|
||||
* This may be zero if the fragment only exists in bitstream form
|
||||
* and has not been decomposed.
|
||||
*/
|
||||
int nb_units;
|
||||
|
||||
/**
|
||||
* Number of allocated units.
|
||||
*
|
||||
* Must always be >= nb_units; designed for internal use by cbs.
|
||||
*/
|
||||
int nb_units_allocated;
|
||||
|
||||
/**
|
||||
* Pointer to an array of units of length nb_units_allocated.
|
||||
* Only the first nb_units are valid.
|
||||
*
|
||||
* Must be NULL if nb_units_allocated is zero.
|
||||
*/
|
||||
CodedBitstreamUnit *units;
|
||||
} CodedBitstreamFragment;
|
||||
|
||||
|
||||
struct CodedBitstreamContext;
|
||||
struct GetBitContext;
|
||||
struct PutBitContext;
|
||||
|
||||
/**
|
||||
* Callback type for read tracing.
|
||||
*
|
||||
* @param ctx User-set trace context.
|
||||
* @param gbc A GetBitContext set at the start of the syntax
|
||||
* element. This is a copy, the callee does not
|
||||
* need to preserve it.
|
||||
* @param length Length in bits of the syntax element.
|
||||
* @param name String name of the syntax elements.
|
||||
* @param subscripts If the syntax element is an array, a pointer to
|
||||
* an array of subscripts into the array.
|
||||
* @param value Parsed value of the syntax element.
|
||||
*/
|
||||
typedef void (*CBSTraceReadCallback)(void *trace_context,
|
||||
struct GetBitContext *gbc,
|
||||
int start_position,
|
||||
const char *name,
|
||||
const int *subscripts,
|
||||
int64_t value);
|
||||
|
||||
/**
|
||||
* Callback type for write tracing.
|
||||
*
|
||||
* @param ctx User-set trace context.
|
||||
* @param pbc A PutBitContext set at the end of the syntax
|
||||
* element. The user must not modify this, but may
|
||||
* inspect it to determine state.
|
||||
* @param length Length in bits of the syntax element.
|
||||
* @param name String name of the syntax elements.
|
||||
* @param subscripts If the syntax element is an array, a pointer to
|
||||
* an array of subscripts into the array.
|
||||
* @param value Written value of the syntax element.
|
||||
*/
|
||||
typedef void (*CBSTraceWriteCallback)(void *trace_context,
|
||||
struct PutBitContext *pbc,
|
||||
int start_position,
|
||||
const char *name,
|
||||
const int *subscripts,
|
||||
int64_t value);
|
||||
|
||||
/**
|
||||
* Context structure for coded bitstream operations.
|
||||
*/
|
||||
typedef struct CodedBitstreamContext {
|
||||
/**
|
||||
* Logging context to be passed to all av_log() calls associated
|
||||
* with this context.
|
||||
*/
|
||||
void *log_ctx;
|
||||
|
||||
/**
|
||||
* Internal codec-specific hooks.
|
||||
*/
|
||||
const struct CodedBitstreamType *codec;
|
||||
|
||||
/**
|
||||
* Internal codec-specific data.
|
||||
*
|
||||
* This contains any information needed when reading/writing
|
||||
* bitsteams which will not necessarily be present in a fragment.
|
||||
* For example, for H.264 it contains all currently visible
|
||||
* parameter sets - they are required to determine the bitstream
|
||||
* syntax but need not be present in every access unit.
|
||||
*/
|
||||
void *priv_data;
|
||||
|
||||
/**
|
||||
* Array of unit types which should be decomposed when reading.
|
||||
*
|
||||
* Types not in this list will be available in bitstream form only.
|
||||
* If NULL, all supported types will be decomposed.
|
||||
*/
|
||||
const CodedBitstreamUnitType *decompose_unit_types;
|
||||
/**
|
||||
* Length of the decompose_unit_types array.
|
||||
*/
|
||||
int nb_decompose_unit_types;
|
||||
|
||||
/**
|
||||
* Enable trace output during read/write operations.
|
||||
*/
|
||||
int trace_enable;
|
||||
/**
|
||||
* Log level to use for default trace output.
|
||||
*
|
||||
* From AV_LOG_*; defaults to AV_LOG_TRACE.
|
||||
*/
|
||||
int trace_level;
|
||||
/**
|
||||
* User context pointer to pass to trace callbacks.
|
||||
*/
|
||||
void *trace_context;
|
||||
/**
|
||||
* Callback for read tracing.
|
||||
*
|
||||
* If tracing is enabled then this is called once for each syntax
|
||||
* element parsed.
|
||||
*/
|
||||
CBSTraceReadCallback trace_read_callback;
|
||||
/**
|
||||
* Callback for write tracing.
|
||||
*
|
||||
* If tracing is enabled then this is called once for each syntax
|
||||
* element written.
|
||||
*/
|
||||
CBSTraceWriteCallback trace_write_callback;
|
||||
|
||||
/**
|
||||
* Write buffer. Used as intermediate buffer when writing units.
|
||||
* For internal use of cbs only.
|
||||
*/
|
||||
uint8_t *write_buffer;
|
||||
size_t write_buffer_size;
|
||||
} CodedBitstreamContext;
|
||||
|
||||
|
||||
/**
|
||||
* Table of all supported codec IDs.
|
||||
*
|
||||
* Terminated by AV_CODEC_ID_NONE.
|
||||
*/
|
||||
extern const enum AVCodecID ff_cbs_all_codec_ids[];
|
||||
|
||||
|
||||
/**
|
||||
* Create and initialise a new context for the given codec.
|
||||
*/
|
||||
int ff_cbs_init(CodedBitstreamContext **ctx,
|
||||
enum AVCodecID codec_id, void *log_ctx);
|
||||
|
||||
/**
|
||||
* Reset all internal state in a context.
|
||||
*/
|
||||
void ff_cbs_flush(CodedBitstreamContext *ctx);
|
||||
|
||||
/**
|
||||
* Close a context and free all internal state.
|
||||
*/
|
||||
void ff_cbs_close(CodedBitstreamContext **ctx);
|
||||
|
||||
|
||||
/**
|
||||
* Read the extradata bitstream found in codec parameters into a
|
||||
* fragment, then split into units and decompose.
|
||||
*
|
||||
* This also updates the internal state, so will need to be called for
|
||||
* codecs with extradata to read parameter sets necessary for further
|
||||
* parsing even if the fragment itself is not desired.
|
||||
*
|
||||
* The fragment must have been zeroed or reset via ff_cbs_fragment_reset
|
||||
* before use.
|
||||
*/
|
||||
int ff_cbs_read_extradata(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
const AVCodecParameters *par);
|
||||
|
||||
/**
|
||||
* Read the extradata bitstream found in a codec context into a
|
||||
* fragment, then split into units and decompose.
|
||||
*
|
||||
* This acts identical to ff_cbs_read_extradata() for the case where
|
||||
* you already have a codec context.
|
||||
*/
|
||||
int ff_cbs_read_extradata_from_codec(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
const struct AVCodecContext *avctx);
|
||||
|
||||
int ff_cbs_read_packet_side_data(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
const AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Read the data bitstream from a packet into a fragment, then
|
||||
* split into units and decompose.
|
||||
*
|
||||
* This also updates the internal state of the coded bitstream context
|
||||
* with any persistent data from the fragment which may be required to
|
||||
* read following fragments (e.g. parameter sets).
|
||||
*
|
||||
* The fragment must have been zeroed or reset via ff_cbs_fragment_reset
|
||||
* before use.
|
||||
*/
|
||||
int ff_cbs_read_packet(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
const AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Read a bitstream from a memory region into a fragment, then
|
||||
* split into units and decompose.
|
||||
*
|
||||
* This also updates the internal state of the coded bitstream context
|
||||
* with any persistent data from the fragment which may be required to
|
||||
* read following fragments (e.g. parameter sets).
|
||||
*
|
||||
* The fragment must have been zeroed or reset via ff_cbs_fragment_reset
|
||||
* before use.
|
||||
*/
|
||||
int ff_cbs_read(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
const uint8_t *data, size_t size);
|
||||
|
||||
|
||||
/**
|
||||
* Write the content of the fragment to its own internal buffer.
|
||||
*
|
||||
* Writes the content of all units and then assembles them into a new
|
||||
* data buffer. When modifying the content of decomposed units, this
|
||||
* can be used to regenerate the bitstream form of units or the whole
|
||||
* fragment so that it can be extracted for other use.
|
||||
*
|
||||
* This also updates the internal state of the coded bitstream context
|
||||
* with any persistent data from the fragment which may be required to
|
||||
* write following fragments (e.g. parameter sets).
|
||||
*/
|
||||
int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag);
|
||||
|
||||
/**
|
||||
* Write the bitstream of a fragment to the extradata in codec parameters.
|
||||
*
|
||||
* Modifies context and fragment as ff_cbs_write_fragment_data does and
|
||||
* replaces any existing extradata in the structure.
|
||||
*/
|
||||
int ff_cbs_write_extradata(CodedBitstreamContext *ctx,
|
||||
AVCodecParameters *par,
|
||||
CodedBitstreamFragment *frag);
|
||||
|
||||
/**
|
||||
* Write the bitstream of a fragment to a packet.
|
||||
*
|
||||
* Modifies context and fragment as ff_cbs_write_fragment_data does.
|
||||
*
|
||||
* On success, the packet's buf is unreferenced and its buf, data and
|
||||
* size fields are set to the corresponding values from the newly updated
|
||||
* fragment; other fields are not touched. On failure, the packet is not
|
||||
* touched at all.
|
||||
*/
|
||||
int ff_cbs_write_packet(CodedBitstreamContext *ctx,
|
||||
AVPacket *pkt,
|
||||
CodedBitstreamFragment *frag);
|
||||
|
||||
|
||||
/**
|
||||
* Free the units contained in a fragment as well as the fragment's
|
||||
* own data buffer, but not the units array itself.
|
||||
*/
|
||||
void ff_cbs_fragment_reset(CodedBitstreamFragment *frag);
|
||||
|
||||
/**
|
||||
* Free the units array of a fragment in addition to what
|
||||
* ff_cbs_fragment_reset does.
|
||||
*/
|
||||
void ff_cbs_fragment_free(CodedBitstreamFragment *frag);
|
||||
|
||||
/**
|
||||
* Allocate a new internal content buffer matching the type of the unit.
|
||||
*
|
||||
* The content will be zeroed.
|
||||
*/
|
||||
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit);
|
||||
|
||||
/**
|
||||
* Insert a new unit into a fragment with the given content.
|
||||
*
|
||||
* If content_ref is supplied, it has to be a RefStruct reference
|
||||
* backing content; the user keeps ownership of the supplied reference.
|
||||
* The content structure continues to be owned by the caller if
|
||||
* content_ref is not supplied.
|
||||
*/
|
||||
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag,
|
||||
int position,
|
||||
CodedBitstreamUnitType type,
|
||||
void *content,
|
||||
void *content_ref);
|
||||
|
||||
/**
|
||||
* Add a new unit to a fragment with the given data bitstream.
|
||||
*
|
||||
* If data_buf is not supplied then data must have been allocated with
|
||||
* av_malloc() and will on success become owned by the unit after this
|
||||
* call or freed on error.
|
||||
*/
|
||||
int ff_cbs_append_unit_data(CodedBitstreamFragment *frag,
|
||||
CodedBitstreamUnitType type,
|
||||
uint8_t *data, size_t data_size,
|
||||
AVBufferRef *data_buf);
|
||||
|
||||
/**
|
||||
* Delete a unit from a fragment and free all memory it uses.
|
||||
*
|
||||
* Requires position to be >= 0 and < frag->nb_units.
|
||||
*/
|
||||
void ff_cbs_delete_unit(CodedBitstreamFragment *frag,
|
||||
int position);
|
||||
|
||||
|
||||
/**
|
||||
* Make the content of a unit refcounted.
|
||||
*
|
||||
* If the unit is not refcounted, this will do a deep copy of the unit
|
||||
* content to new refcounted buffers.
|
||||
*
|
||||
* It is not valid to call this function on a unit which does not have
|
||||
* decomposed content.
|
||||
*/
|
||||
int ff_cbs_make_unit_refcounted(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit);
|
||||
|
||||
/**
|
||||
* Make the content of a unit writable so that internal fields can be
|
||||
* modified.
|
||||
*
|
||||
* If it is known that there are no other references to the content of
|
||||
* the unit, does nothing and returns success. Otherwise (including the
|
||||
* case where the unit content is not refcounted), it does a full clone
|
||||
* of the content (including any internal buffers) to make a new copy,
|
||||
* and replaces the existing references inside the unit with that.
|
||||
*
|
||||
* It is not valid to call this function on a unit which does not have
|
||||
* decomposed content.
|
||||
*/
|
||||
int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit);
|
||||
|
||||
enum CbsDiscardFlags {
|
||||
DISCARD_FLAG_NONE = 0,
|
||||
|
||||
/**
|
||||
* keep non-vcl units even if the picture has been dropped.
|
||||
*/
|
||||
DISCARD_FLAG_KEEP_NON_VCL = 0x01,
|
||||
};
|
||||
|
||||
/**
|
||||
* Discard units accroding to 'skip'.
|
||||
*/
|
||||
void ff_cbs_discard_units(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
enum AVDiscard skip,
|
||||
int flags);
|
||||
|
||||
|
||||
/**
|
||||
* Helper function for read tracing which formats the syntax element
|
||||
* and logs the result.
|
||||
*
|
||||
* Trace context should be set to the CodedBitstreamContext.
|
||||
*/
|
||||
void ff_cbs_trace_read_log(void *trace_context,
|
||||
struct GetBitContext *gbc, int length,
|
||||
const char *str, const int *subscripts,
|
||||
int64_t value);
|
||||
|
||||
/**
|
||||
* Helper function for write tracing which formats the syntax element
|
||||
* and logs the result.
|
||||
*
|
||||
* Trace context should be set to the CodedBitstreamContext.
|
||||
*/
|
||||
void ff_cbs_trace_write_log(void *trace_context,
|
||||
struct PutBitContext *pbc, int length,
|
||||
const char *str, const int *subscripts,
|
||||
int64_t value);
|
||||
|
||||
#endif /* AVCODEC_CBS_H */
|
||||
478
libs/FFmpeg/include/libavcodec/cbs_av1.h
Normal file
478
libs/FFmpeg/include/libavcodec/cbs_av1.h
Normal file
@@ -0,0 +1,478 @@
|
||||
/*
|
||||
* 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_CBS_AV1_H
|
||||
#define AVCODEC_CBS_AV1_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "av1.h"
|
||||
#include "cbs.h"
|
||||
|
||||
|
||||
typedef struct AV1RawOBUHeader {
|
||||
uint8_t obu_forbidden_bit;
|
||||
uint8_t obu_type;
|
||||
uint8_t obu_extension_flag;
|
||||
uint8_t obu_has_size_field;
|
||||
uint8_t obu_reserved_1bit;
|
||||
|
||||
uint8_t temporal_id;
|
||||
uint8_t spatial_id;
|
||||
uint8_t extension_header_reserved_3bits;
|
||||
} AV1RawOBUHeader;
|
||||
|
||||
typedef struct AV1RawColorConfig {
|
||||
uint8_t high_bitdepth;
|
||||
uint8_t twelve_bit;
|
||||
uint8_t mono_chrome;
|
||||
|
||||
uint8_t color_description_present_flag;
|
||||
uint8_t color_primaries;
|
||||
uint8_t transfer_characteristics;
|
||||
uint8_t matrix_coefficients;
|
||||
|
||||
uint8_t color_range;
|
||||
uint8_t subsampling_x;
|
||||
uint8_t subsampling_y;
|
||||
uint8_t chroma_sample_position;
|
||||
uint8_t separate_uv_delta_q;
|
||||
} AV1RawColorConfig;
|
||||
|
||||
typedef struct AV1RawTimingInfo {
|
||||
uint32_t num_units_in_display_tick;
|
||||
uint32_t time_scale;
|
||||
|
||||
uint8_t equal_picture_interval;
|
||||
uint32_t num_ticks_per_picture_minus_1;
|
||||
} AV1RawTimingInfo;
|
||||
|
||||
typedef struct AV1RawDecoderModelInfo {
|
||||
uint8_t buffer_delay_length_minus_1;
|
||||
uint32_t num_units_in_decoding_tick;
|
||||
uint8_t buffer_removal_time_length_minus_1;
|
||||
uint8_t frame_presentation_time_length_minus_1;
|
||||
} AV1RawDecoderModelInfo;
|
||||
|
||||
typedef struct AV1RawSequenceHeader {
|
||||
uint8_t seq_profile;
|
||||
uint8_t still_picture;
|
||||
uint8_t reduced_still_picture_header;
|
||||
|
||||
uint8_t timing_info_present_flag;
|
||||
uint8_t decoder_model_info_present_flag;
|
||||
uint8_t initial_display_delay_present_flag;
|
||||
uint8_t operating_points_cnt_minus_1;
|
||||
|
||||
AV1RawTimingInfo timing_info;
|
||||
AV1RawDecoderModelInfo decoder_model_info;
|
||||
|
||||
uint16_t operating_point_idc[AV1_MAX_OPERATING_POINTS];
|
||||
uint8_t seq_level_idx[AV1_MAX_OPERATING_POINTS];
|
||||
uint8_t seq_tier[AV1_MAX_OPERATING_POINTS];
|
||||
uint8_t decoder_model_present_for_this_op[AV1_MAX_OPERATING_POINTS];
|
||||
uint32_t decoder_buffer_delay[AV1_MAX_OPERATING_POINTS];
|
||||
uint32_t encoder_buffer_delay[AV1_MAX_OPERATING_POINTS];
|
||||
uint8_t low_delay_mode_flag[AV1_MAX_OPERATING_POINTS];
|
||||
uint8_t initial_display_delay_present_for_this_op[AV1_MAX_OPERATING_POINTS];
|
||||
uint8_t initial_display_delay_minus_1[AV1_MAX_OPERATING_POINTS];
|
||||
|
||||
uint8_t frame_width_bits_minus_1;
|
||||
uint8_t frame_height_bits_minus_1;
|
||||
uint16_t max_frame_width_minus_1;
|
||||
uint16_t max_frame_height_minus_1;
|
||||
|
||||
uint8_t frame_id_numbers_present_flag;
|
||||
uint8_t delta_frame_id_length_minus_2;
|
||||
uint8_t additional_frame_id_length_minus_1;
|
||||
|
||||
uint8_t use_128x128_superblock;
|
||||
uint8_t enable_filter_intra;
|
||||
uint8_t enable_intra_edge_filter;
|
||||
uint8_t enable_interintra_compound;
|
||||
uint8_t enable_masked_compound;
|
||||
uint8_t enable_warped_motion;
|
||||
uint8_t enable_dual_filter;
|
||||
|
||||
uint8_t enable_order_hint;
|
||||
uint8_t enable_jnt_comp;
|
||||
uint8_t enable_ref_frame_mvs;
|
||||
|
||||
uint8_t seq_choose_screen_content_tools;
|
||||
uint8_t seq_force_screen_content_tools;
|
||||
uint8_t seq_choose_integer_mv;
|
||||
uint8_t seq_force_integer_mv;
|
||||
|
||||
uint8_t order_hint_bits_minus_1;
|
||||
|
||||
uint8_t enable_superres;
|
||||
uint8_t enable_cdef;
|
||||
uint8_t enable_restoration;
|
||||
|
||||
AV1RawColorConfig color_config;
|
||||
|
||||
uint8_t film_grain_params_present;
|
||||
} AV1RawSequenceHeader;
|
||||
|
||||
typedef struct AV1RawFilmGrainParams {
|
||||
uint8_t apply_grain;
|
||||
uint16_t grain_seed;
|
||||
uint8_t update_grain;
|
||||
uint8_t film_grain_params_ref_idx;
|
||||
uint8_t num_y_points;
|
||||
uint8_t point_y_value[14];
|
||||
uint8_t point_y_scaling[14];
|
||||
uint8_t chroma_scaling_from_luma;
|
||||
uint8_t num_cb_points;
|
||||
uint8_t point_cb_value[10];
|
||||
uint8_t point_cb_scaling[10];
|
||||
uint8_t num_cr_points;
|
||||
uint8_t point_cr_value[10];
|
||||
uint8_t point_cr_scaling[10];
|
||||
uint8_t grain_scaling_minus_8;
|
||||
uint8_t ar_coeff_lag;
|
||||
uint8_t ar_coeffs_y_plus_128[24];
|
||||
uint8_t ar_coeffs_cb_plus_128[25];
|
||||
uint8_t ar_coeffs_cr_plus_128[25];
|
||||
uint8_t ar_coeff_shift_minus_6;
|
||||
uint8_t grain_scale_shift;
|
||||
uint8_t cb_mult;
|
||||
uint8_t cb_luma_mult;
|
||||
uint16_t cb_offset;
|
||||
uint8_t cr_mult;
|
||||
uint8_t cr_luma_mult;
|
||||
uint16_t cr_offset;
|
||||
uint8_t overlap_flag;
|
||||
uint8_t clip_to_restricted_range;
|
||||
} AV1RawFilmGrainParams;
|
||||
|
||||
typedef struct AV1RawFrameHeader {
|
||||
uint8_t show_existing_frame;
|
||||
uint8_t frame_to_show_map_idx;
|
||||
uint32_t frame_presentation_time;
|
||||
uint32_t display_frame_id;
|
||||
|
||||
uint8_t frame_type;
|
||||
uint8_t show_frame;
|
||||
uint8_t showable_frame;
|
||||
|
||||
uint8_t error_resilient_mode;
|
||||
uint8_t disable_cdf_update;
|
||||
uint8_t allow_screen_content_tools;
|
||||
uint8_t force_integer_mv;
|
||||
|
||||
uint32_t current_frame_id;
|
||||
uint8_t frame_size_override_flag;
|
||||
uint8_t order_hint;
|
||||
|
||||
uint8_t buffer_removal_time_present_flag;
|
||||
uint32_t buffer_removal_time[AV1_MAX_OPERATING_POINTS];
|
||||
|
||||
uint8_t primary_ref_frame;
|
||||
uint16_t frame_width_minus_1;
|
||||
uint16_t frame_height_minus_1;
|
||||
uint8_t use_superres;
|
||||
uint8_t coded_denom;
|
||||
uint8_t render_and_frame_size_different;
|
||||
uint16_t render_width_minus_1;
|
||||
uint16_t render_height_minus_1;
|
||||
|
||||
uint8_t found_ref[AV1_REFS_PER_FRAME];
|
||||
|
||||
uint8_t refresh_frame_flags;
|
||||
uint8_t allow_intrabc;
|
||||
uint8_t ref_order_hint[AV1_NUM_REF_FRAMES];
|
||||
uint8_t frame_refs_short_signaling;
|
||||
uint8_t last_frame_idx;
|
||||
uint8_t golden_frame_idx;
|
||||
int8_t ref_frame_idx[AV1_REFS_PER_FRAME];
|
||||
uint32_t delta_frame_id_minus1[AV1_REFS_PER_FRAME];
|
||||
|
||||
uint8_t allow_high_precision_mv;
|
||||
uint8_t is_filter_switchable;
|
||||
uint8_t interpolation_filter;
|
||||
uint8_t is_motion_mode_switchable;
|
||||
uint8_t use_ref_frame_mvs;
|
||||
|
||||
uint8_t disable_frame_end_update_cdf;
|
||||
|
||||
uint8_t uniform_tile_spacing_flag;
|
||||
uint8_t tile_cols_log2;
|
||||
uint8_t tile_rows_log2;
|
||||
uint8_t tile_start_col_sb[AV1_MAX_TILE_COLS];
|
||||
uint8_t tile_start_row_sb[AV1_MAX_TILE_COLS];
|
||||
uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS];
|
||||
uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS];
|
||||
uint16_t context_update_tile_id;
|
||||
uint8_t tile_size_bytes_minus1;
|
||||
|
||||
// These are derived values, but it's very unhelpful to have to
|
||||
// recalculate them all the time so we store them here.
|
||||
uint16_t tile_cols;
|
||||
uint16_t tile_rows;
|
||||
|
||||
uint8_t base_q_idx;
|
||||
int8_t delta_q_y_dc;
|
||||
uint8_t diff_uv_delta;
|
||||
int8_t delta_q_u_dc;
|
||||
int8_t delta_q_u_ac;
|
||||
int8_t delta_q_v_dc;
|
||||
int8_t delta_q_v_ac;
|
||||
uint8_t using_qmatrix;
|
||||
uint8_t qm_y;
|
||||
uint8_t qm_u;
|
||||
uint8_t qm_v;
|
||||
|
||||
uint8_t segmentation_enabled;
|
||||
uint8_t segmentation_update_map;
|
||||
uint8_t segmentation_temporal_update;
|
||||
uint8_t segmentation_update_data;
|
||||
uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
|
||||
int16_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
|
||||
|
||||
uint8_t delta_q_present;
|
||||
uint8_t delta_q_res;
|
||||
uint8_t delta_lf_present;
|
||||
uint8_t delta_lf_res;
|
||||
uint8_t delta_lf_multi;
|
||||
|
||||
uint8_t loop_filter_level[4];
|
||||
uint8_t loop_filter_sharpness;
|
||||
uint8_t loop_filter_delta_enabled;
|
||||
uint8_t loop_filter_delta_update;
|
||||
uint8_t update_ref_delta[AV1_TOTAL_REFS_PER_FRAME];
|
||||
int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME];
|
||||
uint8_t update_mode_delta[2];
|
||||
int8_t loop_filter_mode_deltas[2];
|
||||
|
||||
uint8_t cdef_damping_minus_3;
|
||||
uint8_t cdef_bits;
|
||||
uint8_t cdef_y_pri_strength[8];
|
||||
uint8_t cdef_y_sec_strength[8];
|
||||
uint8_t cdef_uv_pri_strength[8];
|
||||
uint8_t cdef_uv_sec_strength[8];
|
||||
|
||||
uint8_t lr_type[3];
|
||||
uint8_t lr_unit_shift;
|
||||
uint8_t lr_uv_shift;
|
||||
|
||||
uint8_t tx_mode;
|
||||
uint8_t reference_select;
|
||||
uint8_t skip_mode_present;
|
||||
|
||||
uint8_t allow_warped_motion;
|
||||
uint8_t reduced_tx_set;
|
||||
|
||||
uint8_t is_global[AV1_TOTAL_REFS_PER_FRAME];
|
||||
uint8_t is_rot_zoom[AV1_TOTAL_REFS_PER_FRAME];
|
||||
uint8_t is_translation[AV1_TOTAL_REFS_PER_FRAME];
|
||||
//AV1RawSubexp gm_params[AV1_TOTAL_REFS_PER_FRAME][6];
|
||||
uint32_t gm_params[AV1_TOTAL_REFS_PER_FRAME][6];
|
||||
|
||||
AV1RawFilmGrainParams film_grain;
|
||||
} AV1RawFrameHeader;
|
||||
|
||||
typedef struct AV1RawTileData {
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t data_size;
|
||||
} AV1RawTileData;
|
||||
|
||||
typedef struct AV1RawTileGroup {
|
||||
uint8_t tile_start_and_end_present_flag;
|
||||
uint16_t tg_start;
|
||||
uint16_t tg_end;
|
||||
|
||||
AV1RawTileData tile_data;
|
||||
} AV1RawTileGroup;
|
||||
|
||||
typedef struct AV1RawFrame {
|
||||
AV1RawFrameHeader header;
|
||||
AV1RawTileGroup tile_group;
|
||||
} AV1RawFrame;
|
||||
|
||||
typedef struct AV1RawTileList {
|
||||
uint8_t output_frame_width_in_tiles_minus_1;
|
||||
uint8_t output_frame_height_in_tiles_minus_1;
|
||||
uint16_t tile_count_minus_1;
|
||||
|
||||
AV1RawTileData tile_data;
|
||||
} AV1RawTileList;
|
||||
|
||||
typedef struct AV1RawMetadataHDRCLL {
|
||||
uint16_t max_cll;
|
||||
uint16_t max_fall;
|
||||
} AV1RawMetadataHDRCLL;
|
||||
|
||||
typedef struct AV1RawMetadataHDRMDCV {
|
||||
uint16_t primary_chromaticity_x[3];
|
||||
uint16_t primary_chromaticity_y[3];
|
||||
uint16_t white_point_chromaticity_x;
|
||||
uint16_t white_point_chromaticity_y;
|
||||
uint32_t luminance_max;
|
||||
uint32_t luminance_min;
|
||||
} AV1RawMetadataHDRMDCV;
|
||||
|
||||
typedef struct AV1RawMetadataScalability {
|
||||
uint8_t scalability_mode_idc;
|
||||
uint8_t spatial_layers_cnt_minus_1;
|
||||
uint8_t spatial_layer_dimensions_present_flag;
|
||||
uint8_t spatial_layer_description_present_flag;
|
||||
uint8_t temporal_group_description_present_flag;
|
||||
uint8_t scalability_structure_reserved_3bits;
|
||||
uint16_t spatial_layer_max_width[4];
|
||||
uint16_t spatial_layer_max_height[4];
|
||||
uint8_t spatial_layer_ref_id[4];
|
||||
uint8_t temporal_group_size;
|
||||
uint8_t temporal_group_temporal_id[255];
|
||||
uint8_t temporal_group_temporal_switching_up_point_flag[255];
|
||||
uint8_t temporal_group_spatial_switching_up_point_flag[255];
|
||||
uint8_t temporal_group_ref_cnt[255];
|
||||
uint8_t temporal_group_ref_pic_diff[255][7];
|
||||
} AV1RawMetadataScalability;
|
||||
|
||||
typedef struct AV1RawMetadataITUTT35 {
|
||||
uint8_t itu_t_t35_country_code;
|
||||
uint8_t itu_t_t35_country_code_extension_byte;
|
||||
|
||||
uint8_t *payload;
|
||||
AVBufferRef *payload_ref;
|
||||
size_t payload_size;
|
||||
} AV1RawMetadataITUTT35;
|
||||
|
||||
typedef struct AV1RawMetadataTimecode {
|
||||
uint8_t counting_type;
|
||||
uint8_t full_timestamp_flag;
|
||||
uint8_t discontinuity_flag;
|
||||
uint8_t cnt_dropped_flag;
|
||||
uint16_t n_frames;
|
||||
uint8_t seconds_value;
|
||||
uint8_t minutes_value;
|
||||
uint8_t hours_value;
|
||||
uint8_t seconds_flag;
|
||||
uint8_t minutes_flag;
|
||||
uint8_t hours_flag;
|
||||
uint8_t time_offset_length;
|
||||
uint32_t time_offset_value;
|
||||
} AV1RawMetadataTimecode;
|
||||
|
||||
typedef struct AV1RawMetadataUnknown {
|
||||
uint8_t *payload;
|
||||
AVBufferRef *payload_ref;
|
||||
size_t payload_size;
|
||||
} AV1RawMetadataUnknown;
|
||||
|
||||
typedef struct AV1RawMetadata {
|
||||
uint64_t metadata_type;
|
||||
union {
|
||||
AV1RawMetadataHDRCLL hdr_cll;
|
||||
AV1RawMetadataHDRMDCV hdr_mdcv;
|
||||
AV1RawMetadataScalability scalability;
|
||||
AV1RawMetadataITUTT35 itut_t35;
|
||||
AV1RawMetadataTimecode timecode;
|
||||
AV1RawMetadataUnknown unknown;
|
||||
} metadata;
|
||||
} AV1RawMetadata;
|
||||
|
||||
typedef struct AV1RawPadding {
|
||||
uint8_t *payload;
|
||||
AVBufferRef *payload_ref;
|
||||
size_t payload_size;
|
||||
} AV1RawPadding;
|
||||
|
||||
|
||||
typedef struct AV1RawOBU {
|
||||
AV1RawOBUHeader header;
|
||||
|
||||
size_t obu_size;
|
||||
|
||||
union {
|
||||
AV1RawSequenceHeader sequence_header;
|
||||
AV1RawFrameHeader frame_header;
|
||||
AV1RawFrame frame;
|
||||
AV1RawTileGroup tile_group;
|
||||
AV1RawTileList tile_list;
|
||||
AV1RawMetadata metadata;
|
||||
AV1RawPadding padding;
|
||||
} obu;
|
||||
} AV1RawOBU;
|
||||
|
||||
typedef struct AV1ReferenceFrameState {
|
||||
int valid; // RefValid
|
||||
int frame_id; // RefFrameId
|
||||
int upscaled_width; // RefUpscaledWidth
|
||||
int frame_width; // RefFrameWidth
|
||||
int frame_height; // RefFrameHeight
|
||||
int render_width; // RefRenderWidth
|
||||
int render_height; // RefRenderHeight
|
||||
int frame_type; // RefFrameType
|
||||
int subsampling_x; // RefSubsamplingX
|
||||
int subsampling_y; // RefSubsamplingY
|
||||
int bit_depth; // RefBitDepth
|
||||
int order_hint; // RefOrderHint
|
||||
|
||||
int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME];
|
||||
int8_t loop_filter_mode_deltas[2];
|
||||
uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
|
||||
int16_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
|
||||
} AV1ReferenceFrameState;
|
||||
|
||||
typedef struct CodedBitstreamAV1Context {
|
||||
const AVClass *class;
|
||||
|
||||
AV1RawSequenceHeader *sequence_header;
|
||||
/** A RefStruct reference backing sequence_header. */
|
||||
AV1RawOBU *sequence_header_ref;
|
||||
|
||||
int seen_frame_header;
|
||||
AVBufferRef *frame_header_ref;
|
||||
uint8_t *frame_header;
|
||||
size_t frame_header_size;
|
||||
|
||||
int temporal_id;
|
||||
int spatial_id;
|
||||
int operating_point_idc;
|
||||
|
||||
int bit_depth;
|
||||
int order_hint;
|
||||
int frame_width;
|
||||
int frame_height;
|
||||
int upscaled_width;
|
||||
int render_width;
|
||||
int render_height;
|
||||
|
||||
int num_planes;
|
||||
int coded_lossless;
|
||||
int all_lossless;
|
||||
int tile_cols;
|
||||
int tile_rows;
|
||||
int tile_num;
|
||||
|
||||
AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES];
|
||||
|
||||
// AVOptions
|
||||
int operating_point;
|
||||
// When writing, fix the length in bytes of the obu_size field.
|
||||
// Writing will fail with an error if an OBU larger than can be
|
||||
// represented by the fixed size is encountered.
|
||||
int fixed_obu_size_length;
|
||||
} CodedBitstreamAV1Context;
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_AV1_H */
|
||||
Reference in New Issue
Block a user