FFmpeg  4.3
colorspacedsp.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "colorspacedsp.h"
22 
23 /*
24  * SS_W/H stands for "subsampling_w/h"
25  * it's analogous to AVPixFmtDescriptor->log2_chroma_w/h.
26  */
27 #define SS_W 0
28 #define SS_H 0
29 
30 #define BIT_DEPTH 8
31 #include "colorspacedsp_template.c"
32 
33 #undef BIT_DEPTH
34 #define BIT_DEPTH 10
35 #include "colorspacedsp_template.c"
36 
37 #undef BIT_DEPTH
38 #define BIT_DEPTH 12
39 #include "colorspacedsp_template.c"
40 
41 #undef SS_W
42 #undef SS_H
43 
44 #define SS_W 1
45 #define SS_H 0
46 
47 #undef BIT_DEPTH
48 #define BIT_DEPTH 8
49 #include "colorspacedsp_template.c"
50 
51 #undef BIT_DEPTH
52 #define BIT_DEPTH 10
53 #include "colorspacedsp_template.c"
54 
55 #undef BIT_DEPTH
56 #define BIT_DEPTH 12
57 #include "colorspacedsp_template.c"
58 
59 #undef SS_W
60 #undef SS_H
61 
62 #define SS_W 1
63 #define SS_H 1
64 
65 #undef BIT_DEPTH
66 #define BIT_DEPTH 8
67 #include "colorspacedsp_template.c"
68 
69 #undef BIT_DEPTH
70 #define BIT_DEPTH 10
71 #include "colorspacedsp_template.c"
72 
73 #undef BIT_DEPTH
74 #define BIT_DEPTH 12
75 #include "colorspacedsp_template.c"
76 
77 static void multiply3x3_c(int16_t *buf[3], ptrdiff_t stride,
78  int w, int h, const int16_t m[3][3][8])
79 {
80  int y, x;
81  int16_t *buf0 = buf[0], *buf1 = buf[1], *buf2 = buf[2];
82 
83  for (y = 0; y < h; y++) {
84  for (x = 0; x < w; x++) {
85  int v0 = buf0[x], v1 = buf1[x], v2 = buf2[x];
86 
87  buf0[x] = av_clip_int16((m[0][0][0] * v0 + m[0][1][0] * v1 +
88  m[0][2][0] * v2 + 8192) >> 14);
89  buf1[x] = av_clip_int16((m[1][0][0] * v0 + m[1][1][0] * v1 +
90  m[1][2][0] * v2 + 8192) >> 14);
91  buf2[x] = av_clip_int16((m[2][0][0] * v0 + m[2][1][0] * v1 +
92  m[2][2][0] * v2 + 8192) >> 14);
93  }
94 
95  buf0 += stride;
96  buf1 += stride;
97  buf2 += stride;
98  }
99 }
100 
102 {
103 #define init_yuv2rgb_fn(bit) \
104  dsp->yuv2rgb[BPP_##bit][SS_444] = yuv2rgb_444p##bit##_c; \
105  dsp->yuv2rgb[BPP_##bit][SS_422] = yuv2rgb_422p##bit##_c; \
106  dsp->yuv2rgb[BPP_##bit][SS_420] = yuv2rgb_420p##bit##_c
107 
108  init_yuv2rgb_fn( 8);
109  init_yuv2rgb_fn(10);
110  init_yuv2rgb_fn(12);
111 
112 #define init_rgb2yuv_fn(bit) \
113  dsp->rgb2yuv[BPP_##bit][SS_444] = rgb2yuv_444p##bit##_c; \
114  dsp->rgb2yuv[BPP_##bit][SS_422] = rgb2yuv_422p##bit##_c; \
115  dsp->rgb2yuv[BPP_##bit][SS_420] = rgb2yuv_420p##bit##_c
116 
117  init_rgb2yuv_fn( 8);
118  init_rgb2yuv_fn(10);
119  init_rgb2yuv_fn(12);
120 
121 #define init_rgb2yuv_fsb_fn(bit) \
122  dsp->rgb2yuv_fsb[BPP_##bit][SS_444] = rgb2yuv_fsb_444p##bit##_c; \
123  dsp->rgb2yuv_fsb[BPP_##bit][SS_422] = rgb2yuv_fsb_422p##bit##_c; \
124  dsp->rgb2yuv_fsb[BPP_##bit][SS_420] = rgb2yuv_fsb_420p##bit##_c
125 
129 
130 #define init_yuv2yuv_fn(idx1, bit1, bit2) \
131  dsp->yuv2yuv[idx1][BPP_##bit2][SS_444] = yuv2yuv_444p##bit1##to##bit2##_c; \
132  dsp->yuv2yuv[idx1][BPP_##bit2][SS_422] = yuv2yuv_422p##bit1##to##bit2##_c; \
133  dsp->yuv2yuv[idx1][BPP_##bit2][SS_420] = yuv2yuv_420p##bit1##to##bit2##_c
134 #define init_yuv2yuv_fns(bit1) \
135  init_yuv2yuv_fn(BPP_##bit1, bit1, 8); \
136  init_yuv2yuv_fn(BPP_##bit1, bit1, 10); \
137  init_yuv2yuv_fn(BPP_##bit1, bit1, 12)
138 
139  init_yuv2yuv_fns( 8);
140  init_yuv2yuv_fns(10);
141  init_yuv2yuv_fns(12);
142 
143  dsp->multiply3x3 = multiply3x3_c;
144 
145  if (ARCH_X86)
147 }
stride
int stride
Definition: mace.c:144
ARCH_X86
#define ARCH_X86
Definition: config.h:38
multiply3x3_c
static void multiply3x3_c(int16_t *buf[3], ptrdiff_t stride, int w, int h, const int16_t m[3][3][8])
Definition: colorspacedsp.c:77
v0
#define v0
Definition: regdef.h:26
ff_colorspacedsp_x86_init
void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
Definition: colorspacedsp_init.c:79
x
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 x
Definition: fate.txt:150
ColorSpaceDSPContext
Definition: colorspacedsp.h:59
init_rgb2yuv_fn
#define init_rgb2yuv_fn(bit)
init_rgb2yuv_fsb_fn
#define init_rgb2yuv_fsb_fn(bit)
ColorSpaceDSPContext::multiply3x3
void(* multiply3x3)(int16_t *data[3], ptrdiff_t stride, int w, int h, const int16_t m[3][3][8])
Definition: colorspacedsp.h:74
init_yuv2yuv_fns
#define init_yuv2yuv_fns(bit1)
init_yuv2rgb_fn
#define init_yuv2rgb_fn(bit)
colorspacedsp_template.c
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
colorspacedsp.h
h
h
Definition: vp9dsp_template.c:2038
ff_colorspacedsp_init
void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
Definition: colorspacedsp.c:101