avcodec/cbs: add cbs implementation for H266/VVC
Add CodedBitstreamContext to parse VPS,SPS,PPS in VVC nal units. Implement parsing and writing of SPS,PPS,VPS,PH,AUD,SEI and slices. Add ff_cbs_type_h266 to cbs types tables and AV_CODEC_ID_H266 to cbs codec ids. Co-authored-by: Thomas Siedel <thomas.ff@spin-digital.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
		
							parent
							
								
									136e96a8a8
								
							
						
					
					
						commit
						dfc62fd1c6
					
				
							
								
								
									
										2
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@ -2477,6 +2477,7 @@ CONFIG_EXTRA="
 | 
			
		||||
    cbs_av1
 | 
			
		||||
    cbs_h264
 | 
			
		||||
    cbs_h265
 | 
			
		||||
    cbs_h266
 | 
			
		||||
    cbs_jpeg
 | 
			
		||||
    cbs_mpeg2
 | 
			
		||||
    cbs_vp9
 | 
			
		||||
@ -2761,6 +2762,7 @@ threads_if_any="$THREADS_LIST"
 | 
			
		||||
cbs_av1_select="cbs"
 | 
			
		||||
cbs_h264_select="cbs"
 | 
			
		||||
cbs_h265_select="cbs"
 | 
			
		||||
cbs_h266_select="cbs"
 | 
			
		||||
cbs_jpeg_select="cbs"
 | 
			
		||||
cbs_mpeg2_select="cbs"
 | 
			
		||||
cbs_vp9_select="cbs"
 | 
			
		||||
 | 
			
		||||
@ -76,6 +76,7 @@ OBJS-$(CONFIG_CBS)                     += cbs.o cbs_bsf.o
 | 
			
		||||
OBJS-$(CONFIG_CBS_AV1)                 += cbs_av1.o
 | 
			
		||||
OBJS-$(CONFIG_CBS_H264)                += cbs_h2645.o cbs_sei.o h2645_parse.o
 | 
			
		||||
OBJS-$(CONFIG_CBS_H265)                += cbs_h2645.o cbs_sei.o h2645_parse.o
 | 
			
		||||
OBJS-$(CONFIG_CBS_H266)                += cbs_h2645.o cbs_sei.o h2645_parse.o
 | 
			
		||||
OBJS-$(CONFIG_CBS_JPEG)                += cbs_jpeg.o
 | 
			
		||||
OBJS-$(CONFIG_CBS_MPEG2)               += cbs_mpeg2.o
 | 
			
		||||
OBJS-$(CONFIG_CBS_VP9)                 += cbs_vp9.o
 | 
			
		||||
 | 
			
		||||
