2 * This file is part of FFmpeg.
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "libavutil/intreadwrite.h"
26 #include "bit_depth_template.c"
28 #define DEF_PEL(OPNAME, OP) \
29 static inline void FUNCC(OPNAME ## _pixels2)(uint8_t *block, \
30 const uint8_t *pixels, \
31 ptrdiff_t line_size, \
35 for (i = 0; i < h; i++) { \
36 OP(*((pixel2 *) block), AV_RN2P(pixels)); \
37 pixels += line_size; \
42 static inline void FUNCC(OPNAME ## _pixels4)(uint8_t *block, \
43 const uint8_t *pixels, \
44 ptrdiff_t line_size, \
48 for (i = 0; i < h; i++) { \
49 OP(*((pixel4 *) block), AV_RN4P(pixels)); \
50 pixels += line_size; \
55 static inline void FUNCC(OPNAME ## _pixels8)(uint8_t *block, \
56 const uint8_t *pixels, \
57 ptrdiff_t line_size, \
61 for (i = 0; i < h; i++) { \
62 OP(*((pixel4 *) block), AV_RN4P(pixels)); \
63 OP(*((pixel4 *) (block + 4 * sizeof(pixel))), \
64 AV_RN4P(pixels + 4 * sizeof(pixel))); \
65 pixels += line_size; \
70 CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16), \
71 FUNCC(OPNAME ## _pixels8), \
74 #define op_avg(a, b) a = rnd_avg_pixel4(a, b)
75 #define op_put(a, b) a = b