Go to the documentation of this file.
46 const uint8_t *rpu,
size_t rpu_size,
101 memcpy(nal->
data + 3, rpu, rpu_size);
111 memcpy(
ref->data, nal->
data, 3);
112 memcpy(
ref->data + 3, rpu, rpu_size);
128 int provider_code, provider_oriented_code, rpu_size,
ret;
144 provider_oriented_code != 0x800)
176 .fragment_name =
"access unit",
177 .unit_name =
"NAL unit",
183 .fragment_name =
"temporal unit",
192 s->dec.logctx =
s->enc.logctx = bsf;
217 if (
s->compression &&
s->dec.cfg.dv_profile < 8) {
219 "Dolby Vision profile %d.\n",
s->compression,
s->dec.cfg.dv_profile);
226 "found? Generating one, but results may be invalid.\n");
232 s->dec.cfg =
s->enc.cfg;
255 #define OFFSET(x) offsetof(DoviRpuContext, x)
256 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
260 {
"none",
"Don't compress metadata", 0,
AV_OPT_TYPE_CONST, {.i64 = 0}, .flags =
FLAGS, .unit =
"compression" },
278 .
p.
name =
"dovi_rpu",
AVCodecParameters * par_in
Parameters of the input stream.
#define AV_LOG_WARNING
Something somehow does not look correct.
int ff_cbs_bsf_generic_init(AVBSFContext *bsf, const CBSBSFType *type)
Initialise generic CBS BSF setup.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void ff_dovi_ctx_unref(DOVIContext *s)
Completely reset a DOVIContext, preserving only logctx.
const FFBitStreamFilter ff_dovi_rpu_bsf
void * content
Pointer to the decomposed form of this unit.
int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, int err_recognition)
Parse the contents of a Dolby Vision RPU and update the parsed values in the DOVIContext struct.
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
void av_packet_side_data_remove(AVPacketSideData *sd, int *pnb_sd, enum AVPacketSideDataType type)
Remove side data of the given type from a side data array.
static int update_rpu(AVBSFContext *bsf, const AVPacket *pkt, int flags, const uint8_t *rpu, size_t rpu_size, uint8_t **out_rpu, int *out_size)
void(* filter)(uint8_t *src, int stride, int qscale)
CodedBitstreamUnitType type
Codec-specific type of this unit.
@ AV1_METADATA_TYPE_ITUT_T35
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
The bitstream filter state.
Coded bitstream unit structure.
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
static int dovi_rpu_update_fragment_av1(AVBSFContext *bsf, AVPacket *pkt, CodedBitstreamFragment *frag)
static void dovi_rpu_close(AVBSFContext *bsf)
uint8_t dv_md_compression
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
AVCodecParameters * par_out
Parameters of the output stream.
@ FF_DOVI_WRAP_T35
wrap inside T.35+EMDF
@ FF_DOVI_COMPRESS_RPU
enable compression for this RPU
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Coded bitstream fragment structure, combining one or more units.
void av_buffer_default_free(void *opaque, uint8_t *data)
Default free callback, which calls av_free() on the buffer data.
int nb_coded_side_data
Amount of entries in coded_side_data.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static enum AVCodecID dovi_rpu_codec_ids[]
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, int flags, uint8_t **out_rpu, int *out_size)
Synthesize a Dolby Vision RPU reflecting the current state.
int ff_dovi_configure_ext(DOVIContext *s, AVCodecParameters *codecpar, const AVDOVIMetadata *metadata, enum AVDOVICompression compression, int strict_std_compliance)
Configure the encoder for Dolby Vision encoding.
const char * av_default_item_name(void *ptr)
Return the context name.
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
static const AVClass dovi_rpu_class
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
AVCodecID
Identify the syntax and semantics of the bitstream.
const AVPacketSideData * av_packet_side_data_get(const AVPacketSideData *sd, int nb_sd, enum AVPacketSideDataType type)
Get side information from a side data array.
AVBitStreamFilter p
The public AVBitStreamFilter.
#define ITU_T_T35_PROVIDER_CODE_DOLBY
int(* init)(AVBSFContext *ctx)
void ff_dovi_ctx_flush(DOVIContext *s)
Partially reset the internal state.
static int dovi_rpu_update_fragment_hevc(AVBSFContext *bsf, AVPacket *pkt, CodedBitstreamFragment *au)
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
void ff_cbs_bsf_generic_close(AVBSFContext *bsf)
Close a generic CBS BSF instance.
#define FF_COMPLIANCE_NORMAL
int flags
A combination of AV_PKT_FLAG values.
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
static const CBSBSFType dovi_rpu_hevc_type
int ff_dovi_get_metadata(DOVIContext *s, AVDOVIMetadata **out_metadata)
Get the decoded AVDOVIMetadata.
#define i(width, name, range_min, range_max)
AVBufferRef * data_ref
A reference to the buffer containing data.
static int dovi_rpu_init(AVBSFContext *bsf)
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
static const CBSBSFType dovi_rpu_av1_type
int av_buffer_is_writable(const AVBufferRef *buf)
void * priv_data
Opaque filter-specific private data.
int ff_cbs_bsf_generic_filter(AVBSFContext *bsf, AVPacket *pkt)
Filter operation for CBS BSF.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
@ AV_OPT_TYPE_INT
Underlying C type is int.
static int ref[MAX_W *MAX_W]
A reference to a data buffer.
#define ITU_T_T35_COUNTRY_CODE_US
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define flags(name, subs,...)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
static const AVOption dovi_rpu_options[]
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
int nb_units
Number of units in this fragment.
void ff_cbs_delete_unit(CodedBitstreamFragment *frag, int position)
Delete a unit from a fragment and free all memory it uses.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16