From patchwork Wed Aug 28 15:45:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 14758 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3423E4476B8 for ; Wed, 28 Aug 2019 18:46:01 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2091168AE59; Wed, 28 Aug 2019 18:46:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C3A2168AE51 for ; Wed, 28 Aug 2019 18:45:54 +0300 (EEST) Received: by mail-pg1-f193.google.com with SMTP id l21so1695570pgm.3 for ; Wed, 28 Aug 2019 08:45:54 -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; bh=EVDpFyyZzMHENT27RfR8oHJ9GAphgaSVPz10tSqa51g=; b=VSo3Th1OmVpz4n5e4FB48nN4Ak1vFlXv4/cayvozP8SrPlhqXIOK8FW/k5+iIB2h23 eTcB+PTzf6FauHi1B0jUGWPtiTm25Ro6qINiKhcCU6aU7VMBkZvQRLeH4TkvL39Rxm4B ba2fxVIKK/RakqatvQGHRZ+BMHkWp2XC5ppT8RwfYdVcjKwCABdRHN0EPZtjW92X2seK 9i/tZyUuYhXmvvC3TecJgcMP/6C8RZQcVoH19LAawT+uLAyaBMFRoYHPA8w+ea6h2kdc SFaxbeOv7jdqCHoXDMCXqid1MeN/yT2MDvE+xGKEZwlS0wb7+aKkI7vrgq1JZ1XYDW2O q8nw== 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; bh=EVDpFyyZzMHENT27RfR8oHJ9GAphgaSVPz10tSqa51g=; b=gmUu0pryoTVj+NgvjfV7ExkK+x3W662bX54doLoiLhPQFOU9kw61W/TxhMjS+h/E4j Lo9n46QNm54RZEvHSIZ5rnQEgnTJ4xxCqiO7o3Vsf7yWazZdG6ZXzSh/ydosi5NylwOG gBdy6g6edAej7oRkVcYk1XnrEfCRPk7MQ4L+LRzj6cIOkmuY53M6co4HCxplLYiTiE41 EYQ71MurHjjMgg8lkf2gWysMy/F4O3cIHB4LFCmFrva2Gl9KWddZD53nU/HfOkL3ehIS cNvHcuXtkXQfQdEE1g+weAa1Foy2CV1fAEFMPl9wpp3kYs/qkOe0VbareTMpdVDRbcE2 c6Hg== X-Gm-Message-State: APjAAAUJ+J7fSD8Fd1s2tkpmn0a+kLbwd8+0gkoC19Rl/apssaNIynvc d6GcWqD4lsz0sLJx1by2SqSqIH9D X-Google-Smtp-Source: APXvYqzQOmFINAtMBCRCygM8Xz3DVZydCP9atk5RySoMCw3fLd7xMiDyTF6UM6J8zdDj37jXEcHvbw== X-Received: by 2002:a63:188:: with SMTP id 130mr3970016pgb.231.1567007152963; Wed, 28 Aug 2019 08:45:52 -0700 (PDT) Received: from localhost.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id e3sm2489502pjr.9.2019.08.28.08.45.51 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 28 Aug 2019 08:45:52 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Aug 2019 23:45:14 +0800 Message-Id: <1567007116-9088-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1567007116-9088-1-git-send-email-lance.lmwang@gmail.com> References: <1567007116-9088-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v1 3/5] avcodec/v210enc: define DEFINE_V210_PLANAR_FUNC to remove duplicate function 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/v210enc.c | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c index 69a2efe..716544a 100644 --- a/libavcodec/v210enc.c +++ b/libavcodec/v210enc.c @@ -36,35 +36,24 @@ dst += 4; \ } while (0) -static void v210_planar_pack_8_c(const uint8_t *y, const uint8_t *u, - const uint8_t *v, uint8_t *dst, - ptrdiff_t width) -{ - uint32_t val; - int i; - - for (i = 0; i < width - 5; i += 6) { - WRITE_PIXELS(u, y, v, 8); - WRITE_PIXELS(y, u, y, 8); - WRITE_PIXELS(v, y, u, 8); - WRITE_PIXELS(y, v, y, 8); - } +#define DEFINE_V210_PLANAR_FUNC(nbits, depth) \ +static void v210_planar_pack_##depth##_c(const uint##nbits##_t *y, \ + const uint##nbits##_t *u, const uint##nbits##_t *v, \ + uint8_t *dst, ptrdiff_t width) \ +{ \ + uint32_t val; \ + int i; \ + \ + for (i = 0; i < width - 5; i += 6) { \ + WRITE_PIXELS(u, y, v, depth); \ + WRITE_PIXELS(y, u, y, depth); \ + WRITE_PIXELS(v, y, u, depth); \ + WRITE_PIXELS(y, v, y, depth); \ + } \ } -static void v210_planar_pack_10_c(const uint16_t *y, const uint16_t *u, - const uint16_t *v, uint8_t *dst, - ptrdiff_t width) -{ - uint32_t val; - int i; - - for (i = 0; i < width - 5; i += 6) { - WRITE_PIXELS(u, y, v, 10); - WRITE_PIXELS(y, u, y, 10); - WRITE_PIXELS(v, y, u, 10); - WRITE_PIXELS(y, v, y, 10); - } -} +DEFINE_V210_PLANAR_FUNC(8, 8); +DEFINE_V210_PLANAR_FUNC(16, 10); av_cold void ff_v210enc_init(V210EncContext *s) {