summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libffmpeg/libavcodec/ppc/dsputil_ppc.c')
-rw-r--r--src/libffmpeg/libavcodec/ppc/dsputil_ppc.c130
1 files changed, 48 insertions, 82 deletions
diff --git a/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c b/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c
index b63c8dd84..9169eaef0 100644
--- a/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c
+++ b/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c
@@ -3,18 +3,20 @@
* Copyright (c) 2002 Dieter Shirley
* Copyright (c) 2003-2004 Romain Dolbeau <romain@dolbeau.org>
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* 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
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -24,22 +26,21 @@
#ifdef HAVE_ALTIVEC
#include "dsputil_altivec.h"
-#endif
extern void fdct_altivec(int16_t *block);
+extern void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,
+ int x16, int y16, int rounder);
extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);
-extern void ff_snow_horizontal_compose97i_altivec(DWTELEM *b, int width);
-extern void ff_snow_vertical_compose97i_altivec(DWTELEM *b0, DWTELEM *b1,
- DWTELEM *b2, DWTELEM *b3,
- DWTELEM *b4, DWTELEM *b5,
- int width);
-extern void ff_snow_inner_add_yblock_altivec(uint8_t *obmc, const int obmc_stride,
- uint8_t * * block, int b_w, int b_h,
- int src_x, int src_y, int src_stride,
- slice_buffer * sb, int add,
- uint8_t * dst8);
+void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx);
+
+void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx);
+void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx);
+void snow_init_altivec(DSPContext* c, AVCodecContext *avctx);
+void float_init_altivec(DSPContext* c, AVCodecContext *avctx);
+
+#endif
int mm_flags = 0;
@@ -100,7 +101,7 @@ void powerpc_display_perf_report(void)
{
if (perfdata[j][i][powerpc_data_num] != (unsigned long long)0)
av_log(NULL, AV_LOG_INFO,
- " Function \"%s\" (pmc%d):\n\tmin: %llu\n\tmax: %llu\n\tavg: %1.2lf (%llu)\n",
+ " Function \"%s\" (pmc%d):\n\tmin: %"PRIu64"\n\tmax: %"PRIu64"\n\tavg: %1.2lf (%"PRIu64")\n",
perfname[i],
j+1,
perfdata[j][i][powerpc_data_min],
@@ -174,7 +175,7 @@ POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz32, 1);
/* same as above, when dcbzl clear a whole 128B cache line
i.e. the PPC970 aka G5 */
-#ifndef NO_DCBZL
+#ifdef HAVE_DCBZL
void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
{
POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz128, 1);
@@ -204,7 +205,7 @@ void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
}
#endif
-#ifndef NO_DCBZL
+#ifdef HAVE_DCBZL
/* check dcbz report how many bytes are set to 0 by dcbz */
/* update 24/06/2003 : replace dcbz by dcbzl to get
the intended effect (Apple "fixed" dcbz)
@@ -248,69 +249,43 @@ long check_dcbzl_effect(void)
}
#endif
-
-void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx);
+static void prefetch_ppc(void *mem, int stride, int h)
+{
+ register const uint8_t *p = mem;
+ do {
+ asm volatile ("dcbt 0,%0" : : "r" (p));
+ p+= stride;
+ } while(--h);
+}
void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
{
// Common optimizations whether Altivec is available or not
-
- switch (check_dcbzl_effect()) {
- case 32:
- c->clear_blocks = clear_blocks_dcbz32_ppc;
- break;
- case 128:
- c->clear_blocks = clear_blocks_dcbz128_ppc;
- break;
- default:
- break;
- }
+ c->prefetch = prefetch_ppc;
+ switch (check_dcbzl_effect()) {
+ case 32:
+ c->clear_blocks = clear_blocks_dcbz32_ppc;
+ break;
+ case 128:
+ c->clear_blocks = clear_blocks_dcbz128_ppc;
+ break;
+ default:
+ break;
+ }
#ifdef HAVE_ALTIVEC
- dsputil_h264_init_ppc(c, avctx);
+ if(ENABLE_H264_DECODER) dsputil_h264_init_ppc(c, avctx);
if (has_altivec()) {
mm_flags |= MM_ALTIVEC;
- // Altivec specific optimisations
- c->pix_abs[0][1] = sad16_x2_altivec;
- c->pix_abs[0][2] = sad16_y2_altivec;
- c->pix_abs[0][3] = sad16_xy2_altivec;
- c->pix_abs[0][0] = sad16_altivec;
- c->pix_abs[1][0] = sad8_altivec;
- c->sad[0]= sad16_altivec;
- c->sad[1]= sad8_altivec;
- c->pix_norm1 = pix_norm1_altivec;
- c->sse[1]= sse8_altivec;
- c->sse[0]= sse16_altivec;
- c->pix_sum = pix_sum_altivec;
- c->diff_pixels = diff_pixels_altivec;
- c->get_pixels = get_pixels_altivec;
-// next one disabled as it's untested.
-#if 0
- c->add_bytes= add_bytes_altivec;
-#endif /* 0 */
- c->put_pixels_tab[0][0] = put_pixels16_altivec;
- /* the two functions do the same thing, so use the same code */
- c->put_no_rnd_pixels_tab[0][0] = put_pixels16_altivec;
- c->avg_pixels_tab[0][0] = avg_pixels16_altivec;
- c->avg_pixels_tab[1][0] = avg_pixels8_altivec;
- c->avg_pixels_tab[1][3] = avg_pixels8_xy2_altivec;
- c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec;
- c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec;
- c->put_pixels_tab[0][3] = put_pixels16_xy2_altivec;
- c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec;
-
+ dsputil_init_altivec(c, avctx);
+ if(ENABLE_SNOW_DECODER) snow_init_altivec(c, avctx);
+ if(ENABLE_VC1_DECODER || ENABLE_WMV3_DECODER)
+ vc1dsp_init_altivec(c, avctx);
+ float_init_altivec(c, avctx);
c->gmc1 = gmc1_altivec;
- c->hadamard8_diff[0] = hadamard8_diff16_altivec;
- c->hadamard8_diff[1] = hadamard8_diff8x8_altivec;
-
-
- c->horizontal_compose97i = ff_snow_horizontal_compose97i_altivec;
- c->vertical_compose97i = ff_snow_vertical_compose97i_altivec;
- c->inner_add_yblock = ff_snow_inner_add_yblock_altivec;
-
#ifdef CONFIG_ENCODERS
if (avctx->dct_algo == FF_DCT_AUTO ||
avctx->dct_algo == FF_DCT_ALTIVEC)
@@ -319,20 +294,16 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
}
#endif //CONFIG_ENCODERS
- if (avctx->lowres==0)
- {
+ if (avctx->lowres==0)
+ {
if ((avctx->idct_algo == FF_IDCT_AUTO) ||
(avctx->idct_algo == FF_IDCT_ALTIVEC))
{
c->idct_put = idct_put_altivec;
c->idct_add = idct_add_altivec;
-#ifndef ALTIVEC_USE_REFERENCE_C_CODE
c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
-#else /* ALTIVEC_USE_REFERENCE_C_CODE */
- c->idct_permutation_type = FF_NO_IDCT_PERM;
-#endif /* ALTIVEC_USE_REFERENCE_C_CODE */
}
- }
+ }
#ifdef POWERPC_PERFORMANCE_REPORT
{
@@ -349,11 +320,6 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
}
}
#endif /* POWERPC_PERFORMANCE_REPORT */
- } else
-#endif /* HAVE_ALTIVEC */
- {
- // Non-AltiVec PPC optimisations
-
- // ... pending ...
}
+#endif /* HAVE_ALTIVEC */
}