[FFmpeg-devel] [PATCH v3 07/11] avcodec: add cbs for h266/vvc
James Almer
jamrial at gmail.com
Thu Jan 14 06:22:31 EET 2021
On 1/11/2021 1:33 PM, Nuo Mi wrote:
> @@ -1218,6 +1464,20 @@ static int cbs_h2645_unit_requires_zero_byte(enum AVCodecID codec_id,
> return type == H264_NAL_SPS || type == H264_NAL_PPS;
> if (codec_id == AV_CODEC_ID_HEVC)
> return type == HEVC_NAL_VPS || type == HEVC_NAL_SPS || type == HEVC_NAL_PPS;
> + if (codec_id == AV_CODEC_ID_VVC) {
> + switch (type) {
> + case VVC_DCI_NUT:
> + case VVC_OPI_NUT:
> + case VVC_VPS_NUT:
> + case VVC_SPS_NUT:
> + case VVC_PPS_NUT:
> + case VVC_PREFIX_APS_NUT:
> + case VVC_SUFFIX_APS_NUT:
> + return 1;
> + default:
> + return 0;
> + }
return type >= VVC_OPI_NUT && type <= VVC_SUFFIX_APS_NUT;
> + }
> return 0;
> }
>
> @@ -1369,6 +1629,34 @@ static void cbs_h265_close(CodedBitstreamContext *ctx)
> av_buffer_unref(&h265->pps_ref[i]);
> }
>
> +static void cbs_h266_flush(CodedBitstreamContext *ctx)
> +{
> + CodedBitstreamH266Context *h266 = ctx->priv_data;
> +
> + for (int i = 0; i < FF_ARRAY_ELEMS(h266->sps); i++) {
> + av_buffer_unref(&h266->sps_ref[i]);
> + h266->sps[i] = NULL;
> + }
> + for (int i = 0; i < FF_ARRAY_ELEMS(h266->pps); i++) {
> + av_buffer_unref(&h266->pps_ref[i]);
> + h266->pps[i] = NULL;
> + }
> + av_buffer_unref(&h266->ph_ref);
> + h266->ph = NULL;
> +
> + h266->active_sps = NULL;
> + h266->active_pps = NULL;
> +}
> +
> +static void cbs_h266_close(CodedBitstreamContext *ctx)
> +{
> + CodedBitstreamH266Context *h266 = ctx->priv_data;
> +
> + cbs_h266_flush(ctx);
> + ff_h2645_packet_uninit(&h266->common.read_packet);
> +
> + }
> +
> static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload)
> {
> switch (payload->payload_type) {
> @@ -1513,6 +1801,76 @@ static const CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types[] = {
> CBS_UNIT_TYPE_END_OF_LIST
> };
>
> +static void cbs_h266_free_sei(void *opaque, uint8_t *content)
> +{
> +}
static void cbs_h266_free_sei_payload(H266RawSEIPayload *payload)
{
switch (payload->payload_type) {
case VVC_SEI_TYPE_DECODED_PICTURE_HASH:
break;
default:
av_buffer_unref(&payload->payload.other.data_ref);
break;
}
av_buffer_unref(&payload->extension_data.data_ref);
}
static void cbs_h266_free_sei(void *opaque, uint8_t *content)
{
H266RawSEI *sei = (H266RawSEI*)content;
for (int i = 0; i < sei->payload_count; i++)
cbs_h266_free_sei_payload(&sei->payload[i]);
av_freep(&content);
}
More information about the ffmpeg-devel
mailing list