Merge remote-tracking branch 'qatar/master'

* qatar/master:
  aacdec: Drop some unused function arguments
  x86: Fix assembly with NASM
  x86: fmtconvert: Refactor cvtps2pi emulation through cpuflags

Conflicts:
	libavcodec/aacdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-10-31 14:26:11 +01:00
commit 84833b028b
2 changed files with 47 additions and 51 deletions

View File

@ -175,7 +175,7 @@ struct elem_to_channel {
}; };
static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID], static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID],
uint8_t (*layout_map)[3], int offset, int tags, uint64_t left, uint8_t (*layout_map)[3], int offset, uint64_t left,
uint64_t right, int pos) uint64_t right, int pos)
{ {
if (layout_map[offset][0] == TYPE_CPE) { if (layout_map[offset][0] == TYPE_CPE) {
@ -257,21 +257,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
num_front_channels--; num_front_channels--;
} }
if (num_front_channels >= 4) { if (num_front_channels >= 4) {
i += assign_pair(e2c_vec, layout_map, i, tags, i += assign_pair(e2c_vec, layout_map, i,
AV_CH_FRONT_LEFT_OF_CENTER, AV_CH_FRONT_LEFT_OF_CENTER,
AV_CH_FRONT_RIGHT_OF_CENTER, AV_CH_FRONT_RIGHT_OF_CENTER,
AAC_CHANNEL_FRONT); AAC_CHANNEL_FRONT);
num_front_channels -= 2; num_front_channels -= 2;
} }
if (num_front_channels >= 2) { if (num_front_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i, tags, i += assign_pair(e2c_vec, layout_map, i,
AV_CH_FRONT_LEFT, AV_CH_FRONT_LEFT,
AV_CH_FRONT_RIGHT, AV_CH_FRONT_RIGHT,
AAC_CHANNEL_FRONT); AAC_CHANNEL_FRONT);
num_front_channels -= 2; num_front_channels -= 2;
} }
while (num_front_channels >= 2) { while (num_front_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i, tags, i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX, UINT64_MAX,
UINT64_MAX, UINT64_MAX,
AAC_CHANNEL_FRONT); AAC_CHANNEL_FRONT);
@ -279,14 +279,14 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
} }
if (num_side_channels >= 2) { if (num_side_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i, tags, i += assign_pair(e2c_vec, layout_map, i,
AV_CH_SIDE_LEFT, AV_CH_SIDE_LEFT,
AV_CH_SIDE_RIGHT, AV_CH_SIDE_RIGHT,
AAC_CHANNEL_FRONT); AAC_CHANNEL_FRONT);
num_side_channels -= 2; num_side_channels -= 2;
} }
while (num_side_channels >= 2) { while (num_side_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i, tags, i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX, UINT64_MAX,
UINT64_MAX, UINT64_MAX,
AAC_CHANNEL_SIDE); AAC_CHANNEL_SIDE);
@ -294,14 +294,14 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
} }
while (num_back_channels >= 4) { while (num_back_channels >= 4) {
i += assign_pair(e2c_vec, layout_map, i, tags, i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX, UINT64_MAX,
UINT64_MAX, UINT64_MAX,
AAC_CHANNEL_BACK); AAC_CHANNEL_BACK);
num_back_channels -= 2; num_back_channels -= 2;
} }
if (num_back_channels >= 2) { if (num_back_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i, tags, i += assign_pair(e2c_vec, layout_map, i,
AV_CH_BACK_LEFT, AV_CH_BACK_LEFT,
AV_CH_BACK_RIGHT, AV_CH_BACK_RIGHT,
AAC_CHANNEL_BACK); AAC_CHANNEL_BACK);
@ -383,7 +383,7 @@ static void pop_output_configuration(AACContext *ac) {
*/ */
static int output_configure(AACContext *ac, static int output_configure(AACContext *ac,
uint8_t layout_map[MAX_ELEM_ID*4][3], int tags, uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
int channel_config, enum OCStatus oc_type) enum OCStatus oc_type)
{ {
AVCodecContext *avctx = ac->avctx; AVCodecContext *avctx = ac->avctx;
int i, channels = 0, ret; int i, channels = 0, ret;
@ -481,7 +481,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
2) < 0) 2) < 0)
return NULL; return NULL;
if (output_configure(ac, layout_map, layout_map_tags, if (output_configure(ac, layout_map, layout_map_tags,
2, OC_TRIAL_FRAME) < 0) OC_TRIAL_FRAME) < 0)
return NULL; return NULL;
ac->oc[1].m4ac.chan_config = 2; ac->oc[1].m4ac.chan_config = 2;
@ -499,7 +499,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
1) < 0) 1) < 0)
return NULL; return NULL;
if (output_configure(ac, layout_map, layout_map_tags, if (output_configure(ac, layout_map, layout_map_tags,
1, OC_TRIAL_FRAME) < 0) OC_TRIAL_FRAME) < 0)
return NULL; return NULL;
ac->oc[1].m4ac.chan_config = 1; ac->oc[1].m4ac.chan_config = 1;
@ -692,8 +692,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
} else if (m4ac->sbr == 1 && m4ac->ps == -1) } else if (m4ac->sbr == 1 && m4ac->ps == -1)
m4ac->ps = 1; m4ac->ps = 1;
if (ac && (ret = output_configure(ac, layout_map, tags, if (ac && (ret = output_configure(ac, layout_map, tags, OC_GLOBAL_HDR)))
channel_config, OC_GLOBAL_HDR)))
return ret; return ret;
if (extension_flag) { if (extension_flag) {
@ -877,7 +876,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
&layout_map_tags, ac->oc[1].m4ac.chan_config); &layout_map_tags, ac->oc[1].m4ac.chan_config);
if (!ret) if (!ret)
output_configure(ac, layout_map, layout_map_tags, output_configure(ac, layout_map, layout_map_tags,
ac->oc[1].m4ac.chan_config, OC_GLOBAL_HDR); OC_GLOBAL_HDR);
else if (avctx->err_recognition & AV_EF_EXPLODE) else if (avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -967,7 +966,7 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
/** /**
* Decode Long Term Prediction data; reference: table 4.xx. * Decode Long Term Prediction data; reference: table 4.xx.
*/ */
static void decode_ltp(AACContext *ac, LongTermPrediction *ltp, static void decode_ltp(LongTermPrediction *ltp,
GetBitContext *gb, uint8_t max_sfb) GetBitContext *gb, uint8_t max_sfb)
{ {
int sfb; int sfb;
@ -1028,7 +1027,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
goto fail; goto fail;
} else { } else {
if ((ics->ltp.present = get_bits(gb, 1))) if ((ics->ltp.present = get_bits(gb, 1)))
decode_ltp(ac, &ics->ltp, gb, ics->max_sfb); decode_ltp(&ics->ltp, gb, ics->max_sfb);
} }
} }
} }
@ -1769,7 +1768,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
cpe->ch[1].ics.use_kb_window[1] = i; cpe->ch[1].ics.use_kb_window[1] = i;
if (cpe->ch[1].ics.predictor_present && (ac->oc[1].m4ac.object_type != AOT_AAC_MAIN)) if (cpe->ch[1].ics.predictor_present && (ac->oc[1].m4ac.object_type != AOT_AAC_MAIN))
if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1))) if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1)))
decode_ltp(ac, &cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb); decode_ltp(&cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb);
ms_present = get_bits(gb, 2); ms_present = get_bits(gb, 2);
if (ms_present == 3) { if (ms_present == 3) {
av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n"); av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
@ -1896,12 +1895,10 @@ static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc,
/** /**
* Decode dynamic range information; reference: table 4.52. * Decode dynamic range information; reference: table 4.52.
* *
* @param cnt length of TYPE_FIL syntactic element in bytes
*
* @return Returns number of bytes consumed. * @return Returns number of bytes consumed.
*/ */
static int decode_dynamic_range(DynamicRangeControl *che_drc, static int decode_dynamic_range(DynamicRangeControl *che_drc,
GetBitContext *gb, int cnt) GetBitContext *gb)
{ {
int n = 1; int n = 1;
int drc_num_bands = 1; int drc_num_bands = 1;
@ -2004,14 +2001,14 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
ac->oc[1].m4ac.sbr = 1; ac->oc[1].m4ac.sbr = 1;
ac->oc[1].m4ac.ps = 1; ac->oc[1].m4ac.ps = 1;
output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags, output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
ac->oc[1].m4ac.chan_config, ac->oc[1].status); ac->oc[1].status);
} else { } else {
ac->oc[1].m4ac.sbr = 1; ac->oc[1].m4ac.sbr = 1;
} }
res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type); res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
break; break;
case EXT_DYNAMIC_RANGE: case EXT_DYNAMIC_RANGE:
res = decode_dynamic_range(&ac->che_drc, gb, cnt); res = decode_dynamic_range(&ac->che_drc, gb);
break; break;
case EXT_FILL: case EXT_FILL:
decode_fill(ac, gb, 8 * cnt - 4); decode_fill(ac, gb, 8 * cnt - 4);
@ -2398,7 +2395,6 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
&layout_map_tags, hdr_info.chan_config)) &layout_map_tags, hdr_info.chan_config))
return -7; return -7;
if (output_configure(ac, layout_map, layout_map_tags, if (output_configure(ac, layout_map, layout_map_tags,
hdr_info.chan_config,
FFMAX(ac->oc[1].status, OC_TRIAL_FRAME))) FFMAX(ac->oc[1].status, OC_TRIAL_FRAME)))
return -7; return -7;
} else { } else {
@ -2415,7 +2411,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
layout_map[0][1] = 0; layout_map[0][1] = 0;
layout_map[1][1] = 1; layout_map[1][1] = 1;
if (output_configure(ac, layout_map, layout_map_tags, if (output_configure(ac, layout_map, layout_map_tags,
0, OC_TRIAL_FRAME)) OC_TRIAL_FRAME))
return -7; return -7;
} }
} }
@ -2513,7 +2509,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
"Not evaluating a further program_config_element as this construct is dubious at best.\n"); "Not evaluating a further program_config_element as this construct is dubious at best.\n");
pop_output_configuration(ac); pop_output_configuration(ac);
} else { } else {
err = output_configure(ac, layout_map, tags, 0, OC_TRIAL_PCE); err = output_configure(ac, layout_map, tags, OC_TRIAL_PCE);
if (!err) if (!err)
ac->oc[1].m4ac.chan_config = 0; ac->oc[1].m4ac.chan_config = 0;
pce_found = 1; pce_found = 1;

View File

@ -23,6 +23,14 @@
SECTION_TEXT SECTION_TEXT
%macro CVTPS2PI 2
%if cpuflag(sse)
cvtps2pi %1, %2
%elif cpuflag(3dnow)
pf2id %1, %2
%endif
%endmacro
;--------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------
; void int32_to_float_fmul_scalar(float *dst, const int *src, float mul, int len); ; void int32_to_float_fmul_scalar(float *dst, const int *src, float mul, int len);
;--------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------
@ -88,10 +96,10 @@ cglobal float_to_int16, 3, 3, %1, dst, src, len
packssdw m0, m1 packssdw m0, m1
mova [dstq+lenq], m0 mova [dstq+lenq], m0
%else %else
cvtps2pi m0, [srcq+2*lenq ] CVTPS2PI m0, [srcq+2*lenq ]
cvtps2pi m1, [srcq+2*lenq+ 8] CVTPS2PI m1, [srcq+2*lenq+ 8]
cvtps2pi m2, [srcq+2*lenq+16] CVTPS2PI m2, [srcq+2*lenq+16]
cvtps2pi m3, [srcq+2*lenq+24] CVTPS2PI m3, [srcq+2*lenq+24]
packssdw m0, m1 packssdw m0, m1
packssdw m2, m3 packssdw m2, m3
mova [dstq+lenq ], m0 mova [dstq+lenq ], m0
@ -109,10 +117,8 @@ INIT_XMM sse2
FLOAT_TO_INT16 2 FLOAT_TO_INT16 2
INIT_MMX sse INIT_MMX sse
FLOAT_TO_INT16 0 FLOAT_TO_INT16 0
%define cvtps2pi pf2id
INIT_MMX 3dnow INIT_MMX 3dnow
FLOAT_TO_INT16 0 FLOAT_TO_INT16 0
%undef cvtps2pi
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; void ff_float_to_int16_step(int16_t *dst, const float *src, long len, long step); ; void ff_float_to_int16_step(int16_t *dst, const float *src, long len, long step);
@ -150,10 +156,10 @@ cglobal float_to_int16_step, 4, 7, %1, dst, src, len, step, step3, v1, v2
mov [dstq+step3q*2], v2w mov [dstq+step3q*2], v2w
lea dstq, [dstq+stepq*8] lea dstq, [dstq+stepq*8]
%else %else
cvtps2pi m0, [srcq+2*lenq ] CVTPS2PI m0, [srcq+2*lenq ]
cvtps2pi m1, [srcq+2*lenq+ 8] CVTPS2PI m1, [srcq+2*lenq+ 8]
cvtps2pi m2, [srcq+2*lenq+16] CVTPS2PI m2, [srcq+2*lenq+16]
cvtps2pi m3, [srcq+2*lenq+24] CVTPS2PI m3, [srcq+2*lenq+24]
packssdw m0, m1 packssdw m0, m1
packssdw m2, m3 packssdw m2, m3
movd v1d, m0 movd v1d, m0
@ -189,10 +195,8 @@ INIT_XMM sse2
FLOAT_TO_INT16_STEP 2 FLOAT_TO_INT16_STEP 2
INIT_MMX sse INIT_MMX sse
FLOAT_TO_INT16_STEP 0 FLOAT_TO_INT16_STEP 0
%define cvtps2pi pf2id
INIT_MMX 3dnow INIT_MMX 3dnow
FLOAT_TO_INT16_STEP 0 FLOAT_TO_INT16_STEP 0
%undef cvtps2pi
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
; void ff_float_to_int16_interleave2(int16_t *dst, const float **src, long len); ; void ff_float_to_int16_interleave2(int16_t *dst, const float **src, long len);
@ -215,10 +219,10 @@ cglobal float_to_int16_interleave2, 3, 4, 2, dst, src0, src1, len
punpcklwd m0, m1 punpcklwd m0, m1
mova [dstq+lenq], m0 mova [dstq+lenq], m0
%else %else
cvtps2pi m0, [src0q+lenq ] CVTPS2PI m0, [src0q+lenq ]
cvtps2pi m1, [src0q+lenq+8] CVTPS2PI m1, [src0q+lenq+8]
cvtps2pi m2, [src1q+lenq ] CVTPS2PI m2, [src1q+lenq ]
cvtps2pi m3, [src1q+lenq+8] CVTPS2PI m3, [src1q+lenq+8]
packssdw m0, m1 packssdw m0, m1
packssdw m2, m3 packssdw m2, m3
mova m1, m0 mova m1, m0
@ -236,9 +240,7 @@ cglobal float_to_int16_interleave2, 3, 4, 2, dst, src0, src1, len
%endmacro %endmacro
INIT_MMX 3dnow INIT_MMX 3dnow
%define cvtps2pi pf2id
FLOAT_TO_INT16_INTERLEAVE2 FLOAT_TO_INT16_INTERLEAVE2
%undef cvtps2pi
INIT_MMX sse INIT_MMX sse
FLOAT_TO_INT16_INTERLEAVE2 FLOAT_TO_INT16_INTERLEAVE2
INIT_XMM sse2 INIT_XMM sse2
@ -274,12 +276,12 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, s
sub src4q, srcq sub src4q, srcq
sub src5q, srcq sub src5q, srcq
.loop: .loop:
cvtps2pi mm0, [srcq] CVTPS2PI mm0, [srcq]
cvtps2pi mm1, [srcq+src1q] CVTPS2PI mm1, [srcq+src1q]
cvtps2pi mm2, [srcq+src2q] CVTPS2PI mm2, [srcq+src2q]
cvtps2pi mm3, [srcq+src3q] CVTPS2PI mm3, [srcq+src3q]
cvtps2pi mm4, [srcq+src4q] CVTPS2PI mm4, [srcq+src4q]
cvtps2pi mm5, [srcq+src5q] CVTPS2PI mm5, [srcq+src5q]
packssdw mm0, mm3 packssdw mm0, mm3
packssdw mm1, mm4 packssdw mm1, mm4
packssdw mm2, mm5 packssdw mm2, mm5
@ -306,13 +308,11 @@ INIT_MMX sse
%define pswapd PSWAPD_SSE %define pswapd PSWAPD_SSE
FLOAT_TO_INT16_INTERLEAVE6 FLOAT_TO_INT16_INTERLEAVE6
INIT_MMX 3dnow INIT_MMX 3dnow
%define cvtps2pi pf2id
%define pswapd PSWAPD_3DNOW %define pswapd PSWAPD_3DNOW
FLOAT_TO_INT16_INTERLEAVE6 FLOAT_TO_INT16_INTERLEAVE6
%undef pswapd %undef pswapd
INIT_MMX 3dnowext INIT_MMX 3dnowext
FLOAT_TO_INT16_INTERLEAVE6 FLOAT_TO_INT16_INTERLEAVE6
%undef cvtps2pi
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; void ff_float_interleave6(float *dst, const float **src, unsigned int len); ; void ff_float_interleave6(float *dst, const float **src, unsigned int len);