annotate mips/mathops.h @ 12514:e6d711ba5760 libavcodec

rawdec: ensure that there is always a valid palette for formats that should have one like gray8 etc.
author reimar
date Sat, 25 Sep 2010 08:44:35 +0000
parents 25136467a218
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9729
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
1 /*
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
2 * Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
3 *
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
4 * This file is part of FFmpeg.
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
5 *
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
10 *
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
14 * Lesser General Public License for more details.
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
15 *
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
19 */
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
20
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
21 #ifndef AVCODEC_MIPS_MATHOPS_H
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
22 #define AVCODEC_MIPS_MATHOPS_H
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
23
10077
5bf12cdf0cb6 Include required headers in {mips,ppc}/mathops.h
mru
parents: 9729
diff changeset
24 #include <stdint.h>
10080
25136467a218 Add necessary #include for config.h.
diego
parents: 10077
diff changeset
25 #include "config.h"
10077
5bf12cdf0cb6 Include required headers in {mips,ppc}/mathops.h
mru
parents: 9729
diff changeset
26 #include "libavutil/common.h"
9729
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
27
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
28 #if HAVE_LOONGSON
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
29
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
30 static inline av_const int64_t MAC64(int64_t d, int a, int b)
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
31 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
32 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
33 __asm__ ("dmult.g %1, %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
34 "daddu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
35 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
36 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
37 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
38 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
39
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
40 static inline av_const int64_t MLS64(int64_t d, int a, int b)
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
41 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
42 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
43 __asm__ ("dmult.g %1, %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
44 "dsubu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
45 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
46 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
47 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
48 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
49
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
50 #elif ARCH_MIPS64
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
51
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
52 static inline av_const int64_t MAC64(int64_t d, int a, int b)
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
53 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
54 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
55 __asm__ ("dmult %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
56 "mflo %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
57 "daddu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
58 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
59 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
60 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
61 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
62
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
63 static inline av_const int64_t MLS64(int64_t d, int a, int b)
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
64 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
65 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
66 __asm__ ("dmult %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
67 "mflo %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
68 "dsubu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
69 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
70 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
71 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
72 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
73
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
74 #endif
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
75
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
76 #endif /* AVCODEC_MIPS_MATHOPS_H */