@ -40,6 +40,9 @@ static const CodedBitstreamType *const cbs_type_table[] = {
 | 
			
		||||
#if CONFIG_CBS_H265
 | 
			
		||||
    &ff_cbs_type_h265,
 | 
			
		||||
#endif
 | 
			
		||||
#if CONFIG_CBS_H266
 | 
			
		||||
    &ff_cbs_type_h266,
 | 
			
		||||
#endif
 | 
			
		||||
#if CONFIG_CBS_JPEG
 | 
			
		||||
    &ff_cbs_type_jpeg,
 | 
			
		||||
#endif
 | 
			
		||||
@ -61,6 +64,9 @@ const enum AVCodecID ff_cbs_all_codec_ids[] = {
 | 
			
		||||
#if CONFIG_CBS_H265
 | 
			
		||||
    AV_CODEC_ID_H265,
 | 
			
		||||
#endif
 | 
			
		||||
#if CONFIG_CBS_H266
 | 
			
		||||
    AV_CODEC_ID_H266,
 | 
			
		||||
#endif
 | 
			
		||||
#if CONFIG_CBS_JPEG
 | 
			
		||||
    AV_CODEC_ID_MJPEG,
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -24,9 +24,11 @@
 | 
			
		||||
#include "cbs_internal.h"
 | 
			
		||||
#include "cbs_h264.h"
 | 
			
		||||
#include "cbs_h265.h"
 | 
			
		||||
#include "cbs_h266.h"
 | 
			
		||||
#include "h264.h"
 | 
			
		||||
#include "h2645_parse.h"
 | 
			
		||||
#include "hevc.h"
 | 
			
		||||
#include "vvc.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
 | 
			
		||||
@ -255,6 +257,7 @@ static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t paylo
 | 
			
		||||
#define FUNC_NAME1(rw, codec, name) FUNC_NAME2(rw, codec, name)
 | 
			
		||||
#define FUNC_H264(name) FUNC_NAME1(READWRITE, h264, name)
 | 
			
		||||
#define FUNC_H265(name) FUNC_NAME1(READWRITE, h265, name)
 | 
			
		||||
#define FUNC_H266(name) FUNC_NAME1(READWRITE, h266, name)
 | 
			
		||||
#define FUNC_SEI(name)  FUNC_NAME1(READWRITE, sei,  name)
 | 
			
		||||
 | 
			
		||||
#define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
 | 
			
		||||
@ -369,6 +372,10 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
 | 
			
		||||
#include "cbs_h265_syntax_template.c"
 | 
			
		||||
#undef FUNC
 | 
			
		||||
 | 
			
		||||
#define FUNC(name) FUNC_H266(name)
 | 
			
		||||
#include "cbs_h266_syntax_template.c"
 | 
			
		||||
#undef FUNC
 | 
			
		||||
 | 
			
		||||
#undef READ
 | 
			
		||||
#undef READWRITE
 | 
			
		||||
#undef RWContext
 | 
			
		||||
@ -447,6 +454,10 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
 | 
			
		||||
#include "cbs_h265_syntax_template.c"
 | 
			
		||||
#undef FUNC
 | 
			
		||||
 | 
			
		||||
#define FUNC(name) FUNC_H266(name)
 | 
			
		||||
#include "cbs_h266_syntax_template.c"
 | 
			
		||||
#undef FUNC
 | 
			
		||||
 | 
			
		||||
#undef WRITE
 | 
			
		||||
#undef READWRITE
 | 
			
		||||
#undef RWContext
 | 
			
		||||
@ -476,8 +487,9 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx,
 | 
			
		||||
        const H2645NAL *nal = &packet->nals[i];
 | 
			
		||||
        AVBufferRef *ref;
 | 
			
		||||
        size_t size = nal->size;
 | 
			
		||||
        enum AVCodecID codec_id = ctx->codec->codec_id;
 | 
			
		||||
 | 
			
		||||
        if (nal->nuh_layer_id > 0)
 | 
			
		||||
        if (codec_id != AV_CODEC_ID_VVC && nal->nuh_layer_id > 0)
 | 
			
		||||
            continue;
 | 
			
		||||
 | 
			
		||||
        // Remove trailing zeroes.
 | 
			
		||||
@ -513,6 +525,12 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx,
 | 
			
		||||
    if (frag->data_size == 0)
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
    if (codec_id == AV_CODEC_ID_VVC) {
 | 
			
		||||
        //we deactive picture header here to avoid reuse previous au's ph.
 | 
			
		||||
        CodedBitstreamH266Context *h266 = ctx->priv_data;
 | 
			
		||||
        h266->priv.ph = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (header && frag->data[0] && codec_id == AV_CODEC_ID_H264) {
 | 
			
		||||
        // AVCC header.
 | 
			
		||||
        size_t size, start, end;
 | 
			
		||||
@ -640,6 +658,71 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx,
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    } else if(header && frag->data[0] && codec_id == AV_CODEC_ID_VVC) {
 | 
			
		||||
        // VVCC header.
 | 
			
		||||
        int ptl_present_flag, num_arrays;
 | 
			
		||||
        int b, i, j;
 | 
			
		||||
 | 
			
		||||
        priv->mp4 = 1;
 | 
			
		||||
 | 
			
		||||
        bytestream2_init(&gbc, frag->data, frag->data_size);
 | 
			
		||||
 | 
			
		||||
        b = bytestream2_get_byte(&gbc);
 | 
			
		||||
        priv->nal_length_size = ((b >> 1) & 3) + 1;
 | 
			
		||||
        ptl_present_flag = b & 1;
 | 
			
		||||
 | 
			
		||||
        if(ptl_present_flag) {
 | 
			
		||||
            int num_sublayers, num_bytes_constraint_info, num_sub_profiles;
 | 
			
		||||
            num_sublayers = (bytestream2_get_be16u(&gbc) >> 4) & 7;
 | 
			
		||||
            bytestream2_skip(&gbc, 1);
 | 
			
		||||
 | 
			
		||||
            // begin VvcPTLRecord(num_sublayers);
 | 
			
		||||
            num_bytes_constraint_info = bytestream2_get_byte(&gbc) & 0x3f;
 | 
			
		||||
            bytestream2_skip(&gbc, 2 + num_bytes_constraint_info);
 | 
			
		||||
            if(num_sublayers > 1) {
 | 
			
		||||
                int count_present_flags = 0;
 | 
			
		||||
                b = bytestream2_get_byte(&gbc);
 | 
			
		||||
                for(i = num_sublayers - 2; i >= 0; i--) {
 | 
			
		||||
                    if((b >> (7 - (num_sublayers - 2 - i))) & 0x01)
 | 
			
		||||
                        count_present_flags++;
 | 
			
		||||
                }
 | 
			
		||||
                bytestream2_skip(&gbc, count_present_flags);
 | 
			
		||||
            }
 | 
			
		||||
            num_sub_profiles = bytestream2_get_byte(&gbc);
 | 
			
		||||
            bytestream2_skip(&gbc, num_sub_profiles * 4);
 | 
			
		||||
            // end VvcPTLRecord(num_sublayers);
 | 
			
		||||
 | 
			
		||||
            bytestream2_skip(&gbc, 3 * 2);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        num_arrays = bytestream2_get_byte(&gbc);
 | 
			
		||||
        for(j = 0; j < num_arrays; j++) {
 | 
			
		||||
            size_t start, end, size;
 | 
			
		||||
            int nal_unit_type = bytestream2_get_byte(&gbc) & 0x1f;
 | 
			
		||||
            unsigned int num_nalus = 1;
 | 
			
		||||
            if(nal_unit_type != VVC_DCI_NUT && nal_unit_type != VVC_OPI_NUT)
 | 
			
		||||
                num_nalus = bytestream2_get_be16u(&gbc);
 | 
			
		||||
 | 
			
		||||
            start = bytestream2_tell(&gbc);
 | 
			
		||||
            for(i = 0; i < num_nalus; i++) {
 | 
			
		||||
                size = bytestream2_get_be16(&gbc);
 | 
			
		||||
                bytestream2_skip(&gbc, size);
 | 
			
		||||
            }
 | 
			
		||||
            end = bytestream2_tell(&gbc);
 | 
			
		||||
 | 
			
		||||
            err = ff_h2645_packet_split(&priv->read_packet,
 | 
			
		||||
                                        frag->data + start, end - start,
 | 
			
		||||
                                        ctx->log_ctx, 1, 2, AV_CODEC_ID_VVC, 1, 1);
 | 
			
		||||
            if (err < 0) {
 | 
			
		||||
                av_log(ctx->log_ctx, AV_LOG_ERROR, "Failed to split "
 | 
			
		||||
                       "VVCC array %d (%d NAL units of type %d).\n",
 | 
			
		||||
                       i, num_nalus, nal_unit_type);
 | 
			
		||||
                return err;
 | 
			
		||||
            }
 | 
			
		||||
            err = cbs_h2645_fragment_add_nals(ctx, frag, &priv->read_packet);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        // Annex B, or later MP4 with already-known parameters.
 | 
			
		||||
 | 
			
		||||
@ -686,6 +769,46 @@ cbs_h2645_replace_ps(5, VPS, vps, vps_video_parameter_set_id)
 | 
			
		||||
cbs_h2645_replace_ps(5, SPS, sps, sps_seq_parameter_set_id)
 | 
			
		||||
cbs_h2645_replace_ps(5, PPS, pps, pps_pic_parameter_set_id)
 | 
			
		||||
 | 
			
		||||
#define cbs_h266_replace_ps(h26n, ps_name, ps_var, id_element) \
 | 
			
		||||
static int cbs_h26 ## h26n ## _replace_ ## ps_var(CodedBitstreamContext *ctx, \
 | 
			
		||||
                                                  CodedBitstreamUnit *unit)  \
 | 
			
		||||
{ \
 | 
			
		||||
    CodedBitstreamH26 ## h26n ## Context *priv = ctx->priv_data; \
 | 
			
		||||
    H26 ## h26n ## Raw ## ps_name *ps_var = unit->content; \
 | 
			
		||||
    unsigned int id = ps_var->id_element; \
 | 
			
		||||
    int err = ff_cbs_make_unit_refcounted(ctx, unit); \
 | 
			
		||||
    if (err < 0) \
 | 
			
		||||
        return err; \
 | 
			
		||||
    av_buffer_unref(&priv->ps_var ## _ref[id]); \
 | 
			
		||||
    av_assert0(unit->content_ref); \
 | 
			
		||||
    priv->ps_var ## _ref[id] = av_buffer_ref(unit->content_ref); \
 | 
			
		||||
    if (!priv->ps_var ## _ref[id]) \
 | 
			
		||||
        return AVERROR(ENOMEM); \
 | 
			
		||||
    priv->ps_var[id] = (H26 ## h26n ## Raw ## ps_name *)priv->ps_var ## _ref[id]->data; \
 | 
			
		||||
    return 0; \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
cbs_h266_replace_ps(6, VPS, vps, vps_video_parameter_set_id)
 | 
			
		||||
cbs_h266_replace_ps(6, SPS, sps, sps_seq_parameter_set_id)
 | 
			
		||||
cbs_h266_replace_ps(6, PPS, pps, pps_pic_parameter_set_id)
 | 
			
		||||
 | 
			
		||||
static int cbs_h266_replace_ph(CodedBitstreamContext *ctx,
 | 
			
		||||
                               CodedBitstreamUnit *unit)
 | 
			
		||||
{
 | 
			
		||||
    CodedBitstreamH266Context *h266 = ctx->priv_data;
 | 
			
		||||
    int err;
 | 
			
		||||
 | 
			
		||||
    h266->priv.ph = NULL;
 | 
			
		||||
    err = ff_cbs_make_unit_refcounted(ctx, unit);
 | 
			
		||||
    if (err < 0)
 | 
			
		||||
        return err;
 | 
			
		||||
    err = av_buffer_replace(&h266->priv.ph_ref, unit->content_ref);
 | 
			
		||||
    if (err < 0)
 | 
			
		||||
        return err;
 | 
			
		||||
    h266->priv.ph = (H266RawPH*)h266->priv.ph_ref->data;
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
 | 
			
		||||
                                  CodedBitstreamUnit *unit)
 | 
			
		||||
{
 | 
			
		||||
@ -926,6 +1049,130 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int cbs_h266_read_nal_unit(CodedBitstreamContext *ctx,
 | 
			
		||||
                                  CodedBitstreamUnit *unit)
 | 
			
		||||
{
 | 
			
		||||
    GetBitContext gbc;
 | 
			
		||||
    int err;
 | 
			
		||||
 | 
			
		||||
    err = init_get_bits8(&gbc, unit->data, unit->data_size);
 | 
			
		||||
    if (err < 0)
 | 
			
		||||
        return err;
 | 
			
		||||
 | 
			
		||||
    err = ff_cbs_alloc_unit_content(ctx, unit);
 | 
			
		||||
    if (err < 0)
 | 
			
		||||
        return err;
 | 
			
		||||
 | 
			
		||||
    switch (unit->type) {
 | 
			
		||||
    case VVC_VPS_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawVPS *vps = unit->content;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_read_vps(ctx, &gbc, vps);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_replace_vps(ctx, unit);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    case VVC_SPS_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawSPS *sps = unit->content;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_read_sps(ctx, &gbc, sps);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_replace_sps(ctx, unit);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_PPS_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawPPS *pps = unit->content;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_read_pps(ctx, &gbc, pps);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_replace_pps(ctx, unit);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_PH_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawPH *ph = unit->content;
 | 
			
		||||
            err = cbs_h266_read_ph(ctx, &gbc, ph);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
            err = cbs_h266_replace_ph(ctx, unit);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_TRAIL_NUT:
 | 
			
		||||
    case VVC_STSA_NUT:
 | 
			
		||||
    case VVC_RADL_NUT:
 | 
			
		||||
    case VVC_RASL_NUT:
 | 
			
		||||
    case VVC_IDR_W_RADL:
 | 
			
		||||
    case VVC_IDR_N_LP:
 | 
			
		||||
    case VVC_CRA_NUT:
 | 
			
		||||
    case VVC_GDR_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawSlice *slice = unit->content;
 | 
			
		||||
            int pos, len;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_read_slice_header(ctx, &gbc, &slice->header);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            if (!cbs_h2645_read_more_rbsp_data(&gbc))
 | 
			
		||||
                return AVERROR_INVALIDDATA;
 | 
			
		||||
 | 
			
		||||
            pos = get_bits_count(&gbc);
 | 
			
		||||
            len = unit->data_size;
 | 
			
		||||
 | 
			
		||||
            slice->data_size = len - pos / 8;
 | 
			
		||||
            slice->data_ref  = av_buffer_ref(unit->data_ref);
 | 
			
		||||
            if (!slice->data_ref)
 | 
			
		||||
                return AVERROR(ENOMEM);
 | 
			
		||||
            slice->data = unit->data + pos / 8;
 | 
			
		||||
            slice->data_bit_start = pos % 8;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_AUD_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            err = cbs_h266_read_aud(ctx, &gbc, unit->content);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_PREFIX_SEI_NUT:
 | 
			
		||||
    case VVC_SUFFIX_SEI_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            err = cbs_h266_read_sei(ctx, &gbc, unit->content,
 | 
			
		||||
                                    unit->type == VVC_PREFIX_SEI_NUT);
 | 
			
		||||
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
        return AVERROR(ENOSYS);
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int cbs_h2645_write_slice_data(CodedBitstreamContext *ctx,
 | 
			
		||||
                                      PutBitContext *pbc, const uint8_t *data,
 | 
			
		||||
                                      size_t data_size, int data_bit_start)
 | 
			
		||||
@ -1338,11 +1585,127 @@ static int cbs_h265_discarded_nal_unit(CodedBitstreamContext *ctx,
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int cbs_h266_write_nal_unit(CodedBitstreamContext *ctx,
 | 
			
		||||
                                   CodedBitstreamUnit *unit,
 | 
			
		||||
                                   PutBitContext *pbc)
 | 
			
		||||
{
 | 
			
		||||
    int err;
 | 
			
		||||
 | 
			
		||||
    switch (unit->type) {
 | 
			
		||||
    case VVC_VPS_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawVPS *vps = unit->content;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_write_vps(ctx, pbc, vps);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_replace_vps(ctx, unit);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    case VVC_SPS_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawSPS *sps = unit->content;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_write_sps(ctx, pbc, sps);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_replace_sps(ctx, unit);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_PPS_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawPPS *pps = unit->content;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_write_pps(ctx, pbc, pps);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_replace_pps(ctx, unit);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_PH_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawPH *ph = unit->content;
 | 
			
		||||
            err = cbs_h266_write_ph(ctx, pbc, ph);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_replace_ph(ctx, unit);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_TRAIL_NUT:
 | 
			
		||||
    case VVC_STSA_NUT:
 | 
			
		||||
    case VVC_RADL_NUT:
 | 
			
		||||
    case VVC_RASL_NUT:
 | 
			
		||||
    case VVC_IDR_W_RADL:
 | 
			
		||||
    case VVC_IDR_N_LP:
 | 
			
		||||
    case VVC_CRA_NUT:
 | 
			
		||||
    case VVC_GDR_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawSlice *slice = unit->content;
 | 
			
		||||
 | 
			
		||||
            err = cbs_h266_write_slice_header(ctx, pbc, &slice->header);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
 | 
			
		||||
            if (slice->data) {
 | 
			
		||||
                err = cbs_h2645_write_slice_data(ctx, pbc, slice->data,
 | 
			
		||||
                                                 slice->data_size,
 | 
			
		||||
                                                 slice->data_bit_start);
 | 
			
		||||
                if (err < 0)
 | 
			
		||||
                    return err;
 | 
			
		||||
            } else {
 | 
			
		||||
                // No slice data - that was just the header.
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_AUD_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            err = cbs_h266_write_aud(ctx, pbc, unit->content);
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VVC_PREFIX_SEI_NUT:
 | 
			
		||||
    case VVC_SUFFIX_SEI_NUT:
 | 
			
		||||
        {
 | 
			
		||||
            err = cbs_h266_write_sei(ctx, pbc, unit->content,
 | 
			
		||||
                                     unit->type == VVC_PREFIX_SEI_NUT);
 | 
			
		||||
 | 
			
		||||
            if (err < 0)
 | 
			
		||||
                return err;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
        av_log(ctx->log_ctx, AV_LOG_ERROR, "Write unimplemented for "
 | 
			
		||||
               "NAL unit type %"PRIu32".\n", unit->type);
 | 
			
		||||
        return AVERROR_PATCHWELCOME;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int cbs_h2645_unit_requires_zero_byte(enum AVCodecID codec_id,
 | 
			
		||||
                                             CodedBitstreamUnitType type,
 | 
			
		||||
                                             int nal_unit_index)
 | 
			
		||||
{
 | 
			
		||||
    // Section B.1.2 in H.264, section B.2.2 in H.265.
 | 
			
		||||
    // Section B.1.2 in H.264, section B.2.2 in H.265, H.266.
 | 
			
		||||
    if (nal_unit_index == 0) {
 | 
			
		||||
        // Assume that this is the first NAL unit in an access unit.
 | 
			
		||||
        return 1;
 | 
			
		||||
@ -1351,6 +1714,8 @@ 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)
 | 
			
		||||
        return type >= VVC_OPI_NUT && type <= VVC_SUFFIX_APS_NUT;
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1502,6 +1867,35 @@ 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->vps); i++) {
 | 
			
		||||
        av_buffer_unref(&h266->vps_ref[i]);
 | 
			
		||||
        h266->vps[i] = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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->priv.ph_ref);
 | 
			
		||||
    h266->priv.ph = 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(void *opaque, uint8_t *content)
 | 
			
		||||
{
 | 
			
		||||
    H264RawSEI *sei = (H264RawSEI*)content;
 | 
			
		||||
@ -1556,6 +1950,33 @@ static const CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types[] = {
 | 
			
		||||
    CBS_UNIT_TYPE_END_OF_LIST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void cbs_h266_free_sei(void *opaque, uint8_t *content)
 | 
			
		||||
{
 | 
			
		||||
    H266RawSEI *sei = (H266RawSEI*)content;
 | 
			
		||||
    ff_cbs_sei_free_message_list(&sei->message_list);
 | 
			
		||||
    av_free(content);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[] = {
 | 
			
		||||
    CBS_UNIT_TYPE_INTERNAL_REF(VVC_VPS_NUT, H266RawVPS, extension_data.data),
 | 
			
		||||
    CBS_UNIT_TYPE_INTERNAL_REF(VVC_SPS_NUT, H266RawSPS, extension_data.data),
 | 
			
		||||
    CBS_UNIT_TYPE_INTERNAL_REF(VVC_PPS_NUT, H266RawPPS, extension_data.data),
 | 
			
		||||
 | 
			
		||||
    CBS_UNIT_TYPE_POD(VVC_PH_NUT , H266RawPH),
 | 
			
		||||
    CBS_UNIT_TYPE_POD(VVC_AUD_NUT, H266RawAUD),
 | 
			
		||||
 | 
			
		||||
    CBS_UNIT_RANGE_INTERNAL_REF(VVC_TRAIL_NUT, VVC_RASL_NUT,
 | 
			
		||||
                                H266RawSlice, data),
 | 
			
		||||
 | 
			
		||||
    CBS_UNIT_RANGE_INTERNAL_REF(VVC_IDR_W_RADL, VVC_GDR_NUT,
 | 
			
		||||
                                H266RawSlice, data),
 | 
			
		||||
 | 
			
		||||
    CBS_UNIT_TYPES_COMPLEX((VVC_PREFIX_SEI_NUT, VVC_SUFFIX_SEI_NUT),
 | 
			
		||||
                           H266RawSEI, cbs_h266_free_sei),
 | 
			
		||||
 | 
			
		||||
    CBS_UNIT_TYPE_END_OF_LIST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const CodedBitstreamType ff_cbs_type_h264 = {
 | 
			
		||||
    .codec_id          = AV_CODEC_ID_H264,
 | 
			
		||||
 | 
			
		||||
@ -1590,6 +2011,22 @@ const CodedBitstreamType ff_cbs_type_h265 = {
 | 
			
		||||
    .close             = &cbs_h265_close,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const CodedBitstreamType ff_cbs_type_h266 = {
 | 
			
		||||
    .codec_id          = AV_CODEC_ID_VVC,
 | 
			
		||||
 | 
			
		||||
    .priv_data_size    = sizeof(CodedBitstreamH266Context),
 | 
			
		||||
 | 
			
		||||
    .unit_types        = cbs_h266_unit_types,
 | 
			
		||||
 | 
			
		||||
    .split_fragment    = &cbs_h2645_split_fragment,
 | 
			
		||||
    .read_unit         = &cbs_h266_read_nal_unit,
 | 
			
		||||
    .write_unit        = &cbs_h266_write_nal_unit,
 | 
			
		||||
    .assemble_fragment = &cbs_h2645_assemble_fragment,
 | 
			
		||||
 | 
			
		||||
    .flush             = &cbs_h266_flush,
 | 
			
		||||
    .close             = &cbs_h266_close,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const SEIMessageTypeDescriptor cbs_sei_common_types[] = {
 | 
			
		||||
    {
 | 
			
		||||
        SEI_TYPE_FILLER_PAYLOAD,
 | 
			
		||||
@ -1740,6 +2177,16 @@ static const SEIMessageTypeDescriptor cbs_sei_h265_types[] = {
 | 
			
		||||
    SEI_MESSAGE_TYPE_END
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const SEIMessageTypeDescriptor cbs_sei_h266_types[] = {
 | 
			
		||||
    {
 | 
			
		||||
        SEI_TYPE_DECODED_PICTURE_HASH,
 | 
			
		||||
        0, 1,
 | 
			
		||||
        sizeof(H266RawSEIDecodedPictureHash),
 | 
			
		||||
        SEI_MESSAGE_RW(h266, sei_decoded_picture_hash),
 | 
			
		||||
    },
 | 
			
		||||
    SEI_MESSAGE_TYPE_END
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const SEIMessageTypeDescriptor *ff_cbs_sei_find_type(CodedBitstreamContext *ctx,
 | 
			
		||||
                                                     int payload_type)
 | 
			
		||||
{
 | 
			
		||||
@ -1758,6 +2205,9 @@ const SEIMessageTypeDescriptor *ff_cbs_sei_find_type(CodedBitstreamContext *ctx,
 | 
			
		||||
    case AV_CODEC_ID_H265:
 | 
			
		||||
        codec_list = cbs_sei_h265_types;
 | 
			
		||||
        break;
 | 
			
		||||
    case AV_CODEC_ID_H266:
 | 
			
		||||
        codec_list = cbs_sei_h266_types;
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										783
									
								
								libavcodec/cbs_h266.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										783
									
								
								libavcodec/cbs_h266.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,783 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of FFmpeg.
 | 
			
		||||
 *
 | 
			
		||||
 * FFmpeg is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * FFmpeg is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with FFmpeg; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef AVCODEC_CBS_H266_H
 | 
			
		||||
#define AVCODEC_CBS_H266_H
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
#include "cbs_h2645.h"
 | 
			
		||||
#include "cbs_sei.h"
 | 
			
		||||
#include "vvc.h"
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawNALUnitHeader {
 | 
			
		||||
    uint8_t nuh_layer_id;
 | 
			
		||||
    uint8_t nal_unit_type;
 | 
			
		||||
    uint8_t nuh_temporal_id_plus1;
 | 
			
		||||
    uint8_t nuh_reserved_zero_bit;
 | 
			
		||||
} H266RawNALUnitHeader;
 | 
			
		||||
 | 
			
		||||
typedef struct H266GeneralConstraintsInfo {
 | 
			
		||||
    uint8_t gci_present_flag;
 | 
			
		||||
    /* general */
 | 
			
		||||
    uint8_t gci_intra_only_constraint_flag;
 | 
			
		||||
    uint8_t gci_all_layers_independent_constraint_flag;
 | 
			
		||||
    uint8_t gci_one_au_only_constraint_flag;
 | 
			
		||||
 | 
			
		||||
    /* picture format */
 | 
			
		||||
    uint8_t gci_sixteen_minus_max_bitdepth_constraint_idc;
 | 
			
		||||
    uint8_t gci_three_minus_max_chroma_format_constraint_idc;
 | 
			
		||||
 | 
			
		||||
    /* NAL unit type related */
 | 
			
		||||
    uint8_t gci_no_mixed_nalu_types_in_pic_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_trail_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_stsa_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_rasl_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_radl_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_idr_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_cra_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_gdr_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_aps_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_idr_rpl_constraint_flag;
 | 
			
		||||
 | 
			
		||||
    /* tile, slice, subpicture partitioning */
 | 
			
		||||
    uint8_t gci_one_tile_per_pic_constraint_flag;
 | 
			
		||||
    uint8_t gci_pic_header_in_slice_header_constraint_flag;
 | 
			
		||||
    uint8_t gci_one_slice_per_pic_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_rectangular_slice_constraint_flag;
 | 
			
		||||
    uint8_t gci_one_slice_per_subpic_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_subpic_info_constraint_flag;
 | 
			
		||||
 | 
			
		||||
    /* CTU and block partitioning */
 | 
			
		||||
    uint8_t gci_three_minus_max_log2_ctu_size_constraint_idc;
 | 
			
		||||
    uint8_t gci_no_partition_constraints_override_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_mtt_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_qtbtt_dual_tree_intra_constraint_flag;
 | 
			
		||||
 | 
			
		||||
    /* intra */
 | 
			
		||||
    uint8_t gci_no_palette_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_ibc_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_isp_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_mrl_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_mip_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_cclm_constraint_flag;
 | 
			
		||||
 | 
			
		||||
    /* inter */
 | 
			
		||||
    uint8_t gci_no_ref_pic_resampling_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_res_change_in_clvs_constraint_flag;;
 | 
			
		||||
    uint8_t gci_no_weighted_prediction_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_ref_wraparound_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_temporal_mvp_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_sbtmvp_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_amvr_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_bdof_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_smvd_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_dmvr_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_mmvd_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_affine_motion_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_prof_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_bcw_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_ciip_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_gpm_constraint_flag;
 | 
			
		||||
 | 
			
		||||
    /* transform, quantization, residual */
 | 
			
		||||
    uint8_t gci_no_luma_transform_size_64_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_transform_skip_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_bdpcm_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_mts_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_lfnst_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_joint_cbcr_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_sbt_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_act_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_explicit_scaling_list_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_dep_quant_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_sign_data_hiding_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_cu_qp_delta_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_chroma_qp_offset_constraint_flag;
 | 
			
		||||
 | 
			
		||||
    /* loop filter */
 | 
			
		||||
    uint8_t gci_no_sao_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_alf_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_ccalf_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_lmcs_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_ladf_constraint_flag;
 | 
			
		||||
    uint8_t gci_no_virtual_boundaries_constraint_flag;
 | 
			
		||||
    uint8_t gci_num_reserved_bits;
 | 
			
		||||
    uint8_t gci_reserved_zero_bit[255];
 | 
			
		||||
} H266GeneralConstraintsInfo;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawProfileTierLevel {
 | 
			
		||||
    uint8_t  general_profile_idc;
 | 
			
		||||
    uint8_t  general_tier_flag;
 | 
			
		||||
    uint8_t  general_level_idc;
 | 
			
		||||
    uint8_t  ptl_frame_only_constraint_flag;
 | 
			
		||||
    uint8_t  ptl_multilayer_enabled_flag;
 | 
			
		||||
    H266GeneralConstraintsInfo general_constraints_info;
 | 
			
		||||
    uint8_t  ptl_sublayer_level_present_flag[VVC_MAX_SUBLAYERS - 1];
 | 
			
		||||
    uint8_t  sublayer_level_idc[VVC_MAX_SUBLAYERS - 1];
 | 
			
		||||
    uint8_t  ptl_num_sub_profiles;
 | 
			
		||||
    uint32_t general_sub_profile_idc[VVC_MAX_SUB_PROFILES];
 | 
			
		||||
 | 
			
		||||
    uint8_t  ptl_reserved_zero_bit;
 | 
			
		||||
} H266RawProfileTierLevel;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawExtensionData {
 | 
			
		||||
    uint8_t     *data;
 | 
			
		||||
    AVBufferRef *data_ref;
 | 
			
		||||
    size_t       bit_length;
 | 
			
		||||
} H266RawExtensionData;
 | 
			
		||||
 | 
			
		||||
typedef struct H266DpbParameters {
 | 
			
		||||
    uint8_t dpb_max_dec_pic_buffering_minus1[VVC_MAX_SUBLAYERS];
 | 
			
		||||
    uint8_t dpb_max_num_reorder_pics[VVC_MAX_SUBLAYERS];
 | 
			
		||||
    uint8_t dpb_max_latency_increase_plus1[VVC_MAX_SUBLAYERS];
 | 
			
		||||
} H266DpbParameters;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RefPicListStruct {
 | 
			
		||||
    uint8_t num_ref_entries;
 | 
			
		||||
    uint8_t ltrp_in_header_flag;
 | 
			
		||||
    uint8_t inter_layer_ref_pic_flag[VVC_MAX_REF_ENTRIES];
 | 
			
		||||
    uint8_t st_ref_pic_flag[VVC_MAX_REF_ENTRIES];
 | 
			
		||||
    uint8_t abs_delta_poc_st[VVC_MAX_REF_ENTRIES];
 | 
			
		||||
    uint8_t strp_entry_sign_flag[VVC_MAX_REF_ENTRIES];
 | 
			
		||||
    uint8_t rpls_poc_lsb_lt[VVC_MAX_REF_ENTRIES];
 | 
			
		||||
    uint8_t ilrp_idx[VVC_MAX_REF_ENTRIES];
 | 
			
		||||
} H266RefPicListStruct;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RefPicLists {
 | 
			
		||||
    uint8_t  rpl_sps_flag[2];
 | 
			
		||||
    uint8_t  rpl_idx[2];
 | 
			
		||||
    H266RefPicListStruct rpl_ref_list[2];
 | 
			
		||||
    uint16_t poc_lsb_lt[2][VVC_MAX_REF_ENTRIES];
 | 
			
		||||
    uint8_t  delta_poc_msb_cycle_present_flag[2][VVC_MAX_REF_ENTRIES];
 | 
			
		||||
    uint16_t delta_poc_msb_cycle_lt[2][VVC_MAX_REF_ENTRIES];
 | 
			
		||||
} H266RefPicLists;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawGeneralTimingHrdParameters {
 | 
			
		||||
    uint32_t num_units_in_tick;
 | 
			
		||||
    uint32_t time_scale;
 | 
			
		||||
    uint8_t  general_nal_hrd_params_present_flag;
 | 
			
		||||
    uint8_t  general_vcl_hrd_params_present_flag;
 | 
			
		||||
    uint8_t  general_same_pic_timing_in_all_ols_flag;
 | 
			
		||||
    uint8_t  general_du_hrd_params_present_flag;
 | 
			
		||||
    uint8_t  tick_divisor_minus2;
 | 
			
		||||
    uint8_t  bit_rate_scale;
 | 
			
		||||
    uint8_t  cpb_size_scale;
 | 
			
		||||
    uint8_t  cpb_size_du_scale;
 | 
			
		||||
    uint8_t  hrd_cpb_cnt_minus1;
 | 
			
		||||
} H266RawGeneralTimingHrdParameters;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawSubLayerHRDParameters {
 | 
			
		||||
    uint32_t bit_rate_value_minus1[VVC_MAX_SUBLAYERS][VVC_MAX_CPB_CNT];
 | 
			
		||||
    uint32_t cpb_size_value_minus1[VVC_MAX_SUBLAYERS][VVC_MAX_CPB_CNT];
 | 
			
		||||
    uint32_t cpb_size_du_value_minus1[VVC_MAX_SUBLAYERS][VVC_MAX_CPB_CNT];
 | 
			
		||||
    uint32_t bit_rate_du_value_minus1[VVC_MAX_SUBLAYERS][VVC_MAX_CPB_CNT];
 | 
			
		||||
    uint8_t  cbr_flag[VVC_MAX_SUBLAYERS][VVC_MAX_CPB_CNT];
 | 
			
		||||
} H266RawSubLayerHRDParameters;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawOlsTimingHrdParameters {
 | 
			
		||||
    uint8_t  fixed_pic_rate_general_flag[VVC_MAX_SUBLAYERS];
 | 
			
		||||
    uint8_t  fixed_pic_rate_within_cvs_flag[VVC_MAX_SUBLAYERS];
 | 
			
		||||
    uint16_t elemental_duration_in_tc_minus1[VVC_MAX_SUBLAYERS];
 | 
			
		||||
    uint8_t  low_delay_hrd_flag[VVC_MAX_SUBLAYERS];
 | 
			
		||||
    H266RawSubLayerHRDParameters nal_sub_layer_hrd_parameters;
 | 
			
		||||
    H266RawSubLayerHRDParameters vcl_sub_layer_hrd_parameters;
 | 
			
		||||
} H266RawOlsTimingHrdParameters;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawVUI {
 | 
			
		||||
    uint8_t  vui_progressive_source_flag;
 | 
			
		||||
    uint8_t  vui_interlaced_source_flag;
 | 
			
		||||
    uint8_t  vui_non_packed_constraint_flag;
 | 
			
		||||
    uint8_t  vui_non_projected_constraint_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  vui_aspect_ratio_info_present_flag;
 | 
			
		||||
    uint8_t  vui_aspect_ratio_constant_flag;
 | 
			
		||||
    uint8_t  vui_aspect_ratio_idc;
 | 
			
		||||
 | 
			
		||||
    uint16_t vui_sar_width;
 | 
			
		||||
    uint16_t vui_sar_height;;
 | 
			
		||||
 | 
			
		||||
    uint8_t  vui_overscan_info_present_flag;
 | 
			
		||||
    uint8_t  vui_overscan_appropriate_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  vui_colour_description_present_flag;
 | 
			
		||||
    uint8_t  vui_colour_primaries;
 | 
			
		||||
 | 
			
		||||
    uint8_t  vui_transfer_characteristics;
 | 
			
		||||
    uint8_t  vui_matrix_coeffs;
 | 
			
		||||
    uint8_t  vui_full_range_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  vui_chroma_loc_info_present_flag;
 | 
			
		||||
    uint8_t  vui_chroma_sample_loc_type_frame;
 | 
			
		||||
    uint8_t  vui_chroma_sample_loc_type_top_field;
 | 
			
		||||
    uint8_t  vui_chroma_sample_loc_type_bottom_field;
 | 
			
		||||
    H266RawExtensionData extension_data;
 | 
			
		||||
} H266RawVUI;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawVPS {
 | 
			
		||||
    H266RawNALUnitHeader nal_unit_header;
 | 
			
		||||
 | 
			
		||||
    uint8_t  vps_video_parameter_set_id;
 | 
			
		||||
    uint8_t  vps_max_layers_minus1;
 | 
			
		||||
    uint8_t  vps_max_sublayers_minus1;
 | 
			
		||||
    uint8_t  vps_default_ptl_dpb_hrd_max_tid_flag;
 | 
			
		||||
    uint8_t  vps_all_independent_layers_flag;
 | 
			
		||||
    uint8_t  vps_layer_id[VVC_MAX_LAYERS];
 | 
			
		||||
    uint8_t  vps_independent_layer_flag[VVC_MAX_LAYERS];
 | 
			
		||||
    uint8_t  vps_max_tid_ref_present_flag[VVC_MAX_LAYERS];
 | 
			
		||||
    uint8_t  vps_direct_ref_layer_flag[VVC_MAX_LAYERS][VVC_MAX_LAYERS - 1];
 | 
			
		||||
    uint8_t  vps_max_tid_il_ref_pics_plus1[VVC_MAX_LAYERS][VVC_MAX_LAYERS - 1];
 | 
			
		||||
    uint8_t  vps_each_layer_is_an_ols_flag;
 | 
			
		||||
    uint8_t  vps_ols_mode_idc;
 | 
			
		||||
    uint8_t  vps_num_output_layer_sets_minus2;
 | 
			
		||||
    uint8_t  vps_ols_output_layer_flag[VVC_MAX_TOTAL_NUM_OLSS][VVC_MAX_LAYERS];
 | 
			
		||||
 | 
			
		||||
    uint8_t  vps_num_ptls_minus1;
 | 
			
		||||
    uint8_t  vps_pt_present_flag[VVC_MAX_PTLS];
 | 
			
		||||
    uint8_t  vps_ptl_max_tid[VVC_MAX_PTLS];
 | 
			
		||||
    H266RawProfileTierLevel vps_profile_tier_level[VVC_MAX_PTLS];
 | 
			
		||||
    uint8_t  vps_ols_ptl_idx[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
 | 
			
		||||
    uint16_t vps_num_dpb_params_minus1;
 | 
			
		||||
    uint8_t  vps_sublayer_dpb_params_present_flag;
 | 
			
		||||
    uint8_t  vps_dpb_max_tid[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
    H266DpbParameters vps_dpb_params[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
    uint16_t vps_ols_dpb_pic_width[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
    uint16_t vps_ols_dpb_pic_height[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
    uint8_t  vps_ols_dpb_chroma_format[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
    uint8_t  vps_ols_dpb_bitdepth_minus8[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
    uint16_t vps_ols_dpb_params_idx[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
 | 
			
		||||
    uint8_t  vps_timing_hrd_params_present_flag;
 | 
			
		||||
    H266RawGeneralTimingHrdParameters vps_general_timing_hrd_parameters;
 | 
			
		||||
    uint8_t  vps_sublayer_cpb_params_present_flag;
 | 
			
		||||
    uint16_t vps_num_ols_timing_hrd_params_minus1;
 | 
			
		||||
    uint8_t  vps_hrd_max_tid[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
    H266RawOlsTimingHrdParameters vps_ols_timing_hrd_parameters;
 | 
			
		||||
    uint8_t  vps_ols_timing_hrd_idx[VVC_MAX_TOTAL_NUM_OLSS];
 | 
			
		||||
 | 
			
		||||
    uint8_t  vps_extension_flag;
 | 
			
		||||
    H266RawExtensionData extension_data;
 | 
			
		||||
} H266RawVPS;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawSPS {
 | 
			
		||||
    H266RawNALUnitHeader nal_unit_header;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_seq_parameter_set_id;
 | 
			
		||||
    uint8_t  sps_video_parameter_set_id;
 | 
			
		||||
    uint8_t  sps_max_sublayers_minus1;
 | 
			
		||||
    uint8_t  sps_chroma_format_idc;
 | 
			
		||||
    uint8_t  sps_log2_ctu_size_minus5;
 | 
			
		||||
    uint8_t  sps_ptl_dpb_hrd_params_present_flag;
 | 
			
		||||
    H266RawProfileTierLevel profile_tier_level;
 | 
			
		||||
    uint8_t  sps_gdr_enabled_flag;
 | 
			
		||||
    uint8_t  sps_ref_pic_resampling_enabled_flag;
 | 
			
		||||
    uint8_t  sps_res_change_in_clvs_allowed_flag;
 | 
			
		||||
 | 
			
		||||
    uint16_t sps_pic_width_max_in_luma_samples;
 | 
			
		||||
    uint16_t sps_pic_height_max_in_luma_samples;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_conformance_window_flag;
 | 
			
		||||
    uint16_t sps_conf_win_left_offset;
 | 
			
		||||
    uint16_t sps_conf_win_right_offset;
 | 
			
		||||
    uint16_t sps_conf_win_top_offset;
 | 
			
		||||
    uint16_t sps_conf_win_bottom_offset;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_subpic_info_present_flag;
 | 
			
		||||
    uint16_t sps_num_subpics_minus1;
 | 
			
		||||
    uint8_t  sps_independent_subpics_flag;
 | 
			
		||||
    uint8_t  sps_subpic_same_size_flag;
 | 
			
		||||
    uint16_t sps_subpic_ctu_top_left_x[VVC_MAX_SLICES];
 | 
			
		||||
    uint16_t sps_subpic_ctu_top_left_y[VVC_MAX_SLICES];
 | 
			
		||||
    uint16_t sps_subpic_width_minus1[VVC_MAX_SLICES];
 | 
			
		||||
    uint16_t sps_subpic_height_minus1[VVC_MAX_SLICES];
 | 
			
		||||
    uint8_t  sps_subpic_treated_as_pic_flag[VVC_MAX_SLICES];
 | 
			
		||||
    uint8_t  sps_loop_filter_across_subpic_enabled_flag[VVC_MAX_SLICES];
 | 
			
		||||
    uint8_t  sps_subpic_id_len_minus1;
 | 
			
		||||
    uint8_t  sps_subpic_id_mapping_explicitly_signalled_flag;
 | 
			
		||||
    uint8_t  sps_subpic_id_mapping_present_flag;
 | 
			
		||||
    uint32_t sps_subpic_id[VVC_MAX_SLICES];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_bitdepth_minus8;
 | 
			
		||||
    uint8_t  sps_entropy_coding_sync_enabled_flag;
 | 
			
		||||
    uint8_t  sps_entry_point_offsets_present_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_log2_max_pic_order_cnt_lsb_minus4;
 | 
			
		||||
    uint8_t  sps_poc_msb_cycle_flag;
 | 
			
		||||
    uint8_t  sps_poc_msb_cycle_len_minus1;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_num_extra_ph_bytes;
 | 
			
		||||
    uint8_t  sps_extra_ph_bit_present_flag[16];
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_num_extra_sh_bytes;
 | 
			
		||||
    uint8_t  sps_extra_sh_bit_present_flag[16];
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_sublayer_dpb_params_flag;
 | 
			
		||||
    H266DpbParameters sps_dpb_params;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_log2_min_luma_coding_block_size_minus2;
 | 
			
		||||
    uint8_t  sps_partition_constraints_override_enabled_flag;
 | 
			
		||||
    uint8_t  sps_log2_diff_min_qt_min_cb_intra_slice_luma;
 | 
			
		||||
    uint8_t  sps_max_mtt_hierarchy_depth_intra_slice_luma;
 | 
			
		||||
    uint8_t  sps_log2_diff_max_bt_min_qt_intra_slice_luma;
 | 
			
		||||
    uint8_t  sps_log2_diff_max_tt_min_qt_intra_slice_luma;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_qtbtt_dual_tree_intra_flag;
 | 
			
		||||
    uint8_t  sps_log2_diff_min_qt_min_cb_intra_slice_chroma;
 | 
			
		||||
    uint8_t  sps_max_mtt_hierarchy_depth_intra_slice_chroma;
 | 
			
		||||
    uint8_t  sps_log2_diff_max_bt_min_qt_intra_slice_chroma;
 | 
			
		||||
    uint8_t  sps_log2_diff_max_tt_min_qt_intra_slice_chroma;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_log2_diff_min_qt_min_cb_inter_slice;
 | 
			
		||||
    uint8_t  sps_max_mtt_hierarchy_depth_inter_slice;
 | 
			
		||||
    uint8_t  sps_log2_diff_max_bt_min_qt_inter_slice;
 | 
			
		||||
    uint8_t  sps_log2_diff_max_tt_min_qt_inter_slice;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_max_luma_transform_size_64_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_transform_skip_enabled_flag;
 | 
			
		||||
    uint8_t  sps_log2_transform_skip_max_size_minus2;
 | 
			
		||||
    uint8_t  sps_bdpcm_enabled_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_mts_enabled_flag;
 | 
			
		||||
    uint8_t  sps_explicit_mts_intra_enabled_flag;
 | 
			
		||||
    uint8_t  sps_explicit_mts_inter_enabled_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_lfnst_enabled_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_joint_cbcr_enabled_flag;
 | 
			
		||||
    uint8_t  sps_same_qp_table_for_chroma_flag;
 | 
			
		||||
 | 
			
		||||
    int8_t   sps_qp_table_start_minus26[VVC_MAX_SAMPLE_ARRAYS];
 | 
			
		||||
    uint8_t  sps_num_points_in_qp_table_minus1[VVC_MAX_SAMPLE_ARRAYS];
 | 
			
		||||
    uint8_t  sps_delta_qp_in_val_minus1[VVC_MAX_SAMPLE_ARRAYS][VVC_MAX_POINTS_IN_QP_TABLE];
 | 
			
		||||
    uint8_t  sps_delta_qp_diff_val[VVC_MAX_SAMPLE_ARRAYS][VVC_MAX_POINTS_IN_QP_TABLE];
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_sao_enabled_flag;
 | 
			
		||||
    uint8_t  sps_alf_enabled_flag;
 | 
			
		||||
    uint8_t  sps_ccalf_enabled_flag;
 | 
			
		||||
    uint8_t  sps_lmcs_enabled_flag;
 | 
			
		||||
    uint8_t  sps_weighted_pred_flag;
 | 
			
		||||
    uint8_t  sps_weighted_bipred_flag;
 | 
			
		||||
    uint8_t  sps_long_term_ref_pics_flag;
 | 
			
		||||
    uint8_t  sps_inter_layer_prediction_enabled_flag;
 | 
			
		||||
    uint8_t  sps_idr_rpl_present_flag;
 | 
			
		||||
    uint8_t  sps_rpl1_same_as_rpl0_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_num_ref_pic_lists[2];
 | 
			
		||||
    H266RefPicListStruct sps_ref_pic_list_struct[2][VVC_MAX_REF_PIC_LISTS];
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_ref_wraparound_enabled_flag;
 | 
			
		||||
    uint8_t  sps_temporal_mvp_enabled_flag;
 | 
			
		||||
    uint8_t  sps_sbtmvp_enabled_flag;
 | 
			
		||||
    uint8_t  sps_amvr_enabled_flag;
 | 
			
		||||
    uint8_t  sps_bdof_enabled_flag;
 | 
			
		||||
    uint8_t  sps_bdof_control_present_in_ph_flag;
 | 
			
		||||
    uint8_t  sps_smvd_enabled_flag;
 | 
			
		||||
    uint8_t  sps_dmvr_enabled_flag;
 | 
			
		||||
    uint8_t  sps_dmvr_control_present_in_ph_flag;
 | 
			
		||||
    uint8_t  sps_mmvd_enabled_flag;
 | 
			
		||||
    uint8_t  sps_mmvd_fullpel_only_enabled_flag;
 | 
			
		||||
    uint8_t  sps_six_minus_max_num_merge_cand;
 | 
			
		||||
    uint8_t  sps_sbt_enabled_flag;
 | 
			
		||||
    uint8_t  sps_affine_enabled_flag;
 | 
			
		||||
    uint8_t  sps_five_minus_max_num_subblock_merge_cand;
 | 
			
		||||
    uint8_t  sps_6param_affine_enabled_flag;
 | 
			
		||||
    uint8_t  sps_affine_amvr_enabled_flag;
 | 
			
		||||
    uint8_t  sps_affine_prof_enabled_flag;
 | 
			
		||||
    uint8_t  sps_prof_control_present_in_ph_flag;
 | 
			
		||||
    uint8_t  sps_bcw_enabled_flag;
 | 
			
		||||
    uint8_t  sps_ciip_enabled_flag;
 | 
			
		||||
    uint8_t  sps_gpm_enabled_flag;
 | 
			
		||||
    uint8_t  sps_max_num_merge_cand_minus_max_num_gpm_cand;
 | 
			
		||||
    uint8_t  sps_log2_parallel_merge_level_minus2;
 | 
			
		||||
    uint8_t  sps_isp_enabled_flag;
 | 
			
		||||
    uint8_t  sps_mrl_enabled_flag;
 | 
			
		||||
    uint8_t  sps_mip_enabled_flag;
 | 
			
		||||
    uint8_t  sps_cclm_enabled_flag;
 | 
			
		||||
    uint8_t  sps_chroma_horizontal_collocated_flag;
 | 
			
		||||
    uint8_t  sps_chroma_vertical_collocated_flag;
 | 
			
		||||
    uint8_t  sps_palette_enabled_flag;
 | 
			
		||||
    uint8_t  sps_act_enabled_flag;
 | 
			
		||||
    uint8_t  sps_min_qp_prime_ts;
 | 
			
		||||
    uint8_t  sps_ibc_enabled_flag;
 | 
			
		||||
    uint8_t  sps_six_minus_max_num_ibc_merge_cand;
 | 
			
		||||
    uint8_t  sps_ladf_enabled_flag;
 | 
			
		||||
    uint8_t  sps_num_ladf_intervals_minus2;
 | 
			
		||||
    int8_t   sps_ladf_lowest_interval_qp_offset;
 | 
			
		||||
    int8_t   sps_ladf_qp_offset[4];
 | 
			
		||||
    uint16_t sps_ladf_delta_threshold_minus1[4];
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_explicit_scaling_list_enabled_flag;
 | 
			
		||||
    uint8_t  sps_scaling_matrix_for_lfnst_disabled_flag;
 | 
			
		||||
    uint8_t  sps_scaling_matrix_for_alternative_colour_space_disabled_flag;
 | 
			
		||||
    uint8_t  sps_scaling_matrix_designated_colour_space_flag;
 | 
			
		||||
    uint8_t  sps_dep_quant_enabled_flag;
 | 
			
		||||
    uint8_t  sps_sign_data_hiding_enabled_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_virtual_boundaries_enabled_flag;
 | 
			
		||||
    uint8_t  sps_virtual_boundaries_present_flag;
 | 
			
		||||
    uint8_t  sps_num_ver_virtual_boundaries;
 | 
			
		||||
    uint16_t sps_virtual_boundary_pos_x_minus1[3];
 | 
			
		||||
    uint8_t  sps_num_hor_virtual_boundaries;
 | 
			
		||||
    uint16_t sps_virtual_boundary_pos_y_minus1[3];
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_timing_hrd_params_present_flag;
 | 
			
		||||
    uint8_t  sps_sublayer_cpb_params_present_flag;
 | 
			
		||||
    H266RawGeneralTimingHrdParameters sps_general_timing_hrd_parameters;
 | 
			
		||||
    H266RawOlsTimingHrdParameters sps_ols_timing_hrd_parameters;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_field_seq_flag;
 | 
			
		||||
    uint8_t  sps_vui_parameters_present_flag;
 | 
			
		||||
    uint16_t sps_vui_payload_size_minus1;
 | 
			
		||||
    H266RawVUI vui;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sps_extension_flag;
 | 
			
		||||
 | 
			
		||||
    H266RawExtensionData extension_data;
 | 
			
		||||
 | 
			
		||||
} H266RawSPS;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawPPS {
 | 
			
		||||
    H266RawNALUnitHeader nal_unit_header;
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_pic_parameter_set_id;
 | 
			
		||||
    uint8_t  pps_seq_parameter_set_id;
 | 
			
		||||
    uint8_t  pps_mixed_nalu_types_in_pic_flag;
 | 
			
		||||
    uint16_t pps_pic_width_in_luma_samples;
 | 
			
		||||
    uint16_t pps_pic_height_in_luma_samples;
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_conformance_window_flag;
 | 
			
		||||
    uint16_t pps_conf_win_left_offset;
 | 
			
		||||
    uint16_t pps_conf_win_right_offset;
 | 
			
		||||
    uint16_t pps_conf_win_top_offset;
 | 
			
		||||
    uint16_t pps_conf_win_bottom_offset;
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_scaling_window_explicit_signalling_flag;
 | 
			
		||||
    int16_t  pps_scaling_win_left_offset;
 | 
			
		||||
    int16_t  pps_scaling_win_right_offset;
 | 
			
		||||
    int16_t  pps_scaling_win_top_offset;
 | 
			
		||||
    int16_t  pps_scaling_win_bottom_offset;
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_output_flag_present_flag;
 | 
			
		||||
    uint8_t  pps_no_pic_partition_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_subpic_id_mapping_present_flag;
 | 
			
		||||
    uint16_t pps_num_subpics_minus1;
 | 
			
		||||
    uint8_t  pps_subpic_id_len_minus1;
 | 
			
		||||
    uint16_t pps_subpic_id[VVC_MAX_SLICES];
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_log2_ctu_size_minus5;
 | 
			
		||||
    uint8_t  pps_num_exp_tile_columns_minus1;
 | 
			
		||||
    uint8_t  pps_num_exp_tile_rows_minus1;
 | 
			
		||||
    uint16_t pps_tile_column_width_minus1[VVC_MAX_TILE_COLUMNS];
 | 
			
		||||
    uint16_t pps_tile_row_height_minus1[VVC_MAX_TILE_ROWS];
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_loop_filter_across_tiles_enabled_flag;
 | 
			
		||||
    uint8_t  pps_rect_slice_flag;
 | 
			
		||||
    uint8_t  pps_single_slice_per_subpic_flag;
 | 
			
		||||
 | 
			
		||||
    uint16_t pps_num_slices_in_pic_minus1;
 | 
			
		||||
    uint8_t  pps_tile_idx_delta_present_flag;
 | 
			
		||||
    uint16_t pps_slice_width_in_tiles_minus1[VVC_MAX_SLICES];
 | 
			
		||||
    uint16_t pps_slice_height_in_tiles_minus1[VVC_MAX_SLICES];
 | 
			
		||||
    uint16_t pps_num_exp_slices_in_tile[VVC_MAX_SLICES];
 | 
			
		||||
    uint16_t pps_exp_slice_height_in_ctus_minus1[VVC_MAX_SLICES][VVC_MAX_TILE_ROWS];
 | 
			
		||||
    int16_t  pps_tile_idx_delta_val[VVC_MAX_SLICES];
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_loop_filter_across_slices_enabled_flag;
 | 
			
		||||
    uint8_t  pps_cabac_init_present_flag;
 | 
			
		||||
    uint8_t  pps_num_ref_idx_default_active_minus1[2];
 | 
			
		||||
    uint8_t  pps_rpl1_idx_present_flag;
 | 
			
		||||
    uint8_t  pps_weighted_pred_flag;
 | 
			
		||||
    uint8_t  pps_weighted_bipred_flag;
 | 
			
		||||
    uint8_t  pps_ref_wraparound_enabled_flag;
 | 
			
		||||
    uint16_t  pps_pic_width_minus_wraparound_offset;
 | 
			
		||||
    int8_t   pps_init_qp_minus26;
 | 
			
		||||
    uint8_t  pps_cu_qp_delta_enabled_flag;
 | 
			
		||||
    uint8_t  pps_chroma_tool_offsets_present_flag;
 | 
			
		||||
    int8_t   pps_cb_qp_offset;
 | 
			
		||||
    int8_t   pps_cr_qp_offset;
 | 
			
		||||
    uint8_t  pps_joint_cbcr_qp_offset_present_flag;
 | 
			
		||||
    int8_t   pps_joint_cbcr_qp_offset_value;
 | 
			
		||||
    uint8_t  pps_slice_chroma_qp_offsets_present_flag;
 | 
			
		||||
    uint8_t  pps_cu_chroma_qp_offset_list_enabled_flag;
 | 
			
		||||
    uint8_t  pps_chroma_qp_offset_list_len_minus1;
 | 
			
		||||
    uint8_t  pps_cb_qp_offset_list[6];
 | 
			
		||||
    uint8_t  pps_cr_qp_offset_list[6];
 | 
			
		||||
    uint8_t  pps_joint_cbcr_qp_offset_list[6];
 | 
			
		||||
    uint8_t  pps_deblocking_filter_control_present_flag;
 | 
			
		||||
    uint8_t  pps_deblocking_filter_override_enabled_flag;
 | 
			
		||||
    uint8_t  pps_deblocking_filter_disabled_flag;
 | 
			
		||||
    uint8_t  pps_dbf_info_in_ph_flag;
 | 
			
		||||
 | 
			
		||||
    int8_t   pps_luma_beta_offset_div2;
 | 
			
		||||
    int8_t   pps_luma_tc_offset_div2;
 | 
			
		||||
    int8_t   pps_cb_beta_offset_div2;
 | 
			
		||||
    int8_t   pps_cb_tc_offset_div2;
 | 
			
		||||
    int8_t   pps_cr_beta_offset_div2;
 | 
			
		||||
    int8_t   pps_cr_tc_offset_div2;
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_rpl_info_in_ph_flag;
 | 
			
		||||
    uint8_t  pps_sao_info_in_ph_flag;
 | 
			
		||||
    uint8_t  pps_alf_info_in_ph_flag;
 | 
			
		||||
    uint8_t  pps_wp_info_in_ph_flag;
 | 
			
		||||
    uint8_t  pps_qp_delta_info_in_ph_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  pps_picture_header_extension_present_flag;
 | 
			
		||||
    uint8_t  pps_slice_header_extension_present_flag;
 | 
			
		||||
    uint8_t  pps_extension_flag;
 | 
			
		||||
    H266RawExtensionData extension_data;
 | 
			
		||||
 | 
			
		||||
    //calculated value;
 | 
			
		||||
    uint16_t num_tile_columns;
 | 
			
		||||
    uint16_t num_tile_rows;
 | 
			
		||||
    uint16_t num_tiles_in_pic;
 | 
			
		||||
    uint16_t slice_height_in_ctus[VVC_MAX_SLICES];
 | 
			
		||||
    uint16_t num_slices_in_subpic[VVC_MAX_SLICES];
 | 
			
		||||
} H266RawPPS;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawAUD {
 | 
			
		||||
    H266RawNALUnitHeader nal_unit_header;
 | 
			
		||||
    uint8_t aud_irap_or_gdr_flag;
 | 
			
		||||
    uint8_t aud_pic_type;
 | 
			
		||||
} H266RawAUD;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawPredWeightTable {
 | 
			
		||||
    uint8_t  luma_log2_weight_denom;
 | 
			
		||||
    int8_t   delta_chroma_log2_weight_denom;
 | 
			
		||||
 | 
			
		||||
    uint8_t  num_l0_weights;
 | 
			
		||||
    uint8_t  luma_weight_l0_flag[15];
 | 
			
		||||
    uint8_t  chroma_weight_l0_flag[15];
 | 
			
		||||
    int8_t   delta_luma_weight_l0[15];
 | 
			
		||||
    int8_t   luma_offset_l0[15];
 | 
			
		||||
    int8_t   delta_chroma_weight_l0[15][2];
 | 
			
		||||
    int16_t  delta_chroma_offset_l0[15][2];
 | 
			
		||||
 | 
			
		||||
    uint8_t  num_l1_weights;
 | 
			
		||||
    uint8_t  luma_weight_l1_flag[15];
 | 
			
		||||
    uint8_t  chroma_weight_l1_flag[15];
 | 
			
		||||
    int8_t   delta_luma_weight_l1[15];
 | 
			
		||||
    int8_t   luma_offset_l1[15];
 | 
			
		||||
    int8_t   delta_chroma_weight_l1[15][2];
 | 
			
		||||
    int16_t  delta_chroma_offset_l1[15][2];
 | 
			
		||||
} H266RawPredWeightTable;
 | 
			
		||||
 | 
			
		||||
typedef struct  H266RawPH {
 | 
			
		||||
    H266RawNALUnitHeader nal_unit_header;
 | 
			
		||||
    uint8_t  ph_gdr_or_irap_pic_flag;
 | 
			
		||||
    uint8_t  ph_non_ref_pic_flag;
 | 
			
		||||
    uint8_t  ph_gdr_pic_flag;
 | 
			
		||||
    uint8_t  ph_inter_slice_allowed_flag;
 | 
			
		||||
    uint8_t  ph_intra_slice_allowed_flag;
 | 
			
		||||
    uint8_t  ph_pic_parameter_set_id;
 | 
			
		||||
    uint16_t ph_pic_order_cnt_lsb;
 | 
			
		||||
    uint8_t  ph_recovery_poc_cnt;
 | 
			
		||||
    uint8_t  ph_extra_bit[16];
 | 
			
		||||
    uint8_t  ph_poc_msb_cycle_present_flag;
 | 
			
		||||
    uint8_t  ph_poc_msb_cycle_val;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_alf_enabled_flag;
 | 
			
		||||
    uint8_t  ph_num_alf_aps_ids_luma;
 | 
			
		||||
    uint8_t  ph_alf_aps_id_luma[8];
 | 
			
		||||
    uint8_t  ph_alf_cb_enabled_flag;
 | 
			
		||||
    uint8_t  ph_alf_cr_enabled_flag;
 | 
			
		||||
    uint8_t  ph_alf_aps_id_chroma;
 | 
			
		||||
    uint8_t  ph_alf_cc_cb_enabled_flag;
 | 
			
		||||
    uint8_t  ph_alf_cc_cb_aps_id;
 | 
			
		||||
    uint8_t  ph_alf_cc_cr_enabled_flag;
 | 
			
		||||
    uint8_t  ph_alf_cc_cr_aps_id;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_lmcs_enabled_flag;
 | 
			
		||||
    uint8_t  ph_lmcs_aps_id;
 | 
			
		||||
    uint8_t  ph_chroma_residual_scale_flag;
 | 
			
		||||
    uint8_t  ph_explicit_scaling_list_enabled_flag;
 | 
			
		||||
    uint8_t  ph_scaling_list_aps_id;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_virtual_boundaries_present_flag;
 | 
			
		||||
    uint8_t  ph_num_ver_virtual_boundaries;
 | 
			
		||||
    uint16_t ph_virtual_boundary_pos_x_minus1[3];
 | 
			
		||||
    uint8_t  ph_num_hor_virtual_boundaries;
 | 
			
		||||
    uint16_t ph_virtual_boundary_pos_y_minus1[3];
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_pic_output_flag;
 | 
			
		||||
    H266RefPicLists ph_ref_pic_lists;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_partition_constraints_override_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_log2_diff_min_qt_min_cb_intra_slice_luma;
 | 
			
		||||
    uint8_t  ph_max_mtt_hierarchy_depth_intra_slice_luma;
 | 
			
		||||
    uint8_t  ph_log2_diff_max_bt_min_qt_intra_slice_luma;
 | 
			
		||||
    uint8_t  ph_log2_diff_max_tt_min_qt_intra_slice_luma;
 | 
			
		||||
    uint8_t  ph_log2_diff_min_qt_min_cb_intra_slice_chroma;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_max_mtt_hierarchy_depth_intra_slice_chroma;
 | 
			
		||||
    uint8_t  ph_log2_diff_max_bt_min_qt_intra_slice_chroma;
 | 
			
		||||
    uint8_t  ph_log2_diff_max_tt_min_qt_intra_slice_chroma;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_cu_qp_delta_subdiv_intra_slice;
 | 
			
		||||
    uint8_t  ph_cu_chroma_qp_offset_subdiv_intra_slice;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_log2_diff_min_qt_min_cb_inter_slice;
 | 
			
		||||
    uint8_t  ph_max_mtt_hierarchy_depth_inter_slice;
 | 
			
		||||
    uint8_t  ph_log2_diff_max_bt_min_qt_inter_slice;
 | 
			
		||||
    uint8_t  ph_log2_diff_max_tt_min_qt_inter_slice;
 | 
			
		||||
    uint8_t  ph_cu_qp_delta_subdiv_inter_slice;
 | 
			
		||||
    uint8_t  ph_cu_chroma_qp_offset_subdiv_inter_slice;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_temporal_mvp_enabled_flag;
 | 
			
		||||
    uint8_t  ph_collocated_from_l0_flag;
 | 
			
		||||
    uint8_t  ph_collocated_ref_idx;
 | 
			
		||||
    uint8_t  ph_mmvd_fullpel_only_flag;
 | 
			
		||||
    uint8_t  ph_mvd_l1_zero_flag;
 | 
			
		||||
    uint8_t  ph_bdof_disabled_flag;
 | 
			
		||||
    uint8_t  ph_dmvr_disabled_flag;
 | 
			
		||||
    uint8_t  ph_prof_disabled_flag;
 | 
			
		||||
 | 
			
		||||
    H266RawPredWeightTable ph_pred_weight_table;
 | 
			
		||||
 | 
			
		||||
    int8_t   ph_qp_delta;
 | 
			
		||||
    uint8_t  ph_joint_cbcr_sign_flag;
 | 
			
		||||
    uint8_t  ph_sao_luma_enabled_flag;
 | 
			
		||||
    uint8_t  ph_sao_chroma_enabled_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_deblocking_params_present_flag;
 | 
			
		||||
    uint8_t  ph_deblocking_filter_disabled_flag;
 | 
			
		||||
    int8_t   ph_luma_beta_offset_div2;
 | 
			
		||||
    int8_t   ph_luma_tc_offset_div2;
 | 
			
		||||
    int8_t   ph_cb_beta_offset_div2;
 | 
			
		||||
    int8_t   ph_cb_tc_offset_div2;
 | 
			
		||||
    int8_t   ph_cr_beta_offset_div2;
 | 
			
		||||
    int8_t   ph_cr_tc_offset_div2;
 | 
			
		||||
 | 
			
		||||
    uint8_t  ph_extension_length;
 | 
			
		||||
    uint8_t  ph_extension_data_byte[256];
 | 
			
		||||
} H266RawPH;
 | 
			
		||||
 | 
			
		||||
typedef struct  H266RawSliceHeader {
 | 
			
		||||
    H266RawNALUnitHeader nal_unit_header;
 | 
			
		||||
    uint8_t  sh_picture_header_in_slice_header_flag;
 | 
			
		||||
    H266RawPH sh_picture_header;
 | 
			
		||||
 | 
			
		||||
    uint16_t sh_subpic_id;
 | 
			
		||||
    uint16_t sh_slice_address;
 | 
			
		||||
    uint8_t  sh_extra_bit[16];
 | 
			
		||||
    uint8_t  sh_num_tiles_in_slice_minus1;
 | 
			
		||||
    uint8_t  sh_slice_type;
 | 
			
		||||
    uint8_t  sh_no_output_of_prior_pics_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sh_alf_enabled_flag;
 | 
			
		||||
    uint8_t  sh_num_alf_aps_ids_luma;
 | 
			
		||||
    uint8_t  sh_alf_aps_id_luma[8];
 | 
			
		||||
    uint8_t  sh_alf_cb_enabled_flag;
 | 
			
		||||
    uint8_t  sh_alf_cr_enabled_flag;
 | 
			
		||||
    uint8_t  sh_alf_aps_id_chroma;
 | 
			
		||||
    uint8_t  sh_alf_cc_cb_enabled_flag;
 | 
			
		||||
    uint8_t  sh_alf_cc_cb_aps_id;
 | 
			
		||||
    uint8_t  sh_alf_cc_cr_enabled_flag;
 | 
			
		||||
    uint8_t  sh_alf_cc_cr_aps_id;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sh_lmcs_used_flag;
 | 
			
		||||
    uint8_t  sh_explicit_scaling_list_used_flag;
 | 
			
		||||
 | 
			
		||||
    H266RefPicLists sh_ref_pic_lists;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sh_num_ref_idx_active_override_flag;
 | 
			
		||||
    uint8_t  sh_num_ref_idx_active_minus1[2];
 | 
			
		||||
    uint8_t  sh_cabac_init_flag;
 | 
			
		||||
    uint8_t  sh_collocated_from_l0_flag;
 | 
			
		||||
    uint8_t  sh_collocated_ref_idx;
 | 
			
		||||
 | 
			
		||||
    H266RawPredWeightTable sh_pred_weight_table;
 | 
			
		||||
 | 
			
		||||
    int8_t   sh_qp_delta;
 | 
			
		||||
    int8_t   sh_cb_qp_offset;
 | 
			
		||||
    int8_t   sh_cr_qp_offset;
 | 
			
		||||
    int8_t   sh_joint_cbcr_qp_offset;
 | 
			
		||||
    uint8_t  sh_cu_chroma_qp_offset_enabled_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sh_sao_luma_used_flag;
 | 
			
		||||
    uint8_t  sh_sao_chroma_used_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sh_deblocking_params_present_flag;
 | 
			
		||||
    uint8_t  sh_deblocking_filter_disabled_flag;
 | 
			
		||||
    int8_t   sh_luma_beta_offset_div2;
 | 
			
		||||
    int8_t   sh_luma_tc_offset_div2;
 | 
			
		||||
    int8_t   sh_cb_beta_offset_div2;
 | 
			
		||||
    int8_t   sh_cb_tc_offset_div2;
 | 
			
		||||
    int8_t   sh_cr_beta_offset_div2;
 | 
			
		||||
    int8_t   sh_cr_tc_offset_div2;
 | 
			
		||||
    uint8_t  sh_dep_quant_used_flag;
 | 
			
		||||
 | 
			
		||||
    uint8_t  sh_sign_data_hiding_used_flag;
 | 
			
		||||
    uint8_t  sh_ts_residual_coding_disabled_flag;
 | 
			
		||||
    uint16_t sh_slice_header_extension_length;
 | 
			
		||||
    uint8_t  sh_slice_header_extension_data_byte[256];
 | 
			
		||||
 | 
			
		||||
    uint8_t  sh_entry_offset_len_minus1;
 | 
			
		||||
    uint32_t sh_entry_point_offset_minus1[VVC_MAX_ENTRY_POINTS];
 | 
			
		||||
 | 
			
		||||
} H266RawSliceHeader;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawSlice {
 | 
			
		||||
    H266RawSliceHeader header;
 | 
			
		||||
 | 
			
		||||
    uint8_t     *data;
 | 
			
		||||
    AVBufferRef *data_ref;
 | 
			
		||||
    size_t       data_size;
 | 
			
		||||
    int          data_bit_start;
 | 
			
		||||
} H266RawSlice;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawSEIDecodedPictureHash {
 | 
			
		||||
    uint8_t  dph_sei_hash_type;
 | 
			
		||||
    uint8_t  dph_sei_single_component_flag;
 | 
			
		||||
    uint8_t  dph_sei_picture_md5[3][16];
 | 
			
		||||
    uint16_t dph_sei_picture_crc[3];
 | 
			
		||||
    uint32_t dph_sei_picture_checksum[3];
 | 
			
		||||
 | 
			
		||||
    uint8_t  dph_sei_reserved_zero_7bits;
 | 
			
		||||
} H266RawSEIDecodedPictureHash;
 | 
			
		||||
 | 
			
		||||
typedef struct H266RawSEI {
 | 
			
		||||
    H266RawNALUnitHeader nal_unit_header;
 | 
			
		||||
    SEIRawMessageList    message_list;
 | 
			
		||||
} H266RawSEI;
 | 
			
		||||
 | 
			
		||||
typedef struct CodedBitstreamH266Context {
 | 
			
		||||
    // Reader/writer context in common with the H.264 implementation.
 | 
			
		||||
    CodedBitstreamH2645Context common;
 | 
			
		||||
 | 
			
		||||
    // All currently available parameter sets.  These are updated when
 | 
			
		||||
    // any parameter set NAL unit is read/written with this context.
 | 
			
		||||
    AVBufferRef *vps_ref[VVC_MAX_VPS_COUNT];
 | 
			
		||||
    AVBufferRef *sps_ref[VVC_MAX_SPS_COUNT];
 | 
			
		||||
    AVBufferRef *pps_ref[VVC_MAX_PPS_COUNT];
 | 
			
		||||
    H266RawVPS  *vps[VVC_MAX_SPS_COUNT];
 | 
			
		||||
    H266RawSPS  *sps[VVC_MAX_SPS_COUNT];
 | 
			
		||||
    H266RawPPS  *pps[VVC_MAX_PPS_COUNT];
 | 
			
		||||
 | 
			
		||||
    struct {
 | 
			
		||||
        AVBufferRef *ph_ref;
 | 
			
		||||
        H266RawPH   *ph;
 | 
			
		||||
    } priv;
 | 
			
		||||
} CodedBitstreamH266Context;
 | 
			
		||||
 | 
			
		||||
#endif /* AVCODEC_CBS_H266_H */
 | 
			
		||||
							
								
								
									
										3116
									
								
								libavcodec/cbs_h266_syntax_template.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3116
									
								
								libavcodec/cbs_h266_syntax_template.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -251,6 +251,7 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc,
 | 
			
		||||
extern const CodedBitstreamType ff_cbs_type_av1;
 | 
			
		||||
extern const CodedBitstreamType ff_cbs_type_h264;
 | 
			
		||||
extern const CodedBitstreamType ff_cbs_type_h265;
 | 
			
		||||
extern const CodedBitstreamType ff_cbs_type_h266;
 | 
			
		||||
extern const CodedBitstreamType ff_cbs_type_jpeg;
 | 
			
		||||
extern const CodedBitstreamType ff_cbs_type_mpeg2;
 | 
			
		||||
extern const CodedBitstreamType ff_cbs_type_vp9;
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,7 @@
 | 
			
		||||
#include "cbs_internal.h"
 | 
			
		||||
#include "cbs_h264.h"
 | 
			
		||||
#include "cbs_h265.h"
 | 
			
		||||
#include "cbs_h266.h"
 | 
			
		||||
#include "cbs_sei.h"
 | 
			
		||||
 | 
			
		||||
static void cbs_free_user_data_registered(void *opaque, uint8_t *data)
 | 
			
		||||
@ -132,6 +133,13 @@ static int cbs_sei_get_unit(CodedBitstreamContext *ctx,
 | 
			
		||||
        else
 | 
			
		||||
            sei_type = HEVC_NAL_SEI_SUFFIX;
 | 
			
		||||
        break;
 | 
			
		||||
    case AV_CODEC_ID_H266:
 | 
			
		||||
        highest_vcl_type = VVC_RSV_IRAP_11;
 | 
			
		||||
        if (prefix)
 | 
			
		||||
            sei_type = VVC_PREFIX_SEI_NUT;
 | 
			
		||||
        else
 | 
			
		||||
            sei_type = VVC_SUFFIX_SEI_NUT;
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        return AVERROR(EINVAL);
 | 
			
		||||
    }
 | 
			
		||||
@ -207,6 +215,18 @@ static int cbs_sei_get_unit(CodedBitstreamContext *ctx,
 | 
			
		||||
            memcpy(unit->content, &sei, sizeof(sei));
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    case AV_CODEC_ID_H266:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawSEI sei = {
 | 
			
		||||
                .nal_unit_header = {
 | 
			
		||||
                    .nal_unit_type         = sei_type,
 | 
			
		||||
                    .nuh_layer_id          = 0,
 | 
			
		||||
                    .nuh_temporal_id_plus1 = 1,
 | 
			
		||||
                },
 | 
			
		||||
            };
 | 
			
		||||
            memcpy(unit->content, &sei, sizeof(sei));
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        av_assert0(0);
 | 
			
		||||
    }
 | 
			
		||||
@ -237,6 +257,15 @@ static int cbs_sei_get_message_list(CodedBitstreamContext *ctx,
 | 
			
		||||
            *list = &sei->message_list;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    case AV_CODEC_ID_H266:
 | 
			
		||||
        {
 | 
			
		||||
            H266RawSEI *sei = unit->content;
 | 
			
		||||
            if (unit->type != VVC_PREFIX_SEI_NUT &&
 | 
			
		||||
                unit->type != VVC_SUFFIX_SEI_NUT)
 | 
			
		||||
                return AVERROR(EINVAL);
 | 
			
		||||
            *list = &sei->message_list;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        return AVERROR(EINVAL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user