Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 1 | /* |
Michael Niedermayer | b058301 | 2013-02-09 12:16:57 | [diff] [blame] | 2 | * This file is part of FFmpeg. |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 3 | * |
Michael Niedermayer | b058301 | 2013-02-09 12:16:57 | [diff] [blame] | 4 | * FFmpeg is free software; you can redistribute it and/or |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 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. |
| 8 | * |
Michael Niedermayer | b058301 | 2013-02-09 12:16:57 | [diff] [blame] | 9 | * FFmpeg is distributed in the hope that it will be useful, |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 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. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
Michael Niedermayer | b058301 | 2013-02-09 12:16:57 | [diff] [blame] | 15 | * License along with FFmpeg; if not, write to the Free Software |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 16 | * 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 Biurrun | 73f5e17 | 2016-08-26 10:38:33 | [diff] [blame] | 22 | #include <stddef.h> |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 23 | #include <stdint.h> |
| 24 | |
| 25 | #include "libavutil/intreadwrite.h" |
| 26 | |
Clément Bœsch | 21c18b0 | 2017-03-20 08:22:36 | [diff] [blame^] | 27 | static inline void copy_block2(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h) |
Michael Niedermayer | b058301 | 2013-02-09 12:16:57 | [diff] [blame] | 28 | { |
| 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 Biurrun | 73f5e17 | 2016-08-26 10:38:33 | [diff] [blame] | 38 | static inline void copy_block4(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h) |
Michael Niedermayer | b058301 | 2013-02-09 12:16:57 | [diff] [blame] | 39 | { |
| 40 | int i; |
Vittorio Giovara | d37c962 | 2014-03-10 16:05:12 | [diff] [blame] | 41 | for (i = 0; i < h; i++) { |
Michael Niedermayer | b058301 | 2013-02-09 12:16:57 | [diff] [blame] | 42 | AV_COPY32U(dst, src); |
Vittorio Giovara | d37c962 | 2014-03-10 16:05:12 | [diff] [blame] | 43 | dst += dstStride; |
| 44 | src += srcStride; |
Michael Niedermayer | b058301 | 2013-02-09 12:16:57 | [diff] [blame] | 45 | } |
| 46 | } |
| 47 | |
Diego Biurrun | 73f5e17 | 2016-08-26 10:38:33 | [diff] [blame] | 48 | static inline void copy_block8(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h) |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 49 | { |
| 50 | int i; |
Vittorio Giovara | b4e355c | 2014-03-10 20:44:26 | [diff] [blame] | 51 | for (i = 0; i < h; i++) { |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 52 | AV_COPY64U(dst, src); |
Vittorio Giovara | b4e355c | 2014-03-10 20:44:26 | [diff] [blame] | 53 | dst += dstStride; |
| 54 | src += srcStride; |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 55 | } |
| 56 | } |
| 57 | |
Diego Biurrun | 73f5e17 | 2016-08-26 10:38:33 | [diff] [blame] | 58 | static inline void copy_block9(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h) |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 59 | { |
| 60 | int i; |
Vittorio Giovara | b4e355c | 2014-03-10 20:44:26 | [diff] [blame] | 61 | for (i = 0; i < h; i++) { |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 62 | AV_COPY64U(dst, src); |
Vittorio Giovara | b4e355c | 2014-03-10 20:44:26 | [diff] [blame] | 63 | dst[8] = src[8]; |
| 64 | dst += dstStride; |
| 65 | src += srcStride; |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 66 | } |
| 67 | } |
| 68 | |
Diego Biurrun | 73f5e17 | 2016-08-26 10:38:33 | [diff] [blame] | 69 | static inline void copy_block16(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h) |
Vittorio Giovara | d37c962 | 2014-03-10 16:05:12 | [diff] [blame] | 70 | { |
| 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 Biurrun | 73f5e17 | 2016-08-26 10:38:33 | [diff] [blame] | 79 | static inline void copy_block17(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h) |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 80 | { |
| 81 | int i; |
Vittorio Giovara | b4e355c | 2014-03-10 20:44:26 | [diff] [blame] | 82 | for (i = 0; i < h; i++) { |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 83 | AV_COPY128U(dst, src); |
Vittorio Giovara | b4e355c | 2014-03-10 20:44:26 | [diff] [blame] | 84 | dst[16] = src[16]; |
| 85 | dst += dstStride; |
| 86 | src += srcStride; |
Diego Biurrun | b9ba525 | 2013-02-07 21:03:49 | [diff] [blame] | 87 | } |
| 88 | } |
| 89 | |
| 90 | #endif /* AVCODEC_COPY_BLOCK_H */ |