mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/dovi_rpu: simplify vdr type
Storing the color metadata alongside the data mapping is no longer needed, so we can simplify this array's type.
This commit is contained in:
parent
ae7bff55df
commit
7bf08a5b2d
@ -75,7 +75,7 @@ typedef struct DOVIContext {
|
|||||||
* Private fields internal to dovi_rpu.c
|
* Private fields internal to dovi_rpu.c
|
||||||
*/
|
*/
|
||||||
AVDOVIColorMetadata *dm; ///< RefStruct
|
AVDOVIColorMetadata *dm; ///< RefStruct
|
||||||
struct DOVIVdr *vdr[DOVI_MAX_DM_ID+1]; ///< RefStruct references
|
AVDOVIDataMapping *vdr[DOVI_MAX_DM_ID+1]; ///< RefStruct references
|
||||||
uint8_t *rpu_buf; ///< temporary buffer
|
uint8_t *rpu_buf; ///< temporary buffer
|
||||||
unsigned rpu_buf_sz;
|
unsigned rpu_buf_sz;
|
||||||
|
|
||||||
@ -127,11 +127,6 @@ int ff_dovi_configure(DOVIContext *s, AVCodecContext *avctx);
|
|||||||
* The following section is for internal use only. *
|
* The following section is for internal use only. *
|
||||||
***************************************************/
|
***************************************************/
|
||||||
|
|
||||||
typedef struct DOVIVdr {
|
|
||||||
AVDOVIDataMapping mapping;
|
|
||||||
AVDOVIColorMetadata color;
|
|
||||||
} DOVIVdr;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
RPU_COEFF_FIXED = 0,
|
RPU_COEFF_FIXED = 0,
|
||||||
RPU_COEFF_FLOAT = 1,
|
RPU_COEFF_FLOAT = 1,
|
||||||
|
@ -465,18 +465,18 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size,
|
|||||||
prev_vdr_rpu_id);
|
prev_vdr_rpu_id);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
s->mapping = &s->vdr[prev_vdr_rpu_id]->mapping;
|
s->mapping = s->vdr[prev_vdr_rpu_id];
|
||||||
} else {
|
} else {
|
||||||
AVDOVIDataMapping *mapping;
|
AVDOVIDataMapping *mapping;
|
||||||
int vdr_rpu_id = get_ue_golomb_31(gb);
|
int vdr_rpu_id = get_ue_golomb_31(gb);
|
||||||
VALIDATE(vdr_rpu_id, 0, DOVI_MAX_DM_ID);
|
VALIDATE(vdr_rpu_id, 0, DOVI_MAX_DM_ID);
|
||||||
if (!s->vdr[vdr_rpu_id]) {
|
if (!s->vdr[vdr_rpu_id]) {
|
||||||
s->vdr[vdr_rpu_id] = ff_refstruct_allocz(sizeof(DOVIVdr));
|
s->vdr[vdr_rpu_id] = ff_refstruct_allocz(sizeof(AVDOVIDataMapping));
|
||||||
if (!s->vdr[vdr_rpu_id])
|
if (!s->vdr[vdr_rpu_id])
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
s->mapping = mapping = &s->vdr[vdr_rpu_id]->mapping;
|
s->mapping = mapping = s->vdr[vdr_rpu_id];
|
||||||
mapping->vdr_rpu_id = vdr_rpu_id;
|
mapping->vdr_rpu_id = vdr_rpu_id;
|
||||||
mapping->mapping_color_space = get_ue_golomb_31(gb);
|
mapping->mapping_color_space = get_ue_golomb_31(gb);
|
||||||
mapping->mapping_chroma_format_idc = get_ue_golomb_31(gb);
|
mapping->mapping_chroma_format_idc = get_ue_golomb_31(gb);
|
||||||
|
@ -465,7 +465,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata,
|
|||||||
|
|
||||||
vdr_rpu_id = -1;
|
vdr_rpu_id = -1;
|
||||||
for (int i = 0; i <= DOVI_MAX_DM_ID; i++) {
|
for (int i = 0; i <= DOVI_MAX_DM_ID; i++) {
|
||||||
if (s->vdr[i] && !memcmp(&s->vdr[i]->mapping, mapping, sizeof(*mapping))) {
|
if (s->vdr[i] && !memcmp(s->vdr[i], mapping, sizeof(*mapping))) {
|
||||||
vdr_rpu_id = i;
|
vdr_rpu_id = i;
|
||||||
break;
|
break;
|
||||||
} else if (vdr_rpu_id < 0 && (!s->vdr[i] || i == DOVI_MAX_DM_ID)) {
|
} else if (vdr_rpu_id < 0 && (!s->vdr[i] || i == DOVI_MAX_DM_ID)) {
|
||||||
@ -474,7 +474,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!s->vdr[vdr_rpu_id]) {
|
if (!s->vdr[vdr_rpu_id]) {
|
||||||
s->vdr[vdr_rpu_id] = ff_refstruct_allocz(sizeof(DOVIVdr));
|
s->vdr[vdr_rpu_id] = ff_refstruct_allocz(sizeof(AVDOVIDataMapping));
|
||||||
if (!s->vdr[vdr_rpu_id])
|
if (!s->vdr[vdr_rpu_id])
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
@ -507,7 +507,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata,
|
|||||||
}
|
}
|
||||||
|
|
||||||
vdr_dm_metadata_present = memcmp(color, &ff_dovi_color_default, sizeof(*color));
|
vdr_dm_metadata_present = memcmp(color, &ff_dovi_color_default, sizeof(*color));
|
||||||
use_prev_vdr_rpu = !memcmp(&s->vdr[vdr_rpu_id]->mapping, mapping, sizeof(*mapping));
|
use_prev_vdr_rpu = !memcmp(s->vdr[vdr_rpu_id], mapping, sizeof(*mapping));
|
||||||
|
|
||||||
if (vdr_dm_metadata_present && !s->dm) {
|
if (vdr_dm_metadata_present && !s->dm) {
|
||||||
s->dm = ff_refstruct_allocz(sizeof(AVDOVIColorMetadata));
|
s->dm = ff_refstruct_allocz(sizeof(AVDOVIColorMetadata));
|
||||||
@ -563,7 +563,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata,
|
|||||||
put_bits(pb, 1, vdr_dm_metadata_present);
|
put_bits(pb, 1, vdr_dm_metadata_present);
|
||||||
put_bits(pb, 1, use_prev_vdr_rpu);
|
put_bits(pb, 1, use_prev_vdr_rpu);
|
||||||
set_ue_golomb(pb, vdr_rpu_id);
|
set_ue_golomb(pb, vdr_rpu_id);
|
||||||
s->mapping = &s->vdr[vdr_rpu_id]->mapping;
|
s->mapping = s->vdr[vdr_rpu_id];
|
||||||
|
|
||||||
profile = s->cfg.dv_profile ? s->cfg.dv_profile : ff_dovi_guess_profile_hevc(hdr);
|
profile = s->cfg.dv_profile ? s->cfg.dv_profile : ff_dovi_guess_profile_hevc(hdr);
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&s->vdr[vdr_rpu_id]->mapping, mapping, sizeof(*mapping));
|
memcpy(s->vdr[vdr_rpu_id], mapping, sizeof(*mapping));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vdr_dm_metadata_present) {
|
if (vdr_dm_metadata_present) {
|
||||||
|
Loading…
Reference in New Issue
Block a user