blob: 4d6ef262d1397cab5568973ae110f916a3fceff4 [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;
30 for(i=0; i<h; i++)
31 {
32 AV_COPY16U(dst, src);
33 dst+=dstStride;
34 src+=srcStride;
35 }
36}
37
Diego Biurrun73f5e172016-08-26 10:38:3338static 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:5739{
40 int i;
Vittorio Giovarad37c9622014-03-10 16:05:1241 for (i = 0; i < h; i++) {
Michael Niedermayerb0583012013-02-09 12:16:5742 AV_COPY32U(dst, src);
Vittorio Giovarad37c9622014-03-10 16:05:1243 dst += dstStride;
44 src += srcStride;
Michael Niedermayerb0583012013-02-09 12:16:5745 }
46}
47
Diego Biurrun73f5e172016-08-26 10:38:3348static 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:4949{
50 int i;
Vittorio Giovarab4e355c2014-03-10 20:44:2651 for (i = 0; i < h; i++) {
Diego Biurrunb9ba5252013-02-07 21:03:4952 AV_COPY64U(dst, src);
Vittorio Giovarab4e355c2014-03-10 20:44:2653 dst += dstStride;
54 src += srcStride;
Diego Biurrunb9ba5252013-02-07 21:03:4955 }
56}
57
Diego Biurrun73f5e172016-08-26 10:38:3358static 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:4959{
60 int i;
Vittorio Giovarab4e355c2014-03-10 20:44:2661 for (i = 0; i < h; i++) {
Diego Biurrunb9ba5252013-02-07 21:03:4962 AV_COPY64U(dst, src);
Vittorio Giovarab4e355c2014-03-10 20:44:2663 dst[8] = src[8];
64 dst += dstStride;
65 src += srcStride;
Diego Biurrunb9ba5252013-02-07 21:03:4966 }
67}
68
Diego Biurrun73f5e172016-08-26 10:38:3369static 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:1270{
71 int i;
72 for (i = 0; i < h; i++) {
73 AV_COPY128U(dst, src);
74 dst += dstStride;
75 src += srcStride;
76 }
77}
78
Diego Biurrun73f5e172016-08-26 10:38:3379static 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:4980{
81 int i;
Vittorio Giovarab4e355c2014-03-10 20:44:2682 for (i = 0; i < h; i++) {
Diego Biurrunb9ba5252013-02-07 21:03:4983 AV_COPY128U(dst, src);
Vittorio Giovarab4e355c2014-03-10 20:44:2684 dst[16] = src[16];
85 dst += dstStride;
86 src += srcStride;
Diego Biurrunb9ba5252013-02-07 21:03:4987 }
88}
89
90#endif /* AVCODEC_COPY_BLOCK_H */