FFmpeg
h264qpel.c
Go to the documentation of this file.
1 /*
2  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
3  * Copyright (c) 2003-2010 Michael Niedermayer <michaelni@gmx.at>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/attributes.h"
23 #include "libavutil/common.h"
24 #include "h264qpel.h"
25 
26 #define pixeltmp int16_t
27 #define BIT_DEPTH 8
28 #include "h264qpel_template.c"
29 #undef BIT_DEPTH
30 
31 #define BIT_DEPTH 9
32 #include "h264qpel_template.c"
33 #undef BIT_DEPTH
34 
35 #define BIT_DEPTH 10
36 #include "h264qpel_template.c"
37 #undef BIT_DEPTH
38 #undef pixeltmp
39 
40 #define pixeltmp int32_t
41 #define BIT_DEPTH 12
42 #include "h264qpel_template.c"
43 #undef BIT_DEPTH
44 
45 #define BIT_DEPTH 14
46 #include "h264qpel_template.c"
47 #undef BIT_DEPTH
48 
49 
51 {
52 #undef FUNCC
53 #define FUNCC(f, depth) f ## _ ## depth ## _c
54 
55 #define dspfunc2(PFX, IDX, NUM, depth) \
56  c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth); \
57  c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth); \
58  c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth); \
59  c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth); \
60  c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth); \
61  c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth); \
62  c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth); \
63  c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth); \
64  c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth); \
65  c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth); \
66  c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth); \
67  c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth); \
68  c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth); \
69  c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth); \
70  c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth); \
71  c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth)
72 
73 #define SET_QPEL(depth) \
74  dspfunc2(put_h264_qpel, 0, 16, depth); \
75  dspfunc2(put_h264_qpel, 1, 8, depth); \
76  dspfunc2(put_h264_qpel, 2, 4, depth); \
77  dspfunc2(avg_h264_qpel, 0, 16, depth); \
78  dspfunc2(avg_h264_qpel, 1, 8, depth); \
79  dspfunc2(avg_h264_qpel, 2, 4, depth)
80 
81  switch (bit_depth) {
82  default:
83  SET_QPEL(8);
84  break;
85  case 9:
86  SET_QPEL(9);
87  break;
88  case 10:
89  SET_QPEL(10);
90  break;
91  case 12:
92  SET_QPEL(12);
93  break;
94  case 14:
95  SET_QPEL(14);
96  break;
97  }
98 
99 #if ARCH_AARCH64
101 #elif ARCH_ARM
103 #elif ARCH_PPC
105 #elif ARCH_RISCV
107 #elif ARCH_X86
109 #elif ARCH_MIPS
111 #elif ARCH_LOONGARCH64
113 #endif
114 }
h264qpel_template.c
ff_h264qpel_init_loongarch
void ff_h264qpel_init_loongarch(H264QpelContext *c, int bit_depth)
Definition: h264qpel_init_loongarch.c:27
bit_depth
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition: af_astats.c:246
ff_h264qpel_init_arm
av_cold void ff_h264qpel_init_arm(H264QpelContext *c, int bit_depth)
Definition: h264qpel_init_arm.c:97
h264qpel.h
ff_h264qpel_init
av_cold void ff_h264qpel_init(H264QpelContext *c, int bit_depth)
Definition: h264qpel.c:50
av_cold
#define av_cold
Definition: attributes.h:106
SET_QPEL
#define SET_QPEL(depth)
ff_h264qpel_init_ppc
av_cold void ff_h264qpel_init_ppc(H264QpelContext *c, int bit_depth)
Definition: h264qpel.c:283
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
attributes.h
ff_h264qpel_init_riscv
void ff_h264qpel_init_riscv(H264QpelContext *c, int bit_depth)
Definition: h264qpel_init.c:83
ff_h264qpel_init_aarch64
av_cold void ff_h264qpel_init_aarch64(H264QpelContext *c, int bit_depth)
Definition: h264qpel_init_aarch64.c:142
common.h
H264QpelContext
Definition: h264qpel.h:27
ff_h264qpel_init_x86
void ff_h264qpel_init_x86(H264QpelContext *c, int bit_depth)
Definition: h264_qpel.c:400
ff_h264qpel_init_mips
void ff_h264qpel_init_mips(H264QpelContext *c, int bit_depth)
Definition: h264qpel_init_mips.c:26