From patchwork Sat May 8 12:13:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhanshu Saxena X-Patchwork-Id: 27700 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp1359298iof; Sat, 8 May 2021 05:14:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUtxlzHa3vvyjvWWXWX8Ig5fyrPb2C/HOtuDMm/EUcqJ7+csiBqt1DbCMDMrP7JfVYAgUx X-Received: by 2002:a17:906:8390:: with SMTP id p16mr14904045ejx.430.1620476042790; Sat, 08 May 2021 05:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620476042; cv=none; d=google.com; s=arc-20160816; b=VjQDHbZqizWXZ+74oU1GpkVI+6ReU+35+UHzdw5UO+Jbj9Soak7ekhmQlmleHonOUN +3xByPpEDafmuGuZJdbxZopUGa5pE6nw1iFknkrDWW8qm4tsNgb4acDDoWGBckTR3W8S a/B/u1yCdZWDEYLxxtqaTmCt1Fna48MYIjLWcUy2WEh4wA3iTE8v21oKABzAR09lcmah yroTOkj2e5qhmpuVUYcThW7774hbZcEUiJPmdBXRslkIBG0H6D4w9Xrk/nA6kZgx0kB9 fchHS7BY0+EvyC/zxyf7N82ct60sXiRqPXzvCtoRNp4WdoUscLaKH3GopQMS+NH/GMiC v5nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=aXZZ1uNv4weRNjYc27Ftg+Nfv6MUoHbvedSwQRZhRik=; b=eI5uFYXtzF14cyE10/dFC0B9E8CJSWgGXpxEMDxKYKj37N44bikL7/bJlLAmjkHNs2 40uQrB7hmSoz79Uy9jpJ+U7klpdsgAd7WGof5BIyEQkPPMlwLv1kNWNqIuDlMVl2NVa9 FviIvNI8zGOeC2G/xj5t4OYrE0hz59ZPMIDZcvzOQNoTlb59Aa2kwmPoKKTkz69pMCfa OAPYF/0Y55M/UmiyKrNcBZytCz3RWI+w1gcOpd9/wZC1J0Jm0ax5GXS10U1S7Muup9s0 MOIe9QQDXHvZJ2ME+Qquf6f+TUVxQjuMNubn44soGYGpqNUf0KDam0pUlW27TKp0oaua FCyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=SQBEJsu0; 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 b22si8149266eju.274.2021.05.08.05.14.02; Sat, 08 May 2021 05:14:02 -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=SQBEJsu0; 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 85FBB68094B; Sat, 8 May 2021 15:13:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E70C66808F2 for ; Sat, 8 May 2021 15:13:51 +0300 (EEST) Received: by mail-pf1-f178.google.com with SMTP id b21so2687976pft.10 for ; Sat, 08 May 2021 05:13:51 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=vnsCKCPNQV5zO/Gb5OBVQ2MeXwYEABAUWnSRqj8i+s4=; b=SQBEJsu0/AElfE0M7pRpp2mtvfxbKZnD7iZdVneKVzoM6cbZ6SoWOJBtrcwKoqGgnm ogz4Rro/hRtLsKhhwKlIS4bsvgfOD97rZf1cz0j3qFBbko2I2w3TVeU5YsAMc5r2WFOe pdSKiDeAQrUvgE0fd/P+CCe5QGRjTrkH0DZx6hjTpoE+fA/lDrDSEiDTOIhzm6dg0j1Z ZcS7YdUhaymmX042cJXsIjimJtSRKODXHfvBoehaS0RvtZDeuaXUQobGME3xxADIOWMS HKokxxXWgLz7+wv2ZEhRCGK1fwDiK9kwIrC/1xqGWitXKI770tZEqgifhN2ditGQwVhm jEzw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vnsCKCPNQV5zO/Gb5OBVQ2MeXwYEABAUWnSRqj8i+s4=; b=ZiGHZS3pSWTRimdpRNP/p+813tNddUwQAgCjyI7rH5fT3FKQx/pz6CTdLryYriAVq5 ZJbDPkl/Q7xVF1Bs3snSKhbgxhrjVx5TLnoQ2aU7g7VGt7JTXK5z5udHA4tp1trhj/RL +uoZuEvbkvsXevFRqidQa+FWS1mfH3uVnyaDMmA1I+sbhUQrfNu3T9rNeDrN6SdZLhny 9+WhmWRQ0Zio4yk1ZnT1OvJcrLrDbai08AFNgrjjBjfQyTt2fBJUFgN4uOG8QlxzOfFr tVtBMxTPKAUnXFXFr9emiRPkaTJsGivV7h3Q8Usp/v7eI2xHB/HJo0FycXJG3fGuXu4E nLUg== X-Gm-Message-State: AOAM530tZ/7OrL1ciwyzwXUeH49vson4/8tAtbKKRMnB5mV1WwWPtIJp IEn5ZlYrTq9jJuAYNpXGxyRZKLJkcEBgUg== X-Received: by 2002:a63:f749:: with SMTP id f9mr8988941pgk.369.1620476030151; Sat, 08 May 2021 05:13:50 -0700 (PDT) Received: from localhost.localdomain ([117.212.37.139]) by smtp.googlemail.com with ESMTPSA id v14sm3132384pgl.86.2021.05.08.05.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 May 2021 05:13:49 -0700 (PDT) From: Shubhanshu Saxena To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 May 2021 17:43:07 +0530 Message-Id: <20210508121307.13976-5-shubhanshu.e01@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210508121307.13976-4-shubhanshu.e01@gmail.com> References: <20210508121307.13976-4-shubhanshu.e01@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/5] lavfi/dnn_backend_native_layer_mathunary.h: Documentation X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Shubhanshu Saxena Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: GGKSg7HQ7XLn Add documentation for Unary Math Layer Signed-off-by: Shubhanshu Saxena --- .../dnn/dnn_backend_native_layer_mathunary.h | 64 +++++++++++++------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index 151a73200a..869fdc16fd 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -30,31 +30,59 @@ #include "dnn_backend_native.h" typedef enum { - DMUO_ABS = 0, - DMUO_SIN = 1, - DMUO_COS = 2, - DMUO_TAN = 3, - DMUO_ASIN = 4, - DMUO_ACOS = 5, - DMUO_ATAN = 6, - DMUO_SINH = 7, - DMUO_COSH = 8, - DMUO_TANH = 9, - DMUO_ASINH = 10, - DMUO_ACOSH = 11, - DMUO_ATANH = 12, - DMUO_CEIL = 13, - DMUO_FLOOR = 14, - DMUO_ROUND = 15, - DMUO_EXP = 16, - DMUO_COUNT + DMUO_ABS = 0, // Absolute Value + DMUO_SIN = 1, // Sine + DMUO_COS = 2, // Cosine + DMUO_TAN = 3, // Tangent + DMUO_ASIN = 4, // Inverse Sine + DMUO_ACOS = 5, // Inverse Cosine + DMUO_ATAN = 6, // Inverse Tangent + DMUO_SINH = 7, // Hyperbolic Sine + DMUO_COSH = 8, // Hyperbolic Cosine + DMUO_TANH = 9, // Hyperbolic Tangent + DMUO_ASINH = 10, // Inverse Hyperbolic Sine + DMUO_ACOSH = 11, // Inverse Hyperbolic Cosine + DMUO_ATANH = 12, // Inverse Hyperbolic Tangent + DMUO_CEIL = 13, // Ceiling + DMUO_FLOOR = 14, // Floor + DMUO_ROUND = 15, // Round off to Nearest Integer + DMUO_EXP = 16, // Exponential + DMUO_COUNT // Total Number of Operators } DNNMathUnaryOperation; typedef struct DnnLayerMathUnaryParams{ DNNMathUnaryOperation un_op; } DnnLayerMathUnaryParams; +/** + * @brief Load the Unary Math Layer. + * + * It assigns the layer parameters to the unary operator + * hyperparameter from the model file context. + * + * @param layer pointer to the DNN layer instance + * @param model_file_context pointer to model file context + * @param file_size model file size + * @param operands_num number of operands for the layer + * @return Size of DNN Layer + * @retval 0 if model file context contains invalid hyperparameters. + */ int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num); + +/** + * @brief Execute the Unary Math Layer. + * + * It applies the unary operator parsed while + * loading to the given input operands. + * + * @param operands input operands + * @param input_operand_indexes input operand indexes + * @param output_operand_index output operand index + * @param parameters layer parameters + * @param ctx pointer to Native model context + * @retval DNN_SUCCESS if the execution succeeds + * @retval DNN_ERROR if the execution fails + */ int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx);