mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-05 14:30:00 +01:00
checkasm: Add xyz12Torgb48le test
Add checkasm coverage for the XYZ12LE to RGB48LE path via the ctx->xyz12Torgb48 hook. Integrate the test into the build and runner, exercise a variety of widths/heights, compare against the C reference, and benchmark when width is multiple of 4. This improves test coverage for the new function pointer in preparation for architecture-specific implementations in subsequent commits. Signed-off-by: Arpad Panyik <Arpad.Panyik@arm.com>
This commit is contained in:
committed by
Martin Storsjö
parent
ef651b84ce
commit
a13871ae19
@@ -82,6 +82,7 @@ SWSCALEOBJS += sw_gbrp.o \
|
||||
sw_range_convert.o \
|
||||
sw_rgb.o \
|
||||
sw_scale.o \
|
||||
sw_xyz2rgb.o \
|
||||
sw_yuv2rgb.o \
|
||||
sw_yuv2yuv.o
|
||||
|
||||
|
||||
@@ -330,6 +330,7 @@ static const struct {
|
||||
{ "sw_range_convert", checkasm_check_sw_range_convert },
|
||||
{ "sw_rgb", checkasm_check_sw_rgb },
|
||||
{ "sw_scale", checkasm_check_sw_scale },
|
||||
{ "sw_xyz2rgb", checkasm_check_sw_xyz2rgb },
|
||||
{ "sw_yuv2rgb", checkasm_check_sw_yuv2rgb },
|
||||
{ "sw_yuv2yuv", checkasm_check_sw_yuv2yuv },
|
||||
{ "sw_ops", checkasm_check_sw_ops },
|
||||
|
||||
@@ -139,6 +139,7 @@ void checkasm_check_sw_gbrp(void);
|
||||
void checkasm_check_sw_range_convert(void);
|
||||
void checkasm_check_sw_rgb(void);
|
||||
void checkasm_check_sw_scale(void);
|
||||
void checkasm_check_sw_xyz2rgb(void);
|
||||
void checkasm_check_sw_yuv2rgb(void);
|
||||
void checkasm_check_sw_yuv2yuv(void);
|
||||
void checkasm_check_sw_ops(void);
|
||||
|
||||
108
tests/checkasm/sw_xyz2rgb.c
Normal file
108
tests/checkasm/sw_xyz2rgb.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Arpad Panyik <Arpad.Panyik@arm.com>
|
||||
*
|
||||
* 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 <string.h>
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/mem_internal.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
|
||||
#include "libswscale/swscale.h"
|
||||
#include "libswscale/swscale_internal.h"
|
||||
|
||||
#include "checkasm.h"
|
||||
|
||||
#define NUM_LINES 4
|
||||
#define MAX_LINE_SIZE 1920
|
||||
|
||||
#define randomize_buffers(buf, size) \
|
||||
do { \
|
||||
for (int j = 0; j < size; j += 2) \
|
||||
AV_WN32(buf + j, rnd()); \
|
||||
} while (0)
|
||||
|
||||
static void check_xyz12Torgb48le(void)
|
||||
{
|
||||
static const int input_sizes[] = {1, 2, 3, 4, 5, 6, 7, 8, 16, 17, 21, 31,
|
||||
32, 64, 128, 256, 512, 1024,
|
||||
MAX_LINE_SIZE};
|
||||
|
||||
const int src_stride = 3 * sizeof(uint16_t) * MAX_LINE_SIZE;
|
||||
const int dst_stride = src_stride;
|
||||
|
||||
const int src_pix_fmt = AV_PIX_FMT_XYZ12LE;
|
||||
const int dst_pix_fmt = AV_PIX_FMT_RGB48LE;
|
||||
|
||||
const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
|
||||
const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
|
||||
|
||||
LOCAL_ALIGNED_8(uint16_t, src, [3 * MAX_LINE_SIZE * NUM_LINES]);
|
||||
LOCAL_ALIGNED_8(uint16_t, dst_ref, [3 * MAX_LINE_SIZE * NUM_LINES]);
|
||||
LOCAL_ALIGNED_8(uint16_t, dst_new, [3 * MAX_LINE_SIZE * NUM_LINES]);
|
||||
|
||||
declare_func(void, const SwsContext *, uint8_t *, int, const uint8_t *,
|
||||
int, int, int);
|
||||
|
||||
SwsInternal c;
|
||||
memset(&c, 0, sizeof(c));
|
||||
c.opts.src_format = src_pix_fmt;
|
||||
ff_sws_init_xyzdsp(&c);
|
||||
ff_sws_fill_xyztables(&c);
|
||||
|
||||
randomize_buffers(src, 3 * MAX_LINE_SIZE * NUM_LINES);
|
||||
|
||||
for (int height = 1; height <= NUM_LINES; height++) {
|
||||
for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) {
|
||||
int width = input_sizes[isi];
|
||||
|
||||
if (check_func(c.xyz12Torgb48, "%s_%s_%dx%d", src_desc->name,
|
||||
dst_desc->name, width, height)) {
|
||||
memset(dst_ref, 0xFE,
|
||||
3 * sizeof(uint16_t) * MAX_LINE_SIZE * NUM_LINES);
|
||||
memset(dst_new, 0xFE,
|
||||
3 * sizeof(uint16_t) * MAX_LINE_SIZE * NUM_LINES);
|
||||
|
||||
call_ref((const SwsContext*)&c, (uint8_t *)dst_ref, dst_stride,
|
||||
(const uint8_t *)src, src_stride, width, height);
|
||||
call_new((const SwsContext*)&c, (uint8_t *)dst_new, dst_stride,
|
||||
(const uint8_t *)src, src_stride, width, height);
|
||||
|
||||
checkasm_check(uint16_t, dst_ref, dst_stride, dst_new,
|
||||
dst_stride, width, height, "dst_rgb");
|
||||
|
||||
if (!(width & 3) && height == NUM_LINES) {
|
||||
bench_new((const SwsContext*)&c, (uint8_t *)dst_new,
|
||||
dst_stride, (const uint8_t *)src, src_stride,
|
||||
width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef NUM_LINES
|
||||
#undef MAX_LINE_SIZE
|
||||
|
||||
void checkasm_check_sw_xyz2rgb(void)
|
||||
{
|
||||
check_xyz12Torgb48le();
|
||||
report("xyz12Torgb48le");
|
||||
}
|
||||
@@ -55,6 +55,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp \
|
||||
fate-checkasm-sw_range_convert \
|
||||
fate-checkasm-sw_rgb \
|
||||
fate-checkasm-sw_scale \
|
||||
fate-checkasm-sw_xyz2rgb \
|
||||
fate-checkasm-sw_yuv2rgb \
|
||||
fate-checkasm-sw_yuv2yuv \
|
||||
fate-checkasm-takdsp \
|
||||
|
||||
Reference in New Issue
Block a user