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
506506 }
507507 }
508508
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+
509515 vdr_dm_metadata_present = memcmp(color, &ff_dovi_color_default, sizeof(*color));
510516 use_prev_vdr_rpu = !memcmp(s->vdr[vdr_rpu_id], mapping, sizeof(*mapping));
511517 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
636642 }
637643
638644 if (vdr_dm_metadata_present) {
645+ size_t ext_sz;
639646 const int denom = profile == 4 ? (1 << 30) : (1 << 28);
640647 set_ue_golomb(pb, color->dm_metadata_id); /* affected_dm_id */
641648 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
673680 for (int i = 0; i < metadata->num_ext_blocks; i++)
674681 generate_ext_v2(pb, av_dovi_get_ext(metadata, i));
675682 }
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;
676688 } else {
677689 s->color = &ff_dovi_color_default;
678690 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