From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 93E2546BE6 for ; Wed, 5 Jul 2023 11:45:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 13C7D68C5FB; Wed, 5 Jul 2023 14:45:54 +0300 (EEST) Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5FBCC68C5E2 for ; Wed, 5 Jul 2023 14:45:47 +0300 (EEST) Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-56597d949b1so4505890eaf.1 for ; Wed, 05 Jul 2023 04:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688557545; x=1691149545; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=wBdLfefbpc2/wbmTpPVtN08QDYXMsv+t+gq17/8I0Mg=; b=oWwkU6uiG240bzp/JkhRsu2Zyk5ulEkSmPebKh+i0RBJWMgqnlTq36WCy/l/39PTWC fA8dMf6EdWVulbzAtpLL1GW2aIfDE2GlWk6QsaYZpk41yv+gv0QnreyigCtNhR9d/2Ap GxwURNrh7rf2uixDgEzPji+HpxuMWnXklqgM+L2+Ua0iPWC1Jto/3hAbGfs76NBAmgMF cIuke1BoEYigxGa8wu9Mpw9fnkMTwr98dZS40T12o6DMA3LdkMczXA4exPUWgyxm1YXU Q7sOunnehVyo/Et42fHExUQhG3tK0eYgYIN9lcyD/qQLflcusgHE/qSclLiXZkRSV0su r/KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688557545; x=1691149545; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wBdLfefbpc2/wbmTpPVtN08QDYXMsv+t+gq17/8I0Mg=; b=hLSy84Wa/e3Ax7lRjxabytYCyuoVqdRxoRd9kySk8b6DF+dQnzHuWFW5zCu3i68P70 iBrvv+i9kRgghlCzPxyBqh54hH4kBSatiolpKY3APYDPKx9rm8Rl3B3OqDX/wdk7Jxfg HwwUAU69HVsz2CPUV5Iq7Y2ZqEI/MqzGb09HY/Y2XUuW9s+a3iAAEhAW9NoUsT1OO/sU fsBH5w2Mi1m6LtLXLK6g8DqDW0/BHB+B2CklQFdhiek67pN3kUSq5TAdJT+MYdmu2WGd Tq1fJMwywgF3d69IYnK37u0se+LIRxCVlMIAGVYhHt9PTFrf2UIXFUD/dzkq33O4EvG7 dRQA== X-Gm-Message-State: AC+VfDzloPRXvpcPAoIcURbECk44ofRzFOvTiGX87cgYn9t5A6B3I8HU eGd2Bl7d99z01+/ZiqFeu9kZopPDS2s= X-Google-Smtp-Source: ACHHUZ7hVC2INNV/jHG8RXz3TI3ZfPonuYKMxE2ZSLYBVNeIdIIOG4zpYblhUTOZ4GiGDvrMDc7/4A== X-Received: by 2002:a05:6808:a93:b0:3a1:d3f2:70b7 with SMTP id q19-20020a0568080a9300b003a1d3f270b7mr17593008oij.18.1688557545072; Wed, 05 Jul 2023 04:45:45 -0700 (PDT) Received: from [192.168.0.12] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id n81-20020acabd54000000b003941c3b9f0dsm6158386oif.41.2023.07.05.04.45.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Jul 2023 04:45:44 -0700 (PDT) Message-ID: Date: Wed, 5 Jul 2023 08:45:42 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] cbs_h266: add range extension support X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 7/5/2023 8:38 AM, Nuo Mi wrote: > From: frankplow > > --- > libavcodec/cbs_h266.h | 18 ++++++ > libavcodec/cbs_h266_syntax_template.c | 79 +++++++++++++++++++++++++-- > 2 files changed, 93 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h > index e33d08a0f5..40aba9eb13 100644 > --- a/libavcodec/cbs_h266.h > +++ b/libavcodec/cbs_h266.h > @@ -120,6 +120,13 @@ typedef struct H266GeneralConstraintsInfo { > uint8_t gci_no_virtual_boundaries_constraint_flag; > uint8_t gci_num_reserved_bits; > uint8_t gci_reserved_zero_bit[255]; > + > + uint8_t gci_all_rap_pictures_constraint_flag; > + uint8_t gci_no_extended_precision_processing_constraint_flag; > + uint8_t gci_no_ts_residual_coding_rice_constraint_flag; > + uint8_t gci_no_rrc_rice_extension_constraint_flag; > + uint8_t gci_no_persistent_rice_adaptation_constraint_flag; > + uint8_t gci_no_reverse_last_sig_coeff_constraint_flag; > } H266GeneralConstraintsInfo; > > typedef struct H266RawProfileTierLevel { > @@ -451,6 +458,15 @@ typedef struct H266RawSPS { > > uint8_t sps_extension_flag; > > + uint8_t sps_range_extension_flag; > + uint8_t sps_extension_7bits; > + > + uint8_t sps_extended_precision_flag; > + uint8_t sps_ts_residual_coding_rice_present_in_sh_flag; > + uint8_t sps_rrc_rice_extension_flag; > + uint8_t sps_persistent_rice_adaptation_enabled_flag; > + uint8_t sps_reverse_last_sig_coeff_enabled_flag; > + > H266RawExtensionData extension_data; > > } H266RawSPS; > @@ -734,6 +750,8 @@ typedef struct H266RawSliceHeader { > > uint8_t sh_sign_data_hiding_used_flag; > uint8_t sh_ts_residual_coding_disabled_flag; > + uint8_t sh_ts_residual_coding_rice_idx_minus1; > + uint8_t sh_reverse_last_sig_coeff_flag; > uint16_t sh_slice_header_extension_length; > uint8_t sh_slice_header_extension_data_byte[256]; > > diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c > index 485c02f590..893fa55369 100644 > --- a/libavcodec/cbs_h266_syntax_template.c > +++ b/libavcodec/cbs_h266_syntax_template.c > @@ -61,7 +61,7 @@ static int FUNC(general_constraints_info) (CodedBitstreamContext *ctx, > RWContext *rw, > H266GeneralConstraintsInfo *current) > { > - int err, i; > + int err, i, num_additional_bits_used; > > flag(gci_present_flag); > if (current->gci_present_flag) { > @@ -149,7 +149,25 @@ static int FUNC(general_constraints_info) (CodedBitstreamContext *ctx, > flag(gci_no_ladf_constraint_flag); > flag(gci_no_virtual_boundaries_constraint_flag); > ub(8, gci_num_reserved_bits); This should be renamed to gci_num_additional_bits while at it. > - for (i = 0; i < current->gci_num_reserved_bits; i++) { > + if (current->gci_num_reserved_bits > 5) { > + flag(gci_all_rap_pictures_constraint_flag); > + flag(gci_no_extended_precision_processing_constraint_flag); > + flag(gci_no_ts_residual_coding_rice_constraint_flag); > + flag(gci_no_rrc_rice_extension_constraint_flag); > + flag(gci_no_persistent_rice_adaptation_constraint_flag); > + flag(gci_no_reverse_last_sig_coeff_constraint_flag); > + num_additional_bits_used = 6; > + } else { > + infer(gci_all_rap_pictures_constraint_flag, 0); > + infer(gci_no_extended_precision_processing_constraint_flag, 0); > + infer(gci_no_ts_residual_coding_rice_constraint_flag, 0); > + infer(gci_no_rrc_rice_extension_constraint_flag, 0); > + infer(gci_no_persistent_rice_adaptation_constraint_flag, 0); > + infer(gci_no_reverse_last_sig_coeff_constraint_flag, 0); > + num_additional_bits_used = 0; > + } > + > + for (i = 0; i < current->gci_num_reserved_bits - num_additional_bits_used; i++) { > flags(gci_reserved_zero_bit[i], 1, i); > } > } > @@ -963,6 +981,23 @@ static int FUNC(vps) (CodedBitstreamContext *ctx, RWContext *rw, > return 0; > } > > +static int FUNC(sps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw, > + H266RawSPS *current) > +{ > + int err; > + > + flag(sps_extended_precision_flag); > + if (current->sps_transform_skip_enabled_flag) { > + flag(sps_ts_residual_coding_rice_present_in_sh_flag); > + } else { > + infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0); > + } > + flag(sps_rrc_rice_extension_flag); > + flag(sps_persistent_rice_adaptation_enabled_flag); > + flag(sps_reverse_last_sig_coeff_enabled_flag); > + > + return 0; > +} > > static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, > H266RawSPS *current) > @@ -1518,9 +1553,33 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, > } else { > CHECK(FUNC(vui_parameters_default) (ctx, rw, ¤t->vui)); > } > + > flag(sps_extension_flag); > - if (current->sps_extension_flag) > - CHECK(FUNC(extension_data) (ctx, rw, ¤t->extension_data)); > + if (current->sps_extension_flag) { > + flag(sps_range_extension_flag); > + ub(7, sps_extension_7bits); > + > + if (current->sps_range_extension_flag) { > + CHECK(FUNC(sps_range_extension)(ctx, rw, current)); > + } else { > + infer(sps_extended_precision_flag, 0); > + infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0); > + infer(sps_rrc_rice_extension_flag, 0); > + infer(sps_persistent_rice_adaptation_enabled_flag, 0); > + infer(sps_reverse_last_sig_coeff_enabled_flag, 0); > + } > + } else { > + infer(sps_range_extension_flag, 0); > + infer(sps_extension_7bits, 0); > + infer(sps_extended_precision_flag, 0); > + infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0); > + infer(sps_rrc_rice_extension_flag, 0); > + infer(sps_persistent_rice_adaptation_enabled_flag, 0); > + infer(sps_reverse_last_sig_coeff_enabled_flag, 0); > + } > + > + if (current->sps_extension_7bits) > + CHECK(FUNC(extension_data)(ctx, rw, ¤t->extension_data)); > > CHECK(FUNC(rbsp_trailing_bits) (ctx, rw)); > > @@ -3005,6 +3064,18 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, > flag(sh_ts_residual_coding_disabled_flag); > else > infer(sh_ts_residual_coding_disabled_flag, 0); > + > + if (!current->sh_ts_residual_coding_disabled_flag && > + sps->sps_ts_residual_coding_rice_present_in_sh_flag) > + ub(3, sh_ts_residual_coding_rice_idx_minus1); > + else > + infer(sh_ts_residual_coding_rice_idx_minus1, 0); > + > + if (sps->sps_reverse_last_sig_coeff_enabled_flag) > + flag(sh_reverse_last_sig_coeff_flag); > + else > + infer(sh_reverse_last_sig_coeff_flag, 0); Do you know what sample if any in the conformance suite covers this? > + > if (pps->pps_slice_header_extension_present_flag) { > ue(sh_slice_header_extension_length, 0, 256); > for (i = 0; i < current->sh_slice_header_extension_length; i++) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".