Diego Biurrun <[email protected]> writes:
> On Mon, Jul 16, 2012 at 02:17:06PM +0100, Mans Rullgard wrote:
>>
>> --- a/libavcodec/arm/Makefile
>> +++ b/libavcodec/arm/Makefile
>> @@ -14,6 +14,7 @@ OBJS-$(CONFIG_FLAC_DECODER) +=
>> arm/flacdsp_init_arm.o \
>> OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o
>> ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o
>>
>> +OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_init_arm.o
>> OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o
>
> This would fit better at the top with the other parts used by many codecs.
There is no such part in that makefile. Perhaps it could use a cleanup,
but that's for a different patch.
>> --- a/libavcodec/ppc/Makefile
>> +++ b/libavcodec/ppc/Makefile
>> @@ -1,14 +1,13 @@
>> OBJS += ppc/dsputil_ppc.o \
>>
>> +OBJS-$(CONFIG_VP3DSP) += ppc/vp3dsp_altivec.o
>> +
>> FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o
>> ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \
>> $(FFT-OBJS-yes)
>> ALTIVEC-OBJS-$(CONFIG_H264DSP) += ppc/h264_altivec.o
>> ALTIVEC-OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodec_altivec.o
>> ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o
>> -ALTIVEC-OBJS-$(CONFIG_VP3_DECODER) += ppc/vp3dsp_altivec.o
>> -ALTIVEC-OBJS-$(CONFIG_VP5_DECODER) += ppc/vp3dsp_altivec.o
>> -ALTIVEC-OBJS-$(CONFIG_VP6_DECODER) += ppc/vp3dsp_altivec.o
>> ALTIVEC-OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o
>>
>> --- a/libavcodec/ppc/vp3dsp_altivec.c
>> +++ b/libavcodec/ppc/vp3dsp_altivec.c
>> @@ -18,6 +18,12 @@
>>
>> +#include "config.h"
>> +#include "libavutil/cpu.h"
>> +#include "libavcodec/vp3dsp.h"
>> +
>> +#if HAVE_ALTIVEC
>> +
>> #include "libavutil/ppc/types_altivec.h"
>> @@ -183,3 +171,14 @@ void ff_vp3_idct_add_altivec(uint8_t *dst, int stride,
>> DCTELEM block[64])
>> ADD(b7)
>> }
>> +
>> +#endif /* HAVE_ALTIVEC */
>> +
>> +void ff_vp3dsp_init_ppc(VP3DSPContext *c, int flags)
>> +{
>> + if (HAVE_ALTIVEC && av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
>> + c->idct_put = vp3_idct_put_altivec;
>> + c->idct_add = vp3_idct_add_altivec;
>> + c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
>> + }
>> +}
>
> So the general strategy is to compile files containing optimizations
> unconditionally and then have ifdefs in the files?
There is no "general strategy." In this specific case, the choice is
either adding another file just for the init function, or placing the
altivec code under ifdef. The ARM and x86 VP3 functions are in separate
.S/.asm files anyway, so there is only one option there.
The init function has to be built unconditionally to allow calling it
based on ARCH_FOO only.
> Previously we did not compile the VP3 optimizations w/o MMX
> available...
MMX? This is PPC code...
All the optimised functions are built under exactly the same conditions
as before.
--
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel