FFmpeg
|
#include "libavutil/dovi_meta.h"
#include "libavutil/frame.h"
#include "avcodec.h"
#include "codec_par.h"
Go to the source code of this file.
Data Structures | |
struct | DOVIExt |
struct | DOVIContext |
Macros | |
#define | DOVI_MAX_DM_ID 15 |
#define | FF_DOVI_AUTOMATIC -1 |
Enable tri-state. More... | |
Enumerations | |
enum | { FF_DOVI_WRAP_NAL = 1 << 0, FF_DOVI_WRAP_T35 = 1 << 1, FF_DOVI_COMPRESS_RPU = 1 << 2 } |
enum | { RPU_COEFF_FIXED = 0, RPU_COEFF_FLOAT = 1 } |
Functions | |
void | ff_dovi_ctx_replace (DOVIContext *s, const DOVIContext *s0) |
void | ff_dovi_ctx_unref (DOVIContext *s) |
Completely reset a DOVIContext, preserving only logctx. More... | |
void | ff_dovi_ctx_flush (DOVIContext *s) |
Partially reset the internal state. More... | |
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. More... | |
int | ff_dovi_get_metadata (DOVIContext *s, AVDOVIMetadata **out_metadata) |
Get the decoded AVDOVIMetadata. More... | |
int | ff_dovi_attach_side_data (DOVIContext *s, AVFrame *frame) |
Attach the decoded AVDOVIMetadata as side data to an AVFrame. More... | |
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. More... | |
int | ff_dovi_configure (DOVIContext *s, AVCodecContext *avctx) |
Helper wrapper around ff_dovi_configure_ext which infers the codec parameters from an AVCodecContext. More... | |
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. More... | |
int | ff_dovi_guess_profile_hevc (const AVDOVIRpuDataHeader *hdr) |
Internal helper function to guess the correct DV profile for HEVC. More... | |
static int | ff_dovi_rpu_extension_is_static (int level) |
Variables | |
const AVDOVIColorMetadata | ff_dovi_color_default |
#define DOVI_MAX_DM_ID 15 |
Definition at line 33 of file dovi_rpu.h.
#define FF_DOVI_AUTOMATIC -1 |
Enable tri-state.
For encoding only. FF_DOVI_AUTOMATIC enables Dolby Vision only if avctx->decoded_side_data contains an AVDOVIMetadata.
Definition at line 49 of file dovi_rpu.h.
anonymous enum |
Enumerator | |
---|---|
FF_DOVI_WRAP_NAL | wrap inside NAL RBSP |
FF_DOVI_WRAP_T35 | wrap inside T.35+EMDF |
FF_DOVI_COMPRESS_RPU | enable compression for this RPU |
Definition at line 157 of file dovi_rpu.h.
anonymous enum |
Enumerator | |
---|---|
RPU_COEFF_FIXED | |
RPU_COEFF_FLOAT |
Definition at line 181 of file dovi_rpu.h.
void ff_dovi_ctx_replace | ( | DOVIContext * | s, |
const DOVIContext * | s0 | ||
) |
Definition at line 58 of file dovi_rpu.c.
void ff_dovi_ctx_unref | ( | DOVIContext * | s | ) |
Completely reset a DOVIContext, preserving only logctx.
Definition at line 29 of file dovi_rpu.c.
Referenced by aom_free(), av1_decode_free(), dovi_rpu_close(), eb_enc_close(), ff_dovi_rpu_parse(), hevc_decode_free(), libdav1d_close(), and libx265_encode_close().
void ff_dovi_ctx_flush | ( | DOVIContext * | s | ) |
Partially reset the internal state.
Resets per-frame state, but preserves the stream-wide configuration record.
Definition at line 42 of file dovi_rpu.c.
Referenced by hevc_decode_flush(), and update_rpu().
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 function should receive the decoded unit payload, without any T.35 or NAL unit headers.
Returns 0 or an error code.
Note: DOVIContext.cfg
should be initialized before calling into this function. If not done, the profile will be guessed according to HEVC semantics.
The patent mentions another legal value, NLQ_MU_LAW, but it's not documented anywhere how to parse or apply that type of NLQ.
Definition at line 346 of file dovi_rpudec.c.
Referenced by decode_nal_units(), export_itut_t35(), libdav1d_receive_frame(), and update_rpu().
int ff_dovi_get_metadata | ( | DOVIContext * | s, |
AVDOVIMetadata ** | out_metadata | ||
) |
Get the decoded AVDOVIMetadata.
Ownership passes to the caller.
Returns the size of *out_metadata, a negative error code, or 0 if no metadata is available to return.
Definition at line 33 of file dovi_rpudec.c.
Referenced by ff_dovi_attach_side_data(), and update_rpu().
int ff_dovi_attach_side_data | ( | DOVIContext * | s, |
AVFrame * | frame | ||
) |
Attach the decoded AVDOVIMetadata as side data to an AVFrame.
Returns 0 or a negative error code.
Definition at line 64 of file dovi_rpudec.c.
Referenced by export_itut_t35(), libdav1d_receive_frame(), and set_side_data().
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.
Generates a configuration record in s->cfg, and attaches it to avctx->coded_side_data. Sets the correct profile and compatibility ID based on the tagged AVCodecParameters colorspace metadata, and the correct level based on the resolution and tagged framerate.
metadata
should point to the first frame's RPU, if available. If absent, auto-detection will be performed, but this can sometimes lead to inaccurate results (in particular for HEVC streams with enhancement layers).
Returns 0 or a negative error code.
Definition at line 55 of file dovi_rpuenc.c.
Referenced by dovi_rpu_init(), and ff_dovi_configure().
int ff_dovi_configure | ( | DOVIContext * | s, |
AVCodecContext * | avctx | ||
) |
Helper wrapper around ff_dovi_configure_ext
which infers the codec parameters from an AVCodecContext.
Definition at line 241 of file dovi_rpuenc.c.
Referenced by aom_init(), eb_enc_init(), and libx265_encode_init().
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.
By default, the RPU is not encapsulated (see flags
for more options). Note that this assumes all previous calls to ff_dovi_rpu_generate
have been appropriately signalled, i.e. it will not re-send already transmitted redundant data.
Mutates the internal state of DOVIContext to reflect the change. Returns 0 or a negative error code.
Definition at line 562 of file dovi_rpuenc.c.
Referenced by aom_encode(), eb_send_frame(), libx265_encode_frame(), and update_rpu().
int ff_dovi_guess_profile_hevc | ( | const AVDOVIRpuDataHeader * | hdr | ) |
Internal helper function to guess the correct DV profile for HEVC.
Returns the profile number or 0 if unknown.
Definition at line 71 of file dovi_rpu.c.
Referenced by ff_dovi_configure_ext(), ff_dovi_rpu_generate(), and ff_dovi_rpu_parse().
|
inlinestatic |
Definition at line 196 of file dovi_rpu.h.
Referenced by ff_dovi_rpu_generate(), parse_ext_blocks(), and try_reuse_ext().
const AVDOVIColorMetadata ff_dovi_color_default |
Definition at line 93 of file dovi_rpu.c.
Referenced by ff_dovi_rpu_generate(), and ff_dovi_rpu_parse().