From patchwork Sat Nov 11 15:21:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 5921 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp219129jah; Sat, 11 Nov 2017 07:22:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMZHyePrY3xtczXRT+yvOoo0bPdDGIiVvpoGgnDlkvMK+jIChzRcYHmIFYkpYWkwgv2iirMM X-Received: by 10.28.109.153 with SMTP id b25mr1251985wmi.130.1510413748880; Sat, 11 Nov 2017 07:22:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510413748; cv=none; d=google.com; s=arc-20160816; b=WBPfBhLsYO68sZZPaIuDBTNNktRC11+D+09afCn+LgJUUhkl07PRF66PA4NSN1vXSx tAYGVWSOcfL6fr8HaFXcYM/IqZGgs6fZaYwc0FzYi8t4WEkcfruJl1RMTGj4m4CbLHth sXoiCJC5bTuhvC5m4rx0LFQcLKE31WSMlQ8q2epv7kM1U7Lb4C4sxL+grEzT1kO6ChMO bZU0C8KrfeFSIPBODzOF4lV6Hj5Ewgpkz0olzNirMYsrYy+I2wmu5MAjtkzVrsTVHPCS AquX1M2T1U4WTCT8cvmrgs9opGNaSapUnylqclamASPZVof0SiU3CzwYdX82nefM0I/5 9PpQ== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=6YIR1IPWHpddIjw3T3TkHa8NLs1GwaImJq4rPe7Dp6g=; b=W9uaORH1qhS8T4qcc4M6ww02gx4lEdVqIncg6zKZ2oxF5tyWTngxV0dUZ2H7kwol68 BNXpqpjwE3kyr8uYFJrvUwVfDvsRFQbkMI3WQm22HTRw/4dKyS6qIO5hUlRd5ulRsZwh 5d54oNypy68r+7GnvnhHU+xlbv+cKo5z8lvhNqO11/FgISp+utmZWwi4UPMkPMvzMbJ/ ElScB5MFTehid8t49jO6bUU+8Vkn+TNlYCt2/OrlLYVmkwB1P8/rzFVMT8zEgp2hkLxv HQtYJt4XGyq4X5YOaptT4lH1U0TcZNIGEsfVsU0rtev0wBG/TSjseUOcg3Qe9K/TPz0P 3X2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=gpAAstOh; 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 186si3259544wmm.6.2017.11.11.07.22.28; Sat, 11 Nov 2017 07:22:28 -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=@rothenpieler.org header.s=mail header.b=gpAAstOh; 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 E7168689B6E; Sat, 11 Nov 2017 17:21:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B297D68973B for ; Sat, 11 Nov 2017 17:21:46 +0200 (EET) Received: from localhost.localdomain (unknown [IPv6:2a02:8109:43f:959c:ba97:5aff:fe10:ec69]) by btbn.de (Postfix) with ESMTPSA id 6977C5F25A; Sat, 11 Nov 2017 16:22:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1510413720; bh=1MVstaDw6mmd4T8rIZE3tDBZKCRiKwotrOa/yYNkyfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gpAAstOhgbFaAC5jp0NnrHMrmI++besMu+wUvzvlDn0pueKSQm8FZEwIYRfy7AqY2 nb5VeoDN8k7cJsIWjWTI+Uo09l5Y/kGBqd3D7Wv1JJFab0ue8LfWrdwLbzUsdX5Nw+ OWrjsY2RIsibTeO6W2aaEI9sqEdNACizddgm5hBM= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Nov 2017 16:21:38 +0100 Message-Id: <20171111152139.14394-3-timo@rothenpieler.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171111152139.14394-1-timo@rothenpieler.org> References: <20171111152139.14394-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/nvdec: add support for 12 bit formats 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: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/nvdec.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 780c2e67cf..d3620f0d1f 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -234,9 +234,21 @@ int ff_nvdec_decode_init(AVCodecContext *avctx, unsigned int dpb_size) frames_ctx->format = AV_PIX_FMT_CUDA; frames_ctx->width = (avctx->width + 1) & ~1; frames_ctx->height = (avctx->height + 1) & ~1; - frames_ctx->sw_format = AV_PIX_FMT_NV12; - frames_ctx->sw_format = sw_desc->comp[0].depth > 8 ? - AV_PIX_FMT_P010 : AV_PIX_FMT_NV12; + + switch (sw_desc->comp[0].depth) { + case 8: + frames_ctx->sw_format = AV_PIX_FMT_NV12; + break; + case 10: + frames_ctx->sw_format = AV_PIX_FMT_P010; + break; + case 12: + frames_ctx->sw_format = AV_PIX_FMT_P016; + break; + default: + return AVERROR(EINVAL); + } + frames_ctx->initial_pool_size = dpb_size; ret = av_hwframe_ctx_init(avctx->hw_frames_ctx);