1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * Copyright (C) 2012 Ronald S. Bultje
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * This file is part of FFmpeg.
5cabdff1aSopenharmony_ci *
6cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
7cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
8cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
9cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
10cabdff1aSopenharmony_ci *
11cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
12cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
13cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14cabdff1aSopenharmony_ci * Lesser General Public License for more details.
15cabdff1aSopenharmony_ci *
16cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
17cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
18cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19cabdff1aSopenharmony_ci */
20cabdff1aSopenharmony_ci
21cabdff1aSopenharmony_ci/**
22cabdff1aSopenharmony_ci * @file
23cabdff1aSopenharmony_ci * Core video DSP helper functions
24cabdff1aSopenharmony_ci */
25cabdff1aSopenharmony_ci
26cabdff1aSopenharmony_ci#ifndef AVCODEC_VIDEODSP_H
27cabdff1aSopenharmony_ci#define AVCODEC_VIDEODSP_H
28cabdff1aSopenharmony_ci
29cabdff1aSopenharmony_ci#include <stddef.h>
30cabdff1aSopenharmony_ci#include <stdint.h>
31cabdff1aSopenharmony_ci
32cabdff1aSopenharmony_ci#define EMULATED_EDGE(depth) \
33cabdff1aSopenharmony_civoid ff_emulated_edge_mc_ ## depth(uint8_t *dst, const uint8_t *src, \
34cabdff1aSopenharmony_ci                                   ptrdiff_t dst_stride, ptrdiff_t src_stride, \
35cabdff1aSopenharmony_ci                                   int block_w, int block_h,\
36cabdff1aSopenharmony_ci                                   int src_x, int src_y, int w, int h);
37cabdff1aSopenharmony_ci
38cabdff1aSopenharmony_ciEMULATED_EDGE(8)
39cabdff1aSopenharmony_ci
40cabdff1aSopenharmony_citypedef struct VideoDSPContext {
41cabdff1aSopenharmony_ci    /**
42cabdff1aSopenharmony_ci     * Copy a rectangular area of samples to a temporary buffer and replicate
43cabdff1aSopenharmony_ci     * the border samples.
44cabdff1aSopenharmony_ci     *
45cabdff1aSopenharmony_ci     * @param dst destination buffer
46cabdff1aSopenharmony_ci     * @param dst_stride number of bytes between 2 vertically adjacent samples
47cabdff1aSopenharmony_ci     *                   in destination buffer
48cabdff1aSopenharmony_ci     * @param src source buffer
49cabdff1aSopenharmony_ci     * @param dst_linesize number of bytes between 2 vertically adjacent
50cabdff1aSopenharmony_ci     *                     samples in the destination buffer
51cabdff1aSopenharmony_ci     * @param src_linesize number of bytes between 2 vertically adjacent
52cabdff1aSopenharmony_ci     *                     samples in both the source buffer
53cabdff1aSopenharmony_ci     * @param block_w width of block
54cabdff1aSopenharmony_ci     * @param block_h height of block
55cabdff1aSopenharmony_ci     * @param src_x x coordinate of the top left sample of the block in the
56cabdff1aSopenharmony_ci     *                source buffer
57cabdff1aSopenharmony_ci     * @param src_y y coordinate of the top left sample of the block in the
58cabdff1aSopenharmony_ci     *                source buffer
59cabdff1aSopenharmony_ci     * @param w width of the source buffer
60cabdff1aSopenharmony_ci     * @param h height of the source buffer
61cabdff1aSopenharmony_ci     */
62cabdff1aSopenharmony_ci    void (*emulated_edge_mc)(uint8_t *dst, const uint8_t *src,
63cabdff1aSopenharmony_ci                             ptrdiff_t dst_linesize,
64cabdff1aSopenharmony_ci                             ptrdiff_t src_linesize,
65cabdff1aSopenharmony_ci                             int block_w, int block_h,
66cabdff1aSopenharmony_ci                             int src_x, int src_y, int w, int h);
67cabdff1aSopenharmony_ci
68cabdff1aSopenharmony_ci    /**
69cabdff1aSopenharmony_ci     * Prefetch memory into cache (if supported by hardware).
70cabdff1aSopenharmony_ci     *
71cabdff1aSopenharmony_ci     * @param buf    pointer to buffer to prefetch memory from
72cabdff1aSopenharmony_ci     * @param stride distance between two lines of buf (in bytes)
73cabdff1aSopenharmony_ci     * @param h      number of lines to prefetch
74cabdff1aSopenharmony_ci     */
75cabdff1aSopenharmony_ci    void (*prefetch)(uint8_t *buf, ptrdiff_t stride, int h);
76cabdff1aSopenharmony_ci} VideoDSPContext;
77cabdff1aSopenharmony_ci
78cabdff1aSopenharmony_civoid ff_videodsp_init(VideoDSPContext *ctx, int bpc);
79cabdff1aSopenharmony_ci
80cabdff1aSopenharmony_ci/* for internal use only (i.e. called by ff_videodsp_init() */
81cabdff1aSopenharmony_civoid ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc);
82cabdff1aSopenharmony_civoid ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc);
83cabdff1aSopenharmony_civoid ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc);
84cabdff1aSopenharmony_civoid ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc);
85cabdff1aSopenharmony_civoid ff_videodsp_init_mips(VideoDSPContext *ctx, int bpc);
86cabdff1aSopenharmony_civoid ff_videodsp_init_loongarch(VideoDSPContext *ctx, int bpc);
87cabdff1aSopenharmony_ci
88cabdff1aSopenharmony_ci#endif /* AVCODEC_VIDEODSP_H */
89