History

avcodec/dovi_rpuenc: also copy ext blocks to dovi ctx

As the comment implies, DOVIContext.ext_blocks should also reflect the current state after ff_dovi_rpu_generate(). Fluff for now, but will be needed once we start implementing metadata compression for extension blocks as well.

Niklas Haas committed 2 years ago

Commit bf924411 parent a93801b1 file · +12 −0Browse files

Unified · Split

libavcodec/dovi_rpuenc.c+12−0
@@ -506,6 +506,12 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 505 unmodified lines
506 }506 }
507 }507 }
508 508
509 if (metadata->num_ext_blocks && !s->ext_blocks) {
510 s->ext_blocks = ff_refstruct_allocz(sizeof(AVDOVIDmData) * AV_DOVI_MAX_EXT_BLOCKS);
511 if (!s->ext_blocks)
512 return AVERROR(ENOMEM);
513 }
514
509 vdr_dm_metadata_present = memcmp(color, &ff_dovi_color_default, sizeof(*color));515 vdr_dm_metadata_present = memcmp(color, &ff_dovi_color_default, sizeof(*color));
510 use_prev_vdr_rpu = !memcmp(s->vdr[vdr_rpu_id], mapping, sizeof(*mapping));516 use_prev_vdr_rpu = !memcmp(s->vdr[vdr_rpu_id], mapping, sizeof(*mapping));
511 if (num_ext_blocks_v1 || num_ext_blocks_v2)517 if (num_ext_blocks_v1 || num_ext_blocks_v2)
@@ -636,6 +642,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 124 unmodified lines
636 }642 }
637 643
638 if (vdr_dm_metadata_present) {644 if (vdr_dm_metadata_present) {
645 size_t ext_sz;
639 const int denom = profile == 4 ? (1 << 30) : (1 << 28);646 const int denom = profile == 4 ? (1 << 30) : (1 << 28);
640 set_ue_golomb(pb, color->dm_metadata_id); /* affected_dm_id */647 set_ue_golomb(pb, color->dm_metadata_id); /* affected_dm_id */
641 set_ue_golomb(pb, color->dm_metadata_id); /* current_dm_id */648 set_ue_golomb(pb, color->dm_metadata_id); /* current_dm_id */
@@ -673,6 +680,11 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, · 31 unmodified lines
673 for (int i = 0; i < metadata->num_ext_blocks; i++)680 for (int i = 0; i < metadata->num_ext_blocks; i++)
674 generate_ext_v2(pb, av_dovi_get_ext(metadata, i));681 generate_ext_v2(pb, av_dovi_get_ext(metadata, i));
675 }682 }
683
684 ext_sz = FFMIN(sizeof(AVDOVIDmData), metadata->ext_block_size);
685 for (int i = 0; i < metadata->num_ext_blocks; i++)
686 memcpy(&s->ext_blocks[i], av_dovi_get_ext(metadata, i), ext_sz);
687 s->num_ext_blocks = metadata->num_ext_blocks;
676 } else {688 } else {
677 s->color = &ff_dovi_color_default;689 s->color = &ff_dovi_color_default;
678 s->num_ext_blocks = 0;690 s->num_ext_blocks = 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