2 * Copyright (C) 2012 Ronald S. Bultje
4 * This file is part of FFmpeg.
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.
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.
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
23 * Core video DSP helper functions
26 #ifndef AVCODEC_VIDEODSP_H
27 #define AVCODEC_VIDEODSP_H
32 #define EMULATED_EDGE(depth) \
33 void ff_emulated_edge_mc_ ## depth(uint8_t *dst, const uint8_t *src, \
34 ptrdiff_t dst_stride, ptrdiff_t src_stride, \
35 int block_w, int block_h,\
36 int src_x, int src_y, int w, int h);
40 typedef struct VideoDSPContext
{
42 * Copy a rectangular area of samples to a temporary buffer and replicate
45 * @param dst destination buffer
46 * @param dst_stride number of bytes between 2 vertically adjacent samples
47 * in destination buffer
48 * @param src source buffer
49 * @param dst_linesize number of bytes between 2 vertically adjacent
50 * samples in the destination buffer
51 * @param src_linesize number of bytes between 2 vertically adjacent
52 * samples in both the source buffer
53 * @param block_w width of block
54 * @param block_h height of block
55 * @param src_x x coordinate of the top left sample of the block in the
57 * @param src_y y coordinate of the top left sample of the block in the
59 * @param w width of the source buffer
60 * @param h height of the source buffer
62 void (*emulated_edge_mc
)(uint8_t *dst
, const uint8_t *src
,
63 ptrdiff_t dst_linesize
,
64 ptrdiff_t src_linesize
,
65 int block_w
, int block_h
,
66 int src_x
, int src_y
, int w
, int h
);
69 * Prefetch memory into cache (if supported by hardware).
71 * @param buf pointer to buffer to prefetch memory from
72 * @param stride distance between two lines of buf (in bytes)
73 * @param h number of lines to prefetch
75 void (*prefetch
)(const uint8_t *buf
, ptrdiff_t stride
, int h
);
78 void ff_videodsp_init(VideoDSPContext
*ctx
, int bpc
);
80 /* for internal use only (i.e. called by ff_videodsp_init() */
81 void ff_videodsp_init_aarch64(VideoDSPContext
*ctx
, int bpc
);
82 void ff_videodsp_init_arm(VideoDSPContext
*ctx
, int bpc
);
83 void ff_videodsp_init_ppc(VideoDSPContext
*ctx
, int bpc
);
84 void ff_videodsp_init_x86(VideoDSPContext
*ctx
, int bpc
);
85 void ff_videodsp_init_mips(VideoDSPContext
*ctx
, int bpc
);
86 void ff_videodsp_init_loongarch(VideoDSPContext
*ctx
, int bpc
);
88 #endif /* AVCODEC_VIDEODSP_H */