From patchwork Fri Dec 15 07:04:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Bin X-Patchwork-Id: 6790 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp140139jah; Thu, 14 Dec 2017 23:10:17 -0800 (PST) X-Google-Smtp-Source: ACJfBovcF3DnXGnuk4nPnKRF3iS7isY9fqElwbOG+c4BwjvcmhK9Z3wIfTv2vAcfoJ0M/f+Ozz+t X-Received: by 10.223.154.43 with SMTP id z40mr8870159wrb.210.1513321817681; Thu, 14 Dec 2017 23:10:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513321817; cv=none; d=google.com; s=arc-20160816; b=kk8uYVmLsS03z/pZHYJnrpi13ufqr2bw4yOoZvXtTuRuF76xWwSJY3uGro7Xece4IE jlbDdoayAYybXl/8aMhvHx35mb7cr4mHuvqjQzCNzseq0PoN/EM20WGHb73X+k/EHFsx 6TzJtoejaLZNtL1xOhxNvy9nCMtyhZ1EPqlLKY2Yk1kSJHbTzKRkRXKP1uL8wE7Ms+yt hxZSniGWx0DcXiYLokxPxcr8AyyNm+EgV/6FDFjkXlNLorz7MLKZkxuhW7vZNDCWwtkd VMhq44AbJBFW2ECkmP2Um6cD3U9CrFcTeUh4lQUGPefvNtV/Rs8hDJMDY7ByGXYTXP/O zDRw== 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:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=r4gZYesu/F7hnmTO6h7tnYoGVkyXCKKBpZXMgLtxBLE=; b=zlxFfK1ijnoDac8d748HRI18ktw4TVwhAUksLpx/L6qg9udgOGMy5+95/31yjiTy1i YTTCtPKulIzwxAfrA+LVFS4Y2jvu8ViPWi41jPi6VqLjzRnpSwJ5hLJK2ftXU/2Zxg3G VTOHFYdbYZoGurszXjzfENfARco3TPAdXfCt0VaJaPzzo4p/qAbDatZ7nQPcgGUIPOw3 h4bcx3d/R3oirRZHaMVgrTDbGjsqjbX0/siNjcAb3HgOoWasqD/DVNIIEX9sueC6L3eh H6MjiKELp89kZ+4PL52PauOnXkAuexu2xPVBlb0GZj9An/9V3et0sQKIhQaLMU2ZU0Sl XQZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=bYq5/JDU; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t84si4115912wmt.58.2017.12.14.23.10.17; Thu, 14 Dec 2017 23:10:17 -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=@gmail.com header.s=20161025 header.b=bYq5/JDU; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 00D086898CF; Fri, 15 Dec 2017 09:10:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A957689828 for ; Fri, 15 Dec 2017 09:10:01 +0200 (EET) Received: by mail-pg0-f68.google.com with SMTP id b18so5219106pgv.10 for ; Thu, 14 Dec 2017 23:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6r2SzlKTwOvbrR+HHB698Xkya963IPxDk2Qv8iUaiBw=; b=bYq5/JDUgwks04mwh7kGxGa/NOcVEqxqZB87MRBE+VfYamzeWcQLsW/gow5ZkXo8Ni WFDgf8qv0xFnjWLrBEINlZmcac9M4xPb/4/b1LauKEdmCnxsaBpC/FhS/w0jpdep6xLq LbuPjz157Xx3hMh1H9RhqgtWI+cJb6FHbEEYfRB8aYeiD59VzhmQRiWFPZLLMb1Y7M3C LXBWsKkkXoGVuJ0HPTgEk8CUrqQCe+mbZ0vwXrOWSHLihbk4uLo3bv31TbOzyjsoyfTn DR5JMTpiG+xAPwDsgcHamsspaw6FE97aHzaT40CvlWl3d5mOe31WW3yu2pvVBHPmO0sW fivA== 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; bh=6r2SzlKTwOvbrR+HHB698Xkya963IPxDk2Qv8iUaiBw=; b=n5ecY2lGlM3kw5NxhDpwaz9FX1C3YKPnxY6tHhXxE1Lc8c6IIbSszAgj2IoT/q2fxB HPaI4ptUET+TiTjwqzc3yrX/Y0AhYngqQJsKoRc4ZchcpUnvkerZwt0fErdOxAskCCOO DdB0xfwPCqFp5zn2zvARiLEA1FOhsKM3B/vsO8aHdw6UUOf4k40GOBxedN3SanJm5x0X zLd1tfJ6UR4LnDpQsAmBYxTHrqQ+fGEZgroznwsmcVHMy5nR6FgMDCmCBefjV5JOMUfP Rio+4f1YrfWeryK15vuKuLYWGW8NhFwLsnpAhzeuafraZtxr+UDSnaJz4tsAayZY9G5i 9w1A== X-Gm-Message-State: AKGB3mLtA0xeMmy9ggwGRMKwV+L/B0ePNgHpmc1kyluB7bY3RLlKPYxU 6dT9OEyrrk3w8n4aM7A0cJZo X-Received: by 10.84.234.135 with SMTP id n7mr11765082plk.298.1513321477262; Thu, 14 Dec 2017 23:04:37 -0800 (PST) Received: from localhost.localdomain ([188.166.166.98]) by smtp.gmail.com with ESMTPSA id i20sm10834340pfj.58.2017.12.14.23.04.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2017 23:04:36 -0800 (PST) From: wbsecg1@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 15 Dec 2017 15:04:23 +0800 Message-Id: <20171215070423.34629-1-wbsecg1@gmail.com> X-Mailer: git-send-email 2.15.1 Subject: [FFmpeg-devel] [PATCH 09/14] videotoolbox: allow software implementation 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 Cc: wang-bin MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: wang-bin hevc is supported on macOS 10.12+ and iOS11+. sw implementaion is provided for old devices. vt sw decoder is more energy effecient than ffmpeg sw decoder. the sum of program and vt service cpu usage is about 50% lower than ffmpeg. decoding speed is faster sometimes(if opengl compatiblility attribute is disabled) --- libavcodec/videotoolbox.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index e66cd23451..9d2f0afa20 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -40,6 +40,9 @@ #ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder # define kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder CFSTR("RequireHardwareAcceleratedVideoDecoder") #endif +#ifndef kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder +# define kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder CFSTR("EnableHardwareAcceleratedVideoDecoder") +#endif #if !HAVE_KCMVIDEOCODECTYPE_HEVC enum { kCMVideoCodecType_HEVC = 'hvc1' }; @@ -684,7 +687,9 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec &kCFTypeDictionaryValueCallBacks); CFDictionarySetValue(config_info, - kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, + (avctx->hwaccel_flags & AV_HWACCEL_FLAG_ALLOW_SOFTWARE) + ? kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder + : kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, kCFBooleanTrue); CFMutableDictionaryRef avc_info;