]> git.sesse.net Git - ffmpeg/blob - libavcodec/videodsp.h
Merge commit 'd4c2a3740fb95f952a87ba320d2bf31f126bdf68'
[ffmpeg] / libavcodec / videodsp.h
1 /*
2  * Copyright (C) 2012 Ronald S. Bultje
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 /**
22  * @file
23  * Core video DSP helper functions
24  */
25
26 #ifndef AVCODEC_VIDEODSP_H
27 #define AVCODEC_VIDEODSP_H
28
29 #include <stddef.h>
30 #include <stdint.h>
31
32 typedef int emuedge_linesize_type;
33
34 #define EMULATED_EDGE(depth) \
35 void ff_emulated_edge_mc_ ## depth (uint8_t *buf, const uint8_t *src, ptrdiff_t linesize,\
36                          int block_w, int block_h,\
37                          int src_x, int src_y, int w, int h);
38
39 EMULATED_EDGE(8)
40 EMULATED_EDGE(16)
41
42 typedef struct VideoDSPContext {
43     /**
44      * Copy a rectangular area of samples to a temporary buffer and replicate
45      * the border samples.
46      *
47      * @param buf destination buffer
48      * @param src source buffer
49      * @param linesize number of bytes between 2 vertically adjacent samples
50      *                 in both the source and destination buffers
51      * @param block_w width of block
52      * @param block_h height of block
53      * @param src_x x coordinate of the top left sample of the block in the
54      *                source buffer
55      * @param src_y y coordinate of the top left sample of the block in the
56      *                source buffer
57      * @param w width of the source buffer
58      * @param h height of the source buffer
59      */
60     void (*emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
61                              ptrdiff_t linesize, int block_w, int block_h,
62                              int src_x, int src_y, int w, int h);
63
64     /**
65      * Prefetch memory into cache (if supported by hardware).
66      *
67      * @buf pointer to buffer to prefetch memory from
68      * @stride distance between two lines of buf (in bytes)
69      * @h number of lines to prefetch
70      */
71     void (*prefetch)(uint8_t *buf, ptrdiff_t stride, int h);
72 } VideoDSPContext;
73
74 void ff_videodsp_init(VideoDSPContext *ctx, int bpc);
75
76 /* for internal use only (i.e. called by ff_videodsp_init() */
77 void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc);
78 void ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc);
79 void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc);
80
81 #endif /* AVCODEC_VIDEODSP_H */