annotate libvo/fastmemcpy.h @ 29636:eb925f17f9a8

Add support for decoding sgi files via FFmpeg's sgi decoder.
author reimar
date Mon, 14 Sep 2009 09:47:08 +0000
parents c7ac52e4b228
children 688c1e685fe7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23385
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
1 /*
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
2 * This file is part of MPlayer.
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
3 *
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
4 * MPlayer is free software; you can redistribute it and/or
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
6 * License as published by the Free Software Foundation; either
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
7 * version 2.1 of the License, or (at your option) any later version.
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
8 *
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
12 * Lesser General Public License for more details.
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
13 *
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
15 * License along with MPlayer; if not, write to the Free Software
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
17 */
499d246cd549 Add LGPL license header.
diego
parents: 22003
diff changeset
18
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
19 #ifndef MPLAYER_FASTMEMCPY_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
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>
800
dc6cdb87229a USE_FASTMEMCPY bug fixed.
pontscho
parents: 698
diff changeset
25
28867
c7ac52e4b228 Merge two preprocessor conditions in order to drop one duplicated #else case.
diego
parents: 28335
diff changeset
26 #if defined(CONFIG_FASTMEMCPY) && (HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW /* || HAVE_SSE || HAVE_SSE2 */)
644
88eb1a3f7bfb Changed code, should be faster on Athlon/K6 but slower on PIII with SSE, more portable.
atmosfear
parents: 581
diff changeset
27 #include <stddef.h>
477
a1ceb65cf6ab add 3dnow support
pontscho
parents: 409
diff changeset
28
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27341
diff changeset
29 void * fast_memcpy(void * to, const void * from, size_t len);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27341
diff changeset
30 void * mem2agpcpy(void * to, const void * from, size_t len);
513
aec3cad1e41a replace "movsl..." to small_memcpy
pontscho
parents: 478
diff changeset
31
28867
c7ac52e4b228 Merge two preprocessor conditions in order to drop one duplicated #else case.
diego
parents: 28335
diff changeset
32 #else
4681
8db59073127e mem2agpcpy()
michael
parents: 1131
diff changeset
33 #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
34 #define fast_memcpy(a,b,c) memcpy(a,b,c)
4681
8db59073127e mem2agpcpy()
michael
parents: 1131
diff changeset
35 #endif
4708
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
36
17095
rathann
parents: 15069
diff changeset
37 static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride)
4708
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
38 {
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
39 int i;
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
40 void *retval=dst;
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
41
15069
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
42 if(dstStride == srcStride)
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
43 {
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
44 if (srcStride < 0) {
22000
f7c209352770 get rid of void pointer arithmetic, as spotted by ICC
gpoirier
parents: 17095
diff changeset
45 src = (uint8_t*)src + (height-1)*srcStride;
f7c209352770 get rid of void pointer arithmetic, as spotted by ICC
gpoirier
parents: 17095
diff changeset
46 dst = (uint8_t*)dst + (height-1)*dstStride;
15069
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
47 srcStride = -srcStride;
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
48 }
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
49
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
50 mem2agpcpy(dst, src, srcStride*height);
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
51 }
4708
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
52 else
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
53 {
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
54 for(i=0; i<height; i++)
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
55 {
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
56 mem2agpcpy(dst, src, bytesPerLine);
22000
f7c209352770 get rid of void pointer arithmetic, as spotted by ICC
gpoirier
parents: 17095
diff changeset
57 src = (uint8_t*)src + srcStride;
f7c209352770 get rid of void pointer arithmetic, as spotted by ICC
gpoirier
parents: 17095
diff changeset
58 dst = (uint8_t*)dst + dstStride;
4708
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
59 }
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
60 }
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
61
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
62 return retval;
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
63 }
000ca7a19331 mem2agpcpy_pic()
michael
parents: 4681
diff changeset
64
23666
5c3c7efd9b75 Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents: 23457
diff changeset
65 #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
66 #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
67
5c3c7efd9b75 Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents: 23457
diff changeset
68 /**
5c3c7efd9b75 Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents: 23457
diff changeset
69 * \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
70 * 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
71 */
5c3c7efd9b75 Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents: 23457
diff changeset
72 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
73 int bytesPerLine, int height,
5c3c7efd9b75 Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents: 23457
diff changeset
74 int dstStride, int srcStride, int limit2width)
5504
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
75 {
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
76 int i;
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
77 void *retval=dst;
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
78
23666
5c3c7efd9b75 Get rid of my_memcpy_pic code duplication in many filters.
reimar
parents: 23457
diff changeset
79 if(!limit2width && dstStride == srcStride)
15069
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
80 {
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
81 if (srcStride < 0) {
22000
f7c209352770 get rid of void pointer arithmetic, as spotted by ICC
gpoirier
parents: 17095
diff changeset
82 src = (uint8_t*)src + (height-1)*srcStride;
f7c209352770 get rid of void pointer arithmetic, as spotted by ICC
gpoirier
parents: 17095
diff changeset
83 dst = (uint8_t*)dst + (height-1)*dstStride;
15069
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
84 srcStride = -srcStride;
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
85 }
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
86
23457
a124f3abc1ec Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents: 23385
diff changeset
87 fast_memcpy(dst, src, srcStride*height);
15069
3f5daa60e049 support for negative strides (fixes -vf spp,flip crash)
henry
parents: 13787
diff changeset
88 }
5504
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
89 else
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
90 {
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
91 for(i=0; i<height; i++)
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
92 {
23457
a124f3abc1ec Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents: 23385
diff changeset
93 fast_memcpy(dst, src, bytesPerLine);
22000
f7c209352770 get rid of void pointer arithmetic, as spotted by ICC
gpoirier
parents: 17095
diff changeset
94 src = (uint8_t*)src + srcStride;
f7c209352770 get rid of void pointer arithmetic, as spotted by ICC
gpoirier
parents: 17095
diff changeset
95 dst = (uint8_t*)dst + dstStride;
5504
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
96 }
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
97 }
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 return retval;
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
100 }
23ba417cf64b memcpy_pic() added (copy image plane with src/dst stride)
arpi
parents: 4708
diff changeset
101
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
102 #endif /* MPLAYER_FASTMEMCPY_H */