FFmpeg
blockdsp.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 #include <string.h>
21 
22 #include "config.h"
23 #include "libavutil/attributes.h"
24 #include "avcodec.h"
25 #include "blockdsp.h"
26 
27 static void clear_block_c(int16_t *block)
28 {
29  memset(block, 0, sizeof(int16_t) * 64);
30 }
31 
32 static void clear_blocks_c(int16_t *blocks)
33 {
34  memset(blocks, 0, sizeof(int16_t) * 6 * 64);
35 }
36 
37 static void fill_block16_c(uint8_t *block, uint8_t value, ptrdiff_t line_size,
38  int h)
39 {
40  int i;
41 
42  for (i = 0; i < h; i++) {
43  memset(block, value, 16);
44  block += line_size;
45  }
46 }
47 
48 static void fill_block8_c(uint8_t *block, uint8_t value, ptrdiff_t line_size,
49  int h)
50 {
51  int i;
52 
53  for (i = 0; i < h; i++) {
54  memset(block, value, 8);
55  block += line_size;
56  }
57 }
58 
60 {
61  c->clear_block = clear_block_c;
62  c->clear_blocks = clear_blocks_c;
63 
64  c->fill_block_tab[0] = fill_block16_c;
65  c->fill_block_tab[1] = fill_block8_c;
66 
67  if (ARCH_ALPHA)
69  if (ARCH_ARM)
71  if (ARCH_PPC)
73  if (ARCH_X86)
74  ff_blockdsp_init_x86(c, avctx);
75  if (ARCH_MIPS)
77 }
blockdsp.h
ff_blockdsp_init_mips
void ff_blockdsp_init_mips(BlockDSPContext *c)
Definition: blockdsp_init_mips.c:25
BlockDSPContext
Definition: blockdsp.h:34
av_cold
#define av_cold
Definition: attributes.h:90
ff_blockdsp_init_arm
av_cold void ff_blockdsp_init_arm(BlockDSPContext *c)
Definition: blockdsp_init_arm.c:27
clear_blocks_c
static void clear_blocks_c(int16_t *blocks)
Definition: blockdsp.c:32
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
ff_blockdsp_init_alpha
av_cold void ff_blockdsp_init_alpha(BlockDSPContext *c)
Definition: blockdsp_alpha.c:46
attributes.h
i
int i
Definition: input.c:406
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
avcodec.h
fill_block16_c
static void fill_block16_c(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h)
Definition: blockdsp.c:37
AVCodecContext
main external API structure.
Definition: avcodec.h:379
ff_blockdsp_init_x86
void ff_blockdsp_init_x86(BlockDSPContext *c, AVCodecContext *avctx)
Definition: blockdsp_init.c:36
ff_blockdsp_init_ppc
av_cold void ff_blockdsp_init_ppc(BlockDSPContext *c)
Definition: blockdsp.c:145
clear_block_c
static void clear_block_c(int16_t *block)
Definition: blockdsp.c:27
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:2038
ff_blockdsp_init
av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
Definition: blockdsp.c:59
fill_block8_c
static void fill_block8_c(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h)
Definition: blockdsp.c:48