annotate mips/mathops.h @ 10061:09f2db2d7c90 libavcodec

Fix bug caused by difference in stride and picture width. When a frame is allocated using libschroedinger routines, the frame data size does not match the actual frame size if the width is not a multiple of 16. So we cannot do a straightforward memcpy of the frame returned by libschroedinger into the FFmpeg picture as the stride differs from the width. Fix this bug by allocating for the libschroedinger frame with the dimensions in AVCodecContext within libavcodec and passing the frame to libschroedinger. patch by Anuradha Suraparaju, anuradha rd.bbc.co uk
author diego
date Sat, 15 Aug 2009 11:59:53 +0000
parents 8c680e33eeaa
children 5bf12cdf0cb6
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
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
24 #include "config.h"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
25
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
26 #if HAVE_LOONGSON
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 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
29 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
30 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
31 __asm__ ("dmult.g %1, %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
32 "daddu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
33 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
34 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
35 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
36 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
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 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
39 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
40 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
41 __asm__ ("dmult.g %1, %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
42 "dsubu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
43 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
44 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
45 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
46 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
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 #elif ARCH_MIPS64
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 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
51 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
52 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
53 __asm__ ("dmult %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
54 "mflo %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
55 "daddu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
56 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
57 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
58 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
59 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
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 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
62 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
63 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
64 __asm__ ("dmult %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
65 "mflo %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
66 "dsubu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
67 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
68 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
69 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
70 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
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 #endif
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 /* AVCODEC_MIPS_MATHOPS_H */