105
102
#define TEMP_STRIDE 8
106
103
//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
108
#if defined(ARCH_X86)
109
106
DECLARE_ASM_CONST(8, uint64_t, w05)= 0x0005000500050005LL;
110
107
DECLARE_ASM_CONST(8, uint64_t, w04)= 0x0004000400040004LL;
111
108
DECLARE_ASM_CONST(8, uint64_t, w20)= 0x0020002000200020LL;
558
555
//Note: we have C, MMX, MMX2, 3DNOW version there is no 3DNOW+MMX2 one
559
556
//Plain C versions
560
#if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT)
557
#if !(HAVE_MMX || HAVE_ALTIVEC) || defined (RUNTIME_CPUDETECT)
561
558
#define COMPILE_C
565
562
#define COMPILE_ALTIVEC
566
563
#endif //HAVE_ALTIVEC
568
#if defined(ARCH_X86)
570
#if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
567
#if (HAVE_MMX && !HAVE_3DNOW && !HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
571
568
#define COMPILE_MMX
574
#if defined (HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
571
#if HAVE_MMX2 || defined (RUNTIME_CPUDETECT)
575
572
#define COMPILE_MMX2
578
#if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
575
#if (HAVE_3DNOW && !HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
579
576
#define COMPILE_3DNOW
581
#endif /* defined(ARCH_X86) */
578
#endif /* ARCH_X86 */
585
584
#undef HAVE_3DNOW
586
586
#undef HAVE_ALTIVEC
587
#define HAVE_ALTIVEC 0
592
590
#define RENAME(a) a ## _C
593
591
#include "postprocess_template.c"
596
594
#ifdef COMPILE_ALTIVEC
597
#define HAVE_ALTIVEC 1
599
598
#define RENAME(a) a ## _altivec
600
599
#include "postprocess_altivec_template.c"
601
600
#include "postprocess_template.c"
634
636
// minor note: the HAVE_xyz is messed up after that line so do not use it.
636
638
static inline void postProcess(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
637
const QP_STORE_T QPs[], int QPStride, int isColor, pp_mode_t *vm, pp_context_t *vc)
639
const QP_STORE_T QPs[], int QPStride, int isColor, pp_mode *vm, pp_context *vc)
639
641
PPContext *c= (PPContext *)vc;
640
642
PPMode *ppMode= (PPMode *)vm;
644
646
// difference would not be measurable here but it is much better because
645
647
// someone might exchange the CPU whithout restarting MPlayer ;)
646
648
#ifdef RUNTIME_CPUDETECT
647
#if defined(ARCH_X86)
648
650
// ordered per speed fastest first
649
651
if(c->cpuCaps & PP_CPU_CAPS_MMX2)
650
652
postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
656
658
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
659
661
if(c->cpuCaps & PP_CPU_CAPS_ALTIVEC)
660
662
postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
663
665
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
665
667
#else //RUNTIME_CPUDETECT
667
669
postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
668
#elif defined (HAVE_3DNOW)
669
671
postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
670
#elif defined (HAVE_MMX)
671
673
postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
672
#elif defined (HAVE_ALTIVEC)
673
675
postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
675
677
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
948
950
static const AVClass av_codec_context_class = { "Postproc", context_to_name, NULL };
950
pp_context_t *pp_get_context(int width, int height, int cpuCaps){
952
pp_context *pp_get_context(int width, int height, int cpuCaps){
951
953
PPContext *c= av_malloc(sizeof(PPContext));
952
954
int stride= (width+15)&(~15); //assumed / will realloc if needed
953
955
int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed
995
997
uint8_t * dst[3], const int dstStride[3],
996
998
int width, int height,
997
999
const QP_STORE_T *QP_store, int QPStride,
998
pp_mode_t *vm, void *vc, int pict_type)
1000
pp_mode *vm, void *vc, int pict_type)
1000
1002
int mbWidth = (width+15)>>4;
1001
1003
int mbHeight= (height+15)>>4;