mirror of https://git.ffmpeg.org/ffmpeg.git
aacdec: Use intfloat.h rather than local punning union.
This commit is contained in:
parent
58c42af722
commit
5cd56e193f
|
@ -98,6 +98,7 @@
|
||||||
#include "aacsbr.h"
|
#include "aacsbr.h"
|
||||||
#include "mpeg4audio.h"
|
#include "mpeg4audio.h"
|
||||||
#include "aacadtsdec.h"
|
#include "aacadtsdec.h"
|
||||||
|
#include "libavutil/intfloat.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -108,11 +109,6 @@
|
||||||
# include "arm/aac.h"
|
# include "arm/aac.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
union float754 {
|
|
||||||
float f;
|
|
||||||
uint32_t i;
|
|
||||||
};
|
|
||||||
|
|
||||||
static VLC vlc_scalefactors;
|
static VLC vlc_scalefactors;
|
||||||
static VLC vlc_spectral[11];
|
static VLC vlc_spectral[11];
|
||||||
|
|
||||||
|
@ -1004,7 +1000,7 @@ static inline float *VMUL4(float *dst, const float *v, unsigned idx,
|
||||||
static inline float *VMUL2S(float *dst, const float *v, unsigned idx,
|
static inline float *VMUL2S(float *dst, const float *v, unsigned idx,
|
||||||
unsigned sign, const float *scale)
|
unsigned sign, const float *scale)
|
||||||
{
|
{
|
||||||
union float754 s0, s1;
|
union av_intfloat32 s0, s1;
|
||||||
|
|
||||||
s0.f = s1.f = *scale;
|
s0.f = s1.f = *scale;
|
||||||
s0.i ^= sign >> 1 << 31;
|
s0.i ^= sign >> 1 << 31;
|
||||||
|
@ -1022,8 +1018,8 @@ static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
|
||||||
unsigned sign, const float *scale)
|
unsigned sign, const float *scale)
|
||||||
{
|
{
|
||||||
unsigned nz = idx >> 12;
|
unsigned nz = idx >> 12;
|
||||||
union float754 s = { .f = *scale };
|
union av_intfloat32 s = { .f = *scale };
|
||||||
union float754 t;
|
union av_intfloat32 t;
|
||||||
|
|
||||||
t.i = s.i ^ (sign & 1U<<31);
|
t.i = s.i ^ (sign & 1U<<31);
|
||||||
*dst++ = v[idx & 3] * t.f;
|
*dst++ = v[idx & 3] * t.f;
|
||||||
|
@ -1272,7 +1268,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
|
||||||
|
|
||||||
static av_always_inline float flt16_round(float pf)
|
static av_always_inline float flt16_round(float pf)
|
||||||
{
|
{
|
||||||
union float754 tmp;
|
union av_intfloat32 tmp;
|
||||||
tmp.f = pf;
|
tmp.f = pf;
|
||||||
tmp.i = (tmp.i + 0x00008000U) & 0xFFFF0000U;
|
tmp.i = (tmp.i + 0x00008000U) & 0xFFFF0000U;
|
||||||
return tmp.f;
|
return tmp.f;
|
||||||
|
@ -1280,7 +1276,7 @@ static av_always_inline float flt16_round(float pf)
|
||||||
|
|
||||||
static av_always_inline float flt16_even(float pf)
|
static av_always_inline float flt16_even(float pf)
|
||||||
{
|
{
|
||||||
union float754 tmp;
|
union av_intfloat32 tmp;
|
||||||
tmp.f = pf;
|
tmp.f = pf;
|
||||||
tmp.i = (tmp.i + 0x00007FFFU + (tmp.i & 0x00010000U >> 16)) & 0xFFFF0000U;
|
tmp.i = (tmp.i + 0x00007FFFU + (tmp.i & 0x00010000U >> 16)) & 0xFFFF0000U;
|
||||||
return tmp.f;
|
return tmp.f;
|
||||||
|
@ -1288,7 +1284,7 @@ static av_always_inline float flt16_even(float pf)
|
||||||
|
|
||||||
static av_always_inline float flt16_trunc(float pf)
|
static av_always_inline float flt16_trunc(float pf)
|
||||||
{
|
{
|
||||||
union float754 pun;
|
union av_intfloat32 pun;
|
||||||
pun.f = pf;
|
pun.f = pf;
|
||||||
pun.i &= 0xFFFF0000U;
|
pun.i &= 0xFFFF0000U;
|
||||||
return pun.f;
|
return pun.f;
|
||||||
|
|
Loading…
Reference in New Issue