Browse code

Merge commit 'bfe5454cd238b16e7977085f880205229103eccb'

* commit 'bfe5454cd238b16e7977085f880205229103eccb':
lavf: move ff_codec_get_tag() and ff_codec_get_id() definitions to internal.h
lavf: move "MP3 " fourcc from riff to nut
fate: vpx: Add dependencies
fate: Fix wavpack-matroskamode test dependencies
x86: dsputilenc: port to cpuflags

Conflicts:
libavformat/internal.h
libavformat/nut.c
tests/fate/vpx.mak

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

Michael Niedermayer authored on 2012/11/29 21:45:57
Showing 23 changed files
... ...
@@ -99,35 +99,33 @@ SECTION .text
99 99
     paddusw         m0, m1
100 100
 %endmacro
101 101
 
102
-; FIXME: HSUM_* saturates at 64k, while an 8x8 hadamard or dct block can get up to
102
+; FIXME: HSUM saturates at 64k, while an 8x8 hadamard or dct block can get up to
103 103
 ; about 100k on extreme inputs. But that's very unlikely to occur in natural video,
104 104
 ; and it's even more unlikely to not have any alternative mvs/modes with lower cost.
105
-%macro HSUM_MMX 3
106
-    mova            %2, %1
107
-    psrlq           %1, 32
105
+%macro HSUM 3
106
+%if cpuflag(sse2)
107
+    movhlps         %2, %1
108 108
     paddusw         %1, %2
109
-    mova            %2, %1
110
-    psrlq           %1, 16
109
+    pshuflw         %2, %1, 0xE
110
+    paddusw         %1, %2
111
+    pshuflw         %2, %1, 0x1
111 112
     paddusw         %1, %2
112 113
     movd            %3, %1
113
-%endmacro
114
-
115
-%macro HSUM_MMXEXT 3
114
+%elif cpuflag(mmxext)
116 115
     pshufw          %2, %1, 0xE
117 116
     paddusw         %1, %2
118 117
     pshufw          %2, %1, 0x1
119 118
     paddusw         %1, %2
120 119
     movd            %3, %1
121
-%endmacro
122
-
123
-%macro HSUM_SSE2 3
124
-    movhlps         %2, %1
125
-    paddusw         %1, %2
126
-    pshuflw         %2, %1, 0xE
120
+%elif cpuflag(mmx)
121
+    mova            %2, %1
122
+    psrlq           %1, 32
127 123
     paddusw         %1, %2
128
-    pshuflw         %2, %1, 0x1
124
+    mova            %2, %1
125
+    psrlq           %1, 16
129 126
     paddusw         %1, %2
130 127
     movd            %3, %1
128
+%endif
131 129
 %endmacro
132 130
 
133 131
 %macro STORE4 5
... ...
@@ -144,30 +142,30 @@ SECTION .text
144 144
     mova            %5, [%1+mmsize*3]
145 145
 %endmacro
146 146
 
147
-%macro hadamard8_16_wrapper 3
148
-cglobal hadamard8_diff_%1, 4, 4, %2
147
+%macro hadamard8_16_wrapper 2
148
+cglobal hadamard8_diff, 4, 4, %1
149 149
 %ifndef m8
150
-    %assign pad %3*mmsize-(4+stack_offset&(mmsize-1))
150
+    %assign pad %2*mmsize-(4+stack_offset&(mmsize-1))
151 151
     SUB            rsp, pad
152 152
 %endif
153
-    call hadamard8x8_diff_%1
153
+    call hadamard8x8_diff %+ SUFFIX
154 154
 %ifndef m8
155 155
     ADD            rsp, pad
156 156
 %endif
157 157
     RET
158 158
 
159
-cglobal hadamard8_diff16_%1, 5, 6, %2
159
+cglobal hadamard8_diff16, 5, 6, %1
160 160
 %ifndef m8
161
-    %assign pad %3*mmsize-(4+stack_offset&(mmsize-1))
161
+    %assign pad %2*mmsize-(4+stack_offset&(mmsize-1))
162 162
     SUB            rsp, pad
