|
|
|
@ -809,50 +809,6 @@ fail: |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void cbs_av1_free_tile_data(AV1RawTileData *td) |
|
|
|
|
{ |
|
|
|
|
av_buffer_unref(&td->data_ref); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void cbs_av1_free_padding(AV1RawPadding *pd) |
|
|
|
|
{ |
|
|
|
|
av_buffer_unref(&pd->payload_ref); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void cbs_av1_free_metadata(AV1RawMetadata *md) |
|
|
|
|
{ |
|
|
|
|
switch (md->metadata_type) { |
|
|
|
|
case AV1_METADATA_TYPE_ITUT_T35: |
|
|
|
|
av_buffer_unref(&md->metadata.itut_t35.payload_ref); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void cbs_av1_free_obu(void *opaque, uint8_t *content) |
|
|
|
|
{ |
|
|
|
|
AV1RawOBU *obu = (AV1RawOBU*)content; |
|
|
|
|
|
|
|
|
|
switch (obu->header.obu_type) { |
|
|
|
|
case AV1_OBU_TILE_GROUP: |
|
|
|
|
cbs_av1_free_tile_data(&obu->obu.tile_group.tile_data); |
|
|
|
|
break; |
|
|
|
|
case AV1_OBU_FRAME: |
|
|
|
|
cbs_av1_free_tile_data(&obu->obu.frame.tile_group.tile_data); |
|
|
|
|
break; |
|
|
|
|
case AV1_OBU_TILE_LIST: |
|
|
|
|
cbs_av1_free_tile_data(&obu->obu.tile_list.tile_data); |
|
|
|
|
break; |
|
|
|
|
case AV1_OBU_METADATA: |
|
|
|
|
cbs_av1_free_metadata(&obu->obu.metadata); |
|
|
|
|
break; |
|
|
|
|
case AV1_OBU_PADDING: |
|
|
|
|
cbs_av1_free_padding(&obu->obu.padding); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
av_freep(&obu); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int cbs_av1_ref_tile_data(CodedBitstreamContext *ctx, |
|
|
|
|
CodedBitstreamUnit *unit, |
|
|
|
|
GetBitContext *gbc, |
|
|
|
@ -887,8 +843,7 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx, |
|
|
|
|
GetBitContext gbc; |
|
|
|
|
int err, start_pos, end_pos; |
|
|
|
|
|
|
|
|
|
err = ff_cbs_alloc_unit_content(unit, sizeof(*obu), |
|
|
|
|
&cbs_av1_free_obu); |
|
|
|
|
err = ff_cbs_alloc_unit_content2(ctx, unit); |
|
|
|
|
if (err < 0) |
|
|
|
|
return err; |
|
|
|
|
obu = unit->content; |
|
|
|
@ -1247,11 +1202,49 @@ static void cbs_av1_close(CodedBitstreamContext *ctx) |
|
|
|
|
av_buffer_unref(&priv->frame_header_ref); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void cbs_av1_free_metadata(void *unit, uint8_t *content) |
|
|
|
|
{ |
|
|
|
|
AV1RawOBU *obu = (AV1RawOBU*)content; |
|
|
|
|
AV1RawMetadata *md; |
|
|
|
|
|
|
|
|
|
av_assert0(obu->header.obu_type == AV1_OBU_METADATA); |
|
|
|
|
md = &obu->obu.metadata; |
|
|
|
|
|
|
|
|
|
switch (md->metadata_type) { |
|
|
|
|
case AV1_METADATA_TYPE_ITUT_T35: |
|
|
|
|
av_buffer_unref(&md->metadata.itut_t35.payload_ref); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const CodedBitstreamUnitTypeDescriptor cbs_av1_unit_types[] = { |
|
|
|
|
CBS_UNIT_TYPE_POD(AV1_OBU_SEQUENCE_HEADER, AV1RawOBU), |
|
|
|
|
CBS_UNIT_TYPE_POD(AV1_OBU_TEMPORAL_DELIMITER, AV1RawOBU), |
|
|
|
|
CBS_UNIT_TYPE_POD(AV1_OBU_FRAME_HEADER, AV1RawOBU), |
|
|
|
|
CBS_UNIT_TYPE_POD(AV1_OBU_REDUNDANT_FRAME_HEADER, AV1RawOBU), |
|
|
|
|
|
|
|
|
|
CBS_UNIT_TYPE_INTERNAL_REF(AV1_OBU_TILE_GROUP, AV1RawOBU, |
|
|
|
|
obu.tile_group.tile_data.data), |
|
|
|
|
CBS_UNIT_TYPE_INTERNAL_REF(AV1_OBU_FRAME, AV1RawOBU, |
|
|
|
|
obu.frame.tile_group.tile_data.data), |
|
|
|
|
CBS_UNIT_TYPE_INTERNAL_REF(AV1_OBU_TILE_LIST, AV1RawOBU, |
|
|
|
|
obu.tile_list.tile_data.data), |
|
|
|
|
CBS_UNIT_TYPE_INTERNAL_REF(AV1_OBU_PADDING, AV1RawOBU, |
|
|
|
|
obu.padding.payload), |
|
|
|
|
|
|
|
|
|
CBS_UNIT_TYPE_COMPLEX(AV1_OBU_METADATA, AV1RawOBU, |
|
|
|
|
&cbs_av1_free_metadata), |
|
|
|
|
|
|
|
|
|
CBS_UNIT_TYPE_END_OF_LIST |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const CodedBitstreamType ff_cbs_type_av1 = { |
|
|
|
|
.codec_id = AV_CODEC_ID_AV1, |
|
|
|
|
|
|
|
|
|
.priv_data_size = sizeof(CodedBitstreamAV1Context), |
|
|
|
|
|
|
|
|
|
.unit_types = cbs_av1_unit_types, |
|
|
|
|
|
|
|
|
|
.split_fragment = &cbs_av1_split_fragment, |
|
|
|
|
.read_unit = &cbs_av1_read_unit, |
|
|
|
|
.write_unit = &cbs_av1_write_obu, |
|
|
|
|