FFmpeg
hpeldsp.h
Go to the documentation of this file.
1 /*
2  * Half-pel DSP functions.
3  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * Half-pel DSP functions.
26  */
27 
28 #ifndef AVCODEC_HPELDSP_H
29 #define AVCODEC_HPELDSP_H
30 
31 #include <stdint.h>
32 #include <stddef.h>
33 
34 /* add and put pixel (decoding) */
35 // blocksizes for hpel_pixels_func are 8x4,8x8 16x8 16x16
36 // h for hpel_pixels_func is limited to {width/2, width} but never larger
37 // than 16 and never smaller than 4
38 typedef void (*op_pixels_func)(uint8_t *block /*align width (8 or 16)*/,
39  const uint8_t *pixels /*align 1*/,
40  ptrdiff_t line_size, int h);
41 
42 /**
43  * Half-pel DSP context.
44  */
45 typedef struct HpelDSPContext {
46  /**
47  * Halfpel motion compensation with rounding (a+b+1)>>1.
48  * this is an array[4][4] of motion compensation functions for 4
49  * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
50  * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
51  * @param block destination where the result is stored
52  * @param pixels source
53  * @param line_size number of bytes in a horizontal line of block
54  * @param h height
55  */
57 
58  /**
59  * Halfpel motion compensation with rounding (a+b+1)>>1.
60  * This is an array[4][4] of motion compensation functions for 4
61  * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
62  * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
63  * @param block destination into which the result is averaged (a+b+1)>>1
64  * @param pixels source
65  * @param line_size number of bytes in a horizontal line of block
66  * @param h height
67  */
69 
70  /**
71  * Halfpel motion compensation with no rounding (a+b)>>1.
72  * this is an array[4][4] of motion compensation functions for 2
73  * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
74  * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
75  * @param block destination where the result is stored
76  * @param pixels source
77  * @param line_size number of bytes in a horizontal line of block
78  * @param h height
79  * @note The size is kept at [4][4] to match the above pixel_tabs and avoid
80  * out of bounds reads in the motion estimation code.
81  */
83 
84  /**
85  * Halfpel motion compensation with no rounding (a+b)>>1.
86  * this is an array[4] of motion compensation functions for 1
87  * horizontal blocksize (16) and the 4 halfpel positions<br>
88  * *pixels_tab[0][ xhalfpel + 2*yhalfpel ]
89  * @param block destination into which the result is averaged (a+b)>>1
90  * @param pixels source
91  * @param line_size number of bytes in a horizontal line of block
92  * @param h height
93  */
96 
98 
106 
107 #endif /* AVCODEC_HPELDSP_H */
ff_hpeldsp_init_loongarch
void ff_hpeldsp_init_loongarch(HpelDSPContext *c, int flags)
Definition: hpeldsp_init_loongarch.c:26
HpelDSPContext::avg_no_rnd_pixels_tab
op_pixels_func avg_no_rnd_pixels_tab[4]
Halfpel motion compensation with no rounding (a+b)>>1.
Definition: hpeldsp.h:94
HpelDSPContext::put_no_rnd_pixels_tab
op_pixels_func put_no_rnd_pixels_tab[4][4]
Halfpel motion compensation with no rounding (a+b)>>1.
Definition: hpeldsp.h:82
HpelDSPContext::avg_pixels_tab
op_pixels_func avg_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
Definition: hpeldsp.h:68
ff_hpeldsp_init_aarch64
void ff_hpeldsp_init_aarch64(HpelDSPContext *c, int flags)
Definition: hpeldsp_init_aarch64.c:86
ff_hpeldsp_init
void ff_hpeldsp_init(HpelDSPContext *c, int flags)
Definition: hpeldsp.c:338
op_pixels_func
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
Definition: hpeldsp.h:38
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
HpelDSPContext
Half-pel DSP context.
Definition: hpeldsp.h:45
ff_hpeldsp_init_x86
void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags)
Definition: hpeldsp_init.c:229
HpelDSPContext::put_pixels_tab
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
Definition: hpeldsp.h:56
ff_hpeldsp_init_alpha
void ff_hpeldsp_init_alpha(HpelDSPContext *c, int flags)
ff_hpeldsp_init_arm
void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags)
Definition: hpeldsp_init_arm.c:45
ff_hpeldsp_init_ppc
void ff_hpeldsp_init_ppc(HpelDSPContext *c, int flags)
Definition: hpeldsp_altivec.c:368
ff_hpeldsp_init_mips
void ff_hpeldsp_init_mips(HpelDSPContext *c, int flags)
Definition: hpeldsp_init_mips.c:26
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
h
h
Definition: vp9dsp_template.c:2070