From patchwork Wed Jul 5 19:44:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 4218 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp1265004vsb; Wed, 5 Jul 2017 12:45:14 -0700 (PDT) X-Received: by 10.223.148.37 with SMTP id 34mr37389790wrq.137.1499283914655; Wed, 05 Jul 2017 12:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499283914; cv=none; d=google.com; s=arc-20160816; b=U1cjz4l7TMh4C728q2hAVH7tvAgOQmmm1orTQRiUVbUkf1eCjuGmoW6admI4w6B3J+ U81/AKhc8k2zLvlOsetF8jnNTB6orrvJTE9fsoATWzKVQd2ofWV2btu4KKIqMM7Awx0k eQ6KKR0Q2EHeBZOeq1xY2+d7175vlOZRc/R0xSqld/zjHsknyLbxCaoOyGMwXuTPFEG9 GlbL3nG8qlLDTcnbkZU4hZ+pw8/z3XNSHB8sI2gp47i2Uaf/UWKgEdBGRqugFicPKyPp t5+vZ9jOaLN9awT+BSxl99LOJDnXrdbX06SsxMwrU3tjJlx37oCwCcXUPbC8fbvxLKny 6hGw== 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:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=zdsYk5PF2wNX83B89Lq3R0lts74BIe1/K9yuvP7q9JY=; b=YCgwAou7BNCN+TJDWHMhUBWjK895EvIwRMg9mR6IP4RDQhuqWvuRGcdESUXY4qfCby 9LYqET5lIE+CICcBPWiUGstMOIVM2+7fv+uxUOpYMPTWBmggd9QgHbap56VtV03y5djf 7PMW7Vslp0NLGWY0q0ZjDXeRxQ+mL8cf9qqQepjYRFcsmeck1Y6iU/Zqw3pD366nwuRY qFU5zkqMuFQbIEl6rwxSkHgA2fbuYn5DKQWiXWV0h1vGMlvAT60T0+TmpFqVHNcakH1r nI1TmtqTUy6oE28qfz81Fu5vTmGvBOAYzOqtn7EaYTg7ZZZd4g0ut8gpTUzuqqMGGlxY OIWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=Mqb8SHRH; 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 p3si17524786wmp.33.2017.07.05.12.45.13; Wed, 05 Jul 2017 12:45:14 -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.b=Mqb8SHRH; 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 053E7688390; Wed, 5 Jul 2017 22:45:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f194.google.com (mail-qk0-f194.google.com [209.85.220.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CCD1C68097C for ; Wed, 5 Jul 2017 22:45:00 +0300 (EEST) Received: by mail-qk0-f194.google.com with SMTP id 91so32599681qkq.1 for ; Wed, 05 Jul 2017 12:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=cCN0CCC7p6K0U5XdOSD6rZo++G3m3V+j4m0/MYoEFg4=; b=Mqb8SHRHp3i9kNphqKUQYbeCuX8OtKCsIy5ekDWHl8vv7v+uut176g5MmilHnV9W+2 hGmTPS3r4f7C6kzr42YK3j3usuBDgy4Tv/qmWZJVaFB5uzh01Uv+glQUzjkrLjlJ59m0 D8ZOmbDxToBVRTVUYWAODGF7E/zXLNedxD10ug4DQjSZ5dQ0emM2EFTwpOJpBA8apVPR 7fIDzmJD2y0CDBe0kJLY9PpZF4w3ACFRRqAhNhoyaZt2wvKqPHs6wzS3uOsTfKVLZ5G9 /d5QGfLL6wshrPZa/bBR6vmyR3BoFW4BfxDSfqggehJWoNrDi1tuhKTYR7mOCCYQQhvb mBkg== 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; bh=cCN0CCC7p6K0U5XdOSD6rZo++G3m3V+j4m0/MYoEFg4=; b=SntqTGCE0I2iv4O1Gw+ojMnAof3nPxiw0M738x3iogOQGJ2kodV2dEGSe0MuuwMTM3 39f1Sj0odk9CDqkmSNO7eCQCZPeBLUXzMmM2kyBSjA5d/aH+BdIJsJPG6z3Iv1Nl0WJE RbNP5mjx5uCtMIwv7CWmkUeP6sXmSxwD2lJZg9Vlh46eVaqdDR407lIXWZHo5KObf+n1 QoxUFZPNccnToZItd4mhP/anU40lU76aw1CF9umh8HTsiG7qzF80JoGJProvneSm4A4S VBU5yI0aJLKHJe42xVJCFDGnp2rE2/9cDAMrb/M6xO+UaxSNoB7nNUfKwXXSfu+O25+H pY5g== X-Gm-Message-State: AKS2vOwC00wFMtYLIUChaRnYrPCkK8wV2sYVtNru2CVfF0bIM82wiU6V sDX6JH3l+16qOJyr X-Received: by 10.55.165.17 with SMTP id o17mr56892976qke.14.1499283901496; Wed, 05 Jul 2017 12:45:01 -0700 (PDT) Received: from localhost.localdomain ([181.231.116.134]) by smtp.gmail.com with ESMTPSA id h34sm11822762qth.0.2017.07.05.12.45.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Jul 2017 12:45:00 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Jul 2017 16:44:47 -0300 Message-Id: <20170705194447.9352-1-jamrial@gmail.com> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH] checkasm: add a g722dsp test 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" Signed-off-by: James Almer --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 +++ tests/checkasm/checkasm.h | 1 + tests/checkasm/g722dsp.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++ tests/fate/checkasm.mak | 1 + 5 files changed, 72 insertions(+) create mode 100644 tests/checkasm/g722dsp.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 60e80ab738..184e981754 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -5,6 +5,7 @@ AVCODECOBJS-$(CONFIG_BLOCKDSP) += blockdsp.o AVCODECOBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o AVCODECOBJS-$(CONFIG_FLACDSP) += flacdsp.o AVCODECOBJS-$(CONFIG_FMTCONVERT) += fmtconvert.o +AVCODECOBJS-$(CONFIG_G722DSP) += g722dsp.o AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 29f201b1b3..9173ed19d9 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -90,6 +90,9 @@ static const struct { #if CONFIG_FMTCONVERT { "fmtconvert", checkasm_check_fmtconvert }, #endif + #if CONFIG_G722DSP + { "g722dsp", checkasm_check_g722dsp }, + #endif #if CONFIG_H264DSP { "h264dsp", checkasm_check_h264dsp }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index fa51e71e4b..3165b21086 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -42,6 +42,7 @@ void checkasm_check_fixed_dsp(void); void checkasm_check_flacdsp(void); void checkasm_check_float_dsp(void); void checkasm_check_fmtconvert(void); +void checkasm_check_g722dsp(void); void checkasm_check_h264dsp(void); void checkasm_check_h264pred(void); void checkasm_check_h264qpel(void); diff --git a/tests/checkasm/g722dsp.c b/tests/checkasm/g722dsp.c new file mode 100644 index 0000000000..2120c5fd58 --- /dev/null +++ b/tests/checkasm/g722dsp.c @@ -0,0 +1,66 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU 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. + */ + +#include +#include "checkasm.h" +#include "libavcodec/g722.h" +#include "libavcodec/g722dsp.h" +#include "libavcodec/mathops.h" + +#define randomize_buffers() \ + do { \ + int i; \ + for (i = 0; i < PREV_SAMPLES_BUF_SIZE; i++) { \ + int16_t r = sign_extend(rnd(), 16); \ + src0[i] = r; \ + src1[i] = r; \ + } \ + } while (0) + +static void check_qmf(int16_t *src0, int16_t *src1, int dst0[2], int dst1[2]) { + const int16_t *tmp0 = src0; + const int16_t *tmp1 = src1; + int i; + + declare_func(void, const int16_t *prev_samples, int xout[2]); + + randomize_buffers(); + for (i = 0; i < PREV_SAMPLES_BUF_SIZE - 24; i++) { + call_ref(tmp0++, dst0); + call_new(tmp1++, dst1); + if (memcmp(src0, src1, PREV_SAMPLES_BUF_SIZE * sizeof(int16_t)) || + memcmp(dst0, dst1, sizeof(dst0))) + fail(); + } + bench_new(src1, dst1); +} + +void checkasm_check_g722dsp(void) +{ + int16_t src0[PREV_SAMPLES_BUF_SIZE]; + int16_t src1[PREV_SAMPLES_BUF_SIZE]; + int dst0[2], dst1[2]; + G722DSPContext h; + + ff_g722dsp_init(&h); + + if (check_func(h.apply_qmf, "g722_apply_qmf")) + check_qmf(src0, src1, dst0, dst1); + + report("apply_qmf"); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 61ce6cd74f..e473b3ec0c 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -7,6 +7,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \ fate-checkasm-flacdsp \ fate-checkasm-float_dsp \ fate-checkasm-fmtconvert \ + fate-checkasm-g722dsp \ fate-checkasm-h264dsp \ fate-checkasm-h264pred \ fate-checkasm-h264qpel \