Mercurial > mplayer.hg
annotate libvo/fastmemcpy.h @ 33389:2672587086ad
Add MNG output support.
Patch by Stefan Schuermans, stefan blinkenarea dot org.
author | cboesch |
---|---|
date | Sat, 21 May 2011 15:04:50 +0000 |
parents | aab47f5fdb9b |
children |
rev | line source |
---|---|
23385 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer 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. | |
8 * | |
9 * MPlayer 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. | |
13 * | |
14 * You should have received a copy of the GNU Lesser General Public | |
15 * License along with MPlayer; if not, write to the Free Software | |
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 */ | |
18 | |
26029 | 19 #ifndef MPLAYER_FASTMEMCPY_H |
20 #define MPLAYER_FASTMEMCPY_H | |
644
88eb1a3f7bfb
Changed code, should be faster on Athlon/K6 but slower on PIII with SSE, more portable.
atmosfear
parents:
581
diff
changeset
|
21 |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12663
diff
changeset
|
22 #include "config.h" |
22003
6fd6bf6269f3
fastmemcpy.h always has to include inttypes.h on systems that need it.
diego
parents:
22000
diff
changeset
|
23 #include <inttypes.h> |
27044
b03f87f35c3c
Add missing string.h #include for memcpy prototype;
diego
parents:
26029
diff
changeset
|
24 #include <string.h> |
644
88eb1a3f7bfb
Changed code, should be faster on Athlon/K6 but slower on PIII with SSE, more portable.
atmosfear
parents:
581
diff
changeset
|
25 #include <stddef.h> |
477 | 26 |
28051 | 27 void * fast_memcpy(void * to, const void * from, size_t len); |
28 void * mem2agpcpy(void * to, const void * from, size_t len); | |
513 | 29 |
31097
5b23259d86e7
Fix compilation with --disable-fastmemcpy on x86
astrange
parents:
30686
diff
changeset
|
30 #if ! defined(CONFIG_FASTMEMCPY) || ! (HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW /* || HAVE_SSE || HAVE_SSE2 */) |
4681 | 31 #define mem2agpcpy(a,b,c) memcpy(a,b,c) |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
23385
diff
changeset
|
32 #define fast_memcpy(a,b,c) memcpy(a,b,c) |
4681 | 33 #endif |
4708 | 34 |
17095 | 35 static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride) |
4708 | 36 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
37 int i; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
38 void *retval=dst; |
4708 | 39 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
40 if(dstStride == srcStride) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
41 { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
42 if (srcStride < 0) { |
33013 | 43 src = (const uint8_t*)src + (height-1)*srcStride; |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
44 dst = (uint8_t*)dst + (height-1)*dstStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
45 srcStride = -srcStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
46 } |
15069
3f5daa60e049
support for negative strides (fixes -vf spp,flip crash)
henry
parents:
13787
diff
changeset
|
47 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
48 mem2agpcpy(dst, src, srcStride*height); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
49 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
50 else |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
51 { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
52 for(i=0; i<height; i++) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
53 { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
54 mem2agpcpy(dst, src, bytesPerLine); |
33013 | 55 src = (const uint8_t*)src + srcStride; |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
56 dst = (uint8_t*)dst + dstStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
57 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
58 } |
4708 | 59 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
60 return retval; |
4708 | 61 } |
62 | |
23666
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
63 #define memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 0) |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
64 #define my_memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 1) |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
65 |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
66 /** |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
67 * \param limit2width always skip data between end of line and start of next |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
68 * instead of copying the full block when strides are the same |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
69 */ |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
70 static inline void * memcpy_pic2(void * dst, const void * src, |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
71 int bytesPerLine, int height, |
5c3c7efd9b75
Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents:
23457
diff
changeset
|
72 int dstStride, int srcStride, int limit2width) |
5504
23ba417cf64b
memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents:
4708
diff
changeset
|
73 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
74 int i; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
75 void *retval=dst; |
5504
23ba417cf64b
memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents:
4708
diff
changeset
|
76 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
77 if(!limit2width && dstStride == srcStride) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
78 { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
79 if (srcStride < 0) { |
33012 | 80 src = (const uint8_t*)src + (height-1)*srcStride; |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
81 dst = (uint8_t*)dst + (height-1)*dstStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
82 srcStride = -srcStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
83 } |
15069
3f5daa60e049
support for negative strides (fixes -vf spp,flip crash)
henry
parents:
13787
diff
changeset
|
84 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
85 fast_memcpy(dst, src, srcStride*height); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
86 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
87 else |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
88 { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
89 for(i=0; i<height; i++) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
90 { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
91 fast_memcpy(dst, src, bytesPerLine); |
33012 | 92 src = (const uint8_t*)src + srcStride; |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
93 dst = (uint8_t*)dst + dstStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
94 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
95 } |
5504
23ba417cf64b
memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents:
4708
diff
changeset
|
96 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
31097
diff
changeset
|
97 return retval; |
5504
23ba417cf64b
memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents:
4708
diff
changeset
|
98 } |
23ba417cf64b
memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents:
4708
diff
changeset
|
99 |
26029 | 100 #endif /* MPLAYER_FASTMEMCPY_H */ |