1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * This file is part of FFmpeg.
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
8cabdff1aSopenharmony_ci *
9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12cabdff1aSopenharmony_ci * Lesser General Public License for more details.
13cabdff1aSopenharmony_ci *
14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17cabdff1aSopenharmony_ci */
18cabdff1aSopenharmony_ci
19cabdff1aSopenharmony_ci#ifndef AVCODEC_ME_CMP_H
20cabdff1aSopenharmony_ci#define AVCODEC_ME_CMP_H
21cabdff1aSopenharmony_ci
22cabdff1aSopenharmony_ci#include <stdint.h>
23cabdff1aSopenharmony_ci
24cabdff1aSopenharmony_ci#include "avcodec.h"
25cabdff1aSopenharmony_ci
26cabdff1aSopenharmony_ciextern const uint32_t ff_square_tab[512];
27cabdff1aSopenharmony_ci
28cabdff1aSopenharmony_ci
29cabdff1aSopenharmony_ci/* minimum alignment rules ;)
30cabdff1aSopenharmony_ci * If you notice errors in the align stuff, need more alignment for some ASM code
31cabdff1aSopenharmony_ci * for some CPU or need to use a function with less aligned data then send a mail
32cabdff1aSopenharmony_ci * to the ffmpeg-devel mailing list, ...
33cabdff1aSopenharmony_ci *
34cabdff1aSopenharmony_ci * !warning These alignments might not match reality, (missing attribute((align))
35cabdff1aSopenharmony_ci * stuff somewhere possible).
36cabdff1aSopenharmony_ci * I (Michael) did not check them, these are just the alignments which I think
37cabdff1aSopenharmony_ci * could be reached easily ...
38cabdff1aSopenharmony_ci *
39cabdff1aSopenharmony_ci * !future video codecs might need functions with less strict alignment
40cabdff1aSopenharmony_ci */
41cabdff1aSopenharmony_ci
42cabdff1aSopenharmony_cistruct MpegEncContext;
43cabdff1aSopenharmony_ci/* Motion estimation:
44cabdff1aSopenharmony_ci * h is limited to { width / 2, width, 2 * width },
45cabdff1aSopenharmony_ci * but never larger than 16 and never smaller than 2.
46cabdff1aSopenharmony_ci * Although currently h < 4 is not used as functions with
47cabdff1aSopenharmony_ci * width < 8 are neither used nor implemented. */
48cabdff1aSopenharmony_citypedef int (*me_cmp_func)(struct MpegEncContext *c,
49cabdff1aSopenharmony_ci                           uint8_t *blk1 /* align width (8 or 16) */,
50cabdff1aSopenharmony_ci                           uint8_t *blk2 /* align 1 */, ptrdiff_t stride,
51cabdff1aSopenharmony_ci                           int h);
52cabdff1aSopenharmony_ci
53cabdff1aSopenharmony_citypedef struct MECmpContext {
54cabdff1aSopenharmony_ci    int (*sum_abs_dctelem)(int16_t *block /* align 16 */);
55cabdff1aSopenharmony_ci
56cabdff1aSopenharmony_ci    me_cmp_func sad[6]; /* identical to pix_absAxA except additional void * */
57cabdff1aSopenharmony_ci    me_cmp_func sse[6];
58cabdff1aSopenharmony_ci    me_cmp_func hadamard8_diff[6];
59cabdff1aSopenharmony_ci    me_cmp_func dct_sad[6];
60cabdff1aSopenharmony_ci    me_cmp_func quant_psnr[6];
61cabdff1aSopenharmony_ci    me_cmp_func bit[6];
62cabdff1aSopenharmony_ci    me_cmp_func rd[6];
63cabdff1aSopenharmony_ci    me_cmp_func vsad[6];
64cabdff1aSopenharmony_ci    me_cmp_func vsse[6];
65cabdff1aSopenharmony_ci    me_cmp_func nsse[6];
66cabdff1aSopenharmony_ci    me_cmp_func w53[6];
67cabdff1aSopenharmony_ci    me_cmp_func w97[6];
68cabdff1aSopenharmony_ci    me_cmp_func dct_max[6];
69cabdff1aSopenharmony_ci    me_cmp_func dct264_sad[6];
70cabdff1aSopenharmony_ci
71cabdff1aSopenharmony_ci    me_cmp_func me_pre_cmp[6];
72cabdff1aSopenharmony_ci    me_cmp_func me_cmp[6];
73cabdff1aSopenharmony_ci    me_cmp_func me_sub_cmp[6];
74cabdff1aSopenharmony_ci    me_cmp_func mb_cmp[6];
75cabdff1aSopenharmony_ci    me_cmp_func ildct_cmp[6]; // only width 16 used
76cabdff1aSopenharmony_ci    me_cmp_func frame_skip_cmp[6]; // only width 8 used
77cabdff1aSopenharmony_ci
78cabdff1aSopenharmony_ci    me_cmp_func pix_abs[2][4];
79cabdff1aSopenharmony_ci    me_cmp_func median_sad[6];
80cabdff1aSopenharmony_ci} MECmpContext;
81cabdff1aSopenharmony_ci
82cabdff1aSopenharmony_civoid ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx);
83cabdff1aSopenharmony_civoid ff_me_cmp_init_aarch64(MECmpContext *c, AVCodecContext *avctx);
84cabdff1aSopenharmony_civoid ff_me_cmp_init_alpha(MECmpContext *c, AVCodecContext *avctx);
85cabdff1aSopenharmony_civoid ff_me_cmp_init_arm(MECmpContext *c, AVCodecContext *avctx);
86cabdff1aSopenharmony_civoid ff_me_cmp_init_ppc(MECmpContext *c, AVCodecContext *avctx);
87cabdff1aSopenharmony_civoid ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx);
88cabdff1aSopenharmony_civoid ff_me_cmp_init_mips(MECmpContext *c, AVCodecContext *avctx);
89cabdff1aSopenharmony_ci
90cabdff1aSopenharmony_ciint ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type);
91cabdff1aSopenharmony_ci
92cabdff1aSopenharmony_civoid ff_dsputil_init_dwt(MECmpContext *c);
93cabdff1aSopenharmony_ci
94cabdff1aSopenharmony_ci#endif /* AVCODEC_ME_CMP_H */
95