History

libavcodec/alpha: remove DSP & support code

Introduced in 1992, the Alpha was a 64-bit RISC processor designed to replace the VAX CISC machines sold by Digital Equipment Corporation. After Digital was acquired by Compaq in 1998 -- who themselves would be later purchased by Hewlett-Packard, the architecture was phased out over the following decade. It became effectively defunct in 2007, the last publicly available processor being the Alpha 21364. FFmpeg has not added any DSP code for this architecture since lowres2 was introduced in 2012, and it is more than unlikely someone still wishes to maintain it. Remove the DSP and support code.

Sean McGovern committed 2 years ago

Commit cdd139d1 parent a5d2d2623 files · +6 −1959Browse files

Unified · Split

23 files
  1. Changelog +1 −0
  2. configure +3 −12
  3. libavcodec/alpha/Makefile +0 −10
  4. libavcodec/alpha/asm.h +0 −153
  5. libavcodec/alpha/blockdsp_alpha.c +0 −49
  6. libavcodec/alpha/hpeldsp_alpha.c +0 −213
  7. libavcodec/alpha/hpeldsp_alpha.h +0 −28
  8. libavcodec/alpha/hpeldsp_alpha_asm.S +0 −125
  9. libavcodec/alpha/idctdsp_alpha.c +0 −127
  10. libavcodec/alpha/idctdsp_alpha.h +0 −34
  11. libavcodec/alpha/idctdsp_alpha_asm.S +0 −167
  12. libavcodec/alpha/me_cmp_alpha.c +0 −279
  13. libavcodec/alpha/me_cmp_mvi_asm.S +0 −179
  14. libavcodec/alpha/mpegvideo_alpha.c +0 −110
  15. libavcodec/alpha/pixblockdsp_alpha.c +0 −79
  16. libavcodec/alpha/regdef.h +0 −77
  17. libavcodec/alpha/simple_idct_alpha.c +0 −303
  18. libavcodec/blockdsp.c +1 −3
  19. libavcodec/hpeldsp.c +0 −2
  20. libavcodec/idctdsp.c +0 −2
  21. libavcodec/me_cmp.c +0 −2
  22. libavcodec/mpegvideo.c +1 −3
  23. libavcodec/pixblockdsp.c +0 −2
