Go to the documentation of this file.
60 .dv_profile =
s->dv_profile,
67 s->logctx =
s0->logctx;
68 s->mapping =
s0->mapping;
70 s->dv_profile =
s0->dv_profile;
98 if (!
s->mapping || !
s->color)
118 #define COPY(t, a, b, last) memcpy(a, b, offsetof(t, last) + sizeof((b)->last))
150 union { uint32_t u32;
float f32; } fpart;
169 union { uint32_t u32;
float f32; } fpart;
185 #define VALIDATE(VAR, MIN, MAX) \
187 if (VAR < MIN || VAR > MAX) { \
188 av_log(s->logctx, AV_LOG_ERROR, "RPU validation failed: " \
189 #MIN" <= "#VAR" = %d <= "#MAX"\n", (int) VAR); \
203 uint8_t vdr_seq_info_present;
204 uint8_t vdr_dm_metadata_present;
205 uint8_t use_prev_vdr_rpu;
217 "%"PRIu8
", ignoring\n", rpu_type);
229 if (vdr_seq_info_present) {
250 VALIDATE(bl_bit_depth_minus8, 0, 8);
251 VALIDATE(el_bit_depth_minus8, 0, 8);
252 VALIDATE(vdr_bit_depth_minus8, 0, 8);
278 if (use_prev_vdr_rpu) {
281 if (!
s->vdr_ref[prev_vdr_rpu_id]) {
286 vdr = (
DOVIVdrRef *)
s->vdr_ref[prev_vdr_rpu_id]->data;
291 if (!
s->vdr_ref[vdr_rpu_id]) {
293 if (!
s->vdr_ref[vdr_rpu_id])
304 for (
int c = 0;
c < 3;
c++) {
332 for (
int c = 0;
c < 3;
c++) {
338 switch (mapping_idc) {
343 if (poly_order_minus1 == 0) {
345 if (linear_interp_flag) {
348 "linear interpolation");
358 int mmr_order_minus1 =
get_bits(gb, 2);
362 for (
int j = 0; j < curve->
mmr_order[
i]; j++) {
363 for (
int k = 0; k < 7; k++)
373 for (
int c = 0;
c < 3;
c++) {
387 if (vdr_dm_metadata_present) {
393 if (!
s->vdr_ref[affected_dm_id]) {
395 if (!
s->vdr_ref[affected_dm_id])
399 if (!
s->vdr_ref[current_dm_id]) {
406 vdr = (
DOVIVdrRef *)
s->vdr_ref[current_dm_id]->data;
410 vdr = (
DOVIVdrRef *)
s->vdr_ref[affected_dm_id]->data;
412 color->dm_metadata_id = affected_dm_id;
414 for (
int i = 0;
i < 9;
i++)
416 for (
int i = 0;
i < 3;
i++) {
417 int denom =
profile == 4 ? (1 << 30) : (1 << 28);
426 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.
AVDOVIDataMapping mapping
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
int ff_dovi_ctx_replace(DOVIContext *s, const DOVIContext *s0)
AVDOVIColorMetadata color
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...
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.
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
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
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
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
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
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]
Private contents of vdr_ref.
Dolby Vision RPU data mapping parameters.
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