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 48AA24BA3E for ; Mon, 15 Jul 2024 18:29:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D618D68D963; Mon, 15 Jul 2024 21:29:33 +0300 (EEST) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 246DE68D6CC for ; Mon, 15 Jul 2024 21:29:28 +0300 (EEST) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-70df2135426so2595940a12.2 for ; Mon, 15 Jul 2024 11:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721068165; x=1721672965; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:content-language:references :to:from:subject:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=DwpLm6A3ZbdVUPXMbGg+xdPbJEEZ6naMgdeflccKm64=; b=fDPPXCw1VtoJ7AsHoBZ98btZApY9Tq1P9KUOfAHhzpjoOMK7So3bRfG8lLhVVMCzi4 1I06nHnc0G9UDQLu4f0SvYyWxqqrQPdw7aIPAVJMLjGrK3WoHGi3bBbLRl14XqKLN1fx pAWSov7CsycOjavgDNSWuaYm1k792xmW23E4Gzuh7CHnDVD1pI6sDzCWBEpTTGyW0CRT gM7fpH/l2Ow5asB2De5BjEk/+lxPj8ZtMWZWMCBJnJDPO6zEWL65Qqq5YTsjqpZ6MYEz oN2N88vsghQHGo3WY+iUg7Etp8e1mjHWCAe6hQ0SGsrt19Hwbj2R3jowN12QCEZBG5Au RZAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721068165; x=1721672965; h=content-transfer-encoding:in-reply-to:content-language:references :to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DwpLm6A3ZbdVUPXMbGg+xdPbJEEZ6naMgdeflccKm64=; b=OVw0vQHuVQwBIETO1WCBGGw6I1nmqvfZ8gnUN+yeUONVvP0CfTluwev8q215U0NFGT MW/HPeA/v2KDAntk5CN/N92Az7Sixvs0ppZRXVSMgkDdL8M3Ooti65av3TEKCgu4oA8I nCTOlUeyPT3pcIkdIsKTwAcDbBFImJHg/fLlUjl8XeRnffLfqJBQubDeFYNkOvzkHB0a vPzqdvtidph9bQy4iok8wvK847XklJww/OzRfSiV9iTYOKho+4gaOJg6BbtD9rYxKeAm S+mS+6SgeVi6zJkvMRDrQsEnmVLPg1ZeGnuzr75MDQ0pqIh8vwcO+hUMQjeOhMmuPVmz bw8Q== X-Gm-Message-State: AOJu0YxmOnyEBGoYu2z8ltM2bFZDw+CBMllDMg5uw2y35YxiH2Qo9wfK aXG3PHV3KUFKHUJW0tn7KSWCGgHQ5v4PXeWNbNEBEr9gQyKk9RLZEtoExw== X-Google-Smtp-Source: AGHT+IHFarECxvFI5sxexa4aEQcIsUxZpESdhbjDoowsCzmsJ5sGDsZ6BiaJnsjazYct/YMZ8UTy2Q== X-Received: by 2002:a05:6a21:6d94:b0:1c0:edae:cebc with SMTP id adf61e73a8af0-1c3ee48fb80mr1045375637.2.1721068165177; Mon, 15 Jul 2024 11:29:25 -0700 (PDT) Received: from [192.168.0.16] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fc0bc38cd8sm44164865ad.213.2024.07.15.11.29.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jul 2024 11:29:24 -0700 (PDT) Message-ID: <1f71d71b-edbe-4c9d-b6b7-b0bb0c8fa7c1@gmail.com> Date: Mon, 15 Jul 2024 15:29:39 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: James Almer To: ffmpeg-devel@ffmpeg.org References: <20240713145846.1331-1-jamrial@gmail.com> Content-Language: en-US In-Reply-To: <20240713145846.1331-1-jamrial@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH 1/4] avcodec/cbs_h265: fix range of sps_max_sub_layers_minus1 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/13/2024 11:58 AM, James Almer wrote: > The VPS referenced by the SPS must always be present as the max value for > sps_max_sub_layers_minus1 is vps_max_sub_layers_minus1. This replaces a buggy > custom range check for the aforementioned field. > Also, add the missing conformance check for sps_temporal_id_nesting_flag while > at it. > > Signed-off-by: James Almer > --- > libavcodec/cbs_h265_syntax_template.c | 37 +++++++++++++++------------ > 1 file changed, 20 insertions(+), 17 deletions(-) > > diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c > index 86ca00a0c9..c6db439b3b 100644 > --- a/libavcodec/cbs_h265_syntax_template.c > +++ b/libavcodec/cbs_h265_syntax_template.c > @@ -788,25 +788,28 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, > > ub(4, sps_video_parameter_set_id); > h265->active_vps = vps = h265->vps[current->sps_video_parameter_set_id]; > + if (!vps) { > + av_log(ctx->log_ctx, AV_LOG_ERROR, "VPS id %d not available.\n", > + current->sps_video_parameter_set_id); > + return AVERROR_INVALIDDATA; > + } > > - u(3, sps_max_sub_layers_minus1, 0, HEVC_MAX_SUB_LAYERS - 1); > + u(3, sps_max_sub_layers_minus1, 0, vps->vps_max_sub_layers_minus1); > flag(sps_temporal_id_nesting_flag); > - if (vps) { > - if (vps->vps_max_sub_layers_minus1 > current->sps_max_sub_layers_minus1) { > - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " > - "sps_max_sub_layers_minus1 (%d) must be less than or equal to " > - "vps_max_sub_layers_minus1 (%d).\n", > - vps->vps_max_sub_layers_minus1, > - current->sps_max_sub_layers_minus1); > - return AVERROR_INVALIDDATA; > - } > - if (vps->vps_temporal_id_nesting_flag && > - !current->sps_temporal_id_nesting_flag) { > - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " > - "sps_temporal_id_nesting_flag must be 1 if " > - "vps_temporal_id_nesting_flag is 1.\n"); > - return AVERROR_INVALIDDATA; > - } > + > + if (vps->vps_temporal_id_nesting_flag && > + !current->sps_temporal_id_nesting_flag) { > + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " > + "sps_temporal_id_nesting_flag must be 1 if " > + "vps_temporal_id_nesting_flag is 1.\n"); > + return AVERROR_INVALIDDATA; > + } > + if (current->sps_max_sub_layers_minus1 == 0 && > + current->sps_temporal_id_nesting_flag != 1) { > + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: " > + "sps_temporal_id_nesting_flag must be 1 if " > + "sps_max_sub_layers_minus1 is 0.\n"); > + return AVERROR_INVALIDDATA; > } > > CHECK(FUNC(profile_tier_level)(ctx, rw, ¤t->profile_tier_level, Will apply set. _______________________________________________ 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".