From patchwork Sun Sep 10 20:53:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 5091 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp2357704jaa; Sun, 10 Sep 2017 13:55:20 -0700 (PDT) X-Received: by 10.28.127.4 with SMTP id a4mr6839098wmd.12.1505076920757; Sun, 10 Sep 2017 13:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505076920; cv=none; d=google.com; s=arc-20160816; b=R6eNPOn19KWIervr12mupe7ym4p0MiipSIGGcBoDF0NsVfYr91bt0L2EHW5RzQXrER y9WmU0lujiuf0GqAlI+9weRgG8bJR+FpZPU4KbUv1ICQMukCXNZP65y+R8s4MSpbszz+ QDsQDB4RxNxnXMtjfn/AjhKtB/Ql3BH+h831ghkRDCe0A9ai/+qY67q1rNiPZCjpp0JV qy89eJxV9KTg76n7BbP0SzkjgSqpazlfRo+ixonPqjUAT+jZxlifBs8GONITo7T9x1A9 tqwvWxajhFXSssfuEPMVaOqCDCNLL3ni7EiLsFiwFkmN2EawkDR9HYkpaJYQmpCX9oAa q7NQ== 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=itU9y4XvTxKYTM1jahEqOx/qwy7YhUrOk2839OUTo8E=; b=r4ZBDKkTJI8CWk+1M2D7pfSsNwO2rlwSsTEQo/GflZZYZL1J8mtkC/s4FNUCT2hvlz zA5cr7ikCUQ0w4wWPwFREnkJHvTa5YHDxETyM0C/b2mNGck+Uyr4XzyS3S8Yu3X7W5ax yc6E92n0Le6SNkhJ+oACT2YPCY3UtIbFfdVrdT1H4CEtQSngv4iGilA9tcBx7m8tUQHf IDd580JgiFDziv6Df3/vqL6lXgOQmQSHub7bdf6G9mbAXhxjBgFpSGpl1oj2UdD85N42 qQipovWYcloccvKvqTKa0Mxdd2QdVUQO68CR03QPnl9jJnuOs+g/senFnNhUuWvZRfGD 5KNQ== 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=N432N70q; 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 w79si5706386wrc.476.2017.09.10.13.55.20; Sun, 10 Sep 2017 13:55:20 -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=N432N70q; 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 B2929689D66; Sun, 10 Sep 2017 23:53:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0826F689D45 for ; Sun, 10 Sep 2017 23:53:52 +0300 (EEST) Received: by mail-wm0-f50.google.com with SMTP id f199so27702134wme.0 for ; Sun, 10 Sep 2017 13:53:58 -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=yLl3sLwtN6qrX9kkK/KZvaLKyKz0sHC1GLoyn8HbnlE=; b=N432N70qzo6Gr/YaZyOEasCoZdizBA2+jkyFyG9+NGdWaOlF03WZHVedEgTtWdHutU TUzo5s29Y2t/qD6WRGDM24RJ2YtrVn1IkaEqTS3uik9hHU3ZNPS5ucuAUeA8L9Lrx7+y oSyM4pJOpuMkLWuyeiS3dqodL0o/ZAVXrti7QIFkasgpi31tCj1EdLkEYTys47mxY6GX jF7+tUsnpYa5FGOs49QVAjtHSC+PI8H6tlS9S0kMI6hwrUBVdFGTUQ0PiJHqtOSmpnvx 7Pfjn2WRephp1cs7BU2kBAh5k66v4lRuzeeWCOeyfzqjhqKYEADv1FTNnxcG8gsyYzs1 eMVA== 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=yLl3sLwtN6qrX9kkK/KZvaLKyKz0sHC1GLoyn8HbnlE=; b=UysErads3p6Av3BBuisSd/GzwlvwqxqP4syid2h1LIpSTge4GHPnLpW61h75VEjozg skcHhr/fNOILvFD6Swgs+SrsShYn9TXBtW0fg4H0Uo+iJVCX5ODu5VxZqEv60i5dWg7s Pl2zpFVimUgL3wcNiOUozMXl8pUbUTP4idrGfywsoq6x1l35+1roLJKLGd2mmMfH6BpJ /J0AS4sGABOGxLdUdx8tg3HHv9ua3Pp+P5ebWfPf5Dj84mfDoOaiIOXj0QCYXMQflCm6 hzd6wOwhyUxZXhx5SmRsplimxYVXnvxbUlG90HyN60vNubnfPi4dNmwfmi++WAUUqIE6 i4QA== X-Gm-Message-State: AHPjjUjsiUPU53gOSXZjAlPekfg9tHrmRpnDSyvwTBisfuX8gEqNDwCM +yhy6dpjAXMQZgQO0x8= X-Google-Smtp-Source: AOwi7QCsCB1ZquQTO/CeGTQpPJaTdqL5uHx9WdqptAgwn1kiPk1W/Td2Xr17mv9S+iCOiG+97pStxg== X-Received: by 10.28.60.8 with SMTP id j8mr5719737wma.16.1505076837355; Sun, 10 Sep 2017 13:53:57 -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 z51sm8742868wrz.80.2017.09.10.13.53.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Sep 2017 13:53:56 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Sep 2017 21:53:35 +0100 Message-Id: <20170910205338.29687-12-sw@jkqxz.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170910205338.29687-1-sw@jkqxz.net> References: <20170910205338.29687-1-sw@jkqxz.net> Subject: [FFmpeg-devel] [PATCH 11/14] lavfi: Add infrastructure for building OpenCL source into libavfilter 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" --- In lavfi only because that's the only current consumer; could be extended if anyone wants to write OpenCL code for lavc. libavfilter/Makefile | 6 ++++++ libavfilter/opencl_source.h | 22 ++++++++++++++++++++++ tools/cl2c | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 libavfilter/opencl_source.h create mode 100755 tools/cl2c diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 5c754c5f39..cb3a1424d9 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -396,3 +396,9 @@ TOOLS-$(CONFIG_LIBZMQ) += zmqsend clean:: $(RM) $(CLEANSUFFIXES:%=libavfilter/libmpcodecs/%) + +OPENCL = $(subst $(SRC_PATH)/,,$(wildcard $(SRC_PATH)/libavfilter/opencl/*.cl)) +.SECONDARY: $(OPENCL:.cl=.c) +libavfilter/opencl/%.c: TAG = OPENCL +libavfilter/opencl/%.c: $(SRC_PATH)/libavfilter/opencl/%.cl + $(M)$(SRC_PATH)/tools/cl2c $< $@ diff --git a/libavfilter/opencl_source.h b/libavfilter/opencl_source.h new file mode 100644 index 0000000000..8674a03a94 --- /dev/null +++ b/libavfilter/opencl_source.h @@ -0,0 +1,22 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_OPENCL_SOURCE_H +#define AVFILTER_OPENCL_SOURCE_H + +#endif /* AVFILTER_OPENCL_SOURCE_H */ diff --git a/tools/cl2c b/tools/cl2c new file mode 100755 index 0000000000..1ead940811 --- /dev/null +++ b/tools/cl2c @@ -0,0 +1,20 @@ +#!/bin/sh +# Convert an OpenCL source file into a C source file containing the +# OpenCL source as a C string. Also adds a #line directive so that +# compiler messages are useful. + +input="$1" +output="$2" + +name=$(basename "$input" | sed 's/.cl$//') + +cat >$output <>$output + +echo ";" >>$output