From patchwork Fri May 24 15:59:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 49204 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:542:0:b0:460:55fa:d5ed with SMTP id 63csp1835562vqf; Fri, 24 May 2024 08:59:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWfZk9O/VgVs/s2W9ZDu2EaBI17YrNboDLbmtXoVG9Y0lDsw1QDTr2npqC1fHA7Id5u136acsMndd9kYaac1MIQ4tV1UUqwhCrpKA== X-Google-Smtp-Source: AGHT+IGrxX2tz1rb2ZLs3Ph3sOUYR7Ii/xkCJMsdMJ0f1vVH5Tpn2ISqUGq4c81JmLadV20jOtpA X-Received: by 2002:a17:906:b152:b0:a59:cf38:5340 with SMTP id a640c23a62f3a-a626525ba99mr156215166b.5.1716566388130; Fri, 24 May 2024 08:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716566388; cv=none; d=google.com; s=arc-20160816; b=y++wpQzjZ8VuaGt5bgfr4hTo8Fnmy3qYTCLZevPPWGj6zUl8FeMuDQjD+aTe/PQ4gk RkXYW5LNUKjWF3OVji/tlLMReKIQKSytsLhSI9iNgqv5c9BpdFY+b497hi3bm+4zUWtp 7WYtD9CUtuBlZ/lwENwDvaDoqpwdphVZvz1p1bSWXJ23JVSPXprhrmLn+Ov0xhwQck3K V9dTb4Y3qQOqD754ujGBclwpTVntiQ4KQ4us+LFwln9ObnQuhZUsH2sh0eaNiaV1vi8D pTzUVq/IRkarRVWa1iNCQXSsCumzYrIuAuLtjAenVraleZ9sYYA2oXiQkoVjJXs81nQP TzLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=MypM826aZzCDq5FkD/RiNIaDLtTsMFVaEYea9WlGI0s=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=La5DjebyhkikM46ORluKVZaTZ0XC7rG187OgKkCgNDmXgUiJvM5/Zo258bm6J4i9jg 9WuKdnc+XzaV5zdz9yXKyOODi898TDeJM44+xabZ9Kdb8ARtTCv9KuEHmC+b5Fy4x80f w3DTNfJrW95kpjL56+c8qvX298bpKCZdOAAacc6xLNpGYr4i0WRHrqIArTfaTIURBC3i efqtI7+b9rygbIKVk0gphANr7upqDzOXn7SSWqleLJSON6wVivkt7bNdkhf2prpTFw5C 1ztFGLsUHoEbN2I1kS4yABl7Tr0J1yifXGivW2UE8rMNYYEsdTeqF0MrbgxvKxJ6FwES wIZg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a626cc64414si94710966b.537.2024.05.24.08.59.47; Fri, 24 May 2024 08:59:48 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1FD9168D57B; Fri, 24 May 2024 18:59:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 90E5A68D222 for ; Fri, 24 May 2024 18:59:36 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id E951FC006E for ; Fri, 24 May 2024 18:59:35 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 24 May 2024 18:59:34 +0300 Message-ID: <20240524155935.28531-1-remi@remlab.net> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] checkasm/vp8dsp: share DSP context across tests 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Sd4SsgmNKBgD This will simplify later changes. --- tests/checkasm/vp8dsp.c | 82 +++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 48 deletions(-) diff --git a/tests/checkasm/vp8dsp.c b/tests/checkasm/vp8dsp.c index 6e989819ef..12d2f62f2d 100644 --- a/tests/checkasm/vp8dsp.c +++ b/tests/checkasm/vp8dsp.c @@ -108,7 +108,7 @@ static void wht4x4(int16_t *coef) } } -static void check_idct(void) +static void check_idct(VP8DSPContext *d) { LOCAL_ALIGNED_16(uint8_t, src, [4 * 4]); LOCAL_ALIGNED_16(uint8_t, dst, [4 * 4]); @@ -117,17 +117,15 @@ static void check_idct(void) LOCAL_ALIGNED_16(int16_t, coef, [4 * 4]); LOCAL_ALIGNED_16(int16_t, subcoef0, [4 * 4]); LOCAL_ALIGNED_16(int16_t, subcoef1, [4 * 4]); - VP8DSPContext d; int dc; declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, int16_t *block, ptrdiff_t stride); - ff_vp8dsp_init(&d); randomize_buffers(src, dst, 4, coef); dct4x4(coef); for (dc = 0; dc <= 1; dc++) { - void (*idct)(uint8_t *, int16_t *, ptrdiff_t) = dc ? d.vp8_idct_dc_add : d.vp8_idct_add; + void (*idct)(uint8_t *, int16_t *, ptrdiff_t) = dc ? d->vp8_idct_dc_add : d->vp8_idct_add; if (check_func(idct, "vp8_idct_%sadd", dc ? "dc_" : "")) { if (dc) { @@ -153,7 +151,7 @@ static void check_idct(void) } } -static void check_idct_dc4(void) +static void check_idct_dc4(VP8DSPContext *d) { LOCAL_ALIGNED_16(uint8_t, src, [4 * 4 * 4]); LOCAL_ALIGNED_16(uint8_t, dst, [4 * 4 * 4]); @@ -162,14 +160,11 @@ static void check_idct_dc4(void) LOCAL_ALIGNED_16(int16_t, coef, [4], [4 * 4]); LOCAL_ALIGNED_16(int16_t, subcoef0, [4], [4 * 4]); LOCAL_ALIGNED_16(int16_t, subcoef1, [4], [4 * 4]); - VP8DSPContext d; int i, chroma; declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); - ff_vp8dsp_init(&d); - for (chroma = 0; chroma <= 1; chroma++) { - void (*idct4dc)(uint8_t *, int16_t[4][16], ptrdiff_t) = chroma ? d.vp8_idct_dc_add4uv : d.vp8_idct_dc_add4y; + void (*idct4dc)(uint8_t *, int16_t[4][16], ptrdiff_t) = chroma ? d->vp8_idct_dc_add4uv : d->vp8_idct_dc_add4y; if (check_func(idct4dc, "vp8_idct_dc_add4%s", chroma ? "uv" : "y")) { ptrdiff_t stride = chroma ? 8 : 16; int w = chroma ? 2 : 4; @@ -196,7 +191,7 @@ static void check_idct_dc4(void) } -static void check_luma_dc_wht(void) +static void check_luma_dc_wht(VP8DSPContext *d) { LOCAL_ALIGNED_16(int16_t, dc, [4 * 4]); LOCAL_ALIGNED_16(int16_t, dc0, [4 * 4]); @@ -204,13 +199,10 @@ static void check_luma_dc_wht(void) int16_t block[4][4][16]; LOCAL_ALIGNED_16(int16_t, block0, [4], [4][16]); LOCAL_ALIGNED_16(int16_t, block1, [4], [4][16]); - VP8DSPContext d; int dc_only; int blockx, blocky; declare_func_emms(AV_CPU_FLAG_MMX, void, int16_t block[4][4][16], int16_t dc[16]); - ff_vp8dsp_init(&d); - for (blocky = 0; blocky < 4; blocky++) { for (blockx = 0; blockx < 4; blockx++) { uint8_t src[16], dst[16]; @@ -224,7 +216,7 @@ static void check_luma_dc_wht(void) wht4x4(dc); for (dc_only = 0; dc_only <= 1; dc_only++) { - void (*idct)(int16_t [4][4][16], int16_t [16]) = dc_only ? d.vp8_luma_dc_wht_dc : d.vp8_luma_dc_wht; + void (*idct)(int16_t [4][4][16], int16_t [16]) = dc_only ? d->vp8_luma_dc_wht_dc : d->vp8_luma_dc_wht; if (check_func(idct, "vp8_luma_dc_wht%s", dc_only ? "_dc" : "")) { if (dc_only) { @@ -262,20 +254,16 @@ static void check_luma_dc_wht(void) } \ } while (0) -static void check_mc(void) +static void check_mc(VP8DSPContext *d) { LOCAL_ALIGNED_16(uint8_t, buf, [32 * 32]); LOCAL_ALIGNED_16(uint8_t, dst0, [16 * 16]); LOCAL_ALIGNED_16(uint8_t, dst1, [16 * 16]); - VP8DSPContext d; int type, k, dx, dy; declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, ptrdiff_t, const uint8_t *, ptrdiff_t, int, int, int); - ff_vp78dsp_init(&d); - for (type = 0; type < 2; type++) { - vp8_mc_func (*tab)[3][3] = type ? d.put_vp8_bilinear_pixels_tab : d.put_vp8_epel_pixels_tab; for (k = 1; k < 8; k++) { int hsize = k / 3; int size = 16 >> hsize; @@ -283,6 +271,8 @@ static void check_mc(void) for (dy = 0; dy < 3; dy++) { for (dx = 0; dx < 3; dx++) { char str[100]; + vp8_mc_func func = (type ? d->put_vp8_bilinear_pixels_tab : d->put_vp8_epel_pixels_tab)[hsize][dy][dx]; + if (dx || dy) { if (type == 0) { static const char *dx_names[] = { "", "h4", "h6" }; @@ -294,7 +284,8 @@ static void check_mc(void) } else { snprintf(str, sizeof(str), "pixels%d", size); } - if (check_func(tab[hsize][dy][dx], "vp8_put_%s", str)) { + + if (check_func(func, "vp8_put_%s", str)) { int mx, my; int i; if (type == 0) { @@ -377,17 +368,14 @@ static void fill_loopfilter_buffers(uint8_t *buf, ptrdiff_t stride, int w, int h #define randomize_buffers(buf, lineoff, str, force_hev) \ randomize_loopfilter_buffers(lineoff, str, dir, flim_E, flim_I, hev_thresh, buf, force_hev) -static void check_loopfilter_16y(void) +static void check_loopfilter_16y(VP8DSPContext *d) { LOCAL_ALIGNED_16(uint8_t, base0, [32 + 16 * 16]); LOCAL_ALIGNED_16(uint8_t, base1, [32 + 16 * 16]); - VP8DSPContext d; int dir, edge, force_hev; int flim_E = 20, flim_I = 10, hev_thresh = 7; declare_func(void, uint8_t *, ptrdiff_t, int, int, int); - ff_vp8dsp_init(&d); - for (dir = 0; dir < 2; dir++) { int midoff = dir ? 4 * 16 : 4; int midoff_aligned = dir ? 4 * 16 : 16; @@ -396,10 +384,10 @@ static void check_loopfilter_16y(void) for (edge = 0; edge < 2; edge++) { void (*func)(uint8_t *, ptrdiff_t, int, int, int) = NULL; switch (dir << 1 | edge) { - case (0 << 1) | 0: func = d.vp8_h_loop_filter16y; break; - case (1 << 1) | 0: func = d.vp8_v_loop_filter16y; break; - case (0 << 1) | 1: func = d.vp8_h_loop_filter16y_inner; break; - case (1 << 1) | 1: func = d.vp8_v_loop_filter16y_inner; break; + case (0 << 1) | 0: func = d->vp8_h_loop_filter16y; break; + case (1 << 1) | 0: func = d->vp8_v_loop_filter16y; break; + case (0 << 1) | 1: func = d->vp8_h_loop_filter16y_inner; break; + case (1 << 1) | 1: func = d->vp8_v_loop_filter16y_inner; break; } if (check_func(func, "vp8_loop_filter16y%s_%s", edge ? "_inner" : "", dir ? "v" : "h")) { for (force_hev = -1; force_hev <= 1; force_hev++) { @@ -421,19 +409,16 @@ static void check_loopfilter_16y(void) } } -static void check_loopfilter_8uv(void) +static void check_loopfilter_8uv(VP8DSPContext *d) { LOCAL_ALIGNED_16(uint8_t, base0u, [32 + 16 * 16]); LOCAL_ALIGNED_16(uint8_t, base0v, [32 + 16 * 16]); LOCAL_ALIGNED_16(uint8_t, base1u, [32 + 16 * 16]); LOCAL_ALIGNED_16(uint8_t, base1v, [32 + 16 * 16]); - VP8DSPContext d; int dir, edge, force_hev; int flim_E = 20, flim_I = 10, hev_thresh = 7; declare_func(void, uint8_t *, uint8_t *, ptrdiff_t, int, int, int); - ff_vp8dsp_init(&d); - for (dir = 0; dir < 2; dir++) { int midoff = dir ? 4 * 16 : 4; int midoff_aligned = dir ? 4 * 16 : 16; @@ -444,10 +429,10 @@ static void check_loopfilter_8uv(void) for (edge = 0; edge < 2; edge++) { void (*func)(uint8_t *, uint8_t *, ptrdiff_t, int, int, int) = NULL; switch (dir << 1 | edge) { - case (0 << 1) | 0: func = d.vp8_h_loop_filter8uv; break; - case (1 << 1) | 0: func = d.vp8_v_loop_filter8uv; break; - case (0 << 1) | 1: func = d.vp8_h_loop_filter8uv_inner; break; - case (1 << 1) | 1: func = d.vp8_v_loop_filter8uv_inner; break; + case (0 << 1) | 0: func = d->vp8_h_loop_filter8uv; break; + case (1 << 1) | 0: func = d->vp8_v_loop_filter8uv; break; + case (0 << 1) | 1: func = d->vp8_h_loop_filter8uv_inner; break; + case (1 << 1) | 1: func = d->vp8_v_loop_filter8uv_inner; break; } if (check_func(func, "vp8_loop_filter8uv%s_%s", edge ? "_inner" : "", dir ? "v" : "h")) { for (force_hev = -1; force_hev <= 1; force_hev++) { @@ -474,23 +459,20 @@ static void check_loopfilter_8uv(void) } } -static void check_loopfilter_simple(void) +static void check_loopfilter_simple(VP8DSPContext *d) { LOCAL_ALIGNED_16(uint8_t, base0, [32 + 16 * 16]); LOCAL_ALIGNED_16(uint8_t, base1, [32 + 16 * 16]); - VP8DSPContext d; int dir; int flim_E = 20, flim_I = 30, hev_thresh = 0; declare_func(void, uint8_t *, ptrdiff_t, int); - ff_vp8dsp_init(&d); - for (dir = 0; dir < 2; dir++) { int midoff = dir ? 4 * 16 : 4; int midoff_aligned = dir ? 4 * 16 : 16; uint8_t *buf0 = base0 + midoff_aligned; uint8_t *buf1 = base1 + midoff_aligned; - void (*func)(uint8_t *, ptrdiff_t, int) = dir ? d.vp8_v_loop_filter_simple : d.vp8_h_loop_filter_simple; + void (*func)(uint8_t *, ptrdiff_t, int) = dir ? d->vp8_v_loop_filter_simple : d->vp8_h_loop_filter_simple; if (check_func(func, "vp8_loop_filter_simple_%s", dir ? "v" : "h")) { fill_loopfilter_buffers(buf0 - midoff, 16, 16, 16); randomize_buffers(buf0, 0, 16, -1); @@ -507,14 +489,18 @@ static void check_loopfilter_simple(void) void checkasm_check_vp8dsp(void) { - check_idct(); - check_idct_dc4(); - check_luma_dc_wht(); + VP8DSPContext d; + + ff_vp78dsp_init(&d); + ff_vp8dsp_init(&d); + check_idct(&d); + check_idct_dc4(&d); + check_luma_dc_wht(&d); report("idct"); - check_mc(); + check_mc(&d); report("mc"); - check_loopfilter_16y(); - check_loopfilter_8uv(); - check_loopfilter_simple(); + check_loopfilter_16y(&d); + check_loopfilter_8uv(&d); + check_loopfilter_simple(&d); report("loopfilter"); } From patchwork Fri May 24 15:59:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 49205 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:542:0:b0:460:55fa:d5ed with SMTP id 63csp1835690vqf; Fri, 24 May 2024 08:59:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWAu4qWkmKPadRayw5qM9EAEUmf4zqk+PPEiTS4Ddl8oMA+tfKqPJcwW85QyeyUpNy5TugfTDkJVbkc+CjKP89+LiD4rAPC8Ut5yQ== X-Google-Smtp-Source: AGHT+IEvXPh3FUVChyvvhcNeEfLfANTyuZeoxO17W3pVV7fBsIbLSyZMrqPwwxjK43j3TCs+Hq2x X-Received: by 2002:a50:ab41:0:b0:575:2a03:8ff6 with SMTP id 4fb4d7f45d1cf-57843f074cdmr4627891a12.16.1716566397644; Fri, 24 May 2024 08:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716566397; cv=none; d=google.com; s=arc-20160816; b=wjdv/RpzzecRnQ9dIJBJh1R3wg4cUdjBiWmk6W9Lhh9r5mhhjqD5dz3EBEFvXNaZE7 PyOy5RJy2Be8qWXeBzCN5nGS6C8RlrRKmEkSJ3gBq9gFZhNJown0Xa6dMHIpNkgnihve 6SbPIukii9ujpdjBouurAvmwXsQSH7liBJdNVEWUfdfrKZfPuLSa5xV/xPI6FRHq+IRN 7vjXY5VJQH/rxHoVRcLYPNiaUdqE7/snT365AL0O/dYzn5itUynX/suAOyW5X6hEUe5C MmLif3BK07Nd75+zERFduDcIOYSalDKgkjO+C/xXts1lxGOOh0QelQZ1Q6/g37S2RdXI R6vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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:delivered-to; bh=k5iAcO+LMjIDTjr4rhSKpnHCC3ybvZcDPGW+w55QL5w=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=ODm3ZAZsYh1lcYLKhKVR+85ul+kuWs5QzopCtpu+TQcnvMB1sKd2+VwhCuzX5NrMei 9QJA1ygMwBfKYHK8ELUOfw1UZSeLJsys5BSpz4oEAzAWWgGmR837qpR5TJHa7TkWzQ0P TW0TeEqJ0ZfYM10oE59rLGw1EE7kEWy5QWrWqNmw1ahcW7CHFXRoYNnCU4IrVngz3BdX AUhVP+7k7LvM+F7HOOiUqLxsson7b7WvmKGKXfDMdp0Ss5tcGqdbCYWQWLCMGXUTFV/f Kb5aKnQYhjnK3EfVyo1b9a2DhsTgW3ANZiKTDBu7D9IAtCJP5QAItHSPKgPAsFSur5v4 bg3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-578524b660fsi1021326a12.558.2024.05.24.08.59.56; Fri, 24 May 2024 08:59:57 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4545668D545; Fri, 24 May 2024 18:59:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DE4A868D222 for ; Fri, 24 May 2024 18:59:36 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 288A9C01F0 for ; Fri, 24 May 2024 18:59:36 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 24 May 2024 18:59:35 +0300 Message-ID: <20240524155935.28531-2-remi@remlab.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524155935.28531-1-remi@remlab.net> References: <20240524155935.28531-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] checkasm/vp8dsp: add VP7 tests 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: lWTdFyZy7C87 --- tests/checkasm/vp8dsp.c | 57 ++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/tests/checkasm/vp8dsp.c b/tests/checkasm/vp8dsp.c index 12d2f62f2d..e448fe89fc 100644 --- a/tests/checkasm/vp8dsp.c +++ b/tests/checkasm/vp8dsp.c @@ -18,8 +18,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include +#include "config_components.h" #include "libavcodec/vp8dsp.h" #include "libavutil/common.h" @@ -108,7 +110,7 @@ static void wht4x4(int16_t *coef) } } -static void check_idct(VP8DSPContext *d) +static void check_idct(VP8DSPContext *d, bool is_vp7) { LOCAL_ALIGNED_16(uint8_t, src, [4 * 4]); LOCAL_ALIGNED_16(uint8_t, dst, [4 * 4]); @@ -127,7 +129,7 @@ static void check_idct(VP8DSPContext *d) for (dc = 0; dc <= 1; dc++) { void (*idct)(uint8_t *, int16_t *, ptrdiff_t) = dc ? d->vp8_idct_dc_add : d->vp8_idct_add; - if (check_func(idct, "vp8_idct_%sadd", dc ? "dc_" : "")) { + if (check_func(idct, "vp%d_idct_%sadd", 8 - is_vp7, dc ? "dc_" : "")) { if (dc) { memset(subcoef0, 0, 4 * 4 * sizeof(int16_t)); subcoef0[0] = coef[0]; @@ -151,7 +153,7 @@ static void check_idct(VP8DSPContext *d) } } -static void check_idct_dc4(VP8DSPContext *d) +static void check_idct_dc4(VP8DSPContext *d, bool is_vp7) { LOCAL_ALIGNED_16(uint8_t, src, [4 * 4 * 4]); LOCAL_ALIGNED_16(uint8_t, dst, [4 * 4 * 4]); @@ -165,7 +167,7 @@ static void check_idct_dc4(VP8DSPContext *d) for (chroma = 0; chroma <= 1; chroma++) { void (*idct4dc)(uint8_t *, int16_t[4][16], ptrdiff_t) = chroma ? d->vp8_idct_dc_add4uv : d->vp8_idct_dc_add4y; - if (check_func(idct4dc, "vp8_idct_dc_add4%s", chroma ? "uv" : "y")) { + if (check_func(idct4dc, "vp%d_idct_dc_add4%s", 8 - is_vp7, chroma ? "uv" : "y")) { ptrdiff_t stride = chroma ? 8 : 16; int w = chroma ? 2 : 4; for (i = 0; i < 4; i++) { @@ -191,7 +193,7 @@ static void check_idct_dc4(VP8DSPContext *d) } -static void check_luma_dc_wht(VP8DSPContext *d) +static void check_luma_dc_wht(VP8DSPContext *d, bool is_vp7) { LOCAL_ALIGNED_16(int16_t, dc, [4 * 4]); LOCAL_ALIGNED_16(int16_t, dc0, [4 * 4]); @@ -218,7 +220,7 @@ static void check_luma_dc_wht(VP8DSPContext *d) for (dc_only = 0; dc_only <= 1; dc_only++) { void (*idct)(int16_t [4][4][16], int16_t [16]) = dc_only ? d->vp8_luma_dc_wht_dc : d->vp8_luma_dc_wht; - if (check_func(idct, "vp8_luma_dc_wht%s", dc_only ? "_dc" : "")) { + if (check_func(idct, "vp%d_luma_dc_wht%s", 8 - is_vp7, dc_only ? "_dc" : "")) { if (dc_only) { memset(dc0, 0, 16 * sizeof(int16_t)); dc0[0] = dc[0]; @@ -368,7 +370,7 @@ static void fill_loopfilter_buffers(uint8_t *buf, ptrdiff_t stride, int w, int h #define randomize_buffers(buf, lineoff, str, force_hev) \ randomize_loopfilter_buffers(lineoff, str, dir, flim_E, flim_I, hev_thresh, buf, force_hev) -static void check_loopfilter_16y(VP8DSPContext *d) +static void check_loopfilter_16y(VP8DSPContext *d, bool is_vp7) { LOCAL_ALIGNED_16(uint8_t, base0, [32 + 16 * 16]); LOCAL_ALIGNED_16(uint8_t, base1, [32 + 16 * 16]); @@ -389,7 +391,7 @@ static void check_loopfilter_16y(VP8DSPContext *d) case (0 << 1) | 1: func = d->vp8_h_loop_filter16y_inner; break; case (1 << 1) | 1: func = d->vp8_v_loop_filter16y_inner; break; } - if (check_func(func, "vp8_loop_filter16y%s_%s", edge ? "_inner" : "", dir ? "v" : "h")) { + if (check_func(func, "vp%d_loop_filter16y%s_%s", 8 - is_vp7, edge ? "_inner" : "", dir ? "v" : "h")) { for (force_hev = -1; force_hev <= 1; force_hev++) { fill_loopfilter_buffers(buf0 - midoff, 16, 16, 16); randomize_buffers(buf0, 0, 16, force_hev); @@ -409,7 +411,7 @@ static void check_loopfilter_16y(VP8DSPContext *d) } } -static void check_loopfilter_8uv(VP8DSPContext *d) +static void check_loopfilter_8uv(VP8DSPContext *d, bool is_vp7) { LOCAL_ALIGNED_16(uint8_t, base0u, [32 + 16 * 16]); LOCAL_ALIGNED_16(uint8_t, base0v, [32 + 16 * 16]); @@ -434,7 +436,7 @@ static void check_loopfilter_8uv(VP8DSPContext *d) case (0 << 1) | 1: func = d->vp8_h_loop_filter8uv_inner; break; case (1 << 1) | 1: func = d->vp8_v_loop_filter8uv_inner; break; } - if (check_func(func, "vp8_loop_filter8uv%s_%s", edge ? "_inner" : "", dir ? "v" : "h")) { + if (check_func(func, "vp%d_loop_filter8uv%s_%s", 8 - is_vp7, edge ? "_inner" : "", dir ? "v" : "h")) { for (force_hev = -1; force_hev <= 1; force_hev++) { fill_loopfilter_buffers(buf0u - midoff, 16, 16, 16); fill_loopfilter_buffers(buf0v - midoff, 16, 16, 16); @@ -459,7 +461,7 @@ static void check_loopfilter_8uv(VP8DSPContext *d) } } -static void check_loopfilter_simple(VP8DSPContext *d) +static void check_loopfilter_simple(VP8DSPContext *d, bool is_vp7) { LOCAL_ALIGNED_16(uint8_t, base0, [32 + 16 * 16]); LOCAL_ALIGNED_16(uint8_t, base1, [32 + 16 * 16]); @@ -473,7 +475,7 @@ static void check_loopfilter_simple(VP8DSPContext *d) uint8_t *buf0 = base0 + midoff_aligned; uint8_t *buf1 = base1 + midoff_aligned; void (*func)(uint8_t *, ptrdiff_t, int) = dir ? d->vp8_v_loop_filter_simple : d->vp8_h_loop_filter_simple; - if (check_func(func, "vp8_loop_filter_simple_%s", dir ? "v" : "h")) { + if (check_func(func, "vp%d_loop_filter_simple_%s", 8 - is_vp7, dir ? "v" : "h")) { fill_loopfilter_buffers(buf0 - midoff, 16, 16, 16); randomize_buffers(buf0, 0, 16, -1); randomize_buffers(buf0, 8, 16, -1); @@ -487,20 +489,33 @@ static void check_loopfilter_simple(VP8DSPContext *d) } } +static void checkasm_check_vp78dsp(VP8DSPContext *d, bool is_vp7) +{ +#if CONFIG_VP7_DECODER + if (is_vp7) + ff_vp7dsp_init(d); + else +#endif + ff_vp8dsp_init(d); + check_idct(d, is_vp7); + check_idct_dc4(d, is_vp7); + check_luma_dc_wht(d, is_vp7); + report("idct"); + check_loopfilter_16y(d, is_vp7); + check_loopfilter_8uv(d, is_vp7); + check_loopfilter_simple(d, is_vp7); + report("loopfilter"); +} + void checkasm_check_vp8dsp(void) { VP8DSPContext d; ff_vp78dsp_init(&d); - ff_vp8dsp_init(&d); - check_idct(&d); - check_idct_dc4(&d); - check_luma_dc_wht(&d); - report("idct"); check_mc(&d); report("mc"); - check_loopfilter_16y(&d); - check_loopfilter_8uv(&d); - check_loopfilter_simple(&d); - report("loopfilter"); + checkasm_check_vp78dsp(&d, false); +#if CONFIG_VP7_DECODER + checkasm_check_vp78dsp(&d, true); +#endif }