Test for presence of sps->vui parameters
This commit is contained in:
171
third-party/cbs/include/cbs/av1.h
vendored
Normal file
171
third-party/cbs/include/cbs/av1.h
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* 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,
|
||||
};
|
||||
|
||||
|
||||
// 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,
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_AV1_H */
|
||||
448
third-party/cbs/include/cbs/cbs.h
vendored
Normal file
448
third-party/cbs/include/cbs/cbs.h
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
/*
|
||||
* 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 <libavcodec/avcodec.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 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 reference to the buffer containing
|
||||
* content. Null if content is not reference counted.
|
||||
*/
|
||||
AVBufferRef *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;
|
||||
|
||||
/**
|
||||
* 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 trace output.
|
||||
*
|
||||
* From AV_LOG_*; defaults to AV_LOG_TRACE.
|
||||
*/
|
||||
int trace_level;
|
||||
|
||||
/**
|
||||
* 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 AVCodecContext *avctx);
|
||||
|
||||
/**
|
||||
* 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 of the given size in the unit.
|
||||
*
|
||||
* The content will be zeroed.
|
||||
*/
|
||||
int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit,
|
||||
size_t size,
|
||||
void (*free)(void *opaque, uint8_t *content));
|
||||
|
||||
/**
|
||||
* Allocate a new internal content buffer matching the type of the unit.
|
||||
*
|
||||
* The content will be zeroed.
|
||||
*/
|
||||
int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit);
|
||||
|
||||
|
||||
/**
|
||||
* Allocate a new internal data buffer of the given size in the unit.
|
||||
*
|
||||
* The data buffer will have input padding.
|
||||
*/
|
||||
int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit,
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
* Insert a new unit into a fragment with the given content.
|
||||
*
|
||||
* The content structure continues to be owned by the caller if
|
||||
* content_buf is not supplied.
|
||||
*/
|
||||
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag,
|
||||
int position,
|
||||
CodedBitstreamUnitType type,
|
||||
void *content,
|
||||
AVBufferRef *content_buf);
|
||||
|
||||
/**
|
||||
* Insert a new unit into 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_insert_unit_data(CodedBitstreamFragment *frag,
|
||||
int position,
|
||||
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);
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_H */
|
||||
464
third-party/cbs/include/cbs/cbs_av1.h
vendored
Normal file
464
third-party/cbs/include/cbs/cbs_av1.h
vendored
Normal file
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
* 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 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 AV1RawMetadata {
|
||||
uint64_t metadata_type;
|
||||
union {
|
||||
AV1RawMetadataHDRCLL hdr_cll;
|
||||
AV1RawMetadataHDRMDCV hdr_mdcv;
|
||||
AV1RawMetadataScalability scalability;
|
||||
AV1RawMetadataITUTT35 itut_t35;
|
||||
AV1RawMetadataTimecode timecode;
|
||||
} 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;
|
||||
AVBufferRef *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;
|
||||
} CodedBitstreamAV1Context;
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_AV1_H */
|
||||
131
third-party/cbs/include/cbs/cbs_bsf.h
vendored
Normal file
131
third-party/cbs/include/cbs/cbs_bsf.h
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* 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_BSF_H
|
||||
#define AVCODEC_CBS_BSF_H
|
||||
|
||||
#include "cbs.h"
|
||||
|
||||
|
||||
typedef struct CBSBSFType {
|
||||
enum AVCodecID codec_id;
|
||||
|
||||
// Name of a frame fragment in this codec (e.g. "access unit",
|
||||
// "temporal unit").
|
||||
const char *fragment_name;
|
||||
|
||||
// Name of a unit for this BSF, for use in error messages (e.g.
|
||||
// "NAL unit", "OBU").
|
||||
const char *unit_name;
|
||||
|
||||
// Update the content of a fragment with whatever metadata changes
|
||||
// are desired. The associated AVPacket is provided so that any side
|
||||
// data associated with the fragment can be inspected or edited. If
|
||||
// pkt is NULL, then an extradata header fragment is being updated.
|
||||
int (*update_fragment)(AVBSFContext *bsf, AVPacket *pkt,
|
||||
CodedBitstreamFragment *frag);
|
||||
} CBSBSFType;
|
||||
|
||||
// Common structure for all generic CBS BSF users. An instance of this
|
||||
// structure must be the first member of the BSF private context (to be
|
||||
// pointed to by AVBSFContext.priv_data).
|
||||
typedef struct CBSBSFContext {
|
||||
const AVClass *class;
|
||||
const CBSBSFType *type;
|
||||
|
||||
CodedBitstreamContext *input;
|
||||
CodedBitstreamContext *output;
|
||||
CodedBitstreamFragment fragment;
|
||||
} CBSBSFContext;
|
||||
|
||||
/**
|
||||
* Initialise generic CBS BSF setup.
|
||||
*
|
||||
* Creates the input and output CBS instances, and applies the filter to
|
||||
* the extradata on the input codecpar if any is present.
|
||||
*
|
||||
* Since it calls the update_fragment() function immediately to deal with
|
||||
* extradata, this should be called after any codec-specific setup is done
|
||||
* (probably at the end of the AVBitStreamFilter.init function).
|
||||
*/
|
||||
int ff_cbs_bsf_generic_init(AVBSFContext *bsf, const CBSBSFType *type);
|
||||
|
||||
/**
|
||||
* Close a generic CBS BSF instance.
|
||||
*
|
||||
* If no other deinitialisation is required then this function can be used
|
||||
* directly as AVBitStreamFilter.close.
|
||||
*/
|
||||
void ff_cbs_bsf_generic_close(AVBSFContext *bsf);
|
||||
|
||||
/**
|
||||
* Filter operation for CBS BSF.
|
||||
*
|
||||
* Reads the input packet into a CBS fragment, calls update_fragment() on
|
||||
* it, then writes the result to an output packet. If the input packet
|
||||
* has AV_PKT_DATA_NEW_EXTRADATA side-data associated with it then it does
|
||||
* the same thing to that new extradata to form the output side-data first.
|
||||
*
|
||||
* If the BSF does not do anything else then this function can be used
|
||||
* directly as AVBitStreamFilter.filter.
|
||||
*/
|
||||
int ff_cbs_bsf_generic_filter(AVBSFContext *bsf, AVPacket *pkt);
|
||||
|
||||
|
||||
// Options for element manipulation.
|
||||
enum {
|
||||
// Pass this element through unchanged.
|
||||
BSF_ELEMENT_PASS,
|
||||
// Insert this element, replacing any existing instances of it.
|
||||
// Associated values may be provided explicitly (as addtional options)
|
||||
// or implicitly (either as side data or deduced from other parts of
|
||||
// the stream).
|
||||
BSF_ELEMENT_INSERT,
|
||||
// Remove this element if it appears in the stream.
|
||||
BSF_ELEMENT_REMOVE,
|
||||
// Extract this element to side data, so that further manipulation
|
||||
// can happen elsewhere.
|
||||
BSF_ELEMENT_EXTRACT,
|
||||
};
|
||||
|
||||
#define BSF_ELEMENT_OPTIONS_PIR(name, help, field, opt_flags) \
|
||||
{ name, help, OFFSET(field), AV_OPT_TYPE_INT, \
|
||||
{ .i64 = BSF_ELEMENT_PASS }, \
|
||||
BSF_ELEMENT_PASS, BSF_ELEMENT_REMOVE, opt_flags, name }, \
|
||||
{ "pass", NULL, 0, AV_OPT_TYPE_CONST, \
|
||||
{ .i64 = BSF_ELEMENT_PASS }, .flags = opt_flags, .unit = name }, \
|
||||
{ "insert", NULL, 0, AV_OPT_TYPE_CONST, \
|
||||
{ .i64 = BSF_ELEMENT_INSERT }, .flags = opt_flags, .unit = name }, \
|
||||
{ "remove", NULL, 0, AV_OPT_TYPE_CONST, \
|
||||
{ .i64 = BSF_ELEMENT_REMOVE }, .flags = opt_flags, .unit = name }
|
||||
|
||||
#define BSF_ELEMENT_OPTIONS_PIRE(name, help, field, opt_flags) \
|
||||
{ name, help, OFFSET(field), AV_OPT_TYPE_INT, \
|
||||
{ .i64 = BSF_ELEMENT_PASS }, \
|
||||
BSF_ELEMENT_PASS, BSF_ELEMENT_EXTRACT, opt_flags, name }, \
|
||||
{ "pass", NULL, 0, AV_OPT_TYPE_CONST, \
|
||||
{ .i64 = BSF_ELEMENT_PASS }, .flags = opt_flags, .unit = name }, \
|
||||
{ "insert", NULL, 0, AV_OPT_TYPE_CONST, \
|
||||
{ .i64 = BSF_ELEMENT_INSERT }, .flags = opt_flags, .unit = name }, \
|
||||
{ "remove", NULL, 0, AV_OPT_TYPE_CONST, \
|
||||
{ .i64 = BSF_ELEMENT_REMOVE }, .flags = opt_flags, .unit = name }, \
|
||||
{ "extract", NULL, 0, AV_OPT_TYPE_CONST, \
|
||||
{ .i64 = BSF_ELEMENT_EXTRACT }, .flags = opt_flags, .unit = name }
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_BSF_H */
|
||||
406
third-party/cbs/include/cbs/cbs_h264.h
vendored
Normal file
406
third-party/cbs/include/cbs/cbs_h264.h
vendored
Normal file
@@ -0,0 +1,406 @@
|
||||
/*
|
||||
* 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_H264_H
|
||||
#define AVCODEC_CBS_H264_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "cbs.h"
|
||||
#include "cbs_h2645.h"
|
||||
#include "cbs_sei.h"
|
||||
#include "h264.h"
|
||||
|
||||
|
||||
typedef struct H264RawNALUnitHeader {
|
||||
uint8_t nal_ref_idc;
|
||||
uint8_t nal_unit_type;
|
||||
|
||||
uint8_t svc_extension_flag;
|
||||
uint8_t avc_3d_extension_flag;
|
||||
} H264RawNALUnitHeader;
|
||||
|
||||
typedef struct H264RawScalingList {
|
||||
int8_t delta_scale[64];
|
||||
} H264RawScalingList;
|
||||
|
||||
typedef struct H264RawHRD {
|
||||
uint8_t cpb_cnt_minus1;
|
||||
uint8_t bit_rate_scale;
|
||||
uint8_t cpb_size_scale;
|
||||
|
||||
uint32_t bit_rate_value_minus1[H264_MAX_CPB_CNT];
|
||||
uint32_t cpb_size_value_minus1[H264_MAX_CPB_CNT];
|
||||
uint8_t cbr_flag[H264_MAX_CPB_CNT];
|
||||
|
||||
uint8_t initial_cpb_removal_delay_length_minus1;
|
||||
uint8_t cpb_removal_delay_length_minus1;
|
||||
uint8_t dpb_output_delay_length_minus1;
|
||||
uint8_t time_offset_length;
|
||||
} H264RawHRD;
|
||||
|
||||
typedef struct H264RawVUI {
|
||||
uint8_t aspect_ratio_info_present_flag;
|
||||
uint8_t aspect_ratio_idc;
|
||||
uint16_t sar_width;
|
||||
uint16_t sar_height;
|
||||
|
||||
uint8_t overscan_info_present_flag;
|
||||
uint8_t overscan_appropriate_flag;
|
||||
|
||||
uint8_t video_signal_type_present_flag;
|
||||
uint8_t video_format;
|
||||
uint8_t video_full_range_flag;
|
||||
uint8_t colour_description_present_flag;
|
||||
uint8_t colour_primaries;
|
||||
uint8_t transfer_characteristics;
|
||||
uint8_t matrix_coefficients;
|
||||
|
||||
uint8_t chroma_loc_info_present_flag;
|
||||
uint8_t chroma_sample_loc_type_top_field;
|
||||
uint8_t chroma_sample_loc_type_bottom_field;
|
||||
|
||||
uint8_t timing_info_present_flag;
|
||||
uint32_t num_units_in_tick;
|
||||
uint32_t time_scale;
|
||||
uint8_t fixed_frame_rate_flag;
|
||||
|
||||
uint8_t nal_hrd_parameters_present_flag;
|
||||
H264RawHRD nal_hrd_parameters;
|
||||
uint8_t vcl_hrd_parameters_present_flag;
|
||||
H264RawHRD vcl_hrd_parameters;
|
||||
uint8_t low_delay_hrd_flag;
|
||||
|
||||
uint8_t pic_struct_present_flag;
|
||||
|
||||
uint8_t bitstream_restriction_flag;
|
||||
uint8_t motion_vectors_over_pic_boundaries_flag;
|
||||
uint8_t max_bytes_per_pic_denom;
|
||||
uint8_t max_bits_per_mb_denom;
|
||||
uint8_t log2_max_mv_length_horizontal;
|
||||
uint8_t log2_max_mv_length_vertical;
|
||||
uint8_t max_num_reorder_frames;
|
||||
uint8_t max_dec_frame_buffering;
|
||||
} H264RawVUI;
|
||||
|
||||
typedef struct H264RawSPS {
|
||||
H264RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t profile_idc;
|
||||
uint8_t constraint_set0_flag;
|
||||
uint8_t constraint_set1_flag;
|
||||
uint8_t constraint_set2_flag;
|
||||
uint8_t constraint_set3_flag;
|
||||
uint8_t constraint_set4_flag;
|
||||
uint8_t constraint_set5_flag;
|
||||
uint8_t reserved_zero_2bits;
|
||||
uint8_t level_idc;
|
||||
|
||||
uint8_t seq_parameter_set_id;
|
||||
|
||||
uint8_t chroma_format_idc;
|
||||
uint8_t separate_colour_plane_flag;
|
||||
uint8_t bit_depth_luma_minus8;
|
||||
uint8_t bit_depth_chroma_minus8;
|
||||
uint8_t qpprime_y_zero_transform_bypass_flag;
|
||||
|
||||
uint8_t seq_scaling_matrix_present_flag;
|
||||
uint8_t seq_scaling_list_present_flag[12];
|
||||
H264RawScalingList scaling_list_4x4[6];
|
||||
H264RawScalingList scaling_list_8x8[6];
|
||||
|
||||
uint8_t log2_max_frame_num_minus4;
|
||||
uint8_t pic_order_cnt_type;
|
||||
uint8_t log2_max_pic_order_cnt_lsb_minus4;
|
||||
uint8_t delta_pic_order_always_zero_flag;
|
||||
int32_t offset_for_non_ref_pic;
|
||||
int32_t offset_for_top_to_bottom_field;
|
||||
uint8_t num_ref_frames_in_pic_order_cnt_cycle;
|
||||
int32_t offset_for_ref_frame[256];
|
||||
|
||||
uint8_t max_num_ref_frames;
|
||||
uint8_t gaps_in_frame_num_allowed_flag;
|
||||
|
||||
uint16_t pic_width_in_mbs_minus1;
|
||||
uint16_t pic_height_in_map_units_minus1;
|
||||
|
||||
uint8_t frame_mbs_only_flag;
|
||||
uint8_t mb_adaptive_frame_field_flag;
|
||||
uint8_t direct_8x8_inference_flag;
|
||||
|
||||
uint8_t frame_cropping_flag;
|
||||
uint16_t frame_crop_left_offset;
|
||||
uint16_t frame_crop_right_offset;
|
||||
uint16_t frame_crop_top_offset;
|
||||
uint16_t frame_crop_bottom_offset;
|
||||
|
||||
uint8_t vui_parameters_present_flag;
|
||||
H264RawVUI vui;
|
||||
} H264RawSPS;
|
||||
|
||||
typedef struct H264RawSPSExtension {
|
||||
H264RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t seq_parameter_set_id;
|
||||
|
||||
uint8_t aux_format_idc;
|
||||
uint8_t bit_depth_aux_minus8;
|
||||
uint8_t alpha_incr_flag;
|
||||
uint16_t alpha_opaque_value;
|
||||
uint16_t alpha_transparent_value;
|
||||
|
||||
uint8_t additional_extension_flag;
|
||||
} H264RawSPSExtension;
|
||||
|
||||
typedef struct H264RawPPS {
|
||||
H264RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t pic_parameter_set_id;
|
||||
uint8_t seq_parameter_set_id;
|
||||
|
||||
uint8_t entropy_coding_mode_flag;
|
||||
uint8_t bottom_field_pic_order_in_frame_present_flag;
|
||||
|
||||
uint8_t num_slice_groups_minus1;
|
||||
uint8_t slice_group_map_type;
|
||||
uint16_t run_length_minus1[H264_MAX_SLICE_GROUPS];
|
||||
uint16_t top_left[H264_MAX_SLICE_GROUPS];
|
||||
uint16_t bottom_right[H264_MAX_SLICE_GROUPS];
|
||||
uint8_t slice_group_change_direction_flag;
|
||||
uint16_t slice_group_change_rate_minus1;
|
||||
uint16_t pic_size_in_map_units_minus1;
|
||||
|
||||
uint8_t *slice_group_id;
|
||||
AVBufferRef *slice_group_id_ref;
|
||||
|
||||
uint8_t num_ref_idx_l0_default_active_minus1;
|
||||
uint8_t num_ref_idx_l1_default_active_minus1;
|
||||
|
||||
uint8_t weighted_pred_flag;
|
||||
uint8_t weighted_bipred_idc;
|
||||
|
||||
int8_t pic_init_qp_minus26;
|
||||
int8_t pic_init_qs_minus26;
|
||||
int8_t chroma_qp_index_offset;
|
||||
|
||||
uint8_t deblocking_filter_control_present_flag;
|
||||
uint8_t constrained_intra_pred_flag;
|
||||
|
||||
uint8_t more_rbsp_data;
|
||||
|
||||
uint8_t redundant_pic_cnt_present_flag;
|
||||
uint8_t transform_8x8_mode_flag;
|
||||
|
||||
uint8_t pic_scaling_matrix_present_flag;
|
||||
uint8_t pic_scaling_list_present_flag[12];
|
||||
H264RawScalingList scaling_list_4x4[6];
|
||||
H264RawScalingList scaling_list_8x8[6];
|
||||
|
||||
int8_t second_chroma_qp_index_offset;
|
||||
} H264RawPPS;
|
||||
|
||||
typedef struct H264RawAUD {
|
||||
H264RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t primary_pic_type;
|
||||
} H264RawAUD;
|
||||
|
||||
typedef struct H264RawSEIBufferingPeriod {
|
||||
uint8_t seq_parameter_set_id;
|
||||
struct {
|
||||
uint32_t initial_cpb_removal_delay[H264_MAX_CPB_CNT];
|
||||
uint32_t initial_cpb_removal_delay_offset[H264_MAX_CPB_CNT];
|
||||
} nal, vcl;
|
||||
} H264RawSEIBufferingPeriod;
|
||||
|
||||
typedef struct H264RawSEIPicTimestamp {
|
||||
uint8_t ct_type;
|
||||
uint8_t nuit_field_based_flag;
|
||||
uint8_t counting_type;
|
||||
uint8_t full_timestamp_flag;
|
||||
uint8_t discontinuity_flag;
|
||||
uint8_t cnt_dropped_flag;
|
||||
uint8_t n_frames;
|
||||
uint8_t seconds_flag;
|
||||
uint8_t seconds_value;
|
||||
uint8_t minutes_flag;
|
||||
uint8_t minutes_value;
|
||||
uint8_t hours_flag;
|
||||
uint8_t hours_value;
|
||||
int32_t time_offset;
|
||||
} H264RawSEIPicTimestamp;
|
||||
|
||||
typedef struct H264RawSEIPicTiming {
|
||||
uint32_t cpb_removal_delay;
|
||||
uint32_t dpb_output_delay;
|
||||
uint8_t pic_struct;
|
||||
uint8_t clock_timestamp_flag[3];
|
||||
H264RawSEIPicTimestamp timestamp[3];
|
||||
} H264RawSEIPicTiming;
|
||||
|
||||
typedef struct H264RawSEIPanScanRect {
|
||||
uint32_t pan_scan_rect_id;
|
||||
uint8_t pan_scan_rect_cancel_flag;
|
||||
uint8_t pan_scan_cnt_minus1;
|
||||
int32_t pan_scan_rect_left_offset[3];
|
||||
int32_t pan_scan_rect_right_offset[3];
|
||||
int32_t pan_scan_rect_top_offset[3];
|
||||
int32_t pan_scan_rect_bottom_offset[3];
|
||||
uint16_t pan_scan_rect_repetition_period;
|
||||
} H264RawSEIPanScanRect;
|
||||
|
||||
typedef struct H264RawSEIRecoveryPoint {
|
||||
uint16_t recovery_frame_cnt;
|
||||
uint8_t exact_match_flag;
|
||||
uint8_t broken_link_flag;
|
||||
uint8_t changing_slice_group_idc;
|
||||
} H264RawSEIRecoveryPoint;
|
||||
|
||||
typedef struct H264RawSEIDisplayOrientation {
|
||||
uint8_t display_orientation_cancel_flag;
|
||||
uint8_t hor_flip;
|
||||
uint8_t ver_flip;
|
||||
uint16_t anticlockwise_rotation;
|
||||
uint16_t display_orientation_repetition_period;
|
||||
uint8_t display_orientation_extension_flag;
|
||||
} H264RawSEIDisplayOrientation;
|
||||
|
||||
typedef struct H264RawSEI {
|
||||
H264RawNALUnitHeader nal_unit_header;
|
||||
SEIRawMessageList message_list;
|
||||
} H264RawSEI;
|
||||
|
||||
typedef struct H264RawSliceHeader {
|
||||
H264RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint32_t first_mb_in_slice;
|
||||
uint8_t slice_type;
|
||||
|
||||
uint8_t pic_parameter_set_id;
|
||||
|
||||
uint8_t colour_plane_id;
|
||||
|
||||
uint16_t frame_num;
|
||||
uint8_t field_pic_flag;
|
||||
uint8_t bottom_field_flag;
|
||||
|
||||
uint16_t idr_pic_id;
|
||||
|
||||
uint16_t pic_order_cnt_lsb;
|
||||
int32_t delta_pic_order_cnt_bottom;
|
||||
int32_t delta_pic_order_cnt[2];
|
||||
|
||||
uint8_t redundant_pic_cnt;
|
||||
uint8_t direct_spatial_mv_pred_flag;
|
||||
|
||||
uint8_t num_ref_idx_active_override_flag;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
|
||||
uint8_t ref_pic_list_modification_flag_l0;
|
||||
uint8_t ref_pic_list_modification_flag_l1;
|
||||
struct {
|
||||
uint8_t modification_of_pic_nums_idc;
|
||||
int32_t abs_diff_pic_num_minus1;
|
||||
uint8_t long_term_pic_num;
|
||||
} rplm_l0[H264_MAX_RPLM_COUNT], rplm_l1[H264_MAX_RPLM_COUNT];
|
||||
|
||||
uint8_t luma_log2_weight_denom;
|
||||
uint8_t chroma_log2_weight_denom;
|
||||
|
||||
uint8_t luma_weight_l0_flag[H264_MAX_REFS];
|
||||
int8_t luma_weight_l0[H264_MAX_REFS];
|
||||
int8_t luma_offset_l0[H264_MAX_REFS];
|
||||
uint8_t chroma_weight_l0_flag[H264_MAX_REFS];
|
||||
int8_t chroma_weight_l0[H264_MAX_REFS][2];
|
||||
int8_t chroma_offset_l0[H264_MAX_REFS][2];
|
||||
|
||||
uint8_t luma_weight_l1_flag[H264_MAX_REFS];
|
||||
int8_t luma_weight_l1[H264_MAX_REFS];
|
||||
int8_t luma_offset_l1[H264_MAX_REFS];
|
||||
uint8_t chroma_weight_l1_flag[H264_MAX_REFS];
|
||||
int8_t chroma_weight_l1[H264_MAX_REFS][2];
|
||||
int8_t chroma_offset_l1[H264_MAX_REFS][2];
|
||||
|
||||
uint8_t no_output_of_prior_pics_flag;
|
||||
uint8_t long_term_reference_flag;
|
||||
|
||||
uint8_t adaptive_ref_pic_marking_mode_flag;
|
||||
struct {
|
||||
uint8_t memory_management_control_operation;
|
||||
int32_t difference_of_pic_nums_minus1;
|
||||
uint8_t long_term_pic_num;
|
||||
uint8_t long_term_frame_idx;
|
||||
uint8_t max_long_term_frame_idx_plus1;
|
||||
} mmco[H264_MAX_MMCO_COUNT];
|
||||
|
||||
uint8_t cabac_init_idc;
|
||||
|
||||
int8_t slice_qp_delta;
|
||||
|
||||
uint8_t sp_for_switch_flag;
|
||||
int8_t slice_qs_delta;
|
||||
|
||||
uint8_t disable_deblocking_filter_idc;
|
||||
int8_t slice_alpha_c0_offset_div2;
|
||||
int8_t slice_beta_offset_div2;
|
||||
|
||||
uint16_t slice_group_change_cycle;
|
||||
} H264RawSliceHeader;
|
||||
|
||||
typedef struct H264RawSlice {
|
||||
H264RawSliceHeader header;
|
||||
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t data_size;
|
||||
int data_bit_start;
|
||||
} H264RawSlice;
|
||||
|
||||
typedef struct H264RawFiller {
|
||||
H264RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint32_t filler_size;
|
||||
} H264RawFiller;
|
||||
|
||||
|
||||
typedef struct CodedBitstreamH264Context {
|
||||
// Reader/writer context in common with the H.265 implementation.
|
||||
CodedBitstreamH2645Context common;
|
||||
|
||||
// All currently available parameter sets. These are updated when
|
||||
// any parameter set NAL unit is read/written with this context.
|
||||
AVBufferRef *sps_ref[H264_MAX_SPS_COUNT];
|
||||
AVBufferRef *pps_ref[H264_MAX_PPS_COUNT];
|
||||
H264RawSPS *sps[H264_MAX_SPS_COUNT];
|
||||
H264RawPPS *pps[H264_MAX_PPS_COUNT];
|
||||
|
||||
// The currently active parameter sets. These are updated when any
|
||||
// NAL unit refers to the relevant parameter set. These pointers
|
||||
// must also be present in the arrays above.
|
||||
const H264RawSPS *active_sps;
|
||||
const H264RawPPS *active_pps;
|
||||
|
||||
// The NAL unit type of the most recent normal slice. This is required
|
||||
// to be able to read/write auxiliary slices, because IdrPicFlag is
|
||||
// otherwise unknown.
|
||||
uint8_t last_slice_nal_unit_type;
|
||||
} CodedBitstreamH264Context;
|
||||
|
||||
#endif /* AVCODEC_CBS_H264_H */
|
||||
36
third-party/cbs/include/cbs/cbs_h2645.h
vendored
Normal file
36
third-party/cbs/include/cbs/cbs_h2645.h
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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_H2645_H
|
||||
#define AVCODEC_CBS_H2645_H
|
||||
|
||||
#include "h2645_parse.h"
|
||||
|
||||
|
||||
typedef struct CodedBitstreamH2645Context {
|
||||
// If set, the stream being read is in MP4 (AVCC/HVCC) format. If not
|
||||
// set, the stream is assumed to be in annex B format.
|
||||
int mp4;
|
||||
// Size in bytes of the NAL length field for MP4 format.
|
||||
int nal_length_size;
|
||||
// Packet reader.
|
||||
H2645Packet read_packet;
|
||||
} CodedBitstreamH2645Context;
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_H2645_H */
|
||||
679
third-party/cbs/include/cbs/cbs_h265.h
vendored
Normal file
679
third-party/cbs/include/cbs/cbs_h265.h
vendored
Normal file
@@ -0,0 +1,679 @@
|
||||
/*
|
||||
* 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_H265_H
|
||||
#define AVCODEC_CBS_H265_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "cbs_h2645.h"
|
||||
#include "cbs_sei.h"
|
||||
#include "hevc.h"
|
||||
|
||||
typedef struct H265RawNALUnitHeader {
|
||||
uint8_t nal_unit_type;
|
||||
uint8_t nuh_layer_id;
|
||||
uint8_t nuh_temporal_id_plus1;
|
||||
} H265RawNALUnitHeader;
|
||||
|
||||
typedef struct H265RawProfileTierLevel {
|
||||
uint8_t general_profile_space;
|
||||
uint8_t general_tier_flag;
|
||||
uint8_t general_profile_idc;
|
||||
|
||||
uint8_t general_profile_compatibility_flag[32];
|
||||
|
||||
uint8_t general_progressive_source_flag;
|
||||
uint8_t general_interlaced_source_flag;
|
||||
uint8_t general_non_packed_constraint_flag;
|
||||
uint8_t general_frame_only_constraint_flag;
|
||||
|
||||
uint8_t general_max_12bit_constraint_flag;
|
||||
uint8_t general_max_10bit_constraint_flag;
|
||||
uint8_t general_max_8bit_constraint_flag;
|
||||
uint8_t general_max_422chroma_constraint_flag;
|
||||
uint8_t general_max_420chroma_constraint_flag;
|
||||
uint8_t general_max_monochrome_constraint_flag;
|
||||
uint8_t general_intra_constraint_flag;
|
||||
uint8_t general_one_picture_only_constraint_flag;
|
||||
uint8_t general_lower_bit_rate_constraint_flag;
|
||||
uint8_t general_max_14bit_constraint_flag;
|
||||
|
||||
uint8_t general_inbld_flag;
|
||||
|
||||
uint8_t general_level_idc;
|
||||
|
||||
uint8_t sub_layer_profile_present_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_level_present_flag[HEVC_MAX_SUB_LAYERS];
|
||||
|
||||
uint8_t sub_layer_profile_space[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_tier_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_profile_idc[HEVC_MAX_SUB_LAYERS];
|
||||
|
||||
uint8_t sub_layer_profile_compatibility_flag[HEVC_MAX_SUB_LAYERS][32];
|
||||
|
||||
uint8_t sub_layer_progressive_source_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_interlaced_source_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_non_packed_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_frame_only_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
|
||||
uint8_t sub_layer_max_12bit_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_max_10bit_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_max_8bit_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_max_422chroma_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_max_420chroma_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_max_monochrome_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_intra_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_one_picture_only_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_lower_bit_rate_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sub_layer_max_14bit_constraint_flag[HEVC_MAX_SUB_LAYERS];
|
||||
|
||||
uint8_t sub_layer_inbld_flag[HEVC_MAX_SUB_LAYERS];
|
||||
|
||||
uint8_t sub_layer_level_idc[HEVC_MAX_SUB_LAYERS];
|
||||
} H265RawProfileTierLevel;
|
||||
|
||||
typedef struct H265RawSubLayerHRDParameters {
|
||||
uint32_t bit_rate_value_minus1[HEVC_MAX_CPB_CNT];
|
||||
uint32_t cpb_size_value_minus1[HEVC_MAX_CPB_CNT];
|
||||
uint32_t cpb_size_du_value_minus1[HEVC_MAX_CPB_CNT];
|
||||
uint32_t bit_rate_du_value_minus1[HEVC_MAX_CPB_CNT];
|
||||
uint8_t cbr_flag[HEVC_MAX_CPB_CNT];
|
||||
} H265RawSubLayerHRDParameters;
|
||||
|
||||
typedef struct H265RawHRDParameters {
|
||||
uint8_t nal_hrd_parameters_present_flag;
|
||||
uint8_t vcl_hrd_parameters_present_flag;
|
||||
|
||||
uint8_t sub_pic_hrd_params_present_flag;
|
||||
uint8_t tick_divisor_minus2;
|
||||
uint8_t du_cpb_removal_delay_increment_length_minus1;
|
||||
uint8_t sub_pic_cpb_params_in_pic_timing_sei_flag;
|
||||
uint8_t dpb_output_delay_du_length_minus1;
|
||||
|
||||
uint8_t bit_rate_scale;
|
||||
uint8_t cpb_size_scale;
|
||||
uint8_t cpb_size_du_scale;
|
||||
|
||||
uint8_t initial_cpb_removal_delay_length_minus1;
|
||||
uint8_t au_cpb_removal_delay_length_minus1;
|
||||
uint8_t dpb_output_delay_length_minus1;
|
||||
|
||||
uint8_t fixed_pic_rate_general_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t fixed_pic_rate_within_cvs_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint16_t elemental_duration_in_tc_minus1[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t low_delay_hrd_flag[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t cpb_cnt_minus1[HEVC_MAX_SUB_LAYERS];
|
||||
H265RawSubLayerHRDParameters nal_sub_layer_hrd_parameters[HEVC_MAX_SUB_LAYERS];
|
||||
H265RawSubLayerHRDParameters vcl_sub_layer_hrd_parameters[HEVC_MAX_SUB_LAYERS];
|
||||
} H265RawHRDParameters;
|
||||
|
||||
typedef struct H265RawVUI {
|
||||
uint8_t aspect_ratio_info_present_flag;
|
||||
uint8_t aspect_ratio_idc;
|
||||
uint16_t sar_width;
|
||||
uint16_t sar_height;
|
||||
|
||||
uint8_t overscan_info_present_flag;
|
||||
uint8_t overscan_appropriate_flag;
|
||||
|
||||
uint8_t video_signal_type_present_flag;
|
||||
uint8_t video_format;
|
||||
uint8_t video_full_range_flag;
|
||||
uint8_t colour_description_present_flag;
|
||||
uint8_t colour_primaries;
|
||||
uint8_t transfer_characteristics;
|
||||
uint8_t matrix_coefficients;
|
||||
|
||||
uint8_t chroma_loc_info_present_flag;
|
||||
uint8_t chroma_sample_loc_type_top_field;
|
||||
uint8_t chroma_sample_loc_type_bottom_field;
|
||||
|
||||
uint8_t neutral_chroma_indication_flag;
|
||||
uint8_t field_seq_flag;
|
||||
uint8_t frame_field_info_present_flag;
|
||||
|
||||
uint8_t default_display_window_flag;
|
||||
uint16_t def_disp_win_left_offset;
|
||||
uint16_t def_disp_win_right_offset;
|
||||
uint16_t def_disp_win_top_offset;
|
||||
uint16_t def_disp_win_bottom_offset;
|
||||
|
||||
uint8_t vui_timing_info_present_flag;
|
||||
uint32_t vui_num_units_in_tick;
|
||||
uint32_t vui_time_scale;
|
||||
uint8_t vui_poc_proportional_to_timing_flag;
|
||||
uint32_t vui_num_ticks_poc_diff_one_minus1;
|
||||
uint8_t vui_hrd_parameters_present_flag;
|
||||
H265RawHRDParameters hrd_parameters;
|
||||
|
||||
uint8_t bitstream_restriction_flag;
|
||||
uint8_t tiles_fixed_structure_flag;
|
||||
uint8_t motion_vectors_over_pic_boundaries_flag;
|
||||
uint8_t restricted_ref_pic_lists_flag;
|
||||
uint16_t min_spatial_segmentation_idc;
|
||||
uint8_t max_bytes_per_pic_denom;
|
||||
uint8_t max_bits_per_min_cu_denom;
|
||||
uint8_t log2_max_mv_length_horizontal;
|
||||
uint8_t log2_max_mv_length_vertical;
|
||||
} H265RawVUI;
|
||||
|
||||
typedef struct H265RawExtensionData {
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t bit_length;
|
||||
} H265RawExtensionData;
|
||||
|
||||
typedef struct H265RawVPS {
|
||||
H265RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t vps_video_parameter_set_id;
|
||||
|
||||
uint8_t vps_base_layer_internal_flag;
|
||||
uint8_t vps_base_layer_available_flag;
|
||||
uint8_t vps_max_layers_minus1;
|
||||
uint8_t vps_max_sub_layers_minus1;
|
||||
uint8_t vps_temporal_id_nesting_flag;
|
||||
|
||||
H265RawProfileTierLevel profile_tier_level;
|
||||
|
||||
uint8_t vps_sub_layer_ordering_info_present_flag;
|
||||
uint8_t vps_max_dec_pic_buffering_minus1[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t vps_max_num_reorder_pics[HEVC_MAX_SUB_LAYERS];
|
||||
uint32_t vps_max_latency_increase_plus1[HEVC_MAX_SUB_LAYERS];
|
||||
|
||||
uint8_t vps_max_layer_id;
|
||||
uint16_t vps_num_layer_sets_minus1;
|
||||
uint8_t layer_id_included_flag[HEVC_MAX_LAYER_SETS][HEVC_MAX_LAYERS];
|
||||
|
||||
uint8_t vps_timing_info_present_flag;
|
||||
uint32_t vps_num_units_in_tick;
|
||||
uint32_t vps_time_scale;
|
||||
uint8_t vps_poc_proportional_to_timing_flag;
|
||||
uint32_t vps_num_ticks_poc_diff_one_minus1;
|
||||
uint16_t vps_num_hrd_parameters;
|
||||
uint16_t hrd_layer_set_idx[HEVC_MAX_LAYER_SETS];
|
||||
uint8_t cprms_present_flag[HEVC_MAX_LAYER_SETS];
|
||||
H265RawHRDParameters hrd_parameters[HEVC_MAX_LAYER_SETS];
|
||||
|
||||
uint8_t vps_extension_flag;
|
||||
H265RawExtensionData extension_data;
|
||||
} H265RawVPS;
|
||||
|
||||
typedef struct H265RawSTRefPicSet {
|
||||
uint8_t inter_ref_pic_set_prediction_flag;
|
||||
|
||||
uint8_t delta_idx_minus1;
|
||||
uint8_t delta_rps_sign;
|
||||
uint16_t abs_delta_rps_minus1;
|
||||
|
||||
uint8_t used_by_curr_pic_flag[HEVC_MAX_REFS];
|
||||
uint8_t use_delta_flag[HEVC_MAX_REFS];
|
||||
|
||||
uint8_t num_negative_pics;
|
||||
uint8_t num_positive_pics;
|
||||
uint16_t delta_poc_s0_minus1[HEVC_MAX_REFS];
|
||||
uint8_t used_by_curr_pic_s0_flag[HEVC_MAX_REFS];
|
||||
uint16_t delta_poc_s1_minus1[HEVC_MAX_REFS];
|
||||
uint8_t used_by_curr_pic_s1_flag[HEVC_MAX_REFS];
|
||||
} H265RawSTRefPicSet;
|
||||
|
||||
typedef struct H265RawScalingList {
|
||||
uint8_t scaling_list_pred_mode_flag[4][6];
|
||||
uint8_t scaling_list_pred_matrix_id_delta[4][6];
|
||||
int16_t scaling_list_dc_coef_minus8[4][6];
|
||||
int8_t scaling_list_delta_coeff[4][6][64];
|
||||
} H265RawScalingList;
|
||||
|
||||
typedef struct H265RawSPS {
|
||||
H265RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t sps_video_parameter_set_id;
|
||||
|
||||
uint8_t sps_max_sub_layers_minus1;
|
||||
uint8_t sps_temporal_id_nesting_flag;
|
||||
|
||||
H265RawProfileTierLevel profile_tier_level;
|
||||
|
||||
uint8_t sps_seq_parameter_set_id;
|
||||
|
||||
uint8_t chroma_format_idc;
|
||||
uint8_t separate_colour_plane_flag;
|
||||
|
||||
uint16_t pic_width_in_luma_samples;
|
||||
uint16_t pic_height_in_luma_samples;
|
||||
|
||||
uint8_t conformance_window_flag;
|
||||
uint16_t conf_win_left_offset;
|
||||
uint16_t conf_win_right_offset;
|
||||
uint16_t conf_win_top_offset;
|
||||
uint16_t conf_win_bottom_offset;
|
||||
|
||||
uint8_t bit_depth_luma_minus8;
|
||||
uint8_t bit_depth_chroma_minus8;
|
||||
|
||||
uint8_t log2_max_pic_order_cnt_lsb_minus4;
|
||||
|
||||
uint8_t sps_sub_layer_ordering_info_present_flag;
|
||||
uint8_t sps_max_dec_pic_buffering_minus1[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t sps_max_num_reorder_pics[HEVC_MAX_SUB_LAYERS];
|
||||
uint32_t sps_max_latency_increase_plus1[HEVC_MAX_SUB_LAYERS];
|
||||
|
||||
uint8_t log2_min_luma_coding_block_size_minus3;
|
||||
uint8_t log2_diff_max_min_luma_coding_block_size;
|
||||
uint8_t log2_min_luma_transform_block_size_minus2;
|
||||
uint8_t log2_diff_max_min_luma_transform_block_size;
|
||||
uint8_t max_transform_hierarchy_depth_inter;
|
||||
uint8_t max_transform_hierarchy_depth_intra;
|
||||
|
||||
uint8_t scaling_list_enabled_flag;
|
||||
uint8_t sps_scaling_list_data_present_flag;
|
||||
H265RawScalingList scaling_list;
|
||||
|
||||
uint8_t amp_enabled_flag;
|
||||
uint8_t sample_adaptive_offset_enabled_flag;
|
||||
|
||||
uint8_t pcm_enabled_flag;
|
||||
uint8_t pcm_sample_bit_depth_luma_minus1;
|
||||
uint8_t pcm_sample_bit_depth_chroma_minus1;
|
||||
uint8_t log2_min_pcm_luma_coding_block_size_minus3;
|
||||
uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
|
||||
uint8_t pcm_loop_filter_disabled_flag;
|
||||
|
||||
uint8_t num_short_term_ref_pic_sets;
|
||||
H265RawSTRefPicSet st_ref_pic_set[HEVC_MAX_SHORT_TERM_REF_PIC_SETS];
|
||||
|
||||
uint8_t long_term_ref_pics_present_flag;
|
||||
uint8_t num_long_term_ref_pics_sps;
|
||||
uint16_t lt_ref_pic_poc_lsb_sps[HEVC_MAX_LONG_TERM_REF_PICS];
|
||||
uint8_t used_by_curr_pic_lt_sps_flag[HEVC_MAX_LONG_TERM_REF_PICS];
|
||||
|
||||
uint8_t sps_temporal_mvp_enabled_flag;
|
||||
uint8_t strong_intra_smoothing_enabled_flag;
|
||||
|
||||
uint8_t vui_parameters_present_flag;
|
||||
H265RawVUI vui;
|
||||
|
||||
uint8_t sps_extension_present_flag;
|
||||
uint8_t sps_range_extension_flag;
|
||||
uint8_t sps_multilayer_extension_flag;
|
||||
uint8_t sps_3d_extension_flag;
|
||||
uint8_t sps_scc_extension_flag;
|
||||
uint8_t sps_extension_4bits;
|
||||
|
||||
H265RawExtensionData extension_data;
|
||||
|
||||
// Range extension.
|
||||
uint8_t transform_skip_rotation_enabled_flag;
|
||||
uint8_t transform_skip_context_enabled_flag;
|
||||
uint8_t implicit_rdpcm_enabled_flag;
|
||||
uint8_t explicit_rdpcm_enabled_flag;
|
||||
uint8_t extended_precision_processing_flag;
|
||||
uint8_t intra_smoothing_disabled_flag;
|
||||
uint8_t high_precision_offsets_enabled_flag;
|
||||
uint8_t persistent_rice_adaptation_enabled_flag;
|
||||
uint8_t cabac_bypass_alignment_enabled_flag;
|
||||
|
||||
// Screen content coding extension.
|
||||
uint8_t sps_curr_pic_ref_enabled_flag;
|
||||
uint8_t palette_mode_enabled_flag;
|
||||
uint8_t palette_max_size;
|
||||
uint8_t delta_palette_max_predictor_size;
|
||||
uint8_t sps_palette_predictor_initializer_present_flag;
|
||||
uint8_t sps_num_palette_predictor_initializer_minus1;
|
||||
uint16_t sps_palette_predictor_initializers[3][128];
|
||||
|
||||
uint8_t motion_vector_resolution_control_idc;
|
||||
uint8_t intra_boundary_filtering_disable_flag;
|
||||
} H265RawSPS;
|
||||
|
||||
typedef struct H265RawPPS {
|
||||
H265RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t pps_pic_parameter_set_id;
|
||||
uint8_t pps_seq_parameter_set_id;
|
||||
|
||||
uint8_t dependent_slice_segments_enabled_flag;
|
||||
uint8_t output_flag_present_flag;
|
||||
uint8_t num_extra_slice_header_bits;
|
||||
uint8_t sign_data_hiding_enabled_flag;
|
||||
uint8_t cabac_init_present_flag;
|
||||
|
||||
uint8_t num_ref_idx_l0_default_active_minus1;
|
||||
uint8_t num_ref_idx_l1_default_active_minus1;
|
||||
|
||||
int8_t init_qp_minus26;
|
||||
|
||||
uint8_t constrained_intra_pred_flag;
|
||||
uint8_t transform_skip_enabled_flag;
|
||||
uint8_t cu_qp_delta_enabled_flag;
|
||||
uint8_t diff_cu_qp_delta_depth;
|
||||
|
||||
int8_t pps_cb_qp_offset;
|
||||
int8_t pps_cr_qp_offset;
|
||||
uint8_t pps_slice_chroma_qp_offsets_present_flag;
|
||||
|
||||
uint8_t weighted_pred_flag;
|
||||
uint8_t weighted_bipred_flag;
|
||||
|
||||
uint8_t transquant_bypass_enabled_flag;
|
||||
uint8_t tiles_enabled_flag;
|
||||
uint8_t entropy_coding_sync_enabled_flag;
|
||||
|
||||
uint8_t num_tile_columns_minus1;
|
||||
uint8_t num_tile_rows_minus1;
|
||||
uint8_t uniform_spacing_flag;
|
||||
uint16_t column_width_minus1[HEVC_MAX_TILE_COLUMNS];
|
||||
uint16_t row_height_minus1[HEVC_MAX_TILE_ROWS];
|
||||
uint8_t loop_filter_across_tiles_enabled_flag;
|
||||
|
||||
uint8_t pps_loop_filter_across_slices_enabled_flag;
|
||||
uint8_t deblocking_filter_control_present_flag;
|
||||
uint8_t deblocking_filter_override_enabled_flag;
|
||||
uint8_t pps_deblocking_filter_disabled_flag;
|
||||
int8_t pps_beta_offset_div2;
|
||||
int8_t pps_tc_offset_div2;
|
||||
|
||||
uint8_t pps_scaling_list_data_present_flag;
|
||||
H265RawScalingList scaling_list;
|
||||
|
||||
uint8_t lists_modification_present_flag;
|
||||
uint8_t log2_parallel_merge_level_minus2;
|
||||
|
||||
uint8_t slice_segment_header_extension_present_flag;
|
||||
|
||||
uint8_t pps_extension_present_flag;
|
||||
uint8_t pps_range_extension_flag;
|
||||
uint8_t pps_multilayer_extension_flag;
|
||||
uint8_t pps_3d_extension_flag;
|
||||
uint8_t pps_scc_extension_flag;
|
||||
uint8_t pps_extension_4bits;
|
||||
|
||||
H265RawExtensionData extension_data;
|
||||
|
||||
// Range extension.
|
||||
uint8_t log2_max_transform_skip_block_size_minus2;
|
||||
uint8_t cross_component_prediction_enabled_flag;
|
||||
uint8_t chroma_qp_offset_list_enabled_flag;
|
||||
uint8_t diff_cu_chroma_qp_offset_depth;
|
||||
uint8_t chroma_qp_offset_list_len_minus1;
|
||||
int8_t cb_qp_offset_list[6];
|
||||
int8_t cr_qp_offset_list[6];
|
||||
uint8_t log2_sao_offset_scale_luma;
|
||||
uint8_t log2_sao_offset_scale_chroma;
|
||||
|
||||
// Screen content coding extension.
|
||||
uint8_t pps_curr_pic_ref_enabled_flag;
|
||||
uint8_t residual_adaptive_colour_transform_enabled_flag;
|
||||
uint8_t pps_slice_act_qp_offsets_present_flag;
|
||||
int8_t pps_act_y_qp_offset_plus5;
|
||||
int8_t pps_act_cb_qp_offset_plus5;
|
||||
int8_t pps_act_cr_qp_offset_plus3;
|
||||
|
||||
uint8_t pps_palette_predictor_initializer_present_flag;
|
||||
uint8_t pps_num_palette_predictor_initializer;
|
||||
uint8_t monochrome_palette_flag;
|
||||
uint8_t luma_bit_depth_entry_minus8;
|
||||
uint8_t chroma_bit_depth_entry_minus8;
|
||||
uint16_t pps_palette_predictor_initializers[3][128];
|
||||
} H265RawPPS;
|
||||
|
||||
typedef struct H265RawAUD {
|
||||
H265RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t pic_type;
|
||||
} H265RawAUD;
|
||||
|
||||
typedef struct H265RawSliceHeader {
|
||||
H265RawNALUnitHeader nal_unit_header;
|
||||
|
||||
uint8_t first_slice_segment_in_pic_flag;
|
||||
uint8_t no_output_of_prior_pics_flag;
|
||||
uint8_t slice_pic_parameter_set_id;
|
||||
|
||||
uint8_t dependent_slice_segment_flag;
|
||||
uint16_t slice_segment_address;
|
||||
|
||||
uint8_t slice_reserved_flag[8];
|
||||
uint8_t slice_type;
|
||||
|
||||
uint8_t pic_output_flag;
|
||||
uint8_t colour_plane_id;
|
||||
|
||||
uint16_t slice_pic_order_cnt_lsb;
|
||||
|
||||
uint8_t short_term_ref_pic_set_sps_flag;
|
||||
H265RawSTRefPicSet short_term_ref_pic_set;
|
||||
uint8_t short_term_ref_pic_set_idx;
|
||||
|
||||
uint8_t num_long_term_sps;
|
||||
uint8_t num_long_term_pics;
|
||||
uint8_t lt_idx_sps[HEVC_MAX_REFS];
|
||||
uint8_t poc_lsb_lt[HEVC_MAX_REFS];
|
||||
uint8_t used_by_curr_pic_lt_flag[HEVC_MAX_REFS];
|
||||
uint8_t delta_poc_msb_present_flag[HEVC_MAX_REFS];
|
||||
uint32_t delta_poc_msb_cycle_lt[HEVC_MAX_REFS];
|
||||
|
||||
uint8_t slice_temporal_mvp_enabled_flag;
|
||||
|
||||
uint8_t slice_sao_luma_flag;
|
||||
uint8_t slice_sao_chroma_flag;
|
||||
|
||||
uint8_t num_ref_idx_active_override_flag;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
|
||||
uint8_t ref_pic_list_modification_flag_l0;
|
||||
uint8_t list_entry_l0[HEVC_MAX_REFS];
|
||||
uint8_t ref_pic_list_modification_flag_l1;
|
||||
uint8_t list_entry_l1[HEVC_MAX_REFS];
|
||||
|
||||
uint8_t mvd_l1_zero_flag;
|
||||
uint8_t cabac_init_flag;
|
||||
uint8_t collocated_from_l0_flag;
|
||||
uint8_t collocated_ref_idx;
|
||||
|
||||
uint8_t luma_log2_weight_denom;
|
||||
int8_t delta_chroma_log2_weight_denom;
|
||||
uint8_t luma_weight_l0_flag[HEVC_MAX_REFS];
|
||||
uint8_t chroma_weight_l0_flag[HEVC_MAX_REFS];
|
||||
int8_t delta_luma_weight_l0[HEVC_MAX_REFS];
|
||||
int16_t luma_offset_l0[HEVC_MAX_REFS];
|
||||
int8_t delta_chroma_weight_l0[HEVC_MAX_REFS][2];
|
||||
int16_t chroma_offset_l0[HEVC_MAX_REFS][2];
|
||||
uint8_t luma_weight_l1_flag[HEVC_MAX_REFS];
|
||||
uint8_t chroma_weight_l1_flag[HEVC_MAX_REFS];
|
||||
int8_t delta_luma_weight_l1[HEVC_MAX_REFS];
|
||||
int16_t luma_offset_l1[HEVC_MAX_REFS];
|
||||
int8_t delta_chroma_weight_l1[HEVC_MAX_REFS][2];
|
||||
int16_t chroma_offset_l1[HEVC_MAX_REFS][2];
|
||||
|
||||
uint8_t five_minus_max_num_merge_cand;
|
||||
uint8_t use_integer_mv_flag;
|
||||
|
||||
int8_t slice_qp_delta;
|
||||
int8_t slice_cb_qp_offset;
|
||||
int8_t slice_cr_qp_offset;
|
||||
int8_t slice_act_y_qp_offset;
|
||||
int8_t slice_act_cb_qp_offset;
|
||||
int8_t slice_act_cr_qp_offset;
|
||||
uint8_t cu_chroma_qp_offset_enabled_flag;
|
||||
|
||||
uint8_t deblocking_filter_override_flag;
|
||||
uint8_t slice_deblocking_filter_disabled_flag;
|
||||
int8_t slice_beta_offset_div2;
|
||||
int8_t slice_tc_offset_div2;
|
||||
uint8_t slice_loop_filter_across_slices_enabled_flag;
|
||||
|
||||
uint16_t num_entry_point_offsets;
|
||||
uint8_t offset_len_minus1;
|
||||
uint32_t entry_point_offset_minus1[HEVC_MAX_ENTRY_POINT_OFFSETS];
|
||||
|
||||
uint16_t slice_segment_header_extension_length;
|
||||
uint8_t slice_segment_header_extension_data_byte[256];
|
||||
} H265RawSliceHeader;
|
||||
|
||||
|
||||
typedef struct H265RawSlice {
|
||||
H265RawSliceHeader header;
|
||||
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t data_size;
|
||||
int data_bit_start;
|
||||
} H265RawSlice;
|
||||
|
||||
|
||||
typedef struct H265RawSEIBufferingPeriod {
|
||||
uint8_t bp_seq_parameter_set_id;
|
||||
uint8_t irap_cpb_params_present_flag;
|
||||
uint32_t cpb_delay_offset;
|
||||
uint32_t dpb_delay_offset;
|
||||
uint8_t concatenation_flag;
|
||||
uint32_t au_cpb_removal_delay_delta_minus1;
|
||||
|
||||
uint32_t nal_initial_cpb_removal_delay[HEVC_MAX_CPB_CNT];
|
||||
uint32_t nal_initial_cpb_removal_offset[HEVC_MAX_CPB_CNT];
|
||||
uint32_t nal_initial_alt_cpb_removal_delay[HEVC_MAX_CPB_CNT];
|
||||
uint32_t nal_initial_alt_cpb_removal_offset[HEVC_MAX_CPB_CNT];
|
||||
|
||||
uint32_t vcl_initial_cpb_removal_delay[HEVC_MAX_CPB_CNT];
|
||||
uint32_t vcl_initial_cpb_removal_offset[HEVC_MAX_CPB_CNT];
|
||||
uint32_t vcl_initial_alt_cpb_removal_delay[HEVC_MAX_CPB_CNT];
|
||||
uint32_t vcl_initial_alt_cpb_removal_offset[HEVC_MAX_CPB_CNT];
|
||||
|
||||
uint8_t use_alt_cpb_params_flag;
|
||||
} H265RawSEIBufferingPeriod;
|
||||
|
||||
typedef struct H265RawSEIPicTiming {
|
||||
uint8_t pic_struct;
|
||||
uint8_t source_scan_type;
|
||||
uint8_t duplicate_flag;
|
||||
|
||||
uint32_t au_cpb_removal_delay_minus1;
|
||||
uint32_t pic_dpb_output_delay;
|
||||
uint32_t pic_dpb_output_du_delay;
|
||||
|
||||
uint16_t num_decoding_units_minus1;
|
||||
uint8_t du_common_cpb_removal_delay_flag;
|
||||
uint32_t du_common_cpb_removal_delay_increment_minus1;
|
||||
uint16_t num_nalus_in_du_minus1[HEVC_MAX_SLICE_SEGMENTS];
|
||||
uint32_t du_cpb_removal_delay_increment_minus1[HEVC_MAX_SLICE_SEGMENTS];
|
||||
} H265RawSEIPicTiming;
|
||||
|
||||
typedef struct H265RawSEIPanScanRect {
|
||||
uint32_t pan_scan_rect_id;
|
||||
uint8_t pan_scan_rect_cancel_flag;
|
||||
uint8_t pan_scan_cnt_minus1;
|
||||
int32_t pan_scan_rect_left_offset[3];
|
||||
int32_t pan_scan_rect_right_offset[3];
|
||||
int32_t pan_scan_rect_top_offset[3];
|
||||
int32_t pan_scan_rect_bottom_offset[3];
|
||||
uint16_t pan_scan_rect_persistence_flag;
|
||||
} H265RawSEIPanScanRect;
|
||||
|
||||
typedef struct H265RawSEIRecoveryPoint {
|
||||
int16_t recovery_poc_cnt;
|
||||
uint8_t exact_match_flag;
|
||||
uint8_t broken_link_flag;
|
||||
} H265RawSEIRecoveryPoint;
|
||||
|
||||
typedef struct H265RawSEIDisplayOrientation {
|
||||
uint8_t display_orientation_cancel_flag;
|
||||
uint8_t hor_flip;
|
||||
uint8_t ver_flip;
|
||||
uint16_t anticlockwise_rotation;
|
||||
uint16_t display_orientation_repetition_period;
|
||||
uint8_t display_orientation_persistence_flag;
|
||||
} H265RawSEIDisplayOrientation;
|
||||
|
||||
typedef struct H265RawSEIActiveParameterSets {
|
||||
uint8_t active_video_parameter_set_id;
|
||||
uint8_t self_contained_cvs_flag;
|
||||
uint8_t no_parameter_set_update_flag;
|
||||
uint8_t num_sps_ids_minus1;
|
||||
uint8_t active_seq_parameter_set_id[HEVC_MAX_SPS_COUNT];
|
||||
uint8_t layer_sps_idx[HEVC_MAX_LAYERS];
|
||||
} H265RawSEIActiveParameterSets;
|
||||
|
||||
typedef struct H265RawSEIDecodedPictureHash {
|
||||
uint8_t hash_type;
|
||||
uint8_t picture_md5[3][16];
|
||||
uint16_t picture_crc[3];
|
||||
uint32_t picture_checksum[3];
|
||||
} H265RawSEIDecodedPictureHash;
|
||||
|
||||
typedef struct H265RawSEITimeCode {
|
||||
uint8_t num_clock_ts;
|
||||
uint8_t clock_timestamp_flag[3];
|
||||
uint8_t units_field_based_flag[3];
|
||||
uint8_t counting_type[3];
|
||||
uint8_t full_timestamp_flag[3];
|
||||
uint8_t discontinuity_flag[3];
|
||||
uint8_t cnt_dropped_flag[3];
|
||||
uint16_t n_frames[3];
|
||||
uint8_t seconds_value[3];
|
||||
uint8_t minutes_value[3];
|
||||
uint8_t hours_value[3];
|
||||
uint8_t seconds_flag[3];
|
||||
uint8_t minutes_flag[3];
|
||||
uint8_t hours_flag[3];
|
||||
uint8_t time_offset_length[3];
|
||||
int32_t time_offset_value[3];
|
||||
} H265RawSEITimeCode;
|
||||
|
||||
typedef struct H265RawSEIAlphaChannelInfo {
|
||||
uint8_t alpha_channel_cancel_flag;
|
||||
uint8_t alpha_channel_use_idc;
|
||||
uint8_t alpha_channel_bit_depth_minus8;
|
||||
uint16_t alpha_transparent_value;
|
||||
uint16_t alpha_opaque_value;
|
||||
uint8_t alpha_channel_incr_flag;
|
||||
uint8_t alpha_channel_clip_flag;
|
||||
uint8_t alpha_channel_clip_type_flag;
|
||||
} H265RawSEIAlphaChannelInfo;
|
||||
|
||||
typedef struct H265RawSEI {
|
||||
H265RawNALUnitHeader nal_unit_header;
|
||||
SEIRawMessageList message_list;
|
||||
} H265RawSEI;
|
||||
|
||||
typedef struct CodedBitstreamH265Context {
|
||||
// Reader/writer context in common with the H.264 implementation.
|
||||
CodedBitstreamH2645Context common;
|
||||
|
||||
// All currently available parameter sets. These are updated when
|
||||
// any parameter set NAL unit is read/written with this context.
|
||||
AVBufferRef *vps_ref[HEVC_MAX_VPS_COUNT];
|
||||
AVBufferRef *sps_ref[HEVC_MAX_SPS_COUNT];
|
||||
AVBufferRef *pps_ref[HEVC_MAX_PPS_COUNT];
|
||||
H265RawVPS *vps[HEVC_MAX_VPS_COUNT];
|
||||
H265RawSPS *sps[HEVC_MAX_SPS_COUNT];
|
||||
H265RawPPS *pps[HEVC_MAX_PPS_COUNT];
|
||||
|
||||
// The currently active parameter sets. These are updated when any
|
||||
// NAL unit refers to the relevant parameter set. These pointers
|
||||
// must also be present in the arrays above.
|
||||
const H265RawVPS *active_vps;
|
||||
const H265RawSPS *active_sps;
|
||||
const H265RawPPS *active_pps;
|
||||
} CodedBitstreamH265Context;
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_H265_H */
|
||||
123
third-party/cbs/include/cbs/cbs_jpeg.h
vendored
Normal file
123
third-party/cbs/include/cbs/cbs_jpeg.h
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* 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_JPEG_H
|
||||
#define AVCODEC_CBS_JPEG_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libavutil/buffer.h>
|
||||
|
||||
|
||||
enum {
|
||||
JPEG_MARKER_SOF0 = 0xc0,
|
||||
JPEG_MARKER_SOF1 = 0xc1,
|
||||
JPEG_MARKER_SOF2 = 0xc2,
|
||||
JPEG_MARKER_SOF3 = 0xc3,
|
||||
|
||||
JPEG_MARKER_DHT = 0xc4,
|
||||
JPEG_MARKER_SOI = 0xd8,
|
||||
JPEG_MARKER_EOI = 0xd9,
|
||||
JPEG_MARKER_SOS = 0xda,
|
||||
JPEG_MARKER_DQT = 0xdb,
|
||||
|
||||
JPEG_MARKER_APPN = 0xe0,
|
||||
JPEG_MARKER_JPGN = 0xf0,
|
||||
JPEG_MARKER_COM = 0xfe,
|
||||
};
|
||||
|
||||
enum {
|
||||
JPEG_MAX_COMPONENTS = 255,
|
||||
|
||||
JPEG_MAX_HEIGHT = 65535,
|
||||
JPEG_MAX_WIDTH = 65535,
|
||||
};
|
||||
|
||||
|
||||
typedef struct JPEGRawFrameHeader {
|
||||
uint16_t Lf;
|
||||
uint8_t P;
|
||||
uint16_t Y;
|
||||
uint16_t X;
|
||||
uint16_t Nf;
|
||||
|
||||
uint8_t C[JPEG_MAX_COMPONENTS];
|
||||
uint8_t H[JPEG_MAX_COMPONENTS];
|
||||
uint8_t V[JPEG_MAX_COMPONENTS];
|
||||
uint8_t Tq[JPEG_MAX_COMPONENTS];
|
||||
} JPEGRawFrameHeader;
|
||||
|
||||
typedef struct JPEGRawScanHeader {
|
||||
uint16_t Ls;
|
||||
uint8_t Ns;
|
||||
|
||||
uint8_t Cs[JPEG_MAX_COMPONENTS];
|
||||
uint8_t Td[JPEG_MAX_COMPONENTS];
|
||||
uint8_t Ta[JPEG_MAX_COMPONENTS];
|
||||
|
||||
uint8_t Ss;
|
||||
uint8_t Se;
|
||||
uint8_t Ah;
|
||||
uint8_t Al;
|
||||
} JPEGRawScanHeader;
|
||||
|
||||
typedef struct JPEGRawScan {
|
||||
JPEGRawScanHeader header;
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t data_size;
|
||||
} JPEGRawScan;
|
||||
|
||||
typedef struct JPEGRawQuantisationTable {
|
||||
uint8_t Pq;
|
||||
uint8_t Tq;
|
||||
uint16_t Q[64];
|
||||
} JPEGRawQuantisationTable;
|
||||
|
||||
typedef struct JPEGRawQuantisationTableSpecification {
|
||||
uint16_t Lq;
|
||||
JPEGRawQuantisationTable table[4];
|
||||
} JPEGRawQuantisationTableSpecification;
|
||||
|
||||
typedef struct JPEGRawHuffmanTable {
|
||||
uint8_t Tc;
|
||||
uint8_t Th;
|
||||
uint8_t L[16];
|
||||
uint8_t V[224];
|
||||
} JPEGRawHuffmanTable;
|
||||
|
||||
typedef struct JPEGRawHuffmanTableSpecification {
|
||||
uint16_t Lh;
|
||||
JPEGRawHuffmanTable table[8];
|
||||
} JPEGRawHuffmanTableSpecification;
|
||||
|
||||
typedef struct JPEGRawApplicationData {
|
||||
uint16_t Lp;
|
||||
uint8_t *Ap;
|
||||
AVBufferRef *Ap_ref;
|
||||
} JPEGRawApplicationData;
|
||||
|
||||
typedef struct JPEGRawComment {
|
||||
uint16_t Lc;
|
||||
uint8_t *Cm;
|
||||
AVBufferRef *Cm_ref;
|
||||
} JPEGRawComment;
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_JPEG_H */
|
||||
231
third-party/cbs/include/cbs/cbs_mpeg2.h
vendored
Normal file
231
third-party/cbs/include/cbs/cbs_mpeg2.h
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
* 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_MPEG2_H
|
||||
#define AVCODEC_CBS_MPEG2_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libavutil/buffer.h>
|
||||
|
||||
|
||||
enum {
|
||||
MPEG2_START_PICTURE = 0x00,
|
||||
MPEG2_START_SLICE_MIN = 0x01,
|
||||
MPEG2_START_SLICE_MAX = 0xaf,
|
||||
MPEG2_START_USER_DATA = 0xb2,
|
||||
MPEG2_START_SEQUENCE_HEADER = 0xb3,
|
||||
MPEG2_START_SEQUENCE_ERROR = 0xb4,
|
||||
MPEG2_START_EXTENSION = 0xb5,
|
||||
MPEG2_START_SEQUENCE_END = 0xb7,
|
||||
MPEG2_START_GROUP = 0xb8,
|
||||
};
|
||||
|
||||
#define MPEG2_START_IS_SLICE(type) \
|
||||
((type) >= MPEG2_START_SLICE_MIN && \
|
||||
(type) <= MPEG2_START_SLICE_MAX)
|
||||
|
||||
enum {
|
||||
MPEG2_EXTENSION_SEQUENCE = 0x1,
|
||||
MPEG2_EXTENSION_SEQUENCE_DISPLAY = 0x2,
|
||||
MPEG2_EXTENSION_QUANT_MATRIX = 0x3,
|
||||
MPEG2_EXTENSION_COPYRIGHT = 0x4,
|
||||
MPEG2_EXTENSION_SEQUENCE_SCALABLE = 0x5,
|
||||
MPEG2_EXTENSION_PICTURE_DISPLAY = 0x7,
|
||||
MPEG2_EXTENSION_PICTURE_CODING = 0x8,
|
||||
MPEG2_EXTENSION_PICTURE_SPATIAL_SCALABLE = 0x9,
|
||||
MPEG2_EXTENSION_PICTURE_TEMPORAL_SCALABLE = 0xa,
|
||||
MPEG2_EXTENSION_CAMERA_PARAMETERS = 0xb,
|
||||
MPEG2_EXTENSION_ITU_T = 0xc,
|
||||
};
|
||||
|
||||
|
||||
typedef struct MPEG2RawSequenceHeader {
|
||||
uint8_t sequence_header_code;
|
||||
|
||||
uint16_t horizontal_size_value;
|
||||
uint16_t vertical_size_value;
|
||||
uint8_t aspect_ratio_information;
|
||||
uint8_t frame_rate_code;
|
||||
uint32_t bit_rate_value;
|
||||
uint16_t vbv_buffer_size_value;
|
||||
uint8_t constrained_parameters_flag;
|
||||
|
||||
uint8_t load_intra_quantiser_matrix;
|
||||
uint8_t intra_quantiser_matrix[64];
|
||||
uint8_t load_non_intra_quantiser_matrix;
|
||||
uint8_t non_intra_quantiser_matrix[64];
|
||||
} MPEG2RawSequenceHeader;
|
||||
|
||||
typedef struct MPEG2RawUserData {
|
||||
uint8_t user_data_start_code;
|
||||
|
||||
uint8_t *user_data;
|
||||
AVBufferRef *user_data_ref;
|
||||
size_t user_data_length;
|
||||
} MPEG2RawUserData;
|
||||
|
||||
typedef struct MPEG2RawSequenceExtension {
|
||||
uint8_t profile_and_level_indication;
|
||||
uint8_t progressive_sequence;
|
||||
uint8_t chroma_format;
|
||||
uint8_t horizontal_size_extension;
|
||||
uint8_t vertical_size_extension;
|
||||
uint16_t bit_rate_extension;
|
||||
uint8_t vbv_buffer_size_extension;
|
||||
uint8_t low_delay;
|
||||
uint8_t frame_rate_extension_n;
|
||||
uint8_t frame_rate_extension_d;
|
||||
} MPEG2RawSequenceExtension;
|
||||
|
||||
typedef struct MPEG2RawSequenceDisplayExtension {
|
||||
uint8_t video_format;
|
||||
|
||||
uint8_t colour_description;
|
||||
uint8_t colour_primaries;
|
||||
uint8_t transfer_characteristics;
|
||||
uint8_t matrix_coefficients;
|
||||
|
||||
uint16_t display_horizontal_size;
|
||||
uint16_t display_vertical_size;
|
||||
} MPEG2RawSequenceDisplayExtension;
|
||||
|
||||
typedef struct MPEG2RawGroupOfPicturesHeader {
|
||||
uint8_t group_start_code;
|
||||
|
||||
uint32_t time_code;
|
||||
uint8_t closed_gop;
|
||||
uint8_t broken_link;
|
||||
} MPEG2RawGroupOfPicturesHeader;
|
||||
|
||||
typedef struct MPEG2RawExtraInformation {
|
||||
uint8_t *extra_information;
|
||||
AVBufferRef *extra_information_ref;
|
||||
size_t extra_information_length;
|
||||
} MPEG2RawExtraInformation;
|
||||
|
||||
typedef struct MPEG2RawPictureHeader {
|
||||
uint8_t picture_start_code;
|
||||
|
||||
uint16_t temporal_reference;
|
||||
uint8_t picture_coding_type;
|
||||
uint16_t vbv_delay;
|
||||
|
||||
uint8_t full_pel_forward_vector;
|
||||
uint8_t forward_f_code;
|
||||
uint8_t full_pel_backward_vector;
|
||||
uint8_t backward_f_code;
|
||||
|
||||
MPEG2RawExtraInformation extra_information_picture;
|
||||
} MPEG2RawPictureHeader;
|
||||
|
||||
typedef struct MPEG2RawPictureCodingExtension {
|
||||
uint8_t f_code[2][2];
|
||||
|
||||
uint8_t intra_dc_precision;
|
||||
uint8_t picture_structure;
|
||||
uint8_t top_field_first;
|
||||
uint8_t frame_pred_frame_dct;
|
||||
uint8_t concealment_motion_vectors;
|
||||
uint8_t q_scale_type;
|
||||
uint8_t intra_vlc_format;
|
||||
uint8_t alternate_scan;
|
||||
uint8_t repeat_first_field;
|
||||
uint8_t chroma_420_type;
|
||||
uint8_t progressive_frame;
|
||||
|
||||
uint8_t composite_display_flag;
|
||||
uint8_t v_axis;
|
||||
uint8_t field_sequence;
|
||||
uint8_t sub_carrier;
|
||||
uint8_t burst_amplitude;
|
||||
uint8_t sub_carrier_phase;
|
||||
} MPEG2RawPictureCodingExtension;
|
||||
|
||||
typedef struct MPEG2RawQuantMatrixExtension {
|
||||
uint8_t load_intra_quantiser_matrix;
|
||||
uint8_t intra_quantiser_matrix[64];
|
||||
uint8_t load_non_intra_quantiser_matrix;
|
||||
uint8_t non_intra_quantiser_matrix[64];
|
||||
uint8_t load_chroma_intra_quantiser_matrix;
|
||||
uint8_t chroma_intra_quantiser_matrix[64];
|
||||
uint8_t load_chroma_non_intra_quantiser_matrix;
|
||||
uint8_t chroma_non_intra_quantiser_matrix[64];
|
||||
} MPEG2RawQuantMatrixExtension;
|
||||
|
||||
typedef struct MPEG2RawPictureDisplayExtension {
|
||||
int16_t frame_centre_horizontal_offset[3];
|
||||
int16_t frame_centre_vertical_offset[3];
|
||||
} MPEG2RawPictureDisplayExtension;
|
||||
|
||||
typedef struct MPEG2RawExtensionData {
|
||||
uint8_t extension_start_code;
|
||||
uint8_t extension_start_code_identifier;
|
||||
|
||||
union {
|
||||
MPEG2RawSequenceExtension sequence;
|
||||
MPEG2RawSequenceDisplayExtension sequence_display;
|
||||
MPEG2RawQuantMatrixExtension quant_matrix;
|
||||
MPEG2RawPictureCodingExtension picture_coding;
|
||||
MPEG2RawPictureDisplayExtension picture_display;
|
||||
} data;
|
||||
} MPEG2RawExtensionData;
|
||||
|
||||
typedef struct MPEG2RawSliceHeader {
|
||||
uint8_t slice_vertical_position;
|
||||
|
||||
uint8_t slice_vertical_position_extension;
|
||||
uint8_t priority_breakpoint;
|
||||
|
||||
uint8_t quantiser_scale_code;
|
||||
|
||||
uint8_t slice_extension_flag;
|
||||
uint8_t intra_slice;
|
||||
uint8_t slice_picture_id_enable;
|
||||
uint8_t slice_picture_id;
|
||||
|
||||
MPEG2RawExtraInformation extra_information_slice;
|
||||
} MPEG2RawSliceHeader;
|
||||
|
||||
typedef struct MPEG2RawSlice {
|
||||
MPEG2RawSliceHeader header;
|
||||
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t data_size;
|
||||
int data_bit_start;
|
||||
} MPEG2RawSlice;
|
||||
|
||||
typedef struct MPEG2RawSequenceEnd {
|
||||
uint8_t sequence_end_code;
|
||||
} MPEG2RawSequenceEnd;
|
||||
|
||||
|
||||
typedef struct CodedBitstreamMPEG2Context {
|
||||
// Elements stored in headers which are required for other decoding.
|
||||
uint16_t horizontal_size;
|
||||
uint16_t vertical_size;
|
||||
uint8_t scalable;
|
||||
uint8_t scalable_mode;
|
||||
uint8_t progressive_sequence;
|
||||
uint8_t number_of_frame_centre_offsets;
|
||||
} CodedBitstreamMPEG2Context;
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_MPEG2_H */
|
||||
200
third-party/cbs/include/cbs/cbs_sei.h
vendored
Normal file
200
third-party/cbs/include/cbs/cbs_sei.h
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* 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_SEI_H
|
||||
#define AVCODEC_CBS_SEI_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libavutil/buffer.h>
|
||||
|
||||
#include "cbs.h"
|
||||
#include "sei.h"
|
||||
|
||||
|
||||
typedef struct SEIRawFillerPayload {
|
||||
uint32_t payload_size;
|
||||
} SEIRawFillerPayload;
|
||||
|
||||
typedef struct SEIRawUserDataRegistered {
|
||||
uint8_t itu_t_t35_country_code;
|
||||
uint8_t itu_t_t35_country_code_extension_byte;
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t data_length;
|
||||
} SEIRawUserDataRegistered;
|
||||
|
||||
typedef struct SEIRawUserDataUnregistered {
|
||||
uint8_t uuid_iso_iec_11578[16];
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t data_length;
|
||||
} SEIRawUserDataUnregistered;
|
||||
|
||||
typedef struct SEIRawMasteringDisplayColourVolume {
|
||||
uint16_t display_primaries_x[3];
|
||||
uint16_t display_primaries_y[3];
|
||||
uint16_t white_point_x;
|
||||
uint16_t white_point_y;
|
||||
uint32_t max_display_mastering_luminance;
|
||||
uint32_t min_display_mastering_luminance;
|
||||
} SEIRawMasteringDisplayColourVolume;
|
||||
|
||||
typedef struct SEIRawContentLightLevelInfo {
|
||||
uint16_t max_content_light_level;
|
||||
uint16_t max_pic_average_light_level;
|
||||
} SEIRawContentLightLevelInfo;
|
||||
|
||||
typedef struct SEIRawAlternativeTransferCharacteristics {
|
||||
uint8_t preferred_transfer_characteristics;
|
||||
} SEIRawAlternativeTransferCharacteristics;
|
||||
|
||||
typedef struct SEIRawMessage {
|
||||
uint32_t payload_type;
|
||||
uint32_t payload_size;
|
||||
void *payload;
|
||||
AVBufferRef *payload_ref;
|
||||
uint8_t *extension_data;
|
||||
AVBufferRef *extension_data_ref;
|
||||
size_t extension_bit_length;
|
||||
} SEIRawMessage;
|
||||
|
||||
typedef struct SEIRawMessageList {
|
||||
SEIRawMessage *messages;
|
||||
int nb_messages;
|
||||
int nb_messages_allocated;
|
||||
} SEIRawMessageList;
|
||||
|
||||
|
||||
typedef struct SEIMessageState {
|
||||
// The type of the payload being written.
|
||||
uint32_t payload_type;
|
||||
// When reading, contains the size of the payload to allow finding the
|
||||
// end of variable-length fields (such as user_data_payload_byte[]).
|
||||
// (When writing, the size will be derived from the total number of
|
||||
// bytes actually written.)
|
||||
uint32_t payload_size;
|
||||
// When writing, indicates that payload extension data is present so
|
||||
// all extended fields must be written. May be updated by the writer
|
||||
// to indicate that extended fields have been written, so the extension
|
||||
// end bits must be written too.
|
||||
uint8_t extension_present;
|
||||
} SEIMessageState;
|
||||
|
||||
struct GetBitContext;
|
||||
struct PutBitContext;
|
||||
|
||||
typedef int (*SEIMessageReadFunction)(CodedBitstreamContext *ctx,
|
||||
struct GetBitContext *rw,
|
||||
void *current,
|
||||
SEIMessageState *sei);
|
||||
|
||||
typedef int (*SEIMessageWriteFunction)(CodedBitstreamContext *ctx,
|
||||
struct PutBitContext *rw,
|
||||
void *current,
|
||||
SEIMessageState *sei);
|
||||
|
||||
typedef struct SEIMessageTypeDescriptor {
|
||||
// Payload type for the message. (-1 in this field ends a list.)
|
||||
int type;
|
||||
// Valid in a prefix SEI NAL unit (always for H.264).
|
||||
uint8_t prefix;
|
||||
// Valid in a suffix SEI NAL unit (never for H.264).
|
||||
uint8_t suffix;
|
||||
// Size of the decomposed structure.
|
||||
size_t size;
|
||||
// Read bitstream into SEI message.
|
||||
SEIMessageReadFunction read;
|
||||
// Write bitstream from SEI message.
|
||||
SEIMessageWriteFunction write;
|
||||
} SEIMessageTypeDescriptor;
|
||||
|
||||
// Macro for the read/write pair. The clumsy cast is needed because the
|
||||
// current pointer is typed in all of the read/write functions but has to
|
||||
// be void here to fit all cases.
|
||||
#define SEI_MESSAGE_RW(codec, name) \
|
||||
.read = (SEIMessageReadFunction)cbs_##codec##_read_##name, \
|
||||
.write = (SEIMessageWriteFunction)cbs_##codec##_write_##name
|
||||
|
||||
// End-of-list sentinel element.
|
||||
#define SEI_MESSAGE_TYPE_END \
|
||||
{ .type = -1 }
|
||||
|
||||
|
||||
/**
|
||||
* Find the type descriptor for the given payload type.
|
||||
*
|
||||
* Returns NULL if the payload type is not known.
|
||||
*/
|
||||
const SEIMessageTypeDescriptor *ff_cbs_sei_find_type(CodedBitstreamContext *ctx,
|
||||
int payload_type);
|
||||
|
||||
/**
|
||||
* Allocate a new payload for the given SEI message.
|
||||
*/
|
||||
int ff_cbs_sei_alloc_message_payload(SEIRawMessage *message,
|
||||
const SEIMessageTypeDescriptor *desc);
|
||||
|
||||
/**
|
||||
* Allocate a new empty SEI message in a message list.
|
||||
*
|
||||
* The new message is in place nb_messages - 1.
|
||||
*/
|
||||
int ff_cbs_sei_list_add(SEIRawMessageList *list);
|
||||
|
||||
/**
|
||||
* Free all SEI messages in a message list.
|
||||
*/
|
||||
void ff_cbs_sei_free_message_list(SEIRawMessageList *list);
|
||||
|
||||
/**
|
||||
* Add an SEI message to an access unit.
|
||||
*
|
||||
* Will add to an existing SEI NAL unit, or create a new one for the
|
||||
* message if there is no suitable existing one.
|
||||
*
|
||||
* Takes a new reference to payload_buf, if set. If payload_buf is
|
||||
* NULL then the new message will not be reference counted.
|
||||
*/
|
||||
int ff_cbs_sei_add_message(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *au,
|
||||
int prefix,
|
||||
uint32_t payload_type,
|
||||
void *payload_data,
|
||||
AVBufferRef *payload_buf);
|
||||
|
||||
/**
|
||||
* Iterate over messages with the given payload type in an access unit.
|
||||
*
|
||||
* Set message to NULL in the first call. Returns 0 while more messages
|
||||
* are available, AVERROR(ENOENT) when all messages have been found.
|
||||
*/
|
||||
int ff_cbs_sei_find_message(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *au,
|
||||
uint32_t payload_type,
|
||||
SEIRawMessage **message);
|
||||
|
||||
/**
|
||||
* Delete all messages with the given payload type from an access unit.
|
||||
*/
|
||||
void ff_cbs_sei_delete_message_type(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *au,
|
||||
uint32_t payload_type);
|
||||
|
||||
#endif /* AVCODEC_CBS_SEI_H */
|
||||
213
third-party/cbs/include/cbs/cbs_vp9.h
vendored
Normal file
213
third-party/cbs/include/cbs/cbs_vp9.h
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* 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_VP9_H
|
||||
#define AVCODEC_CBS_VP9_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "cbs.h"
|
||||
|
||||
|
||||
// Miscellaneous constants (section 3).
|
||||
enum {
|
||||
VP9_REFS_PER_FRAME = 3,
|
||||
|
||||
VP9_MIN_TILE_WIDTH_B64 = 4,
|
||||
VP9_MAX_TILE_WIDTH_B64 = 64,
|
||||
|
||||
VP9_NUM_REF_FRAMES = 8,
|
||||
VP9_MAX_REF_FRAMES = 4,
|
||||
|
||||
VP9_MAX_SEGMENTS = 8,
|
||||
VP9_SEG_LVL_MAX = 4,
|
||||
};
|
||||
|
||||
// Frame types (section 7.2).
|
||||
enum {
|
||||
VP9_KEY_FRAME = 0,
|
||||
VP9_NON_KEY_FRAME = 1,
|
||||
};
|
||||
|
||||
// Frame sync bytes (section 7.2.1).
|
||||
enum {
|
||||
VP9_FRAME_SYNC_0 = 0x49,
|
||||
VP9_FRAME_SYNC_1 = 0x83,
|
||||
VP9_FRAME_SYNC_2 = 0x42,
|
||||
};
|
||||
|
||||
// Color space values (section 7.2.2).
|
||||
enum {
|
||||
VP9_CS_UNKNOWN = 0,
|
||||
VP9_CS_BT_601 = 1,
|
||||
VP9_CS_BT_709 = 2,
|
||||
VP9_CS_SMPTE_170 = 3,
|
||||
VP9_CS_SMPTE_240 = 4,
|
||||
VP9_CS_BT_2020 = 5,
|
||||
VP9_CS_RESERVED = 6,
|
||||
VP9_CS_RGB = 7,
|
||||
};
|
||||
|
||||
// Reference frame types (section 7.4.12).
|
||||
enum {
|
||||
VP9_INTRA_FRAME = 0,
|
||||
VP9_LAST_FRAME = 1,
|
||||
VP9_GOLDEN_FRAME = 2,
|
||||
VP9_ALTREF_FRAME = 3,
|
||||
};
|
||||
|
||||
// Superframe properties (section B.3).
|
||||
enum {
|
||||
VP9_MAX_FRAMES_IN_SUPERFRAME = 8,
|
||||
|
||||
VP9_SUPERFRAME_MARKER = 6,
|
||||
};
|
||||
|
||||
|
||||
typedef struct VP9RawFrameHeader {
|
||||
uint8_t frame_marker;
|
||||
uint8_t profile_low_bit;
|
||||
uint8_t profile_high_bit;
|
||||
|
||||
uint8_t show_existing_frame;
|
||||
uint8_t frame_to_show_map_idx;
|
||||
|
||||
uint8_t frame_type;
|
||||
uint8_t show_frame;
|
||||
uint8_t error_resilient_mode;
|
||||
|
||||
// Color config.
|
||||
uint8_t ten_or_twelve_bit;
|
||||
uint8_t color_space;
|
||||
uint8_t color_range;
|
||||
uint8_t subsampling_x;
|
||||
uint8_t subsampling_y;
|
||||
|
||||
uint8_t refresh_frame_flags;
|
||||
|
||||
uint8_t intra_only;
|
||||
uint8_t reset_frame_context;
|
||||
|
||||
uint8_t ref_frame_idx[VP9_REFS_PER_FRAME];
|
||||
uint8_t ref_frame_sign_bias[VP9_MAX_REF_FRAMES];
|
||||
|
||||
uint8_t allow_high_precision_mv;
|
||||
|
||||
uint8_t refresh_frame_context;
|
||||
uint8_t frame_parallel_decoding_mode;
|
||||
|
||||
uint8_t frame_context_idx;
|
||||
|
||||
// Frame/render size.
|
||||
uint8_t found_ref[VP9_REFS_PER_FRAME];
|
||||
uint16_t frame_width_minus_1;
|
||||
uint16_t frame_height_minus_1;
|
||||
uint8_t render_and_frame_size_different;
|
||||
uint16_t render_width_minus_1;
|
||||
uint16_t render_height_minus_1;
|
||||
|
||||
// Interpolation filter.
|
||||
uint8_t is_filter_switchable;
|
||||
uint8_t raw_interpolation_filter_type;
|
||||
|
||||
// Loop filter params.
|
||||
uint8_t loop_filter_level;
|
||||
uint8_t loop_filter_sharpness;
|
||||
uint8_t loop_filter_delta_enabled;
|
||||
uint8_t loop_filter_delta_update;
|
||||
uint8_t update_ref_delta[VP9_MAX_REF_FRAMES];
|
||||
int8_t loop_filter_ref_deltas[VP9_MAX_REF_FRAMES];
|
||||
uint8_t update_mode_delta[2];
|
||||
int8_t loop_filter_mode_deltas[2];
|
||||
|
||||
// Quantization params.
|
||||
uint8_t base_q_idx;
|
||||
int8_t delta_q_y_dc;
|
||||
int8_t delta_q_uv_dc;
|
||||
int8_t delta_q_uv_ac;
|
||||
|
||||
// Segmentation params.
|
||||
uint8_t segmentation_enabled;
|
||||
uint8_t segmentation_update_map;
|
||||
uint8_t segmentation_tree_probs[7];
|
||||
uint8_t segmentation_temporal_update;
|
||||
uint8_t segmentation_pred_prob[3];
|
||||
uint8_t segmentation_update_data;
|
||||
uint8_t segmentation_abs_or_delta_update;
|
||||
uint8_t feature_enabled[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX];
|
||||
uint8_t feature_value[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX];
|
||||
uint8_t feature_sign[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX];
|
||||
|
||||
// Tile info.
|
||||
uint8_t tile_cols_log2;
|
||||
uint8_t tile_rows_log2;
|
||||
|
||||
uint16_t header_size_in_bytes;
|
||||
} VP9RawFrameHeader;
|
||||
|
||||
typedef struct VP9RawFrame {
|
||||
VP9RawFrameHeader header;
|
||||
|
||||
uint8_t *data;
|
||||
AVBufferRef *data_ref;
|
||||
size_t data_size;
|
||||
} VP9RawFrame;
|
||||
|
||||
typedef struct VP9RawSuperframeIndex {
|
||||
uint8_t superframe_marker;
|
||||
uint8_t bytes_per_framesize_minus_1;
|
||||
uint8_t frames_in_superframe_minus_1;
|
||||
uint32_t frame_sizes[VP9_MAX_FRAMES_IN_SUPERFRAME];
|
||||
} VP9RawSuperframeIndex;
|
||||
|
||||
typedef struct VP9RawSuperframe {
|
||||
VP9RawFrame frames[VP9_MAX_FRAMES_IN_SUPERFRAME];
|
||||
VP9RawSuperframeIndex index;
|
||||
} VP9RawSuperframe;
|
||||
|
||||
typedef struct VP9ReferenceFrameState {
|
||||
int frame_width; // RefFrameWidth
|
||||
int frame_height; // RefFrameHeight
|
||||
int subsampling_x; // RefSubsamplingX
|
||||
int subsampling_y; // RefSubsamplingY
|
||||
int bit_depth; // RefBitDepth
|
||||
} VP9ReferenceFrameState;
|
||||
|
||||
typedef struct CodedBitstreamVP9Context {
|
||||
int profile;
|
||||
|
||||
// Frame dimensions in 8x8 mode info blocks.
|
||||
uint16_t mi_cols;
|
||||
uint16_t mi_rows;
|
||||
// Frame dimensions in 64x64 superblocks.
|
||||
uint16_t sb64_cols;
|
||||
uint16_t sb64_rows;
|
||||
|
||||
int frame_width;
|
||||
int frame_height;
|
||||
|
||||
uint8_t subsampling_x;
|
||||
uint8_t subsampling_y;
|
||||
int bit_depth;
|
||||
|
||||
VP9ReferenceFrameState ref[VP9_NUM_REF_FRAMES];
|
||||
} CodedBitstreamVP9Context;
|
||||
|
||||
|
||||
#endif /* AVCODEC_CBS_VP9_H */
|
||||
113
third-party/cbs/include/cbs/h264.h
vendored
Normal file
113
third-party/cbs/include/cbs/h264.h
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* 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
|
||||
* H.264 common definitions
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_H264_H
|
||||
#define AVCODEC_H264_H
|
||||
|
||||
#define QP_MAX_NUM (51 + 6 * 6) // The maximum supported qp
|
||||
|
||||
/*
|
||||
* Table 7-1 – NAL unit type codes, syntax element categories, and NAL unit type classes in
|
||||
* T-REC-H.264-201704
|
||||
*/
|
||||
enum {
|
||||
H264_NAL_UNSPECIFIED = 0,
|
||||
H264_NAL_SLICE = 1,
|
||||
H264_NAL_DPA = 2,
|
||||
H264_NAL_DPB = 3,
|
||||
H264_NAL_DPC = 4,
|
||||
H264_NAL_IDR_SLICE = 5,
|
||||
H264_NAL_SEI = 6,
|
||||
H264_NAL_SPS = 7,
|
||||
H264_NAL_PPS = 8,
|
||||
H264_NAL_AUD = 9,
|
||||
H264_NAL_END_SEQUENCE = 10,
|
||||
H264_NAL_END_STREAM = 11,
|
||||
H264_NAL_FILLER_DATA = 12,
|
||||
H264_NAL_SPS_EXT = 13,
|
||||
H264_NAL_PREFIX = 14,
|
||||
H264_NAL_SUB_SPS = 15,
|
||||
H264_NAL_DPS = 16,
|
||||
H264_NAL_RESERVED17 = 17,
|
||||
H264_NAL_RESERVED18 = 18,
|
||||
H264_NAL_AUXILIARY_SLICE = 19,
|
||||
H264_NAL_EXTEN_SLICE = 20,
|
||||
H264_NAL_DEPTH_EXTEN_SLICE = 21,
|
||||
H264_NAL_RESERVED22 = 22,
|
||||
H264_NAL_RESERVED23 = 23,
|
||||
H264_NAL_UNSPECIFIED24 = 24,
|
||||
H264_NAL_UNSPECIFIED25 = 25,
|
||||
H264_NAL_UNSPECIFIED26 = 26,
|
||||
H264_NAL_UNSPECIFIED27 = 27,
|
||||
H264_NAL_UNSPECIFIED28 = 28,
|
||||
H264_NAL_UNSPECIFIED29 = 29,
|
||||
H264_NAL_UNSPECIFIED30 = 30,
|
||||
H264_NAL_UNSPECIFIED31 = 31,
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
// 7.4.2.1.1: seq_parameter_set_id is in [0, 31].
|
||||
H264_MAX_SPS_COUNT = 32,
|
||||
// 7.4.2.2: pic_parameter_set_id is in [0, 255].
|
||||
H264_MAX_PPS_COUNT = 256,
|
||||
|
||||
// A.3: MaxDpbFrames is bounded above by 16.
|
||||
H264_MAX_DPB_FRAMES = 16,
|
||||
// 7.4.2.1.1: max_num_ref_frames is in [0, MaxDpbFrames], and
|
||||
// each reference frame can have two fields.
|
||||
H264_MAX_REFS = 2 * H264_MAX_DPB_FRAMES,
|
||||
|
||||
// 7.4.3.1: modification_of_pic_nums_idc is not equal to 3 at most
|
||||
// num_ref_idx_lN_active_minus1 + 1 times (that is, once for each
|
||||
// possible reference), then equal to 3 once.
|
||||
H264_MAX_RPLM_COUNT = H264_MAX_REFS + 1,
|
||||
|
||||
// 7.4.3.3: in the worst case, we begin with a full short-term
|
||||
// reference picture list. Each picture in turn is moved to the
|
||||
// long-term list (type 3) and then discarded from there (type 2).
|
||||
// Then, we set the length of the long-term list (type 4), mark
|
||||
// the current picture as long-term (type 6) and terminate the
|
||||
// process (type 0).
|
||||
H264_MAX_MMCO_COUNT = H264_MAX_REFS * 2 + 3,
|
||||
|
||||
// A.2.1, A.2.3: profiles supporting FMO constrain
|
||||
// num_slice_groups_minus1 to be in [0, 7].
|
||||
H264_MAX_SLICE_GROUPS = 8,
|
||||
|
||||
// E.2.2: cpb_cnt_minus1 is in [0, 31].
|
||||
H264_MAX_CPB_CNT = 32,
|
||||
|
||||
// A.3: in table A-1 the highest level allows a MaxFS of 139264.
|
||||
H264_MAX_MB_PIC_SIZE = 139264,
|
||||
// A.3.1, A.3.2: PicWidthInMbs and PicHeightInMbs are constrained
|
||||
// to be not greater than sqrt(MaxFS * 8). Hence height/width are
|
||||
// bounded above by sqrt(139264 * 8) = 1055.5 macroblocks.
|
||||
H264_MAX_MB_WIDTH = 1055,
|
||||
H264_MAX_MB_HEIGHT = 1055,
|
||||
H264_MAX_WIDTH = H264_MAX_MB_WIDTH * 16,
|
||||
H264_MAX_HEIGHT = H264_MAX_MB_HEIGHT * 16,
|
||||
};
|
||||
|
||||
|
||||
#endif /* AVCODEC_H264_H */
|
||||
152
third-party/cbs/include/cbs/h2645_parse.h
vendored
Normal file
152
third-party/cbs/include/cbs/h2645_parse.h
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* H.264/HEVC common parsing code
|
||||
*
|
||||
* 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_H2645_PARSE_H
|
||||
#define AVCODEC_H2645_PARSE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/buffer.h>
|
||||
|
||||
|
||||
/**
|
||||
* CACHED_BITSTREAM_READER can only be true if it's used by a decoder
|
||||
* Thus, Sunshine doesn't need to worry about it
|
||||
*/
|
||||
typedef struct GetBitContext {
|
||||
const uint8_t *buffer, *buffer_end;
|
||||
#if CACHED_BITSTREAM_READER
|
||||
uint64_t cache;
|
||||
unsigned bits_left;
|
||||
#endif
|
||||
int index;
|
||||
int size_in_bits;
|
||||
int size_in_bits_plus8;
|
||||
} GetBitContext;
|
||||
|
||||
#define MAX_MBPAIR_SIZE (256 * 1024) // a tighter bound could be calculated if someone cares about a few bytes
|
||||
|
||||
typedef struct H2645NAL {
|
||||
uint8_t *rbsp_buffer;
|
||||
|
||||
int size;
|
||||
const uint8_t *data;
|
||||
|
||||
/**
|
||||
* Size, in bits, of just the data, excluding the stop bit and any trailing
|
||||
* padding. I.e. what HEVC calls SODB.
|
||||
*/
|
||||
int size_bits;
|
||||
|
||||
int raw_size;
|
||||
const uint8_t *raw_data;
|
||||
|
||||
GetBitContext gb;
|
||||
|
||||
/**
|
||||
* NAL unit type
|
||||
*/
|
||||
int type;
|
||||
|
||||
/**
|
||||
* HEVC only, nuh_temporal_id_plus_1 - 1
|
||||
*/
|
||||
int temporal_id;
|
||||
|
||||
/*
|
||||
* HEVC only, identifier of layer to which nal unit belongs
|
||||
*/
|
||||
int nuh_layer_id;
|
||||
|
||||
int skipped_bytes;
|
||||
int skipped_bytes_pos_size;
|
||||
int *skipped_bytes_pos;
|
||||
/**
|
||||
* H.264 only, nal_ref_idc
|
||||
*/
|
||||
int ref_idc;
|
||||
} H2645NAL;
|
||||
|
||||
typedef struct H2645RBSP {
|
||||
uint8_t *rbsp_buffer;
|
||||
AVBufferRef *rbsp_buffer_ref;
|
||||
int rbsp_buffer_alloc_size;
|
||||
int rbsp_buffer_size;
|
||||
} H2645RBSP;
|
||||
|
||||
/* an input packet split into unescaped NAL units */
|
||||
typedef struct H2645Packet {
|
||||
H2645NAL *nals;
|
||||
H2645RBSP rbsp;
|
||||
int nb_nals;
|
||||
int nals_allocated;
|
||||
unsigned nal_buffer_size;
|
||||
} H2645Packet;
|
||||
|
||||
/**
|
||||
* Extract the raw (unescaped) bitstream.
|
||||
*/
|
||||
int ff_h2645_extract_rbsp(const uint8_t *src, int length, H2645RBSP *rbsp,
|
||||
H2645NAL *nal, int small_padding);
|
||||
|
||||
/**
|
||||
* Split an input packet into NAL units.
|
||||
*
|
||||
* If data == raw_data holds true for a NAL unit of the returned pkt, then
|
||||
* said NAL unit does not contain any emulation_prevention_three_byte and
|
||||
* the data is contained in the input buffer pointed to by buf.
|
||||
* Otherwise, the unescaped data is part of the rbsp_buffer described by the
|
||||
* packet's H2645RBSP.
|
||||
*
|
||||
* If the packet's rbsp_buffer_ref is not NULL, the underlying AVBuffer must
|
||||
* own rbsp_buffer. If not and rbsp_buffer is not NULL, use_ref must be 0.
|
||||
* If use_ref is set, rbsp_buffer will be reference-counted and owned by
|
||||
* the underlying AVBuffer of rbsp_buffer_ref.
|
||||
*/
|
||||
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
void *logctx, int is_nalff, int nal_length_size,
|
||||
enum AVCodecID codec_id, int small_padding, int use_ref);
|
||||
|
||||
/**
|
||||
* Free all the allocated memory in the packet.
|
||||
*/
|
||||
void ff_h2645_packet_uninit(H2645Packet *pkt);
|
||||
|
||||
static inline int get_nalsize(int nal_length_size, const uint8_t *buf,
|
||||
int buf_size, int *buf_index, void *logctx) {
|
||||
int i, nalsize = 0;
|
||||
|
||||
if(*buf_index >= buf_size - nal_length_size) {
|
||||
// the end of the buffer is reached, refill it
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
|
||||
for(i = 0; i < nal_length_size; i++)
|
||||
nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
|
||||
if(nalsize <= 0 || nalsize > buf_size - *buf_index) {
|
||||
av_log(logctx, AV_LOG_ERROR,
|
||||
"Invalid NAL unit size (%d > %d).\n", nalsize, buf_size - *buf_index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return nalsize;
|
||||
}
|
||||
|
||||
#endif /* AVCODEC_H2645_PARSE_H */
|
||||
160
third-party/cbs/include/cbs/hevc.h
vendored
Normal file
160
third-party/cbs/include/cbs/hevc.h
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* HEVC shared code
|
||||
*
|
||||
* 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_HEVC_H
|
||||
#define AVCODEC_HEVC_H
|
||||
|
||||
/**
|
||||
* Table 7-1 – NAL unit type codes and NAL unit type classes in
|
||||
* T-REC-H.265-201802
|
||||
*/
|
||||
enum HEVCNALUnitType {
|
||||
HEVC_NAL_TRAIL_N = 0,
|
||||
HEVC_NAL_TRAIL_R = 1,
|
||||
HEVC_NAL_TSA_N = 2,
|
||||
HEVC_NAL_TSA_R = 3,
|
||||
HEVC_NAL_STSA_N = 4,
|
||||
HEVC_NAL_STSA_R = 5,
|
||||
HEVC_NAL_RADL_N = 6,
|
||||
HEVC_NAL_RADL_R = 7,
|
||||
HEVC_NAL_RASL_N = 8,
|
||||
HEVC_NAL_RASL_R = 9,
|
||||
HEVC_NAL_VCL_N10 = 10,
|
||||
HEVC_NAL_VCL_R11 = 11,
|
||||
HEVC_NAL_VCL_N12 = 12,
|
||||
HEVC_NAL_VCL_R13 = 13,
|
||||
HEVC_NAL_VCL_N14 = 14,
|
||||
HEVC_NAL_VCL_R15 = 15,
|
||||
HEVC_NAL_BLA_W_LP = 16,
|
||||
HEVC_NAL_BLA_W_RADL = 17,
|
||||
HEVC_NAL_BLA_N_LP = 18,
|
||||
HEVC_NAL_IDR_W_RADL = 19,
|
||||
HEVC_NAL_IDR_N_LP = 20,
|
||||
HEVC_NAL_CRA_NUT = 21,
|
||||
HEVC_NAL_RSV_IRAP_VCL22 = 22,
|
||||
HEVC_NAL_RSV_IRAP_VCL23 = 23,
|
||||
HEVC_NAL_RSV_VCL24 = 24,
|
||||
HEVC_NAL_RSV_VCL25 = 25,
|
||||
HEVC_NAL_RSV_VCL26 = 26,
|
||||
HEVC_NAL_RSV_VCL27 = 27,
|
||||
HEVC_NAL_RSV_VCL28 = 28,
|
||||
HEVC_NAL_RSV_VCL29 = 29,
|
||||
HEVC_NAL_RSV_VCL30 = 30,
|
||||
HEVC_NAL_RSV_VCL31 = 31,
|
||||
HEVC_NAL_VPS = 32,
|
||||
HEVC_NAL_SPS = 33,
|
||||
HEVC_NAL_PPS = 34,
|
||||
HEVC_NAL_AUD = 35,
|
||||
HEVC_NAL_EOS_NUT = 36,
|
||||
HEVC_NAL_EOB_NUT = 37,
|
||||
HEVC_NAL_FD_NUT = 38,
|
||||
HEVC_NAL_SEI_PREFIX = 39,
|
||||
HEVC_NAL_SEI_SUFFIX = 40,
|
||||
HEVC_NAL_RSV_NVCL41 = 41,
|
||||
HEVC_NAL_RSV_NVCL42 = 42,
|
||||
HEVC_NAL_RSV_NVCL43 = 43,
|
||||
HEVC_NAL_RSV_NVCL44 = 44,
|
||||
HEVC_NAL_RSV_NVCL45 = 45,
|
||||
HEVC_NAL_RSV_NVCL46 = 46,
|
||||
HEVC_NAL_RSV_NVCL47 = 47,
|
||||
HEVC_NAL_UNSPEC48 = 48,
|
||||
HEVC_NAL_UNSPEC49 = 49,
|
||||
HEVC_NAL_UNSPEC50 = 50,
|
||||
HEVC_NAL_UNSPEC51 = 51,
|
||||
HEVC_NAL_UNSPEC52 = 52,
|
||||
HEVC_NAL_UNSPEC53 = 53,
|
||||
HEVC_NAL_UNSPEC54 = 54,
|
||||
HEVC_NAL_UNSPEC55 = 55,
|
||||
HEVC_NAL_UNSPEC56 = 56,
|
||||
HEVC_NAL_UNSPEC57 = 57,
|
||||
HEVC_NAL_UNSPEC58 = 58,
|
||||
HEVC_NAL_UNSPEC59 = 59,
|
||||
HEVC_NAL_UNSPEC60 = 60,
|
||||
HEVC_NAL_UNSPEC61 = 61,
|
||||
HEVC_NAL_UNSPEC62 = 62,
|
||||
HEVC_NAL_UNSPEC63 = 63,
|
||||
};
|
||||
|
||||
enum HEVCSliceType {
|
||||
HEVC_SLICE_B = 0,
|
||||
HEVC_SLICE_P = 1,
|
||||
HEVC_SLICE_I = 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
// 7.4.3.1: vps_max_layers_minus1 is in [0, 62].
|
||||
HEVC_MAX_LAYERS = 63,
|
||||
// 7.4.3.1: vps_max_sub_layers_minus1 is in [0, 6].
|
||||
HEVC_MAX_SUB_LAYERS = 7,
|
||||
// 7.4.3.1: vps_num_layer_sets_minus1 is in [0, 1023].
|
||||
HEVC_MAX_LAYER_SETS = 1024,
|
||||
|
||||
// 7.4.2.1: vps_video_parameter_set_id is u(4).
|
||||
HEVC_MAX_VPS_COUNT = 16,
|
||||
// 7.4.3.2.1: sps_seq_parameter_set_id is in [0, 15].
|
||||
HEVC_MAX_SPS_COUNT = 16,
|
||||
// 7.4.3.3.1: pps_pic_parameter_set_id is in [0, 63].
|
||||
HEVC_MAX_PPS_COUNT = 64,
|
||||
|
||||
// A.4.2: MaxDpbSize is bounded above by 16.
|
||||
HEVC_MAX_DPB_SIZE = 16,
|
||||
// 7.4.3.1: vps_max_dec_pic_buffering_minus1[i] is in [0, MaxDpbSize - 1].
|
||||
HEVC_MAX_REFS = HEVC_MAX_DPB_SIZE,
|
||||
|
||||
// 7.4.3.2.1: num_short_term_ref_pic_sets is in [0, 64].
|
||||
HEVC_MAX_SHORT_TERM_REF_PIC_SETS = 64,
|
||||
// 7.4.3.2.1: num_long_term_ref_pics_sps is in [0, 32].
|
||||
HEVC_MAX_LONG_TERM_REF_PICS = 32,
|
||||
|
||||
// A.3: all profiles require that CtbLog2SizeY is in [4, 6].
|
||||
HEVC_MIN_LOG2_CTB_SIZE = 4,
|
||||
HEVC_MAX_LOG2_CTB_SIZE = 6,
|
||||
|
||||
// E.3.2: cpb_cnt_minus1[i] is in [0, 31].
|
||||
HEVC_MAX_CPB_CNT = 32,
|
||||
|
||||
// A.4.1: in table A.6 the highest level allows a MaxLumaPs of 35 651 584.
|
||||
HEVC_MAX_LUMA_PS = 35651584,
|
||||
// A.4.1: pic_width_in_luma_samples and pic_height_in_luma_samples are
|
||||
// constrained to be not greater than sqrt(MaxLumaPs * 8). Hence height/
|
||||
// width are bounded above by sqrt(8 * 35651584) = 16888.2 samples.
|
||||
HEVC_MAX_WIDTH = 16888,
|
||||
HEVC_MAX_HEIGHT = 16888,
|
||||
|
||||
// A.4.1: table A.6 allows at most 22 tile rows for any level.
|
||||
HEVC_MAX_TILE_ROWS = 22,
|
||||
// A.4.1: table A.6 allows at most 20 tile columns for any level.
|
||||
HEVC_MAX_TILE_COLUMNS = 20,
|
||||
|
||||
// A.4.2: table A.6 allows at most 600 slice segments for any level.
|
||||
HEVC_MAX_SLICE_SEGMENTS = 600,
|
||||
|
||||
// 7.4.7.1: in the worst case (tiles_enabled_flag and
|
||||
// entropy_coding_sync_enabled_flag are both set), entry points can be
|
||||
// placed at the beginning of every Ctb row in every tile, giving an
|
||||
// upper bound of (num_tile_columns_minus1 + 1) * PicHeightInCtbsY - 1.
|
||||
// Only a stream with very high resolution and perverse parameters could
|
||||
// get near that, though, so set a lower limit here with the maximum
|
||||
// possible value for 4K video (at most 135 16x16 Ctb rows).
|
||||
HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135,
|
||||
};
|
||||
|
||||
|
||||
#endif /* AVCODEC_HEVC_H */
|
||||
140
third-party/cbs/include/cbs/sei.h
vendored
Normal file
140
third-party/cbs/include/cbs/sei.h
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* 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_SEI_H
|
||||
#define AVCODEC_SEI_H
|
||||
|
||||
// SEI payload types form a common namespace between the H.264, H.265
|
||||
// and H.266 standards. A given payload type always has the same
|
||||
// meaning, but some names have different payload types in different
|
||||
// standards (e.g. scalable-nesting is 30 in H.264 but 133 in H.265).
|
||||
// The content of the payload data depends on the standard, though
|
||||
// many generic parts have the same interpretation everywhere (such as
|
||||
// mastering-display-colour-volume and user-data-unregistered).
|
||||
enum {
|
||||
SEI_TYPE_BUFFERING_PERIOD = 0,
|
||||
SEI_TYPE_PIC_TIMING = 1,
|
||||
SEI_TYPE_PAN_SCAN_RECT = 2,
|
||||
SEI_TYPE_FILLER_PAYLOAD = 3,
|
||||
SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35 = 4,
|
||||
SEI_TYPE_USER_DATA_UNREGISTERED = 5,
|
||||
SEI_TYPE_RECOVERY_POINT = 6,
|
||||
SEI_TYPE_DEC_REF_PIC_MARKING_REPETITION = 7,
|
||||
SEI_TYPE_SPARE_PIC = 8,
|
||||
SEI_TYPE_SCENE_INFO = 9,
|
||||
SEI_TYPE_SUB_SEQ_INFO = 10,
|
||||
SEI_TYPE_SUB_SEQ_LAYER_CHARACTERISTICS = 11,
|
||||
SEI_TYPE_SUB_SEQ_CHARACTERISTICS = 12,
|
||||
SEI_TYPE_FULL_FRAME_FREEZE = 13,
|
||||
SEI_TYPE_FULL_FRAME_FREEZE_RELEASE = 14,
|
||||
SEI_TYPE_FULL_FRAME_SNAPSHOT = 15,
|
||||
SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_START = 16,
|
||||
SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_END = 17,
|
||||
SEI_TYPE_MOTION_CONSTRAINED_SLICE_GROUP_SET = 18,
|
||||
SEI_TYPE_FILM_GRAIN_CHARACTERISTICS = 19,
|
||||
SEI_TYPE_DEBLOCKING_FILTER_DISPLAY_PREFERENCE = 20,
|
||||
SEI_TYPE_STEREO_VIDEO_INFO = 21,
|
||||
SEI_TYPE_POST_FILTER_HINT = 22,
|
||||
SEI_TYPE_TONE_MAPPING_INFO = 23,
|
||||
SEI_TYPE_SCALABILITY_INFO = 24,
|
||||
SEI_TYPE_SUB_PIC_SCALABLE_LAYER = 25,
|
||||
SEI_TYPE_NON_REQUIRED_LAYER_REP = 26,
|
||||
SEI_TYPE_PRIORITY_LAYER_INFO = 27,
|
||||
SEI_TYPE_LAYERS_NOT_PRESENT_4 = 28,
|
||||
SEI_TYPE_LAYER_DEPENDENCY_CHANGE = 29,
|
||||
SEI_TYPE_SCALABLE_NESTING_4 = 30,
|
||||
SEI_TYPE_BASE_LAYER_TEMPORAL_HRD = 31,
|
||||
SEI_TYPE_QUALITY_LAYER_INTEGRITY_CHECK = 32,
|
||||
SEI_TYPE_REDUNDANT_PIC_PROPERTY = 33,
|
||||
SEI_TYPE_TL0_DEP_REP_INDEX = 34,
|
||||
SEI_TYPE_TL_SWITCHING_POINT = 35,
|
||||
SEI_TYPE_PARALLEL_DECODING_INFO = 36,
|
||||
SEI_TYPE_MVC_SCALABLE_NESTING = 37,
|
||||
SEI_TYPE_VIEW_SCALABILITY_INFO = 38,
|
||||
SEI_TYPE_MULTIVIEW_SCENE_INFO_4 = 39,
|
||||
SEI_TYPE_MULTIVIEW_ACQUISITION_INFO_4 = 40,
|
||||
SEI_TYPE_NON_REQUIRED_VIEW_COMPONENT = 41,
|
||||
SEI_TYPE_VIEW_DEPENDENCY_CHANGE = 42,
|
||||
SEI_TYPE_OPERATION_POINTS_NOT_PRESENT = 43,
|
||||
SEI_TYPE_BASE_VIEW_TEMPORAL_HRD = 44,
|
||||
SEI_TYPE_FRAME_PACKING_ARRANGEMENT = 45,
|
||||
SEI_TYPE_MULTIVIEW_VIEW_POSITION_4 = 46,
|
||||
SEI_TYPE_DISPLAY_ORIENTATION = 47,
|
||||
SEI_TYPE_MVCD_SCALABLE_NESTING = 48,
|
||||
SEI_TYPE_MVCD_VIEW_SCALABILITY_INFO = 49,
|
||||
SEI_TYPE_DEPTH_REPRESENTATION_INFO_4 = 50,
|
||||
SEI_TYPE_THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO_4 = 51,
|
||||
SEI_TYPE_DEPTH_TIMING = 52,
|
||||
SEI_TYPE_DEPTH_SAMPLING_INFO = 53,
|
||||
SEI_TYPE_CONSTRAINED_DEPTH_PARAMETER_SET_IDENTIFIER = 54,
|
||||
SEI_TYPE_GREEN_METADATA = 56,
|
||||
SEI_TYPE_STRUCTURE_OF_PICTURES_INFO = 128,
|
||||
SEI_TYPE_ACTIVE_PARAMETER_SETS = 129,
|
||||
SEI_TYPE_PARAMETER_SETS_INCLUSION_INDICATION = SEI_TYPE_ACTIVE_PARAMETER_SETS,
|
||||
SEI_TYPE_DECODING_UNIT_INFO = 130,
|
||||
SEI_TYPE_TEMPORAL_SUB_LAYER_ZERO_IDX = 131,
|
||||
SEI_TYPE_DECODED_PICTURE_HASH = 132,
|
||||
SEI_TYPE_SCALABLE_NESTING_5 = 133,
|
||||
SEI_TYPE_REGION_REFRESH_INFO = 134,
|
||||
SEI_TYPE_NO_DISPLAY = 135,
|
||||
SEI_TYPE_TIME_CODE = 136,
|
||||
SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
|
||||
SEI_TYPE_SEGMENTED_RECT_FRAME_PACKING_ARRANGEMENT = 138,
|
||||
SEI_TYPE_TEMPORAL_MOTION_CONSTRAINED_TILE_SETS = 139,
|
||||
SEI_TYPE_CHROMA_RESAMPLING_FILTER_HINT = 140,
|
||||
SEI_TYPE_KNEE_FUNCTION_INFO = 141,
|
||||
SEI_TYPE_COLOUR_REMAPPING_INFO = 142,
|
||||
SEI_TYPE_DEINTERLACED_FIELD_IDENTIFICATION = 143,
|
||||
SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO = 144,
|
||||
SEI_TYPE_DEPENDENT_RAP_INDICATION = 145,
|
||||
SEI_TYPE_CODED_REGION_COMPLETION = 146,
|
||||
SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147,
|
||||
SEI_TYPE_AMBIENT_VIEWING_ENVIRONMENT = 148,
|
||||
SEI_TYPE_CONTENT_COLOUR_VOLUME = 149,
|
||||
SEI_TYPE_EQUIRECTANGULAR_PROJECTION = 150,
|
||||
SEI_TYPE_CUBEMAP_PROJECTION = 151,
|
||||
SEI_TYPE_FISHEYE_VIDEO_INFO = 152,
|
||||
SEI_TYPE_SPHERE_ROTATION = 154,
|
||||
SEI_TYPE_REGIONWISE_PACKING = 155,
|
||||
SEI_TYPE_OMNI_VIEWPORT = 156,
|
||||
SEI_TYPE_REGIONAL_NESTING = 157,
|
||||
SEI_TYPE_MCTS_EXTRACTION_INFO_SETS = 158,
|
||||
SEI_TYPE_MCTS_EXTRACTION_INFO_NESTING = 159,
|
||||
SEI_TYPE_LAYERS_NOT_PRESENT_5 = 160,
|
||||
SEI_TYPE_INTER_LAYER_CONSTRAINED_TILE_SETS = 161,
|
||||
SEI_TYPE_BSP_NESTING = 162,
|
||||
SEI_TYPE_BSP_INITIAL_ARRIVAL_TIME = 163,
|
||||
SEI_TYPE_SUB_BITSTREAM_PROPERTY = 164,
|
||||
SEI_TYPE_ALPHA_CHANNEL_INFO = 165,
|
||||
SEI_TYPE_OVERLAY_INFO = 166,
|
||||
SEI_TYPE_TEMPORAL_MV_PREDICTION_CONSTRAINTS = 167,
|
||||
SEI_TYPE_FRAME_FIELD_INFO = 168,
|
||||
SEI_TYPE_THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO = 176,
|
||||
SEI_TYPE_DEPTH_REPRESENTATION_INFO_5 = 177,
|
||||
SEI_TYPE_MULTIVIEW_SCENE_INFO_5 = 178,
|
||||
SEI_TYPE_MULTIVIEW_ACQUISITION_INFO_5 = 179,
|
||||
SEI_TYPE_MULTIVIEW_VIEW_POSITION_5 = 180,
|
||||
SEI_TYPE_ALTERNATIVE_DEPTH_INFO = 181,
|
||||
SEI_TYPE_SEI_MANIFEST = 200,
|
||||
SEI_TYPE_SEI_PREFIX_INDICATION = 201,
|
||||
SEI_TYPE_ANNOTATED_REGIONS = 202,
|
||||
SEI_TYPE_SUBPIC_LEVEL_INFO = 203,
|
||||
SEI_TYPE_SAMPLE_ASPECT_RATIO_INFO = 204,
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_SEI_H */
|
||||
Reference in New Issue
Block a user