avcodec/dovi_rpu: attach ext blocks to frames

This commit is contained in:
Niklas Haas 2024-03-23 16:53:14 +01:00
parent f46fff27d0
commit 9073f49e6e
1 changed files with 5 additions and 1 deletions

View File

@ -95,7 +95,7 @@ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame)
AVFrameSideData *sd;
AVBufferRef *buf;
AVDOVIMetadata *dovi;
size_t dovi_size;
size_t dovi_size, ext_sz;
if (!s->mapping || !s->color)
return 0; /* incomplete dovi metadata */
@ -121,6 +121,10 @@ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame)
COPY(AVDOVIRpuDataHeader, av_dovi_get_header(dovi), &s->header, disable_residual_flag);
COPY(AVDOVIDataMapping, av_dovi_get_mapping(dovi), s->mapping, nlq_pivots);
COPY(AVDOVIColorMetadata, av_dovi_get_color(dovi), s->color, source_diagonal);
ext_sz = FFMIN(sizeof(AVDOVIDmData), dovi->ext_block_size);
for (int i = 0; i < s->num_ext_blocks; i++)
memcpy(av_dovi_get_ext(dovi, i), &s->ext_blocks[i], ext_sz);
dovi->num_ext_blocks = s->num_ext_blocks;
return 0;
}