FFmpeg  4.3
h263dsp.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
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <stdint.h>
20 
21 #include "libavutil/attributes.h"
22 #include "libavutil/common.h"
23 #include "config.h"
24 #include "h263dsp.h"
25 
27  0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7,
28  7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12
29 };
30 
31 static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale)
32 {
33  int y;
34  const int strength = ff_h263_loop_filter_strength[qscale];
35 
36  for (y = 0; y < 8; y++) {
37  int d1, d2, ad1;
38  int p0 = src[y * stride - 2];
39  int p1 = src[y * stride - 1];
40  int p2 = src[y * stride + 0];
41  int p3 = src[y * stride + 1];
42  int d = (p0 - p3 + 4 * (p2 - p1)) / 8;
43 
44  if (d < -2 * strength)
45  d1 = 0;
46  else if (d < -strength)
47  d1 = -2 * strength - d;
48  else if (d < strength)
49  d1 = d;
50  else if (d < 2 * strength)
51  d1 = 2 * strength - d;
52  else
53  d1 = 0;
54 
55  p1 += d1;
56  p2 -= d1;
57  if (p1 & 256)
58  p1 = ~(p1 >> 31);
59  if (p2 & 256)
60  p2 = ~(p2 >> 31);
61 
62  src[y * stride - 1] = p1;
63  src[y * stride + 0] = p2;
64 
65  ad1 = FFABS(d1) >> 1;
66 
67  d2 = av_clip((p0 - p3) / 4, -ad1, ad1);
68 
69  src[y * stride - 2] = p0 - d2;
70  src[y * stride + 1] = p3 + d2;
71  }
72 }
73 
74 static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale)
75 {
76  int x;
77  const int strength = ff_h263_loop_filter_strength[qscale];
78 
79  for (x = 0; x < 8; x++) {
80  int d1, d2, ad1;
81  int p0 = src[x - 2 * stride];
82  int p1 = src[x - 1 * stride];
83  int p2 = src[x + 0 * stride];
84  int p3 = src[x + 1 * stride];
85  int d = (p0 - p3 + 4 * (p2 - p1)) / 8;
86 
87  if (d < -2 * strength)
88  d1 = 0;
89  else if (d < -strength)
90  d1 = -2 * strength - d;
91  else if (d < strength)
92  d1 = d;
93  else if (d < 2 * strength)
94  d1 = 2 * strength - d;
95  else
96  d1 = 0;
97 
98  p1 += d1;
99  p2 -= d1;
100  if (p1 & 256)
101  p1 = ~(p1 >> 31);
102  if (p2 & 256)
103  p2 = ~(p2 >> 31);
104 
105  src[x - 1 * stride] = p1;
106  src[x + 0 * stride] = p2;
107 
108  ad1 = FFABS(d1) >> 1;
109 
110  d2 = av_clip((p0 - p3) / 4, -ad1, ad1);
111 
112  src[x - 2 * stride] = p0 - d2;
113  src[x + stride] = p3 + d2;
114  }
115 }
116 
118 {
119  ctx->h263_h_loop_filter = h263_h_loop_filter_c;
120  ctx->h263_v_loop_filter = h263_v_loop_filter_c;
121 
122  if (ARCH_X86)
124  if (ARCH_MIPS)
126 }
stride
int stride
Definition: mace.c:144
ARCH_X86
#define ARCH_X86
Definition: config.h:38
h263dsp.h
h263_v_loop_filter_c
static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:74
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
ff_h263dsp_init
av_cold void ff_h263dsp_init(H263DSPContext *ctx)
Definition: h263dsp.c:117
h263_h_loop_filter_c
static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:31
H263DSPContext
Definition: h263dsp.h:26
av_cold
#define av_cold
Definition: attributes.h:90
ff_h263dsp_init_x86
void ff_h263dsp_init_x86(H263DSPContext *ctx)
Definition: h263dsp_init.c:31
ARCH_MIPS
#define ARCH_MIPS
Definition: config.h:26
ctx
AVFormatContext * ctx
Definition: movenc.c:48
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
src
#define src
Definition: vp8dsp.c:254
attributes.h
common.h
uint8_t
uint8_t
Definition: audio_convert.c:194
ff_h263_loop_filter_strength
const uint8_t ff_h263_loop_filter_strength[32]
Definition: h263dsp.c:26
config.h
ff_h263dsp_init_mips
void ff_h263dsp_init_mips(H263DSPContext *ctx)
Definition: h263dsp_init_mips.c:31