FFmpeg
|
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/crc.h"
#include "libavutil/mem.h"
#include "libavutil/refstruct.h"
#include "avcodec.h"
#include "dovi_rpu.h"
#include "itut35.h"
#include "put_bits.h"
#include "put_golomb.h"
Go to the source code of this file.
Macros | |
#define | ANY6(arr) (arr[0] || arr[1] || arr[2] || arr[3] || arr[4] || arr[5]) |
#define | ANY_XY(xy) (xy.x.num || xy.y.num) |
#define | ANY_CSP(csp) |
Functions | |
static av_cold int | dovi_configure_ext (DOVIContext *s, enum AVCodecID codec_id, const AVDOVIMetadata *metadata, enum AVDOVICompression compression, int strict_std_compliance, int width, int height, AVRational framerate, enum AVPixelFormat pix_format, enum AVColorSpace color_space, enum AVColorPrimaries color_primaries, enum AVColorTransferCharacteristic color_trc, AVPacketSideData **coded_side_data, int *nb_coded_side_data) |
av_cold int | ff_dovi_configure_from_codedpar (DOVIContext *s, AVCodecParameters *par, const AVDOVIMetadata *metadata, enum AVDOVICompression compression, int strict_std_compliance) |
Configure the encoder for Dolby Vision encoding. More... | |
av_cold int | ff_dovi_configure (DOVIContext *s, AVCodecContext *avctx) |
Variant of ff_dovi_configure_from_codedpar which infers the codec parameters from an AVCodecContext. More... | |
static int | cmp_dm_level0 (const AVDOVIColorMetadata *dm1, const AVDOVIColorMetadata *dm2) |
static int | try_reuse_ext (DOVIExt *ext, const AVDOVIMetadata *metadata) |
static void | put_ue_coef (PutBitContext *pb, const AVDOVIRpuDataHeader *hdr, uint64_t coef) |
static void | put_se_coef (PutBitContext *pb, const AVDOVIRpuDataHeader *hdr, uint64_t coef) |
static int | av_q2den (AVRational q, int den) |
static void | generate_ext_v1 (PutBitContext *pb, const AVDOVIDmData *dm) |
static void | put_cie_xy (PutBitContext *pb, AVCIExy xy) |
static void | generate_ext_v2 (PutBitContext *pb, const AVDOVIDmData *dm) |
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... | |
Variables | |
struct { | |
uint64_t pps | |
int width | |
int main | |
int high | |
} | dv_levels [] |
#define ANY6 | ( | arr | ) | (arr[0] || arr[1] || arr[2] || arr[3] || arr[4] || arr[5]) |
Definition at line 447 of file dovi_rpuenc.c.
#define ANY_XY | ( | xy | ) | (xy.x.num || xy.y.num) |
Definition at line 448 of file dovi_rpuenc.c.
#define ANY_CSP | ( | csp | ) |
Definition at line 449 of file dovi_rpuenc.c.
|
static |
Definition at line 56 of file dovi_rpuenc.c.
Referenced by ff_dovi_configure(), and ff_dovi_configure_from_codedpar().
av_cold int ff_dovi_configure_from_codedpar | ( | 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 codecpar->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 248 of file dovi_rpuenc.c.
Referenced by dovi_rpu_init().
av_cold int ff_dovi_configure | ( | DOVIContext * | s, |
AVCodecContext * | avctx | ||
) |
Variant of ff_dovi_configure_from_codedpar
which infers the codec parameters from an AVCodecContext.
Definition at line 260 of file dovi_rpuenc.c.
Referenced by aom_init(), eb_enc_init(), and libx265_encode_init().
|
static |
Definition at line 280 of file dovi_rpuenc.c.
Referenced by ff_dovi_rpu_generate().
|
static |
Definition at line 304 of file dovi_rpuenc.c.
Referenced by ff_dovi_rpu_generate().
|
inlinestatic |
Definition at line 334 of file dovi_rpuenc.c.
Referenced by ff_dovi_rpu_generate().
|
inlinestatic |
Definition at line 352 of file dovi_rpuenc.c.
Referenced by ff_dovi_rpu_generate().
|
static |
Definition at line 370 of file dovi_rpuenc.c.
Referenced by ff_dovi_rpu_generate(), and put_cie_xy().
|
static |
Definition at line 378 of file dovi_rpuenc.c.
Referenced by ff_dovi_rpu_generate().
|
static |
Definition at line 440 of file dovi_rpuenc.c.
Referenced by generate_ext_v2().
|
static |
Definition at line 452 of file dovi_rpuenc.c.
Referenced by ff_dovi_rpu_generate().
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 567 of file dovi_rpuenc.c.
Referenced by aom_encode(), eb_send_frame(), libx265_encode_frame(), and update_rpu().
uint64_t pps |
Definition at line 36 of file dovi_rpuenc.c.
Referenced by alf_get_edges(), alf_get_subblocks(), alloc_cu(), alloc_frame(), base_unit_to_vk(), bcw_idx_decode(), build_qp_table(), can_split(), cbs_h264_read_nal_unit(), cbs_h264_write_nal_unit(), cbs_h265_read_nal_unit(), cbs_h265_write_nal_unit(), cbs_h266_read_nal_unit(), cbs_h266_write_nal_unit(), chroma_mc_bi(), chroma_mc_uni(), chroma_qp_offset_decode(), chroma_tc(), coding_tree_bth(), coding_tree_btv(), coding_tree_qt(), colour_mapping_octants(), colour_mapping_table(), ctu_nz_tl_init(), ctu_rs(), ctu_xy(), d3d12va_encode_hevc_init_sequence_params(), deblocking_filter_CTB(), decode_ph(), decode_pps(), decode_scaling_matrices(), decode_slice_data(), delta_dlt(), derive_center_luma_intra_pred_mode(), derive_chroma_intra_pred_mode(), derive_dmvr_bdof_flag(), derive_spatial_merge_candidates(), derive_weight(), derive_weight_uni(), dovi_configure_ext(), dual_tree_implicit_qt_split(), emulated_edge(), end_of_access_unit_found(), export_frame_params(), ff_dxva2_h264_fill_picture_parameters(), ff_dxva2_h264_fill_scaling_lists(), ff_dxva2_hevc_fill_picture_parameters(), ff_evc_derive_poc(), ff_evc_parse_pps(), ff_evc_parse_slice_header(), ff_h264_decode_picture_parameter_set(), ff_h264_execute_ref_pic_marking(), ff_h264_parse_ref_count(), ff_h264_queue_decode_slice(), ff_hevc_cabac_init(), ff_hevc_deblocking_boundary_strengths(), ff_hevc_decode_nal_pps(), ff_hevc_frame_nb_refs(), ff_hevc_hls_filter(), ff_hevc_hls_filters(), ff_hevc_hls_residual_coding(), ff_hevc_luma_mv_merge_mode(), ff_hevc_luma_mv_mvp_mode(), ff_hevc_save_states(), ff_hevc_set_qPy(), ff_hw_base_encode_init_params_h264(), ff_hw_base_encode_init_params_h265(), ff_intra_pred_8_16x16_msa(), ff_intra_pred_8_32x32_msa(), ff_isom_write_avcc(), ff_videotoolbox_hvcc_extradata_create(), ff_vvc_cabac_init(), ff_vvc_coding_tree_unit(), ff_vvc_frame_thread_init(), ff_vvc_slice_rpl(), ff_vvc_split_cu_flag(), fill_dmvr_info(), generate_missing_ref(), get_chroma_qp(), get_qp_y_pred(), get_qPy_pred(), h264_extradata_to_annexb(), h264_probe(), h264_redundant_pps_fixup_pps(), h264_redundant_pps_fixup_slice(), h264_slice_header_parse(), h265_metadata_guess_level(), hevc_frame_start(), hevc_luma_mv_mvp_mode(), hevc_parse_slice_header(), hevc_pps_free(), hevc_probe(), hls_coding_quadtree(), hls_coding_tree(), hls_coding_tree_unit(), hls_coding_unit(), hls_decode_entry(), hls_decode_entry_wpp(), hls_decode_neighbour(), hls_pcm_sample(), hls_prediction_unit(), hls_sao_param(), hls_slice_data_wpp(), hls_slice_header(), hls_transform_tree(), hls_transform_unit(), ibc_tl_init(), init_dequant4_coeff_table(), init_dequant8_coeff_table(), init_dequant_tables(), intra_luma_pred_modes(), intra_pred(), is_diff_mer(), is_first_row(), ispmf_tl_init(), luma_mc_bi(), luma_mc_uni(), min_cb_nz_tl_init(), min_cb_tl_init(), min_pu_nz_tl_init(), min_pu_tl_init(), min_tu_nz_tl_init(), min_tu_tl_init(), msm_tl_init(), nvdec_h264_start_frame(), nvdec_hevc_start_frame(), palette_qp(), parse_feedback_units(), parse_nal_unit(), ph_derive(), ph_vb(), pic_arrays_init(), pixel_buffer_nz_tl_init(), pps_3d_extension(), pps_add_ctus(), pps_alloc(), pps_bd(), pps_chroma_qp_offset(), pps_derive(), pps_free(), pps_multi_tiles_slice(), pps_multilayer_extension(), pps_no_rect_slice(), pps_one_tile_slices(), pps_range_extensions(), pps_rect_slice(), pps_ref_wraparound_offset(), pps_scc_extension(), pps_single_slice_per_subpic(), pps_single_slice_picture(), pps_slice_map(), pps_subpic(), pps_subpic_less_than_one_tile_slice(), pps_subpic_one_or_more_tiles_slice(), pps_subpic_slice(), pps_width_height(), pred_get_y(), restore_tqb_pixels(), sao_filter_CTB(), sao_get_edges(), sb_clip_location(), set_cb_pos(), set_cb_tab(), set_dmvr_info(), set_parser_ctx(), set_pps(), set_qp_c(), setup_pps(), sh_derive(), sh_entry_points(), sh_inter(), sh_qp_y(), sh_slice_address(), subpic_get_rect(), subpic_tiles(), temporal_luma_motion_vector(), tile_xy(), vaapi_encode_h264_init_sequence_params(), vaapi_encode_h264_init_slice_params(), vaapi_encode_h265_init_sequence_params(), vaapi_encode_h265_init_slice_params(), vaapi_h264_start_frame(), vaapi_hevc_start_frame(), vaapi_vvc_decode_slice(), vaapi_vvc_start_frame(), vdpau_h264_start_frame(), vdpau_hevc_start_frame(), vk_hevc_end_frame(), vk_hevc_start_frame(), and vvc_probe().
int width |
Definition at line 37 of file dovi_rpuenc.c.
Referenced by dovi_configure_ext().
int main |
Definition at line 38 of file dovi_rpuenc.c.
Referenced by compute_vif2(), do_vif(), ff_mjpeg_encode_stuffing(), generate_tape_maps(), init_filter(), init_gblur_pipeline(), init_vulkan(), ssim360_4x4x2_tape(), ssim360_4x4xn_8bit(), ssim360_plane_16bit(), ssim360_plane_8bit(), ssim360_tape(), and ssim_4x4xn_8bit().
int high |
Definition at line 39 of file dovi_rpuenc.c.
Referenced by ac_dec_bit(), ac_decode_bool(), ac_update(), arith2_rescale_interval(), assign_bits(), bcd2uint(), celt_bits2pulses(), cfhd_decode(), cfhd_encode_frame(), conv_down(), conv_up(), decode_signed_subexp_with_ref(), decode_type1(), eval_expr(), ff_aac_ac_decode(), ff_bgmc_decode(), ff_celt_bitalloc(), ff_double_threshold(), ff_opus_rc_dec_cdf(), ff_vorbis_ready_floor1_list(), filter(), filterfn(), get_lsp_poly(), horiz_filter(), horiz_filter_clip(), horiz_filter_clip_bayer(), idct_8x8(), interlaced_vertical_filter(), inverse_temporal_filter(), mpegaudiodec_common_init_static(), opus_rc_dec_update(), quantize(), rand_in(), read_var_block_data(), silk_stabilize_lsf(), snow_interleave_line_footer(), test_hf_g_filt(), tr_16x4(), tr_32x4(), vert_filter(), wavpack_encode_sample(), wv_unpack_dsd_fast(), and wv_unpack_dsd_high().
const { ... } dv_levels[] |
Referenced by dovi_configure_ext().