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 0BC8B4113E for ; Sat, 16 Apr 2022 08:31:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0C90168B506; Sat, 16 Apr 2022 11:31:32 +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 13E1968A4CB for ; Sat, 16 Apr 2022 11:31:26 +0300 (EEST) Received: by mail-pg1-f171.google.com with SMTP id k29so10164686pgm.12 for ; Sat, 16 Apr 2022 01:31:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to:references :content-language:autocrypt:in-reply-to; bh=U0lmA/KcO9ntSnpwymSJOpyh5bUdAzuAUA9fas/olC4=; b=ajcSz9EMixaXLdInk/ALP2YOduzA5B73Azy3+kEhLlKz5UIleONAx0C6mcg4WORs4N Xg6xsBJACaleeCQ/ep/KX21WGTmOVpyfoSS+yvdjwxJRTwoosKWA/rtdaQUH+8l+pohI 2FdZ1wafHoTa8mkZPr26Vjjf366V2BTbA2e2dZrUfL+yqd59/iMTzSh2M6IYsu5dzQmu Pbqr6+dO8A96CjXKgTBrMUgKSSyFTjLVvE2KYCj6MOGOJgr2/heainXDZrIeGrnIMeIJ Gxb6fxxGXQU933cKzWwwuW5j7cr8EjAYmZxjd+k8mKnaYN13lRhUxgeoF+l0VaS/qeSc 9x4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:references:content-language:autocrypt:in-reply-to; bh=U0lmA/KcO9ntSnpwymSJOpyh5bUdAzuAUA9fas/olC4=; b=pmogd/rD+qjwOS7KLtFuBhB7XjLLMxE2wb0/NuHeW3rl3I+3UXtvXK3fJLdaP+VoFG kb3KKz59cX8T9T9yD9n97PE8K2hdaeeLc8dEfQEFI8DEZ0iLWM1JjMEjnd3kqn2/mI41 U3wJuNko359r3CWuRehkUz3zrlMb4PFwkBHFSMPiSV2oIMXAbqPFnPsyaPusedS9VikY ahWmTRXMk2GOEhDpuUaaJfAzZLKh9wu3YgjbDQeYuUgPr57tafhIAkPNp/3Wx5OKKUm8 Ya5ETOcML+wxaYdCWmKfQWfHTpnAnobpARqHg4LVSDVunX+ZB4fBwhD7V7GKrcLsoD8A RkUg== X-Gm-Message-State: AOAM531iulya25DucKELuUyJ4pOeI484rtZk47ioQNXonFP2q77KGApK 0z3vNx/3p7OB+HwVXkr4kFv9u8+62oMs4w== X-Google-Smtp-Source: ABdhPJx6iPZuYkzm4/r+N1ze1zSMbuGlNylJRnQLI4imwdNXcBGuUUYANdS8uu54CmqxNdbCLwzFwA== X-Received: by 2002:a63:de4d:0:b0:39d:912c:b51a with SMTP id y13-20020a63de4d000000b0039d912cb51amr2125087pgi.435.1650097883781; Sat, 16 Apr 2022 01:31:23 -0700 (PDT) Received: from [10.1.2.131] (ec2-34-214-110-43.us-west-2.compute.amazonaws.com. [34.214.110.43]) by smtp.gmail.com with ESMTPSA id v16-20020a62a510000000b0050759c9a891sm5083336pfm.6.2022.04.16.01.31.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Apr 2022 01:31:23 -0700 (PDT) Message-ID: <9c14fe0c-ba79-9136-227a-26bfdcdf562e@gmail.com> Date: Sat, 16 Apr 2022 16:31:21 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 From: Xiaolei Yu To: ffmpeg-devel@ffmpeg.org References: <5ca902bc-99cc-2866-ec9a-068ac356924d@gmail.com> <164914981025.19727.3038981711097240936@lain.red.khirnov.net> <2237ca87-c339-b00c-1562-5c49faee0987@gmail.com> Content-Language: en-US Autocrypt: addr=dreifachstein@gmail.com; keydata= xjMEYRw8qhYJKwYBBAHaRw8BAQdAh+vf1kJB/kff/4Me8i9RUvNRzGhaR03N8K57WGkQ0UzN JFhpYW9sZWkgWXUgPGRyZWlmYWNoc3RlaW5AZ21haWwuY29tPsKRBBMWCAA5FiEE/7Pjp40G uVEUD2hqIq73773O/wMFAmEcPKoFCQWjmoACGwMFCwkIBwIGFQgJCgsCBRYCAwEAAAoJECKu 9++9zv8D4JABAIsJiPS0oJfJ+DX/8Mpu8vzh0qh2qPzmnTz3kGcebmiXAQCGP0hNLRgJDkot CK+4cPGb5LQkH064KC9OZbIlQpZmCc44BGEcPKoSCisGAQQBl1UBBQEBB0Drgb08O76xaxvz RJuvOc4PEwBagqZ+KVqVGe9c9Ij5DgMBCAfCfgQYFggAJhYhBP+z46eNBrlRFA9oaiKu9++9 zv8DBQJhHDyqBQkFo5qAAhsMAAoJECKu9++9zv8DeUIBAMjEnBZmmeGxAzqlJWypMPXUSWzF O5GSqVC+KPxI0iMEAP0WzgfYt5i/BeHy8B1fYVqv9tHJB4HXeD6OL76U+cmiAA== In-Reply-To: <2237ca87-c339-b00c-1562-5c49faee0987@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 1/2] avcodec/hevcdec: skip generating missing refs in foll lists 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-Type: multipart/mixed; boundary="===============4400913553207775616==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============4400913553207775616== Content-Language: en-US Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------heBBL00Ez1NOUxR86OOz0cEK" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------heBBL00Ez1NOUxR86OOz0cEK Content-Type: multipart/mixed; boundary="------------uTjr2hK6B5XWpAStkPpIYFwm"; protected-headers="v1" From: Xiaolei Yu To: ffmpeg-devel@ffmpeg.org Message-ID: <9c14fe0c-ba79-9136-227a-26bfdcdf562e@gmail.com> Subject: [PATCH v2 1/2] avcodec/hevcdec: skip generating missing refs in foll lists References: <5ca902bc-99cc-2866-ec9a-068ac356924d@gmail.com> <164914981025.19727.3038981711097240936@lain.red.khirnov.net> <2237ca87-c339-b00c-1562-5c49faee0987@gmail.com> In-Reply-To: <2237ca87-c339-b00c-1562-5c49faee0987@gmail.com> --------------uTjr2hK6B5XWpAStkPpIYFwm Content-Type: multipart/mixed; boundary="------------h8k2DluAoSdQABYLRCihG3Lj" --------------h8k2DluAoSdQABYLRCihG3Lj Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Missing refs shall be generated only when they are actually used. Without this change a sequence of a BLA picture and an associated RASL pi= cture would still be decoded without complaints if the RASL picture is mislabel= ed as RADL. --- libavcodec/hevc_refs.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index fe18ca2b1d..84a21991c7 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -378,9 +378,6 @@ static HEVCFrame *find_ref_idx(HEVCContext *s, int po= c, uint8_t use_msb) } } =20 - if (s->nal_unit_type !=3D HEVC_NAL_CRA_NUT && !IS_BLA(s)) - av_log(s->avctx, AV_LOG_ERROR, - "Could not find ref with POC %d\n", poc); return NULL; } =20 @@ -426,7 +423,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s= , int poc) =20 /* add a reference with the given poc to the list and mark it as used in= DPB */ static int add_candidate_ref(HEVCContext *s, RefPicList *list, - int poc, int ref_flag, uint8_t use_msb) + int poc, int ref_flag, uint8_t use_msb, enu= m RPSType rps_type) { HEVCFrame *ref =3D find_ref_idx(s, poc, use_msb); =20 @@ -434,6 +431,15 @@ static int add_candidate_ref(HEVCContext *s, RefPicL= ist *list, return AVERROR_INVALIDDATA; =20 if (!ref) { + int allow_missing =3D !(rps_type =3D=3D ST_CURR_BEF || rps_type = =3D=3D ST_CURR_AFT || + rps_type =3D=3D LT_CURR); + + /* skip generating missing refs in foll lists as they are not us= ed by current frame */ + if (allow_missing) + return 0; + + av_log(s->avctx, AV_LOG_ERROR, "Could not find ref with POC %d\n= ", poc); + ref =3D generate_missing_ref(s, poc); if (!ref) return AVERROR(ENOMEM); @@ -484,7 +490,7 @@ int ff_hevc_frame_rps(HEVCContext *s) else list =3D ST_CURR_AFT; =20 - ret =3D add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_SH= ORT_REF, 1); + ret =3D add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_SH= ORT_REF, 1, list); if (ret < 0) goto fail; } @@ -494,7 +500,8 @@ int ff_hevc_frame_rps(HEVCContext *s) int poc =3D long_rps->poc[i]; int list =3D long_rps->used[i] ? LT_CURR : LT_FOLL; =20 - ret =3D add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_LO= NG_REF, long_rps->poc_msb_present[i]); + ret =3D add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_LO= NG_REF, long_rps->poc_msb_present[i], + list); if (ret < 0) goto fail; } --=20 2.35.1 --------------h8k2DluAoSdQABYLRCihG3Lj Content-Type: application/pgp-keys; name="OpenPGP_0x22AEF7EFBDCEFF03.asc" Content-Disposition: attachment; filename="OpenPGP_0x22AEF7EFBDCEFF03.asc" Content-Description: OpenPGP public key Content-Transfer-Encoding: quoted-printable -----BEGIN PGP PUBLIC KEY BLOCK----- xjMEYRw8qhYJKwYBBAHaRw8BAQdAh+vf1kJB/kff/4Me8i9RUvNRzGhaR03N8K57 WGkQ0UzNJFhpYW9sZWkgWXUgPGRyZWlmYWNoc3RlaW5AZ21haWwuY29tPsKRBBMW CAA5FiEE/7Pjp40GuVEUD2hqIq73773O/wMFAmEcPKoFCQWjmoACGwMFCwkIBwIG FQgJCgsCBRYCAwEAAAoJECKu9++9zv8D4JABAIsJiPS0oJfJ+DX/8Mpu8vzh0qh2 qPzmnTz3kGcebmiXAQCGP0hNLRgJDkotCK+4cPGb5LQkH064KC9OZbIlQpZmCc44 BGEcPKoSCisGAQQBl1UBBQEBB0Drgb08O76xaxvzRJuvOc4PEwBagqZ+KVqVGe9c 9Ij5DgMBCAfCfgQYFggAJhYhBP+z46eNBrlRFA9oaiKu9++9zv8DBQJhHDyqBQkF o5qAAhsMAAoJECKu9++9zv8DeUIBAMjEnBZmmeGxAzqlJWypMPXUSWzFO5GSqVC+ KPxI0iMEAP0WzgfYt5i/BeHy8B1fYVqv9tHJB4HXeD6OL76U+cmiAA=3D=3D =3DAsFU -----END PGP PUBLIC KEY BLOCK----- --------------h8k2DluAoSdQABYLRCihG3Lj-- --------------uTjr2hK6B5XWpAStkPpIYFwm-- --------------heBBL00Ez1NOUxR86OOz0cEK Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wnsEABYIACMWIQT/s+OnjQa5URQPaGoirvfvvc7/AwUCYlp+2QUDAAAAAAAKCRAirvfvvc7/A6ZK AQC7yy2w9Z9DqJLOYs37FVX2UCjjda/fRfmFwhSNWSmieAD/V8HpcHYRwEe/q0UysMgWvRsTa/ow bZztUyS7yVp7CwM= =yCvw -----END PGP SIGNATURE----- --------------heBBL00Ez1NOUxR86OOz0cEK-- --===============4400913553207775616== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============4400913553207775616==--