From patchwork Mon Dec 25 23:36:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 6967 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp6223152jad; Mon, 25 Dec 2017 15:36:46 -0800 (PST) X-Google-Smtp-Source: ACJfBotJvppwxadicM3bKxLy8pfJ560zwL6uRQrLDtUbti+Eib2Yw9QJTCiqbGPNXc2UaaIDbbjw X-Received: by 10.223.164.152 with SMTP id g24mr16484387wrb.28.1514245006029; Mon, 25 Dec 2017 15:36:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514245005; cv=none; d=google.com; s=arc-20160816; b=xJhRYGZ2vvhibjjNqCyLdkIRnjKuIL2jqPGbxZHKXKwonI6NpTr+7qtJfaoLjK+8TF TsXvkv7CbTMUygHEqMaPsgHv4pAcAZvFKIrtQf4hyyYZsWBpLRlUfnWv5RX7Lrzc8y4+ SXkVuDJbM9s3I0zH/lngGHbcpjomsAYu5/ywrXlHVWcjBKIzyrSCC0klIM1+cDEio0es M6lGeDAMcneFXLTWho5oC+lXrKiDxc29Lt/lC0ga50/O0q/uIAAgR+1bqX8I3tH8Ri2o o803W7B6fetFZBNpapJ/m8vNQLpViE8BhbcishS6Yp0CS9bv3J2Wq3rGXQUI6ibuGwUd uNjQ== 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=ZEf88ve8ukWdcV1mC7cNJ4kDrvxJmiTyr88Bf6R7TH8=; b=lQhrlR2C8Qy7gveOS1BYWRhTrLkuGddmV/WBopRjvIVlqcHU8ZUOzwXVYV10AIzGT+ DiQ9eB8V7g/PWusd1NG9Y4PuKxFL6UlGC+unJ8ZSIac8nsyXn4oBw9kuGdSYyIUE3pzK 9zSBfLBRIOoVa+xmak57FzAiWJQ5jbucqk8fKFG/TGuWDjlz1HekHaluuCnbc8M0OQLk bC/7cLaXTYoPqmE719Vym+ZxACJBZ99DQ14a2ZvETFobZYS5NzfN6ijHbfLjV128mxYX IwWoYm6sDd3h0p+HC2OoQRuuZcIET0X1wFv+0GmE227A1jN+hGimVPVfWu63C/wwM2fN HZYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=aI7ATVz4; 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 2si17986511wrj.383.2017.12.25.15.36.45; Mon, 25 Dec 2017 15:36:45 -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=aI7ATVz4; 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 B251F6806AC; Tue, 26 Dec 2017 01:36:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BE7C1680498 for ; Tue, 26 Dec 2017 01:36:24 +0200 (EET) Received: by mail-qt0-f195.google.com with SMTP id i40so43586783qti.8 for ; Mon, 25 Dec 2017 15:36:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=XMX9uL3wxHfTfngL1jXnzj9/Otj5ppyhocCWc9YhAM8=; b=aI7ATVz4xOBncvPS8DQqO2Z8Y78eOvMli8MoBEZ1QgCIxTZXSbyHejB/mRrMCjPAGq ZjbyBQuGQfKtDbRphvwAIGyCuHh+NKCeeQcMJnDpXRIp632Rf7P9x8TqsZe3MBTb++oM za0krh7IqEKrE7Lvv1/LpYFInj7UQ5J0Pqk9ExmHPCypsiEOoy4N5I3+ACdr29lIf3OR 4JjXsp5KkzB7ddJLeR5bjeGpGYQCOLLBGH8X7un1XUpnMenCuJ8WcJZKsgZSRd9DD8pT /H3Oh7aRjC8nBU+478dQGT3ONDFYTlB2TMt/f4w5vuZbsvA1yHfONeDV5g127ddotoFD bz2w== 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=XMX9uL3wxHfTfngL1jXnzj9/Otj5ppyhocCWc9YhAM8=; b=ZMsDcL2uAA0EF2k5WOdfiNHKuyAeeERbw06PG+0sJY55xntvK2F6VXrg38zb+fKulu qI1hyxtJsK6xEXu/4ueJWKXi2td7HvzLsScS3Nn5UmmgeucyU88cqOXkK7/KR8pK7f4x RTiG08WQ3GsTZwbOSj16e7iiwQ7vYaLZcHObx2Pgae2jiIvXfRwx4RxahlnqRUNvYW7A LW4AWNH13+rSPbFQOArX2M6eMe9nbgAxCLBomGX+D+2tMxsi5c65p1GK9CmFmKgki2pV Xb3nOWc3EMga+bJMridYvgTAzgGM7fqHETcckcC0jJvhDYWHt0rb+z70gi3LEmeymGCA TCCg== X-Gm-Message-State: AKGB3mL7S3kgu6xUwSS4Jrc94zF8U/n+khiPq/rDRRmKQJr7PSroXCqO 9dJpa8iFI21w+IGeorIkytRANg== X-Received: by 10.200.27.129 with SMTP id z1mr33328399qtj.259.1514244996913; Mon, 25 Dec 2017 15:36:36 -0800 (PST) Received: from localhost.localdomain ([181.229.225.176]) by smtp.gmail.com with ESMTPSA id 102sm14625579qkx.85.2017.12.25.15.36.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Dec 2017 15:36:36 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 25 Dec 2017 20:36:20 -0300 Message-Id: <20171225233620.7348-1-jamrial@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: References: Subject: [FFmpeg-devel] [PATCH 2/2 v2] avcodec/libx264: fix compilation with x264 builds >= 153 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" x264 now supports multibitdepth builds, with a slightly changed API to request bitdepth during initialization. Signed-off-by: James Almer --- This one is a bit cleaner. I can push whichever is prefered. libavcodec/libx264.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 2d36c5e566..90855dcd3f 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -454,6 +454,7 @@ static av_cold int X264_init(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; AVCPBProperties *cpb_props; + const av_unused AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); int sw,sh; if (avctx->global_quality > 0) @@ -724,6 +725,9 @@ FF_ENABLE_DEPRECATION_WARNINGS x4->params.i_width = avctx->width; x4->params.i_height = avctx->height; +#if X264_BUILD >= 153 + x4->params.i_bitdepth = desc->comp[0].depth; +#endif av_reduce(&sw, &sh, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 4096); x4->params.vui.i_sar_width = sw; x4->params.vui.i_sar_height = sh; @@ -837,6 +841,24 @@ FF_ENABLE_DEPRECATION_WARNINGS return 0; } +static const enum AVPixelFormat pix_fmts[] = { + AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUVJ420P, + AV_PIX_FMT_YUV422P, + AV_PIX_FMT_YUVJ422P, + AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUVJ444P, + AV_PIX_FMT_YUV420P10, + AV_PIX_FMT_YUV422P10, + AV_PIX_FMT_YUV444P10, + AV_PIX_FMT_NV12, + AV_PIX_FMT_NV16, + AV_PIX_FMT_NV20, +#ifdef X264_CSP_NV21 + AV_PIX_FMT_NV21, +#endif + AV_PIX_FMT_NONE +}; static const enum AVPixelFormat pix_fmts_8bit[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, @@ -874,12 +896,16 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] = { static av_cold void X264_init_static(AVCodec *codec) { +#if X264_BUILD >= 153 + codec->pix_fmts = pix_fmts; +#else if (x264_bit_depth == 8) codec->pix_fmts = pix_fmts_8bit; else if (x264_bit_depth == 9) codec->pix_fmts = pix_fmts_9bit; else if (x264_bit_depth == 10) codec->pix_fmts = pix_fmts_10bit; +#endif } #define OFFSET(x) offsetof(X264Context, x)