From patchwork Wed Nov 7 03:47:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 10950 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 537AB44DB59 for ; Wed, 7 Nov 2018 05:56:06 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C25B768A718; Wed, 7 Nov 2018 05:55:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 77EA468A552 for ; Wed, 7 Nov 2018 05:55:31 +0200 (EET) Received: by mail-wr1-f65.google.com with SMTP id k15-v6so12875718wre.12 for ; Tue, 06 Nov 2018 19:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V1FGEQROMaMKZ6hjoJ1zcHdPS9AIufkQdiiN3XgUEqs=; b=TMzcf3gfyXk7h1ihf0MStaEQLwmvA2PANWhNyijDqEl64lPjdY/l72UYacBmFRnjcD XNECBJC5Mqc7oJ9Fel4HqvdrSGT712tfDBvCp/+2fwxPBuFZNSvU0VUqfbMXWjY7QW5/ XJLcChaWyFKPvqoLnUuK8/mrvpkSFXnQHLMspbdkBrHytSkIuc8w57Go/h0Ng4WlEKNq Ls62xHLKPRdN+Y9rzHUWQpBpYU4KcrQLNXt5TwaRe1PdAVJkRliej/rdiDCa9Twi45fo nKYviaXtHqqz8XUZZHmnMPxcHTFCRakoW6kduYusKZdnBqymp7CWB2Z1vYFYBTbfjazY 6I4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V1FGEQROMaMKZ6hjoJ1zcHdPS9AIufkQdiiN3XgUEqs=; b=IFFgWLxmmU9QXbPbCcuU+eogHIN1lqKNH7TNPieeuWfdTqxBs6my+fCiGmc2Q/Wmd/ f0l5pLrEJcXiupPyj17ZmUJw8wUZmIUBDV7IOHRLlcnMxcQP0wyv1QGq8TrKY4waI1c2 J59nOWBApeZvRP9Pok5R5m92IzGizfHWJuwJryC4HqRCYTbEdk9Ya/Lzt2CE9VGCpahz 83vxwqd8sm4+KvRDgSaAlwnzRRa95LbD4fUO7gH5AOlL4nDJ6XZxLnDzPOkgjcqAENgJ 5rTP00ZItCYlUdUSzyN6RaI44QEguzQ3rTUGUmYhcJOJFQhFEd+tUbsH8wTDgWVwaCOd 2Kdw== X-Gm-Message-State: AGRZ1gLsRQXc/yN1X1tBCCYVYTshyYGISudYwkM7sz3B0NP7sRZPCgeN ETuJaiJ9iMhRXrvS3BVv8Sq1wJM7 X-Google-Smtp-Source: AJdET5dJQ6YLrkjG/ayA7ENgxdQsJrc/h38jPXSE9zo2rDhYjSmsoHPwYjALr9oUK2yigSzJwU/V5A== X-Received: by 2002:adf:92e5:: with SMTP id 92-v6mr224611wrn.124.1541562538071; Tue, 06 Nov 2018 19:48:58 -0800 (PST) Received: from localhost.localdomain (ipbcc08c44.dynamic.kabel-deutschland.de. [188.192.140.68]) by smtp.googlemail.com with ESMTPSA id j189-v6sm6417360wmf.18.2018.11.06.19.48.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 19:48:57 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 7 Nov 2018 04:47:51 +0100 Message-Id: <20181107034751.5628-2-andreas.rheinhardt@googlemail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181107034751.5628-1-andreas.rheinhardt@googlemail.com> References: <20181107034751.5628-1-andreas.rheinhardt@googlemail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/1] cbs_h264: Fix handling of auxiliary pictures X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The earlier code used the most recent non-auxiliary slice to determine whether an auxiliary slice has the syntax of an IDR slice, even when the most recent slice was from a slice of a redundant frame. Now only slices of the primary coded picture are used, as the specifications mandate. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs_h264_syntax_template.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c index dbf9ff1268..aaa4589f4d 100644 --- a/libavcodec/cbs_h264_syntax_template.c +++ b/libavcodec/cbs_h264_syntax_template.c @@ -1190,11 +1190,10 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw, "in the same access unit.\n"); return AVERROR_INVALIDDATA; } - } else { - h264->last_slice_nal_unit_type = - current->nal_unit_header.nal_unit_type; - } - idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE; + idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE; + } else + idr_pic_flag = current->nal_unit_header.nal_unit_type == H264_NAL_IDR_SLICE; + ue(first_mb_in_slice, 0, H264_MAX_MB_PIC_SIZE - 1); ue(slice_type, 0, 9); @@ -1272,6 +1271,13 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw, if (pps->redundant_pic_cnt_present_flag) ue(redundant_pic_cnt, 0, 127); + else + infer(redundant_pic_cnt, 0); + + if (current->nal_unit_header.nal_unit_type != H264_NAL_AUXILIARY_SLICE + && !current->redundant_pic_cnt) + h264->last_slice_nal_unit_type = + current->nal_unit_header.nal_unit_type; if (slice_type_b) flag(direct_spatial_mv_pred_flag);