From patchwork Tue Sep 12 23:44:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 5117 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp297275jaa; Tue, 12 Sep 2017 16:46:49 -0700 (PDT) X-Received: by 10.223.135.252 with SMTP id c57mr12763259wrc.204.1505260009046; Tue, 12 Sep 2017 16:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505260009; cv=none; d=google.com; s=arc-20160816; b=1DTbzi1EhTLHOVQDNGbwYvdXAop0p0qwVwRzl37x5dhO/MRzCqPfPwqsrsbgYpROTM z7cVQ01UrIAt45iQnt3IUMblK/LQBU5jNTQcZ3nRF8bo9OmGdNyn366BA69owazAC8ZG pDXSxAHQ25vyrT3O1g0eJaee2ZQ/Zfn4luHfDwx10RHdW6pvhklKptpomvcdpVcRBHlf kKkrtZD5EvIGHKFhOOu8dieFenj1idp3uvob0MTy4Wd9gUqvKMvHZ+4b1l/8JJGBIo6e LQs2cWOYtp/+CNCkp9HZARcFLhjLhKkBNEM9a3XQPbq/yDAtmZi0y/G7HUHVKHIAEqwf PZBQ== 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=Ea9Obt/PHP/lNQ9u2X45ifs3WC6vjI/eqE5nW/Tocj6S3jH5LOIfZ+tWrqNTuPPGD2 LjzUiDf0oCW4DBSRth+mqIa52f2zy5Oz7DSnXlAvZwpBXsjF9vJAUuaGrMCHICyxr+Wn NUKc7KtNBwSj4GZXNFc9goIF+7wR5m8/+6tWq2CaYgp5bjK9PDyuMB5bxLQv1pcLC9jf 5uGIJPbZZbZDIh7UpL3qPaNzdMKvm8fuXsFwiKqcru5SPtCunsvdKt0yIEojpFO5hO1P MztDo2kTnqypcphc5Io5MJbl9gULmJX16npe+4Y3ep2EU8BMM+p8HilSeHl3wLyIzPiq MmMg== 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=QNmRm3uM; 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 k51si9957996wrf.82.2017.09.12.16.46.48; Tue, 12 Sep 2017 16:46:49 -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=QNmRm3uM; 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 548E7689E79; Wed, 13 Sep 2017 02:44:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 33790689DFF for ; Wed, 13 Sep 2017 02:44:23 +0300 (EEST) Received: by mail-wr0-f174.google.com with SMTP id 108so25569901wra.5 for ; Tue, 12 Sep 2017 16:44:29 -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=QNmRm3uMmeXTQfMW2Y4BYDniz+bwemrEhCS9/T1qoHFNQLqDrPd2GfeERPW+bonWBg xRQtX3ci58ntve2CVBQHFyHKW0z+SGr27j07pIjj+ga4B8gZ0gatxO7TtQEiufJnxmqd 8J5a1MCUkEfZ+BLnC7IkuwwlEdGmFRqeVkpAr2O+Y31XbcJ9cfoxVYGpxwT4hGxZD++1 KrOLtgTI4OoVBV3iQrVv5LX5I1sIr7UcM19G9+zxafsER477oUjTcIZ2/niru3iTUWVm o1jvV3iuDXII2q2sCQIDEDG4nycvxMma+c1PS9hKeeNqOFCrNixI0vp4Jf5+fPq/X1je yQIA== 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=HeuZD8MXquSOXsqMQTaF0lM0E9kkYU5LqR8bu3Xl7VnQ6KHo+t76bJG8/D0cNyy+eN QSZ7XyhPeo/0zROPfVdDYsMCUc0iytKa2I7YA+y10TMgYN38ft6qYqwfioFC4bBtjUCR /jeDB0JguJpNtolhExDDDDNC/sQ3DYjVss7DZe0QQrXpaXWLAexqko2kODT06tBlQ79O gdWI+qevO792W75yzWWCpnrFDMOAdz3i5p7wNROPn4e8DcxN2BQMh/qUkIsN9zLrKjyh bar3q3NFLAS71uOwiDElLE3Rd4rgI7neZcmLZgKJLFVzG1koVSfhG+wc7cCwNCxxuReq Q6TQ== X-Gm-Message-State: AHPjjUhRZtamAO53xJms+T1No16tZBKj28W0gMeFuHFEzM5rQQc9vA01 BshxHs+VdlhgXtyrTQs= X-Google-Smtp-Source: ADKCNb7Z/Cw6byQASNhfTq5jVoM3eFCRn6q4iTYIP9uaxl4Cw4fpoxweBh22P6t0RprjOdyRAdGDfg== X-Received: by 10.223.176.13 with SMTP id f13mr12549403wra.220.1505259868691; Tue, 12 Sep 2017 16:44:28 -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 p193sm4378138wmg.37.2017.09.12.16.44.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 16:44:27 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Wed, 13 Sep 2017 00:44:04 +0100 Message-Id: <20170912234410.14093-15-sw@jkqxz.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912234410.14093-1-sw@jkqxz.net> References: <20170912234410.14093-1-sw@jkqxz.net> Subject: [FFmpeg-devel] [PATCH 14/20] 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 }, };