History

Remove PPC perf counter support

This functionality is better accessed through tools like oprofile. Originally committed as revision 23808 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård committed 16 years ago

Commit 2829ce41 parent a78819613 files · +0 −513Browse files

Unified · Split

13 files
  1. configure +0 −4
  2. doc/ffmpeg_powerpc_performance_evaluation_howto.txt +0 −172
  3. ffmpeg.c +0 −5
  4. libavcodec/ppc/dsputil_altivec.c +0 −42
  5. libavcodec/ppc/dsputil_ppc.c +0 −79
  6. libavcodec/ppc/dsputil_ppc.h +0 −154
  7. libavcodec/ppc/fdct_altivec.c +0 −7
  8. libavcodec/ppc/fft_altivec.c +0 −6
  9. libavcodec/ppc/gmc_altivec.c +0 −8
  10. libavcodec/ppc/h264_altivec.c +0 −1
  11. libavcodec/ppc/h264_template_altivec.c +0 −16
  12. libavcodec/ppc/idct_altivec.c +0 −14
  13. libavcodec/ppc/mpegvideo_altivec.c +0 −5
configure+0−4
@@ -211,8 +211,6 @@ Advanced options (experts only): · 210 unmodified lines
211 --arch=ARCH select architecture [$arch]211 --arch=ARCH select architecture [$arch]
212 --cpu=CPU select the minimum required CPU (affects212 --cpu=CPU select the minimum required CPU (affects
213 instruction selection, may crash on older CPUs)213 instruction selection, may crash on older CPUs)
214 --enable-powerpc-perf enable performance report on PPC
215 (requires enabling PMC)
216 --disable-asm disable all assembler optimizations214 --disable-asm disable all assembler optimizations
217 --disable-altivec disable AltiVec optimizations215 --disable-altivec disable AltiVec optimizations
218 --disable-amd3dnow disable 3DNow! optimizations216 --disable-amd3dnow disable 3DNow! optimizations
@@ -886,7 +884,6 @@ CONFIG_LIST=" · 667 unmodified lines
886 nonfree884 nonfree
887 pic885 pic
888 postproc886 postproc
889 powerpc_perf
890 rdft887 rdft
891 runtime_cpudetect888 runtime_cpudetect
892 shared889 shared
@@ -2772,7 +2769,6 @@ if enabled ppc; then · 1879 unmodified lines
2772 echo "AltiVec enabled ${altivec-no}"2769 echo "AltiVec enabled ${altivec-no}"
2773 echo "PPC 4xx optimizations ${ppc4xx-no}"2770 echo "PPC 4xx optimizations ${ppc4xx-no}"
2774 echo "dcbzl available ${dcbzl-no}"2771 echo "dcbzl available ${dcbzl-no}"
2775 echo "performance report ${powerpc_perf-no}"
2776fi2772fi
2777if enabled sparc; then2773if enabled sparc; then
2778 echo "VIS enabled ${vis-no}"2774 echo "VIS enabled ${vis-no}"
doc/ffmpeg_powerpc_performance_evaluation_howto.txt+0−172
@@ -1,172 +0,0 @@
1FFmpeg & evaluating performance on the PowerPC Architecture HOWTO
2
3(c) 2003-2004 Romain Dolbeau <romain@dolbeau.org>
4
5
6
7I - Introduction
8
9The PowerPC architecture and its SIMD extension AltiVec offer some
10interesting tools to evaluate performance and improve the code.
11This document tries to explain how to use those tools with FFmpeg.
12
13The architecture itself offers two ways to evaluate the performance of
14a given piece of code:
15
161) The Time Base Registers (TBL)
172) The Performance Monitor Counter Registers (PMC)
18
19The first ones are always available, always active, but they're not very
20accurate: the registers increment by one every four *bus* cycles. On
21my 667 Mhz tiBook (ppc7450), this means once every twenty *processor*
22cycles. So we won't use that.
23
24The PMC are much more useful: not only can they report cycle-accurate
25timing, but they can also be used to monitor many other parameters,
26such as the number of AltiVec stalls for every kind of instruction,
27or instruction cache misses. The downside is that not all processors
28support the PMC (all G3, all G4 and the 970 do support them), and
29they're inactive by default - you need to activate them with a
30dedicated tool. Also, the number of available PMC depends on the
31procesor: the various 604 have 2, the various 75x (aka. G3) have 4,
32and the various 74xx (aka G4) have 6.
33
34*WARNING*: The PowerPC 970 is not very well documented, and its PMC
35registers are 64 bits wide. To properly notify the code, you *must*
36tune for the 970 (using --tune=970), or the code will assume 32 bit
37registers.
38
39
40II - Enabling FFmpeg PowerPC performance support
41
42This needs to be done by hand. First, you need to configure FFmpeg as
43usual, but add the "--powerpc-perf-enable" option. For instance:
44
45#####
46./configure --prefix=/usr/local/ffmpeg-svn --cc=gcc-3.3 --tune=7450 --powerpc-perf-enable
47#####
48
49This will configure FFmpeg to install inside /usr/local/ffmpeg-svn,
50compiling with gcc-3.3 (you should try to use this one or a newer
51gcc), and tuning for the PowerPC 7450 (i.e. the newer G4; as a rule of
52thumb, those at 550Mhz and more). It will also enable the PMC.
53
54You may also edit the file "config.h" to enable the following line:
55
56#####
57// #define ALTIVEC_USE_REFERENCE_C_CODE 1
58#####
59
60If you enable this line, then the code will not make use of AltiVec,
61but will use the reference C code instead. This is useful to compare
62performance between two versions of the code.
63
64Also, the number of enabled PMC is defined in "libavcodec/ppc/dsputil_ppc.h":
65
66#####
67#define POWERPC_NUM_PMC_ENABLED 4
68#####
69
70If you have a G4 CPU, you can enable all 6 PMC. DO NOT enable more
71PMC than available on your CPU!
72
73Then, simply compile FFmpeg as usual (make && make install).
74
75
76
77III - Using FFmpeg PowerPC performance support
78
79This FFmeg can be used exactly as usual. But before exiting, FFmpeg
80will dump a per-function report that looks like this:
81
82#####
83PowerPC performance report
84 Values are from the PMC registers, and represent whatever the
85 registers are set to record.
86 Function "gmc1_altivec" (pmc1):
87 min: 231
88 max: 1339867
89 avg: 558.25 (255302)
90 Function "gmc1_altivec" (pmc2):
91 min: 93
92 max: 2164
93 avg: 267.31 (255302)
94 Function "gmc1_altivec" (pmc3):
95 min: 72
96 max: 1987
97 avg: 276.20 (255302)
98(...)
99#####
100
101In this example, PMC1 was set to record CPU cycles, PMC2 was set to
102record AltiVec Permute Stall Cycles, and PMC3 was set to record AltiVec
103Issue Stalls.
104
105The function "gmc1_altivec" was monitored 255302 times, and the
106minimum execution time was 231 processor cycles. The max and average
107aren't much use, as it's very likely the OS interrupted execution for
108reasons of its own :-(
109
110With the exact same settings and source file, but using the reference C
111code we get:
112
113#####
114PowerPC performance report
115 Values are from the PMC registers, and represent whatever the
116 registers are set to record.
117 Function "gmc1_altivec" (pmc1):
118 min: 592
119 max: 2532235
120 avg: 962.88 (255302)
121 Function "gmc1_altivec" (pmc2):
122 min: 0
123 max: 33
124 avg: 0.00 (255302)
125 Function "gmc1_altivec" (pmc3):
126 min: 0
127 max: 350
128 avg: 0.03 (255302)
129(...)
130#####
131
132592 cycles, so the fastest AltiVec execution is about 2.5x faster than
133the fastest C execution in this example. It's not perfect but it's not
134bad (well I wrote this function so I can't say otherwise :-).
135
136Once you have that kind of report, you can try to improve things by
137finding what goes wrong and fixing it; in the example above, one
138should try to diminish the number of AltiVec stalls, as this *may*
139improve performance.
140
141
142
143IV) Enabling the PMC in Mac OS X
144
145This is easy. Use "Monster" and "monster". Those tools come from
146Apple's CHUD package, and can be found hidden in the developer web
147site & FTP site. "MONster" is the graphical application, use it to
148generate a config file specifying what each register should
149monitor. Then use the command-line application "monster" to use that
150config file, and enjoy the results.
151
152Note that "MONster" can be used for many other things, but it's
153documented by Apple, it's not my subject.
154
155If you are using CHUD 4.4.2 or later, you'll notice that MONster is
156no longer available. It's been superseeded by Shark, where
157configuration of PMCs is available as a plugin.
158
159
160
161V) Enabling the PMC on Linux
162
163On linux you may use oprofile from http://oprofile.sf.net, depending on the
164version and the cpu you may need to apply a patch[1] to access a set of the
165possibile counters from the userspace application. You can always define them
166using the kernel interface /dev/oprofile/* .
167
168[1] http://dev.gentoo.org/~lu_zero/development/oprofile-g4-20060423.patch
169
170--
171Romain Dolbeau <romain@dolbeau.org>
172Luca Barbato <lu_zero@gentoo.org>
ffmpeg.c+0−5
@@ -618,11 +618,6 @@ static int av_exit(int ret) · 617 unmodified lines
618 618
619 av_free(video_standard);619 av_free(video_standard);
620 620
621#if CONFIG_POWERPC_PERF
622 void powerpc_display_perf_report(void);
623 powerpc_display_perf_report();
624#endif /* CONFIG_POWERPC_PERF */
625
626 for (i=0;i<AVMEDIA_TYPE_NB;i++)621 for (i=0;i<AVMEDIA_TYPE_NB;i++)
627 av_free(avcodec_opts[i]);622 av_free(avcodec_opts[i]);
628 av_free(avformat_opts);623 av_free(avformat_opts);
libavcodec/ppc/dsputil_altivec.c+0−42
@@ -25,7 +25,6 @@ · 24 unmodified lines
25#include <altivec.h>25#include <altivec.h>
26#endif26#endif
27#include "libavcodec/dsputil.h"27#include "libavcodec/dsputil.h"
28#include "dsputil_ppc.h"
29#include "util_altivec.h"28#include "util_altivec.h"
30#include "types_altivec.h"29#include "types_altivec.h"
31#include "dsputil_altivec.h"30#include "dsputil_altivec.h"
@@ -610,7 +609,6 @@ static void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w) { · 578 unmodified lines
610/* next one assumes that ((line_size % 16) == 0) */609/* next one assumes that ((line_size % 16) == 0) */
611void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)610void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
612{611{
613POWERPC_PERF_DECLARE(altivec_put_pixels16_num, 1);
614 register vector unsigned char pixelsv1, pixelsv2;612 register vector unsigned char pixelsv1, pixelsv2;
615 register vector unsigned char pixelsv1B, pixelsv2B;613 register vector unsigned char pixelsv1B, pixelsv2B;
616 register vector unsigned char pixelsv1C, pixelsv2C;614 register vector unsigned char pixelsv1C, pixelsv2C;
@@ -622,7 +620,6 @@ POWERPC_PERF_DECLARE(altivec_put_pixels16_num, 1); · 5 unmodified lines
622 register int line_size_3 = line_size + line_size_2;620 register int line_size_3 = line_size + line_size_2;
623 register int line_size_4 = line_size << 2;621 register int line_size_4 = line_size << 2;
624 622
625POWERPC_PERF_START_COUNT(altivec_put_pixels16_num, 1);
626// hand-unrolling the loop by 4 gains about 15%623// hand-unrolling the loop by 4 gains about 15%
627// mininum execution time goes from 74 to 60 cycles624// mininum execution time goes from 74 to 60 cycles
628// it's faster than -funroll-loops, but using625// it's faster than -funroll-loops, but using
@@ -659,20 +656,16 @@ POWERPC_PERF_START_COUNT(altivec_put_pixels16_num, 1); · 30 unmodified lines
659 block +=line_size_4;656 block +=line_size_4;
660 }657 }
661#endif658#endif
662POWERPC_PERF_STOP_COUNT(altivec_put_pixels16_num, 1);
663}659}
664 660
665/* next one assumes that ((line_size % 16) == 0) */661/* next one assumes that ((line_size % 16) == 0) */
666#define op_avg(a,b) a = ( ((a)|(b)) - ((((a)^(b))&0xFEFEFEFEUL)>>1) )662#define op_avg(a,b) a = ( ((a)|(b)) - ((((a)^(b))&0xFEFEFEFEUL)>>1) )
667void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)663void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
668{664{
669POWERPC_PERF_DECLARE(altivec_avg_pixels16_num, 1);
670 register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;665 register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;
671 register vector unsigned char perm = vec_lvsl(0, pixels);666 register vector unsigned char perm = vec_lvsl(0, pixels);
672 int i;667 int i;
673 668
674POWERPC_PERF_START_COUNT(altivec_avg_pixels16_num, 1);
675
676 for (i = 0; i < h; i++) {669 for (i = 0; i < h; i++) {
677 pixelsv1 = vec_ld( 0, pixels);670 pixelsv1 = vec_ld( 0, pixels);
678 pixelsv2 = vec_ld(16,pixels);671 pixelsv2 = vec_ld(16,pixels);
@@ -683,19 +676,14 @@ POWERPC_PERF_START_COUNT(altivec_avg_pixels16_num, 1); · 4 unmodified lines
683 pixels+=line_size;676 pixels+=line_size;
684 block +=line_size;677 block +=line_size;
685 }678 }
686
687POWERPC_PERF_STOP_COUNT(altivec_avg_pixels16_num, 1);
688}679}
689 680
690/* next one assumes that ((line_size % 8) == 0) */681/* next one assumes that ((line_size % 8) == 0) */
691static void avg_pixels8_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)682static void avg_pixels8_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)
692{683{
693POWERPC_PERF_DECLARE(altivec_avg_pixels8_num, 1);
694 register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;684 register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;
695 int i;685 int i;
696 686
697POWERPC_PERF_START_COUNT(altivec_avg_pixels8_num, 1);
698
699 for (i = 0; i < h; i++) {687 for (i = 0; i < h; i++) {
700 /* block is 8 bytes-aligned, so we're either in the688 /* block is 8 bytes-aligned, so we're either in the
701 left block (16 bytes-aligned) or in the right block (not) */689 left block (16 bytes-aligned) or in the right block (not) */
@@ -719,14 +707,11 @@ POWERPC_PERF_START_COUNT(altivec_avg_pixels8_num, 1); · 17 unmodified lines
719 pixels += line_size;707 pixels += line_size;
720 block += line_size;708 block += line_size;
721 }709 }
722
723POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_num, 1);
724}710}
725 711
726/* next one assumes that ((line_size % 8) == 0) */712/* next one assumes that ((line_size % 8) == 0) */
727static void put_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)713static void put_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
728{714{
729POWERPC_PERF_DECLARE(altivec_put_pixels8_xy2_num, 1);
730 register int i;715 register int i;
731 register vector unsigned char pixelsv1, pixelsv2, pixelsavg;716 register vector unsigned char pixelsv1, pixelsv2, pixelsavg;
732 register vector unsigned char blockv, temp1, temp2;717 register vector unsigned char blockv, temp1, temp2;
@@ -748,7 +733,6 @@ POWERPC_PERF_DECLARE(altivec_put_pixels8_xy2_num, 1); · 15 unmodified lines
748 (vector unsigned short)pixelsv2);733 (vector unsigned short)pixelsv2);
749 pixelssum1 = vec_add(pixelssum1, vctwo);734 pixelssum1 = vec_add(pixelssum1, vctwo);
750 735
751POWERPC_PERF_START_COUNT(altivec_put_pixels8_xy2_num, 1);
752 for (i = 0; i < h ; i++) {736 for (i = 0; i < h ; i++) {
753 int rightside = ((unsigned long)block & 0x0000000F);737 int rightside = ((unsigned long)block & 0x0000000F);
754 blockv = vec_ld(0, block);738 blockv = vec_ld(0, block);
@@ -782,14 +766,11 @@ POWERPC_PERF_START_COUNT(altivec_put_pixels8_xy2_num, 1); · 27 unmodified lines
782 block += line_size;766 block += line_size;
783 pixels += line_size;767 pixels += line_size;
784 }768 }
785
786POWERPC_PERF_STOP_COUNT(altivec_put_pixels8_xy2_num, 1);
787}769}
788 770
789/* next one assumes that ((line_size % 8) == 0) */771/* next one assumes that ((line_size % 8) == 0) */
790static void put_no_rnd_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)772static void put_no_rnd_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
791{773{
792POWERPC_PERF_DECLARE(altivec_put_no_rnd_pixels8_xy2_num, 1);
793 register int i;774 register int i;
794 register vector unsigned char pixelsv1, pixelsv2, pixelsavg;775 register vector unsigned char pixelsv1, pixelsv2, pixelsavg;
795 register vector unsigned char blockv, temp1, temp2;776 register vector unsigned char blockv, temp1, temp2;
@@ -812,7 +793,6 @@ POWERPC_PERF_DECLARE(altivec_put_no_rnd_pixels8_xy2_num, 1); · 16 unmodified lines
812 (vector unsigned short)pixelsv2);793 (vector unsigned short)pixelsv2);
813 pixelssum1 = vec_add(pixelssum1, vcone);794 pixelssum1 = vec_add(pixelssum1, vcone);
814 795
815POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1);
816 for (i = 0; i < h ; i++) {796 for (i = 0; i < h ; i++) {
817 int rightside = ((unsigned long)block & 0x0000000F);797 int rightside = ((unsigned long)block & 0x0000000F);
818 blockv = vec_ld(0, block);798 blockv = vec_ld(0, block);
@@ -846,14 +826,11 @@ POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); · 27 unmodified lines
846 block += line_size;826 block += line_size;
847 pixels += line_size;827 pixels += line_size;
848 }828 }
849
850POWERPC_PERF_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1);
851}829}
852 830
853/* next one assumes that ((line_size % 16) == 0) */831/* next one assumes that ((line_size % 16) == 0) */
854static void put_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)832static void put_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)
855{833{
856POWERPC_PERF_DECLARE(altivec_put_pixels16_xy2_num, 1);
857 register int i;834 register int i;
858 register vector unsigned char pixelsv1, pixelsv2, pixelsv3, pixelsv4;835 register vector unsigned char pixelsv1, pixelsv2, pixelsv3, pixelsv4;
859 register vector unsigned char blockv, temp1, temp2;836 register vector unsigned char blockv, temp1, temp2;
@@ -862,8 +839,6 @@ POWERPC_PERF_DECLARE(altivec_put_pixels16_xy2_num, 1); · 2 unmodified lines
862 register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0);839 register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0);
863 register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2);840 register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2);
864 841
865POWERPC_PERF_START_COUNT(altivec_put_pixels16_xy2_num, 1);
866
867 temp1 = vec_ld(0, pixels);842 temp1 = vec_ld(0, pixels);
868 temp2 = vec_ld(16, pixels);843 temp2 = vec_ld(16, pixels);
869 pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));844 pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));
@@ -919,14 +894,11 @@ POWERPC_PERF_START_COUNT(altivec_put_pixels16_xy2_num, 1); · 49 unmodified lines
919 block += line_size;894 block += line_size;
920 pixels += line_size;895 pixels += line_size;
921 }896 }
922
923POWERPC_PERF_STOP_COUNT(altivec_put_pixels16_xy2_num, 1);
924}897}
925 898
926/* next one assumes that ((line_size % 16) == 0) */899/* next one assumes that ((line_size % 16) == 0) */
927static void put_no_rnd_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)900static void put_no_rnd_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)
928{901{
929POWERPC_PERF_DECLARE(altivec_put_no_rnd_pixels16_xy2_num, 1);
930 register int i;902 register int i;
931 register vector unsigned char pixelsv1, pixelsv2, pixelsv3, pixelsv4;903 register vector unsigned char pixelsv1, pixelsv2, pixelsv3, pixelsv4;
932 register vector unsigned char blockv, temp1, temp2;904 register vector unsigned char blockv, temp1, temp2;
@@ -936,8 +908,6 @@ POWERPC_PERF_DECLARE(altivec_put_no_rnd_pixels16_xy2_num, 1); · 3 unmodified lines
936 register const vector unsigned short vcone = (const vector unsigned short)vec_splat_u16(1);908 register const vector unsigned short vcone = (const vector unsigned short)vec_splat_u16(1);
937 register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2);909 register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2);
938 910
939POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1);
940
941 temp1 = vec_ld(0, pixels);911 temp1 = vec_ld(0, pixels);
942 temp2 = vec_ld(16, pixels);912 temp2 = vec_ld(16, pixels);
943 pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));913 pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));
@@ -993,18 +963,14 @@ POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1); · 49 unmodified lines
993 block += line_size;963 block += line_size;
994 pixels += line_size;964 pixels += line_size;
995 }965 }
996
997POWERPC_PERF_STOP_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1);
998}966}
999 967
1000static int hadamard8_diff8x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){968static int hadamard8_diff8x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){
1001POWERPC_PERF_DECLARE(altivec_hadamard8_diff8x8_num, 1);
1002 int sum;969 int sum;
1003 register const vector unsigned char vzero =970 register const vector unsigned char vzero =
1004 (const vector unsigned char)vec_splat_u8(0);971 (const vector unsigned char)vec_splat_u8(0);
1005 register vector signed short temp0, temp1, temp2, temp3, temp4,972 register vector signed short temp0, temp1, temp2, temp3, temp4,
1006 temp5, temp6, temp7;973 temp5, temp6, temp7;
1007POWERPC_PERF_START_COUNT(altivec_hadamard8_diff8x8_num, 1);
1008 {974 {
1009 register const vector signed short vprod1 =(const vector signed short)975 register const vector signed short vprod1 =(const vector signed short)
1010 { 1,-1, 1,-1, 1,-1, 1,-1 };976 { 1,-1, 1,-1, 1,-1, 1,-1 };
@@ -1100,7 +1066,6 @@ POWERPC_PERF_START_COUNT(altivec_hadamard8_diff8x8_num, 1); · 89 unmodified lines
1100 vsum = vec_splat(vsum, 3);1066 vsum = vec_splat(vsum, 3);
1101 vec_ste(vsum, 0, &sum);1067 vec_ste(vsum, 0, &sum);
1102 }1068 }
1103POWERPC_PERF_STOP_COUNT(altivec_hadamard8_diff8x8_num, 1);
1104 return sum;1069 return sum;
1105}1070}
1106 1071
@@ -1319,16 +1284,13 @@ static int hadamard8_diff16x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, · 212 unmodified lines
1319}1284}
1320 1285
1321static int hadamard8_diff16_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){1286static int hadamard8_diff16_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){
1322POWERPC_PERF_DECLARE(altivec_hadamard8_diff16_num, 1);
1323 int score;1287 int score;
1324POWERPC_PERF_START_COUNT(altivec_hadamard8_diff16_num, 1);
1325 score = hadamard8_diff16x8_altivec(s, dst, src, stride, 8);1288 score = hadamard8_diff16x8_altivec(s, dst, src, stride, 8);
1326 if (h==16) {1289 if (h==16) {
1327 dst += 8*stride;1290 dst += 8*stride;
1328 src += 8*stride;1291 src += 8*stride;
1329 score += hadamard8_diff16x8_altivec(s, dst, src, stride, 8);1292 score += hadamard8_diff16x8_altivec(s, dst, src, stride, 8);
1330 }1293 }
1331POWERPC_PERF_STOP_COUNT(altivec_hadamard8_diff16_num, 1);
1332 return score;1294 return score;
1333}1295}
1334 1296
@@ -1358,7 +1320,6 @@ static void vorbis_inverse_coupling_altivec(float *mag, float *ang, · 23 unmodified lines
1358/* next one assumes that ((line_size % 8) == 0) */1320/* next one assumes that ((line_size % 8) == 0) */
1359static void avg_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)1321static void avg_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
1360{1322{
1361POWERPC_PERF_DECLARE(altivec_avg_pixels8_xy2_num, 1);
1362 register int i;1323 register int i;
1363 register vector unsigned char pixelsv1, pixelsv2, pixelsavg;1324 register vector unsigned char pixelsv1, pixelsv2, pixelsavg;
1364 register vector unsigned char blockv, temp1, temp2, blocktemp;1325 register vector unsigned char blockv, temp1, temp2, blocktemp;
@@ -1383,7 +1344,6 @@ POWERPC_PERF_DECLARE(altivec_avg_pixels8_xy2_num, 1); · 18 unmodified lines
1383 (vector unsigned short)pixelsv2);1344 (vector unsigned short)pixelsv2);
1384 pixelssum1 = vec_add(pixelssum1, vctwo);1345 pixelssum1 = vec_add(pixelssum1, vctwo);
1385 1346
1386POWERPC_PERF_START_COUNT(altivec_avg_pixels8_xy2_num, 1);
1387 for (i = 0; i < h ; i++) {1347 for (i = 0; i < h ; i++) {
1388 int rightside = ((unsigned long)block & 0x0000000F);1348 int rightside = ((unsigned long)block & 0x0000000F);
1389 blockv = vec_ld(0, block);1349 blockv = vec_ld(0, block);
@@ -1418,8 +1378,6 @@ POWERPC_PERF_START_COUNT(altivec_avg_pixels8_xy2_num, 1); · 28 unmodified lines
1418 block += line_size;1378 block += line_size;
1419 pixels += line_size;1379 pixels += line_size;
1420 }1380 }
1421
1422POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_xy2_num, 1);
1423}1381}
1424 1382
1425void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx)1383void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx)
libavcodec/ppc/dsputil_ppc.c+0−79
@@ -21,9 +21,6 @@ · 20 unmodified lines
21 */21 */
22 22
23#include "libavcodec/dsputil.h"23#include "libavcodec/dsputil.h"
24
25#include "dsputil_ppc.h"
26
27#include "dsputil_altivec.h"24#include "dsputil_altivec.h"
28 25
29int mm_flags = 0;26int mm_flags = 0;
@@ -39,63 +36,6 @@ int mm_support(void) · 9 unmodified lines
39 return result;36 return result;
40}37}
41 38
42#if CONFIG_POWERPC_PERF
43unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
44/* list below must match enum in dsputil_ppc.h */
45static unsigned char* perfname[] = {
46 "ff_fft_calc_altivec",
47 "gmc1_altivec",
48 "dct_unquantize_h263_altivec",
49 "fdct_altivec",
50 "idct_add_altivec",
51 "idct_put_altivec",
52 "put_pixels16_altivec",
53 "avg_pixels16_altivec",
54 "avg_pixels8_altivec",
55 "put_pixels8_xy2_altivec",
56 "put_no_rnd_pixels8_xy2_altivec",
57 "put_pixels16_xy2_altivec",
58 "put_no_rnd_pixels16_xy2_altivec",
59 "hadamard8_diff8x8_altivec",
60 "hadamard8_diff16_altivec",
61 "avg_pixels8_xy2_altivec",
62 "clear_blocks_dcbz32_ppc",
63 "clear_blocks_dcbz128_ppc",
64 "put_h264_chroma_mc8_altivec",
65 "avg_h264_chroma_mc8_altivec",
66 "put_h264_qpel16_h_lowpass_altivec",
67 "avg_h264_qpel16_h_lowpass_altivec",
68 "put_h264_qpel16_v_lowpass_altivec",
69 "avg_h264_qpel16_v_lowpass_altivec",
70 "put_h264_qpel16_hv_lowpass_altivec",
71 "avg_h264_qpel16_hv_lowpass_altivec",
72 ""
73};
74#include <stdio.h>
75#endif
76
77#if CONFIG_POWERPC_PERF
78void powerpc_display_perf_report(void)
79{
80 int i, j;
81 av_log(NULL, AV_LOG_INFO, "PowerPC performance report\n Values are from the PMC registers, and represent whatever the registers are set to record.\n");
82 for(i = 0 ; i < powerpc_perf_total ; i++) {
83 for (j = 0; j < POWERPC_NUM_PMC_ENABLED ; j++) {
84 if (perfdata[j][i][powerpc_data_num] != (unsigned long long)0)
85 av_log(NULL, AV_LOG_INFO,
86 " Function \"%s\" (pmc%d):\n\tmin: %"PRIu64"\n\tmax: %"PRIu64"\n\tavg: %1.2lf (%"PRIu64")\n",
87 perfname[i],
88 j+1,
89 perfdata[j][i][powerpc_data_min],
90 perfdata[j][i][powerpc_data_max],
91 (double)perfdata[j][i][powerpc_data_sum] /
92 (double)perfdata[j][i][powerpc_data_num],
93 perfdata[j][i][powerpc_data_num]);
94 }
95 }
96}
97#endif /* CONFIG_POWERPC_PERF */
98
99/* ***** WARNING ***** WARNING ***** WARNING ***** */39/* ***** WARNING ***** WARNING ***** WARNING ***** */
100/*40/*
101clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a41clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a
@@ -118,10 +58,8 @@ and <http://developer.apple.com/technotes/tn/tn2086.html> · 16 unmodified lines
118*/58*/
119static void clear_blocks_dcbz32_ppc(DCTELEM *blocks)59static void clear_blocks_dcbz32_ppc(DCTELEM *blocks)
120{60{
121POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz32, 1);
122 register int misal = ((unsigned long)blocks & 0x00000010);61 register int misal = ((unsigned long)blocks & 0x00000010);
123 register int i = 0;62 register int i = 0;
124POWERPC_PERF_START_COUNT(powerpc_clear_blocks_dcbz32, 1);
125#if 163#if 1
126 if (misal) {64 if (misal) {
127 ((unsigned long*)blocks)[0] = 0L;65 ((unsigned long*)blocks)[0] = 0L;
@@ -143,7 +81,6 @@ POWERPC_PERF_START_COUNT(powerpc_clear_blocks_dcbz32, 1); · 15 unmodified lines
143#else81#else
144 memset(blocks, 0, sizeof(DCTELEM)*6*64);82 memset(blocks, 0, sizeof(DCTELEM)*6*64);
145#endif83#endif
146POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz32, 1);
147}84}
148 85
149/* same as above, when dcbzl clear a whole 128B cache line86/* same as above, when dcbzl clear a whole 128B cache line
@@ -151,10 +88,8 @@ POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz32, 1); · 1 unmodified line
151#if HAVE_DCBZL88#if HAVE_DCBZL
152static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)89static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
153{90{
154POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz128, 1);
155 register int misal = ((unsigned long)blocks & 0x0000007f);91 register int misal = ((unsigned long)blocks & 0x0000007f);
156 register int i = 0;92 register int i = 0;
157POWERPC_PERF_START_COUNT(powerpc_clear_blocks_dcbz128, 1);
158#if 193#if 1
159 if (misal) {94 if (misal) {
160 // we could probably also optimize this case,95 // we could probably also optimize this case,
@@ -169,7 +104,6 @@ POWERPC_PERF_START_COUNT(powerpc_clear_blocks_dcbz128, 1); · 8 unmodified lines
169#else104#else
170 memset(blocks, 0, sizeof(DCTELEM)*6*64);105 memset(blocks, 0, sizeof(DCTELEM)*6*64);
171#endif106#endif
172POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz128, 1);
173}107}
174#else108#else
175static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)109static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
@@ -279,19 +213,6 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) · 103 unmodified lines
279 }213 }
280 }214 }
281 215
282#if CONFIG_POWERPC_PERF
283 {
284 int i, j;
285 for (i = 0 ; i < powerpc_perf_total ; i++) {
286 for (j = 0; j < POWERPC_NUM_PMC_ENABLED ; j++) {
287 perfdata[j][i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFFULL;
288 perfdata[j][i][powerpc_data_max] = 0x0000000000000000ULL;
289 perfdata[j][i][powerpc_data_sum] = 0x0000000000000000ULL;
290 perfdata[j][i][powerpc_data_num] = 0x0000000000000000ULL;
291 }
292 }
293 }
294#endif /* CONFIG_POWERPC_PERF */
295 }216 }
296#endif /* HAVE_ALTIVEC */217#endif /* HAVE_ALTIVEC */
297}218}
libavcodec/ppc/dsputil_ppc.h+0−154
@@ -1,154 +0,0 @@
1/*
2 * Copyright (c) 2003-2004 Romain Dolbeau <romain@dolbeau.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#ifndef AVCODEC_PPC_DSPUTIL_PPC_H
22#define AVCODEC_PPC_DSPUTIL_PPC_H
23
24#include "config.h"
25
26#if CONFIG_POWERPC_PERF
27void powerpc_display_perf_report(void);
28/* the 604* have 2, the G3* have 4, the G4s have 6,
29 and the G5 are completely different (they MUST use
30 ARCH_PPC64, and let's hope all future 64 bis PPC
31 will use the same PMCs... */
32#define POWERPC_NUM_PMC_ENABLED 6
33/* if you add to the enum below, also add to the perfname array
34 in dsputil_ppc.c */
35enum powerpc_perf_index {
36 altivec_fft_num = 0,
37 altivec_gmc1_num,
38 altivec_dct_unquantize_h263_num,
39 altivec_fdct,
40 altivec_idct_add_num,
41 altivec_idct_put_num,
42 altivec_put_pixels16_num,
43 altivec_avg_pixels16_num,
44 altivec_avg_pixels8_num,
45 altivec_put_pixels8_xy2_num,
46 altivec_put_no_rnd_pixels8_xy2_num,
47 altivec_put_pixels16_xy2_num,
48 altivec_put_no_rnd_pixels16_xy2_num,
49 altivec_hadamard8_diff8x8_num,
50 altivec_hadamard8_diff16_num,
51 altivec_avg_pixels8_xy2_num,
52 powerpc_clear_blocks_dcbz32,
53 powerpc_clear_blocks_dcbz128,
54 altivec_put_h264_chroma_mc8_num,
55 altivec_avg_h264_chroma_mc8_num,
56 altivec_put_h264_qpel16_h_lowpass_num,
57 altivec_avg_h264_qpel16_h_lowpass_num,
58 altivec_put_h264_qpel16_v_lowpass_num,
59 altivec_avg_h264_qpel16_v_lowpass_num,
60 altivec_put_h264_qpel16_hv_lowpass_num,
61 altivec_avg_h264_qpel16_hv_lowpass_num,
62 powerpc_perf_total
63};
64enum powerpc_data_index {
65 powerpc_data_min = 0,
66 powerpc_data_max,
67 powerpc_data_sum,
68 powerpc_data_num,
69 powerpc_data_total
70};
71extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
72
73#if !ARCH_PPC64
74#define POWERP_PMC_DATATYPE unsigned long
75#define POWERPC_GET_PMC1(a) __asm__ volatile("mfspr %0, 937" : "=r" (a))
76#define POWERPC_GET_PMC2(a) __asm__ volatile("mfspr %0, 938" : "=r" (a))
77#if (POWERPC_NUM_PMC_ENABLED > 2)
78#define POWERPC_GET_PMC3(a) __asm__ volatile("mfspr %0, 941" : "=r" (a))
79#define POWERPC_GET_PMC4(a) __asm__ volatile("mfspr %0, 942" : "=r" (a))
80#else
81#define POWERPC_GET_PMC3(a) do {} while (0)
82#define POWERPC_GET_PMC4(a) do {} while (0)
83#endif
84#if (POWERPC_NUM_PMC_ENABLED > 4)
85#define POWERPC_GET_PMC5(a) __asm__ volatile("mfspr %0, 929" : "=r" (a))
86#define POWERPC_GET_PMC6(a) __asm__ volatile("mfspr %0, 930" : "=r" (a))
87#else
88#define POWERPC_GET_PMC5(a) do {} while (0)
89#define POWERPC_GET_PMC6(a) do {} while (0)
90#endif
91#else /* ARCH_PPC64 */
92#define POWERP_PMC_DATATYPE unsigned long long
93#define POWERPC_GET_PMC1(a) __asm__ volatile("mfspr %0, 771" : "=r" (a))
94#define POWERPC_GET_PMC2(a) __asm__ volatile("mfspr %0, 772" : "=r" (a))
95#if (POWERPC_NUM_PMC_ENABLED > 2)
96#define POWERPC_GET_PMC3(a) __asm__ volatile("mfspr %0, 773" : "=r" (a))
97#define POWERPC_GET_PMC4(a) __asm__ volatile("mfspr %0, 774" : "=r" (a))
98#else
99#define POWERPC_GET_PMC3(a) do {} while (0)
100#define POWERPC_GET_PMC4(a) do {} while (0)
101#endif
102#if (POWERPC_NUM_PMC_ENABLED > 4)
103#define POWERPC_GET_PMC5(a) __asm__ volatile("mfspr %0, 775" : "=r" (a))
104#define POWERPC_GET_PMC6(a) __asm__ volatile("mfspr %0, 776" : "=r" (a))
105#else
106#define POWERPC_GET_PMC5(a) do {} while (0)
107#define POWERPC_GET_PMC6(a) do {} while (0)
108#endif
109#endif /* ARCH_PPC64 */
110#define POWERPC_PERF_DECLARE(a, cond) \
111 POWERP_PMC_DATATYPE \
112 pmc_start[POWERPC_NUM_PMC_ENABLED], \
113 pmc_stop[POWERPC_NUM_PMC_ENABLED], \
114 pmc_loop_index;
115#define POWERPC_PERF_START_COUNT(a, cond) do { \
116 POWERPC_GET_PMC6(pmc_start[5]); \
117 POWERPC_GET_PMC5(pmc_start[4]); \
118 POWERPC_GET_PMC4(pmc_start[3]); \
119 POWERPC_GET_PMC3(pmc_start[2]); \
120 POWERPC_GET_PMC2(pmc_start[1]); \
121 POWERPC_GET_PMC1(pmc_start[0]); \
122 } while (0)
123#define POWERPC_PERF_STOP_COUNT(a, cond) do { \
124 POWERPC_GET_PMC1(pmc_stop[0]); \
125 POWERPC_GET_PMC2(pmc_stop[1]); \
126 POWERPC_GET_PMC3(pmc_stop[2]); \
127 POWERPC_GET_PMC4(pmc_stop[3]); \
128 POWERPC_GET_PMC5(pmc_stop[4]); \
129 POWERPC_GET_PMC6(pmc_stop[5]); \
130 if (cond) { \
131 for(pmc_loop_index = 0; \
132 pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \
133 pmc_loop_index++) { \
134 if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) { \
135 POWERP_PMC_DATATYPE diff = \
136 pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index]; \
137 if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \
138 perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \
139 if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \
140 perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \
141 perfdata[pmc_loop_index][a][powerpc_data_sum] += diff; \
142 perfdata[pmc_loop_index][a][powerpc_data_num] ++; \
143 } \
144 } \
145 } \
146} while (0)
147#else /* CONFIG_POWERPC_PERF */
148// those are needed to avoid empty statements.
149#define POWERPC_PERF_DECLARE(a, cond) int altivec_placeholder __attribute__ ((unused))
150#define POWERPC_PERF_START_COUNT(a, cond) do {} while (0)
151#define POWERPC_PERF_STOP_COUNT(a, cond) do {} while (0)
152#endif /* CONFIG_POWERPC_PERF */
153
154#endif /* AVCODEC_PPC_DSPUTIL_PPC_H */
libavcodec/ppc/fdct_altivec.c+0−7
@@ -24,7 +24,6 @@ · 23 unmodified lines
24#endif24#endif
25#include "libavutil/common.h"25#include "libavutil/common.h"
26#include "libavcodec/dsputil.h"26#include "libavcodec/dsputil.h"
27#include "dsputil_ppc.h"
28#include "dsputil_altivec.h"27#include "dsputil_altivec.h"
29 28
30#define vs16(v) ((vector signed short)(v))29#define vs16(v) ((vector signed short)(v))
@@ -198,7 +197,6 @@ static vector float fdctconsts[3] = { · 167 unmodified lines
198 197
199void fdct_altivec(int16_t *block)198void fdct_altivec(int16_t *block)
200{199{
201POWERPC_PERF_DECLARE(altivec_fdct, 1);
202 vector signed short *bp;200 vector signed short *bp;
203 vector float *cp;201 vector float *cp;
204 vector float b00, b10, b20, b30, b40, b50, b60, b70;202 vector float b00, b10, b20, b30, b40, b50, b60, b70;
@@ -206,9 +204,6 @@ POWERPC_PERF_DECLARE(altivec_fdct, 1); · 1 unmodified line
206 vector float mzero, cnst, cnsts0, cnsts1, cnsts2;204 vector float mzero, cnst, cnsts0, cnsts1, cnsts2;
207 vector float x0, x1, x2, x3, x4, x5, x6, x7, x8;205 vector float x0, x1, x2, x3, x4, x5, x6, x7, x8;
208 206
209 POWERPC_PERF_START_COUNT(altivec_fdct, 1);
210
211
212 /* setup constants {{{ */207 /* setup constants {{{ */
213 /* mzero = -0.0 */208 /* mzero = -0.0 */
214 mzero = ((vector float)vec_splat_u32(-1));209 mzero = ((vector float)vec_splat_u32(-1));
@@ -487,8 +482,6 @@ POWERPC_PERF_DECLARE(altivec_fdct, 1); · 272 unmodified lines
487 482
488#undef CTS483#undef CTS
489 /* }}} */484 /* }}} */
490
491POWERPC_PERF_STOP_COUNT(altivec_fdct, 1);
492}485}
493 486
494/* vim:set foldmethod=marker foldlevel=0: */487/* vim:set foldmethod=marker foldlevel=0: */
libavcodec/ppc/fft_altivec.c+0−6
@@ -21,7 +21,6 @@ · 20 unmodified lines
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */22 */
23#include "libavcodec/fft.h"23#include "libavcodec/fft.h"
24#include "dsputil_ppc.h"
25#include "util_altivec.h"24#include "util_altivec.h"
26#include "dsputil_altivec.h"25#include "dsputil_altivec.h"
27 26
@@ -38,7 +37,6 @@ · 10 unmodified lines
38 */37 */
39static void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z)38static void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z)
40{39{
41POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6);
42 register const vector float vczero = (const vector float)vec_splat_u32(0.);40 register const vector float vczero = (const vector float)vec_splat_u32(0.);
43 41
44 int ln = s->nbits;42 int ln = s->nbits;
@@ -48,8 +46,6 @@ POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6); · 3 unmodified lines
48 FFTComplex *cptr, *cptr1;46 FFTComplex *cptr, *cptr1;
49 int k;47 int k;
50 48
51POWERPC_PERF_START_COUNT(altivec_fft_num, s->nbits >= 6);
52
53 np = 1 << ln;49 np = 1 << ln;
54 50
55 {51 {
@@ -132,8 +128,6 @@ POWERPC_PERF_START_COUNT(altivec_fft_num, s->nbits >= 6); · 76 unmodified lines
132 nblocks = nblocks >> 1;128 nblocks = nblocks >> 1;
133 nloops = nloops << 1;129 nloops = nloops << 1;
134 } while (nblocks != 0);130 } while (nblocks != 0);
135
136POWERPC_PERF_STOP_COUNT(altivec_fft_num, s->nbits >= 6);
137}131}
138 132
139av_cold void ff_fft_init_altivec(FFTContext *s)133av_cold void ff_fft_init_altivec(FFTContext *s)
libavcodec/ppc/gmc_altivec.c+0−8
@@ -21,7 +21,6 @@ · 20 unmodified lines
21 */21 */
22 22
23#include "libavcodec/dsputil.h"23#include "libavcodec/dsputil.h"
24#include "dsputil_ppc.h"
25#include "util_altivec.h"24#include "util_altivec.h"
26#include "types_altivec.h"25#include "types_altivec.h"
27#include "dsputil_altivec.h"26#include "dsputil_altivec.h"
@@ -30,10 +29,8 @@ · 2 unmodified lines
30 altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8,29 altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8,
31 to preserve proper dst alignment.30 to preserve proper dst alignment.
32*/31*/
33#define GMC1_PERF_COND (h==8)
34void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder)32void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
35{33{
36POWERPC_PERF_DECLARE(altivec_gmc1_num, GMC1_PERF_COND);
37 const DECLARE_ALIGNED(16, unsigned short, rounder_a) = rounder;34 const DECLARE_ALIGNED(16, unsigned short, rounder_a) = rounder;
38 const DECLARE_ALIGNED(16, unsigned short, ABCD)[8] =35 const DECLARE_ALIGNED(16, unsigned short, ABCD)[8] =
39 {36 {
@@ -51,9 +48,6 @@ POWERPC_PERF_DECLARE(altivec_gmc1_num, GMC1_PERF_COND); · 11 unmodified lines
51 unsigned long dst_odd = (unsigned long)dst & 0x0000000F;48 unsigned long dst_odd = (unsigned long)dst & 0x0000000F;
52 unsigned long src_really_odd = (unsigned long)src & 0x0000000F;49 unsigned long src_really_odd = (unsigned long)src & 0x0000000F;
53 50
54
55POWERPC_PERF_START_COUNT(altivec_gmc1_num, GMC1_PERF_COND);
56
57 tempA = vec_ld(0, (unsigned short*)ABCD);51 tempA = vec_ld(0, (unsigned short*)ABCD);
58 Av = vec_splat(tempA, 0);52 Av = vec_splat(tempA, 0);
59 Bv = vec_splat(tempA, 1);53 Bv = vec_splat(tempA, 1);
@@ -133,6 +127,4 @@ POWERPC_PERF_START_COUNT(altivec_gmc1_num, GMC1_PERF_COND); · 73 unmodified lines
133 dst += stride;127 dst += stride;
134 src += stride;128 src += stride;
135 }129 }
136
137POWERPC_PERF_STOP_COUNT(altivec_gmc1_num, GMC1_PERF_COND);
138}130}
libavcodec/ppc/h264_altivec.c+0−1
@@ -22,7 +22,6 @@ · 21 unmodified lines
22#include "libavcodec/h264data.h"22#include "libavcodec/h264data.h"
23#include "libavcodec/h264dsp.h"23#include "libavcodec/h264dsp.h"
24 24
25#include "dsputil_ppc.h"
26#include "dsputil_altivec.h"25#include "dsputil_altivec.h"
27#include "util_altivec.h"26#include "util_altivec.h"
28#include "types_altivec.h"27#include "types_altivec.h"
libavcodec/ppc/h264_template_altivec.c+0−16
@@ -77,7 +77,6 @@ · 76 unmodified lines
77 77
78static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src,78static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src,
79 int stride, int h, int x, int y) {79 int stride, int h, int x, int y) {
80 POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1);
81 DECLARE_ALIGNED(16, signed int, ABCD)[4] =80 DECLARE_ALIGNED(16, signed int, ABCD)[4] =
82 {((8 - x) * (8 - y)),81 {((8 - x) * (8 - y)),
83 (( x) * (8 - y)),82 (( x) * (8 - y)),
@@ -103,8 +102,6 @@ static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, · 19 unmodified lines
103 vec_s16 vsrc2ssH, vsrc3ssH, psum;102 vec_s16 vsrc2ssH, vsrc3ssH, psum;
104 vec_u8 vdst, ppsum, vfdst, fsum;103 vec_u8 vdst, ppsum, vfdst, fsum;
105 104
106 POWERPC_PERF_START_COUNT(PREFIX_h264_chroma_mc8_num, 1);
107
108 if (((unsigned long)dst) % 16 == 0) {105 if (((unsigned long)dst) % 16 == 0) {
109 fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,106 fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,
110 0x14, 0x15, 0x16, 0x17,107 0x14, 0x15, 0x16, 0x17,
@@ -203,7 +200,6 @@ static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, · 92 unmodified lines
203 }200 }
204 }201 }
205 }202 }
206 POWERPC_PERF_STOP_COUNT(PREFIX_h264_chroma_mc8_num, 1);
207}203}
208 204
209/* this code assume that stride % 16 == 0 */205/* this code assume that stride % 16 == 0 */
@@ -295,7 +291,6 @@ static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, i · 85 unmodified lines
295 291
296/* this code assume stride % 16 == 0 */292/* this code assume stride % 16 == 0 */
297static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {293static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
298 POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_h_lowpass_num, 1);
299 register int i;294 register int i;
300 295
301 LOAD_ZERO;296 LOAD_ZERO;
@@ -323,8 +318,6 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i · 21 unmodified lines
323 318
324 vec_u8 sum, vdst, fsum;319 vec_u8 sum, vdst, fsum;
325 320
326 POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_h_lowpass_num, 1);
327
328 for (i = 0 ; i < 16 ; i ++) {321 for (i = 0 ; i < 16 ; i ++) {
329 vec_u8 srcR1 = vec_ld(-2, src);322 vec_u8 srcR1 = vec_ld(-2, src);
330 vec_u8 srcR2 = vec_ld(14, src);323 vec_u8 srcR2 = vec_ld(14, src);
@@ -433,13 +426,10 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i · 102 unmodified lines
433 src += srcStride;426 src += srcStride;
434 dst += dstStride;427 dst += dstStride;
435 }428 }
436 POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_h_lowpass_num, 1);
437}429}
438 430
439/* this code assume stride % 16 == 0 */431/* this code assume stride % 16 == 0 */
440static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {432static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
441 POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_v_lowpass_num, 1);
442
443 register int i;433 register int i;
444 434
445 LOAD_ZERO;435 LOAD_ZERO;
@@ -490,8 +480,6 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i · 44 unmodified lines
490 480
491 vec_u8 sum, vdst, fsum, srcP3a, srcP3b, srcP3;481 vec_u8 sum, vdst, fsum, srcP3a, srcP3b, srcP3;
492 482
493 POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_v_lowpass_num, 1);
494
495 for (i = 0 ; i < 16 ; i++) {483 for (i = 0 ; i < 16 ; i++) {
496 srcP3a = vec_ld(0, srcbis += srcStride);484 srcP3a = vec_ld(0, srcbis += srcStride);
497 srcP3b = vec_ld(16, srcbis);485 srcP3b = vec_ld(16, srcbis);
@@ -544,12 +532,10 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i · 46 unmodified lines
544 532
545 dst += dstStride;533 dst += dstStride;
546 }534 }
547 POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_v_lowpass_num, 1);
548}535}
549 536
550/* this code assume stride % 16 == 0 *and* tmp is properly aligned */537/* this code assume stride % 16 == 0 *and* tmp is properly aligned */
551static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) {538static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) {
552 POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_hv_lowpass_num, 1);
553 register int i;539 register int i;
554 LOAD_ZERO;540 LOAD_ZERO;
555 const vec_u8 permM2 = vec_lvsl(-2, src);541 const vec_u8 permM2 = vec_lvsl(-2, src);
@@ -589,7 +575,6 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, · 33 unmodified lines
589 vec_u8 fsum, sumv, sum, vdst;575 vec_u8 fsum, sumv, sum, vdst;
590 vec_s16 ssume, ssumo;576 vec_s16 ssume, ssumo;
591 577
592 POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_hv_lowpass_num, 1);
593 src -= (2 * srcStride);578 src -= (2 * srcStride);
594 for (i = 0 ; i < 21 ; i ++) {579 for (i = 0 ; i < 21 ; i ++) {
595 vec_u8 srcM2, srcM1, srcP0, srcP1, srcP2, srcP3;580 vec_u8 srcM2, srcM1, srcP0, srcP1, srcP2, srcP3;
@@ -779,5 +764,4 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, · 183 unmodified lines
779 764
780 dst += dstStride;765 dst += dstStride;
781 }766 }
782 POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_hv_lowpass_num, 1);
783}767}
libavcodec/ppc/idct_altivec.c+0−14
@@ -43,7 +43,6 @@ · 42 unmodified lines
43#endif43#endif
44#include "libavcodec/dsputil.h"44#include "libavcodec/dsputil.h"
45#include "types_altivec.h"45#include "types_altivec.h"
46#include "dsputil_ppc.h"
47#include "dsputil_altivec.h"46#include "dsputil_altivec.h"
48 47
49#define IDCT_HALF \48#define IDCT_HALF \
@@ -161,13 +160,9 @@ static const vec_s16 constants[5] = { · 111 unmodified lines
161 160
162void idct_put_altivec(uint8_t* dest, int stride, int16_t *blk)161void idct_put_altivec(uint8_t* dest, int stride, int16_t *blk)
163{162{
164POWERPC_PERF_DECLARE(altivec_idct_put_num, 1);
165 vec_s16 *block = (vec_s16*)blk;163 vec_s16 *block = (vec_s16*)blk;
166 vec_u8 tmp;164 vec_u8 tmp;
167 165
168#if CONFIG_POWERPC_PERF
169POWERPC_PERF_START_COUNT(altivec_idct_put_num, 1);
170#endif
171 IDCT166 IDCT
172 167
173#define COPY(dest,src) \168#define COPY(dest,src) \
@@ -183,13 +178,10 @@ POWERPC_PERF_START_COUNT(altivec_idct_put_num, 1); · 9 unmodified lines
183 COPY (dest, vx5) dest += stride;178 COPY (dest, vx5) dest += stride;
184 COPY (dest, vx6) dest += stride;179 COPY (dest, vx6) dest += stride;
185 COPY (dest, vx7)180 COPY (dest, vx7)
186
187POWERPC_PERF_STOP_COUNT(altivec_idct_put_num, 1);
188}181}
189 182
190void idct_add_altivec(uint8_t* dest, int stride, int16_t *blk)183void idct_add_altivec(uint8_t* dest, int stride, int16_t *blk)
191{184{
192POWERPC_PERF_DECLARE(altivec_idct_add_num, 1);
193 vec_s16 *block = (vec_s16*)blk;185 vec_s16 *block = (vec_s16*)blk;
194 vec_u8 tmp;186 vec_u8 tmp;
195 vec_s16 tmp2, tmp3;187 vec_s16 tmp2, tmp3;
@@ -197,10 +189,6 @@ POWERPC_PERF_DECLARE(altivec_idct_add_num, 1); · 1 unmodified line
197 vec_u8 perm1;189 vec_u8 perm1;
198 vec_u8 p0, p1, p;190 vec_u8 p0, p1, p;
199 191
200#if CONFIG_POWERPC_PERF
201POWERPC_PERF_START_COUNT(altivec_idct_add_num, 1);
202#endif
203
204 IDCT192 IDCT
205 193
206 p0 = vec_lvsl (0, dest);194 p0 = vec_lvsl (0, dest);
@@ -226,7 +214,5 @@ POWERPC_PERF_START_COUNT(altivec_idct_add_num, 1); · 19 unmodified lines
226 ADD (dest, vx5, perm1) dest += stride;214 ADD (dest, vx5, perm1) dest += stride;
227 ADD (dest, vx6, perm0) dest += stride;215 ADD (dest, vx6, perm0) dest += stride;
228 ADD (dest, vx7, perm1)216 ADD (dest, vx7, perm1)
229
230POWERPC_PERF_STOP_COUNT(altivec_idct_add_num, 1);
231}217}
232 218
libavcodec/ppc/mpegvideo_altivec.c+0−5
@@ -26,7 +26,6 @@ · 25 unmodified lines
26#include "libavcodec/dsputil.h"26#include "libavcodec/dsputil.h"
27#include "libavcodec/mpegvideo.h"27#include "libavcodec/mpegvideo.h"
28 28
29#include "dsputil_ppc.h"
30#include "util_altivec.h"29#include "util_altivec.h"
31#include "types_altivec.h"30#include "types_altivec.h"
32#include "dsputil_altivec.h"31#include "dsputil_altivec.h"
@@ -479,14 +478,11 @@ static int dct_quantize_altivec(MpegEncContext* s, · 446 unmodified lines
479static void dct_unquantize_h263_altivec(MpegEncContext *s,478static void dct_unquantize_h263_altivec(MpegEncContext *s,
480 DCTELEM *block, int n, int qscale)479 DCTELEM *block, int n, int qscale)
481{480{
482POWERPC_PERF_DECLARE(altivec_dct_unquantize_h263_num, 1);
483 int i, level, qmul, qadd;481 int i, level, qmul, qadd;
484 int nCoeffs;482 int nCoeffs;
485 483
486 assert(s->block_last_index[n]>=0);484 assert(s->block_last_index[n]>=0);
487 485
488POWERPC_PERF_START_COUNT(altivec_dct_unquantize_h263_num, 1);
489
490 qadd = (qscale - 1) | 1;486 qadd = (qscale - 1) | 1;
491 qmul = qscale << 1;487 qmul = qscale << 1;
492 488
@@ -569,7 +565,6 @@ POWERPC_PERF_START_COUNT(altivec_dct_unquantize_h263_num, 1); · 76 unmodified lines
569 block[0] = backup_0;565 block[0] = backup_0;
570 }566 }
571 }567 }
572POWERPC_PERF_STOP_COUNT(altivec_dct_unquantize_h263_num, nCoeffs == 63);
573}568}
574 569
575 570

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