[MPlayer-dev-eng] [PATCH] SGI IRIX audio format fixes

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Sep 2 22:32:07 CEST 2005


Hi,
On Wed, Aug 31, 2005 at 11:18:29PM -0400, dega wrote:
>  #include <stdlib.h>
> +#include <unistd.h>
> +#include <errno.h>
>  #include <dmedia/audio.h>

Why are these needed?

> +  switch(*format & (AF_FORMAT_POINT_MASK | AF_FORMAT_SPECIAL_MASK)) {
> +  case AF_FORMAT_I:

IMHO you shouldn't use the low-level representation. If possible use the
predefined formats like AF_FORMAT_U16_LE etc.

> +  if(us2si_mask) {
> +    /* Perform parallel on-the-fly unsigned-to-signed conversion */
> +    register uint64_t *smpls = data;
> +    const uint64_t *smple = smpls + (plen * bytes_per_frame);
> +    const uint64_t mask = us2si_mask;
> +    while(smpls < smple)
> +      *smpls++ ^= mask;
> +  }

This does not belong here. Just return only the formats that are really
supported by the hardware. You can still improve the conversion
functions in af_format.c if that is important to you...

> +  if((ao_data.format & (AF_FORMAT_BITS_MASK | AF_FORMAT_POINT_MASK)) ==
> +     (AF_FORMAT_32BIT | AF_FORMAT_I)) {
> +    /* libaudio expects doubleword-aligned 24-bit values */
> +    int32_t *smpls = data;
> +    const int32_t *smple = smpls + (framecount * ao_data.channels);
> +    while(smpls < smple)
> +      *smpls++ >>= 8;
> +  }

Hmm... can this be avoided somehow? I don't like conversion code in
aos...

Greetings,
Reimar Döffinger




More information about the MPlayer-dev-eng mailing list