From patchwork Sun Aug 20 22:41:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 4776 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.37.132 with SMTP id g126csp2344079jag; Sun, 20 Aug 2017 15:44:38 -0700 (PDT) X-Received: by 10.223.167.73 with SMTP id e9mr9132886wrd.205.1503269078456; Sun, 20 Aug 2017 15:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503269078; cv=none; d=google.com; s=arc-20160816; b=EkS4sbqoGGdou7hCv2dDMzU9B9wS1oJECI/mkxRfqarMiZVczDO8+yn1BX4tZbe+w4 stQe14y5Xm6gpci1ABzL+VVciveaDyULYm6xbugLmipCaIMQhsuU5TGqhf4hRHNCmMsJ qo7FAMHHbvOL13rEu+zlm6WrHpXhf3CwRHbQRcNOUfp1IIMGkaeq5aUrHwTqW3lp6POe P19IHGaIotmVBCBqIfbPywgV0HI9qSScJduBRKmwtYFyVhEP6gN70eji6IMRHbfWHmcM bd6BPTrIptqZnkF/RujH+iLRZe6lbAfdW11J1KBHwd8oSVP58WBr+5GcprmQHpkbe7xd b/tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=aOqbQqHxhFo+c/t+UhD5oULekZQ+pfp3DiDThBIW+gI=; b=GygA2202wer9740++hC1IaJtnU3syp+t9/gj4xzE3+HB+dBHnoTyCMrJJRbk4/9Gn9 Krfa4AlJUTvUUwrZVbUJaUCcSgFK/V3ZsFqSZXlsMSHHbM8Tr717rvY/5dA0tNPsGQJD OEiwjeHxyBKJ/uWxe6rNWSptIuvKpVrVVXmteWPYywxoBfKLHPgEyDynIYBGh2c+f3Hl qElt9Go5LHsFx7RRixuUW5JryB2rx93YZOsAjxjyMMvOAJgFlpvWboF3BBW0194ofWtj z/z4aFCrhaqCsxNEXKHMQwpigj2Y/4R0JRf4gyHLVeI+E3xXet6/oXDuNTTI09ZWL9Ds OJNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20150623.gappssmtp.com header.s=20150623 header.b=KJ+4HcVf; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k84si540158wmh.61.2017.08.20.15.44.37; Sun, 20 Aug 2017 15:44:38 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20150623.gappssmtp.com header.s=20150623 header.b=KJ+4HcVf; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2F98A689B5C; Mon, 21 Aug 2017 01:42:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E107B689B0D for ; Mon, 21 Aug 2017 01:42:08 +0300 (EEST) Received: by mail-wr0-f177.google.com with SMTP id p14so15458219wrg.1 for ; Sun, 20 Aug 2017 15:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=LizbH2qdU9SBPiOjfAxpW79k6xF/wJwP1pQX7lVD+js=; b=KJ+4HcVf2oxpncSCkumB6zHdEkf5gMcjkv3rau5mycDbfmeW70e6wNxeC9Qy3inOwd WfstvUFEhIzdbc2pFb5SHybI8hU+mwRRT5XebOySYueWAXYa6rbivySRCPpgvD+mIot0 AWnb0/d/nQz7uUJFmjY2+w/2JisqhF0iEb7E/qqCfDK1HFdGaWgIcZvGZL2k5ctA9fkB 9hnXknuVHeWVoqvqSBYnyLKlxJA/ykY5y+WCDh3v0sBz8WpDi5wdMBHwHspJg0BgxdNl oBf9wmRFdZ7JYvqcfqNw6d30L8sZSoTB8eDj7wBJoJ0Dq3idFMJJTZbHCJpIfArJcTdy aqmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=LizbH2qdU9SBPiOjfAxpW79k6xF/wJwP1pQX7lVD+js=; b=cngr4i8ZmznK+l/uPha8kHBk41KPw846NLAz6DYKDv8k328pWnvTw4mKW+hFW6YUl8 WIwfQhnwks8eOyahOJ79z9s9t51t2cNaE47s77V0pCspmnFu7d1f3plIymSf5I3Bt14N v1CDC/TESoAL/okXEeWMHIxNNVWVCMUoYSopajG6ti5dIu+sJY7Y2GpMMmbeslzPNSxa GhIuoPm2QBcyAL4c0x4QUgQN3S+rkMupSdmFszhtAhs0LrJmjYy6M1ifYGm4P4CF6HCD aioWBIsSrP0sI1eT5chQicTDuldQTSju7iyRCSl0nk0dEr0+n9CfivSIEtaWxmB0XRiT zDPQ== X-Gm-Message-State: AHYfb5izcOzi2Fa6W/v1kF/yDHN2ZFR8l8TW55/nsvXh3XYyLBhdDI9J JdwJdAfyUJIHubTd/WI= X-Received: by 10.28.191.14 with SMTP id p14mr6417527wmf.64.1503268935114; Sun, 20 Aug 2017 15:42:15 -0700 (PDT) Received: from rywe.jkqxz.net (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id f9sm5391116wmf.18.2017.08.20.15.42.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Aug 2017 15:42:14 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Aug 2017 23:41:44 +0100 Message-Id: <20170820224146.21289-17-sw@jkqxz.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170820224146.21289-1-sw@jkqxz.net> References: <20170820224146.21289-1-sw@jkqxz.net> Subject: [FFmpeg-devel] [PATCH 16/18] vaapi_h264: Add support for SEI recovery points 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Included by default with non-IDR intra frames. (cherry picked from commit a49ee60d5fdbdae1706a44cfbb814abb9793815f) --- libavcodec/vaapi_encode_h264.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index 56e10074c8..2ba9027230 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -37,6 +37,7 @@ enum { SEI_TIMING = 0x01, SEI_IDENTIFIER = 0x02, + SEI_RECOVERY_POINT = 0x04, }; // Random (version 4) ISO 11578 UUID. @@ -61,6 +62,7 @@ typedef struct VAAPIEncodeH264Context { H264RawSEIBufferingPeriod buffering_period; H264RawSEIPicTiming pic_timing; + H264RawSEIRecoveryPoint recovery_point; H264RawSEIUserDataUnregistered identifier; char *identifier_string; @@ -232,6 +234,11 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx, priv->sei.payload[i].payload.pic_timing = priv->pic_timing; ++i; } + if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) { + priv->sei.payload[i].payload_type = H264_SEI_TYPE_RECOVERY_POINT; + priv->sei.payload[i].payload.recovery_point = priv->recovery_point; + ++i; + } priv->sei.payload_count = i; av_assert0(priv->sei.payload_count > 0); @@ -617,6 +624,14 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, priv->sei_needed = 1; } + if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) { + priv->recovery_point.recovery_frame_cnt = 0; + priv->recovery_point.exact_match_flag = 1; + priv->recovery_point.broken_link_flag = ctx->b_per_p > 0; + + priv->sei_needed = 1; + } + vpic->CurrPic = (VAPictureH264) { .picture_id = pic->recon_surface, .frame_idx = priv->frame_num, @@ -970,7 +985,7 @@ static const AVOption vaapi_encode_h264_options[] = { { "sei", "Set SEI to include", OFFSET(sei), AV_OPT_TYPE_FLAGS, - { .i64 = SEI_IDENTIFIER | SEI_TIMING }, + { .i64 = SEI_IDENTIFIER | SEI_TIMING | SEI_RECOVERY_POINT }, 0, INT_MAX, FLAGS, "sei" }, { "identifier", "Include encoder version identifier", 0, AV_OPT_TYPE_CONST, { .i64 = SEI_IDENTIFIER }, @@ -978,6 +993,9 @@ static const AVOption vaapi_encode_h264_options[] = { { "timing", "Include timing parameters (buffering_period and pic_timing)", 0, AV_OPT_TYPE_CONST, { .i64 = SEI_TIMING }, INT_MIN, INT_MAX, FLAGS, "sei" }, + { "recovery_point", "Include recovery points where appropriate", + 0, AV_OPT_TYPE_CONST, { .i64 = SEI_RECOVERY_POINT }, + INT_MIN, INT_MAX, FLAGS, "sei" }, { NULL }, };