History

avcodec/dovi_rpuenc: add a flag to enable compression

Keyframes must reset the metadata compression state, so we need to also signal this at rpu generation time. Default to uncompressed, because encoders cannot generally know if a given frame will be a keyframe before they finish encoding, but also cannot retroactively attach the RPU. (Within the confines of current APIs)

Niklas Haas committed 2 years ago

Commit ae3a7851 parent b3bc8f82 files · +6 −1Browse files

Unified · Split

2 files
  1. libavcodec/dovi_rpu.h +1 −0
  2. libavcodec/dovi_rpuenc.c +5 −1
libavcodec/dovi_rpu.h+1−0
@@ -126,6 +126,7 @@ int ff_dovi_configure(DOVIContext *s, AVCodecContext *avctx); · 125 unmodified lines
126126 enum {
127127 FF_DOVI_WRAP_NAL = 1 << 0, ///< wrap inside NAL RBSP
128128 FF_DOVI_WRAP_T35 = 1 << 1, ///< wrap inside T.35+EMDF
129+ FF_DOVI_COMPRESS_RPU = 1 << 2, ///< enable compression for this RPU
129130 };
130131
131132 /**
libavcodec/dovi_rpuenc.c+5−1
@@ -444,6 +444,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 443 unmodified lines
444444 int vdr_dm_metadata_present, vdr_rpu_id, use_prev_vdr_rpu, profile,
445445 buffer_size, rpu_size, pad, zero_run;
446446 int num_ext_blocks_v1, num_ext_blocks_v2;
447+ int dv_md_compression = s->cfg.dv_md_compression;
447448 uint32_t crc;
448449 uint8_t *dst;
449450 if (!metadata) {
@@ -463,6 +464,9 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 13 unmodified lines
463464 return AVERROR_INVALIDDATA;
464465 }
465466
467+ if (!(flags & FF_DOVI_COMPRESS_RPU))
468+ dv_md_compression = AV_DOVI_COMPRESSION_NONE;
469+
466470 vdr_rpu_id = mapping->vdr_rpu_id;
467471 use_prev_vdr_rpu = 0;
468472
@@ -472,7 +476,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 3 unmodified lines
472476 return AVERROR(ENOMEM);
473477 }
474478
475− switch (s->cfg.dv_md_compression) {
479+ switch (dv_md_compression) {
476480 case AV_DOVI_COMPRESSION_LIMITED:
477481 /* Limited metadata compression requires vdr_rpi_id == 0 */
478482 if (vdr_rpu_id != 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t