From patchwork Tue Jul 3 02:50:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Iashchenko X-Patchwork-Id: 9583 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp625368jad; Mon, 2 Jul 2018 19:51:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdWR0KjXCLnDuvStZCVXR0twtCMhmzdxyp0mSgaWioij1i8y/4cvyZMsHtbZs/UeO2oZpS9 X-Received: by 2002:a1c:9546:: with SMTP id x67-v6mr4302900wmd.25.1530586273341; Mon, 02 Jul 2018 19:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530586273; cv=none; d=google.com; s=arc-20160816; b=cIWADbhmfMnFKi+IY/3vw7eoyYlr77q1zaq6/6CnfvX8DYCotR4NwlGbOoefOzWsFq svSTHVEhH0MB8mF3FTLfE2QqZSYpMirWdktZ/gHDakZNEdRV/4Pv7B3HWplx2M/vBf0K LQj8NCs0HCQcMj5jj1tpaIToMvGJwnBzVoenmnE6EBiDKpe7WRxsQED5yKnVE7fiU9Z0 ZpiH/IwHMDgnQ+4yJ+nnwFXGfSfYG/0EftuZrj5aWJgGrQGdcsYLLcDNtfU9EcQlYsUQ as+0PDYp09fxu9RGx98vYq9foj2R3gCbhmpCj2afR/o1lDdNNIsGFugpO5ea2ouaalre Alng== 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=g2sfmGKu1Vt0A4IdGp6TilqYcWlVlwUmWLBc+HZ8bhQ=; b=hG2MGu8QtnOJlthNzu1V9KhMoveBSXrE+BhMM7SBIQm6suQ0weViJU4sFf0okJM5dh 4XhcMejqOu77afnXHIMkXMyZ3x5E02dRk907a/yRor8uaBIgCIfhotxeMSLVvNeydfeE TqKFso5VH/SRdyWnIxoerBGUjHVrbkIC8GkE4SyejApbSRg/zE3yGR29omVA2pMBMvRv bVRBONhFLDVHyFeJeZRQyj78c7KG3SrMyC2+zTr5aWKuPLK9f1FbuA4F5XEQz6764pFc 1+3HQS0QfWb+toogn/PwKVa9P2RRMg4AQi4oN1ND9s4SS9pK2B4+VP1Tjod7bFl2TJAH ThBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=KtrM3dA0; 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=QUARANTINE 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 m20-v6si37502wrg.431.2018.07.02.19.51.12; Mon, 02 Jul 2018 19:51:13 -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=@gmail.com header.s=20161025 header.b=KtrM3dA0; 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=QUARANTINE 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 4F60468A790; Tue, 3 Jul 2018 05:51:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2F46568A25E for ; Tue, 3 Jul 2018 05:51:01 +0300 (EEST) Received: by mail-lj1-f181.google.com with SMTP id q5-v6so297602ljh.12 for ; Mon, 02 Jul 2018 19:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=xSxves3J141j0JXMAQDbaG+afx1eN5L4W9MkTckc1SE=; b=KtrM3dA03Z61IxGMtEYG8Crw/DE6xTbKLCagOaUdIXe0K6EXhyXxk78Ia9upFX54Ie HpZ5aXrQeF5W6EQmU+pHvJx02MhuvcyDR/Fh1rJkRKWzj36XR3UZnxOgtsJvfhm0pxoB 1G2WNRIbxcybCOx+yIQe1IHMIqEP8NfsbXyvp0Bg0xLsSs/pBhc3Rq29vrOYjVIXkFmo ZKDQHrengIRVDoXuILM6PPZja+fq4ccEPOyCCQIn01c6iOHcKNoCt48IXiE5gCqo1ad+ gCnITkW289X7LnepkgYhUE7d/a2/UP76bvZs9G5NcaP+zK8NGL/1r91m6q+Ww0L0HW2+ Mu7w== 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=xSxves3J141j0JXMAQDbaG+afx1eN5L4W9MkTckc1SE=; b=F1t2sS5btakBmiFCNu4CHVivknm/i/idO94Po6/g0UMx+M1Zvkgk9FTvwswKnFTWM/ LX57PYFHtdd7aGBtAD//JGLXMIhC3TMoKyhFJ3RAOtOIesIidgM5sBGJjjV972niBrGp u7i7uVyBRl3XV+CNgfF/3+apdnDoRiVjAtbeDFQtTbkr3g8vRAQ8Q9LXdQsstfiOnKfe P/GdVz5jk0x3LEQuljF2930Hco+Mq8mNjPO4FvV7c679oJlrS+ORdgrJ1dy71ZgLt5oI LdgQtddva9bmb7q+1YMbsuQROIHCyPn403jxVpiiUj2Jd6N1ZYmqrXbBGTpytA/Mx/io MlYg== X-Gm-Message-State: APt69E2DPFQjmE7f6+37r1eOkqwfOjimHESAncfNlpkXqGUoymtEwhnI BEc8FwZLS0RjiQ3bPnY7k/ZMaF4= X-Received: by 2002:a2e:1dc8:: with SMTP id w69-v6mr15825203lje.110.1530586263961; Mon, 02 Jul 2018 19:51:03 -0700 (PDT) Received: from dan-acer.lan (campus.ifmo.ru. [194.85.161.2]) by smtp.gmail.com with ESMTPSA id w75-v6sm14125lff.41.2018.07.02.19.51.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Jul 2018 19:51:03 -0700 (PDT) From: Danil Iashchenko To: ffmpeg-devel@ffmpeg.org Date: Tue, 3 Jul 2018 05:50:49 +0300 Message-Id: <1530586249-22186-1-git-send-email-danyaschenko@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH] doc/filters: add documentation to all existing OpenCL filters, except tonemap filter 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: Danil Iashchenko MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Add documentation to all existing OpenCL filters, except tonemap filter. --- Creation of the seperate section for OpenCL filters is motivated by developing support for Vulkan and CUDA and it is easier to show the capabilities of each platform by adding new sections. doc/filters.texi | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index fb5f3ee..3e18e5c 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -5423,6 +5423,7 @@ number in range [5, 129]. Set what planes of frame filter will use for averaging. Default is all. @end table +@anchor{avgblur} @section avgblur Apply average blur filter. @@ -5715,6 +5716,7 @@ tblend=all_mode=grainextract @end example @end itemize +@anchor{boxblur} @section boxblur Apply a boxblur algorithm to the input video. @@ -6551,6 +6553,7 @@ For example to convert the input to SMPTE-240M, use the command: colorspace=smpte240m @end example +@anchor{convolution} @section convolution Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements. @@ -12900,6 +12903,7 @@ By default value 0xf, all planes will be processed. Do not require 2nd input for processing, instead use alpha plane from input stream. @end table +@anchor{prewitt} @section prewitt Apply prewitt operator to input video stream. @@ -13591,6 +13595,7 @@ trim=end=5,reverse @end example @end itemize +@anchor{roberts} @section roberts Apply roberts cross operator to input video stream. @@ -15176,6 +15181,7 @@ asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0 @end example @end itemize +@anchor{sobel} @section sobel Apply sobel operator to input video stream. @@ -17422,6 +17428,193 @@ pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1. @c man end VIDEO FILTERS +@chapter OpenCL Video Filters +@c man begin OPENCL VIDEO FILTERS + +Below is a description of the currently available OpenCL video filters. + +To enable compilation of these filters you need to configure FFmpeg with +@code{--enable-opencl}. + +@section avgblur_opencl + +Apply average blur filter. + +Works like existing @ref{avgblur} filter. + +@subsection Example + +@itemize +@item +Apply average blur filter with sizeX and sizeY set to 3 +@example +-i INPUT -filter_complex "hwupload, avgblur_opencl=3, hwdownload" OUTPUT +@end example +@end itemize + +@section boxblur_opencl + +Apply a boxblur algorithm to the input video. + +Works like existing @ref{boxblur} filter. + +@subsection Examples + +@itemize +@item +Apply a boxblur filter with the luma, chroma, and alpha radius +set to 2: +@example +-i INPUT -filter_complex "hwupload, boxblur_opencl=luma_radius=2:luma_power=1, hwdownload" OUTPUT +-i INPUT -filter_complex "hwupload, boxblur_opencl=2:1, hwdownload" OUTPUT +@end example + +@item +Set the luma radius to 2, and alpha and chroma radius to 0: +@example +-i INPUT -filter_complex "hwupload, boxblur_opencl=2:1:cr=0:ar=0, hwdownload" OUTPUT +@end example + +@item +Set the luma and chroma radius to a fraction of the video dimension: +@example +-i INPUT -filter_complex "hwupload, boxblur_opencl=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1, hwdownload" OUTPUT +@end example +@end itemize + +@section convolution_opencl + +Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements. + +Works like existing @ref{convolution} filter. + +@subsection Examples + +@itemize +@item +Apply sharpen: +@example +-i INPUT -filter_complex "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT +@end example + +@item +Apply blur: +@example +-i INPUT -filter_complex "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT +@end example + +@item +Apply edge enhance: +@example +-i INPUT -filter_complex "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT +@end example + +@item +Apply edge detect: +@example +-i INPUT -filter_complex "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT +@end example + +@item +Apply laplacian edge detector which includes diagonals: +@example +-i INPUT -filter_complex "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT +@end example + +@item +Apply emboss: +@example +-i INPUT -filter_complex "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT +@end example +@end itemize + +@section overlay_opencl + +Overlay one video on top of another. + +Works like existing @ref{overlay} filter. + +@subsection Example + +@itemize +@item +Insert a transparent PNG logo in the bottom left corner of the input +@example +-i INPUT -i LOGO -filter_complex "[0:v]hwupload[a],[1:v]hwupload[b], [a][b]overlay_opencl[out],[out]hwdownload" OUTPUT +@end example +@end itemize + +@section prewitt_opencl + +Apply prewitt operator to input video stream. + +Works like existing @ref{prewitt} filter. + +@subsection Example + +@itemize +@item +Apply prewitt operator with scale set to 2 and delta set to 10 +@example +-i INPUT -filter_complex "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT +@end example +@end itemize + +@section roberts_opencl +Apply roberts cross operator to input video stream. + +Works like existing @ref{roberts} filter. + +@subsection Example + +@itemize +@item +Apply roberts cross operator with scale set to 2 and delta set to 10 +@example +-i INPUT -filter_complex "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT +@end example +@end itemize + +@section sobel_opencl + +Apply sobel operator to input video stream. + +Works like existing @ref{sobel} filter. + +@subsection Example + +@itemize +@item +Apply sobel operator with scale set to 2 and delta set to 10 +@example +-i INPUT -filter_complex "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT +@end example +@end itemize + +@section unsharp_opencl + +Sharpen or blur the input video. + +Works like existing @ref{unsharp} filter. + +@subsection Examples + +@itemize +@item +Apply strong luma sharpen effect: +@example +-i INPUT -filter_complex "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT +@end example + +@item +Apply a strong blur of both luma and chroma parameters: +@example +-i INPUT -filter_complex "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT +@end example +@end itemize + +@c man end OPENCL VIDEO FILTERS + @chapter Video Sources @c man begin VIDEO SOURCES