From patchwork Wed Apr 10 12:47:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Darnley X-Patchwork-Id: 12691 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 4E9F3448F55 for ; Wed, 10 Apr 2019 15:48:16 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 27D2A68AF0B; Wed, 10 Apr 2019 15:48:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E31E68AE41 for ; Wed, 10 Apr 2019 15:48:09 +0300 (EEST) Received: by mail-wr1-f49.google.com with SMTP id p10so2831662wrq.1 for ; Wed, 10 Apr 2019 05:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=obe-tv.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DclKhe+D+A/5Sb4NOVVuyySRhqjtufdabgJkykVJAuE=; b=xCb7ZNj5bjtZOUYTAPmaUuH/OOJYOw7pxB/x1HDdffPT0A/9r8wvH6f7mLzzYaJu8+ ajpgjzwI1CJWesEkJJUBLjy6hfhnzjdVaDm0x4wqMiklYYsw349F+ZP9Qeliq0wWfpC+ NplYhrIVEz+TVnWqw/Oj6Zvi0RUFSZ9hNX/9zS7DpTZsCm9Z7VMeEsXVsvAW3FZNFuN8 mZigsStgF7sAMuSw/n1GomfEgb3qp+JoTirLzSks9Rc62PA0SEq5sny27Q3EaeWouDlW DZdhIO8lgxx4q6RgvLdULf2Zg0pJoHoZyy5anAODqjdKL2l58ZLzkLC326dUq5Of6tYo Cqdg== 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:mime-version:content-transfer-encoding; bh=DclKhe+D+A/5Sb4NOVVuyySRhqjtufdabgJkykVJAuE=; b=iiEZdsL+EaaUt2ARstXbaLJNEsUY0rOK++7F96DFcE5KZUJeDiLukt1Aw3AuuLBqjD sxCrWgaa+hMTqHOcYOOcCxyXhLuJ9Q56/lggBtQ0hNUEK93oIMIWDyBcpHZn97eWr+og Zxb24GcT5RN4XsBAc+9NDn+ugkF+1vMhZ9ylGAPjwR48q+zT2vrNufswXR0iDkni0S2B 77TDcFZJzAOVg1pT/723u2T3+TgLsIhAIZL1Tr6WAY90P1LCT5Z6McChPbAoS29Pzb2L FxIXyIUvjHRQ6BpRKDx5RVLQnyTKT3TAeVZG2O3W31aCxLMSGYxjYiazu3N8KLHQtL22 CUhg== X-Gm-Message-State: APjAAAV/JJ7BOaVDG14TR3fVBzDVpkpszlZSnvoG7UaD7T9QpVPeJ08W QDHUKvDKGBVoyEIIKvWczYCidwJCcWc= X-Google-Smtp-Source: APXvYqzOFFMt50cIdfUJjC1q3FwTqOdIOFWwY14bbUMCaOKdDW9kmODWPE+dskin4dIKQGgMf2l80w== X-Received: by 2002:a5d:5190:: with SMTP id k16mr27772901wrv.10.1554900488812; Wed, 10 Apr 2019 05:48:08 -0700 (PDT) Received: from Highwind.systemlords.lan (ptr-7sz70r1cslylgf1u1t2.18120a2.ip6.access.telenet.be. [2a02:1811:41e:dc00:6dc8:1f8e:32c0:e1a6]) by smtp.gmail.com with ESMTPSA id 61sm119323070wre.50.2019.04.10.05.48.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 05:48:08 -0700 (PDT) From: James Darnley To: ffmpeg-devel@ffmpeg.org Date: Wed, 10 Apr 2019 14:47:48 +0200 Message-Id: <20190410124749.9362-3-jdarnley@obe.tv> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190410124749.9362-1-jdarnley@obe.tv> References: <20190410124749.9362-1-jdarnley@obe.tv> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] checkasm: add test for v210dec 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/v210dec.c | 77 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 tests/checkasm/v210dec.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 8cc0bff2d1..886ae33167 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -25,6 +25,7 @@ AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_idct.o hevc_sao.o AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o +AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 9eec41e3c4..bf51e00eab 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -136,6 +136,9 @@ static const struct { #if CONFIG_UTVIDEO_DECODER { "utvideodsp", checkasm_check_utvideodsp }, #endif + #if CONFIG_V210_DECODER + { "v210dec", checkasm_check_v210dec }, + #endif #if CONFIG_V210_ENCODER { "v210enc", checkasm_check_v210enc }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 9e8e879fd3..9b8d2f5419 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -69,6 +69,7 @@ void checkasm_check_sbrdsp(void); void checkasm_check_synth_filter(void); void checkasm_check_sw_rgb(void); void checkasm_check_utvideodsp(void); +void checkasm_check_v210dec(void); void checkasm_check_v210enc(void); void checkasm_check_vf_hflip(void); void checkasm_check_vf_threshold(void); diff --git a/tests/checkasm/v210dec.c b/tests/checkasm/v210dec.c new file mode 100644 index 0000000000..7dd50a8271 --- /dev/null +++ b/tests/checkasm/v210dec.c @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2019 James Darnley + * + * 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/v210dec.h" + +static uint32_t get_v210(void) +{ + uint32_t t0 = rnd() & 0x3ff, + t1 = rnd() & 0x3ff, + t2 = rnd() & 0x3ff; + uint32_t value = t0 + | (t1 << 10) + | (t2 << 20); + return value; +} + +#define NUM_SAMPLES 2048 + +static void randomize_buffers(uint32_t *src0, uint32_t *src1, int len) +{ + for (int i = 0; i < len; i++) { + uint32_t value = get_v210(); + src0[i] = value; + src1[i] = value; + } +} + +void checkasm_check_v210dec(void) +{ + V210DecContext h; + + h.aligned_input = 0; + ff_v210dec_init(&h); + + if (check_func(h.unpack_frame, "v210_unpack")) { + uint32_t src0[NUM_SAMPLES/3]; + uint32_t src1[NUM_SAMPLES/3]; + uint16_t y0[NUM_SAMPLES/2]; + uint16_t y1[NUM_SAMPLES/2]; + uint16_t u0[NUM_SAMPLES/4]; + uint16_t u1[NUM_SAMPLES/4]; + uint16_t v0[NUM_SAMPLES/4]; + uint16_t v1[NUM_SAMPLES/4]; + declare_func(void, const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); + const int pixels = NUM_SAMPLES / 2 / 6 * 6; + + randomize_buffers(src0, src1, NUM_SAMPLES/3); + call_ref(src0, y0, u0, v0, pixels); + call_new(src1, y1, u1, v1, pixels); + if (memcmp(src0, src1, NUM_SAMPLES/3 * sizeof src0[0]) + || memcmp(y0, y1, pixels * sizeof y0[0]) + || memcmp(u0, u1, pixels/2 * sizeof u0[0]) + || memcmp(v0, v1, pixels/2 * sizeof v0[0])) + fail(); + bench_new(src1, y1, u1, v1, pixels); + } + report("v210_unpack"); +}