163 163
 %endif
164 164
 
165
-    call hadamard8x8_diff_%1
165
+    call hadamard8x8_diff %+ SUFFIX
166 166
     mov            r5d, eax
167 167
 
168 168
     add             r1, 8
169 169
     add             r2, 8
170
-    call hadamard8x8_diff_%1
170
+    call hadamard8x8_diff %+ SUFFIX
171 171
     add            r5d, eax
172 172
 
173 173
     cmp            r4d, 16
... ...
@@ -175,12 +173,12 @@ cglobal hadamard8_diff16_%1, 5, 6, %2
175 175
 
176 176
     lea             r1, [r1+r3*8-8]
177 177
     lea             r2, [r2+r3*8-8]
178
-    call hadamard8x8_diff_%1
178
+    call hadamard8x8_diff %+ SUFFIX
179 179
     add            r5d, eax
180 180
 
181 181
     add             r1, 8
182 182
     add             r2, 8
183
-    call hadamard8x8_diff_%1
183
+    call hadamard8x8_diff %+ SUFFIX
184 184
     add            r5d, eax
185 185
 
186 186
 .done:
... ...
@@ -191,7 +189,25 @@ cglobal hadamard8_diff16_%1, 5, 6, %2
191 191
     RET
192 192
 %endmacro
193 193
 
194
-%macro HADAMARD8_DIFF_MMX 1
194
+%macro HADAMARD8_DIFF 0-1
195
+%if cpuflag(sse2)
196
+hadamard8x8_diff %+ SUFFIX:
197
+    lea                          r0, [r3*3]
198
+    DIFF_PIXELS_8                r1, r2,  0, r3, r0, rsp+gprsize
199
+    HADAMARD8
200
+%if ARCH_X86_64
201
+    TRANSPOSE8x8W                 0,  1,  2,  3,  4,  5,  6,  7,  8
202
+%else
203
+    TRANSPOSE8x8W                 0,  1,  2,  3,  4,  5,  6,  7, [rsp+gprsize], [rsp+mmsize+gprsize]
204
+%endif
205
+    HADAMARD8
206
+    ABS_SUM_8x8         rsp+gprsize
207
+    HSUM                        m0, m1, eax
208
+    and                         eax, 0xFFFF
209
+    ret
210
+
211
+hadamard8_16_wrapper %1, 3
212
+%elif cpuflag(mmx)
195 213
 ALIGN 16
196 214
 ; int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2,
197 215
 ;                          int stride, int h)
... ...
@@ -199,7 +215,7 @@ ALIGN 16
199 199
 ; note how r1, r2 and r3 are not clobbered in this function, so 16x16
