Browse code

Merge remote branch 'qatar/master'

* qatar/master: (23 commits)
ac3enc: correct the flipped sign in the ac3_fixed encoder
Eliminate pointless '#if 1' statements without matching '#else'.
Add AVX FFT implementation.
Increase alignment of av_malloc() as needed by AVX ASM.
Update x86inc.asm from x264 to allow AVX emulation using SSE and MMX.
mjpeg: Detect overreads in mjpeg_decode_scan() and error out.
documentation: extend documentation for ffmpeg -aspect option
APIChanges: update commit hashes for recent additions.
lavc: deprecate FF_*_TYPE macros in favor of AV_PICTURE_TYPE_* enums
aac: add headers needed for log2f()
lavc: remove FF_API_MB_Q cruft
lavc: remove FF_API_RATE_EMU cruft
lavc: remove FF_API_HURRY_UP cruft
pad: make the filter parametric
vsrc_movie: add key_frame and pict_type.
vsrc_movie: fix leak in request_frame()
lavfi: add key_frame and pict_type to AVFilterBufferRefVideo.
vsrc_buffer: add sample_aspect_ratio fields to arguments.
lavfi: add fieldorder filter
scale: make the filter parametric
...

Conflicts:
Changelog
doc/filters.texi
ffmpeg.c
libavcodec/ac3dec.h
libavcodec/dsputil.c
libavfilter/avfilter.h
libavfilter/vf_scale.c
libavfilter/vf_yadif.c
libavfilter/vsrc_buffer.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/04/27 10:51:04
Showing 64 changed files
... ...
@@ -10,7 +10,7 @@ version <next>:
10 10
 - libxvid aspect pickiness fixed
11 11
 - Frame multithreaded decoding
12 12
 - Lots of deprecated API cruft removed
13
-
13
+- fft and imdct optimizations for AVX (Sandy Bridge) processors
14 14
 
15 15
 version 0.7_beta1:
16 16
 
... ...
@@ -13,6 +13,17 @@ libavutil:   2011-04-18
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
+2011-04-XX - bebe72f - lavu 51.1.0 - avutil.h
17
+  Add AVPictureType enum and av_get_picture_type_char(), deprecate
18
+  FF_*_TYPE defines and av_get_pict_type_char() defined in
19
+  libavcodec/avcodec.h.
20
+
21
+2011-04-xx - 10d3940 - lavfi 2.3.0 - avfilter.h
22
+  Add pict_type and key_frame fields to AVFilterBufferRefVideo.
23
+
24
+2011-04-xx - 7a11c82 - lavfi 2.2.0 - vsrc_buffer
25
+  Add sample_aspect_ratio fields to vsrc_buffer arguments
26
+
16 27
 2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h
17 28
   Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading.
18 29
 
... ...
@@ -2908,6 +2908,10 @@ static void opt_frame_aspect_ratio(const char *arg)
2908 2908
         ffmpeg_exit(1);
2909 2909
     }
2910 2910
     frame_aspect_ratio = ar;
2911
+
2912
+    x = vfilters ? strlen(vfilters) : 0;
2913
+    vfilters = av_realloc(vfilters, x+100);
2914
+    snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar);
2911 2915
 }
2912 2916
 
2913 2917
 static int opt_metadata(const char *opt, const char *arg)
... ...
@@ -2185,10 +2185,8 @@ static int open_input_stream(HTTPContext *c, const char *info)
2185 2185
         }
2186 2186
     }
2187 2187
 
2188
-#if 1
2189 2188
     if (c->fmt_in->iformat->read_seek)
2190 2189
         av_seek_frame(c->fmt_in, -1, stream_pos, 0);
2191
-#endif
2192 2190
     /* set the start time (needed for maxtime and RTP packet timing) */
2193 2191
     c->start_time = cur_time;
2194 2192
     c->first_pts = AV_NOPTS_VALUE;
... ...
@@ -223,9 +223,9 @@ typedef struct {
223 223
     float sf[120];                                  ///< scalefactors
224 224
     int sf_idx[128];                                ///< scalefactor indices (used by encoder)
225 225
     uint8_t zeroes[128];                            ///< band is not coded (used by encoder)
226
-    DECLARE_ALIGNED(16, float,   coeffs)[1024];     ///< coefficients for IMDCT
227
-    DECLARE_ALIGNED(16, float,   saved)[1024];      ///< overlap
228
-    DECLARE_ALIGNED(16, float,   ret)[2048];        ///< PCM output
226
+    DECLARE_ALIGNED(32, float,   coeffs)[1024];     ///< coefficients for IMDCT
227
+    DECLARE_ALIGNED(32, float,   saved)[1024];      ///< overlap
228
+    DECLARE_ALIGNED(32, float,   ret)[2048];        ///< PCM output
229 229
     DECLARE_ALIGNED(16, int16_t, ltp_state)[3072];  ///< time signal for LTP
230 230
     PredictorState predictor_state[MAX_PREDICTORS];
231 231
 } SingleChannelElement;
