2003-01-19 21:00:45 +02:00
|
|
|
/*
|
2004-04-20 20:05:12 +03:00
|
|
|
* Copyright (c) 2003-2004 Romain Dolbeau <romain@dolbeau.org>
|
2003-01-19 21:00:45 +02:00
|
|
|
*
|
2006-10-07 18:30:46 +03:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2003-01-19 21:00:45 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 18:30:46 +03:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2003-01-19 21:00:45 +02:00
|
|
|
*
|
2006-10-07 18:30:46 +03:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2003-01-19 21:00:45 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-10-07 18:30:46 +03:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-01-13 00:43:26 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2003-01-19 21:00:45 +02:00
|
|
|
*/
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#ifndef AVCODEC_PPC_DSPUTIL_PPC_H
|
|
|
|
#define AVCODEC_PPC_DSPUTIL_PPC_H
|
2003-01-19 21:00:45 +02:00
|
|
|
|
2009-01-25 13:16:25 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-01-14 01:44:16 +02:00
|
|
|
#if CONFIG_POWERPC_PERF
|
2003-01-19 21:00:45 +02:00
|
|
|
void powerpc_display_perf_report(void);
|
2004-09-16 22:05:22 +03:00
|
|
|
/* the 604* have 2, the G3* have 4, the G4s have 6,
|
|
|
|
and the G5 are completely different (they MUST use
|
2009-05-26 08:00:51 +03:00
|
|
|
ARCH_PPC64, and let's hope all future 64 bis PPC
|
2004-09-16 22:05:22 +03:00
|
|
|
will use the same PMCs... */
|
|
|
|
#define POWERPC_NUM_PMC_ENABLED 6
|
2003-01-19 21:00:45 +02:00
|
|
|
/* if you add to the enum below, also add to the perfname array
|
|
|
|
in dsputil_ppc.c */
|
|
|
|
enum powerpc_perf_index {
|
2008-07-20 21:58:30 +03:00
|
|
|
altivec_fft_num = 0,
|
|
|
|
altivec_gmc1_num,
|
|
|
|
altivec_dct_unquantize_h263_num,
|
|
|
|
altivec_fdct,
|
|
|
|
altivec_idct_add_num,
|
|
|
|
altivec_idct_put_num,
|
|
|
|
altivec_put_pixels16_num,
|
|
|
|
altivec_avg_pixels16_num,
|
|
|
|
altivec_avg_pixels8_num,
|
|
|
|
altivec_put_pixels8_xy2_num,
|
|
|
|
altivec_put_no_rnd_pixels8_xy2_num,
|
|
|
|
altivec_put_pixels16_xy2_num,
|
|
|
|
altivec_put_no_rnd_pixels16_xy2_num,
|
|
|
|
altivec_hadamard8_diff8x8_num,
|
|
|
|
altivec_hadamard8_diff16_num,
|
|
|
|
altivec_avg_pixels8_xy2_num,
|
|
|
|
powerpc_clear_blocks_dcbz32,
|
|
|
|
powerpc_clear_blocks_dcbz128,
|
|
|
|
altivec_put_h264_chroma_mc8_num,
|
|
|
|
altivec_avg_h264_chroma_mc8_num,
|
|
|
|
altivec_put_h264_qpel16_h_lowpass_num,
|
|
|
|
altivec_avg_h264_qpel16_h_lowpass_num,
|
|
|
|
altivec_put_h264_qpel16_v_lowpass_num,
|
|
|
|
altivec_avg_h264_qpel16_v_lowpass_num,
|
|
|
|
altivec_put_h264_qpel16_hv_lowpass_num,
|
|
|
|
altivec_avg_h264_qpel16_hv_lowpass_num,
|
|
|
|
powerpc_perf_total
|
2003-01-19 21:00:45 +02:00
|
|
|
};
|
|
|
|
enum powerpc_data_index {
|
2008-07-20 21:58:30 +03:00
|
|
|
powerpc_data_min = 0,
|
|
|
|
powerpc_data_max,
|
|
|
|
powerpc_data_sum,
|
|
|
|
powerpc_data_num,
|
|
|
|
powerpc_data_total
|
2003-01-19 21:00:45 +02:00
|
|
|
};
|
2003-07-09 23:18:13 +03:00
|
|
|
extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
|
2003-01-19 21:00:45 +02:00
|
|
|
|
2009-05-26 08:00:51 +03:00
|
|
|
#if !ARCH_PPC64
|
2004-04-22 16:21:59 +03:00
|
|
|
#define POWERP_PMC_DATATYPE unsigned long
|
2008-10-16 16:34:09 +03:00
|
|
|
#define POWERPC_GET_PMC1(a) __asm__ volatile("mfspr %0, 937" : "=r" (a))
|
|
|
|
#define POWERPC_GET_PMC2(a) __asm__ volatile("mfspr %0, 938" : "=r" (a))
|
2003-07-09 23:18:13 +03:00
|
|
|
#if (POWERPC_NUM_PMC_ENABLED > 2)
|
2008-10-16 16:34:09 +03:00
|
|
|
#define POWERPC_GET_PMC3(a) __asm__ volatile("mfspr %0, 941" : "=r" (a))
|
|
|
|
#define POWERPC_GET_PMC4(a) __asm__ volatile("mfspr %0, 942" : "=r" (a))
|
2003-07-09 23:18:13 +03:00
|
|
|
#else
|
|
|
|
#define POWERPC_GET_PMC3(a) do {} while (0)
|
|
|
|
#define POWERPC_GET_PMC4(a) do {} while (0)
|
|
|
|
#endif
|
|
|
|
#if (POWERPC_NUM_PMC_ENABLED > 4)
|
2008-10-16 16:34:09 +03:00
|
|
|
#define POWERPC_GET_PMC5(a) __asm__ volatile("mfspr %0, 929" : "=r" (a))
|
|
|
|
#define POWERPC_GET_PMC6(a) __asm__ volatile("mfspr %0, 930" : "=r" (a))
|
2003-07-09 23:18:13 +03:00
|
|
|
#else
|
|
|
|
#define POWERPC_GET_PMC5(a) do {} while (0)
|
|
|
|
#define POWERPC_GET_PMC6(a) do {} while (0)
|
|
|
|
#endif
|
2009-05-26 08:00:51 +03:00
|
|
|
#else /* ARCH_PPC64 */
|
2004-04-22 16:21:59 +03:00
|
|
|
#define POWERP_PMC_DATATYPE unsigned long long
|
2008-10-16 16:34:09 +03:00
|
|
|
#define POWERPC_GET_PMC1(a) __asm__ volatile("mfspr %0, 771" : "=r" (a))
|
|
|
|
#define POWERPC_GET_PMC2(a) __asm__ volatile("mfspr %0, 772" : "=r" (a))
|
2004-04-22 16:21:59 +03:00
|
|
|
#if (POWERPC_NUM_PMC_ENABLED > 2)
|
2008-10-16 16:34:09 +03:00
|
|
|
#define POWERPC_GET_PMC3(a) __asm__ volatile("mfspr %0, 773" : "=r" (a))
|
|
|
|
#define POWERPC_GET_PMC4(a) __asm__ volatile("mfspr %0, 774" : "=r" (a))
|
2004-04-22 16:21:59 +03:00
|
|
|
#else
|
|
|
|
#define POWERPC_GET_PMC3(a) do {} while (0)
|
|
|
|
#define POWERPC_GET_PMC4(a) do {} while (0)
|
|
|
|
#endif
|
|
|
|
#if (POWERPC_NUM_PMC_ENABLED > 4)
|
2008-10-16 16:34:09 +03:00
|
|
|
#define POWERPC_GET_PMC5(a) __asm__ volatile("mfspr %0, 775" : "=r" (a))
|
|
|
|
#define POWERPC_GET_PMC6(a) __asm__ volatile("mfspr %0, 776" : "=r" (a))
|
2004-04-22 16:21:59 +03:00
|
|
|
#else
|
|
|
|
#define POWERPC_GET_PMC5(a) do {} while (0)
|
|
|
|
#define POWERPC_GET_PMC6(a) do {} while (0)
|
|
|
|
#endif
|
2009-05-26 08:00:51 +03:00
|
|
|
#endif /* ARCH_PPC64 */
|
2008-07-20 21:58:30 +03:00
|
|
|
#define POWERPC_PERF_DECLARE(a, cond) \
|
|
|
|
POWERP_PMC_DATATYPE \
|
|
|
|
pmc_start[POWERPC_NUM_PMC_ENABLED], \
|
|
|
|
pmc_stop[POWERPC_NUM_PMC_ENABLED], \
|
|
|
|
pmc_loop_index;
|
2003-07-09 23:18:13 +03:00
|
|
|
#define POWERPC_PERF_START_COUNT(a, cond) do { \
|
2008-07-20 21:58:30 +03:00
|
|
|
POWERPC_GET_PMC6(pmc_start[5]); \
|
|
|
|
POWERPC_GET_PMC5(pmc_start[4]); \
|
|
|
|
POWERPC_GET_PMC4(pmc_start[3]); \
|
|
|
|
POWERPC_GET_PMC3(pmc_start[2]); \
|
|
|
|
POWERPC_GET_PMC2(pmc_start[1]); \
|
|
|
|
POWERPC_GET_PMC1(pmc_start[0]); \
|
|
|
|
} while (0)
|
2003-07-09 23:18:13 +03:00
|
|
|
#define POWERPC_PERF_STOP_COUNT(a, cond) do { \
|
2008-07-20 21:58:30 +03:00
|
|
|
POWERPC_GET_PMC1(pmc_stop[0]); \
|
|
|
|
POWERPC_GET_PMC2(pmc_stop[1]); \
|
|
|
|
POWERPC_GET_PMC3(pmc_stop[2]); \
|
|
|
|
POWERPC_GET_PMC4(pmc_stop[3]); \
|
|
|
|
POWERPC_GET_PMC5(pmc_stop[4]); \
|
|
|
|
POWERPC_GET_PMC6(pmc_stop[5]); \
|
|
|
|
if (cond) { \
|
|
|
|
for(pmc_loop_index = 0; \
|
|
|
|
pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \
|
|
|
|
pmc_loop_index++) { \
|
|
|
|
if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) { \
|
|
|
|
POWERP_PMC_DATATYPE diff = \
|
|
|
|
pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index]; \
|
|
|
|
if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \
|
|
|
|
perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \
|
|
|
|
if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \
|
|
|
|
perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \
|
|
|
|
perfdata[pmc_loop_index][a][powerpc_data_sum] += diff; \
|
|
|
|
perfdata[pmc_loop_index][a][powerpc_data_num] ++; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
2003-01-19 21:00:45 +02:00
|
|
|
} while (0)
|
2007-02-14 01:45:28 +02:00
|
|
|
#else /* CONFIG_POWERPC_PERF */
|
2003-02-01 02:18:50 +02:00
|
|
|
// those are needed to avoid empty statements.
|
2003-07-09 23:18:13 +03:00
|
|
|
#define POWERPC_PERF_DECLARE(a, cond) int altivec_placeholder __attribute__ ((unused))
|
|
|
|
#define POWERPC_PERF_START_COUNT(a, cond) do {} while (0)
|
|
|
|
#define POWERPC_PERF_STOP_COUNT(a, cond) do {} while (0)
|
2007-02-14 01:45:28 +02:00
|
|
|
#endif /* CONFIG_POWERPC_PERF */
|
2003-01-19 21:00:45 +02:00
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#endif /* AVCODEC_PPC_DSPUTIL_PPC_H */
|