200 200
 ; can simply call this 2x2x (and that's why we access rsp+gprsize
201 201
 ; everywhere, which is rsp of calling func
202
-hadamard8x8_diff_%1:
202
+hadamard8x8_diff %+ SUFFIX:
203 203
     lea                          r0, [r3*3]
204 204
 
205 205
     ; first 4x8 pixels
... ...
@@ -236,53 +252,35 @@ hadamard8x8_diff_%1:
236 236
     and                         rax, 0xFFFF
237 237
     ret
238 238
 
239
-hadamard8_16_wrapper %1, 0, 14
240
-%endmacro
241
-
242
-%macro HADAMARD8_DIFF_SSE2 2
243
-hadamard8x8_diff_%1:
244
-    lea                          r0, [r3*3]
245
-    DIFF_PIXELS_8                r1, r2,  0, r3, r0, rsp+gprsize
246
-    HADAMARD8
247
-%if ARCH_X86_64
248
-    TRANSPOSE8x8W                 0,  1,  2,  3,  4,  5,  6,  7,  8
249
-%else
250
-    TRANSPOSE8x8W                 0,  1,  2,  3,  4,  5,  6,  7, [rsp+gprsize], [rsp+mmsize+gprsize]
239
+hadamard8_16_wrapper 0, 14
251 240
 %endif
252
-    HADAMARD8
253
-    ABS_SUM_8x8         rsp+gprsize
254
-    HSUM_SSE2                    m0, m1, eax
255
-    and                         eax, 0xFFFF
256
-    ret
257
-
258
-hadamard8_16_wrapper %1, %2, 3
259 241
 %endmacro
260 242
 
261
-INIT_MMX
243
+INIT_MMX mmx
262 244
 %define ABS1 ABS1_MMX
263
-%define HSUM HSUM_MMX
264
-HADAMARD8_DIFF_MMX mmx
245
+HADAMARD8_DIFF
265 246
 
247
+INIT_MMX mmxext
266 248
 %define ABS1 ABS1_MMXEXT
267
-%define HSUM HSUM_MMXEXT
268
-HADAMARD8_DIFF_MMX mmxext
249
+HADAMARD8_DIFF
269 250
 
270
-INIT_XMM
251
+INIT_XMM sse2
271 252
 %define ABS2 ABS2_MMXEXT
272 253
 %if ARCH_X86_64
273 254
 %define ABS_SUM_8x8 ABS_SUM_8x8_64
274 255
 %else
275 256
 %define ABS_SUM_8x8 ABS_SUM_8x8_32
276 257
 %endif
277
-HADAMARD8_DIFF_SSE2 sse2, 10
258
+HADAMARD8_DIFF 10
278 259
 
260
+INIT_XMM ssse3
279 261
 %define ABS2        ABS2_SSSE3
280 262
 %define ABS_SUM_8x8 ABS_SUM_8x8_64
281
-HADAMARD8_DIFF_SSE2 ssse3, 9
263
+HADAMARD8_DIFF 9
282 264
 
283
-INIT_XMM
265
+INIT_XMM sse2
284 266
 ; sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
285
-cglobal sse16_sse2, 5, 5, 8
267
+cglobal sse16, 5, 5, 8
286 268
     shr      r4d, 1
287 269
     pxor      m0, m0         ; mm0 = 0
288 270
     pxor      m7, m7         ; mm7 holds the sum
... ...
@@ -28,7 +28,7 @@
28 28
 #define AVFORMAT_AIFF_H
29 29
 
30 30
 #include "avformat.h"
31
-#include "riff.h"
31
+#include "internal.h"
32 32
 
33 33
 static const AVCodecTag ff_codec_aiff_tags[] = {
34 34
     { AV_CODEC_ID_PCM_S16BE,    MKTAG('N','O','N','E') },
... ...
@@ -31,7 +31,6 @@
31 31
 #include "internal.h"
32 32
 #include "avio_internal.h"
33 33
 #include "pcm.h"
34
-#include "riff.h"
35 34
 
36 35
 /* if we don't know the size in advance */
37 36
 #define AU_UNKNOWN_SIZE ((uint32_t)(~0))
... ...
@@ -27,7 +27,6 @@
27 27
 
28 28
 #include "avformat.h"
29 29
 #include "internal.h"
30
-#include "riff.h"
31 30
 #include "isom.h"
32 31
 #include "mov_chan.h"
33 32
 #include "libavutil/intreadwrite.h"
... ...
@@ -27,7 +27,6 @@
27 27
 #include "avformat.h"
28 28
 #include "internal.h"
29 29
 #include "gxf.h"
30
-#include "riff.h"
31 30
 #include "audiointerleave.h"
32 31
 
33 32
 #define GXF_AUDIO_PACKET_SIZE 65536
... ...
@@ -355,6 +355,10 @@ void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
355 355
 
356 356
 int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux);
357 357
 
358
+unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
359
+
360
+enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
361
+
358 362
 /**
359 363
  * Chooses a timebase for muxing the specified stream.
360 364
  *
... ...
@@ -26,7 +26,6 @@
26 26
 #include "avformat.h"
27 27
 #include "internal.h"
28 28
 #include "isom.h"
29
-#include "riff.h"
30 29
 #include "libavcodec/mpeg4audio.h"
31 30
 #include "libavcodec/mpegaudiodata.h"
32 31
 
... ...
@@ -23,7 +23,6 @@
23 23
 #include "libavcodec/bytestream.h"
24 24
 #include "avformat.h"
25 25
 #include "internal.h"
26
-#include "riff.h"
27 26
 
28 27
 #define LXF_MAX_PACKET_HEADER_SIZE 256
29 28
 #define LXF_HEADER_DATA_SIZE    120
... ...
@@ -23,7 +23,6 @@
23 23
 #include "libavutil/mathematics.h"
24 24
 #include "avformat.h"
25 25
 #include "internal.h"
26
-#include "riff.h"
27 26
 #include "libavutil/dict.h"
28 27
 #include "libavutil/intreadwrite.h"
29 28
 
... ...
@@ -149,6 +149,7 @@ const AVCodecTag ff_nut_video_tags[] = {
149 149
 static const AVCodecTag nut_audio_extra_tags[] = {
150 150
     { AV_CODEC_ID_PCM_ALAW,         MKTAG('A', 'L', 'A', 'W') },
151 151
     { AV_CODEC_ID_PCM_MULAW,        MKTAG('U', 'L', 'A', 'W') },
152
+    { AV_CODEC_ID_MP3,              MKTAG('M', 'P', '3', ' ') },
152 153
     { AV_CODEC_ID_NONE,             0                         }
153 154
 };
154 155
 
... ...
@@ -26,7 +26,7 @@
26 26
 //#include "libavutil/adler32.h"
27 27
 //#include "libavcodec/mpegaudio.h"
28 28
 #include "avformat.h"
29
-#include "riff.h"
29
+#include "internal.h"
30 30
 #include "metadata.h"
31 31
 
32 32
 #define      MAIN_STARTCODE (0x7A561F5F04ADULL + (((uint64_t)('N'<<8) + 'M')<<48))
... ...
@@ -28,6 +28,7 @@
28 28
 #include "libavutil/tree.h"
29 29
 #include "avio_internal.h"
30 30
 #include "nut.h"
31
+#include "riff.h"
31 32
 
32 33
 #define NUT_MAX_STREAMS 256    /* arbitrary sanity check value */
33 34
 
... ...
@@ -28,6 +28,7 @@
28 28
 #include "nut.h"
29 29
 #include "internal.h"
30 30
 #include "avio_internal.h"
31
+#include "riff.h"
31 32
 
32 33
 static int find_expected_header(AVCodecContext *c, int size, int key_frame,
33 34
                                 uint8_t out[64])
... ...
@@ -46,7 +46,6 @@
46 46
 #include "libavutil/des.h"
47 47
 #include "oma.h"
48 48
 #include "pcm.h"
49
-#include "riff.h"
50 49
 #include "id3v2.h"
51 50
 
52 51
 
... ...
@@ -389,7 +389,6 @@ const AVCodecTag ff_codec_wav_tags[] = {
389 389
     // for NuppelVideo (nuv.c)
390 390
     { AV_CODEC_ID_PCM_S16LE, MKTAG('R', 'A', 'W', 'A') },
391 391
     { AV_CODEC_ID_MP3,       MKTAG('L', 'A', 'M', 'E') },
392
-    { AV_CODEC_ID_MP3,       MKTAG('M', 'P', '3', ' ') },
393 392
     { AV_CODEC_ID_NONE,      0 },
394 393
 };
395 394
 
... ...
@@ -54,8 +54,6 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size);
54 54
 extern const AVCodecTag ff_codec_bmp_tags[];
