annotate mips/intreadwrite.h @ 1028:5dbb12a37c3d libavutil tip

Move av_set_options_string() from libavfilter to libavutil.
author stefano
date Mon, 27 Sep 2010 22:09:53 +0000
parents f849545df4e5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
1 /*
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
2 * Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
3 *
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
4 * This file is part of FFmpeg.
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
5 *
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
10 *
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
14 * Lesser General Public License for more details.
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
15 *
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
19 */
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
20
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
21 #ifndef AVUTIL_MIPS_INTREADWRITE_H
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
22 #define AVUTIL_MIPS_INTREADWRITE_H
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
23
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
24 #include <stdint.h>
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
25 #include "config.h"
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
26
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
27 #define AV_RN32 AV_RN32
812
f849545df4e5 Mark all intreadwrite functions av_always_inline
mru
parents: 769
diff changeset
28 static av_always_inline uint32_t AV_RN32(const void *p)
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
29 {
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
30 uint32_t v;
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
31 __asm__ ("lwl %0, %1 \n\t"
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
32 "lwr %0, %2 \n\t"
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
33 : "=&r"(v)
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
34 : "m"(*(const uint32_t *)((const uint8_t *)p+3*!HAVE_BIGENDIAN)),
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
35 "m"(*(const uint32_t *)((const uint8_t *)p+3*HAVE_BIGENDIAN)));
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
36 return v;
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
37 }
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
38
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
39 #define AV_WN32 AV_WN32
812
f849545df4e5 Mark all intreadwrite functions av_always_inline
mru
parents: 769
diff changeset
40 static av_always_inline void AV_WN32(void *p, uint32_t v)
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
41 {
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
42 __asm__ ("swl %2, %0 \n\t"
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
43 "swr %2, %1 \n\t"
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
44 : "=m"(*(uint32_t *)((uint8_t *)p+3*!HAVE_BIGENDIAN)),
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
45 "=m"(*(uint32_t *)((uint8_t *)p+3*HAVE_BIGENDIAN))
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
46 : "r"(v));
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
47 }
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
48
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
49 #if ARCH_MIPS64
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
50
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
51 #define AV_RN64 AV_RN64
812
f849545df4e5 Mark all intreadwrite functions av_always_inline
mru
parents: 769
diff changeset
52 static av_always_inline uint64_t AV_RN64(const void *p)
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
53 {
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
54 uint64_t v;
769
27154cd3d95b MIPS: 100L: fix AV_[RW]N64 on MIPS64
mru
parents: 737
diff changeset
55 __asm__ ("ldl %0, %1 \n\t"
27154cd3d95b MIPS: 100L: fix AV_[RW]N64 on MIPS64
mru
parents: 737
diff changeset
56 "ldr %0, %2 \n\t"
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
57 : "=&r"(v)
769
27154cd3d95b MIPS: 100L: fix AV_[RW]N64 on MIPS64
mru
parents: 737
diff changeset
58 : "m"(*(const uint64_t *)((const uint8_t *)p+7*!HAVE_BIGENDIAN)),
27154cd3d95b MIPS: 100L: fix AV_[RW]N64 on MIPS64
mru
parents: 737
diff changeset
59 "m"(*(const uint64_t *)((const uint8_t *)p+7*HAVE_BIGENDIAN)));
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
60 return v;
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
61 }
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
62
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
63 #define AV_WN64 AV_WN64
812
f849545df4e5 Mark all intreadwrite functions av_always_inline
mru
parents: 769
diff changeset
64 static av_always_inline void AV_WN64(void *p, uint64_t v)
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
65 {
769
27154cd3d95b MIPS: 100L: fix AV_[RW]N64 on MIPS64
mru
parents: 737
diff changeset
66 __asm__ ("sdl %2, %0 \n\t"
27154cd3d95b MIPS: 100L: fix AV_[RW]N64 on MIPS64
mru
parents: 737
diff changeset
67 "sdr %2, %1 \n\t"
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
68 : "=m"(*(uint64_t *)((uint8_t *)p+7*!HAVE_BIGENDIAN)),
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
69 "=m"(*(uint64_t *)((uint8_t *)p+7*HAVE_BIGENDIAN))
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
70 : "r"(v));
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
71 }
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
72
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
73 #else
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
74
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
75 #define AV_RN64 AV_RN64
812
f849545df4e5 Mark all intreadwrite functions av_always_inline
mru
parents: 769
diff changeset
76 static av_always_inline uint64_t AV_RN64(const void *p)
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
77 {
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
78 union { uint64_t v; uint32_t hl[2]; } v;
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
79 v.hl[0] = AV_RN32(p);
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
80 v.hl[1] = AV_RN32((const uint8_t *)p + 4);
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
81 return v.v;
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
82 }
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
83
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
84 #define AV_WN64 AV_WN64
812
f849545df4e5 Mark all intreadwrite functions av_always_inline
mru
parents: 769
diff changeset
85 static av_always_inline void AV_WN64(void *p, uint64_t v)
737
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
86 {
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
87 union { uint64_t v; uint32_t hl[2]; } vv = { v };
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
88 AV_WN32(p, vv.hl[0]);
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
89 AV_WN32((uint8_t *)p + 4, vv.hl[1]);
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
90 }
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
91
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
92 #endif /* ARCH_MIPS64 */
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
93
03f6641ce9e5 MIPS: inline asm for intreadwrite.h
mru
parents:
diff changeset
94 #endif /* AVUTIL_MIPS_INTREADWRITE_H */