Changelog+1−0
@@ -12,6 +12,7 @@ version <next>: · 11 unmodified lines
12- qsv_params option added for QSV encoders12- qsv_params option added for QSV encoders
13- VVC decoder compatible with DVB test content13- VVC decoder compatible with DVB test content
14- xHE-AAC decoder14- xHE-AAC decoder
15- removed DEC Alpha DSP and support code
15 16
16 17
17version 7.0:18version 7.0:
configure+3−12
@@ -2128,7 +2128,6 @@ AUTODETECT_LIBS=" · 2127 unmodified lines
2128 2128
2129ARCH_LIST="2129ARCH_LIST="
2130 aarch642130 aarch64
2131 alpha
2132 arm2131 arm
2133 avr322132 avr32
2134 avr32_ap2133 avr32_ap
@@ -2815,8 +2814,8 @@ for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do · 680 unmodified lines
2815done2814done
2816 2815
2817aligned_stack_if_any="aarch64 ppc x86"2816aligned_stack_if_any="aarch64 ppc x86"
2818fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 riscv64 sparc64 x86_64"2817fast_64bit_if_any="aarch64 ia64 mips64 parisc64 ppc64 riscv64 sparc64 x86_64"
2819fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"2818fast_clz_if_any="aarch64 avr32 mips ppc x86"
2820fast_unaligned_if_any="aarch64 ppc x86"2819fast_unaligned_if_any="aarch64 ppc x86"
2821simd_align_16_if_any="altivec neon sse"2820simd_align_16_if_any="altivec neon sse"
2822simd_align_32_if_any="avx"2821simd_align_32_if_any="avx"
@@ -5274,10 +5273,6 @@ if enabled aarch64; then · 2451 unmodified lines
5274 ;;5273 ;;
5275 esac5274 esac
5276 5275
5277elif enabled alpha; then
5278
5279 cpuflags="-mcpu=$cpu"
5280
5281elif enabled arm; then5276elif enabled arm; then
5282 5277
5283 check_arm_arch() {5278 check_arm_arch() {
@@ -5659,7 +5654,7 @@ check_64bit(){ · 375 unmodified lines
5659}5654}
5660 5655
5661case "$arch" in5656case "$arch" in
5662 aarch64|alpha|ia64)5657 aarch64|ia64)
5663 enabled shared && enable_weak pic5658 enabled shared && enable_weak pic
5664 ;;5659 ;;
5665 loongarch)5660 loongarch)
@@ -6238,10 +6233,6 @@ if enabled aarch64; then · 572 unmodified lines
6238 enabled_any ${v}_external ${v}_inline || disable $v6233 enabled_any ${v}_external ${v}_inline || disable $v
6239 done6234 done
6240 6235
6241elif enabled alpha; then
6242
6243 check_cflags -mieee
6244
6245elif enabled arm; then6236elif enabled arm; then
6246 6237
6247 enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"6238 enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"
libavcodec/alpha/Makefile+0−10
@@ -1,10 +0,0 @@
1OBJS-$(CONFIG_BLOCKDSP) += alpha/blockdsp_alpha.o
2OBJS-$(CONFIG_ME_CMP) += alpha/me_cmp_alpha.o \
3 alpha/me_cmp_mvi_asm.o
4OBJS-$(CONFIG_HPELDSP) += alpha/hpeldsp_alpha.o \
5 alpha/hpeldsp_alpha_asm.o
6OBJS-$(CONFIG_IDCTDSP) += alpha/idctdsp_alpha.o \
7 alpha/idctdsp_alpha_asm.o \
8 alpha/simple_idct_alpha.o
9OBJS-$(CONFIG_MPEGVIDEO) += alpha/mpegvideo_alpha.o
10OBJS-$(CONFIG_PIXBLOCKDSP) += alpha/pixblockdsp_alpha.o
libavcodec/alpha/asm.h+0−153
@@ -1,153 +0,0 @@
1/*
2 * Alpha optimized DSP utils
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef AVCODEC_ALPHA_ASM_H
23#define AVCODEC_ALPHA_ASM_H
24
25#include <inttypes.h>
26
27#include "libavutil/common.h"
28
29#if AV_GCC_VERSION_AT_LEAST(2,96)
30# define likely(x) __builtin_expect((x) != 0, 1)
31# define unlikely(x) __builtin_expect((x) != 0, 0)
32#else
33# define likely(x) (x)
34# define unlikely(x) (x)
35#endif
36
37#define AMASK_BWX (1 << 0)
38#define AMASK_FIX (1 << 1)
39#define AMASK_CIX (1 << 2)
40#define AMASK_MVI (1 << 8)
41
42static inline uint64_t BYTE_VEC(uint64_t x)
43{
44 x |= x << 8;
45 x |= x << 16;
46 x |= x << 32;
47 return x;
48}
49static inline uint64_t WORD_VEC(uint64_t x)
50{
51 x |= x << 16;
52 x |= x << 32;
53 return x;
54}
55
56#define sextw(x) ((int16_t) (x))
57
58#ifdef __GNUC__
59#define ldq(p) \
60 (((const union { \
61 uint64_t __l; \
62 __typeof__(*(p)) __s[sizeof (uint64_t) / sizeof *(p)]; \
63 } *) (p))->__l)
64#define ldl(p) \
65 (((const union { \
66 int32_t __l; \
67 __typeof__(*(p)) __s[sizeof (int32_t) / sizeof *(p)]; \
68 } *) (p))->__l)
69#define stq(l, p) \
70 do { \
71 (((union { \
72 uint64_t __l; \
73 __typeof__(*(p)) __s[sizeof (uint64_t) / sizeof *(p)]; \
74 } *) (p))->__l) = l; \
75 } while (0)
76#define stl(l, p) \
77 do { \
78 (((union { \
79 int32_t __l; \
80 __typeof__(*(p)) __s[sizeof (int32_t) / sizeof *(p)]; \
81 } *) (p))->__l) = l; \
82 } while (0)
83struct unaligned_long { uint64_t l; } __attribute__((packed));
84#define ldq_u(p) (*(const uint64_t *) (((uint64_t) (p)) & ~7ul))
85#define uldq(a) (((const struct unaligned_long *) (a))->l)
86
87#if AV_GCC_VERSION_AT_LEAST(3,3)
88#define prefetch(p) __builtin_prefetch((p), 0, 1)
89#define prefetch_en(p) __builtin_prefetch((p), 0, 0)
90#define prefetch_m(p) __builtin_prefetch((p), 1, 1)
91#define prefetch_men(p) __builtin_prefetch((p), 1, 0)
92#define cmpbge __builtin_alpha_cmpbge
93/* Avoid warnings. */
94#define extql(a, b) __builtin_alpha_extql(a, (uint64_t) (b))
95#define extwl(a, b) __builtin_alpha_extwl(a, (uint64_t) (b))
96#define extqh(a, b) __builtin_alpha_extqh(a, (uint64_t) (b))
97#define zap __builtin_alpha_zap
98#define zapnot __builtin_alpha_zapnot
99#define amask __builtin_alpha_amask
100#define implver __builtin_alpha_implver
101#define rpcc __builtin_alpha_rpcc
102#else
103#define prefetch(p) __asm__ volatile("ldl $31,%0" : : "m"(*(const char *) (p)) : "memory")
104#define prefetch_en(p) __asm__ volatile("ldq $31,%0" : : "m"(*(const char *) (p)) : "memory")
105#define prefetch_m(p) __asm__ volatile("lds $f31,%0" : : "m"(*(const char *) (p)) : "memory")
106#define prefetch_men(p) __asm__ volatile("ldt $f31,%0" : : "m"(*(const char *) (p)) : "memory")
107#define cmpbge(a, b) ({ uint64_t __r; __asm__ ("cmpbge %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
108#define extql(a, b) ({ uint64_t __r; __asm__ ("extql %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
109#define extwl(a, b) ({ uint64_t __r; __asm__ ("extwl %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
110#define extqh(a, b) ({ uint64_t __r; __asm__ ("extqh %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
111#define zap(a, b) ({ uint64_t __r; __asm__ ("zap %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
112#define zapnot(a, b) ({ uint64_t __r; __asm__ ("zapnot %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
113#define amask(a) ({ uint64_t __r; __asm__ ("amask %1,%0" : "=r" (__r) : "rI" (a)); __r; })
114#define implver() ({ uint64_t __r; __asm__ ("implver %0" : "=r" (__r)); __r; })
115#define rpcc() ({ uint64_t __r; __asm__ volatile ("rpcc %0" : "=r" (__r)); __r; })
116#endif
117#define wh64(p) __asm__ volatile("wh64 (%0)" : : "r"(p) : "memory")
118
119#if AV_GCC_VERSION_AT_LEAST(3,3) && defined(__alpha_max__)
120#define minub8 __builtin_alpha_minub8
121#define minsb8 __builtin_alpha_minsb8
122#define minuw4 __builtin_alpha_minuw4
123#define minsw4 __builtin_alpha_minsw4
124#define maxub8 __builtin_alpha_maxub8
125#define maxsb8 __builtin_alpha_maxsb8
126#define maxuw4 __builtin_alpha_maxuw4
127#define maxsw4 __builtin_alpha_maxsw4
128#define perr __builtin_alpha_perr
129#define pklb __builtin_alpha_pklb
130#define pkwb __builtin_alpha_pkwb
131#define unpkbl __builtin_alpha_unpkbl
132#define unpkbw __builtin_alpha_unpkbw
133#else
134#define minub8(a, b) ({ uint64_t __r; __asm__ (".arch ev6; minub8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
135#define minsb8(a, b) ({ uint64_t __r; __asm__ (".arch ev6; minsb8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
136#define minuw4(a, b) ({ uint64_t __r; __asm__ (".arch ev6; minuw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
137#define minsw4(a, b) ({ uint64_t __r; __asm__ (".arch ev6; minsw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
138#define maxub8(a, b) ({ uint64_t __r; __asm__ (".arch ev6; maxub8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
139#define maxsb8(a, b) ({ uint64_t __r; __asm__ (".arch ev6; maxsb8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
140#define maxuw4(a, b) ({ uint64_t __r; __asm__ (".arch ev6; maxuw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
141#define maxsw4(a, b) ({ uint64_t __r; __asm__ (".arch ev6; maxsw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
142#define perr(a, b) ({ uint64_t __r; __asm__ (".arch ev6; perr %r1,%r2,%0" : "=r" (__r) : "%rJ" (a), "rJ" (b)); __r; })
143#define pklb(a) ({ uint64_t __r; __asm__ (".arch ev6; pklb %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
144#define pkwb(a) ({ uint64_t __r; __asm__ (".arch ev6; pkwb %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
145#define unpkbl(a) ({ uint64_t __r; __asm__ (".arch ev6; unpkbl %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
146#define unpkbw(a) ({ uint64_t __r; __asm__ (".arch ev6; unpkbw %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
147#endif
148
149#else
150#error "Unknown compiler!"
151#endif
152
153#endif /* AVCODEC_ALPHA_ASM_H */
libavcodec/alpha/blockdsp_alpha.c+0−49
@@ -1,49 +0,0 @@
1/*
2 * Alpha optimised block operations
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <stdint.h>
23
24#include "libavutil/attributes.h"
25#include "libavcodec/blockdsp.h"
26#include "asm.h"
27
28static void clear_blocks_axp(int16_t *blocks) {
29 uint64_t *p = (uint64_t *) blocks;
30 int n = sizeof(int16_t) * 6 * 64;
31
32 do {
33 p[0] = 0;
34 p[1] = 0;
35 p[2] = 0;
36 p[3] = 0;
37 p[4] = 0;
38 p[5] = 0;
39 p[6] = 0;
40 p[7] = 0;
41 p += 8;
42 n -= 8 * 8;
43 } while (n);
44}
45
46av_cold void ff_blockdsp_init_alpha(BlockDSPContext *c)
47{
48 c->clear_blocks = clear_blocks_axp;
49}
libavcodec/alpha/hpeldsp_alpha.c+0−213
@@ -1,213 +0,0 @@
1/*
2 * Alpha optimized DSP utils
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include "libavutil/attributes.h"
23#include "libavcodec/hpeldsp.h"
24#include "hpeldsp_alpha.h"
25#include "asm.h"
26
27static inline uint64_t avg2_no_rnd(uint64_t a, uint64_t b)
28{
29 return (a & b) + (((a ^ b) & BYTE_VEC(0xfe)) >> 1);
30}
31
32static inline uint64_t avg2(uint64_t a, uint64_t b)
33{
34 return (a | b) - (((a ^ b) & BYTE_VEC(0xfe)) >> 1);
35}
36
37#if 0
38/* The XY2 routines basically utilize this scheme, but reuse parts in
39 each iteration. */
40static inline uint64_t avg4(uint64_t l1, uint64_t l2, uint64_t l3, uint64_t l4)
41{
42 uint64_t r1 = ((l1 & ~BYTE_VEC(0x03)) >> 2)
43 + ((l2 & ~BYTE_VEC(0x03)) >> 2)
44 + ((l3 & ~BYTE_VEC(0x03)) >> 2)
45 + ((l4 & ~BYTE_VEC(0x03)) >> 2);
46 uint64_t r2 = (( (l1 & BYTE_VEC(0x03))
47 + (l2 & BYTE_VEC(0x03))
48 + (l3 & BYTE_VEC(0x03))
49 + (l4 & BYTE_VEC(0x03))
50 + BYTE_VEC(0x02)) >> 2) & BYTE_VEC(0x03);
51 return r1 + r2;
52}
53#endif
54
55#define OP(LOAD, STORE) \
56 do { \
57 STORE(LOAD(pixels), block); \
58 pixels += line_size; \
59 block += line_size; \
60 } while (--h)
61
62#define OP_X2(LOAD, STORE) \
63 do { \
64 uint64_t pix1, pix2; \
65 \
66 pix1 = LOAD(pixels); \
67 pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56); \
68 STORE(AVG2(pix1, pix2), block); \
69 pixels += line_size; \
70 block += line_size; \
71 } while (--h)
72
73#define OP_Y2(LOAD, STORE) \
74 do { \
75 uint64_t pix = LOAD(pixels); \
76 do { \
77 uint64_t next_pix; \
78 \
79 pixels += line_size; \
80 next_pix = LOAD(pixels); \
81 STORE(AVG2(pix, next_pix), block); \
82 block += line_size; \
83 pix = next_pix; \
84 } while (--h); \
85 } while (0)
86
87#define OP_XY2(LOAD, STORE) \
88 do { \
89 uint64_t pix1 = LOAD(pixels); \
90 uint64_t pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56); \
91 uint64_t pix_l = (pix1 & BYTE_VEC(0x03)) \
92 + (pix2 & BYTE_VEC(0x03)); \
93 uint64_t pix_h = ((pix1 & ~BYTE_VEC(0x03)) >> 2) \
94 + ((pix2 & ~BYTE_VEC(0x03)) >> 2); \
95 \
96 do { \
97 uint64_t npix1, npix2; \
98 uint64_t npix_l, npix_h; \
99 uint64_t avg; \
100 \
101 pixels += line_size; \
102 npix1 = LOAD(pixels); \
103 npix2 = npix1 >> 8 | ((uint64_t) pixels[8] << 56); \
104 npix_l = (npix1 & BYTE_VEC(0x03)) \
105 + (npix2 & BYTE_VEC(0x03)); \
106 npix_h = ((npix1 & ~BYTE_VEC(0x03)) >> 2) \
107 + ((npix2 & ~BYTE_VEC(0x03)) >> 2); \
108 avg = (((pix_l + npix_l + AVG4_ROUNDER) >> 2) & BYTE_VEC(0x03)) \
109 + pix_h + npix_h; \
110 STORE(avg, block); \
111 \
112 block += line_size; \
113 pix_l = npix_l; \
114 pix_h = npix_h; \
115 } while (--h); \
116 } while (0)
117
118#define MAKE_OP(OPNAME, SUFF, OPKIND, STORE) \
119static void OPNAME ## _pixels ## SUFF ## _axp \
120 (uint8_t *restrict block, const uint8_t *restrict pixels, \
121 ptrdiff_t line_size, int h) \
122{ \
123 if ((size_t) pixels & 0x7) { \
124 OPKIND(uldq, STORE); \
125 } else { \
126 OPKIND(ldq, STORE); \
127 } \
128} \
129 \
130static void OPNAME ## _pixels16 ## SUFF ## _axp \
131 (uint8_t *restrict block, const uint8_t *restrict pixels, \
132 ptrdiff_t line_size, int h) \
133{ \
134 OPNAME ## _pixels ## SUFF ## _axp(block, pixels, line_size, h); \
135 OPNAME ## _pixels ## SUFF ## _axp(block + 8, pixels + 8, line_size, h); \
136}
137
138#define PIXOP(OPNAME, STORE) \
139 MAKE_OP(OPNAME, , OP, STORE) \
140 MAKE_OP(OPNAME, _x2, OP_X2, STORE) \
141 MAKE_OP(OPNAME, _y2, OP_Y2, STORE) \
142 MAKE_OP(OPNAME, _xy2, OP_XY2, STORE)
143
144/* Rounding primitives. */
145#define AVG2 avg2
146#define AVG4 avg4
147#define AVG4_ROUNDER BYTE_VEC(0x02)
148#define STORE(l, b) stq(l, b)
149PIXOP(put, STORE);
150
151#undef STORE
152#define STORE(l, b) stq(AVG2(l, ldq(b)), b);
153PIXOP(avg, STORE);
154
155/* Not rounding primitives. */
156#undef AVG2
157#undef AVG4
158#undef AVG4_ROUNDER
159#undef STORE
160#define AVG2 avg2_no_rnd
161#define AVG4 avg4_no_rnd
162#define AVG4_ROUNDER BYTE_VEC(0x01)
163#define STORE(l, b) stq(l, b)
164PIXOP(put_no_rnd, STORE);
165
166#undef STORE
167#define STORE(l, b) stq(AVG2(l, ldq(b)), b);
168PIXOP(avg_no_rnd, STORE);
169
170static void put_pixels16_axp_asm(uint8_t *block, const uint8_t *pixels,
171 ptrdiff_t line_size, int h)
172{
173 put_pixels_axp_asm(block, pixels, line_size, h);
174 put_pixels_axp_asm(block + 8, pixels + 8, line_size, h);
175}
176
177av_cold void ff_hpeldsp_init_alpha(HpelDSPContext *c, int flags)
178{
179 c->put_pixels_tab[0][0] = put_pixels16_axp_asm;
180 c->put_pixels_tab[0][1] = put_pixels16_x2_axp;
181 c->put_pixels_tab[0][2] = put_pixels16_y2_axp;
182 c->put_pixels_tab[0][3] = put_pixels16_xy2_axp;
183
184 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_axp_asm;
185 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_axp;
186 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_axp;
187 c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_axp;
188
189 c->avg_pixels_tab[0][0] = avg_pixels16_axp;
190 c->avg_pixels_tab[0][1] = avg_pixels16_x2_axp;
191 c->avg_pixels_tab[0][2] = avg_pixels16_y2_axp;
192 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_axp;
193
194 c->avg_no_rnd_pixels_tab[0] = avg_no_rnd_pixels16_axp;
195 c->avg_no_rnd_pixels_tab[1] = avg_no_rnd_pixels16_x2_axp;
196 c->avg_no_rnd_pixels_tab[2] = avg_no_rnd_pixels16_y2_axp;
197 c->avg_no_rnd_pixels_tab[3] = avg_no_rnd_pixels16_xy2_axp;
198
199 c->put_pixels_tab[1][0] = put_pixels_axp_asm;
200 c->put_pixels_tab[1][1] = put_pixels_x2_axp;
201 c->put_pixels_tab[1][2] = put_pixels_y2_axp;
202 c->put_pixels_tab[1][3] = put_pixels_xy2_axp;
203
204 c->put_no_rnd_pixels_tab[1][0] = put_pixels_axp_asm;
205 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels_x2_axp;
206 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels_y2_axp;
207 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels_xy2_axp;
208
209 c->avg_pixels_tab[1][0] = avg_pixels_axp;
210 c->avg_pixels_tab[1][1] = avg_pixels_x2_axp;
211 c->avg_pixels_tab[1][2] = avg_pixels_y2_axp;
212 c->avg_pixels_tab[1][3] = avg_pixels_xy2_axp;
213}
libavcodec/alpha/hpeldsp_alpha.h+0−28
@@ -1,28 +0,0 @@
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg 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 * FFmpeg 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 FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef AVCODEC_ALPHA_HPELDSP_ALPHA_H
20#define AVCODEC_ALPHA_HPELDSP_ALPHA_H
21
22#include <stdint.h>
23#include <stddef.h>
24
25void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels,
26 ptrdiff_t line_size, int h);
27
28#endif /* AVCODEC_ALPHA_HPELDSP_ALPHA_H */
libavcodec/alpha/hpeldsp_alpha_asm.S+0−125
@@ -1,125 +0,0 @@
1/*
2 * Alpha optimized DSP utils
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/*
23 * These functions are scheduled for pca56. They should work
24 * reasonably on ev6, though.
25 */
26
27#include "regdef.h"
28
29
30 .set noat
31 .set noreorder
32 .arch pca56
33 .text
34
35/************************************************************************
36 * void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels,
37 * int line_size, int h)
38 */
39 .align 6
40 .globl put_pixels_axp_asm
41 .ent put_pixels_axp_asm
42put_pixels_axp_asm:
43 .frame sp, 0, ra
44 .prologue 0
45
46 and a1, 7, t0
47 beq t0, $aligned
48
49 .align 4
50$unaligned:
51 ldq_u t0, 0(a1)
52 ldq_u t1, 8(a1)
53 addq a1, a2, a1
54 nop
55
56 ldq_u t2, 0(a1)
57 ldq_u t3, 8(a1)
58 addq a1, a2, a1
59 nop
60
61 ldq_u t4, 0(a1)
62 ldq_u t5, 8(a1)
63 addq a1, a2, a1
64 nop
65
66 ldq_u t6, 0(a1)
67 ldq_u t7, 8(a1)
68 extql t0, a1, t0
69 addq a1, a2, a1
70
71 extqh t1, a1, t1
72 addq a0, a2, t8
73 extql t2, a1, t2
74 addq t8, a2, t9
75
76 extqh t3, a1, t3
77 addq t9, a2, ta
78 extql t4, a1, t4
79 or t0, t1, t0
80
81 extqh t5, a1, t5
82 or t2, t3, t2
83 extql t6, a1, t6
84 or t4, t5, t4
85
86 extqh t7, a1, t7
87 or t6, t7, t6
88 stq t0, 0(a0)
89 stq t2, 0(t8)
90
91 stq t4, 0(t9)
92 subq a3, 4, a3
93 stq t6, 0(ta)
94 addq ta, a2, a0
95
96 bne a3, $unaligned
97 ret
98
99 .align 4
100$aligned:
101 ldq t0, 0(a1)
102 addq a1, a2, a1
103 ldq t1, 0(a1)
104 addq a1, a2, a1
105
106 ldq t2, 0(a1)
107 addq a1, a2, a1
108 ldq t3, 0(a1)
109
110 addq a0, a2, t4
111 addq a1, a2, a1
112 addq t4, a2, t5
113 subq a3, 4, a3
114
115 stq t0, 0(a0)
116 addq t5, a2, t6
117 stq t1, 0(t4)
118 addq t6, a2, a0
119
120 stq t2, 0(t5)
121 stq t3, 0(t6)
122
123 bne a3, $aligned
124 ret
125 .end put_pixels_axp_asm
libavcodec/alpha/idctdsp_alpha.c+0−127
@@ -1,127 +0,0 @@
1/*
2 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "libavutil/attributes.h"
22#include "libavcodec/avcodec.h"
23#include "libavcodec/idctdsp.h"
24#include "idctdsp_alpha.h"
25#include "asm.h"
26
27void put_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
28 ptrdiff_t line_size);
29void add_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
30 ptrdiff_t line_size);
31
32void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
33 ptrdiff_t line_size);
34void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
35 ptrdiff_t line_size);
36
37#if 0
38/* These functions were the base for the optimized assembler routines,
39 and remain here for documentation purposes. */
40static void put_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels,
41 ptrdiff_t line_size)
42{
43 int i = 8;
44 uint64_t clampmask = zap(-1, 0xaa); /* 0x00ff00ff00ff00ff */
45
46 do {
47 uint64_t shorts0, shorts1;
48
49 shorts0 = ldq(block);
50 shorts0 = maxsw4(shorts0, 0);
51 shorts0 = minsw4(shorts0, clampmask);
52 stl(pkwb(shorts0), pixels);
53
54 shorts1 = ldq(block + 4);
55 shorts1 = maxsw4(shorts1, 0);
56 shorts1 = minsw4(shorts1, clampmask);
57 stl(pkwb(shorts1), pixels + 4);
58
59 pixels += line_size;
60 block += 8;
61 } while (--i);
62}
63
64void add_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels,
65 ptrdiff_t line_size)
66{
67 int h = 8;
68 /* Keep this function a leaf function by generating the constants
69 manually (mainly for the hack value ;-). */
70 uint64_t clampmask = zap(-1, 0xaa); /* 0x00ff00ff00ff00ff */
71 uint64_t signmask = zap(-1, 0x33);
72 signmask ^= signmask >> 1; /* 0x8000800080008000 */
73
74 do {
75 uint64_t shorts0, pix0, signs0;
76 uint64_t shorts1, pix1, signs1;
77
78 shorts0 = ldq(block);
79 shorts1 = ldq(block + 4);
80
81 pix0 = unpkbw(ldl(pixels));
82 /* Signed subword add (MMX paddw). */
83 signs0 = shorts0 & signmask;
84 shorts0 &= ~signmask;
85 shorts0 += pix0;
86 shorts0 ^= signs0;
87 /* Clamp. */
88 shorts0 = maxsw4(shorts0, 0);
89 shorts0 = minsw4(shorts0, clampmask);
90
91 /* Next 4. */
92 pix1 = unpkbw(ldl(pixels + 4));
93 signs1 = shorts1 & signmask;
94 shorts1 &= ~signmask;
95 shorts1 += pix1;
96 shorts1 ^= signs1;
97 shorts1 = maxsw4(shorts1, 0);
98 shorts1 = minsw4(shorts1, clampmask);
99
100 stl(pkwb(shorts0), pixels);
101 stl(pkwb(shorts1), pixels + 4);
102
103 pixels += line_size;
104 block += 8;
105 } while (--h);
106}
107#endif
108
109av_cold void ff_idctdsp_init_alpha(IDCTDSPContext *c, AVCodecContext *avctx,
110 unsigned high_bit_depth)
111{
112 /* amask clears all bits that correspond to present features. */
113 if (amask(AMASK_MVI) == 0) {
114 c->put_pixels_clamped = put_pixels_clamped_mvi_asm;
115 c->add_pixels_clamped = add_pixels_clamped_mvi_asm;
116 }
117
118 put_pixels_clamped_axp_p = c->put_pixels_clamped;
119 add_pixels_clamped_axp_p = c->add_pixels_clamped;
120
121 if (!high_bit_depth && !avctx->lowres &&
122 (avctx->idct_algo == FF_IDCT_AUTO)) {
123 c->idct_put = ff_simple_idct_put_axp;
124 c->idct_add = ff_simple_idct_add_axp;
125 c->idct = ff_simple_idct_axp;
126 }
127}
libavcodec/alpha/idctdsp_alpha.h+0−34
@@ -1,34 +0,0 @@
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg 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 * FFmpeg 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 FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef AVCODEC_ALPHA_IDCTDSP_ALPHA_H
20#define AVCODEC_ALPHA_IDCTDSP_ALPHA_H
21
22#include <stddef.h>
23#include <stdint.h>
24
25extern void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
26 ptrdiff_t line_size);
27extern void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
28 ptrdiff_t line_size);
29
30void ff_simple_idct_axp(int16_t *block);
31void ff_simple_idct_put_axp(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
32void ff_simple_idct_add_axp(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
33
34#endif /* AVCODEC_ALPHA_IDCTDSP_ALPHA_H */
libavcodec/alpha/idctdsp_alpha_asm.S+0−167
@@ -1,167 +0,0 @@
1/*
2 * Alpha optimized IDCT-related routines
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/*
23 * These functions are scheduled for pca56. They should work
24 * reasonably on ev6, though.
25 */
26
27#include "regdef.h"
28
29 .set noat
30 .set noreorder
31 .arch pca56
32 .text
33
34/************************************************************************
35 * void put_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
36 * ptrdiff_t line_size)
37 */
38 .align 6
39 .globl put_pixels_clamped_mvi_asm
40 .ent put_pixels_clamped_mvi_asm
41put_pixels_clamped_mvi_asm:
42 .frame sp, 0, ra
43 .prologue 0
44
45 lda t8, -1
46 lda t9, 8 # loop counter
47 zap t8, 0xaa, t8 # 00ff00ff00ff00ff
48
49 .align 4
501: ldq t0, 0(a0)
51 ldq t1, 8(a0)
52 ldq t2, 16(a0)
53 ldq t3, 24(a0)
54
55 maxsw4 t0, zero, t0
56 subq t9, 2, t9
57 maxsw4 t1, zero, t1
58 lda a0, 32(a0)
59
60 maxsw4 t2, zero, t2
61 addq a1, a2, ta
62 maxsw4 t3, zero, t3
63 minsw4 t0, t8, t0
64
65 minsw4 t1, t8, t1
66 minsw4 t2, t8, t2
67 minsw4 t3, t8, t3
68 pkwb t0, t0
69
70 pkwb t1, t1
71 pkwb t2, t2
72 pkwb t3, t3
73 stl t0, 0(a1)
74
75 stl t1, 4(a1)
76 addq ta, a2, a1
77 stl t2, 0(ta)
78 stl t3, 4(ta)
79
80 bne t9, 1b
81 ret
82 .end put_pixels_clamped_mvi_asm
83
84/************************************************************************
85 * void add_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
86 * ptrdiff_t line_size)
87 */
88 .align 6
89 .globl add_pixels_clamped_mvi_asm
90 .ent add_pixels_clamped_mvi_asm
91add_pixels_clamped_mvi_asm:
92 .frame sp, 0, ra
93 .prologue 0
94
95 lda t1, -1
96 lda th, 8
97 zap t1, 0x33, tg
98 nop
99
100 srl tg, 1, t0
101 xor tg, t0, tg # 0x8000800080008000
102 zap t1, 0xaa, tf # 0x00ff00ff00ff00ff
103
104 .align 4
1051: ldl t1, 0(a1) # pix0 (try to hit cache line soon)
106 ldl t4, 4(a1) # pix1
107 addq a1, a2, te # pixels += line_size
108 ldq t0, 0(a0) # shorts0
109
110 ldl t7, 0(te) # pix2 (try to hit cache line soon)
111 ldl ta, 4(te) # pix3
112 ldq t3, 8(a0) # shorts1
113 ldq t6, 16(a0) # shorts2
114
115 ldq t9, 24(a0) # shorts3
116 unpkbw t1, t1 # 0 0 (quarter/op no.)
117 and t0, tg, t2 # 0 1
118 unpkbw t4, t4 # 1 0
119
120 bic t0, tg, t0 # 0 2
121 unpkbw t7, t7 # 2 0
122 and t3, tg, t5 # 1 1
123 addq t0, t1, t0 # 0 3
124
125 xor t0, t2, t0 # 0 4
126 unpkbw ta, ta # 3 0
127 and t6, tg, t8 # 2 1
128 maxsw4 t0, zero, t0 # 0 5
129
130 bic t3, tg, t3 # 1 2
131 bic t6, tg, t6 # 2 2
132 minsw4 t0, tf, t0 # 0 6
133 addq t3, t4, t3 # 1 3
134
135 pkwb t0, t0 # 0 7
136 xor t3, t5, t3 # 1 4
137 maxsw4 t3, zero, t3 # 1 5
138 addq t6, t7, t6 # 2 3
139
140 xor t6, t8, t6 # 2 4
141 and t9, tg, tb # 3 1
142 minsw4 t3, tf, t3 # 1 6
143 bic t9, tg, t9 # 3 2
144
145 maxsw4 t6, zero, t6 # 2 5
146 addq t9, ta, t9 # 3 3
147 stl t0, 0(a1) # 0 8
148 minsw4 t6, tf, t6 # 2 6
149
150 xor t9, tb, t9 # 3 4
151 maxsw4 t9, zero, t9 # 3 5
152 lda a0, 32(a0) # block += 16;
153 pkwb t3, t3 # 1 7
154
155 minsw4 t9, tf, t9 # 3 6
156 subq th, 2, th
157 pkwb t6, t6 # 2 7
158 pkwb t9, t9 # 3 7
159
160 stl t3, 4(a1) # 1 8
161 addq te, a2, a1 # pixels += line_size
162 stl t6, 0(te) # 2 8
163 stl t9, 4(te) # 3 8
164
165 bne th, 1b
166 ret
167 .end add_pixels_clamped_mvi_asm
libavcodec/alpha/me_cmp_alpha.c+0−279
@@ -1,279 +0,0 @@
1/*
2 * Alpha optimized DSP utils
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include "libavutil/attributes.h"
23#include "libavcodec/me_cmp.h"
24#include "asm.h"
25
26int pix_abs16x16_mvi_asm(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
27 ptrdiff_t line_size, int h);
28
29static inline uint64_t avg2(uint64_t a, uint64_t b)
30{
31 return (a | b) - (((a ^ b) & BYTE_VEC(0xfe)) >> 1);
32}
33
34static inline uint64_t avg4(uint64_t l1, uint64_t l2, uint64_t l3, uint64_t l4)
35{
36 uint64_t r1 = ((l1 & ~BYTE_VEC(0x03)) >> 2)
37 + ((l2 & ~BYTE_VEC(0x03)) >> 2)
38 + ((l3 & ~BYTE_VEC(0x03)) >> 2)
39 + ((l4 & ~BYTE_VEC(0x03)) >> 2);
40 uint64_t r2 = (( (l1 & BYTE_VEC(0x03))
41 + (l2 & BYTE_VEC(0x03))
42 + (l3 & BYTE_VEC(0x03))
43 + (l4 & BYTE_VEC(0x03))
44 + BYTE_VEC(0x02)) >> 2) & BYTE_VEC(0x03);
45 return r1 + r2;
46}
47
48static int pix_abs8x8_mvi(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
49 ptrdiff_t line_size, int h)
50{
51 int result = 0;
52
53 if ((size_t) pix2 & 0x7) {
54 /* works only when pix2 is actually unaligned */
55 do { /* do 8 pixel a time */
56 uint64_t p1, p2;
57
58 p1 = ldq(pix1);
59 p2 = uldq(pix2);
60 result += perr(p1, p2);
61
62 pix1 += line_size;
63 pix2 += line_size;
64 } while (--h);
65 } else {
66 do {
67 uint64_t p1, p2;
68
69 p1 = ldq(pix1);
70 p2 = ldq(pix2);
71 result += perr(p1, p2);
72
73 pix1 += line_size;
74 pix2 += line_size;
75 } while (--h);
76 }
77
78 return result;
79}
80
81static int pix_abs16x16_x2_mvi(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
82 ptrdiff_t line_size, int h)
83{
84 int result = 0;
85 uint64_t disalign = (size_t) pix2 & 0x7;
86
87 switch (disalign) {
88 case 0:
89 do {
90 uint64_t p1_l, p1_r, p2_l, p2_r;
91 uint64_t l, r;
92
93 p1_l = ldq(pix1);
94 p1_r = ldq(pix1 + 8);
95 l = ldq(pix2);
96 r = ldq(pix2 + 8);
97 p2_l = avg2(l, (l >> 8) | ((uint64_t) r << 56));
98 p2_r = avg2(r, (r >> 8) | ((uint64_t) pix2[16] << 56));
99 pix1 += line_size;
100 pix2 += line_size;
101
102 result += perr(p1_l, p2_l)
103 + perr(p1_r, p2_r);
104 } while (--h);
105 break;
106 case 7:
107 /* |.......l|lllllllr|rrrrrrr*|
108 This case is special because disalign1 would be 8, which
109 gets treated as 0 by extqh. At least it is a bit faster
110 that way :) */
111 do {
112 uint64_t p1_l, p1_r, p2_l, p2_r;
113 uint64_t l, m, r;
114
115 p1_l = ldq(pix1);
116 p1_r = ldq(pix1 + 8);
117 l = ldq_u(pix2);
118 m = ldq_u(pix2 + 8);
119 r = ldq_u(pix2 + 16);
120 p2_l = avg2(extql(l, disalign) | extqh(m, disalign), m);
121 p2_r = avg2(extql(m, disalign) | extqh(r, disalign), r);
122 pix1 += line_size;
123 pix2 += line_size;
124
125 result += perr(p1_l, p2_l)
126 + perr(p1_r, p2_r);
127 } while (--h);
128 break;
129 default:
130 do {
131 uint64_t disalign1 = disalign + 1;
132 uint64_t p1_l, p1_r, p2_l, p2_r;
133 uint64_t l, m, r;
134
135 p1_l = ldq(pix1);
136 p1_r = ldq(pix1 + 8);
137 l = ldq_u(pix2);
138 m = ldq_u(pix2 + 8);
139 r = ldq_u(pix2 + 16);
140 p2_l = avg2(extql(l, disalign) | extqh(m, disalign),
141 extql(l, disalign1) | extqh(m, disalign1));
142 p2_r = avg2(extql(m, disalign) | extqh(r, disalign),
143 extql(m, disalign1) | extqh(r, disalign1));
144 pix1 += line_size;
145 pix2 += line_size;
146
147 result += perr(p1_l, p2_l)
148 + perr(p1_r, p2_r);
149 } while (--h);
150 break;
151 }
152 return result;
153}
154
155static int pix_abs16x16_y2_mvi(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
156 ptrdiff_t line_size, int h)
157{
158 int result = 0;
159
160 if ((size_t) pix2 & 0x7) {
161 uint64_t t, p2_l, p2_r;
162 t = ldq_u(pix2 + 8);
163 p2_l = extql(ldq_u(pix2), pix2) | extqh(t, pix2);
164 p2_r = extql(t, pix2) | extqh(ldq_u(pix2 + 16), pix2);
165
166 do {
167 uint64_t p1_l, p1_r, np2_l, np2_r;
168 uint64_t t;
169
170 p1_l = ldq(pix1);
171 p1_r = ldq(pix1 + 8);
172 pix2 += line_size;
173 t = ldq_u(pix2 + 8);
174 np2_l = extql(ldq_u(pix2), pix2) | extqh(t, pix2);
175 np2_r = extql(t, pix2) | extqh(ldq_u(pix2 + 16), pix2);
176
177 result += perr(p1_l, avg2(p2_l, np2_l))
178 + perr(p1_r, avg2(p2_r, np2_r));
179
180 pix1 += line_size;
181 p2_l = np2_l;
182 p2_r = np2_r;
183
184 } while (--h);
185 } else {
186 uint64_t p2_l, p2_r;
187 p2_l = ldq(pix2);
188 p2_r = ldq(pix2 + 8);
189 do {
190 uint64_t p1_l, p1_r, np2_l, np2_r;
191
192 p1_l = ldq(pix1);
193 p1_r = ldq(pix1 + 8);
194 pix2 += line_size;
195 np2_l = ldq(pix2);
196 np2_r = ldq(pix2 + 8);
197
198 result += perr(p1_l, avg2(p2_l, np2_l))
199 + perr(p1_r, avg2(p2_r, np2_r));
200
201 pix1 += line_size;
202 p2_l = np2_l;
203 p2_r = np2_r;
204 } while (--h);
205 }
206 return result;
207}
208
209static int pix_abs16x16_xy2_mvi(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
210 ptrdiff_t line_size, int h)
211{
212 int result = 0;
213
214 uint64_t p1_l, p1_r;
215 uint64_t p2_l, p2_r, p2_x;
216
217 p1_l = ldq(pix1);
218 p1_r = ldq(pix1 + 8);
219
220 if ((size_t) pix2 & 0x7) { /* could be optimized a lot */
221 p2_l = uldq(pix2);
222 p2_r = uldq(pix2 + 8);
223 p2_x = (uint64_t) pix2[16] << 56;
224 } else {
225 p2_l = ldq(pix2);
226 p2_r = ldq(pix2 + 8);
227 p2_x = ldq(pix2 + 16) << 56;
228 }
229
230 do {
231 uint64_t np1_l, np1_r;
232 uint64_t np2_l, np2_r, np2_x;
233
234 pix1 += line_size;
235 pix2 += line_size;
236
237 np1_l = ldq(pix1);
238 np1_r = ldq(pix1 + 8);
239
240 if ((size_t) pix2 & 0x7) { /* could be optimized a lot */
241 np2_l = uldq(pix2);
242 np2_r = uldq(pix2 + 8);
243 np2_x = (uint64_t) pix2[16] << 56;
244 } else {
245 np2_l = ldq(pix2);
246 np2_r = ldq(pix2 + 8);
247 np2_x = ldq(pix2 + 16) << 56;
248 }
249
250 result += perr(p1_l,
251 avg4( p2_l, ( p2_l >> 8) | ((uint64_t) p2_r << 56),
252 np2_l, (np2_l >> 8) | ((uint64_t) np2_r << 56)))
253 + perr(p1_r,
254 avg4( p2_r, ( p2_r >> 8) | ((uint64_t) p2_x),
255 np2_r, (np2_r >> 8) | ((uint64_t) np2_x)));
256
257 p1_l = np1_l;
258 p1_r = np1_r;
259 p2_l = np2_l;
260 p2_r = np2_r;
261 p2_x = np2_x;
262 } while (--h);
263
264 return result;
265}
266
267av_cold void ff_me_cmp_init_alpha(MECmpContext *c, AVCodecContext *avctx)
268{
269 /* amask clears all bits that correspond to present features. */
270 if (amask(AMASK_MVI) == 0) {
271 c->sad[0] = pix_abs16x16_mvi_asm;
272 c->sad[1] = pix_abs8x8_mvi;
273 c->pix_abs[0][0] = pix_abs16x16_mvi_asm;
274 c->pix_abs[1][0] = pix_abs8x8_mvi;
275 c->pix_abs[0][1] = pix_abs16x16_x2_mvi;
276 c->pix_abs[0][2] = pix_abs16x16_y2_mvi;
277 c->pix_abs[0][3] = pix_abs16x16_xy2_mvi;
278 }
279}
libavcodec/alpha/me_cmp_mvi_asm.S+0−179
@@ -1,179 +0,0 @@
1/*
2 * Alpha optimized DSP utils
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include "regdef.h"
23
24/* Some nicer register names. */
25#define ta t10
26#define tb t11
27#define tc t12
28#define td AT
29/* Danger: these overlap with the argument list and the return value */
30#define te a5
31#define tf a4
32#define tg a3
33#define th v0
34
35 .set noat
36 .set noreorder
37 .arch pca56
38 .text
39
40/*****************************************************************************
41 * int pix_abs16x16_mvi_asm(const uint8_t *pix1, const uint8_t *pix2, int line_size)
42 *
43 * This code is written with a pca56 in mind. For ev6, one should
44 * really take the increased latency of 3 cycles for MVI instructions
45 * into account.
46 *
47 * It is important to keep the loading and first use of a register as
48 * far apart as possible, because if a register is accessed before it
49 * has been fetched from memory, the CPU will stall.
50 */
51 .align 4
52 .globl pix_abs16x16_mvi_asm
53 .ent pix_abs16x16_mvi_asm
54pix_abs16x16_mvi_asm:
55 .frame sp, 0, ra, 0
56 .prologue 0
57
58 and a2, 7, t0
59 clr v0
60 beq t0, $aligned
61 .align 4
62$unaligned:
63 /* Registers:
64 line 0:
65 t0: left_u -> left lo -> left
66 t1: mid
67 t2: right_u -> right hi -> right
68 t3: ref left
69 t4: ref right
70 line 1:
71 t5: left_u -> left lo -> left
72 t6: mid
73 t7: right_u -> right hi -> right
74 t8: ref left
75 t9: ref right
76 temp:
77 ta: left hi
78 tb: right lo
79 tc: error left
80 td: error right */
81
82 /* load line 0 */
83 ldq_u t0, 0(a2) # left_u
84 ldq_u t1, 8(a2) # mid
85 ldq_u t2, 16(a2) # right_u
86 ldq t3, 0(a1) # ref left
87 ldq t4, 8(a1) # ref right
88 addq a1, a3, a1 # pix1
89 addq a2, a3, a2 # pix2
90 /* load line 1 */
91 ldq_u t5, 0(a2) # left_u
92 ldq_u t6, 8(a2) # mid
93 ldq_u t7, 16(a2) # right_u
94 ldq t8, 0(a1) # ref left
95 ldq t9, 8(a1) # ref right
96 addq a1, a3, a1 # pix1
97 addq a2, a3, a2 # pix2
98 /* calc line 0 */
99 extql t0, a2, t0 # left lo
100 extqh t1, a2, ta # left hi
101 extql t1, a2, tb # right lo
102 or t0, ta, t0 # left
103 extqh t2, a2, t2 # right hi
104 perr t3, t0, tc # error left
105 or t2, tb, t2 # right
106 perr t4, t2, td # error right
107 addq v0, tc, v0 # add error left
108 addq v0, td, v0 # add error left
109 /* calc line 1 */
110 extql t5, a2, t5 # left lo
111 extqh t6, a2, ta # left hi
112 extql t6, a2, tb # right lo
113 or t5, ta, t5 # left
114 extqh t7, a2, t7 # right hi
115 perr t8, t5, tc # error left
116 or t7, tb, t7 # right
117 perr t9, t7, td # error right
118 addq v0, tc, v0 # add error left
119 addq v0, td, v0 # add error left
120 /* loop */
121 subq a4, 2, a4 # h -= 2
122 bne a4, $unaligned
123 ret
124
125 .align 4
126$aligned:
127 /* load line 0 */
128 ldq t0, 0(a2) # left
129 ldq t1, 8(a2) # right
130 addq a2, a3, a2 # pix2
131 ldq t2, 0(a1) # ref left
132 ldq t3, 8(a1) # ref right
133 addq a1, a3, a1 # pix1
134 /* load line 1 */
135 ldq t4, 0(a2) # left
136 ldq t5, 8(a2) # right
137 addq a2, a3, a2 # pix2
138 ldq t6, 0(a1) # ref left
139 ldq t7, 8(a1) # ref right
140 addq a1, a3, a1 # pix1
141 /* load line 2 */
142 ldq t8, 0(a2) # left
143 ldq t9, 8(a2) # right
144 addq a2, a3, a2 # pix2
145 ldq ta, 0(a1) # ref left
146 ldq tb, 8(a1) # ref right
147 addq a1, a3, a1 # pix1
148 /* load line 3 */
149 ldq tc, 0(a2) # left
150 ldq td, 8(a2) # right
151 addq a2, a3, a2 # pix2
152 ldq te, 0(a1) # ref left
153 ldq a0, 8(a1) # ref right
154 /* calc line 0 */
155 perr t0, t2, t0 # error left
156 addq a1, a3, a1 # pix1
157 perr t1, t3, t1 # error right
158 addq v0, t0, v0 # add error left
159 /* calc line 1 */
160 perr t4, t6, t0 # error left
161 addq v0, t1, v0 # add error right
162 perr t5, t7, t1 # error right
163 addq v0, t0, v0 # add error left
164 /* calc line 2 */
165 perr t8, ta, t0 # error left
166 addq v0, t1, v0 # add error right
167 perr t9, tb, t1 # error right
168 addq v0, t0, v0 # add error left
169 /* calc line 3 */
170 perr tc, te, t0 # error left
171 addq v0, t1, v0 # add error right
172 perr td, a0, t1 # error right
173 addq v0, t0, v0 # add error left
174 addq v0, t1, v0 # add error right
175 /* loop */
176 subq a4, 4, a4 # h -= 4
177 bne a4, $aligned
178 ret
179 .end pix_abs16x16_mvi_asm
libavcodec/alpha/mpegvideo_alpha.c+0−110
@@ -1,110 +0,0 @@
1/*
2 * Alpha optimized DSP utils
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include "libavutil/attributes.h"
23#include "libavcodec/mpegvideo.h"
24#include "asm.h"
25
26static void dct_unquantize_h263_axp(int16_t *block, int n_coeffs,
27 uint64_t qscale, uint64_t qadd)
28{
29 uint64_t qmul = qscale << 1;
30 uint64_t correction = WORD_VEC(qmul * 255 >> 8);
31 int i;
32
33 qadd = WORD_VEC(qadd);
34
35 for(i = 0; i <= n_coeffs; block += 4, i += 4) {
36 uint64_t levels, negmask, zeros, add, sub;
37
38 levels = ldq(block);
39 if (levels == 0)
40 continue;
41
42#ifdef __alpha_max__
43 /* I don't think the speed difference justifies runtime
44 detection. */
45 negmask = maxsw4(levels, -1); /* negative -> ffff (-1) */
46 negmask = minsw4(negmask, 0); /* positive -> 0000 (0) */
47#else
48 negmask = cmpbge(WORD_VEC(0x7fff), levels);
49 negmask &= (negmask >> 1) | (1 << 7);
50 negmask = zap(-1, negmask);
51#endif
52
53 zeros = cmpbge(0, levels);
54 zeros &= zeros >> 1;
55 /* zeros |= zeros << 1 is not needed since qadd <= 255, so
56 zapping the lower byte suffices. */
57
58 levels *= qmul;
59 levels -= correction & (negmask << 16);
60
61 add = qadd & ~negmask;
62 sub = qadd & negmask;
63 /* Set qadd to 0 for levels == 0. */
64 add = zap(add, zeros);
65 levels += add;
66 levels -= sub;
67
68 stq(levels, block);
69 }
70}
71
72static void dct_unquantize_h263_intra_axp(MpegEncContext *s, int16_t *block,
73 int n, int qscale)
74{
75 int n_coeffs;
76 uint64_t qadd;
77 int16_t block0 = block[0];
78
79 if (!s->h263_aic) {
80 if (n < 4)
81 block0 *= s->y_dc_scale;
82 else
83 block0 *= s->c_dc_scale;
84 qadd = (qscale - 1) | 1;
85 } else {
86 qadd = 0;
87 }
88
89 if(s->ac_pred)
90 n_coeffs = 63;
91 else
92 n_coeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
93
94 dct_unquantize_h263_axp(block, n_coeffs, qscale, qadd);
95
96 block[0] = block0;
97}
98
99static void dct_unquantize_h263_inter_axp(MpegEncContext *s, int16_t *block,
100 int n, int qscale)
101{
102 int n_coeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
103 dct_unquantize_h263_axp(block, n_coeffs, qscale, (qscale - 1) | 1);
104}
105
106av_cold void ff_mpv_common_init_axp(MpegEncContext *s)
107{
108 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_axp;
109 s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_axp;
110}
libavcodec/alpha/pixblockdsp_alpha.c+0−79
@@ -1,79 +0,0 @@
1/*
2 * SIMD-optimized pixel operations
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "libavutil/attributes.h"
22#include "libavcodec/pixblockdsp.h"
23#include "asm.h"
24
25static void get_pixels_mvi(int16_t *restrict block,
26 const uint8_t *restrict pixels, ptrdiff_t stride)
27{
28 int h = 8;
29
30 do {
31 uint64_t p;
32
33 p = ldq(pixels);
34 stq(unpkbw(p), block);
35 stq(unpkbw(p >> 32), block + 4);
36
37 pixels += stride;
38 block += 8;
39 } while (--h);
40}
41
42static void diff_pixels_mvi(int16_t *block, const uint8_t *s1, const uint8_t *s2,
43 ptrdiff_t stride)
44{
45 int h = 8;
46 uint64_t mask = 0x4040;
47
48 mask |= mask << 16;
49 mask |= mask << 32;
50 do {
51 uint64_t x, y, c, d, a;
52 uint64_t signs;
53
54 x = ldq(s1);
55 y = ldq(s2);
56 c = cmpbge(x, y);
57 d = x - y;
58 a = zap(mask, c); /* We use 0x4040404040404040 here... */
59 d += 4 * a; /* ...so we can use s4addq here. */
60 signs = zap(-1, c);
61
62 stq(unpkbw(d) | (unpkbw(signs) << 8), block);
63 stq(unpkbw(d >> 32) | (unpkbw(signs >> 32) << 8), block + 4);
64
65 s1 += stride;
66 s2 += stride;
67 block += 8;
68 } while (--h);
69}
70
71av_cold void ff_pixblockdsp_init_alpha(PixblockDSPContext *c, AVCodecContext *avctx,
72 unsigned high_bit_depth)
73{
74 if (amask(AMASK_MVI) == 0) {
75 if (!high_bit_depth)
76 c->get_pixels = get_pixels_mvi;
77 c->diff_pixels = diff_pixels_mvi;
78 }
79}
libavcodec/alpha/regdef.h+0−77
@@ -1,77 +0,0 @@
1/*
2 * Alpha optimized DSP utils
3 * copyright (c) 2002 Falk Hueffner <falk@debian.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/* Some BSDs don't seem to have regdef.h... sigh */
23#ifndef AVCODEC_ALPHA_REGDEF_H
24#define AVCODEC_ALPHA_REGDEF_H
25
26#define v0 $0 /* function return value */
27
28#define t0 $1 /* temporary registers (caller-saved) */
29#define t1 $2
30#define t2 $3
31#define t3 $4
32#define t4 $5
33#define t5 $6
34#define t6 $7
35#define t7 $8
36
37#define s0 $9 /* saved-registers (callee-saved registers) */
38#define s1 $10
39#define s2 $11
40#define s3 $12
41#define s4 $13
42#define s5 $14
43#define s6 $15
44#define fp s6 /* frame-pointer (s6 in frame-less procedures) */
45
46#define a0 $16 /* argument registers (caller-saved) */
47#define a1 $17
48#define a2 $18
49#define a3 $19
50#define a4 $20
51#define a5 $21
52
53#define t8 $22 /* more temps (caller-saved) */
54#define t9 $23
55#define t10 $24
56#define t11 $25
57#define ra $26 /* return address register */
58#define t12 $27
59
60#define pv t12 /* procedure-variable register */
61#define AT $at /* assembler temporary */
62#define gp $29 /* global pointer */
63#define sp $30 /* stack pointer */
64#define zero $31 /* reads as zero, writes are noops */
65
66/* Some nicer register names. */
67#define ta t10
68#define tb t11
69#define tc t12
70#define td AT
71/* Danger: these overlap with the argument list and the return value */
72#define te a5
73#define tf a4
74#define tg a3
75#define th v0
76
77#endif /* AVCODEC_ALPHA_REGDEF_H */
libavcodec/alpha/simple_idct_alpha.c+0−303
@@ -1,303 +0,0 @@
1/*
2 * Simple IDCT (Alpha optimized)
3 *
4 * Copyright (c) 2001 Michael Niedermayer <michaelni@gmx.at>
5 *
6 * based upon some outcommented C code from mpeg2dec (idct_mmx.c
7 * written by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>)
8 *
9 * Alpha optimizations by Måns Rullgård <mans@mansr.com>
10 * and Falk Hueffner <falk@debian.org>
11 *
12 * This file is part of FFmpeg.
13 *
14 * FFmpeg is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * FFmpeg is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with FFmpeg; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28
29#include "idctdsp_alpha.h"
30#include "asm.h"
31
32// cos(i * M_PI / 16) * sqrt(2) * (1 << 14)
33// W4 is actually exactly 16384, but using 16383 works around
34// accumulating rounding errors for some encoders
35#define W1 22725
36#define W2 21407
37#define W3 19266
38#define W4 16383
39#define W5 12873
40#define W6 8867
41#define W7 4520
42#define ROW_SHIFT 11
43#define COL_SHIFT 20
44
45/* 0: all entries 0, 1: only first entry nonzero, 2: otherwise */
46static inline int idct_row(int16_t *row)
47{
48 int a0, a1, a2, a3, b0, b1, b2, b3, t;
49 uint64_t l, r, t2;
50 l = ldq(row);
51 r = ldq(row + 4);
52
53 if (l == 0 && r == 0)
54 return 0;
55
56 a0 = W4 * sextw(l) + (1 << (ROW_SHIFT - 1));
57
58 if (((l & ~0xffffUL) | r) == 0) {
59 a0 >>= ROW_SHIFT;
60 t2 = (uint16_t) a0;
61 t2 |= t2 << 16;
62 t2 |= t2 << 32;
63
64 stq(t2, row);
65 stq(t2, row + 4);
66 return 1;
67 }
68
69 a1 = a0;
70 a2 = a0;
71 a3 = a0;
72
73 t = extwl(l, 4); /* row[2] */
74 if (t != 0) {
75 t = sextw(t);
76 a0 += W2 * t;
77 a1 += W6 * t;
78 a2 -= W6 * t;
79 a3 -= W2 * t;
80 }
81
82 t = extwl(r, 0); /* row[4] */
83 if (t != 0) {
84 t = sextw(t);
85 a0 += W4 * t;
86 a1 -= W4 * t;
87 a2 -= W4 * t;
88 a3 += W4 * t;
89 }
90
91 t = extwl(r, 4); /* row[6] */
92 if (t != 0) {
93 t = sextw(t);
94 a0 += W6 * t;
95 a1 -= W2 * t;
96 a2 += W2 * t;
97 a3 -= W6 * t;
98 }
99
100 t = extwl(l, 2); /* row[1] */
101 if (t != 0) {
102 t = sextw(t);
103 b0 = W1 * t;
104 b1 = W3 * t;
105 b2 = W5 * t;
106 b3 = W7 * t;
107 } else {
108 b0 = 0;
109 b1 = 0;
110 b2 = 0;
111 b3 = 0;
112 }
113
114 t = extwl(l, 6); /* row[3] */
115 if (t) {
116 t = sextw(t);
117 b0 += W3 * t;
118 b1 -= W7 * t;
119 b2 -= W1 * t;
120 b3 -= W5 * t;
121 }
122
123
124 t = extwl(r, 2); /* row[5] */
125 if (t) {
126 t = sextw(t);
127 b0 += W5 * t;
128 b1 -= W1 * t;
129 b2 += W7 * t;
130 b3 += W3 * t;
131 }
132
133 t = extwl(r, 6); /* row[7] */
134 if (t) {
135 t = sextw(t);
136 b0 += W7 * t;
137 b1 -= W5 * t;
138 b2 += W3 * t;
139 b3 -= W1 * t;
140 }
141
142 row[0] = (a0 + b0) >> ROW_SHIFT;
143 row[1] = (a1 + b1) >> ROW_SHIFT;
144 row[2] = (a2 + b2) >> ROW_SHIFT;
145 row[3] = (a3 + b3) >> ROW_SHIFT;
146 row[4] = (a3 - b3) >> ROW_SHIFT;
147 row[5] = (a2 - b2) >> ROW_SHIFT;
148 row[6] = (a1 - b1) >> ROW_SHIFT;
149 row[7] = (a0 - b0) >> ROW_SHIFT;
150
151 return 2;
152}
153
154static inline void idct_col(int16_t *col)
155{
156 int a0, a1, a2, a3, b0, b1, b2, b3;
157
158 col[0] += (1 << (COL_SHIFT - 1)) / W4;
159
160 a0 = W4 * col[8 * 0];
161 a1 = W4 * col[8 * 0];
162 a2 = W4 * col[8 * 0];
163 a3 = W4 * col[8 * 0];
164
165 if (col[8 * 2]) {
166 a0 += W2 * col[8 * 2];
167 a1 += W6 * col[8 * 2];
168 a2 -= W6 * col[8 * 2];
169 a3 -= W2 * col[8 * 2];
170 }
171
172 if (col[8 * 4]) {
173 a0 += W4 * col[8 * 4];
174 a1 -= W4 * col[8 * 4];
175 a2 -= W4 * col[8 * 4];
176 a3 += W4 * col[8 * 4];
177 }
178
179 if (col[8 * 6]) {
180 a0 += W6 * col[8 * 6];
181 a1 -= W2 * col[8 * 6];
182 a2 += W2 * col[8 * 6];
183 a3 -= W6 * col[8 * 6];
184 }
185
186 if (col[8 * 1]) {
187 b0 = W1 * col[8 * 1];
188 b1 = W3 * col[8 * 1];
189 b2 = W5 * col[8 * 1];
190 b3 = W7 * col[8 * 1];
191 } else {
192 b0 = 0;
193 b1 = 0;
194 b2 = 0;
195 b3 = 0;
196 }
197
198 if (col[8 * 3]) {
199 b0 += W3 * col[8 * 3];
200 b1 -= W7 * col[8 * 3];
201 b2 -= W1 * col[8 * 3];
202 b3 -= W5 * col[8 * 3];
203 }
204
205 if (col[8 * 5]) {
206 b0 += W5 * col[8 * 5];
207 b1 -= W1 * col[8 * 5];
208 b2 += W7 * col[8 * 5];
209 b3 += W3 * col[8 * 5];
210 }
211
212 if (col[8 * 7]) {
213 b0 += W7 * col[8 * 7];
214 b1 -= W5 * col[8 * 7];
215 b2 += W3 * col[8 * 7];
216 b3 -= W1 * col[8 * 7];
217 }
218
219 col[8 * 0] = (a0 + b0) >> COL_SHIFT;
220 col[8 * 7] = (a0 - b0) >> COL_SHIFT;
221 col[8 * 1] = (a1 + b1) >> COL_SHIFT;
222 col[8 * 6] = (a1 - b1) >> COL_SHIFT;
223 col[8 * 2] = (a2 + b2) >> COL_SHIFT;
224 col[8 * 5] = (a2 - b2) >> COL_SHIFT;
225 col[8 * 3] = (a3 + b3) >> COL_SHIFT;
226 col[8 * 4] = (a3 - b3) >> COL_SHIFT;
227}
228
229/* If all rows but the first one are zero after row transformation,
230 all rows will be identical after column transformation. */
231static inline void idct_col2(int16_t *col)
232{
233 int i;
234 uint64_t l, r;
235
236 for (i = 0; i < 8; ++i) {
237 int a0 = col[i] + (1 << (COL_SHIFT - 1)) / W4;
238
239 a0 *= W4;
240 col[i] = a0 >> COL_SHIFT;
241 }
242
243 l = ldq(col + 0 * 4); r = ldq(col + 1 * 4);
244 stq(l, col + 2 * 4); stq(r, col + 3 * 4);
245 stq(l, col + 4 * 4); stq(r, col + 5 * 4);
246 stq(l, col + 6 * 4); stq(r, col + 7 * 4);
247 stq(l, col + 8 * 4); stq(r, col + 9 * 4);
248 stq(l, col + 10 * 4); stq(r, col + 11 * 4);
249 stq(l, col + 12 * 4); stq(r, col + 13 * 4);
250 stq(l, col + 14 * 4); stq(r, col + 15 * 4);
251}
252
253void ff_simple_idct_axp(int16_t *block)
254{
255
256 int i;
257 int rowsZero = 1; /* all rows except row 0 zero */
258 int rowsConstant = 1; /* all rows consist of a constant value */
259
260 for (i = 0; i < 8; i++) {
261 int sparseness = idct_row(block + 8 * i);
262
263 if (i > 0 && sparseness > 0)
264 rowsZero = 0;
265 if (sparseness == 2)
266 rowsConstant = 0;
267 }
268
269 if (rowsZero) {
270 idct_col2(block);
271 } else if (rowsConstant) {
272 idct_col(block);
273 for (i = 0; i < 8; i += 2) {
274 uint64_t v = (uint16_t) block[0];
275 uint64_t w = (uint16_t) block[8];
276
277 v |= v << 16;
278 w |= w << 16;
279 v |= v << 32;
280 w |= w << 32;
281 stq(v, block + 0 * 4);
282 stq(v, block + 1 * 4);
283 stq(w, block + 2 * 4);
284 stq(w, block + 3 * 4);
285 block += 4 * 4;
286 }
287 } else {
288 for (i = 0; i < 8; i++)
289 idct_col(block + i);
290 }
291}
292
293void ff_simple_idct_put_axp(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
294{
295 ff_simple_idct_axp(block);
296 put_pixels_clamped_axp_p(block, dest, line_size);
297}
298
299void ff_simple_idct_add_axp(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
300{
301 ff_simple_idct_axp(block);
302 add_pixels_clamped_axp_p(block, dest, line_size);
303}
libavcodec/blockdsp.c+1−3
@@ -63,9 +63,7 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c) · 62 unmodified lines
63 c->fill_block_tab[0] = fill_block16_c;63 c->fill_block_tab[0] = fill_block16_c;
64 c->fill_block_tab[1] = fill_block8_c;64 c->fill_block_tab[1] = fill_block8_c;
65 65
66#if ARCH_ALPHA66#if ARCH_ARM
67 ff_blockdsp_init_alpha(c);
68#elif ARCH_ARM
69 ff_blockdsp_init_arm(c);67 ff_blockdsp_init_arm(c);
70#elif ARCH_PPC68#elif ARCH_PPC
71 ff_blockdsp_init_ppc(c);69 ff_blockdsp_init_ppc(c);
libavcodec/hpeldsp.c+0−2
@@ -357,8 +357,6 @@ av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags) · 356 unmodified lines
357 357
358#if ARCH_AARCH64358#if ARCH_AARCH64
359 ff_hpeldsp_init_aarch64(c, flags);359 ff_hpeldsp_init_aarch64(c, flags);
360#elif ARCH_ALPHA
361 ff_hpeldsp_init_alpha(c, flags);
362#elif ARCH_ARM360#elif ARCH_ARM
363 ff_hpeldsp_init_arm(c, flags);361 ff_hpeldsp_init_arm(c, flags);
364#elif ARCH_PPC362#elif ARCH_PPC
libavcodec/idctdsp.c+0−2
@@ -294,8 +294,6 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) · 293 unmodified lines
294 294
295#if ARCH_AARCH64295#if ARCH_AARCH64
296 ff_idctdsp_init_aarch64(c, avctx, high_bit_depth);296 ff_idctdsp_init_aarch64(c, avctx, high_bit_depth);
297#elif ARCH_ALPHA
298 ff_idctdsp_init_alpha(c, avctx, high_bit_depth);
299#elif ARCH_ARM297#elif ARCH_ARM
300 ff_idctdsp_init_arm(c, avctx, high_bit_depth);298 ff_idctdsp_init_arm(c, avctx, high_bit_depth);
301#elif ARCH_PPC299#elif ARCH_PPC
libavcodec/me_cmp.c+0−2
@@ -1058,8 +1058,6 @@ av_cold void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx) · 1057 unmodified lines
1058 1058
1059#if ARCH_AARCH641059#if ARCH_AARCH64
1060 ff_me_cmp_init_aarch64(c, avctx);1060 ff_me_cmp_init_aarch64(c, avctx);
1061#elif ARCH_ALPHA
1062 ff_me_cmp_init_alpha(c, avctx);
1063#elif ARCH_ARM1061#elif ARCH_ARM
1064 ff_me_cmp_init_arm(c, avctx);1062 ff_me_cmp_init_arm(c, avctx);
1065#elif ARCH_PPC1063#elif ARCH_PPC
libavcodec/mpegvideo.c+1−3
@@ -305,9 +305,7 @@ static av_cold int dct_init(MpegEncContext *s) · 304 unmodified lines
305 ff_mpv_common_init_neon(s);305 ff_mpv_common_init_neon(s);
306#endif306#endif
307 307
308#if ARCH_ALPHA308#if ARCH_ARM
309 ff_mpv_common_init_axp(s);
310#elif ARCH_ARM
311 ff_mpv_common_init_arm(s);309 ff_mpv_common_init_arm(s);
312#elif ARCH_PPC310#elif ARCH_PPC
313 ff_mpv_common_init_ppc(s);311 ff_mpv_common_init_ppc(s);
libavcodec/pixblockdsp.c+0−2
@@ -103,8 +103,6 @@ av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx) · 102 unmodified lines
103 103
104#if ARCH_AARCH64104#if ARCH_AARCH64
105 ff_pixblockdsp_init_aarch64(c, avctx, high_bit_depth);105 ff_pixblockdsp_init_aarch64(c, avctx, high_bit_depth);
106#elif ARCH_ALPHA
107 ff_pixblockdsp_init_alpha(c, avctx, high_bit_depth);
108#elif ARCH_ARM106#elif ARCH_ARM
109 ff_pixblockdsp_init_arm(c, avctx, high_bit_depth);107 ff_pixblockdsp_init_arm(c, avctx, high_bit_depth);
110#elif ARCH_PPC108#elif ARCH_PPC

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t