55 55
 extern const AVCodecTag ff_codec_wav_tags[];
56 56
 
57
-unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
58
-enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
59 57
 void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale);
60 58
 
61 59
 typedef uint8_t ff_asf_guid[16];
... ...
@@ -26,7 +26,6 @@
26 26
 #include "libavutil/dict.h"
27 27
 #include "avformat.h"
28 28
 #include "internal.h"
29
-#include "riff.h"
30 29
 #include "rmsipr.h"
31 30
 #include "rm.h"
32 31
 
... ...
@@ -25,7 +25,6 @@
25 25
 #include "avformat.h"
26 26
 #include "internal.h"
27 27
 #include "pcm.h"
28
-#include "riff.h"
29 28
 #include "rso.h"
30 29
 
31 30
 static int rso_read_header(AVFormatContext *s)
... ...
@@ -26,7 +26,6 @@
26 26
 
27 27
 #include "avformat.h"
28 28
 #include "internal.h"
29
-#include "riff.h"
30 29
 #include "smjpeg.h"
31 30
 
32 31
 typedef struct SMJPEGMuxContext {
... ...
@@ -32,7 +32,7 @@
32 32
 #include "libavutil/fifo.h"
33 33
 #include "avformat.h"
34 34
 #include "avio.h"
35
-#include "riff.h"    /* for CodecTag */
35
+#include "internal.h"
36 36
 
37 37
 /* should have a generic way to indicate probable size */
38 38
 #define DUMMY_FILE_SIZE   (100 * 1024 * 1024)
... ...
@@ -23,7 +23,7 @@
23 23
 #define AVFORMAT_VOC_H
24 24
 
25 25
 #include "avformat.h"
26
-#include "riff.h"    /* for CodecTag */
26
+#include "internal.h"
27 27
 
28 28
 typedef struct voc_dec_context {
29 29
     int64_t remaining_size;
... ...
@@ -1,34 +1,34 @@
1
-FATE_VP3 += fate-vp31
1
+FATE_VP3-$(CONFIG_AVI_DEMUXER) += fate-vp31
2 2
 fate-vp31: CMD = framecrc -i $(SAMPLES)/vp3/vp31.avi
3 3
 
4
-FATE_VP3 += fate-vp3-coeff-level64
4
+FATE_VP3-$(CONFIG_MATROSKA_DEMUXER) += fate-vp3-coeff-level64
5 5
 fate-vp3-coeff-level64: CMD = framecrc -i $(SAMPLES)/vp3/coeff_level64.mkv
6 6
 
7
-FATE_SAMPLES_AVCONV += $(FATE_VP3)
8
-fate-vp3: $(FATE_VP3)
7
+FATE_SAMPLES_AVCONV-$(CONFIG_VP3_DECODER) += $(FATE_VP3-yes)
8
+fate-vp3: $(FATE_VP3-yes)
9 9
 
10
-FATE_SAMPLES_AVCONV += fate-vp5
10
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VP5) += fate-vp5
11 11
 fate-vp5: CMD = framecrc -i $(SAMPLES)/vp5/potter512-400-partial.avi -an
12 12
 
13
-FATE_VP6 += fate-vp60
13
+FATE_VP6-$(call DEMDEC, EA, VP6) += fate-vp60
14 14
 fate-vp60: CMD = framecrc -i $(SAMPLES)/ea-vp6/g36.vp6
15 15
 
16
-FATE_VP6 += fate-vp61
16
+FATE_VP6-$(call DEMDEC, EA, VP6) += fate-vp61
17 17
 fate-vp61: CMD = framecrc -i $(SAMPLES)/ea-vp6/MovieSkirmishGondor.vp6 -t 4
18 18
 
19
-FATE_VP6 += fate-vp6a
19
+FATE_VP6-$(call DEMDEC, FLV, VP6A) += fate-vp6a
20 20
 fate-vp6a: CMD = framecrc -i $(SAMPLES)/flash-vp6/300x180-Scr-f8-056alpha.flv
21 21
 
22
-FATE_VP6 += fate-vp6f
22
+FATE_VP6-$(call DEMDEC, FLV, VP6F) += fate-vp6f
23 23
 fate-vp6f: CMD = framecrc -i $(SAMPLES)/flash-vp6/clip1024.flv
24 24
 
25
-FATE_SAMPLES_AVCONV += $(FATE_VP6)
26
-fate-vp6: $(FATE_VP6)
25
+FATE_SAMPLES_AVCONV += $(FATE_VP6-yes)
26
+fate-vp6: $(FATE_VP6-yes)
27 27
 
28 28
 VP8_SUITE = 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017
29 29
 
30 30
 define FATE_VP8_SUITE
31
-FATE_VP8 += fate-vp8-test-vector$(2)-$(1)
31
+FATE_VP8-$(CONFIG_IVF_DEMUXER) += fate-vp8-test-vector$(2)-$(1)
32 32
 fate-vp8-test-vector$(2)-$(1): CMD = framemd5 $(3) -i $(SAMPLES)/vp8-test-vectors-r1/vp80-00-comprehensive-$(1).ivf
33 33
 fate-vp8-test-vector$(2)-$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-test-vector-$(1)
34 34
 endef
... ...
@@ -38,16 +38,16 @@ $(foreach N,$(VP8_SUITE),$(eval $(call FATE_VP8_SUITE,$(N),$(1),$(2))))
38 38
 
39 39
 # FIXME this file contains two frames with identical timestamps,
40 40
 # so ffmpeg drops one of them
41
-FATE_VP8 += fate-vp8-sign-bias$(1)
41
+FATE_VP8-$(CONFIG_IVF_DEMUXER) += fate-vp8-sign-bias$(1)
42 42
 fate-vp8-sign-bias$(1): CMD = framemd5 $(2) -i $(SAMPLES)/vp8/sintel-signbias.ivf
43 43
 fate-vp8-sign-bias$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-sign-bias
44 44
 
45
-FATE_VP8 += fate-vp8-size-change$(1)
45
+FATE_VP8-$(CONFIG_MATROSKA_DEMUXER) += fate-vp8-size-change$(1)
46 46
 fate-vp8-size-change$(1): CMD = framemd5 $(2) -flags +bitexact -i $(SAMPLES)/vp8/frame_size_change.webm -frames:v 30 -sws_flags bitexact+bilinear
47 47
 fate-vp8-size-change$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-size-change
48 48
 endef
49 49
 
50 50
 $(eval $(call FATE_VP8_FULL))
51 51
 $(eval $(call FATE_VP8_FULL,-emu-edge,-flags +emu_edge))
52
-FATE_SAMPLES_AVCONV += $(FATE_VP8)
53
-fate-vp8: $(FATE_VP8)
52
+FATE_SAMPLES_AVCONV-$(CONFIG_VP8_DECODER) += $(FATE_VP8-yes)
53
+fate-vp8: $(FATE_VP8-yes)
... ...
@@ -83,8 +83,10 @@ fate-wavpack-clipping: CMD = md5 -i $(SAMPLES)/wavpack/special/clipping.wv -f s1
83 83
 FATE_WAVPACK += fate-wavpack-falsestereo
84 84
 fate-wavpack-falsestereo: CMD = md5 -i $(SAMPLES)/wavpack/special/false_stereo.wv -f s16le
85 85
 
86
-FATE_WAVPACK += fate-wavpack-matroskamode
86
+FATE_WAVPACK-$(call DEMDEC, WV, WAVPACK) += $(FATE_WAVPACK)
87
+
88
+FATE_WAVPACK-$(call DEMDEC, MATROSKA, WAVPACK) += fate-wavpack-matroskamode
87 89
 fate-wavpack-matroskamode: CMD = md5 -i $(SAMPLES)/wavpack/special/matroska_mode.mka -f s16le
88 90
 
89
-FATE_SAMPLES_AVCONV-$(call DEMDEC, WV, WAVPACK) += $(FATE_WAVPACK)
90
-fate-wavpack: $(FATE_WAVPACK)
91
+FATE_SAMPLES_AVCONV += $(FATE_WAVPACK-yes)
92
+fate-wavpack: $(FATE_WAVPACK-yes)