[FFmpeg-devel] [PATCH] Add ppc/fmtconvert_ppc.c to fix compilation for PPC without Altivec.

Måns Rullgård mans
Fri Mar 4 21:21:21 CET 2011


"Ronald S. Bultje" <rsbultje at gmail.com> writes:

> Hi,
>
> On Fri, Mar 4, 2011 at 2:25 PM, Justin Ruggles <justin.ruggles at gmail.com> wrote:
>> ---
>> ?libavcodec/ppc/Makefile ? ? ? ? ? ? | ? ?1 +
>> ?libavcodec/ppc/fmtconvert_altivec.c | ? ?2 +-
>> ?libavcodec/ppc/fmtconvert_ppc.c ? ? | ? 33 +++++++++++++++++++++++++++++++++
>> ?3 files changed, 35 insertions(+), 1 deletions(-)
>> ?create mode 100644 libavcodec/ppc/fmtconvert_ppc.c
> [..]
>> +void ff_fmt_convert_init_ppc(FmtConvertContext *c, AVCodecContext *avctx)
>> +{
>> +    int mm_flags = av_get_cpu_flags();
>> +
>> +    if (mm_flags & AV_CPU_FLAG_ALTIVEC && HAVE_ALTIVEC) {
>> +        ff_fmt_convert_init_altivec(c, avctx);
>> +    }
>> +}
>
> Why this wrapper function? I.e. why not do this inside _init_altivec()?

On PPC it doesn't make much difference, but on e.g. ARM with many
optional features, having a single init function that takes care of all
the optional things avoids polluting the common code with conditionals
for every sub-variant.  That being the case, there is something to be
said for consistency, though it's not terribly important.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list