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)
Unified · Split
| @@ -126,6 +126,7 @@ int ff_dovi_configure(DOVIContext *s, AVCodecContext *avctx); · 125 unmodified lines | |||
| 126 | enum { | 126 | enum { |
| 127 | FF_DOVI_WRAP_NAL = 1 << 0, ///< wrap inside NAL RBSP | 127 | FF_DOVI_WRAP_NAL = 1 << 0, ///< wrap inside NAL RBSP |
| 128 | FF_DOVI_WRAP_T35 = 1 << 1, ///< wrap inside T.35+EMDF | 128 | 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 | /** |
| @@ -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) |