FFmpeg  4.3
huffyuvdsp.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Alexandra Hájková
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #include <string.h>
22 
23 #include "libavutil/common.h"
24 #include "libavutil/intreadwrite.h"
25 #include "libavutil/mem.h"
26 
27 #include "libavcodec/huffyuvdsp.h"
28 
29 #include "checkasm.h"
30 
31 #define randomize_buffers(buf, size) \
32  do { \
33  int j; \
34  for (j = 0; j < size; j++) \
35  buf[j] = rnd() & 0xFFFF; \
36  } while (0)
37 
38 static void check_add_int16(HuffYUVDSPContext c, unsigned mask, int width, const char * name)
39 {
40  uint16_t *src0 = av_mallocz(width * sizeof(uint16_t));
41  uint16_t *src1 = av_mallocz(width * sizeof(uint16_t));
42  uint16_t *dst0 = av_mallocz(width * sizeof(uint16_t));
43  uint16_t *dst1 = av_mallocz(width * sizeof(uint16_t));
44 
45  declare_func_emms(AV_CPU_FLAG_MMX, void, uint16_t *dst, uint16_t *src, unsigned mask, int w);
46 
47  if (!src0 || !src1 || !dst0 || !dst1)
48  fail();
49 
51  memcpy(src1, src0, width * sizeof(uint16_t));
52 
53  if (check_func(c.add_int16, "%s", name)) {
54  call_ref(dst0, src0, mask, width);
55  call_new(dst1, src1, mask, width);
56  if (memcmp(dst0, dst1, width * sizeof(uint16_t)))
57  fail();
58  bench_new(dst1, src1, mask, width);
59  }
60 
61  av_free(src0);
62  av_free(src1);
63  av_free(dst0);
64  av_free(dst1);
65 }
66 
68 {
70  int width = 16 * av_clip(rnd(), 16, 128);
71 
73 
74  /*! test width not multiple of mmsize */
75  check_add_int16(c, 65535, width, "add_int16_rnd_width");
76  report("add_int16_rnd_width");
77 
78  /*! test always with the same size (for perf test) */
79  check_add_int16(c, 65535, 16*128, "add_int16_128");
80  report("add_int16_128");
81 }
HuffYUVDSPContext
Definition: huffyuvdsp.h:38
declare_func_emms
#define declare_func_emms(cpu_flags, ret,...)
Definition: checkasm.h:120
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
huffyuvdsp.h
check_func
#define check_func(func,...)
Definition: checkasm.h:114
call_ref
#define call_ref(...)
Definition: checkasm.h:129
fail
#define fail()
Definition: checkasm.h:123
checkasm.h
checkasm_check_huffyuvdsp
void checkasm_check_huffyuvdsp(void)
Definition: huffyuvdsp.c:67
rnd
#define rnd()
Definition: checkasm.h:107
mask
static const uint16_t mask[17]
Definition: lzw.c:38
width
#define width
intreadwrite.h
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:239
call_new
#define call_new(...)
Definition: checkasm.h:201
check_add_int16
static void check_add_int16(HuffYUVDSPContext c, unsigned mask, int width, const char *name)
Definition: huffyuvdsp.c:38
src
#define src
Definition: vp8dsp.c:254
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
ff_huffyuvdsp_init
av_cold void ff_huffyuvdsp_init(HuffYUVDSPContext *c, enum AVPixelFormat pix_fmt)
Definition: huffyuvdsp.c:83
randomize_buffers
#define randomize_buffers(buf, size)
Definition: huffyuvdsp.c:31
src0
#define src0
Definition: h264pred.c:138
src1
#define src1
Definition: h264pred.c:139
report
#define report
Definition: checkasm.h:126
bench_new
#define bench_new(...)
Definition: checkasm.h:261
common.h
w
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
Definition: fate.txt:150
AV_CPU_FLAG_MMX
#define AV_CPU_FLAG_MMX
standard MMX
Definition: cpu.h:31
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
mem.h
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34