... ...
@@ -272,7 +272,7 @@ typedef struct {
272 272
      * @defgroup temporary aligned temporary buffers (We do not want to have these on the stack.)
273 273
      * @{
274 274
      */
275
-    DECLARE_ALIGNED(16, float, buf_mdct)[1024];
275
+    DECLARE_ALIGNED(32, float, buf_mdct)[1024];
276 276
     /** @} */
277 277
 
278 278
     /**
... ...
@@ -296,7 +296,7 @@ typedef struct {
296 296
     int sf_offset;                                    ///< offset into pow2sf_tab as appropriate for dsp.float_to_int16
297 297
     /** @} */
298 298
 
299
-    DECLARE_ALIGNED(16, float, temp)[128];
299
+    DECLARE_ALIGNED(32, float, temp)[128];
300 300
 
301 301
     enum OCStatus output_configured;
302 302
 } AACContext;
... ...
@@ -37,6 +37,7 @@
37 37
 #include "aac.h"
38 38
 #include "aacenc.h"
39 39
 #include "aactab.h"
40
+#include "libavutil/libm.h"
40 41
 
41 42
 /** bits needed to code codebook run value for long windows */
42 43
 static const uint8_t run_value_bits_long[64] = {
... ...
@@ -64,7 +64,7 @@ typedef struct AACEncContext {
64 64
     int last_frame;
65 65
     float lambda;
66 66
     DECLARE_ALIGNED(16, int,   qcoefs)[96];      ///< quantized coefficients
67
-    DECLARE_ALIGNED(16, float, scoefs)[1024];    ///< scaled coefficients
67
+    DECLARE_ALIGNED(32, float, scoefs)[1024];    ///< scaled coefficients
68 68
 } AACEncContext;
69 69
 
70 70
 #endif /* AVCODEC_AACENC_H */
... ...
@@ -32,6 +32,7 @@
32 32
 #include "aacsbrdata.h"
33 33
 #include "fft.h"
34 34
 #include "aacps.h"
35
+#include "libavutil/libm.h"
35 36
 
36 37
 #include <stdint.h>
37 38
 #include <float.h>
... ...
@@ -201,13 +201,13 @@ typedef struct {
201 201
 ///@}
202 202
 
203 203
 ///@defgroup arrays aligned arrays
204
-    DECLARE_ALIGNED(16, int,   fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS];       ///< fixed-point transform coefficients
205
-    DECLARE_ALIGNED(16, float, transform_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< transform coefficients
206
-    DECLARE_ALIGNED(16, float, delay)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];             ///< delay - added to the next block
207
-    DECLARE_ALIGNED(16, float, window)[AC3_BLOCK_SIZE];                              ///< window coefficients
208
-    DECLARE_ALIGNED(16, float, tmp_output)[AC3_BLOCK_SIZE];                          ///< temporary storage for output before windowing
209
-    DECLARE_ALIGNED(16, float, output)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];            ///< output after imdct transform and windowing
210
-    DECLARE_ALIGNED(16, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread
204
+    DECLARE_ALIGNED(16, int,   fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS];       ///> fixed-point transform coefficients
205
+    DECLARE_ALIGNED(32, float, transform_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< transform coefficients
206
+    DECLARE_ALIGNED(32, float, delay)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];             ///< delay - added to the next block
207
+    DECLARE_ALIGNED(32, float, window)[AC3_BLOCK_SIZE];                              ///< window coefficients
208
+    DECLARE_ALIGNED(32, float, tmp_output)[AC3_BLOCK_SIZE];                          ///< temporary storage for output before windowing
209
+    DECLARE_ALIGNED(32, float, output)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];            ///< output after imdct transform and windowing
210
+    DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread
211 211
 ///@}
212 212
 } AC3DecodeContext;
213 213
 
... ...
@@ -171,7 +171,7 @@ typedef struct AC3EncodeContext {
171 171
 
172 172
     uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< exponent strategies
173 173
 
174
-    DECLARE_ALIGNED(16, SampleType, windowed_samples)[AC3_WINDOW_SIZE];
174
+    DECLARE_ALIGNED(32, SampleType, windowed_samples)[AC3_WINDOW_SIZE];
175 175
 } AC3EncodeContext;
176 176
 
177 177
 typedef struct AC3Mant {
... ...
@@ -47,7 +47,7 @@ static av_cold void mdct_end(AC3MDCTContext *mdct)
47 47
 static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
48 48
                              int nbits)
49 49
 {
50
-    int ret = ff_mdct_init(&mdct->fft, nbits, 0, 1.0);
50
+    int ret = ff_mdct_init(&mdct->fft, nbits, 0, -1.0);
51 51
     mdct->window = ff_ac3_window;
52 52
     return ret;
53 53
 }
... ...
@@ -60,11 +60,11 @@ typedef struct {
60 60
     int                 log2_block_count[AT1_QMF_BANDS];    ///< log2 number of blocks in a band
61 61
     int                 num_bfus;                           ///< number of Block Floating Units
62 62
     float*              spectrum[2];
63
-    DECLARE_ALIGNED(16, float, spec1)[AT1_SU_SAMPLES];     ///< mdct buffer
64
-    DECLARE_ALIGNED(16, float, spec2)[AT1_SU_SAMPLES];     ///< mdct buffer
65
-    DECLARE_ALIGNED(16, float, fst_qmf_delay)[46];         ///< delay line for the 1st stacked QMF filter
66
-    DECLARE_ALIGNED(16, float, snd_qmf_delay)[46];         ///< delay line for the 2nd stacked QMF filter
67
-    DECLARE_ALIGNED(16, float, last_qmf_delay)[256+23];    ///< delay line for the last stacked QMF filter
63
+    DECLARE_ALIGNED(32, float, spec1)[AT1_SU_SAMPLES];     ///< mdct buffer
64
+    DECLARE_ALIGNED(32, float, spec2)[AT1_SU_SAMPLES];     ///< mdct buffer
65
+    DECLARE_ALIGNED(32, float, fst_qmf_delay)[46];         ///< delay line for the 1st stacked QMF filter
66
+    DECLARE_ALIGNED(32, float, snd_qmf_delay)[46];         ///< delay line for the 2nd stacked QMF filter
67
+    DECLARE_ALIGNED(32, float, last_qmf_delay)[256+23];    ///< delay line for the last stacked QMF filter
68 68
 } AT1SUCtx;
69 69
 
70 70
 /**
... ...
@@ -72,13 +72,13 @@ typedef struct {
72 72
  */
73 73
 typedef struct {
74 74
     AT1SUCtx            SUs[AT1_MAX_CHANNELS];              ///< channel sound unit
75
-    DECLARE_ALIGNED(16, float, spec)[AT1_SU_SAMPLES];      ///< the mdct spectrum buffer
75
+    DECLARE_ALIGNED(32, float, spec)[AT1_SU_SAMPLES];      ///< the mdct spectrum buffer
76 76
 
77
-    DECLARE_ALIGNED(16, float,  low)[256];
78
-    DECLARE_ALIGNED(16, float,  mid)[256];
79
-    DECLARE_ALIGNED(16, float, high)[512];
77
+    DECLARE_ALIGNED(32, float,  low)[256];
78
+    DECLARE_ALIGNED(32, float,  mid)[256];
79
+    DECLARE_ALIGNED(32, float, high)[512];
80 80
     float*              bands[3];
81
-    DECLARE_ALIGNED(16, float, out_samples)[AT1_MAX_CHANNELS][AT1_SU_SAMPLES];
81
+    DECLARE_ALIGNED(32, float, out_samples)[AT1_MAX_CHANNELS][AT1_SU_SAMPLES];
82 82
     FFTContext          mdct_ctx[3];
83 83
     int                 channels;
84 84
     DSPContext          dsp;
... ...
@@ -74,8 +74,8 @@ typedef struct {
74 74
     int               gcBlkSwitch;
75 75
     gain_block        gainBlock[2];
76 76
 
77
-    DECLARE_ALIGNED(16, float, spectrum)[1024];
78
-    DECLARE_ALIGNED(16, float, IMDCT_buf)[1024];
77
+    DECLARE_ALIGNED(32, float, spectrum)[1024];
78
+    DECLARE_ALIGNED(32, float, IMDCT_buf)[1024];
79 79
 
80 80
     float             delayBuf1[46]; ///<qmf delay buffers
81 81
     float             delayBuf2[46];
... ...
@@ -122,7 +122,7 @@ typedef struct {
122 122
     FFTContext          mdct_ctx;
123 123
 } ATRAC3Context;
124 124
 
125
-static DECLARE_ALIGNED(16, float,mdct_window)[512];
125
+static DECLARE_ALIGNED(32, float, mdct_window)[512];
126 126
 static VLC              spectral_coeff_tab[7];
127 127
 static float            gain_tab1[16];
128 128
 static float            gain_tab2[31];
... ...
@@ -766,7 +766,7 @@ typedef struct AVPanScan{
766 766
      * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
767 767
      * - decoding: Set by libavcodec.\
768 768
      */\
769
-    int pict_type;\
769
+    enum AVPictureType pict_type;\
770 770
 \
771 771
     /**\
772 772
      * presentation timestamp in time_base units (time when frame should be shown to user)\
... ...
@@ -1016,14 +1016,16 @@ typedef struct AVPanScan{
1016 1016
 #define FF_BUFFER_TYPE_SHARED   4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
1017 1017
 #define FF_BUFFER_TYPE_COPY     8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
1018 1018
 
1019
-
1020
-#define FF_I_TYPE  1 ///< Intra
1021
-#define FF_P_TYPE  2 ///< Predicted
1022
-#define FF_B_TYPE  3 ///< Bi-dir predicted
1023
-#define FF_S_TYPE  4 ///< S(GMC)-VOP MPEG4
1024
-#define FF_SI_TYPE 5 ///< Switching Intra
1025
-#define FF_SP_TYPE 6 ///< Switching Predicted
1026
-#define FF_BI_TYPE 7
1019
+#if FF_API_OLD_FF_PICT_TYPES
1020
+/* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */
1021
+#define FF_I_TYPE  AV_PICTURE_TYPE_I  ///< Intra
1022
+#define FF_P_TYPE  AV_PICTURE_TYPE_P  ///< Predicted
1023
+#define FF_B_TYPE  AV_PICTURE_TYPE_B  ///< Bi-dir predicted
1024
+#define FF_S_TYPE  AV_PICTURE_TYPE_S  ///< S(GMC)-VOP MPEG4
1025
+#define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra
1026
+#define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted
1027
+#define FF_BI_TYPE AV_PICTURE_TYPE_BI
1028
+#endif
1027 1029
 
1028 1030
 #define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore).
1029 1031
 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
... ...
@@ -1215,16 +1217,6 @@ typedef struct AVCodecContext {
1215 1215
      */
1216 1216
     enum PixelFormat pix_fmt;
1217 1217
 
1218
-#if FF_API_RATE_EMU
1219
-    /**
1220
-     * Frame rate emulation. If not zero, the lower layer (i.e. format handler)
1221
-     * has to read frames at native frame rate.
1222
-     * - encoding: Set by user.
1223
-     * - decoding: unused
1224
-     */
1225
-    attribute_deprecated int rate_emu;
1226
-#endif
1227
-
1228 1218
     /**
1229 1219
      * If non NULL, 'draw_horiz_band' is called by the libavcodec
1230 1220
      * decoder to draw a horizontal band. It improves cache usage. Not
... ...
@@ -1326,16 +1318,6 @@ typedef struct AVCodecContext {
1326 1326
 
1327 1327
     int b_frame_strategy;
1328 1328
 
1329
-#if FF_API_HURRY_UP
1330
-    /**
1331
-     * hurry up amount
1332
-     * - encoding: unused
1333
-     * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
1334
-     * @deprecated Deprecated in favor of skip_idct and skip_frame.
1335
-     */
1336
-    attribute_deprecated int hurry_up;
1337
-#endif
1338
-
1339 1329
     struct AVCodec *codec;
1340 1330
 
1341 1331
     void *priv_data;
... ...
@@ -1800,22 +1782,6 @@ typedef struct AVCodecContext {
1800 1800
      */
1801 1801
     uint64_t error[4];
1802 1802
 
1803
-#if FF_API_MB_Q
1804
-    /**
1805
-     * minimum MB quantizer
1806
-     * - encoding: unused
1807
-     * - decoding: unused
1808
-     */
1809
-    attribute_deprecated int mb_qmin;
1810
-
1811
-    /**
1812
-     * maximum MB quantizer
1813
-     * - encoding: unused
1814
-     * - decoding: unused
1815
-     */
1816
-    attribute_deprecated int mb_qmax;
1817
-#endif
1818
-
1819 1803
     /**
1820 1804
      * motion estimation comparison function
1821 1805
      * - encoding: Set by user.
... ...
@@ -3866,13 +3832,17 @@ void avcodec_default_free_buffers(AVCodecContext *s);
3866 3866
 
3867 3867
 /* misc useful functions */
3868 3868
 
3869
+#if FF_API_OLD_FF_PICT_TYPES
3869 3870
 /**
3870 3871
  * Return a single letter to describe the given picture type pict_type.
3871 3872
  *
3872 3873
  * @param[in] pict_type the picture type
3873 3874
  * @return A single character representing the picture type.
3875
+ * @deprecated Use av_get_picture_type_char() instead.
3874 3876
  */
3877
+attribute_deprecated
3875 3878
 char av_get_pict_type_char(int pict_type);
3879
+#endif
3876 3880
 
3877 3881
 /**
3878 3882
  * Return codec bits per sample.
... ...
@@ -55,7 +55,7 @@ typedef struct {
55 55
     int num_bands;
56 56
     unsigned int *bands;
57 57
     float root;
58
-    DECLARE_ALIGNED(16, FFTSample, coeffs)[BINK_BLOCK_MAX_SIZE];
58
+    DECLARE_ALIGNED(32, FFTSample, coeffs)[BINK_BLOCK_MAX_SIZE];
59 59
     DECLARE_ALIGNED(16, short, previous)[BINK_BLOCK_MAX_SIZE / 16];  ///< coeffs from previous audio block
60 60
     float *coeffs_ptr[MAX_CHANNELS]; ///< pointers to the coeffs arrays for float_to_int16_interleave
61 61
     union {
... ...
@@ -153,7 +153,7 @@ typedef struct cook {
153 153
     /* data buffers */
154 154
 
155 155
     uint8_t*            decoded_bytes_buffer;
156
-    DECLARE_ALIGNED(16, float,mono_mdct_output)[2048];
156
+    DECLARE_ALIGNED(32, float, mono_mdct_output)[2048];
157 157
     float               decode_buffer_1[1024];
158 158
     float               decode_buffer_2[1024];
159 159
     float               decode_buffer_0[1060]; /* static allocation for joint decode */
... ...
@@ -321,16 +321,16 @@ typedef struct {
321 321
 
322 322
     /* Subband samples history (for ADPCM) */
323 323
     float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4];
324
-    DECLARE_ALIGNED(16, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512];
325
-    DECLARE_ALIGNED(16, float, subband_fir_noidea)[DCA_PRIM_CHANNELS_MAX][32];
324
+    DECLARE_ALIGNED(32, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512];
325
+    DECLARE_ALIGNED(32, float, subband_fir_noidea)[DCA_PRIM_CHANNELS_MAX][32];
326 326
     int hist_index[DCA_PRIM_CHANNELS_MAX];
327
-    DECLARE_ALIGNED(16, float, raXin)[32];
327
+    DECLARE_ALIGNED(32, float, raXin)[32];
328 328
 
329 329
     int output;                 ///< type of output
330 330
     float scale_bias;           ///< output scale
331 331
 
332
-    DECLARE_ALIGNED(16, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8];
333
-    DECLARE_ALIGNED(16, float, samples)[(DCA_PRIM_CHANNELS_MAX+1)*256];
332
+    DECLARE_ALIGNED(32, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8];
333
+    DECLARE_ALIGNED(32, float, samples)[(DCA_PRIM_CHANNELS_MAX+1)*256];
334 334
     const float *samples_chanptr[DCA_PRIM_CHANNELS_MAX+1];
335 335
 
336 336
     uint8_t dca_buffer[DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE + DCA_BUFFER_PADDING_SIZE];
... ...
@@ -312,18 +312,16 @@ static void dct_error(const char *name, int is_idct,
312 312
     }
313 313
     for(i=0; i<64; i++) sysErrMax= FFMAX(sysErrMax, FFABS(sysErr[i]));
314 314
 
315
-#if 1 // dump systematic errors
316 315
     for(i=0; i<64; i++){
317 316
         if(i%8==0) printf("\n");
318 317
         printf("%7d ", (int)sysErr[i]);
319 318
     }
320 319
     printf("\n");
321
-#endif
322 320
 
323 321
     printf("%s %s: err_inf=%d err2=%0.8f syserr=%0.8f maxout=%d blockSumErr=%d\n",
324 322
            is_idct ? "IDCT" : "DCT",
325 323
            name, err_inf, (double)err2 / NB_ITS / 64.0, (double)sysErrMax / NB_ITS, maxout, blockSumErrMax);
326
-#if 1 //Speed test
324
+
327 325
     /* speed test */
328 326
     for(i=0;i<64;i++)
329 327
         block1[i] = 0;
... ...
@@ -376,7 +374,6 @@ static void dct_error(const char *name, int is_idct,
376 376
     printf("%s %s: %0.1f kdct/s\n",
377 377
            is_idct ? "IDCT" : "DCT",
378 378
            name, (double)it1 * 1000.0 / (double)ti1);
379
-#endif
380 379
 }
381 380
 
382 381
 DECLARE_ALIGNED(8, static uint8_t, img_dest)[64];
... ...
@@ -786,7 +786,6 @@ void ff_er_frame_end(MpegEncContext *s){
786 786
         }
787 787
     }
788 788
 
789
-#if 1
790 789
     /* handle overlapping slices */
791 790
     for(error_type=1; error_type<=3; error_type++){
792 791
         int end_ok=0;
... ...
@@ -807,8 +806,7 @@ void ff_er_frame_end(MpegEncContext *s){
807 807
                 end_ok=0;
808 808
         }
809 809
     }
810
-#endif
811
-#if 1
810
+
812 811
     /* handle slices with partitions of different length */
813 812
     if(s->partitioned_frame){
814 813
         int end_ok=0;
... ...
@@ -829,7 +827,7 @@ void ff_er_frame_end(MpegEncContext *s){
829 829
                 end_ok=0;
830 830
         }
831 831
     }
832
-#endif
832
+
833 833
     /* handle missing slices */
834 834
     if(s->error_recognition>=4){
835 835
         int end_ok=1;
... ...
@@ -853,7 +851,6 @@ void ff_er_frame_end(MpegEncContext *s){
853 853
         }
854 854
     }
855 855
 
856
-#if 1
857 856
     /* backward mark errors */
858 857
     distance=9999999;
859 858
     for(error_type=1; error_type<=3; error_type++){
... ...
@@ -878,7 +875,6 @@ void ff_er_frame_end(MpegEncContext *s){
878 878
                 distance= 9999999;
879 879
         }
880 880
     }
881
-#endif
882 881
 
883 882
     /* forward mark errors */
884 883
     error=0;
... ...
@@ -893,7 +889,7 @@ void ff_er_frame_end(MpegEncContext *s){
893 893
             s->error_status_table[mb_xy]|= error;
894 894
         }
895 895
     }
896
-#if 1
896
+
897 897
     /* handle not partitioned case */
898 898
     if(!s->partitioned_frame){
899 899
         for(i=0; i<s->mb_num; i++){
... ...
@@ -904,7 +900,6 @@ void ff_er_frame_end(MpegEncContext *s){
904 904
             s->error_status_table[mb_xy]= error;
905 905
         }
906 906
     }
907
-#endif
908 907
 
909 908
     dc_error= ac_error= mv_error=0;
910 909
     for(i=0; i<s->mb_num; i++){
... ...
@@ -1065,16 +1060,15 @@ void ff_er_frame_end(MpegEncContext *s){
1065 1065
             s->dc_val[2][mb_x + mb_y*s->mb_stride]= (dcv+4)>>3;
1066 1066
         }
1067 1067
     }
1068
-#if 1
1068
+
1069 1069
     /* guess DC for damaged blocks */
1070 1070
     guess_dc(s, s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride, 1);
1071 1071
     guess_dc(s, s->dc_val[1], s->mb_width  , s->mb_height  , s->mb_stride, 0);
1072 1072
     guess_dc(s, s->dc_val[2], s->mb_width  , s->mb_height  , s->mb_stride, 0);
1073
-#endif
1073
+
1074 1074
     /* filter luma DC */
1075 1075
     filter181(s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride);
1076 1076
 
1077
-#if 1
1078 1077
     /* render DC only intra */
1079 1078
     for(mb_y=0; mb_y<s->mb_height; mb_y++){
1080 1079
         for(mb_x=0; mb_x<s->mb_width; mb_x++){
... ...
@@ -1094,7 +1088,6 @@ void ff_er_frame_end(MpegEncContext *s){
1094 1094
             put_dc(s, dest_y, dest_cb, dest_cr, mb_x, mb_y);
1095 1095
         }
1096 1096
     }
1097
-#endif
1098 1097
 
1099 1098
     if(s->avctx->error_concealment&FF_EC_DEBLOCK){
1100 1099
         /* filter horizontal block boundaries */
... ...
@@ -93,6 +93,44 @@ av_cold void ff_init_ff_cos_tabs(int index)
93 93
 #endif
94 94
 }
95 95
 
96
+static const int avx_tab[] = {
97
+    0, 4, 1, 5, 8, 12, 9, 13, 2, 6, 3, 7, 10, 14, 11, 15
98
+};
99
+
100
+static int is_second_half_of_fft32(int i, int n)
101
+{
102
+    if (n <= 32)
103
+        return i >= 16;
104
+    else if (i < n/2)
105
+        return is_second_half_of_fft32(i, n/2);
106
+    else if (i < 3*n/4)
107
+        return is_second_half_of_fft32(i - n/2, n/4);
108
+    else
109
+        return is_second_half_of_fft32(i - 3*n/4, n/4);
110
+}
111
+
112
+static av_cold void fft_perm_avx(FFTContext *s)
113
+{
114
+    int i;
115
+    int n = 1 << s->nbits;
116
+
117
+    for (i = 0; i < n; i += 16) {
118
+        int k;
119
+        if (is_second_half_of_fft32(i, n)) {
120
+            for (k = 0; k < 16; k++)
121
+                s->revtab[-split_radix_permutation(i + k, n, s->inverse) & (n - 1)] =
122
+                    i + avx_tab[k];
123
+
124
+        } else {
125
+            for (k = 0; k < 16; k++) {
126
+                int j = i + k;
127
+                j = (j & ~7) | ((j >> 1) & 3) | ((j << 2) & 4);
128
+                s->revtab[-split_radix_permutation(i + k, n, s->inverse) & (n - 1)] = j;
129
+            }
130
+        }
131
+    }
132
+}
133
+
96 134
 av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
97 135
 {
98 136
     int i, j, n;
... ...
@@ -132,11 +170,16 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
132 132
     for(j=4; j<=nbits; j++) {
133 133
         ff_init_ff_cos_tabs(j);
134 134
     }
135
-    for(i=0; i<n; i++) {
136
-        int j = i;
137
-        if (s->fft_permutation == FF_FFT_PERM_SWAP_LSBS)
138
-            j = (j&~3) | ((j>>1)&1) | ((j<<1)&2);
139
-        s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = j;
135
+
136
+    if (s->fft_permutation == FF_FFT_PERM_AVX) {
137
+        fft_perm_avx(s);
138
+    } else {
139
+        for(i=0; i<n; i++) {
140
+            int j = i;
141
+            if (s->fft_permutation == FF_FFT_PERM_SWAP_LSBS)
142
+                j = (j&~3) | ((j>>1)&1) | ((j<<1)&2);
143
+            s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = j;
144
+        }
140 145
     }
141 146
 
142 147
     return 0;
... ...
@@ -85,6 +85,7 @@ struct FFTContext {
85 85
     int fft_permutation;
86 86
 #define FF_FFT_PERM_DEFAULT   0
87 87
 #define FF_FFT_PERM_SWAP_LSBS 1
88
+#define FF_FFT_PERM_AVX       2
88 89
     int mdct_permutation;
89 90
 #define FF_MDCT_PERM_NONE       0
90 91
 #define FF_MDCT_PERM_INTERLEAVE 1
... ...
@@ -97,7 +98,7 @@ struct FFTContext {
97 97
 #endif
98 98
 
99 99
 #define COSTABLE(size) \
100
-    COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, FFT_NAME(ff_cos_##size))[size/2]
100
+    COSTABLE_CONST DECLARE_ALIGNED(32, FFTSample, FFT_NAME(ff_cos_##size))[size/2]
101 101
 
102 102
 extern COSTABLE(16);
103 103
 extern COSTABLE(32);
... ...
@@ -599,10 +599,6 @@ retry:
599 599
     s->current_picture.pict_type= s->pict_type;
600 600
     s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
601 601
 
602
-#if FF_API_HURRY_UP
603
-    /* skip everything if we are in a hurry>=5 */
604
-    if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
605
-#endif
606 602
     if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
607 603
        ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
608 604
        || avctx->skip_frame >= AVDISCARD_ALL)
... ...
@@ -612,18 +612,10 @@ retry:
612 612
 
613 613
     /* skip B-frames if we don't have reference frames */
614 614
     if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
615
-#if FF_API_HURRY_UP
616
-    /* skip b frames if we are in a hurry */
617
-    if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
618
-#endif
619 615
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
620 616
        || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
621 617
        ||  avctx->skip_frame >= AVDISCARD_ALL)
622 618
         return get_consumed_bytes(s, buf_size);
623
-#if FF_API_HURRY_UP
624
-    /* skip everything if we are in a hurry>=5 */
625
-    if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
626
-#endif
627 619
 
628 620
     if(s->next_p_frame_damaged){
629 621
         if(s->pict_type==FF_B_TYPE)
... ...
@@ -2966,11 +2966,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
2966 2966
         buf_index += consumed;
2967 2967
 
2968 2968
         //FIXME do not discard SEI id
2969
-        if(
2970
-#if FF_API_HURRY_UP
2971
-           (s->hurry_up == 1 && h->nal_ref_idc  == 0) ||
2972
-#endif
2973
-           (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc  == 0))
2969
+        if(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc  == 0)
2974 2970
             continue;
2975 2971
 
2976 2972
       again:
... ...
@@ -3007,9 +3003,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
3007 3007
             }
3008 3008
 
3009 3009
             if(hx->redundant_pic_count==0
3010
-#if FF_API_HURRY_UP
3011
-               && hx->s.hurry_up < 5
3012
-#endif
3013 3010
                && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
3014 3011
                && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
3015 3012
                && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
... ...
@@ -3047,9 +3040,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
3047 3047
 
3048 3048
             if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
3049 3049
                && s->context_initialized
3050
-#if FF_API_HURRY_UP
3051
-               && s->hurry_up < 5
3052
-#endif
3053 3050
                && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
3054 3051
                && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
3055 3052
                && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
... ...
@@ -3186,11 +3176,7 @@ static int decode_frame(AVCodecContext *avctx,
3186 3186
     }
3187 3187
 
3188 3188
     if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
3189
-        if (avctx->skip_frame >= AVDISCARD_NONREF
3190
-#if FF_API_HURRY_UP
3191
-                || s->hurry_up
3192
-#endif
3193
-           )
3189
+        if (avctx->skip_frame >= AVDISCARD_NONREF)
3194 3190
             return 0;
3195 3191
         av_log(avctx, AV_LOG_ERROR, "no frame!\n");
3196 3192
         return -1;
... ...
@@ -1007,7 +1007,6 @@ static void fill_decode_caches(H264Context *h, int mb_type){
1007 1007
     }
1008 1008
     }
1009 1009
 
1010
-#if 1
1011 1010
     if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){
1012 1011
         int list;
1013 1012
         for(list=0; list<h->list_count; list++){
... ...
@@ -1182,7 +1181,6 @@ static void fill_decode_caches(H264Context *h, int mb_type){
1182 1182
             }
1183 1183
         }
1184 1184
     }
1185
-#endif
1186 1185
 
1187 1186
         h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]);
1188 1187
 }
... ...
@@ -88,7 +88,7 @@ typedef struct {
88 88
 
89 89
     DSPContext dsp;
90 90
     FFTContext fft;
91
-    DECLARE_ALIGNED(16, FFTComplex, samples)[COEFFS/2];
91
+    DECLARE_ALIGNED(32, FFTComplex, samples)[COEFFS/2];
92 92
     float *out_samples;
93 93
 } IMCContext;
94 94
 
... ...
@@ -158,7 +158,6 @@ static int hpel_motion_search(MpegEncContext * s,
158 158
         const int b= score_map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)]
159 159
                      + (mv_penalty[bx   - pred_x] + mv_penalty[by+2 - pred_y])*c->penalty_factor;
160 160
 
161
-#if 1
162 161
         int key;
163 162
         int map_generation= c->map_generation;
164 163
 #ifndef NDEBUG
... ...
@@ -172,7 +171,6 @@ static int hpel_motion_search(MpegEncContext * s,
172 172
         assert(map[(index+1)&(ME_MAP_SIZE-1)] == key);
173 173
         key= ((my)<<ME_MAP_MV_BITS) + (mx-1) + map_generation;
174 174
         assert(map[(index-1)&(ME_MAP_SIZE-1)] == key);
175
-#endif
176 175
         if(t<=b){
177 176
             CHECK_HALF_MV(0, 1, mx  ,my-1)
178 177
             if(l<=r){
... ...
@@ -2476,18 +2476,10 @@ static int decode_chunks(AVCodecContext *avctx,
2476 2476
                 /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
2477 2477
                     if(s2->pict_type==FF_P_TYPE && !s->sync) break;
2478 2478
                 }
2479
-#if FF_API_HURRY_UP
2480
-                /* Skip B-frames if we are in a hurry. */
2481
-                if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
2482
-#endif
2483 2479
                 if(  (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE)
2484 2480
                     ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE)
2485 2481
                     || avctx->skip_frame >= AVDISCARD_ALL)
2486 2482
                     break;
2487
-#if FF_API_HURRY_UP
2488
-                /* Skip everything if we are in a hurry>=5. */
2489
-                if(avctx->hurry_up>=5) break;
2490
-#endif
2491 2483
 
2492 2484
                 if (!s->mpeg_enc_ctx_allocated) break;
2493 2485
 
... ...
@@ -1131,9 +1131,6 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
1131 1131
         }
1132 1132
     }
1133 1133
 
1134
-#if FF_API_HURRY_UP
1135
-    s->hurry_up= s->avctx->hurry_up;
1136
-#endif
1137 1134
     s->error_recognition= avctx->error_recognition;
1138 1135
 
1139 1136
     /* set dequantizer, we can't do it during init as it might change for mpeg4
... ...
@@ -2125,9 +2122,6 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
2125 2125
             }
2126 2126
 
2127 2127
             /* skip dequant / idct if we are really late ;) */
2128
-#if FF_API_HURRY_UP
2129
-            if(s->hurry_up>1) goto skip_idct;
2130
-#endif
2131 2128
             if(s->avctx->skip_idct){
2132 2129
                 if(  (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
2133 2130
                    ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
... ...
@@ -391,11 +391,6 @@ typedef struct MpegEncContext {
391 391
     int no_rounding;  /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
392 392
                         for b-frames rounding mode is always 0 */
393 393
 
394
-#if FF_API_HURRY_UP
395
-    int hurry_up;     /**< when set to 1 during decoding, b frames will be skipped
396
-                         when set to 2 idct/dequant will be skipped too */
397
-#endif
398
-
399 394
     /* macroblock layer */
400 395
     int mb_x, mb_y;
401 396
     int mb_skip_run;
... ...
@@ -985,10 +985,9 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n)
985 985
             if(level<=MAX_LEVEL && run<=MAX_RUN){
986 986
                 s->ac_stats[s->mb_intra][n>3][level][run][last]++;
987 987
             }
988
-#if 0
989
-else
990
-    s->ac_stats[s->mb_intra][n>3][40][63][0]++; //esc3 like
991
-#endif
988
+
989
+            s->ac_stats[s->mb_intra][n > 3][40][63][0]++; //esc3 like
990
+
992 991
             code = get_rl_index(rl, last, run, level);
993 992
             put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
994 993
             if (code == rl->n) {
... ...
@@ -47,7 +47,7 @@
47 47
 
48 48
 typedef struct NellyMoserDecodeContext {
49 49
     AVCodecContext* avctx;
50
-    DECLARE_ALIGNED(16, float,float_buf)[NELLY_SAMPLES];
50
+    DECLARE_ALIGNED(32, float, float_buf)[NELLY_SAMPLES];
51 51
     float           state[128];
52 52
     AVLFG           random_state;
53 53
     GetBitContext   gb;
... ...
@@ -55,7 +55,7 @@ typedef struct NellyMoserDecodeContext {
55 55
     DSPContext      dsp;
56 56
     FFTContext      imdct_ctx;
57 57
     FmtConvertContext fmt_conv;
58
-    DECLARE_ALIGNED(16, float,imdct_out)[NELLY_BUF_LEN * 2];
58
+    DECLARE_ALIGNED(32, float, imdct_out)[NELLY_BUF_LEN * 2];
59 59
 } NellyMoserDecodeContext;
60 60
 
61 61
 static void overlap_and_window(NellyMoserDecodeContext *s, float *state, float *audio, float *a_in)
... ...
@@ -55,9 +55,9 @@ typedef struct NellyMoserEncodeContext {
55 55
     int             have_saved;
56 56
     DSPContext      dsp;
57 57
     FFTContext      mdct_ctx;
58
-    DECLARE_ALIGNED(16, float, mdct_out)[NELLY_SAMPLES];
59
-    DECLARE_ALIGNED(16, float, in_buff)[NELLY_SAMPLES];
60
-    DECLARE_ALIGNED(16, float, buf)[2][3 * NELLY_BUF_LEN];     ///< sample buffer
58
+    DECLARE_ALIGNED(32, float, mdct_out)[NELLY_SAMPLES];
59
+    DECLARE_ALIGNED(32, float, in_buff)[NELLY_SAMPLES];
60
+    DECLARE_ALIGNED(32, float, buf)[2][3 * NELLY_BUF_LEN];     ///< sample buffer
61 61
     float           (*opt )[NELLY_BANDS];
62 62
     uint8_t         (*path)[NELLY_BANDS];
63 63
 } NellyMoserEncodeContext;
... ...
@@ -105,9 +105,6 @@ static const AVOption options[]={
105 105
 {"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
106 106
 {"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX},
107 107
 {"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E},
108
-#if FF_API_RATE_EMU
109
-{"rate_emu", "frame rate emulation", OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
110
-#endif
111 108
 {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
112 109
 {"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
113 110
 {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E},
... ...
@@ -124,9 +121,6 @@ static const AVOption options[]={
124 124
 {"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
125 125
 {"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
126 126
 {"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
127
-#if FF_API_HURRY_UP
128
-{"hurry_up", "deprecated, use skip_idct/skip_frame instead", OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
129
-#endif
130 127
 {"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
131 128
 {"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
132 129
 {"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
... ...
@@ -253,10 +247,6 @@ static const AVOption options[]={
253 253
 {"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
254 254
 {"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
255 255
 {"bb", "backward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"},
256
-#if FF_API_MB_Q
257
-{"mb_qmin", "obsolete, use qmin", OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
258
-{"mb_qmax", "obsolete, use qmax", OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
259
-#endif
260 256
 {"cmp", "full pel me compare function", OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
261 257
 {"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
262 258
 {"mbcmp", "macroblock compare function", OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
... ...
@@ -380,9 +380,6 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
380 380
     dst->release_buffer = src->release_buffer;
381 381
 
382 382
     dst->opaque   = src->opaque;
383
-#if FF_API_HURRY_UP
384
-    dst->hurry_up = src->hurry_up;
385
-#endif
386 383
     dst->dsp_mask = src->dsp_mask;
387 384
     dst->debug    = src->debug;
388 385
     dst->debug_mv = src->debug_mv;
... ...
@@ -120,7 +120,7 @@ typedef struct {
120 120
 } FFTCoefficient;
121 121
 
122 122
 typedef struct {
123
-    DECLARE_ALIGNED(16, QDM2Complex, complex)[MPA_MAX_CHANNELS][256];
123
+    DECLARE_ALIGNED(32, QDM2Complex, complex)[MPA_MAX_CHANNELS][256];
124 124
 } QDM2FFT;
125 125
 
126 126
 /**
... ...
@@ -1454,19 +1454,10 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
1454 1454
     }
1455 1455
     if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
1456 1456
         return -1;
1457
-#if FF_API_HURRY_UP
1458
-    /* skip b frames if we are in a hurry */
1459
-    if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
1460
-#endif
1461 1457
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE)
1462 1458
        || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=FF_I_TYPE)
1463 1459
        ||  avctx->skip_frame >= AVDISCARD_ALL)
1464 1460
         return buf_size;
1465
-#if FF_API_HURRY_UP
1466
-    /* skip everything if we are in a hurry>=5 */
1467
-    if(avctx->hurry_up>=5)
1468
-        return buf_size;
1469
-#endif
1470 1461
 
1471 1462
     for(i=0; i<slice_count; i++){
1472 1463
         int offset= get_slice_offset(avctx, slices_hdr, i);
... ...
@@ -897,7 +897,6 @@ QPEL_MC(0, avg_       , _       , op_avg)
897 897
 #undef op_put
898 898
 #undef op_put_no_rnd
899 899
 
900
-#if 1
901 900
 #define H264_LOWPASS(OPNAME, OP, OP2) \
902 901
 static inline void OPNAME ## h264_qpel_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride,int w,int h){\
903 902
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
... ...
@@ -1298,7 +1297,6 @@ H264_MC(avg_, 16)
1298 1298
 #undef op_put
1299 1299
 #undef op2_avg
1300 1300
 #undef op2_put
1301
-#endif
1302 1301
 
1303 1302
 static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){
1304 1303
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
... ...
@@ -3293,10 +3293,8 @@ static void iterative_me(SnowContext *s){
3293 3293
                 }
3294 3294
                 best_rd= ref_rd;
3295 3295
                 *block= ref_b;
3296
-#if 1
3297 3296
                 check_block(s, mb_x, mb_y, color, 1, *obmc_edged, &best_rd);
3298 3297
                 //FIXME RD style color selection
3299
-#endif
3300 3298
                 if(!same_block(block, &backup)){
3301 3299
                     if(tb ) tb ->type &= ~BLOCK_OPT;
3302 3300
                     if(lb ) lb ->type &= ~BLOCK_OPT;
... ...
@@ -684,9 +684,6 @@ static int svq1_decode_frame(AVCodecContext *avctx,
684 684
   //this should be removed after libavcodec can handle more flexible picture types & ordering
685 685
   if(s->pict_type==FF_B_TYPE && s->last_picture_ptr==NULL) return buf_size;
686 686
 
687
-#if FF_API_HURRY_UP
688
-  if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
689
-#endif
690 687
   if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
691 688
      ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
692 689
      || avctx->skip_frame >= AVDISCARD_ALL)
... ...
@@ -952,14 +952,6 @@ static int svq3_decode_frame(AVCodecContext *avctx,
952 952
     /* Skip B-frames if we do not have reference frames. */
953 953
     if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
954 954
         return 0;
955
-#if FF_API_HURRY_UP
956
-    /* Skip B-frames if we are in a hurry. */
957
-    if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
958
-        return 0;
959
-    /* Skip everything if we are in a hurry >= 5. */
960
-    if (avctx->hurry_up >= 5)
961
-        return 0;
962
-#endif
963 955
     if (  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
964 956
         ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
965 957
         || avctx->skip_frame >= AVDISCARD_ALL)
... ...
@@ -1105,18 +1105,11 @@ void avcodec_default_free_buffers(AVCodecContext *s){
1105 1105
     s->internal_buffer_count=0;
1106 1106
 }
1107 1107
 
1108
+#if FF_API_OLD_FF_PICT_TYPES
1108 1109
 char av_get_pict_type_char(int pict_type){
1109
-    switch(pict_type){
1110
-    case FF_I_TYPE: return 'I';
1111
-    case FF_P_TYPE: return 'P';
1112
-    case FF_B_TYPE: return 'B';
1113
-    case FF_S_TYPE: return 'S';
1114
-    case FF_SI_TYPE:return 'i';
1115
-    case FF_SP_TYPE:return 'p';
1116
-    case FF_BI_TYPE:return 'b';
1117
-    default:        return '?';
1118
-    }
1110
+    return av_get_picture_type_char(pict_type);
1119 1111
 }
1112
+#endif
1120 1113
 
1121 1114
 int av_get_bits_per_sample(enum CodecID codec_id){
1122 1115
     switch(codec_id){
... ...
@@ -3519,21 +3519,11 @@ static int vc1_decode_frame(AVCodecContext *avctx,
3519 3519
     if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){
3520 3520
         goto err;
3521 3521
     }
3522
-#if FF_API_HURRY_UP
3523
-    /* skip b frames if we are in a hurry */
3524
-    if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size;
3525
-#endif
3526 3522
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
3527 3523
        || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
3528 3524
        ||  avctx->skip_frame >= AVDISCARD_ALL) {
3529 3525
         goto end;
3530 3526
     }
3531
-#if FF_API_HURRY_UP
3532
-    /* skip everything if we are in a hurry>=5 */
3533
-    if(avctx->hurry_up>=5) {
3534
-        goto err;
3535
-    }
3536
-#endif
3537 3527
 
3538 3528
     if(s->next_p_frame_damaged){
3539 3529
         if(s->pict_type==FF_B_TYPE)
... ...
@@ -22,7 +22,7 @@
22 22
 
23 23
 #define LIBAVCODEC_VERSION_MAJOR 53
24 24
 #define LIBAVCODEC_VERSION_MINOR  1
25
-#define LIBAVCODEC_VERSION_MICRO  0
25
+#define LIBAVCODEC_VERSION_MICRO  1
26 26
 
27 27
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
28 28
                                                LIBAVCODEC_VERSION_MINOR, \
... ...
@@ -47,15 +47,6 @@
47 47
 #ifndef FF_API_OLD_AUDIOCONVERT
48 48
 #define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
49 49
 #endif
50
-#ifndef FF_API_HURRY_UP
51
-#define FF_API_HURRY_UP         (LIBAVCODEC_VERSION_MAJOR < 53)
52
-#endif
53
-#ifndef FF_API_RATE_EMU
54
-#define FF_API_RATE_EMU         (LIBAVCODEC_VERSION_MAJOR < 53)
55
-#endif
56
-#ifndef FF_API_MB_Q
57
-#define FF_API_MB_Q             (LIBAVCODEC_VERSION_MAJOR < 53)
58
-#endif
59 50
 #ifndef FF_API_ANTIALIAS_ALGO
60 51
 #define FF_API_ANTIALIAS_ALGO   (LIBAVCODEC_VERSION_MAJOR < 54)
61 52
 #endif
... ...
@@ -68,5 +59,8 @@
68 68
 #ifndef FF_API_THREAD_INIT
69 69
 #define FF_API_THREAD_INIT      (LIBAVCODEC_VERSION_MAJOR < 54)
70 70
 #endif
71
+#ifndef FF_API_OLD_FF_PICT_TYPES
72
+#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
73
+#endif
71 74
 
72 75
 #endif /* AVCODEC_VERSION_H */
... ...
@@ -113,15 +113,15 @@ typedef struct WMACodecContext {
113 113
     uint8_t ms_stereo;                      ///< true if mid/side stereo mode
114 114
     uint8_t channel_coded[MAX_CHANNELS];    ///< true if channel is coded
115 115
     int exponents_bsize[MAX_CHANNELS];      ///< log2 ratio frame/exp. length
116
-    DECLARE_ALIGNED(16, float, exponents)[MAX_CHANNELS][BLOCK_MAX_SIZE];
116
+    DECLARE_ALIGNED(32, float, exponents)[MAX_CHANNELS][BLOCK_MAX_SIZE];
117 117
     float max_exponent[MAX_CHANNELS];
118 118
     WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE];
119
-    DECLARE_ALIGNED(16, float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE];
120
-    DECLARE_ALIGNED(16, FFTSample, output)[BLOCK_MAX_SIZE * 2];
119
+    DECLARE_ALIGNED(32, float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE];
120
+    DECLARE_ALIGNED(32, FFTSample, output)[BLOCK_MAX_SIZE * 2];
121 121
     FFTContext mdct_ctx[BLOCK_NB_SIZES];
122 122
     float *windows[BLOCK_NB_SIZES];
123 123
     /* output buffer for one frame and the last for IMDCT windowing */
124
-    DECLARE_ALIGNED(16, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2];
124
+    DECLARE_ALIGNED(32, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2];
125 125
     /* last frame info */
126 126
     uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */
127 127
     int last_bitoffset;
... ...
@@ -145,7 +145,7 @@ typedef struct {
145 145
     uint8_t  table_idx;                               ///< index in sf_offsets for the scale factor reference block
146 146
     float*   coeffs;                                  ///< pointer to the subframe decode buffer
147 147
     uint16_t num_vec_coeffs;                          ///< number of vector coded coefficients
148
-    DECLARE_ALIGNED(16, float, out)[WMAPRO_BLOCK_MAX_SIZE + WMAPRO_BLOCK_MAX_SIZE / 2]; ///< output buffer
148
+    DECLARE_ALIGNED(32, float, out)[WMAPRO_BLOCK_MAX_SIZE + WMAPRO_BLOCK_MAX_SIZE / 2]; ///< output buffer
149 149
 } WMAProChannelCtx;
150 150
 
151 151
 /**
... ...
@@ -170,7 +170,7 @@ typedef struct WMAProDecodeCtx {
170 170
                       FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data
171 171
     PutBitContext    pb;                            ///< context for filling the frame_data buffer
172 172
     FFTContext       mdct_ctx[WMAPRO_BLOCK_SIZES];  ///< MDCT context per block size
173
-    DECLARE_ALIGNED(16, float, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT output buffer
173
+    DECLARE_ALIGNED(32, float, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT output buffer
174 174
     float*           windows[WMAPRO_BLOCK_SIZES];   ///< windows for the different block sizes
175 175
 
176 176
     /* frame size dependent frame information (set during initialization) */
... ...
@@ -275,11 +275,11 @@ typedef struct {
275 275
                                   ///< by postfilter
276 276
     float denoise_filter_cache[MAX_FRAMESIZE];
277 277
     int   denoise_filter_cache_size; ///< samples in #denoise_filter_cache
278
-    DECLARE_ALIGNED(16, float, tilted_lpcs_pf)[0x80];
278
+    DECLARE_ALIGNED(32, float, tilted_lpcs_pf)[0x80];
279 279
                                   ///< aligned buffer for LPC tilting
280
-    DECLARE_ALIGNED(16, float, denoise_coeffs_pf)[0x80];
280
+    DECLARE_ALIGNED(32, float, denoise_coeffs_pf)[0x80];
281 281
                                   ///< aligned buffer for denoise coefficients
282
-    DECLARE_ALIGNED(16, float, synth_filter_out_buf)[0x80 + MAX_LSPS_ALIGN16];
282
+    DECLARE_ALIGNED(32, float, synth_filter_out_buf)[0x80 + MAX_LSPS_ALIGN16];
283 283
                                   ///< aligned buffer for postfilter speech
284 284
                                   ///< synthesis
285 285
     /**
... ...
@@ -25,7 +25,14 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
25 25
 {
26 26
 #if HAVE_YASM
27 27
     int has_vectors = av_get_cpu_flags();
28
-    if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
28
+    if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) {
29
+        /* AVX for SB */
30
+        s->imdct_calc      = ff_imdct_calc_sse;
31
+        s->imdct_half      = ff_imdct_half_avx;
32
+        s->fft_permute     = ff_fft_permute_sse;
33
+        s->fft_calc        = ff_fft_calc_avx;
34
+        s->fft_permutation = FF_FFT_PERM_AVX;
35
+    } else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
29 36
         /* SSE for P3/P4/K8 */
30 37
         s->imdct_calc  = ff_imdct_calc_sse;
31 38
         s->imdct_half  = ff_imdct_half_sse;
... ...
@@ -22,6 +22,7 @@
22 22
 #include "libavcodec/fft.h"
23 23
 
24 24
 void ff_fft_permute_sse(FFTContext *s, FFTComplex *z);
25
+void ff_fft_calc_avx(FFTContext *s, FFTComplex *z);
25 26
 void ff_fft_calc_sse(FFTContext *s, FFTComplex *z);
26 27
 void ff_fft_calc_3dn(FFTContext *s, FFTComplex *z);
27 28
 void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z);
... ...
@@ -32,6 +33,7 @@ void ff_imdct_calc_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
32 32
 void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input);
33 33
 void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input);
34 34
 void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input);
35
+void ff_imdct_half_avx(FFTContext *s, FFTSample *output, const FFTSample *input);
35 36
 void ff_dct32_float_sse(FFTSample *out, const FFTSample *in);
36 37
 
37 38
 #endif
... ...
@@ -1,6 +1,7 @@
1 1
 ;******************************************************************************
2 2
 ;* FFT transform with SSE/3DNow optimizations
3 3
 ;* Copyright (c) 2008 Loren Merritt
4
+;* Copyright (c) 2011 Vitor Sessak
4 5
 ;*
5 6
 ;* This algorithm (though not any of the implementation details) is
6 7
 ;* based on libdjbfft by D. J. Bernstein.
... ...
@@ -49,9 +50,21 @@ endstruc
49 49
 SECTION_RODATA
50 50
 
51 51
 %define M_SQRT1_2 0.70710678118654752440
52
-ps_root2: times 4 dd M_SQRT1_2
53
-ps_root2mppm: dd -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
54
-ps_p1p1m1p1: dd 0, 0, 1<<31, 0
52
+%define M_COS_PI_1_8 0.923879532511287
53
+%define M_COS_PI_3_8 0.38268343236509
54
+
55
+align 32
56
+ps_cos16_1: dd 1.0, M_COS_PI_1_8, M_SQRT1_2, M_COS_PI_3_8, 1.0, M_COS_PI_1_8, M_SQRT1_2, M_COS_PI_3_8
57
+ps_cos16_2: dd 0, M_COS_PI_3_8, M_SQRT1_2, M_COS_PI_1_8, 0, -M_COS_PI_3_8, -M_SQRT1_2, -M_COS_PI_1_8
58
+
59
+ps_root2: times 8 dd M_SQRT1_2
60
+ps_root2mppm: dd -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
61
+ps_p1p1m1p1: dd 0, 0, 1<<31, 0, 0, 0, 1<<31, 0
62
+
63
+perm1: dd 0x00, 0x02, 0x03, 0x01, 0x03, 0x00, 0x02, 0x01
64
+perm2: dd 0x00, 0x01, 0x02, 0x03, 0x01, 0x00, 0x02, 0x03
65
+ps_p1p1m1p1root2: dd 1.0, 1.0, -1.0, 1.0, M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, M_SQRT1_2
66
+ps_m1m1p1m1p1m1m1m1: dd 1<<31, 1<<31, 0, 1<<31, 0, 1<<31, 1<<31, 1<<31
55 67
 ps_m1p1: dd 1<<31, 0
56 68
 
57 69
 %assign i 16
... ...
@@ -96,51 +109,80 @@ section .text align=16
96 96
     SWAP     %3, %6
97 97
 %endmacro
98 98
 
99
+;  in: %1 = {r0,i0,r2,i2,r4,i4,r6,i6}
100
+;      %2 = {r1,i1,r3,i3,r5,i5,r7,i7}
101
+;      %3, %4, %5 tmp
102
+; out: %1 = {r0,r1,r2,r3,i0,i1,i2,i3}
103
+;      %2 = {r4,r5,r6,r7,i4,i5,i6,i7}
104
+%macro T8_AVX 5
105
+    vsubps     %5, %1, %2       ; v  = %1 - %2
106
+    vaddps     %3, %1, %2       ; w  = %1 + %2
107
+    vmulps     %2, %5, [ps_p1p1m1p1root2]  ; v *= vals1
108
+    vpermilps  %2, %2, [perm1]
109
+    vblendps   %1, %2, %3, 0x33 ; q = {w1,w2,v4,v2,w5,w6,v7,v6}
110
+    vshufps    %5, %3, %2, 0x4e ; r = {w3,w4,v1,v3,w7,w8,v8,v5}
111
+    vsubps     %4, %5, %1       ; s = r - q
112
+    vaddps     %1, %5, %1       ; u = r + q
113
+    vpermilps  %1, %1, [perm2]  ; k  = {u1,u2,u3,u4,u6,u5,u7,u8}
114
+    vshufps    %5, %4, %1, 0xbb
115
+    vshufps    %3, %4, %1, 0xee
116
+    vperm2f128 %3, %3, %5, 0x13
117
+    vxorps     %4, %4, [ps_m1m1p1m1p1m1m1m1]  ; s *= {1,1,-1,-1,1,-1,-1,-1}
118
+    vshufps    %2, %1, %4, 0xdd
119
+    vshufps    %1, %1, %4, 0x88
120
+    vperm2f128 %4, %2, %1, 0x02 ; v  = {k1,k3,s1,s3,k2,k4,s2,s4}
121
+    vperm2f128 %1, %1, %2, 0x13 ; w  = {k6,k8,s6,s8,k5,k7,s5,s7}
122
+    vsubps     %5, %1, %3
123
+    vblendps   %1, %5, %1, 0x55 ; w -= {0,s7,0,k7,0,s8,0,k8}
124
+    vsubps     %2, %4, %1       ; %2 = v - w
125
+    vaddps     %1, %4, %1       ; %1 = v + w
126
+%endmacro
127
+
128
+; In SSE mode do one fft4 transforms
99 129
 ; in:  %1={r0,i0,r2,i2} %2={r1,i1,r3,i3}
100 130
 ; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3}
131
+;
132
+; In AVX mode do two fft4 transforms
133
+; in:  %1={r0,i0,r2,i2,r4,i4,r6,i6} %2={r1,i1,r3,i3,r5,i5,r7,i7}
134
+; out: %1={r0,r1,r2,r3,r4,r5,r6,r7} %2={i0,i1,i2,i3,i4,i5,i6,i7}
101 135
 %macro T4_SSE 3
102
-    mova     %3, %1
103
-    addps    %1, %2       ; {t1,t2,t6,t5}
104
-    subps    %3, %2       ; {t3,t4,-t8,t7}
105
-    xorps    %3, [ps_p1p1m1p1]
106
-    mova     %2, %1
107
-    shufps   %1, %3, 0x44 ; {t1,t2,t3,t4}
108
-    shufps   %2, %3, 0xbe ; {t6,t5,t7,t8}
109
-    mova     %3, %1
110
-    addps    %1, %2       ; {r0,i0,r1,i1}
111
-    subps    %3, %2       ; {r2,i2,r3,i3}
112
-    mova     %2, %1
113
-    shufps   %1, %3, 0x88 ; {r0,r1,r2,r3}
114
-    shufps   %2, %3, 0xdd ; {i0,i1,i2,i3}
136
+    subps    %3, %1, %2       ; {t3,t4,-t8,t7}
137
+    addps    %1, %1, %2       ; {t1,t2,t6,t5}
138
+    xorps    %3, %3, [ps_p1p1m1p1]
139
+    shufps   %2, %1, %3, 0xbe ; {t6,t5,t7,t8}
140
+    shufps   %1, %1, %3, 0x44 ; {t1,t2,t3,t4}
141
+    subps    %3, %1, %2       ; {r2,i2,r3,i3}
142
+    addps    %1, %1, %2       ; {r0,i0,r1,i1}
143
+    shufps   %2, %1, %3, 0xdd ; {i0,i1,i2,i3}
144
+    shufps   %1, %1, %3, 0x88 ; {r0,r1,r2,r3}
115 145
 %endmacro
116 146
 
147
+; In SSE mode do one FFT8
117 148
 ; in:  %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %3={r4,i4,r6,i6} %4={r5,i5,r7,i7}
118 149
 ; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %1={r4,r5,r6,r7} %2={i4,i5,i6,i7}
150
+;
151
+; In AVX mode do two FFT8
152
+; in:  %1={r0,i0,r2,i2,r8, i8, r10,i10} %2={r1,i1,r3,i3,r9, i9, r11,i11}
153
+;      %3={r4,i4,r6,i6,r12,i12,r14,i14} %4={r5,i5,r7,i7,r13,i13,r15,i15}
154
+; out: %1={r0,r1,r2,r3,r8, r9, r10,r11} %2={i0,i1,i2,i3,i8, i9, i10,i11}
155
+;      %3={r4,r5,r6,r7,r12,r13,r14,r15} %4={i4,i5,i6,i7,i12,i13,i14,i15}
119 156
 %macro T8_SSE 6
120
-    mova     %6, %3
121
-    subps    %3, %4       ; {r5,i5,r7,i7}
122
-    addps    %6, %4       ; {t1,t2,t3,t4}
123
-    mova     %4, %3
124
-    shufps   %4, %4, 0xb1 ; {i5,r5,i7,r7}
125
-    mulps    %3, [ps_root2mppm] ; {-r5,i5,r7,-i7}
126
-    mulps    %4, [ps_root2]
127
-    addps    %3, %4       ; {t8,t7,ta,t9}
128
-    mova     %4, %6
129
-    shufps   %6, %3, 0x36 ; {t3,t2,t9,t8}
130
-    shufps   %4, %3, 0x9c ; {t1,t4,t7,ta}
131
-    mova     %3, %6
132
-    addps    %6, %4       ; {t1,t2,t9,ta}
133
-    subps    %3, %4       ; {t6,t5,tc,tb}
134
-    mova     %4, %6
135
-    shufps   %6, %3, 0xd8 ; {t1,t9,t5,tb}
136
-    shufps   %4, %3, 0x8d ; {t2,ta,t6,tc}
137
-    mova     %3, %1
138
-    mova     %5, %2
139
-    addps    %1, %6       ; {r0,r1,r2,r3}
140
-    addps    %2, %4       ; {i0,i1,i2,i3}
141
-    subps    %3, %6       ; {r4,r5,r6,r7}
142
-    subps    %5, %4       ; {i4,i5,i6,i7}
143
-    SWAP     %4, %5
157
+    addps    %6, %3, %4       ; {t1,t2,t3,t4}
158
+    subps    %3, %3, %4       ; {r5,i5,r7,i7}
159
+    shufps   %4, %3, %3, 0xb1 ; {i5,r5,i7,r7}
160
+    mulps    %3, %3, [ps_root2mppm] ; {-r5,i5,r7,-i7}
161
+    mulps    %4, %4, [ps_root2]
162
+    addps    %3, %3, %4       ; {t8,t7,ta,t9}
163
+    shufps   %4, %6, %3, 0x9c ; {t1,t4,t7,ta}
164
+    shufps   %6, %6, %3, 0x36 ; {t3,t2,t9,t8}
165
+    subps    %3, %6, %4       ; {t6,t5,tc,tb}
166
+    addps    %6, %6, %4       ; {t1,t2,t9,ta}
167
+    shufps   %5, %6, %3, 0x8d ; {t2,ta,t6,tc}
168
+    shufps   %6, %6, %3, 0xd8 ; {t1,t9,t5,tb}
169
+    subps    %3, %1, %6       ; {r4,r5,r6,r7}
170
+    addps    %1, %1, %6       ; {r0,r1,r2,r3}
171
+    subps    %4, %2, %5       ; {i4,i5,i6,i7}
172
+    addps    %2, %2, %5       ; {i0,i1,i2,i3}
144 173
 %endmacro
145 174
 
146 175
 ; scheduled for cpu-bound sizes
... ...
@@ -148,52 +190,44 @@ section .text align=16
148 148
 IF%1 mova    m4, Z(4)
149 149
 IF%1 mova    m5, Z(5)
150 150
     mova     m0, %2 ; wre
151
-    mova     m2, m4
152 151
     mova     m1, %3 ; wim
153
-    mova     m3, m5
154
-    mulps    m2, m0 ; r2*wre
152
+    mulps    m2, m4, m0 ; r2*wre
155 153
 IF%1 mova    m6, Z2(6)
156
-    mulps    m3, m1 ; i2*wim
154
+    mulps    m3, m5, m1 ; i2*wim
157 155
 IF%1 mova    m7, Z2(7)
158
-    mulps    m4, m1 ; r2*wim
159
-    mulps    m5, m0 ; i2*wre
160
-    addps    m2, m3 ; r2*wre + i2*wim
161
-    mova     m3, m1
162
-    mulps    m1, m6 ; r3*wim
163
-    subps    m5, m4 ; i2*wre - r2*wim
164
-    mova     m4, m0
165
-    mulps    m3, m7 ; i3*wim
166
-    mulps    m4, m6 ; r3*wre
167
-    mulps    m0, m7 ; i3*wre
168
-    subps    m4, m3 ; r3*wre - i3*wim
156
+    mulps    m4, m4, m1 ; r2*wim
157
+    mulps    m5, m5, m0 ; i2*wre
158
+    addps    m2, m2, m3 ; r2*wre + i2*wim
159
+    mulps    m3, m1, m7 ; i3*wim
160
+    subps    m5, m5, m4 ; i2*wre - r2*wim
161
+    mulps    m1, m1, m6 ; r3*wim
162
+    mulps    m4, m0, m6 ; r3*wre
163
+    mulps    m0, m0, m7 ; i3*wre
164
+    subps    m4, m4, m3 ; r3*wre - i3*wim
169 165
     mova     m3, Z(0)
170
-    addps    m0, m1 ; i3*wre + r3*wim
171
-    mova     m1, m4
172
-    addps    m4, m2 ; t5
173
-    subps    m1, m2 ; t3
174
-    subps    m3, m4 ; r2
175
-    addps    m4, Z(0) ; r0
166
+    addps    m0, m0, m1 ; i3*wre + r3*wim
167
+    subps    m1, m4, m2 ; t3
168
+    addps    m4, m4, m2 ; t5
169
+    subps    m3, m3, m4 ; r2
170
+    addps    m4, m4, Z(0) ; r0
176 171
     mova     m6, Z(2)
177 172
     mova   Z(4), m3
178 173
     mova   Z(0), m4
179
-    mova     m3, m5
180
-    subps    m5, m0 ; t4
181
-    mova     m4, m6
182
-    subps    m6, m5 ; r3
183
-    addps    m5, m4 ; r1
184
-    mova  Z2(6), m6
185
-    mova   Z(2), m5
174
+    subps    m3, m5, m0 ; t4
175
+    subps    m4, m6, m3 ; r3
176
+    addps    m3, m3, m6 ; r1
177
+    mova  Z2(6), m4
178
+    mova   Z(2), m3
186 179
     mova     m2, Z(3)
187
-    addps    m3, m0 ; t6
188
-    subps    m2, m1 ; i3
180
+    addps    m3, m5, m0 ; t6
181
+    subps    m2, m2, m1 ; i3
189 182
     mova     m7, Z(1)
190
-    addps    m1, Z(3) ; i1
183
+    addps    m1, m1, Z(3) ; i1
191 184
     mova  Z2(7), m2
192 185
     mova   Z(3), m1
193
-    mova     m4, m7
194
-    subps    m7, m3 ; i2
195
-    addps    m3, m4 ; i0
196
-    mova   Z(5), m7
186
+    subps    m4, m7, m3 ; i2
187
+    addps    m3, m3, m7 ; i0
188
+    mova   Z(5), m4
197 189
     mova   Z(1), m3
198 190
 %endmacro
199 191
 
... ...
@@ -201,77 +235,55 @@ IF%1 mova    m7, Z2(7)
201 201
 %macro PASS_BIG 1 ; (!interleave)
202 202
     mova     m4, Z(4) ; r2
203 203
     mova     m5, Z(5) ; i2
204
-    mova     m2, m4
205 204
     mova     m0, [wq] ; wre
206
-    mova     m3, m5
207 205
     mova     m1, [wq+o1q] ; wim
208
-    mulps    m2, m0 ; r2*wre
206
+    mulps    m2, m4, m0 ; r2*wre
209 207
     mova     m6, Z2(6) ; r3
210
-    mulps    m3, m1 ; i2*wim
208
+    mulps    m3, m5, m1 ; i2*wim
211 209
     mova     m7, Z2(7) ; i3
212
-    mulps    m4, m1 ; r2*wim
213
-    mulps    m5, m0 ; i2*wre
214
-    addps    m2, m3 ; r2*wre + i2*wim
215
-    mova     m3, m1
216
-    mulps    m1, m6 ; r3*wim
217
-    subps    m5, m4 ; i2*wre - r2*wim
218
-    mova     m4, m0
219
-    mulps    m3, m7 ; i3*wim
220
-    mulps    m4, m6 ; r3*wre
221
-    mulps    m0, m7 ; i3*wre
222
-    subps    m4, m3 ; r3*wre - i3*wim
210
+    mulps    m4, m4, m1 ; r2*wim
211
+    mulps    m5, m5, m0 ; i2*wre
212
+    addps    m2, m2, m3 ; r2*wre + i2*wim
213
+    mulps    m3, m1, m7 ; i3*wim
214
+    mulps    m1, m1, m6 ; r3*wim
215
+    subps    m5, m5, m4 ; i2*wre - r2*wim
216
+    mulps    m4, m0, m6 ; r3*wre
217
+    mulps    m0, m0, m7 ; i3*wre
218
+    subps    m4, m4, m3 ; r3*wre - i3*wim
223 219
     mova     m3, Z(0)
224
-    addps    m0, m1 ; i3*wre + r3*wim
225
-    mova     m1, m4
226
-    addps    m4, m2 ; t5
227
-    subps    m1, m2 ; t3
228
-    subps    m3, m4 ; r2
229
-    addps    m4, Z(0) ; r0
220
+    addps    m0, m0, m1 ; i3*wre + r3*wim
221
+    subps    m1, m4, m2 ; t3
222
+    addps    m4, m4, m2 ; t5
223
+    subps    m3, m3, m4 ; r2
224
+    addps    m4, m4, Z(0) ; r0
230 225
     mova     m6, Z(2)
231 226
     mova   Z(4), m3
232 227
     mova   Z(0), m4
233
-    mova     m3, m5
234
-    subps    m5, m0 ; t4
235
-    mova     m4, m6
236
-    subps    m6, m5 ; r3
237
-    addps    m5, m4 ; r1
238
-IF%1 mova Z2(6), m6
239
-IF%1 mova  Z(2), m5
228
+    subps    m3, m5, m0 ; t4
229
+    subps    m4, m6, m3 ; r3
230
+    addps    m3, m3, m6 ; r1
231
+IF%1 mova Z2(6), m4
232
+IF%1 mova  Z(2), m3
240 233
     mova     m2, Z(3)
241
-    addps    m3, m0 ; t6
242
-    subps    m2, m1 ; i3
234
+    addps    m5, m5, m0 ; t6
235
+    subps    m2, m2, m1 ; i3
243 236
     mova     m7, Z(1)
244
-    addps    m1, Z(3) ; i1
237
+    addps    m1, m1, Z(3) ; i1
245 238
 IF%1 mova Z2(7), m2
246 239
 IF%1 mova  Z(3), m1
247
-    mova     m4, m7
248
-    subps    m7, m3 ; i2
249
-    addps    m3, m4 ; i0
250
-IF%1 mova  Z(5), m7
251
-IF%1 mova  Z(1), m3
240
+    subps    m6, m7, m5 ; i2
241
+    addps    m5, m5, m7 ; i0
242
+IF%1 mova  Z(5), m6
243
+IF%1 mova  Z(1), m5
252 244
 %if %1==0
253
-    mova     m4, m5 ; r1
254
-    mova     m0, m6 ; r3
255
-    unpcklps m5, m1
256
-    unpckhps m4, m1
257
-    unpcklps m6, m2
258
-    unpckhps m0, m2
245
+    INTERL m1, m3, m7, Z, 2
246
+    INTERL m2, m4, m0, Z2, 6
247
+
259 248
     mova     m1, Z(0)
260 249
     mova     m2, Z(4)
261
-    mova   Z(2), m5
262
-    mova   Z(3), m4
263
-    mova  Z2(6), m6
264
-    mova  Z2(7), m0
265
-    mova     m5, m1 ; r0
266
-    mova     m4, m2 ; r2
267
-    unpcklps m1, m3
268
-    unpckhps m5, m3
269
-    unpcklps m2, m7
270
-    unpckhps m4, m7
271
-    mova   Z(0), m1
272
-    mova   Z(1), m5
273
-    mova   Z(4), m2
274
-    mova   Z(5), m4
250
+
251
+    INTERL m5, m1, m3, Z, 0
252
+    INTERL m6, m2, m7, Z, 4
275 253
 %endif
276 254
 %endmacro
277 255
 
... ...
@@ -281,13 +293,106 @@ IF%1 mova  Z(1), m3
281 281
     punpckhdq %3, %2
282 282
 %endmacro
283 283
 
284
-INIT_XMM
285
-%define mova movaps
286
-
287 284
 %define Z(x) [r0+mmsize*x]
288 285
 %define Z2(x) [r0+mmsize*x]
286
+%define ZH(x) [r0+mmsize*x+mmsize/2]
287
+
288
+INIT_YMM
289
+
290
+align 16
291
+fft8_avx:
292
+    mova      m0, Z(0)
293
+    mova      m1, Z(1)
294
+    T8_AVX    m0, m1, m2, m3, m4
295
+    mova      Z(0), m0
296
+    mova      Z(1), m1
297
+    ret
298
+
299
+
300
+align 16
301
+fft16_avx:
302
+    mova       m2, Z(2)
303
+    mova       m3, Z(3)
304
+    T4_SSE     m2, m3, m7
305
+
306
+    mova       m0, Z(0)
307
+    mova       m1, Z(1)
308
+    T8_AVX     m0, m1, m4, m5, m7
309
+
310
+    mova       m4, [ps_cos16_1]
311
+    mova       m5, [ps_cos16_2]
312
+    vmulps     m6, m2, m4
313
+    vmulps     m7, m3, m5
314
+    vaddps     m7, m7, m6
315
+    vmulps     m2, m2, m5
316
+    vmulps     m3, m3, m4
317
+    vsubps     m3, m3, m2
318
+    vblendps   m2, m7, m3, 0xf0
319
+    vperm2f128 m3, m7, m3, 0x21
320
+    vaddps     m4, m2, m3
321
+    vsubps     m2, m3, m2
322
+    vperm2f128 m2, m2, m2, 0x01
323
+    vsubps     m3, m1, m2
324
+    vaddps     m1, m1, m2
325
+    vsubps     m5, m0, m4
326
+    vaddps     m0, m0, m4
327
+    vextractf128   Z(0), m0, 0
328
+    vextractf128  ZH(0), m1, 0
329
+    vextractf128   Z(1), m0, 1
330
+    vextractf128  ZH(1), m1, 1
331
+    vextractf128   Z(2), m5, 0
332
+    vextractf128  ZH(2), m3, 0
333
+    vextractf128   Z(3), m5, 1
334
+    vextractf128  ZH(3), m3, 1
335
+    ret
336
+
337
+align 16
338
+fft32_avx:
339
+    call fft16_avx
340
+
341
+    mova m0, Z(4)
342
+    mova m1, Z(5)
343
+
344
+    T4_SSE      m0, m1, m4
345
+
346
+    mova m2, Z(6)
347
+    mova m3, Z(7)
348
+
349
+    T8_SSE      m0, m1, m2, m3, m4, m6
350
+    ; m0={r0,r1,r2,r3,r8, r9, r10,r11} m1={i0,i1,i2,i3,i8, i9, i10,i11}
351
+    ; m2={r4,r5,r6,r7,r12,r13,r14,r15} m3={i4,i5,i6,i7,i12,i13,i14,i15}
352
+
353
+    vperm2f128  m4, m0, m2, 0x20
354
+    vperm2f128  m5, m1, m3, 0x20
355
+    vperm2f128  m6, m0, m2, 0x31
356
+    vperm2f128  m7, m1, m3, 0x31
357
+
358
+    PASS_SMALL 0, [cos_32], [cos_32+32]
359
+
360
+    ret
361
+
362
+fft32_interleave_avx:
363
+    call fft32_avx
364
+    mov r2d, 32
365
+.deint_loop:
366
+    mova     m2, Z(0)
367
+    mova     m3, Z(1)
368
+    vunpcklps      m0, m2, m3
369
+    vunpckhps      m1, m2, m3
370
+    vextractf128   Z(0), m0, 0
371
+    vextractf128  ZH(0), m1, 0
372
+    vextractf128   Z(1), m0, 1
373
+    vextractf128  ZH(1), m1, 1
374
+    add r0, mmsize*2
375
+    sub r2d, mmsize/4
376
+    jg .deint_loop
377
+    ret
378
+
379
+INIT_XMM
380
+%define movdqa  movaps
289 381
 
290 382
 align 16
383
+fft4_avx:
291 384
 fft4_sse:
292 385
     mova     m0, Z(0)
293 386
     mova     m1, Z(1)
... ...
@@ -406,6 +511,8 @@ FFT48_3DN _3dn
406 406
 
407 407
 %define Z(x) [zq + o1q*(x&6) + mmsize*(x&1)]
408 408
 %define Z2(x) [zq + o3q + mmsize*(x&1)]
409
+%define ZH(x) [zq + o1q*(x&6) + mmsize*(x&1) + mmsize/2]
410
+%define Z2H(x) [zq + o3q + mmsize*(x&1) + mmsize/2]
409 411
 
410 412
 %macro DECL_PASS 2+ ; name, payload
411 413
 align 16
... ...
@@ -423,8 +530,34 @@ DEFINE_ARGS z, w, n, o1, o3
423 423
     rep ret
424 424
 %endmacro
425 425
 
426
+INIT_YMM
427
+
428
+%macro INTERL_AVX 5
429
+    vunpckhps      %3, %2, %1
430
+    vunpcklps      %2, %2, %1
431
+    vextractf128   %4(%5), %2, 0
432
+    vextractf128  %4 %+ H(%5), %3, 0
433
+    vextractf128   %4(%5 + 1), %2, 1
434
+    vextractf128  %4 %+ H(%5 + 1), %3, 1
435
+%endmacro
436
+
437
+%define INTERL INTERL_AVX
438
+
439
+DECL_PASS pass_avx, PASS_BIG 1
440
+DECL_PASS pass_interleave_avx, PASS_BIG 0
441
+
426 442
 INIT_XMM
427
-%define mova movaps
443
+
444
+%macro INTERL_SSE 5
445
+    mova     %3, %2
446
+    unpcklps %2, %1
447
+    unpckhps %3, %1
448
+    mova  %4(%5), %2
449
+    mova  %4(%5+1), %3
450
+%endmacro
451
+
452
+%define INTERL INTERL_SSE
453
+
428 454
 DECL_PASS pass_sse, PASS_BIG 1
429 455
 DECL_PASS pass_interleave_sse, PASS_BIG 0
430 456
 
... ...
@@ -457,9 +590,12 @@ DECL_PASS pass_interleave_3dn, PASS_BIG 0
457 457
 
458 458
 %macro DECL_FFT 2-3 ; nbits, cpu, suffix
459 459
 %xdefine list_of_fft fft4%2 SECTION_REL, fft8%2 SECTION_REL
460
-%if %1==5
460
+%if %1>=5
461 461
 %xdefine list_of_fft list_of_fft, fft16%2 SECTION_REL
462 462
 %endif
463
+%if %1>=6
464
+%xdefine list_of_fft list_of_fft, fft32%3%2 SECTION_REL
465
+%endif
463 466
 
464 467
 %assign n 1<<%1
465 468
 %rep 17-%1
... ...
@@ -492,9 +628,14 @@ section .text
492 492
 ; The others pass args in registers and don't spill anything.
493 493
 cglobal fft_dispatch%3%2, 2,5,8, z, nbits
494 494
     FFT_DISPATCH %3%2, nbits
495
+%ifidn %2, _avx
496
+    vzeroupper
497
+%endif
495 498
     RET
496 499
 %endmacro ; DECL_FFT
497 500
 
501
+DECL_FFT 6, _avx
502
+DECL_FFT 6, _avx, _interleave
498 503
 DECL_FFT 5, _sse
499 504
 DECL_FFT 5, _sse, _interleave
500 505
 DECL_FFT 4, _3dn
... ...
@@ -533,21 +674,53 @@ INIT_XMM
533 533
 %endmacro
534 534
 
535 535
 %macro CMUL 6 ;j, xmm0, xmm1, 3, 4, 5
536
-    movaps   xmm6, [%4+%1*2]
537
-    movaps   %2,   [%4+%1*2+0x10]
538
-    movaps   %3,   xmm6
539
-    movaps   xmm7, %2
540
-    mulps    xmm6, [%5+%1]
541
-    mulps    %2,   [%6+%1]
542
-    mulps    %3,   [%6+%1]
543
-    mulps    xmm7, [%5+%1]
544
-    subps    %2,   xmm6
545
-    addps    %3,   xmm7
536
+    mulps      m6, %3, [%5+%1]
537
+    mulps      m7, %2, [%5+%1]
538
+    mulps      %2, %2, [%6+%1]
539
+    mulps      %3, %3, [%6+%1]
540
+    subps      %2, %2, m6
541
+    addps      %3, %3, m7
542
+%endmacro
543
+
544
+%macro POSROTATESHUF_AVX 5 ;j, k, z+n8, tcos+n8, tsin+n8
545
+.post:
546
+    vmovaps      ymm1,   [%3+%1*2]
547
+    vmovaps      ymm0,   [%3+%1*2+0x20]
548
+    vmovaps      ymm3,   [%3+%2*2]
549
+    vmovaps      ymm2,   [%3+%2*2+0x20]
550
+
551
+    CMUL         %1, ymm0, ymm1, %3, %4, %5
552
+    CMUL         %2, ymm2, ymm3, %3, %4, %5
553
+    vshufps      ymm1, ymm1, ymm1, 0x1b
554
+    vshufps      ymm3, ymm3, ymm3, 0x1b
555
+    vperm2f128   ymm1, ymm1, ymm1, 0x01
556
+    vperm2f128   ymm3, ymm3, ymm3, 0x01
557
+    vunpcklps    ymm6, ymm2, ymm1
558
+    vunpckhps    ymm4, ymm2, ymm1
559
+    vunpcklps    ymm7, ymm0, ymm3
560
+    vunpckhps    ymm5, ymm0, ymm3
561
+
562
+    vextractf128 [%3+%1*2],      ymm7, 0
563
+    vextractf128 [%3+%1*2+0x10], ymm5, 0
564
+    vextractf128 [%3+%1*2+0x20], ymm7, 1
565
+    vextractf128 [%3+%1*2+0x30], ymm5, 1
566
+
567
+    vextractf128 [%3+%2*2],      ymm6, 0
568
+    vextractf128 [%3+%2*2+0x10], ymm4, 0
569
+    vextractf128 [%3+%2*2+0x20], ymm6, 1
570
+    vextractf128 [%3+%2*2+0x30], ymm4, 1
571
+    sub      %2,   0x20
572
+    add      %1,   0x20
573
+    jl       .post
546 574
 %endmacro
547 575
 
548 576
 %macro POSROTATESHUF 5 ;j, k, z+n8, tcos+n8, tsin+n8
549 577
 .post:
578
+    movaps   xmm1, [%3+%1*2]
579
+    movaps   xmm0, [%3+%1*2+0x10]
550 580
     CMUL     %1,   xmm0, xmm1, %3, %4, %5
581
+    movaps   xmm5, [%3+%2*2]
582
+    movaps   xmm4, [%3+%2*2+0x10]
551 583
     CMUL     %2,   xmm4, xmm5, %3, %4, %5
552 584
     shufps   xmm1, xmm1, 0x1b
553 585
     shufps   xmm5, xmm5, 0x1b
... ...
@@ -566,7 +739,8 @@ INIT_XMM
566 566
     jl       .post
567 567
 %endmacro
568 568
 
569
-cglobal imdct_half_sse, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample *input
569
+%macro DECL_IMDCT 2
570
+cglobal imdct_half%1, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample *input
570 571
 %ifdef ARCH_X86_64
571 572
 %define rrevtab r10
572 573
 %define rtcos   r11
... ...
@@ -641,7 +815,7 @@ cglobal imdct_half_sse, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample
641 641
     mov  r0, r1
642 642
     mov  r1d, [r5+FFTContext.nbits]
643 643
 
644
-    FFT_DISPATCH _sse, r1
644
+    FFT_DISPATCH %1, r1
645 645
 
646 646
     mov  r0d, [r5+FFTContext.mdctsize]
647 647
     add  r6, r0
... ...
@@ -653,9 +827,9 @@ cglobal imdct_half_sse, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample
653 653
     mov  rtsin, [esp+4]
654 654
 %endif
655 655
     neg  r0
656
-    mov  r1, -16
656
+    mov  r1, -mmsize
657 657
     sub  r1, r0
658
-    POSROTATESHUF r0, r1, r6, rtcos, rtsin
658
+    %2 r0, r1, r6, rtcos, rtsin
659 659
 %ifdef ARCH_X86_64
660 660
     pop  r14
661 661
     pop  r13
... ...
@@ -663,4 +837,14 @@ cglobal imdct_half_sse, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample
663 663
 %else
664 664
     add esp, 12
665 665
 %endif
666
+%ifidn avx_enabled, 1
667
+    vzeroupper
668
+%endif
666 669
     RET
670
+%endmacro
671
+
672
+DECL_IMDCT _sse, POSROTATESHUF
673
+
674
+INIT_YMM
675
+
676
+DECL_IMDCT _avx, POSROTATESHUF_AVX
... ...
@@ -28,6 +28,12 @@ DECLARE_ASM_CONST(16, int, ff_m1m1m1m1)[4] =
28 28
 
29 29
 void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
30 30
 void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits);
31
+void ff_fft_dispatch_interleave_avx(FFTComplex *z, int nbits);
32
+
33
+void ff_fft_calc_avx(FFTContext *s, FFTComplex *z)
34
+{
35
+    ff_fft_dispatch_interleave_avx(z, s->nbits);
36
+}
31 37
 
32 38
 void ff_fft_calc_sse(FFTContext *s, FFTComplex *z)
33 39
 {
... ...
@@ -77,7 +83,7 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
77 77
     long n = s->mdct_size;
78 78
     long n4 = n >> 2;
79 79
 
80
-    ff_imdct_half_sse(s, output+n4, input);
80
+    s->imdct_half(s, output + n4, input);
81 81
 
82 82
     j = -n;
83 83
     k = n-16;
... ...
@@ -1,10 +1,11 @@
1 1
 ;*****************************************************************************
2 2
 ;* x86inc.asm
3 3
 ;*****************************************************************************
4
-;* Copyright (C) 2005-2008 x264 project
4
+;* Copyright (C) 2005-2011 x264 project
5 5
 ;*
6 6
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
7 7
 ;*          Anton Mitrofanov <BugMaster@narod.ru>
8
+;*          Jason Garrett-Glaser <darkshikari@gmail.com>
8 9
 ;*
9 10
 ;* Permission to use, copy, modify, and/or distribute this software for any
10 11
 ;* purpose with or without fee is hereby granted, provided that the above
... ...
@@ -499,6 +500,7 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
499 499
 %endmacro
500 500
 
501 501
 %macro INIT_MMX 0
502
+    %assign avx_enabled 0
502 503
     %define RESET_MM_PERMUTATION INIT_MMX
503 504
     %define mmsize 8
504 505
     %define num_mmregs 8
... ...
@@ -520,6 +522,7 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
520 520
 %endmacro
521 521
 
522 522
 %macro INIT_XMM 0
523
+    %assign avx_enabled 0
523 524
     %define RESET_MM_PERMUTATION INIT_XMM
524 525
     %define mmsize 16
525 526
     %define num_mmregs 8
... ...
@@ -538,6 +541,31 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
538 538
     %endrep
539 539
 %endmacro
540 540
 
541
+%macro INIT_AVX 0
542
+    INIT_XMM
543
+    %assign avx_enabled 1
544
+    %define PALIGNR PALIGNR_SSSE3
545
+    %define RESET_MM_PERMUTATION INIT_AVX
546
+%endmacro
547
+
548
+%macro INIT_YMM 0
549
+    %assign avx_enabled 1
550
+    %define RESET_MM_PERMUTATION INIT_YMM
551
+    %define mmsize 32
552
+    %define num_mmregs 8
553
+    %ifdef ARCH_X86_64
554
+    %define num_mmregs 16
555
+    %endif
556
+    %define mova vmovaps
557
+    %define movu vmovups
558
+    %assign %%i 0
559
+    %rep num_mmregs
560
+    CAT_XDEFINE m, %%i, ymm %+ %%i
561
+    CAT_XDEFINE nymm, %%i, %%i
562
+    %assign %%i %%i+1
563
+    %endrep
564
+%endmacro
565
+
541 566
 INIT_MMX
542 567
 
543 568
 ; I often want to use macros that permute their arguments. e.g. there's no
... ...
@@ -645,3 +673,222 @@ INIT_MMX
645 645
         sub %1, %2
646 646
     %endif
647 647
 %endmacro
648
+
649
+;=============================================================================
650
+; AVX abstraction layer
651
+;=============================================================================
652
+
653
+%assign i 0
654
+%rep 16
655
+    %if i < 8
656
+        CAT_XDEFINE sizeofmm, i, 8
657
+    %endif
658
+    CAT_XDEFINE sizeofxmm, i, 16
659
+    CAT_XDEFINE sizeofymm, i, 32
660
+%assign i i+1
661
+%endrep
662
+%undef i
663
+
664
+;%1 == instruction
665
+;%2 == 1 if float, 0 if int
666
+;%3 == 0 if 3-operand (xmm, xmm, xmm), 1 if 4-operand (xmm, xmm, xmm, imm)
667
+;%4 == number of operands given
668
+;%5+: operands
669
+%macro RUN_AVX_INSTR 6-7+
670
+    %if sizeof%5==32
671
+        v%1 %5, %6, %7
672
+    %else
673
+        %if sizeof%5==8
674
+            %define %%regmov movq
675
+        %elif %2
676
+            %define %%regmov movaps
677
+        %else
678
+            %define %%regmov movdqa
679
+        %endif
680
+
681
+        %if %4>=3+%3
682
+            %ifnidn %5, %6
683
+                %if avx_enabled && sizeof%5==16
684
+                    v%1 %5, %6, %7
685
+                %else
686
+                    %%regmov %5, %6
687
+                    %1 %5, %7
688
+                %endif
689
+            %else
690
+                %1 %5, %7
691
+            %endif
692
+        %elif %3
693
+            %1 %5, %6, %7
694
+        %else
695
+            %1 %5, %6
696
+        %endif
697
+    %endif
698
+%endmacro
699
+
700
+;%1 == instruction
701
+;%2 == 1 if float, 0 if int
702
+;%3 == 0 if 3-operand (xmm, xmm, xmm), 1 if 4-operand (xmm, xmm, xmm, imm)
703
+%macro AVX_INSTR 3
704
+    %macro %1 2-8 fnord, fnord, fnord, %1, %2, %3
705
+        %ifidn %3, fnord
706
+            RUN_AVX_INSTR %6, %7, %8, 2, %1, %2
707
+        %elifidn %4, fnord
708
+            RUN_AVX_INSTR %6, %7, %8, 3, %1, %2, %3
709
+        %elifidn %5, fnord
710
+            RUN_AVX_INSTR %6, %7, %8, 4, %1, %2, %3, %4
711
+        %else
712
+            RUN_AVX_INSTR %6, %7, %8, 5, %1, %2, %3, %4, %5
713
+        %endif
714
+    %endmacro
715
+%endmacro
716
+
717
+AVX_INSTR addpd, 1, 0
718
+AVX_INSTR addps, 1, 0
719
+AVX_INSTR addsd, 1, 0
720
+AVX_INSTR addss, 1, 0
721
+AVX_INSTR addsubpd, 1, 0
722
+AVX_INSTR addsubps, 1, 0
723
+AVX_INSTR andpd, 1, 0
724
+AVX_INSTR andps, 1, 0
725
+AVX_INSTR andnpd, 1, 0
726
+AVX_INSTR andnps, 1, 0
727
+AVX_INSTR blendpd, 1, 0
728
+AVX_INSTR blendps, 1, 0
729
+AVX_INSTR blendvpd, 1, 0
730
+AVX_INSTR blendvps, 1, 0
731
+AVX_INSTR cmppd, 1, 0
732
+AVX_INSTR cmpps, 1, 0
733
+AVX_INSTR cmpsd, 1, 0
734
+AVX_INSTR cmpss, 1, 0
735
+AVX_INSTR divpd, 1, 0
736
+AVX_INSTR divps, 1, 0
737
+AVX_INSTR divsd, 1, 0
738
+AVX_INSTR divss, 1, 0
739
+AVX_INSTR dppd, 1, 0
740
+AVX_INSTR dpps, 1, 0
741
+AVX_INSTR haddpd, 1, 0
742
+AVX_INSTR haddps, 1, 0
743
+AVX_INSTR hsubpd, 1, 0
744
+AVX_INSTR hsubps, 1, 0
745
+AVX_INSTR maxpd, 1, 0
746
+AVX_INSTR maxps, 1, 0
747
+AVX_INSTR maxsd, 1, 0
748
+AVX_INSTR maxss, 1, 0
749
+AVX_INSTR minpd, 1, 0
750
+AVX_INSTR minps, 1, 0
751
+AVX_INSTR minsd, 1, 0
752
+AVX_INSTR minss, 1, 0
753
+AVX_INSTR mpsadbw, 0, 1
754
+AVX_INSTR mulpd, 1, 0
755
+AVX_INSTR mulps, 1, 0
756
+AVX_INSTR mulsd, 1, 0
757
+AVX_INSTR mulss, 1, 0
758
+AVX_INSTR orpd, 1, 0
759
+AVX_INSTR orps, 1, 0
760
+AVX_INSTR packsswb, 0, 0
761
+AVX_INSTR packssdw, 0, 0
762
+AVX_INSTR packuswb, 0, 0
763
+AVX_INSTR packusdw, 0, 0
764
+AVX_INSTR paddb, 0, 0
765
+AVX_INSTR paddw, 0, 0
766
+AVX_INSTR paddd, 0, 0
767
+AVX_INSTR paddq, 0, 0
768
+AVX_INSTR paddsb, 0, 0
769
+AVX_INSTR paddsw, 0, 0
770
+AVX_INSTR paddusb, 0, 0
771
+AVX_INSTR paddusw, 0, 0
772
+AVX_INSTR palignr, 0, 1
773
+AVX_INSTR pand, 0, 0
774
+AVX_INSTR pandn, 0, 0
775
+AVX_INSTR pavgb, 0, 0
776
+AVX_INSTR pavgw, 0, 0
777
+AVX_INSTR pblendvb, 0, 0
778
+AVX_INSTR pblendw, 0, 1
779
+AVX_INSTR pcmpestri, 0, 0
780
+AVX_INSTR pcmpestrm, 0, 0
781
+AVX_INSTR pcmpistri, 0, 0
782
+AVX_INSTR pcmpistrm, 0, 0
783
+AVX_INSTR pcmpeqb, 0, 0
784
+AVX_INSTR pcmpeqw, 0, 0
785
+AVX_INSTR pcmpeqd, 0, 0
786
+AVX_INSTR pcmpeqq, 0, 0
787
+AVX_INSTR pcmpgtb, 0, 0
788
+AVX_INSTR pcmpgtw, 0, 0
789
+AVX_INSTR pcmpgtd, 0, 0
790
+AVX_INSTR pcmpgtq, 0, 0
791
+AVX_INSTR phaddw, 0, 0
792
+AVX_INSTR phaddd, 0, 0
793
+AVX_INSTR phaddsw, 0, 0
794
+AVX_INSTR phsubw, 0, 0
795
+AVX_INSTR phsubd, 0, 0
796
+AVX_INSTR phsubsw, 0, 0
797
+AVX_INSTR pmaddwd, 0, 0
798
+AVX_INSTR pmaddubsw, 0, 0
799
+AVX_INSTR pmaxsb, 0, 0
800
+AVX_INSTR pmaxsw, 0, 0
801
+AVX_INSTR pmaxsd, 0, 0
802
+AVX_INSTR pmaxub, 0, 0
803
+AVX_INSTR pmaxuw, 0, 0
804
+AVX_INSTR pmaxud, 0, 0
805
+AVX_INSTR pminsb, 0, 0
806
+AVX_INSTR pminsw, 0, 0
807
+AVX_INSTR pminsd, 0, 0
808
+AVX_INSTR pminub, 0, 0
809
+AVX_INSTR pminuw, 0, 0
810
+AVX_INSTR pminud, 0, 0
811
+AVX_INSTR pmulhuw, 0, 0
812
+AVX_INSTR pmulhrsw, 0, 0
813
+AVX_INSTR pmulhw, 0, 0
814
+AVX_INSTR pmullw, 0, 0
815
+AVX_INSTR pmulld, 0, 0
816
+AVX_INSTR pmuludq, 0, 0
817
+AVX_INSTR pmuldq, 0, 0
818
+AVX_INSTR por, 0, 0
819
+AVX_INSTR psadbw, 0, 0
820
+AVX_INSTR pshufb, 0, 0
821
+AVX_INSTR psignb, 0, 0
822
+AVX_INSTR psignw, 0, 0
823
+AVX_INSTR psignd, 0, 0
824
+AVX_INSTR psllw, 0, 0
825
+AVX_INSTR pslld, 0, 0
826
+AVX_INSTR psllq, 0, 0
827
+AVX_INSTR pslldq, 0, 0
828
+AVX_INSTR psraw, 0, 0
829
+AVX_INSTR psrad, 0, 0
830
+AVX_INSTR psrlw, 0, 0
831
+AVX_INSTR psrld, 0, 0
832
+AVX_INSTR psrlq, 0, 0
833
+AVX_INSTR psrldq, 0, 0
834
+AVX_INSTR psubb, 0, 0
835
+AVX_INSTR psubw, 0, 0
836
+AVX_INSTR psubd, 0, 0
837
+AVX_INSTR psubq, 0, 0
838
+AVX_INSTR psubsb, 0, 0
839
+AVX_INSTR psubsw, 0, 0
840
+AVX_INSTR psubusb, 0, 0
841
+AVX_INSTR psubusw, 0, 0
842
+AVX_INSTR punpckhbw, 0, 0
843
+AVX_INSTR punpckhwd, 0, 0
844
+AVX_INSTR punpckhdq, 0, 0
845
+AVX_INSTR punpckhqdq, 0, 0
846
+AVX_INSTR punpcklbw, 0, 0
847
+AVX_INSTR punpcklwd, 0, 0
848
+AVX_INSTR punpckldq, 0, 0
849
+AVX_INSTR punpcklqdq, 0, 0
850
+AVX_INSTR pxor, 0, 0
851
+AVX_INSTR shufps, 0, 1
852
+AVX_INSTR subpd, 1, 0
853
+AVX_INSTR subps, 1, 0
854
+AVX_INSTR subsd, 1, 0
855
+AVX_INSTR subss, 1, 0
856
+AVX_INSTR unpckhpd, 1, 0
857
+AVX_INSTR unpckhps, 1, 0
858
+AVX_INSTR unpcklpd, 1, 0
859
+AVX_INSTR unpcklps, 1, 0
860
+AVX_INSTR xorpd, 1, 0
861
+AVX_INSTR xorps, 1, 0
862
+
863
+; 3DNow instructions, for sharing code between AVX, SSE and 3DN
864
+AVX_INSTR pfadd, 1, 0
865
+AVX_INSTR pfsub, 1, 0
866
+AVX_INSTR pfmul, 1, 0
... ...
@@ -26,8 +26,8 @@
26 26
 #include "libavutil/samplefmt.h"
27 27
 
28 28
 #define LIBAVFILTER_VERSION_MAJOR  2
29
-#define LIBAVFILTER_VERSION_MINOR  0
30
-#define LIBAVFILTER_VERSION_MICRO  0
29
+#define LIBAVFILTER_VERSION_MINOR  3
30
+#define LIBAVFILTER_VERSION_MICRO  1
31 31
 
32 32
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
33 33
                                                LIBAVFILTER_VERSION_MINOR, \
... ...
@@ -115,7 +115,7 @@ typedef struct AVFilterBufferRefVideoProps {
115 115
     AVRational pixel_aspect;    ///< pixel aspect ratio
116 116
     int interlaced;             ///< is frame interlaced
117 117
     int top_field_first;        ///< field order
118
-    int pict_type;              ///< Picture type of the frame
118
+    enum AVPictureType pict_type; ///< picture type of the frame
119 119
     int key_frame;              ///< 1 -> keyframe, 0-> not
120 120
 } AVFilterBufferRefVideoProps;
121 121
 
... ...
@@ -75,8 +75,8 @@ typedef struct {
75 75
     int input_is_pal;           ///< set to 1 if the input format is paletted
76 76
     int interlaced;
77 77
 
78
-    char w_expr[256];             ///< width  expression string
79
-    char h_expr[256];             ///< height expression string
78
+    char w_expr[256];           ///< width  expression string
79
+    char h_expr[256];           ///< height expression string
80 80
 } ScaleContext;
81 81
 
82 82
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
... ...
@@ -1,7 +1,6 @@
1 1
 /*
2 2
  * Copyright (C) 2006-2010 Michael Niedermayer <michaelni@gmx.at>
3
- *               2010 James Darnley <james.darnley@gmail.com>
4
- * This file is part of FFmpeg.
3
+ *               2010      James Darnley <james.darnley@gmail.com>
5 4
  *
6 5
  * FFmpeg is free software; you can redistribute it and/or modify
7 6
  * it under the terms of the GNU General Public License as published by
... ...
@@ -131,7 +131,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
131 131
         (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str,
132 132
                     &c->time_base.num, &c->time_base.den,
133 133
                     &c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) {
134
-        av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but %d found in '%s'\n", n, args);
134
+        av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but only %d found in '%s'\n", n, args);
135 135
         return AVERROR(EINVAL);
136 136
     }
137 137
     if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) {
... ...
@@ -175,7 +175,6 @@ static void build_frame_code(AVFormatContext *s){
175 175
         }
176 176
 
177 177
         key_frame= intra_only;
178
-#if 1
179 178
         if(is_audio){
180 179
             int frame_bytes= codec->frame_size*(int64_t)codec->bit_rate / (8*codec->sample_rate);
181 180
             int pts;
... ...
@@ -199,7 +198,6 @@ static void build_frame_code(AVFormatContext *s){
199 199
             ft->pts_delta=1;
200 200
             start2++;
201 201
         }
202
-#endif
203 202
 
204 203
         if(codec->has_b_frames){
205 204
             pred_count=5;
... ...
@@ -40,7 +40,7 @@
40 40
 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
41 41
 
42 42
 #define LIBAVUTIL_VERSION_MAJOR 51
43
-#define LIBAVUTIL_VERSION_MINOR  0
43
+#define LIBAVUTIL_VERSION_MINOR  1
44 44
 #define LIBAVUTIL_VERSION_MICRO  0
45 45
 
46 46
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
... ...
@@ -97,6 +97,25 @@ enum AVMediaType {
97 97
 #define AV_TIME_BASE            1000000
98 98
 #define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
99 99
 
100
+enum AVPictureType {
101
+    AV_PICTURE_TYPE_I = 1, ///< Intra
102
+    AV_PICTURE_TYPE_P,     ///< Predicted
103
+    AV_PICTURE_TYPE_B,     ///< Bi-dir predicted
104
+    AV_PICTURE_TYPE_S,     ///< S(GMC)-VOP MPEG4
105
+    AV_PICTURE_TYPE_SI,    ///< Switching Intra
106
+    AV_PICTURE_TYPE_SP,    ///< Switching Predicted
107
+    AV_PICTURE_TYPE_BI,    ///< BI type
108
+};
109
+
110
+/**
111
+ * Return a single letter to describe the given picture type
112
+ * pict_type.
113
+ *
114
+ * @param[in] pict_type the picture type @return a single character
115
+ * representing the picture type, '?' if pict_type is unknown
116
+ */
117
+char av_get_picture_type_char(enum AVPictureType pict_type);
118
+
100 119
 #include "common.h"
101 120
 #include "error.h"
102 121
 #include "mathematics.h"
... ...
@@ -69,21 +69,21 @@ void *av_malloc(size_t size)
69 69
 #endif
70 70
 
71 71
     /* let's disallow possible ambiguous cases */
72
-    if(size > (INT_MAX-16) )
72
+    if(size > (INT_MAX-32) )
73 73
         return NULL;
74 74
 
75 75
 #if CONFIG_MEMALIGN_HACK
76
-    ptr = malloc(size+16);
76
+    ptr = malloc(size+32);
77 77
     if(!ptr)
78 78
         return ptr;
79
-    diff= ((-(long)ptr - 1)&15) + 1;
79
+    diff= ((-(long)ptr - 1)&31) + 1;
80 80
     ptr = (char*)ptr + diff;
81 81
     ((char*)ptr)[-1]= diff;
82 82
 #elif HAVE_POSIX_MEMALIGN
83
-    if (posix_memalign(&ptr,16,size))
83
+    if (posix_memalign(&ptr,32,size))
84 84
         ptr = NULL;
85 85
 #elif HAVE_MEMALIGN
86
-    ptr = memalign(16,size);
86
+    ptr = memalign(32,size);
87 87
     /* Why 64?
88 88
        Indeed, we should align it:
89 89
          on 4 for 386
... ...
@@ -93,10 +93,8 @@ void *av_malloc(size_t size)
93 93
        Because L1 and L2 caches are aligned on those values.
94 94
        But I don't want to code such logic here!
95 95
      */
96
-     /* Why 16?
97
-        Because some CPUs need alignment, for example SSE2 on P4, & most RISC CPUs
98
-        it will just trigger an exception and the unaligned load will be done in the
99
-        exception handler or it will just segfault (SSE2 on P4).
96
+     /* Why 32?
97
+        For AVX ASM. SSE / NEON needs only 16.
100 98
         Why not larger? Because I did not see a difference in benchmarks ...
101 99
      */
102 100
      /* benchmarks with P3
... ...
@@ -218,7 +218,6 @@ int main(void){
218 218
         printf("\n");
219 219
     }
220 220
 
221
-#if 1
222 221
     for(i=0; i<LEN; i++){
223 222
         double v[LEN];
224 223
         double error=0;
... ...
@@ -233,7 +232,7 @@ int main(void){
233 233
         printf("%f ", error);
234 234
     }
235 235
     printf("\n");
236
-#endif
236
+
237 237
     for(i=0; i<LEN; i++){
238 238
         for(j=0; j<LEN; j++){
239 239
             printf("%9.6f ", eigenvector[i + j*LEN]);
... ...
@@ -39,3 +39,17 @@ const char *avutil_license(void)
39 39
 #define LICENSE_PREFIX "libavutil license: "
40 40
     return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
41 41
 }
42
+
43
+char av_get_picture_type_char(enum AVPictureType pict_type)
44
+{
45
+    switch (pict_type) {
46
+    case AV_PICTURE_TYPE_I:  return 'I';
47
+    case AV_PICTURE_TYPE_P:  return 'P';
48
+    case AV_PICTURE_TYPE_B:  return 'B';
49
+    case AV_PICTURE_TYPE_S:  return 'S';
50
+    case AV_PICTURE_TYPE_SI: return 'i';
51
+    case AV_PICTURE_TYPE_SP: return 'p';
52
+    case AV_PICTURE_TYPE_BI: return 'b';
53
+    default:                 return '?';
54
+    }
55
+}
... ...
@@ -1,2 +1,2 @@
1
-5ddb6d25dd117db29627f9d286153a7a *./tests/data/acodec/ac3.rm
1
+0f14801e166819dd4a58981aea36e08b *./tests/data/acodec/ac3.rm
2 2
 98751 ./tests/data/acodec/ac3.rm
... ...
@@ -1,2 +1,2 @@
1
-a1c71456f21d5459d2824d75bbdcc80c *./tests/data/lavf/lavf.rm
1
+2e3d6b1944c6cd2cf14e13055aecf82a *./tests/data/lavf/lavf.rm
2 2
 346706 ./tests/data/lavf/lavf.rm
... ...
@@ -11,7 +11,8 @@ ret:-1         st:-1 flags:1  ts: 1.470835
11 11
 ret:-1         st: 0 flags:0  ts: 0.365000
12 12
 ret: 0         st: 0 flags:1  ts:-0.741000
13 13
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
14
-ret:-1         st:-1 flags:0  ts: 2.153336
14
+ret: 0         st:-1 flags:0  ts: 2.153336
15
+ret: 0         st: 0 flags:1 dts: 2.159000 pts: 2.159000 pos:  35567 size:   556
15 16
 ret:-1         st:-1 flags:1  ts: 1.047503
16 17
 ret: 0         st: 0 flags:0  ts:-0.058000
17 18
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556