* qatar/master: os_support: Choose between direct.h and io.h using a configure check os_support: Include io.h instead of direct.h on mingw32ce x86: ac3dsp: Only refer to the ac3_downmix_sse symbol if it has been declared swscale: Remove two bogus asserts ac3: move ac3_downmix() from dsputil to ac3dsp lavr/audio_mix_matrix: acknowledge the existence of LFE2. mlp_parser: avoid mapping multiple disctinct TrueHD channels to the same Libav channel. lavu/audioconvert: add a second low frequency channel. Conflicts: doc/APIchanges libavcodec/ac3dsp.c libavcodec/ac3dsp.h libavcodec/mlp_parser.c libavutil/audioconvert.c libavutil/version.h
Unified · Split
| @@ -1276,6 +1276,7 @@ HAVE_LIST=" · 1275 unmodified lines | |||
| 1276 | dev_ic_bt8xx_h | 1276 | dev_ic_bt8xx_h |
| 1277 | dev_video_bktr_ioctl_bt848_h | 1277 | dev_video_bktr_ioctl_bt848_h |
| 1278 | dev_video_meteor_ioctl_meteor_h | 1278 | dev_video_meteor_ioctl_meteor_h |
| 1279 | direct_h | ||
| 1279 | dlfcn_h | 1280 | dlfcn_h |
| 1280 | dlopen | 1281 | dlopen |
| 1281 | dos_paths | 1282 | dos_paths |
| @@ -3504,6 +3505,7 @@ check_func_headers windows.h Sleep · 2222 unmodified lines | |||
| 3504 | check_func_headers windows.h VirtualAlloc | 3505 | check_func_headers windows.h VirtualAlloc |
| 3505 | check_func_headers glob.h glob | 3506 | check_func_headers glob.h glob |
| 3506 | 3507 | ||
| 3508 | check_header direct.h | ||
| 3507 | check_header dlfcn.h | 3509 | check_header dlfcn.h |
| 3508 | check_header dxva.h | 3510 | check_header dxva.h |
| 3509 | check_header dxva2api.h -D_WIN32_WINNT=0x0600 | 3511 | check_header dxva2api.h -D_WIN32_WINNT=0x0600 |
| @@ -83,6 +83,9 @@ API changes, most recent first: · 82 unmodified lines | |||
| 83 | 2012-03-26 - a67d9cf - lavfi 2.66.100 | 83 | 2012-03-26 - a67d9cf - lavfi 2.66.100 |
| 84 | Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. | 84 | Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. |
| 85 | 85 | ||
| 86 | 2012-09-12 - xxxxxxx - lavu 51.41.0 - audioconvert.h | ||
| 87 | Added AV_CH_LOW_FREQUENCY_2 channel mask value. | ||
| 88 | |||
| 86 | 2012-09-04 - xxxxxxx - lavu 51.40.0 - opt.h | 89 | 2012-09-04 - xxxxxxx - lavu 51.40.0 - opt.h |
| 87 | Reordered the fields in default_val in AVOption, changed which | 90 | Reordered the fields in default_val in AVOption, changed which |
| 88 | default_val field is used for which AVOptionType. | 91 | default_val field is used for which AVOptionType. |
| @@ -620,34 +620,6 @@ static inline void do_imdct(AC3DecodeContext *s, int channels) · 619 unmodified lines | |||
| 620 | } | 620 | } |
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | /** | ||
| 624 | * Downmix the output to mono or stereo. | ||
| 625 | */ | ||
| 626 | void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2], | ||
| 627 | int out_ch, int in_ch, int len) | ||
| 628 | { | ||
| 629 | int i, j; | ||
| 630 | float v0, v1; | ||
| 631 | if (out_ch == 2) { | ||
| 632 | for (i = 0; i < len; i++) { | ||
| 633 | v0 = v1 = 0.0f; | ||
| 634 | for (j = 0; j < in_ch; j++) { | ||
| 635 | v0 += samples[j][i] * matrix[j][0]; | ||
| 636 | v1 += samples[j][i] * matrix[j][1]; | ||
| 637 | } | ||
| 638 | samples[0][i] = v0; | ||
| 639 | samples[1][i] = v1; | ||
| 640 | } | ||
| 641 | } else if (out_ch == 1) { | ||
| 642 | for (i = 0; i < len; i++) { | ||
| 643 | v0 = 0.0f; | ||
| 644 | for (j = 0; j < in_ch; j++) | ||
| 645 | v0 += samples[j][i] * matrix[j][0]; | ||
| 646 | samples[0][i] = v0; | ||
| 647 | } | ||
| 648 | } | ||
| 649 | } | ||
| 650 | |||
| 651 | /** | 623 | /** |
| 652 | * Upmix delay samples from stereo to original channel layout. | 624 | * Upmix delay samples from stereo to original channel layout. |
| 653 | */ | 625 | */ |
| @@ -1266,19 +1238,19 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) · 612 unmodified lines | |||
| 1266 | do_imdct(s, s->channels); | 1238 | do_imdct(s, s->channels); |
| 1267 | 1239 | ||
| 1268 | if (downmix_output) { | 1240 | if (downmix_output) { |
| 1269 | s->dsp.ac3_downmix(s->output, s->downmix_coeffs, | 1241 | s->ac3dsp.downmix(s->output, s->downmix_coeffs, |
| 1270 | s->out_channels, s->fbw_channels, 256); | 1242 | s->out_channels, s->fbw_channels, 256); |
| 1271 | } | 1243 | } |
| 1272 | } else { | 1244 | } else { |
| 1273 | if (downmix_output) { | 1245 | if (downmix_output) { |
| 1274 | s->dsp.ac3_downmix(s->transform_coeffs + 1, s->downmix_coeffs, | 1246 | s->ac3dsp.downmix(s->transform_coeffs + 1, s->downmix_coeffs, |
| 1275 | s->out_channels, s->fbw_channels, 256); | 1247 | s->out_channels, s->fbw_channels, 256); |
| 1276 | } | 1248 | } |
| 1277 | 1249 | ||
| 1278 | if (downmix_output && !s->downmixed) { | 1250 | if (downmix_output && !s->downmixed) { |
| 1279 | s->downmixed = 1; | 1251 | s->downmixed = 1; |
| 1280 | s->dsp.ac3_downmix(s->delay, s->downmix_coeffs, s->out_channels, | 1252 | s->ac3dsp.downmix(s->delay, s->downmix_coeffs, s->out_channels, |
| 1281 | s->fbw_channels, 128); | 1253 | s->fbw_channels, 128); |
| 1282 | } | 1254 | } |
| 1283 | 1255 | ||
| 1284 | do_imdct(s, s->out_channels); | 1256 | do_imdct(s, s->out_channels); |
| @@ -227,9 +227,6 @@ int ff_eac3_parse_header(AC3DecodeContext *s); · 226 unmodified lines | |||
| 227 | */ | 227 | */ |
| 228 | void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch); | 228 | void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch); |
| 229 | 229 | ||
| 230 | void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2], | ||
| 231 | int out_ch, int in_ch, int len); | ||
| 232 | |||
| 233 | /** | 230 | /** |
| 234 | * Apply spectral extension to each channel by copying lower frequency | 231 | * Apply spectral extension to each channel by copying lower frequency |
| 235 | * coefficients to higher frequency bins and applying side information to | 232 | * coefficients to higher frequency bins and applying side information to |
| @@ -214,6 +214,31 @@ static void ac3_sum_square_butterfly_float_c(float sum[4], · 213 unmodified lines | |||
| 214 | } | 214 | } |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | static void ac3_downmix_c(float (*samples)[256], float (*matrix)[2], | ||
| 218 | int out_ch, int in_ch, int len) | ||
| 219 | { | ||
| 220 | int i, j; | ||
| 221 | float v0, v1; | ||
| 222 | if (out_ch == 2) { | ||
| 223 | for (i = 0; i < len; i++) { | ||
| 224 | v0 = v1 = 0.0f; | ||
| 225 | for (j = 0; j < in_ch; j++) { | ||
| 226 | v0 += samples[j][i] * matrix[j][0]; | ||
| 227 | v1 += samples[j][i] * matrix[j][1]; | ||
| 228 | } | ||
| 229 | samples[0][i] = v0; | ||
| 230 | samples[1][i] = v1; | ||
| 231 | } | ||
| 232 | } else if (out_ch == 1) { | ||
| 233 | for (i = 0; i < len; i++) { | ||
| 234 | v0 = 0.0f; | ||
| 235 | for (j = 0; j < in_ch; j++) | ||
| 236 | v0 += samples[j][i] * matrix[j][0]; | ||
| 237 | samples[0][i] = v0; | ||
| 238 | } | ||
| 239 | } | ||
| 240 | } | ||
| 241 | |||
| 217 | av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact) | 242 | av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact) |
| 218 | { | 243 | { |
| 219 | c->ac3_exponent_min = ac3_exponent_min_c; | 244 | c->ac3_exponent_min = ac3_exponent_min_c; |
| @@ -227,6 +252,7 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact) · 7 unmodified lines | |||
| 227 | c->extract_exponents = ac3_extract_exponents_c; | 252 | c->extract_exponents = ac3_extract_exponents_c; |
| 228 | c->sum_square_butterfly_int32 = ac3_sum_square_butterfly_int32_c; | 253 | c->sum_square_butterfly_int32 = ac3_sum_square_butterfly_int32_c; |
| 229 | c->sum_square_butterfly_float = ac3_sum_square_butterfly_float_c; | 254 | c->sum_square_butterfly_float = ac3_sum_square_butterfly_float_c; |
| 255 | c->downmix = ac3_downmix_c; | ||
| 230 | 256 | ||
| 231 | if (ARCH_ARM) | 257 | if (ARCH_ARM) |
| 232 | ff_ac3dsp_init_arm(c, bit_exact); | 258 | ff_ac3dsp_init_arm(c, bit_exact); |
| @@ -131,6 +131,9 @@ typedef struct AC3DSPContext { · 130 unmodified lines | |||
| 131 | 131 | ||
| 132 | void (*sum_square_butterfly_float)(float sum[4], const float *coef0, | 132 | void (*sum_square_butterfly_float)(float sum[4], const float *coef0, |
| 133 | const float *coef1, int len); | 133 | const float *coef1, int len); |
| 134 | |||
| 135 | void (*downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, | ||
| 136 | int in_ch, int len); | ||
| 134 | } AC3DSPContext; | 137 | } AC3DSPContext; |
| 135 | 138 | ||
| 136 | void ff_ac3dsp_init (AC3DSPContext *c, int bit_exact); | 139 | void ff_ac3dsp_init (AC3DSPContext *c, int bit_exact); |
| @@ -36,7 +36,6 @@ · 35 unmodified lines | |||
| 36 | #include "mathops.h" | 36 | #include "mathops.h" |
| 37 | #include "mpegvideo.h" | 37 | #include "mpegvideo.h" |
| 38 | #include "config.h" | 38 | #include "config.h" |
| 39 | #include "ac3dec.h" | ||
| 40 | #include "vorbis.h" | 39 | #include "vorbis.h" |
| 41 | #include "diracdsp.h" | 40 | #include "diracdsp.h" |
| 42 | 41 | ||
| @@ -3032,9 +3031,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) · 2989 unmodified lines | |||
| 3032 | 3031 | ||
| 3033 | #if CONFIG_VORBIS_DECODER | 3032 | #if CONFIG_VORBIS_DECODER |
| 3034 | c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling; | 3033 | c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling; |
| 3035 | #endif | ||
| 3036 | #if CONFIG_AC3_DECODER | ||
| 3037 | c->ac3_downmix = ff_ac3_downmix_c; | ||
| 3038 | #endif | 3034 | #endif |
| 3039 | c->vector_fmul_reverse = vector_fmul_reverse_c; | 3035 | c->vector_fmul_reverse = vector_fmul_reverse_c; |
| 3040 | c->vector_fmul_add = vector_fmul_add_c; | 3036 | c->vector_fmul_add = vector_fmul_add_c; |
| @@ -384,7 +384,6 @@ typedef struct DSPContext { · 383 unmodified lines | |||
| 384 | 384 | ||
| 385 | /* assume len is a multiple of 4, and arrays are 16-byte aligned */ | 385 | /* assume len is a multiple of 4, and arrays are 16-byte aligned */ |
| 386 | void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize); | 386 | void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize); |
| 387 | void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len); | ||
| 388 | /* assume len is a multiple of 16, and arrays are 32-byte aligned */ | 387 | /* assume len is a multiple of 16, and arrays are 32-byte aligned */ |
| 389 | void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len); | 388 | void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len); |
| 390 | /* assume len is a multiple of 8, and src arrays are 16-byte aligned */ | 389 | /* assume len is a multiple of 8, and src arrays are 16-byte aligned */ |
| @@ -83,10 +83,10 @@ static const uint64_t thd_layout[13] = { · 82 unmodified lines | |||
| 83 | AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT, // LRrs | 83 | AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT, // LRrs |
| 84 | AV_CH_BACK_CENTER, // Cs | 84 | AV_CH_BACK_CENTER, // Cs |
| 85 | AV_CH_TOP_CENTER, // Ts | 85 | AV_CH_TOP_CENTER, // Ts |
| 86 | AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRsd - TODO: Surround Direct | 86 | AV_CH_SURROUND_DIRECT_LEFT|AV_CH_SURROUND_DIRECT_RIGHT, // LRsd |
| 87 | AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT, // LRw | 87 | AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT, // LRw |
| 88 | AV_CH_TOP_FRONT_CENTER, // Cvh | 88 | AV_CH_TOP_FRONT_CENTER, // Cvh |
| 89 | AV_CH_LOW_FREQUENCY // LFE2 | 89 | AV_CH_LOW_FREQUENCY_2, // LFE2 |
| 90 | }; | 90 | }; |
| 91 | 91 | ||
| 92 | static int mlp_samplerate(int in) | 92 | static int mlp_samplerate(int in) |
| @@ -19,9 +19,11 @@ · 18 unmodified lines | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include "libavutil/mem.h" | ||
| 22 | #include "libavutil/x86/asm.h" | 23 | #include "libavutil/x86/asm.h" |
| 23 | #include "libavutil/x86/cpu.h" | 24 | #include "libavutil/x86/cpu.h" |
| 24 | #include "dsputil_mmx.h" | 25 | #include "dsputil_mmx.h" |
| 26 | #include "libavcodec/ac3.h" | ||
| 25 | #include "libavcodec/ac3dsp.h" | 27 | #include "libavcodec/ac3dsp.h" |
| 26 | 28 | ||
| 27 | extern void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int nb_coefs); | 29 | extern void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int nb_coefs); |
| @@ -49,6 +51,119 @@ extern void ff_ac3_extract_exponents_3dnow(uint8_t *exp, int32_t *coef, int nb_c · 21 unmodified lines | |||
| 49 | extern void ff_ac3_extract_exponents_sse2 (uint8_t *exp, int32_t *coef, int nb_coefs); | 51 | extern void ff_ac3_extract_exponents_sse2 (uint8_t *exp, int32_t *coef, int nb_coefs); |
| 50 | extern void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_coefs); | 52 | extern void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_coefs); |
| 51 | 53 | ||
| 54 | #if HAVE_SSE_INLINE | ||
| 55 | |||
| 56 | #define IF1(x) x | ||
| 57 | #define IF0(x) | ||
| 58 | |||
| 59 | #define MIX5(mono, stereo) \ | ||
| 60 | __asm__ volatile ( \ | ||
| 61 | "movss 0(%2), %%xmm5 \n" \ | ||
| 62 | "movss 8(%2), %%xmm6 \n" \ | ||
| 63 | "movss 24(%2), %%xmm7 \n" \ | ||
| 64 | "shufps $0, %%xmm5, %%xmm5 \n" \ | ||
| 65 | "shufps $0, %%xmm6, %%xmm6 \n" \ | ||
| 66 | "shufps $0, %%xmm7, %%xmm7 \n" \ | ||
| 67 | "1: \n" \ | ||
| 68 | "movaps (%0, %1), %%xmm0 \n" \ | ||
| 69 | "movaps 0x400(%0, %1), %%xmm1 \n" \ | ||
| 70 | "movaps 0x800(%0, %1), %%xmm2 \n" \ | ||
| 71 | "movaps 0xc00(%0, %1), %%xmm3 \n" \ | ||
| 72 | "movaps 0x1000(%0, %1), %%xmm4 \n" \ | ||
| 73 | "mulps %%xmm5, %%xmm0 \n" \ | ||
| 74 | "mulps %%xmm6, %%xmm1 \n" \ | ||
| 75 | "mulps %%xmm5, %%xmm2 \n" \ | ||
| 76 | "mulps %%xmm7, %%xmm3 \n" \ | ||
| 77 | "mulps %%xmm7, %%xmm4 \n" \ | ||
| 78 | stereo("addps %%xmm1, %%xmm0 \n") \ | ||
| 79 | "addps %%xmm1, %%xmm2 \n" \ | ||
| 80 | "addps %%xmm3, %%xmm0 \n" \ | ||
| 81 | "addps %%xmm4, %%xmm2 \n" \ | ||
| 82 | mono("addps %%xmm2, %%xmm0 \n") \ | ||
| 83 | "movaps %%xmm0, (%0, %1) \n" \ | ||
| 84 | stereo("movaps %%xmm2, 0x400(%0, %1) \n") \ | ||
| 85 | "add $16, %0 \n" \ | ||
| 86 | "jl 1b \n" \ | ||
| 87 | : "+&r"(i) \ | ||
| 88 | : "r"(samples[0] + len), "r"(matrix) \ | ||
| 89 | : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ | ||
| 90 | "%xmm4", "%xmm5", "%xmm6", "%xmm7",) \ | ||
| 91 | "memory" \ | ||
| 92 | ); | ||
| 93 | |||
| 94 | #define MIX_MISC(stereo) \ | ||
| 95 | __asm__ volatile ( \ | ||
| 96 | "1: \n" \ | ||
| 97 | "movaps (%3, %0), %%xmm0 \n" \ | ||
| 98 | stereo("movaps %%xmm0, %%xmm1 \n") \ | ||
| 99 | "mulps %%xmm4, %%xmm0 \n" \ | ||
| 100 | stereo("mulps %%xmm5, %%xmm1 \n") \ | ||
| 101 | "lea 1024(%3, %0), %1 \n" \ | ||
| 102 | "mov %5, %2 \n" \ | ||
| 103 | "2: \n" \ | ||
| 104 | "movaps (%1), %%xmm2 \n" \ | ||
| 105 | stereo("movaps %%xmm2, %%xmm3 \n") \ | ||
| 106 | "mulps (%4, %2), %%xmm2 \n" \ | ||
| 107 | stereo("mulps 16(%4, %2), %%xmm3 \n") \ | ||
| 108 | "addps %%xmm2, %%xmm0 \n" \ | ||
| 109 | stereo("addps %%xmm3, %%xmm1 \n") \ | ||
| 110 | "add $1024, %1 \n" \ | ||
| 111 | "add $32, %2 \n" \ | ||
| 112 | "jl 2b \n" \ | ||
| 113 | "movaps %%xmm0, (%3, %0) \n" \ | ||
| 114 | stereo("movaps %%xmm1, 1024(%3, %0) \n") \ | ||
| 115 | "add $16, %0 \n" \ | ||
| 116 | "jl 1b \n" \ | ||
| 117 | : "+&r"(i), "=&r"(j), "=&r"(k) \ | ||
| 118 | : "r"(samples[0] + len), "r"(matrix_simd + in_ch), \ | ||
| 119 | "g"((intptr_t) - 32 * (in_ch - 1)) \ | ||
| 120 | : "memory" \ | ||
| 121 | ); | ||
| 122 | |||
| 123 | static void ac3_downmix_sse(float (*samples)[256], float (*matrix)[2], | ||
| 124 | int out_ch, int in_ch, int len) | ||
| 125 | { | ||
| 126 | int (*matrix_cmp)[2] = (int(*)[2])matrix; | ||
| 127 | intptr_t i, j, k; | ||
| 128 | |||
| 129 | i = -len * sizeof(float); | ||
| 130 | if (in_ch == 5 && out_ch == 2 && | ||
| 131 | !(matrix_cmp[0][1] | matrix_cmp[2][0] | | ||
| 132 | matrix_cmp[3][1] | matrix_cmp[4][0] | | ||
| 133 | (matrix_cmp[1][0] ^ matrix_cmp[1][1]) | | ||
| 134 | (matrix_cmp[0][0] ^ matrix_cmp[2][1]))) { | ||
| 135 | MIX5(IF0, IF1); | ||
| 136 | } else if (in_ch == 5 && out_ch == 1 && | ||
| 137 | matrix_cmp[0][0] == matrix_cmp[2][0] && | ||
| 138 | matrix_cmp[3][0] == matrix_cmp[4][0]) { | ||
| 139 | MIX5(IF1, IF0); | ||
| 140 | } else { | ||
| 141 | DECLARE_ALIGNED(16, float, matrix_simd)[AC3_MAX_CHANNELS][2][4]; | ||
| 142 | j = 2 * in_ch * sizeof(float); | ||
| 143 | __asm__ volatile ( | ||
| 144 | "1: \n" | ||
| 145 | "sub $8, %0 \n" | ||
| 146 | "movss (%2, %0), %%xmm4 \n" | ||
| 147 | "movss 4(%2, %0), %%xmm5 \n" | ||
| 148 | "shufps $0, %%xmm4, %%xmm4 \n" | ||
| 149 | "shufps $0, %%xmm5, %%xmm5 \n" | ||
| 150 | "movaps %%xmm4, (%1, %0, 4) \n" | ||
| 151 | "movaps %%xmm5, 16(%1, %0, 4) \n" | ||
| 152 | "jg 1b \n" | ||
| 153 | : "+&r"(j) | ||
| 154 | : "r"(matrix_simd), "r"(matrix) | ||
| 155 | : "memory" | ||
| 156 | ); | ||
| 157 | if (out_ch == 2) { | ||
| 158 | MIX_MISC(IF1); | ||
| 159 | } else { | ||
| 160 | MIX_MISC(IF0); | ||
| 161 | } | ||
| 162 | } | ||
| 163 | } | ||
| 164 | |||
| 165 | #endif /* HAVE_SSE_INLINE */ | ||
| 166 | |||
| 52 | av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact) | 167 | av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact) |
| 53 | { | 168 | { |
| 54 | int mm_flags = av_get_cpu_flags(); | 169 | int mm_flags = av_get_cpu_flags(); |
| @@ -89,4 +204,10 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact) · 34 unmodified lines | |||
| 89 | c->extract_exponents = ff_ac3_extract_exponents_ssse3; | 204 | c->extract_exponents = ff_ac3_extract_exponents_ssse3; |
| 90 | } | 205 | } |
| 91 | } | 206 | } |
| 207 | |||
| 208 | #if HAVE_SSE_INLINE | ||
| 209 | if (INLINE_SSE(mm_flags)) { | ||
| 210 | c->downmix = ac3_downmix_sse; | ||
| 211 | } | ||
| 212 | #endif | ||
| 92 | } | 213 | } |
| @@ -28,7 +28,6 @@ · 27 unmodified lines | |||
| 28 | #include "libavcodec/h264dsp.h" | 28 | #include "libavcodec/h264dsp.h" |
| 29 | #include "libavcodec/mpegvideo.h" | 29 | #include "libavcodec/mpegvideo.h" |
| 30 | #include "libavcodec/simple_idct.h" | 30 | #include "libavcodec/simple_idct.h" |
| 31 | #include "libavcodec/ac3dec.h" | ||
| 32 | #include "dsputil_mmx.h" | 31 | #include "dsputil_mmx.h" |
| 33 | #include "idct_xvid.h" | 32 | #include "idct_xvid.h" |
| 34 | #include "diracdsp_mmx.h" | 33 | #include "diracdsp_mmx.h" |
| @@ -2375,115 +2374,6 @@ static void vorbis_inverse_coupling_sse(float *mag, float *ang, int blocksize) · 2340 unmodified lines | |||
| 2375 | } | 2374 | } |
| 2376 | } | 2375 | } |
| 2377 | 2376 | ||
| 2378 | #define IF1(x) x | ||
| 2379 | #define IF0(x) | ||
| 2380 | |||
| 2381 | #define MIX5(mono, stereo) \ | ||
| 2382 | __asm__ volatile ( \ | ||
| 2383 | "movss 0(%2), %%xmm5 \n" \ | ||
| 2384 | "movss 8(%2), %%xmm6 \n" \ | ||
| 2385 | "movss 24(%2), %%xmm7 \n" \ | ||
| 2386 | "shufps $0, %%xmm5, %%xmm5 \n" \ | ||
| 2387 | "shufps $0, %%xmm6, %%xmm6 \n" \ | ||
| 2388 | "shufps $0, %%xmm7, %%xmm7 \n" \ | ||
| 2389 | "1: \n" \ | ||
| 2390 | "movaps (%0, %1), %%xmm0 \n" \ | ||
| 2391 | "movaps 0x400(%0, %1), %%xmm1 \n" \ | ||
| 2392 | "movaps 0x800(%0, %1), %%xmm2 \n" \ | ||
| 2393 | "movaps 0xc00(%0, %1), %%xmm3 \n" \ | ||
| 2394 | "movaps 0x1000(%0, %1), %%xmm4 \n" \ | ||
| 2395 | "mulps %%xmm5, %%xmm0 \n" \ | ||
| 2396 | "mulps %%xmm6, %%xmm1 \n" \ | ||
| 2397 | "mulps %%xmm5, %%xmm2 \n" \ | ||
| 2398 | "mulps %%xmm7, %%xmm3 \n" \ | ||
| 2399 | "mulps %%xmm7, %%xmm4 \n" \ | ||
| 2400 | stereo("addps %%xmm1, %%xmm0 \n") \ | ||
| 2401 | "addps %%xmm1, %%xmm2 \n" \ | ||
| 2402 | "addps %%xmm3, %%xmm0 \n" \ | ||
| 2403 | "addps %%xmm4, %%xmm2 \n" \ | ||
| 2404 | mono("addps %%xmm2, %%xmm0 \n") \ | ||
| 2405 | "movaps %%xmm0, (%0, %1) \n" \ | ||
| 2406 | stereo("movaps %%xmm2, 0x400(%0, %1) \n") \ | ||
| 2407 | "add $16, %0 \n" \ | ||
| 2408 | "jl 1b \n" \ | ||
| 2409 | : "+&r"(i) \ | ||
| 2410 | : "r"(samples[0] + len), "r"(matrix) \ | ||
| 2411 | : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ | ||
| 2412 | "%xmm4", "%xmm5", "%xmm6", "%xmm7",) \ | ||
| 2413 | "memory" \ | ||
| 2414 | ); | ||
| 2415 | |||
| 2416 | #define MIX_MISC(stereo) \ | ||
| 2417 | __asm__ volatile ( \ | ||
| 2418 | "1: \n" \ | ||
| 2419 | "movaps (%3, %0), %%xmm0 \n" \ | ||
| 2420 | stereo("movaps %%xmm0, %%xmm1 \n") \ | ||
| 2421 | "mulps %%xmm4, %%xmm0 \n" \ | ||
| 2422 | stereo("mulps %%xmm5, %%xmm1 \n") \ | ||
| 2423 | "lea 1024(%3, %0), %1 \n" \ | ||
| 2424 | "mov %5, %2 \n" \ | ||
| 2425 | "2: \n" \ | ||
| 2426 | "movaps (%1), %%xmm2 \n" \ | ||
| 2427 | stereo("movaps %%xmm2, %%xmm3 \n") \ | ||
| 2428 | "mulps (%4, %2), %%xmm2 \n" \ | ||
| 2429 | stereo("mulps 16(%4, %2), %%xmm3 \n") \ | ||
| 2430 | "addps %%xmm2, %%xmm0 \n" \ | ||
| 2431 | stereo("addps %%xmm3, %%xmm1 \n") \ | ||
| 2432 | "add $1024, %1 \n" \ | ||
| 2433 | "add $32, %2 \n" \ | ||
| 2434 | "jl 2b \n" \ | ||
| 2435 | "movaps %%xmm0, (%3, %0) \n" \ | ||
| 2436 | stereo("movaps %%xmm1, 1024(%3, %0) \n") \ | ||
| 2437 | "add $16, %0 \n" \ | ||
| 2438 | "jl 1b \n" \ | ||
| 2439 | : "+&r"(i), "=&r"(j), "=&r"(k) \ | ||
| 2440 | : "r"(samples[0] + len), "r"(matrix_simd + in_ch), \ | ||
| 2441 | "g"((intptr_t) - 32 * (in_ch - 1)) \ | ||
| 2442 | : "memory" \ | ||
| 2443 | ); | ||
| 2444 | |||
| 2445 | static void ac3_downmix_sse(float (*samples)[256], float (*matrix)[2], | ||
| 2446 | int out_ch, int in_ch, int len) | ||
| 2447 | { | ||
| 2448 | int (*matrix_cmp)[2] = (int(*)[2])matrix; | ||
| 2449 | intptr_t i, j, k; | ||
| 2450 | |||
| 2451 | i = -len * sizeof(float); | ||
| 2452 | if (in_ch == 5 && out_ch == 2 && | ||
| 2453 | !(matrix_cmp[0][1] | matrix_cmp[2][0] | | ||
| 2454 | matrix_cmp[3][1] | matrix_cmp[4][0] | | ||
| 2455 | (matrix_cmp[1][0] ^ matrix_cmp[1][1]) | | ||
| 2456 | (matrix_cmp[0][0] ^ matrix_cmp[2][1]))) { | ||
| 2457 | MIX5(IF0, IF1); | ||
| 2458 | } else if (in_ch == 5 && out_ch == 1 && | ||
| 2459 | matrix_cmp[0][0] == matrix_cmp[2][0] && | ||
| 2460 | matrix_cmp[3][0] == matrix_cmp[4][0]) { | ||
| 2461 | MIX5(IF1, IF0); | ||
| 2462 | } else { | ||
| 2463 | DECLARE_ALIGNED(16, float, matrix_simd)[AC3_MAX_CHANNELS][2][4]; | ||
| 2464 | j = 2 * in_ch * sizeof(float); | ||
| 2465 | __asm__ volatile ( | ||
| 2466 | "1: \n" | ||
| 2467 | "sub $8, %0 \n" | ||
| 2468 | "movss (%2, %0), %%xmm4 \n" | ||
| 2469 | "movss 4(%2, %0), %%xmm5 \n" | ||
| 2470 | "shufps $0, %%xmm4, %%xmm4 \n" | ||
| 2471 | "shufps $0, %%xmm5, %%xmm5 \n" | ||
| 2472 | "movaps %%xmm4, (%1, %0, 4) \n" | ||
| 2473 | "movaps %%xmm5, 16(%1, %0, 4) \n" | ||
| 2474 | "jg 1b \n" | ||
| 2475 | : "+&r"(j) | ||
| 2476 | : "r"(matrix_simd), "r"(matrix) | ||
| 2477 | : "memory" | ||
| 2478 | ); | ||
| 2479 | if (out_ch == 2) { | ||
| 2480 | MIX_MISC(IF1); | ||
| 2481 | } else { | ||
| 2482 | MIX_MISC(IF0); | ||
| 2483 | } | ||
| 2484 | } | ||
| 2485 | } | ||
| 2486 | |||
| 2487 | #if HAVE_6REGS | 2377 | #if HAVE_6REGS |
| 2488 | static void vector_fmul_window_3dnowext(float *dst, const float *src0, | 2378 | static void vector_fmul_window_3dnowext(float *dst, const float *src0, |
| 2489 | const float *src1, const float *win, | 2379 | const float *src1, const float *win, |
| @@ -2958,7 +2848,6 @@ static void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx, int mm_flags) · 468 unmodified lines | |||
| 2958 | } | 2848 | } |
| 2959 | 2849 | ||
| 2960 | c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse; | 2850 | c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse; |
| 2961 | c->ac3_downmix = ac3_downmix_sse; | ||
| 2962 | 2851 | ||
| 2963 | #if HAVE_6REGS | 2852 | #if HAVE_6REGS |
| 2964 | c->vector_fmul_window = vector_fmul_window_sse; | 2853 | c->vector_fmul_window = vector_fmul_window_sse; |
| @@ -48,7 +48,11 @@ · 47 unmodified lines | |||
| 48 | #endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */ | 48 | #endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */ |
| 49 | 49 | ||
| 50 | #ifdef _WIN32 | 50 | #ifdef _WIN32 |
| 51 | #if HAVE_DIRECT_H | ||
| 51 | #include <direct.h> | 52 | #include <direct.h> |
| 53 | #elif HAVE_IO_H | ||
| 54 | #include <io.h> | ||
| 55 | #endif | ||
| 52 | #define mkdir(a, b) _mkdir(a) | 56 | #define mkdir(a, b) _mkdir(a) |
| 53 | #else | 57 | #else |
| 54 | #include <sys/stat.h> | 58 | #include <sys/stat.h> |
| @@ -54,6 +54,7 @@ · 53 unmodified lines | |||
| 54 | #define WIDE_RIGHT 32 | 54 | #define WIDE_RIGHT 32 |
| 55 | #define SURROUND_DIRECT_LEFT 33 | 55 | #define SURROUND_DIRECT_LEFT 33 |
| 56 | #define SURROUND_DIRECT_RIGHT 34 | 56 | #define SURROUND_DIRECT_RIGHT 34 |
| 57 | #define LOW_FREQUENCY_2 35 | ||
| 57 | 58 | ||
| 58 | #define SQRT3_2 1.22474487139158904909 /* sqrt(3/2) */ | 59 | #define SQRT3_2 1.22474487139158904909 /* sqrt(3/2) */ |
| 59 | 60 | ||
| @@ -59,6 +59,7 @@ static const struct channel_name channel_names[] = { · 58 unmodified lines | |||
| 59 | [32] = { "WR", "wide right" }, | 59 | [32] = { "WR", "wide right" }, |
| 60 | [33] = { "SDL", "surround direct left" }, | 60 | [33] = { "SDL", "surround direct left" }, |
| 61 | [34] = { "SDR", "surround direct right" }, | 61 | [34] = { "SDR", "surround direct right" }, |
| 62 | [35] = { "LFE2", "low frequency 2" }, | ||
| 62 | }; | 63 | }; |
| 63 | 64 | ||
| 64 | static const char *get_channel_name(int channel_id) | 65 | static const char *get_channel_name(int channel_id) |
| @@ -62,6 +62,7 @@ · 61 unmodified lines | |||
| 62 | #define AV_CH_WIDE_RIGHT 0x0000000100000000ULL | 62 | #define AV_CH_WIDE_RIGHT 0x0000000100000000ULL |
| 63 | #define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL | 63 | #define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL |
| 64 | #define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL | 64 | #define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL |
| 65 | #define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL | ||
| 65 | 66 | ||
| 66 | /** Channel mask value used for AVCodecContext.request_channel_layout | 67 | /** Channel mask value used for AVCodecContext.request_channel_layout |
| 67 | to indicate that the user requests the channel order of the decoder output | 68 | to indicate that the user requests the channel order of the decoder output |
| @@ -39,7 +39,7 @@ · 38 unmodified lines | |||
| 39 | */ | 39 | */ |
| 40 | 40 | ||
| 41 | #define LIBAVUTIL_VERSION_MAJOR 51 | 41 | #define LIBAVUTIL_VERSION_MAJOR 51 |
| 42 | #define LIBAVUTIL_VERSION_MINOR 72 | 42 | #define LIBAVUTIL_VERSION_MINOR 73 |
| 43 | #define LIBAVUTIL_VERSION_MICRO 100 | 43 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 44 | 44 | ||
| 45 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | 45 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| @@ -628,8 +628,6 @@ static int swScale(SwsContext *c, const uint8_t *src[], · 627 unmodified lines | |||
| 628 | } | 628 | } |
| 629 | } | 629 | } |
| 630 | } else { | 630 | } else { |
| 631 | assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize * 2); | ||
| 632 | assert(chrUSrcPtr + vChrFilterSize - 1 < chrUPixBuf + vChrBufSize * 2); | ||
| 633 | if (c->yuv2packed1 && vLumFilterSize == 1 && | 631 | if (c->yuv2packed1 && vLumFilterSize == 1 && |
| 634 | vChrFilterSize <= 2) { // unscaled RGB | 632 | vChrFilterSize <= 2) { // unscaled RGB |
| 635 | int chrAlpha = vChrFilterSize == 1 ? 0 : vChrFilter[2 * dstY + 1]; | 633 | int chrAlpha = vChrFilterSize == 1 ? 0 : vChrFilter[2 * dstY + 1]; |