Go to the documentation of this file.
61 .dv_profile =
s->dv_profile,
67 s->logctx =
s0->logctx;
68 s->mapping =
s0->mapping;
70 s->dv_profile =
s0->dv_profile;
90 if (!
s->mapping || !
s->color)
110 #define COPY(t, a, b, last) memcpy(a, b, offsetof(t, last) + sizeof((b)->last))
142 union { uint32_t u32;
float f32; } fpart;
161 union { uint32_t u32;
float f32; } fpart;
177 #define VALIDATE(VAR, MIN, MAX) \
179 if (VAR < MIN || VAR > MAX) { \
180 av_log(s->logctx, AV_LOG_ERROR, "RPU validation failed: " \
181 #MIN" <= "#VAR" = %d <= "#MAX"\n", (int) VAR); \
195 uint8_t vdr_seq_info_present;
196 uint8_t vdr_dm_metadata_present;
197 uint8_t use_prev_vdr_rpu;
209 "%"PRIu8
", ignoring\n", rpu_type);
221 if (vdr_seq_info_present) {
242 VALIDATE(bl_bit_depth_minus8, 0, 8);
243 VALIDATE(el_bit_depth_minus8, 0, 8);
244 VALIDATE(vdr_bit_depth_minus8, 0, 8);
270 if (use_prev_vdr_rpu) {
273 if (!
s->vdr[prev_vdr_rpu_id]) {
278 vdr =
s->vdr[prev_vdr_rpu_id];
283 if (!
s->vdr[vdr_rpu_id]) {
285 if (!
s->vdr[vdr_rpu_id])
289 vdr =
s->vdr[vdr_rpu_id];
296 for (
int c = 0;
c < 3;
c++) {
324 for (
int c = 0;
c < 3;
c++) {
330 switch (mapping_idc) {
335 if (poly_order_minus1 == 0) {
337 if (linear_interp_flag) {
340 "linear interpolation");
350 int mmr_order_minus1 =
get_bits(gb, 2);
354 for (
int j = 0; j < curve->
mmr_order[
i]; j++) {
355 for (
int k = 0; k < 7; k++)
365 for (
int c = 0;
c < 3;
c++) {
379 if (vdr_dm_metadata_present) {
385 if (!
s->vdr[affected_dm_id]) {
387 if (!
s->vdr[affected_dm_id])
391 if (!
s->vdr[current_dm_id]) {
398 vdr =
s->vdr[current_dm_id];
402 vdr =
s->vdr[affected_dm_id];
404 color->dm_metadata_id = affected_dm_id;
406 for (
int i = 0;
i < 9;
i++)
408 for (
int i = 0;
i < 3;
i++) {
409 int denom =
profile == 4 ? (1 << 30) : (1 << 28);
418 for (
int i = 0;
i < 9;
i++)
#define AV_LOG_WARNING
Something somehow does not look correct.
enum AVDOVINLQMethod nlq_method_idc
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.
static int get_se_golomb_long(GetBitContext *gb)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
@ AV_FRAME_DATA_DOVI_METADATA
Parsed Dolby Vision metadata, suitable for passing to a software implementation.
This structure describes decoded (raw) audio or video data.
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
int64_t mmr_coef[AV_DOVI_MAX_PIECES][3][7]
enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES]
#define VALIDATE(VAR, MIN, MAX)
uint8_t mapping_color_space
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
uint8_t mmr_order[AV_DOVI_MAX_PIECES]
static int get_sbits(GetBitContext *s, int n)
uint8_t poly_order[AV_DOVI_MAX_PIECES]
static int64_t get_se_coef(GetBitContext *gb, const AVDOVIRpuDataHeader *hdr)
uint64_t linear_deadzone_threshold
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static unsigned int get_bits1(GetBitContext *s)
void ff_dovi_update_cfg(DOVIContext *s, const AVDOVIDecoderConfigurationRecord *cfg)
Read the contents of an AVDOVIDecoderConfigurationRecord (usually provided by stream side data) and u...
static void * ff_refstruct_allocz(size_t size)
Equivalent to ff_refstruct_alloc_ext(size, 0, NULL, NULL)
AVFrameSideData * av_frame_new_side_data_from_buf(AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef *buf)
Add a new side data to a frame from an existing AVBufferRef.
int64_t mmr_constant[AV_DOVI_MAX_PIECES]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
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.
void ff_dovi_ctx_flush(DOVIContext *s)
Partially reset the internal state.
AVDOVIDataMapping mapping
static int guess_profile(const AVDOVIRpuDataHeader *hdr)
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
static AVRational av_make_q(int num, int den)
Create an AVRational.
#define COPY(t, a, b, last)
static uint64_t get_ue_coef(GetBitContext *gb, const AVDOVIRpuDataHeader *hdr)
int64_t poly_coef[AV_DOVI_MAX_PIECES][3]
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
#define i(width, name, range_min, range_max)
uint32_t num_y_partitions
Coefficients of the non-linear inverse quantization.
AVDOVIReshapingCurve curves[3]
int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size)
Parse the contents of a Dovi RPU NAL and update the parsed values in the DOVIContext struct.
uint64_t linear_deadzone_slope
void ff_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
uint8_t mapping_chroma_format_idc
AVDOVIColorMetadata color
A reference to a data buffer.
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
#define avpriv_request_sample(...)
Structure to hold side data for an AVFrame.
uint16_t pivots[AV_DOVI_MAX_PIECES+1]
Dolby Vision RPU data mapping parameters.
void ff_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame)
Attach the decoded AVDOVIMetadata as side data to an AVFrame.
uint32_t num_x_partitions
void ff_dovi_ctx_replace(DOVIContext *s, const DOVIContext *s0)