blob: 393d45578e78c5bc4a4bcb36471d386684e121e3 [file] [log] [blame]
Diego Biurrunb9ba5252013-02-07 21:03:491/*
Michael Niedermayerb0583012013-02-09 12:16:572 * This file is part of FFmpeg.
Diego Biurrunb9ba5252013-02-07 21:03:493 *
Michael Niedermayerb0583012013-02-09 12:16:574 * FFmpeg is free software; you can redistribute it and/or
Diego Biurrunb9ba5252013-02-07 21:03:495 * 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.
8 *
Michael Niedermayerb0583012013-02-09 12:16:579 * FFmpeg is distributed in the hope that it will be useful,
Diego Biurrunb9ba5252013-02-07 21:03:4910 * 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.
13 *
14 * You should have received a copy of the GNU Lesser General Public
Michael Niedermayerb0583012013-02-09 12:16:5715 * License along with FFmpeg; if not, write to the Free Software
Diego Biurrunb9ba5252013-02-07 21:03:4916 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef AVCODEC_COPY_BLOCK_H
20#define AVCODEC_COPY_BLOCK_H
21
Diego Biurrun73f5e172016-08-26 10:38:3322#include <stddef.h>
Diego Biurrunb9ba5252013-02-07 21:03:4923#include <stdint.h>
24
25#include "libavutil/intreadwrite.h"
26
Clément Bœsch21c18b02017-03-20 08:22:3627static inline void copy_block2(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
Michael Niedermayerb0583012013-02-09 12:16:5728{
29 int i;
Clément Bœsch64926292017-03-20 08:23:1530 for (i = 0; i < h; i++) {
Michael Niedermayerb0583012013-02-09 12:16:5731 AV_COPY16U(dst, src);
Clément Bœsch64926292017-03-20 08:23:1532 dst += dstStride;
33 src += srcStride;
Michael Niedermayerb0583012013-02-09 12:16:5734 }
35}
36
Diego Biurrun73f5e172016-08-26 10:38:3337static inline void copy_block4(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
Michael Niedermayerb0583012013-02-09 12:16:5738{
39 int i;
Vittorio Giovarad37c9622014-03-10 16:05:1240 for (i = 0; i < h; i++) {
Michael Niedermayerb0583012013-02-09 12:16:5741 AV_COPY32U(dst, src);
Vittorio Giovarad37c9622014-03-10 16:05:1242 dst += dstStride;
43 src += srcStride;
Michael Niedermayerb0583012013-02-09 12:16:5744 }
45}
46
Diego Biurrun73f5e172016-08-26 10:38:3347static inline void copy_block8(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
Diego Biurrunb9ba5252013-02-07 21:03:4948{
49 int i;
Vittorio Giovarab4e355c2014-03-10 20:44:2650 for (i = 0; i < h; i++) {
Diego Biurrunb9ba5252013-02-07 21:03:4951 AV_COPY64U(dst, src);
Vittorio Giovarab4e355c2014-03-10 20:44:2652 dst += dstStride;
53 src += srcStride;
Diego Biurrunb9ba5252013-02-07 21:03:4954 }
55}
56
Diego Biurrun73f5e172016-08-26 10:38:3357static inline void copy_block9(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
Diego Biurrunb9ba5252013-02-07 21:03:4958{
59 int i;
Vittorio Giovarab4e355c2014-03-10 20:44:2660 for (i = 0; i < h; i++) {
Diego Biurrunb9ba5252013-02-07 21:03:4961 AV_COPY64U(dst, src);
Vittorio Giovarab4e355c2014-03-10 20:44:2662 dst[8] = src[8];
63 dst += dstStride;
64 src += srcStride;
Diego Biurrunb9ba5252013-02-07 21:03:4965 }
66}
67
Diego Biurrun73f5e172016-08-26 10:38:3368static inline void copy_block16(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
Vittorio Giovarad37c9622014-03-10 16:05:1269{
70 int i;
71 for (i = 0; i < h; i++) {
72 AV_COPY128U(dst, src);
73 dst += dstStride;
74 src += srcStride;
75 }
76}
77
Diego Biurrun73f5e172016-08-26 10:38:3378static inline void copy_block17(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
Diego Biurrunb9ba5252013-02-07 21:03:4979{
80 int i;
Vittorio Giovarab4e355c2014-03-10 20:44:2681 for (i = 0; i < h; i++) {
Diego Biurrunb9ba5252013-02-07 21:03:4982 AV_COPY128U(dst, src);
Vittorio Giovarab4e355c2014-03-10 20:44:2683 dst[16] = src[16];
84 dst += dstStride;
85 src += srcStride;
Diego Biurrunb9ba5252013-02-07 21:03:4986 }
87}
88
89#endif /* AVCODEC_COPY_BLOCK_H */