Commit 78b982d3 authored by Martin Vignali's avatar Martin Vignali

checkasm : add test for losslessvideoencdsp for diff bytes and sub_left_pred

parent 8f9c38b1
...@@ -10,6 +10,7 @@ AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o ...@@ -10,6 +10,7 @@ AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o
AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o
AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o
AVCODECOBJS-$(CONFIG_LLVIDDSP) += llviddsp.o AVCODECOBJS-$(CONFIG_LLVIDDSP) += llviddsp.o
AVCODECOBJS-$(CONFIG_LLVIDENCDSP) += llviddspenc.o
AVCODECOBJS-$(CONFIG_VP8DSP) += vp8dsp.o AVCODECOBJS-$(CONFIG_VP8DSP) += vp8dsp.o
AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o
......
...@@ -126,6 +126,9 @@ static const struct { ...@@ -126,6 +126,9 @@ static const struct {
#if CONFIG_HUFFYUVDSP #if CONFIG_HUFFYUVDSP
{ "llviddsp", checkasm_check_llviddsp }, { "llviddsp", checkasm_check_llviddsp },
#endif #endif
#if CONFIG_LLVIDENCDSP
{ "llviddspenc", checkasm_check_llviddspenc },
#endif
#if CONFIG_PIXBLOCKDSP #if CONFIG_PIXBLOCKDSP
{ "pixblockdsp", checkasm_check_pixblockdsp }, { "pixblockdsp", checkasm_check_pixblockdsp },
#endif #endif
......
...@@ -60,6 +60,7 @@ void checkasm_check_hevc_idct(void); ...@@ -60,6 +60,7 @@ void checkasm_check_hevc_idct(void);
void checkasm_check_huffyuvdsp(void); void checkasm_check_huffyuvdsp(void);
void checkasm_check_jpeg2000dsp(void); void checkasm_check_jpeg2000dsp(void);
void checkasm_check_llviddsp(void); void checkasm_check_llviddsp(void);
void checkasm_check_llviddspenc(void);
void checkasm_check_pixblockdsp(void); void checkasm_check_pixblockdsp(void);
void checkasm_check_sbrdsp(void); void checkasm_check_sbrdsp(void);
void checkasm_check_synth_filter(void); void checkasm_check_synth_filter(void);
......
/*
* Copyright (c) 2016 Alexandra Hájková
*
* 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/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavcodec/lossless_videoencdsp.h"
#include "checkasm.h"
#define randomize_buffers(buf, size) \
do { \
int j; \
for (j = 0; j < size; j+=4) \
AV_WN32(buf + j, rnd()); \
} while (0)
static const struct {uint8_t w, h, s;} planes[] = {
{16,16,16}, {21,23,25}, {32,17,48}, {15,128,16}, {128,127,128}
};
#define MAX_STRIDE 128
#define MAX_HEIGHT 127
static void check_diff_bytes(LLVidEncDSPContext *c)
{
int i;
LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE]);
LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE]);
LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE]);
LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE]);
LOCAL_ALIGNED_32(uint8_t, src2, [MAX_STRIDE]);
LOCAL_ALIGNED_32(uint8_t, src3, [MAX_STRIDE]);
declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src1,
const uint8_t *src2, intptr_t w);
memset(dst0, 0, MAX_STRIDE);
memset(dst1, 0, MAX_STRIDE);
randomize_buffers(src0, MAX_STRIDE);
memcpy(src1, src0, MAX_STRIDE);
randomize_buffers(src2, MAX_STRIDE);
memcpy(src3, src2, MAX_STRIDE);
if (check_func(c->diff_bytes, "diff_bytes")) {
for (i = 0; i < 5; i ++) {
call_ref(dst0, src0, src2, planes[i].w);
call_new(dst1, src1, src3, planes[i].w);
if (memcmp(dst0, dst1, planes[i].w))
fail();
}
bench_new(dst1, src0, src2, planes[4].w);
}
}
static void check_sub_left_pred(LLVidEncDSPContext *c)
{
int i;
LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE * MAX_HEIGHT]);
LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE * MAX_HEIGHT]);
LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE * MAX_HEIGHT]);
LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE * MAX_HEIGHT]);
declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, ptrdiff_t width, int height);
memset(dst0, 0, MAX_STRIDE * MAX_HEIGHT);
memset(dst1, 0, MAX_STRIDE * MAX_HEIGHT);
randomize_buffers(src0, MAX_STRIDE * MAX_HEIGHT);
memcpy(src1, src0, MAX_STRIDE * MAX_HEIGHT);
if (check_func(c->sub_left_predict, "sub_left_predict")) {
for (i = 0; i < 5; i ++) {
call_ref(dst0, src0, planes[i].s, planes[i].w, planes[i].h);
call_new(dst1, src1, planes[i].s, planes[i].w, planes[i].h);
if (memcmp(dst0, dst1, planes[i].w * planes[i].h))
fail();
break;
}
bench_new(dst1, src0, planes[4].s, planes[4].w, planes[4].h);
}
}
void checkasm_check_llviddspenc(void)
{
LLVidEncDSPContext c;
ff_llvidencdsp_init(&c);
check_diff_bytes(&c);
report("diff_bytes");
check_sub_left_pred(&c);
report("sub_left_predict");
}
...@@ -16,6 +16,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \ ...@@ -16,6 +16,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \
fate-checkasm-hevc_idct \ fate-checkasm-hevc_idct \
fate-checkasm-jpeg2000dsp \ fate-checkasm-jpeg2000dsp \
fate-checkasm-llviddsp \ fate-checkasm-llviddsp \
fate-checkasm-llviddspenc \
fate-checkasm-pixblockdsp \ fate-checkasm-pixblockdsp \
fate-checkasm-sbrdsp \ fate-checkasm-sbrdsp \
fate-checkasm-synth_filter \ fate-checkasm-synth_filter \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment