FFmpeg  4.3
vf_eq.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #include <string.h>
20 #include "checkasm.h"
21 #include "libavfilter/avfilter.h"
22 #include "libavfilter/vf_eq.h"
23 #include "libavutil/intreadwrite.h"
24 
25 #define WIDTH 256
26 #define HEIGHT 256
27 #define SRC_STRIDE 256
28 #define PIXELS (WIDTH * HEIGHT)
29 #define RANDOM_RANGE 80000
30 #define SCALE 10000
31 
32 #define randomize_buffers(buf, size) \
33  do { \
34  int j; \
35  uint8_t *tmp_buf = (uint8_t *)buf;\
36  for (j = 0; j< size; j++) \
37  tmp_buf[j] = rnd() & 0xFF; \
38  } while (0)
39 
40 static void check_eq(void)
41 {
43  LOCAL_ALIGNED_32(uint8_t, dst_ref, [PIXELS]);
44  LOCAL_ALIGNED_32(uint8_t, dst_new, [PIXELS]);
45  int w = WIDTH;
46  int h = HEIGHT;
47  int src_stride = SRC_STRIDE;
48  int dst_stride = SRC_STRIDE;
49  EQParameters pa;
50  EQContext eq;
51  declare_func(void, EQParameters *param, uint8_t *dst, int dst_stride,
52  const uint8_t *src, int src_stride, int w, int h);
53 
54  double rand_contrast = (int)(rnd() % (RANDOM_RANGE * 2) - RANDOM_RANGE) /
55  (SCALE * 1.0);
56  double rand_brightness = (int)(rnd() % (SCALE * 2) - SCALE) /
57  (SCALE * 1.0);
58  pa.contrast = rand_contrast;
59  pa.brightness = rand_brightness;
60 
61  memset(dst_ref, 0, PIXELS);
62  memset(dst_new, 0, PIXELS);
64  ff_eq_init(&eq);
65 
66  if (check_func(eq.process, "process")) {
67  call_ref(&pa, dst_ref, dst_stride, src, src_stride, w, h);
68  call_new(&pa, dst_new, dst_stride, src, src_stride, w, h);
69  if (memcmp(dst_ref, dst_new, PIXELS))
70  fail();
71  bench_new(&pa, dst_new, dst_stride, src, src_stride, w, h);
72  }
73 }
74 
76 {
77  check_eq();
78  report("eq");
79 }
randomize_buffers
#define randomize_buffers(buf, size)
Definition: vf_eq.c:32
check_func
#define check_func(func,...)
Definition: checkasm.h:114
call_ref
#define call_ref(...)
Definition: checkasm.h:129
SRC_STRIDE
#define SRC_STRIDE
Definition: vf_eq.c:27
fail
#define fail()
Definition: checkasm.h:123
PIXELS
#define PIXELS
Definition: vf_eq.c:28
checkasm.h
checkasm_check_vf_eq
void checkasm_check_vf_eq(void)
Definition: vf_eq.c:75
SCALE
#define SCALE
Definition: vf_eq.c:30
eq
#define eq(A, B)
Definition: vf_xbr.c:91
rnd
#define rnd()
Definition: checkasm.h:107
intreadwrite.h
EQParameters
Definition: vf_eq.h:47
vf_eq.h
RANDOM_RANGE
#define RANDOM_RANGE
Definition: vf_eq.c:29
WIDTH
#define WIDTH
Definition: vf_eq.c:25
check_eq
static void check_eq(void)
Definition: vf_eq.c:40
call_new
#define call_new(...)
Definition: checkasm.h:201
src
#define src
Definition: vp8dsp.c:254
EQContext
Definition: vf_eq.h:58
ff_eq_init
void ff_eq_init(EQContext *eq)
Definition: vf_eq.c:177
EQParameters::contrast
double contrast
Definition: vf_eq.h:53
report
#define report
Definition: checkasm.h:126
bench_new
#define bench_new(...)
Definition: checkasm.h:261
uint8_t
uint8_t
Definition: audio_convert.c:194
EQParameters::brightness
double brightness
Definition: vf_eq.h:53
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
HEIGHT
#define HEIGHT
Definition: vf_eq.c:26
avfilter.h
declare_func
#define declare_func(ret,...)
Definition: checkasm.h:118
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition: internal.h:137
h
h
Definition: vp9dsp_template.c:2038
int
int
Definition: ffmpeg_filter.c:192