From patchwork Sun Feb 12 19:02:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Miroslav_Sluge=C5=88?= X-Patchwork-Id: 2524 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp583870vsb; Sun, 12 Feb 2017 11:02:39 -0800 (PST) X-Received: by 10.28.182.70 with SMTP id g67mr35936674wmf.131.1486926158931; Sun, 12 Feb 2017 11:02:38 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 13si10768625wrz.282.2017.02.12.11.02.38; Sun, 12 Feb 2017 11:02:38 -0800 (PST) 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=@email.cz; dkim=neutral (body hash did not verify) header.i=@email.cz; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=email.cz Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9C779689DD9; Sun, 12 Feb 2017 21:02:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mxf2.seznam.cz (mxf2.seznam.cz [77.75.76.123]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E316B680AA5 for ; Sun, 12 Feb 2017 21:02:25 +0200 (EET) Received: from email.seznam.cz by email-smtpc4a.ng.seznam.cz (email-smtpc4a.ng.seznam.cz [10.23.10.105]) id 6ad442065e035a1a6a466b0b; Sun, 12 Feb 2017 20:02:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=email.cz; s=beta; t=1486926150; bh=th+vK4jLVo8daX34o+hnFl/aZ9Rp6zx1S89LQ0MSjqw=; h=DKIM-Signature:Received:From:Subject:To:Message-ID:Date: User-Agent:MIME-Version:Content-Type; b=CYlIH6UDTI978injRum0097grS7/iSZyNo0BnAB68dT+AyHg88LOaRxTEOtF8Y8uP SV4opUFdhItU0T98Tjr58ZaXGrLC/Mo1XflXg0KTJ6c6jgSCiXKMYq9imvKEH0AzNr sTjtIZByXo70fjueUsxB/9NmBXVd9b59IOfh+GXI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=email.cz; s=beta; t=1486926150; bh=th+vK4jLVo8daX34o+hnFl/aZ9Rp6zx1S89LQ0MSjqw=; h=Received:From:Subject:To:Message-ID:Date:User-Agent:MIME-Version: Content-Type; b=I2SWIkFKeeN4cIOqc7EcT1Dog8t6lyvh4DWQLo4q/v6N6wfTWVoQ2FHjJ1jctNDxG wY2lDsgkwdjU2bUhYzCulyfzZzgu/XQ+27IzDdm6DnSL+1rOhTN0j8woZ4WgVi1MEi ZmOPANQxAPyPcKaoBm9JR2jk+qIOxMaHKHRvg+HA= Received: from [192.168.0.6] (ip-94-113-140-7.net.upcbroadband.cz [94.113.140.7]) by email-relay7.ng.seznam.cz (Seznam SMTPD 1.3.56) with ESMTP; Sun, 12 Feb 2017 20:02:29 +0100 (CET) From: =?UTF-8?Q?Miroslav_Sluge=c5=88?= To: ffmpeg-devel@ffmpeg.org Message-ID: <58A0B144.8010500@email.cz> Date: Sun, 12 Feb 2017 20:02:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] cuvid: add drop_second_field as input option and enable it by default 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" There is no need to copy second field if deinterlacing, it doesn't make sense to use two times same image. From 73d8f9fa17c26125a5b03243284f67126c70d7a6 Mon Sep 17 00:00:00 2001 From: Miroslav Slugen Date: Sun, 12 Feb 2017 20:00:51 +0100 Subject: [PATCH 1/1] cuvid: add drop_second_field as input option and enable it by default --- libavcodec/cuvid.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c index 9b35476..a2e125d 100644 --- a/libavcodec/cuvid.c +++ b/libavcodec/cuvid.c @@ -42,6 +42,7 @@ typedef struct CuvidContext char *cu_gpu; int nb_surfaces; + int drop_second_field; AVBufferRef *hwdevice; AVBufferRef *hwframe; @@ -298,8 +299,10 @@ static int CUDAAPI cuvid_handle_picture_display(void *opaque, CUVIDPARSERDISPINF } else { parsed_frame.is_deinterlacing = 1; av_fifo_generic_write(ctx->frame_queue, &parsed_frame, sizeof(CuvidParsedFrame), NULL); - parsed_frame.second_field = 1; - av_fifo_generic_write(ctx->frame_queue, &parsed_frame, sizeof(CuvidParsedFrame), NULL); + if (!ctx->drop_second_field) { + parsed_frame.second_field = 1; + av_fifo_generic_write(ctx->frame_queue, &parsed_frame, sizeof(CuvidParsedFrame), NULL); + } } return 1; @@ -930,6 +933,7 @@ static const AVOption options[] = { { "adaptive", "Adaptive deinterlacing", 0, AV_OPT_TYPE_CONST, { .i64 = cudaVideoDeinterlaceMode_Adaptive }, 0, 0, VD, "deint" }, { "gpu", "GPU to be used for decoding", OFFSET(cu_gpu), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VD }, { "surfaces", "Maximum surfaces to be used for decoding", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, INT_MAX, VD }, + { "drop_second_field", "Drop second field when deinterlacing", OFFSET(drop_second_field), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VD }, { NULL } }; -- 2.1.4