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
126enum {126enum {
127 FF_DOVI_WRAP_NAL = 1 << 0, ///< wrap inside NAL RBSP127 FF_DOVI_WRAP_NAL = 1 << 0, ///< wrap inside NAL RBSP
128 FF_DOVI_WRAP_T35 = 1 << 1, ///< wrap inside T.35+EMDF128 FF_DOVI_WRAP_T35 = 1 << 1, ///< wrap inside T.35+EMDF
129 FF_DOVI_COMPRESS_RPU = 1 << 2, ///< enable compression for this RPU
129};130};
130 131
131/**132/**
libavcodec/dovi_rpuenc.c+5−1
@@ -444,6 +444,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 443 unmodified lines
444 int vdr_dm_metadata_present, vdr_rpu_id, use_prev_vdr_rpu, profile,444 int vdr_dm_metadata_present, vdr_rpu_id, use_prev_vdr_rpu, profile,
445 buffer_size, rpu_size, pad, zero_run;445 buffer_size, rpu_size, pad, zero_run;
446 int num_ext_blocks_v1, num_ext_blocks_v2;446 int num_ext_blocks_v1, num_ext_blocks_v2;
447 int dv_md_compression = s->cfg.dv_md_compression;
447 uint32_t crc;448 uint32_t crc;
448 uint8_t *dst;449 uint8_t *dst;
449 if (!metadata) {450 if (!metadata) {
@@ -463,6 +464,9 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 13 unmodified lines
463 return AVERROR_INVALIDDATA;464 return AVERROR_INVALIDDATA;
464 }465 }
465 466
467 if (!(flags & FF_DOVI_COMPRESS_RPU))
468 dv_md_compression = AV_DOVI_COMPRESSION_NONE;
469
466 vdr_rpu_id = mapping->vdr_rpu_id;470 vdr_rpu_id = mapping->vdr_rpu_id;
467 use_prev_vdr_rpu = 0;471 use_prev_vdr_rpu = 0;
468 472
@@ -472,7 +476,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 3 unmodified lines
472 return AVERROR(ENOMEM);476 return AVERROR(ENOMEM);
473 }477 }
474 478
475 switch (s->cfg.dv_md_compression) {479 switch (dv_md_compression) {
476 case AV_DOVI_COMPRESSION_LIMITED:480 case AV_DOVI_COMPRESSION_LIMITED:
477 /* Limited metadata compression requires vdr_rpi_id == 0 */481 /* Limited metadata compression requires vdr_rpi_id == 0 */
478 if (vdr_rpu_id != 0)482 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