Merge commit '21d8f4da91673051ad7055cf63d989488a56368e'
[ffmpeg.git] / libavcodec / bfin / hpeldsp_init.c
1 /*
2  * BlackFin halfpel functions
3  *
4  * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
5  * Copyright (c) 2006 Michael Benjamin <michael.benjamin@analog.com>
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23
24 #include <stddef.h>
25 #include <stdint.h>
26
27 #include "libavutil/attributes.h"
28 #include "libavutil/bfin/attributes.h"
29 #include "libavcodec/hpeldsp.h"
30 #include "pixels.h"
31
32 void ff_bfin_put_pixels8uc_no_rnd(uint8_t *block, const uint8_t *s0,
33                                   const uint8_t *s1, int line_size,
34                                   int h) attribute_l1_text;
35 void ff_bfin_put_pixels16uc_no_rnd(uint8_t *block, const uint8_t *s0,
36                                    const uint8_t *s1, int line_size,
37                                    int h) attribute_l1_text;
38
39 static void bfin_put_pixels8(uint8_t *block, const uint8_t *pixels,
40                              ptrdiff_t line_size, int h)
41 {
42     ff_bfin_put_pixels8uc(block, pixels, pixels, line_size, line_size, h);
43 }
44
45 static void bfin_put_pixels8_x2(uint8_t *block, const uint8_t *pixels,
46                                 ptrdiff_t line_size, int h)
47 {
48     ff_bfin_put_pixels8uc(block, pixels, pixels + 1, line_size, line_size, h);
49 }
50
51 static void bfin_put_pixels8_y2(uint8_t *block, const uint8_t *pixels,
52                                 ptrdiff_t line_size, int h)
53 {
54     ff_bfin_put_pixels8uc(block, pixels, pixels + line_size,
55                           line_size, line_size, h);
56 }
57
58 static void bfin_put_pixels8_xy2(uint8_t *block, const uint8_t *s0,
59                                  ptrdiff_t line_size, int h)
60 {
61     ff_bfin_z_put_pixels8_xy2(block, s0, line_size, line_size, h);
62 }
63
64 static void bfin_put_pixels16(uint8_t *block, const uint8_t *pixels,
65                               ptrdiff_t line_size, int h)
66 {
67     ff_bfin_put_pixels16uc(block, pixels, pixels, line_size, line_size, h);
68 }
69
70 static void bfin_put_pixels16_x2(uint8_t *block, const uint8_t *pixels,
71                                  ptrdiff_t line_size, int h)
72 {
73     ff_bfin_put_pixels16uc(block, pixels, pixels + 1, line_size, line_size, h);
74 }
75
76 static void bfin_put_pixels16_y2(uint8_t *block, const uint8_t *pixels,
77                                  ptrdiff_t line_size, int h)
78 {
79     ff_bfin_put_pixels16uc(block, pixels, pixels + line_size,
80                            line_size, line_size, h);
81 }
82
83 static void bfin_put_pixels16_xy2(uint8_t *block, const uint8_t *s0,
84                                   ptrdiff_t line_size, int h)
85 {
86     ff_bfin_z_put_pixels16_xy2(block, s0, line_size, line_size, h);
87 }
88
89 static void bfin_put_pixels8_no_rnd(uint8_t *block, const uint8_t *pixels,
90                                     ptrdiff_t line_size, int h)
91 {
92     ff_bfin_put_pixels8uc_no_rnd(block, pixels, pixels, line_size, h);
93 }
94
95 static void bfin_put_pixels8_x2_no_rnd(uint8_t *block, const uint8_t *pixels,
96                                        ptrdiff_t line_size, int h)
97 {
98     ff_bfin_put_pixels8uc_no_rnd(block, pixels, pixels + 1, line_size, h);
99 }
100
101 static void bfin_put_pixels8_y2_no_rnd(uint8_t *block, const uint8_t *pixels,
102                                        ptrdiff_t line_size, int h)
103 {
104     ff_bfin_put_pixels8uc_no_rnd(block, pixels, pixels + line_size,
105                                  line_size, h);
106 }
107
108 static void bfin_put_pixels16_no_rnd(uint8_t *block, const uint8_t *pixels,
109                                      ptrdiff_t line_size, int h)
110 {
111     ff_bfin_put_pixels16uc_no_rnd(block, pixels, pixels, line_size, h);
112 }
113
114 static void bfin_put_pixels16_x2_no_rnd(uint8_t *block, const uint8_t *pixels,
115                                         ptrdiff_t line_size, int h)
116 {
117     ff_bfin_put_pixels16uc_no_rnd(block, pixels, pixels + 1, line_size, h);
118 }
119
120 static void bfin_put_pixels16_y2_no_rnd(uint8_t *block, const uint8_t *pixels,
121                                         ptrdiff_t line_size, int h)
122 {
123     ff_bfin_put_pixels16uc_no_rnd(block, pixels, pixels + line_size,
124                                   line_size, h);
125 }
126
127 av_cold void ff_hpeldsp_init_bfin(HpelDSPContext *c, int flags)
128 {
129     c->put_pixels_tab[0][0] = bfin_put_pixels16;
130     c->put_pixels_tab[0][1] = bfin_put_pixels16_x2;
131     c->put_pixels_tab[0][2] = bfin_put_pixels16_y2;
132     c->put_pixels_tab[0][3] = bfin_put_pixels16_xy2;
133
134     c->put_pixels_tab[1][0] = bfin_put_pixels8;
135     c->put_pixels_tab[1][1] = bfin_put_pixels8_x2;
136     c->put_pixels_tab[1][2] = bfin_put_pixels8_y2;
137     c->put_pixels_tab[1][3] = bfin_put_pixels8_xy2;
138
139     c->put_no_rnd_pixels_tab[1][0] = bfin_put_pixels8_no_rnd;
140     c->put_no_rnd_pixels_tab[1][1] = bfin_put_pixels8_x2_no_rnd;
141     c->put_no_rnd_pixels_tab[1][2] = bfin_put_pixels8_y2_no_rnd;
142
143     c->put_no_rnd_pixels_tab[0][0] = bfin_put_pixels16_no_rnd;
144     c->put_no_rnd_pixels_tab[0][1] = bfin_put_pixels16_x2_no_rnd;
145     c->put_no_rnd_pixels_tab[0][2] = bfin_put_pixels16_y2_no_rnd;
146 }