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 /**
35  * Average and put pixel
36  * Widths can be 16, 8, 4 or 2. For for widths 2 and 4, h is always a positive
37  * multiple of 2; otherwise, it is a positive multiple of 4.
38  */
39 typedef void (*op_pixels_func)(uint8_t *block /* align width */,
40  const uint8_t *pixels /*align 1*/,
41  ptrdiff_t line_size, int h);
42 
43 /**
44  * Half-pel DSP context.
45  */
46 typedef struct HpelDSPContext {
47  /**
48  * Halfpel motion compensation with rounding (a+b+1)>>1.
49  * this is an array[4][4] of motion compensation functions for 4
50  * horizontal blocksizes (2,4,8,16) and the 4 halfpel positions<br>
51  * *pixels_tab[ 0->16xH 1->8xH 2->4xH 3->2xH ][ xhalfpel + 2*yhalfpel ]
52  * @param block destination where the result is stored
53  * @param pixels source
54  * @param line_size number of bytes in a horizontal line of block
55  * @param h height
56  */
58 
59  /**
60  * Halfpel motion compensation with rounding (a+b+1)>>1.
61  * This is an array[4][4] of motion compensation functions for 4
62  * horizontal blocksizes (2,4,8,16) and the 4 halfpel positions<br>
63  * *pixels_tab[ 0->16xH 1->8xH 2->4xH 3->2xH ][ xhalfpel + 2*yhalfpel ]
64  * @param block destination into which the result is averaged (a+b+1)>>1
65  * @param pixels source
66  * @param line_size number of bytes in a horizontal line of block
67  * @param h height
68  */
70 
71  /**
72  * Halfpel motion compensation with no rounding (a+b)>>1.
73  * this is an array[4][4] of motion compensation functions for 2
74  * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
75  * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
76  * @param block destination where the result is stored
77  * @param pixels source
78  * @param line_size number of bytes in a horizontal line of block
79  * @param h height
80  * @note The size is kept at [3][4] to avoid out of bounds accesses
81  * in the motion estimation code.
82  */
84 
85  /**
86  * Halfpel motion compensation with no rounding (a+b)>>1.
87  * this is an array[4] of motion compensation functions for 1
88  * horizontal blocksize (16) and the 4 halfpel positions<br>
89  * *pixels_tab[ xhalfpel + 2*yhalfpel ]
90  * @param block destination into which the result is averaged (a+b)>>1
91  * @param pixels source
92  * @param line_size number of bytes in a horizontal line of block
93  * @param h height
94  */
97 
99 
106 
107 #endif /* AVCODEC_HPELDSP_H */
flags
const SwsFlags flags[]
Definition: swscale.c:61
ff_hpeldsp_init_loongarch
void ff_hpeldsp_init_loongarch(HpelDSPContext *c, int flags)
Definition: hpeldsp_init_loongarch.c:26
HpelDSPContext::put_no_rnd_pixels_tab
op_pixels_func put_no_rnd_pixels_tab[3][4]
Halfpel motion compensation with no rounding (a+b)>>1.
Definition: hpeldsp.h:83
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:95
HpelDSPContext::avg_pixels_tab
op_pixels_func avg_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
Definition: hpeldsp.h:69
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:337
op_pixels_func
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
Average and put pixel Widths can be 16, 8, 4 or 2.
Definition: hpeldsp.h:39
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:46
ff_hpeldsp_init_x86
void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags)
Definition: hpeldsp_init.c:294
HpelDSPContext::put_pixels_tab
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
Definition: hpeldsp.h:57
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
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