Browse code

Merge remote-tracking branch 'qatar/master'

* qatar/master:
lavr: add x86-optimized functions for mixing 1-to-2 s16p with flt coeffs
lavr: add x86-optimized functions for mixing 1-to-2 fltp with flt coeffs
Add Dolby/DPLII downmix support to libavresample
vorbisdec: replace div/mod in loop with a counter
fate: vorbis: add 5.1 surround test
rtpenc: Allow requesting H264 RTP packetization mode 0
configure: Sort the library listings in the help text alphabetically
dwt: remove variable-length arrays
RTMPT protocol support
http: Properly handle chunked transfer-encoding for replies to post data
http: Fail reading if the connection has gone away
amr: Mark an array const
amr: More space cleanup
rtpenc: Fix memory leaks in the muxer open function

Conflicts:
Changelog
configure
doc/APIchanges
libavformat/version.h

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

Michael Niedermayer authored on 2012/06/19 03:05:32
Showing 33 changed files
... ...
@@ -9,6 +9,7 @@ version next:
9 9
 - setnsamples audio filter
10 10
 - atempo filter
11 11
 - ffprobe -show_data option
12
+- RTMPT protocol support
12 13
 
13 14
 
14 15
 version 0.11:
... ...
@@ -174,9 +174,6 @@ External library support:
174 174
   --enable-libass          enable libass subtitles rendering [no]
175 175
   --enable-libbluray       enable BluRay reading using libbluray [no]
176 176
   --enable-libcelt         enable CELT decoding via libcelt [no]
177
-  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
178
-  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
179
-  --enable-libopencv       enable video filtering via libopencv [no]
180 177
   --enable-libcdio         enable audio CD grabbing with libcdio
181 178
   --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
182 179
                            and libraw1394 [no]
... ...
@@ -187,6 +184,9 @@ External library support:
187 187
   --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
188 188
   --enable-libnut          enable NUT (de)muxing via libnut,
189 189
                            native (de)muxer exists [no]
190
+  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
191
+  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
192
+  --enable-libopencv       enable video filtering via libopencv [no]
190 193
   --enable-libopenjpeg     enable JPEG 2000 encoding/decoding via OpenJPEG [no]
191 194
   --enable-libpulse        enable Pulseaudio input via libpulse [no]
192 195
   --enable-librtmp         enable RTMP[E] support via librtmp [no]
... ...
@@ -1689,6 +1689,10 @@ mmsh_protocol_select="http_protocol"
1689 1689
 mmst_protocol_deps="network"
1690 1690
 rtmp_protocol_deps="!librtmp_protocol"
1691 1691
 rtmp_protocol_select="tcp_protocol"
1692
+rtmphttp_protocol_deps="!librtmp_protocol"
1693
+rtmphttp_protocol_select="http_protocol"
1694
+rtmpt_protocol_deps="!librtmp_protocol"
1695
+rtmpt_protocol_select="rtmphttp_protocol"
1692 1696
 rtp_protocol_select="udp_protocol"
1693 1697
 sctp_protocol_deps="network netinet_sctp_h"
1694 1698
 tcp_protocol_deps="network"
... ...
@@ -38,6 +38,9 @@ API changes, most recent first:
38 38
 2012-03-26 - a67d9cf - lavfi 2.66.100
39 39
   Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
40 40
 
41
+2012-xx-xx - xxxxxxx - lavr 0.0.3
42
+  Add a parameter to avresample_build_matrix() for Dolby/DPLII downmixing.
43
+
41 44
 2012-xx-xx - xxxxxxx - lavfi 2.23.0 - avfilter.h
42 45
   Add AVFilterContext.nb_inputs/outputs. Deprecate
43 46
   AVFilterContext.input/output_count.
... ...
@@ -273,6 +273,14 @@ For example to read with @command{ffplay} a multimedia resource named
273 273
 ffplay rtmp://myserver/vod/sample
274 274
 @end example
275 275
 
276
+@section rtmpt
277
+
278
+Real-Time Messaging Protocol tunneled through HTTP.
279
+
280
+The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
281
+for streaming multimedia content within HTTP requests to traverse
282
+firewalls.
283
+
276 284
 @section rtmp, rtmpe, rtmps, rtmpt, rtmpte
277 285
 
278 286
 Real-Time Messaging Protocol and its variants supported through
... ...
@@ -245,9 +245,8 @@ static av_always_inline void inv_liftS(IDWTELEM *dst, IDWTELEM *src,
245 245
 }
246 246
 #endif /* ! liftS */
247 247
 
248
-static void horizontal_decompose53i(DWTELEM *b, int width)
248
+static void horizontal_decompose53i(DWTELEM *b, DWTELEM *temp, int width)
249 249
 {
250
-    DWTELEM temp[width];
251 250
     const int width2 = width >> 1;
252 251
     int x;
253 252
     const int w2 = (width + 1) >> 1;
... ...
@@ -313,8 +312,8 @@ static void vertical_decompose53iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
313 313
         b1[i] += (b0[i] + b2[i] + 2) >> 2;
314 314
 }
315 315
 
316
-static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
317
-                                 int stride)
316
+static void spatial_decompose53i(DWTELEM *buffer, DWTELEM *temp,
317
+                                 int width, int height, int stride)
318 318
 {
319 319
     int y;
320 320
     DWTELEM *b0 = buffer + mirror(-2 - 1, height - 1) * stride;
... ...
@@ -325,9 +324,9 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
325 325
         DWTELEM *b3 = buffer + mirror(y + 2, height - 1) * stride;
326 326
 
327 327
         if (y + 1 < (unsigned)height)
328
-            horizontal_decompose53i(b2, width);
328
+            horizontal_decompose53i(b2, temp, width);
329 329
         if (y + 2 < (unsigned)height)
330
-            horizontal_decompose53i(b3, width);
330
+            horizontal_decompose53i(b3, temp, width);
331 331
 
332 332
         if (y + 1 < (unsigned)height)
333 333
             vertical_decompose53iH0(b1, b2, b3, width);
... ...
@@ -339,9 +338,8 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
339 339
     }
340 340
 }
341 341
 
342
-static void horizontal_decompose97i(DWTELEM *b, int width)
342
+static void horizontal_decompose97i(DWTELEM *b, DWTELEM *temp, int width)
343 343
 {
344
-    DWTELEM temp[width];
345 344
     const int w2 = (width + 1) >> 1;
346 345
 
347 346
     lift(temp + w2, b + 1, b,         1, 2, 2, width, W_AM, W_AO, W_AS, 1, 1);
... ...
@@ -391,8 +389,8 @@ static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
391 391
         b1[i] += (W_DM * (b0[i] + b2[i]) + W_DO) >> W_DS;
392 392
 }
393 393
 
394
-static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
395
-                                 int stride)
394
+static void spatial_decompose97i(DWTELEM *buffer, DWTELEM *temp,
395
+                                 int width, int height, int stride)
396 396
 {
397 397
     int y;
398 398
     DWTELEM *b0 = buffer + mirror(-4 - 1, height - 1) * stride;
... ...
@@ -405,9 +403,9 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
405 405
         DWTELEM *b5 = buffer + mirror(y + 4, height - 1) * stride;
406 406
 
407 407
         if (y + 3 < (unsigned)height)
408
-            horizontal_decompose97i(b4, width);
408
+            horizontal_decompose97i(b4, temp, width);
409 409
         if (y + 4 < (unsigned)height)
410
-            horizontal_decompose97i(b5, width);
410
+            horizontal_decompose97i(b5, temp, width);
411 411
 
412 412
         if (y + 3 < (unsigned)height)
413 413
             vertical_decompose97iH0(b3, b4, b5, width);
... ...
@@ -425,20 +423,20 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
425 425
     }
426 426
 }
427 427
 
428
-void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride,
429
-                    int type, int decomposition_count)
428
+void ff_spatial_dwt(DWTELEM *buffer, DWTELEM *temp, int width, int height,
429
+                    int stride, int type, int decomposition_count)
430 430
 {
431 431
     int level;
432 432
 
433 433
     for (level = 0; level < decomposition_count; level++) {
434 434
         switch (type) {
435 435
         case DWT_97:
436
-            spatial_decompose97i(buffer,
436
+            spatial_decompose97i(buffer, temp,
437 437
                                  width >> level, height >> level,
438 438
                                  stride << level);
439 439
             break;
440 440
         case DWT_53:
441
-            spatial_decompose53i(buffer,
441
+            spatial_decompose53i(buffer, temp,
442 442
                                  width >> level, height >> level,
443 443
                                  stride << level);
444 444
             break;
... ...
@@ -446,9 +444,8 @@ void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride,
446 446
     }
447 447
 }
448 448
 
449
-static void horizontal_compose53i(IDWTELEM *b, int width)
449
+static void horizontal_compose53i(IDWTELEM *b, IDWTELEM *temp, int width)
450 450
 {
451
-    IDWTELEM temp[width];
452 451
     const int width2 = width >> 1;
453 452
     const int w2     = (width + 1) >> 1;
454 453
     int x;
... ...
@@ -508,6 +505,7 @@ static void spatial_compose53i_init(DWTCompose *cs, IDWTELEM *buffer,
508 508
 }
509 509
 
510 510
 static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer *sb,
511
+                                           IDWTELEM *temp,
511 512
                                            int width, int height,
512 513
                                            int stride_line)
513 514
 {
... ...
@@ -537,17 +535,18 @@ static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer *sb,
537 537
     }
538 538
 
539 539
     if (y - 1 < (unsigned)height)
540
-        horizontal_compose53i(b0, width);
540
+        horizontal_compose53i(b0, temp, width);
541 541
     if (y + 0 < (unsigned)height)
542
-        horizontal_compose53i(b1, width);
542
+        horizontal_compose53i(b1, temp, width);
543 543
 
544 544
     cs->b0  = b2;
545 545
     cs->b1  = b3;
546 546
     cs->y  += 2;
547 547
 }
548 548
 
549
-static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
550
-                                  int height, int stride)
549
+static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer,
550
+                                  IDWTELEM *temp, int width, int height,
551
+                                  int stride)
551 552
 {
552 553
     int y        = cs->y;
553 554
     IDWTELEM *b0 = cs->b0;
... ...
@@ -561,27 +560,26 @@ static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
561 561
         vertical_compose53iH0(b0, b1, b2, width);
562 562
 
563 563
     if (y - 1 < (unsigned)height)
564
-        horizontal_compose53i(b0, width);
564
+        horizontal_compose53i(b0, temp, width);
565 565
     if (y + 0 < (unsigned)height)
566
-        horizontal_compose53i(b1, width);
566
+        horizontal_compose53i(b1, temp, width);
567 567
 
568 568
     cs->b0  = b2;
569 569
     cs->b1  = b3;
570 570
     cs->y  += 2;
571 571
 }
572 572
 
573
-static void av_unused spatial_compose53i(IDWTELEM *buffer, int width,
574
-                                         int height, int stride)
573
+static void av_unused spatial_compose53i(IDWTELEM *buffer, IDWTELEM *temp,
574
+                                         int width, int height, int stride)
575 575
 {
576 576
     DWTCompose cs;
577 577
     spatial_compose53i_init(&cs, buffer, height, stride);
578 578
     while (cs.y <= height)
579
-        spatial_compose53i_dy(&cs, buffer, width, height, stride);
579
+        spatial_compose53i_dy(&cs, buffer, temp, width, height, stride);
580 580
 }
581 581
 
582
-void ff_snow_horizontal_compose97i(IDWTELEM *b, int width)
582
+void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
583 583
 {
584
-    IDWTELEM temp[width];
585 584
     const int w2 = (width + 1) >> 1;
586 585
 
587 586
 #if 0 //maybe more understadable but slower
... ...
@@ -695,8 +693,9 @@ static void spatial_compose97i_init(DWTCompose *cs, IDWTELEM *buffer, int height
695 695
 }
696 696
 
697 697
 static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
698
-                                           slice_buffer *sb, int width,
699
-                                           int height, int stride_line)
698
+                                           slice_buffer * sb, IDWTELEM *temp,
699
+                                           int width, int height,
700
+                                           int stride_line)
700 701
 {
701 702
     int y = cs->y;
702 703
 
... ...
@@ -725,9 +724,9 @@ static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
725 725
     }
726 726
 
727 727
     if (y - 1 < (unsigned)height)
728
-        dsp->horizontal_compose97i(b0, width);
728
+        dsp->horizontal_compose97i(b0, temp, width);
729 729
     if (y + 0 < (unsigned)height)
730
-        dsp->horizontal_compose97i(b1, width);
730
+        dsp->horizontal_compose97i(b1, temp, width);
731 731
 
732 732
     cs->b0  = b2;
733 733
     cs->b1  = b3;
... ...
@@ -736,8 +735,9 @@ static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
736 736
     cs->y  += 2;
737 737
 }
738 738
 
739
-static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
740
-                                  int height, int stride)
739
+static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer,
740
+                                  IDWTELEM *temp, int width, int height,
741
+                                  int stride)
741 742
 {
742 743
     int y        = cs->y;
743 744
     IDWTELEM *b0 = cs->b0;
... ...
@@ -757,9 +757,9 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
757 757
         vertical_compose97iH0(b0, b1, b2, width);
758 758
 
759 759
     if (y - 1 < (unsigned)height)
760
-        ff_snow_horizontal_compose97i(b0, width);
760
+        ff_snow_horizontal_compose97i(b0, temp, width);
761 761
     if (y + 0 < (unsigned)height)
762
-        ff_snow_horizontal_compose97i(b1, width);
762
+        ff_snow_horizontal_compose97i(b1, temp, width);
763 763
 
764 764
     cs->b0  = b2;
765 765
     cs->b1  = b3;
... ...
@@ -768,13 +768,13 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
768 768
     cs->y  += 2;
769 769
 }
770 770
 
771
-static void av_unused spatial_compose97i(IDWTELEM *buffer, int width,
772
-                                         int height, int stride)
771
+static void av_unused spatial_compose97i(IDWTELEM *buffer, IDWTELEM *temp,
772
+                                         int width, int height, int stride)
773 773
 {
774 774
     DWTCompose cs;
775 775
     spatial_compose97i_init(&cs, buffer, height, stride);
776 776
     while (cs.y <= height)
777
-        spatial_compose97i_dy(&cs, buffer, width, height, stride);
777
+        spatial_compose97i_dy(&cs, buffer, temp, width, height, stride);
778 778
 }
779 779
 
780 780
 void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
... ...
@@ -797,9 +797,9 @@ void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
797 797
 }
798 798
 
799 799
 void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
800
-                                    slice_buffer *slice_buf, int width,
801
-                                    int height, int stride_line, int type,
802
-                                    int decomposition_count, int y)
800
+                                    slice_buffer *slice_buf, IDWTELEM *temp,
801
+                                    int width, int height, int stride_line,
802
+                                    int type, int decomposition_count, int y)
803 803
 {
804 804
     const int support = type == 1 ? 3 : 5;
805 805
     int level;
... ...
@@ -810,13 +810,13 @@ void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
810 810
         while (cs[level].y <= FFMIN((y >> level) + support, height >> level)) {
811 811
             switch (type) {
812 812
             case DWT_97:
813
-                spatial_compose97i_dy_buffered(dsp, cs + level, slice_buf,
813
+                spatial_compose97i_dy_buffered(dsp, cs + level, slice_buf, temp,
814 814
                                                width >> level,
815 815
                                                height >> level,
816 816
                                                stride_line << level);
817 817
                 break;
818 818
             case DWT_53:
819
-                spatial_compose53i_dy_buffered(cs + level, slice_buf,
819
+                spatial_compose53i_dy_buffered(cs + level, slice_buf, temp,
820 820
                                                width >> level,
821 821
                                                height >> level,
822 822
                                                stride_line << level);
... ...
@@ -844,8 +844,9 @@ static void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width,
844 844
     }
845 845
 }
846 846
 
847
-static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width,
848
-                                  int height, int stride, int type,
847
+static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer,
848
+                                  IDWTELEM *temp, int width, int height,
849
+                                  int stride, int type,
849 850
                                   int decomposition_count, int y)
850 851
 {
851 852
     const int support = type == 1 ? 3 : 5;
... ...
@@ -857,26 +858,26 @@ static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width,
857 857
         while (cs[level].y <= FFMIN((y >> level) + support, height >> level)) {
858 858
             switch (type) {
859 859
             case DWT_97:
860
-                spatial_compose97i_dy(cs + level, buffer, width >> level,
860
+                spatial_compose97i_dy(cs + level, buffer, temp, width >> level,
861 861
                                       height >> level, stride << level);
862 862
                 break;
863 863
             case DWT_53:
864
-                spatial_compose53i_dy(cs + level, buffer, width >> level,
864
+                spatial_compose53i_dy(cs + level, buffer, temp, width >> level,
865 865
                                       height >> level, stride << level);
866 866
                 break;
867 867
             }
868 868
         }
869 869
 }
870 870
 
871
-void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride,
872
-                     int type, int decomposition_count)
871
+void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height,
872
+                     int stride, int type, int decomposition_count)
873 873
 {
874 874
     DWTCompose cs[MAX_DECOMPOSITIONS];
875 875
     int y;
876 876
     ff_spatial_idwt_init(cs, buffer, width, height, stride, type,
877 877
                          decomposition_count);
878 878
     for (y = 0; y < height; y += 4)
879
-        ff_spatial_idwt_slice(cs, buffer, width, height, stride, type,
879
+        ff_spatial_idwt_slice(cs, buffer, temp, width, height, stride, type,
880 880
                               decomposition_count, y);
881 881
 }
882 882
 
... ...
@@ -885,7 +886,7 @@ static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
885 885
 {
886 886
     int s, i, j;
887 887
     const int dec_count = w == 8 ? 3 : 4;
888
-    int tmp[32 * 32];
888
+    int tmp[32 * 32], tmp2[32];
889 889
     int level, ori;
890 890
     static const int scale[2][2][4][4] = {
891 891
         {
... ...
@@ -927,7 +928,7 @@ static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
927 927
         pix2 += line_size;
928 928
     }
929 929
 
930
-    ff_spatial_dwt(tmp, w, h, 32, type, dec_count);
930
+    ff_spatial_dwt(tmp, tmp2, w, h, 32, type, dec_count);
931 931
 
932 932
     s = 0;
933 933
     assert(w == h);
... ...
@@ -79,7 +79,7 @@ typedef struct DWTContext {
79 79
     void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
80 80
                                 IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
81 81
                                 int width);
82
-    void (*horizontal_compose97i)(IDWTELEM *b, int width);
82
+    void (*horizontal_compose97i)(IDWTELEM *b, IDWTELEM *temp, int width);
83 83
     void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride,
84 84
                              uint8_t **block, int b_w, int b_h, int src_x,
85 85
                              int src_y, int src_stride, slice_buffer *sb,
... ...
@@ -239,7 +239,7 @@ IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line);
239 239
 void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
240 240
                                  IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
241 241
                                  int width);
242
-void ff_snow_horizontal_compose97i(IDWTELEM *b, int width);
242
+void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width);
243 243
 void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
244 244
                               uint8_t **block, int b_w, int b_h, int src_x,
245 245
                               int src_y, int src_stride, slice_buffer *sb,
... ...
@@ -248,18 +248,18 @@ void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
248 248
 int ff_w53_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
249 249
 int ff_w97_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
250 250
 
251
-void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type,
252
-                    int decomposition_count);
251
+void ff_spatial_dwt(int *buffer, int *temp, int width, int height, int stride,
252
+                    int type, int decomposition_count);
253 253
 
254 254
 void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
255 255
                                    int height, int stride_line, int type,
256 256
                                    int decomposition_count);
257 257
 void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
258
-                                    slice_buffer *slice_buf, int width,
259
-                                    int height, int stride_line, int type,
260
-                                    int decomposition_count, int y);
261
-void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride,
262
-                     int type, int decomposition_count);
258
+                                    slice_buffer *slice_buf, IDWTELEM *temp,
259
+                                    int width, int height, int stride_line,
260
+                                    int type, int decomposition_count, int y);
261
+void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height,
262
+                     int stride, int type, int decomposition_count);
263 263
 
264 264
 void ff_dwt_init(DWTContext *c);
265 265
 void ff_dwt_init_x86(DWTContext *c);
... ...
@@ -440,6 +440,8 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
440 440
 
441 441
     s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM));
442 442
     s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this does not belong here
443
+    s->temp_dwt_buffer = av_mallocz(width * sizeof(DWTELEM));
444
+    s->temp_idwt_buffer = av_mallocz(width * sizeof(IDWTELEM));
443 445
 
444 446
     for(i=0; i<MAX_REF_FRAMES; i++)
445 447
         for(j=0; j<MAX_REF_FRAMES; j++)
... ...
@@ -618,7 +620,9 @@ av_cold void ff_snow_common_end(SnowContext *s)
618 618
     int plane_index, level, orientation, i;
619 619
 
620 620
     av_freep(&s->spatial_dwt_buffer);
621
+    av_freep(&s->temp_dwt_buffer);
621 622
     av_freep(&s->spatial_idwt_buffer);
623
+    av_freep(&s->temp_idwt_buffer);
622 624
 
623 625
     s->m.me.temp= NULL;
624 626
     av_freep(&s->m.me.scratchpad);
... ...
@@ -132,7 +132,9 @@ typedef struct SnowContext{
132 132
     int16_t (*ref_mvs[MAX_REF_FRAMES])[2];
133 133
     uint32_t *ref_scores[MAX_REF_FRAMES];
134 134
     DWTELEM *spatial_dwt_buffer;
135
+    DWTELEM *temp_dwt_buffer;
135 136
     IDWTELEM *spatial_idwt_buffer;
137
+    IDWTELEM *temp_idwt_buffer;
136 138
     int colorspace_type;
137 139
     int chroma_h_shift;
138 140
     int chroma_v_shift;
... ...
@@ -502,7 +502,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
502 502
             }
503 503
 
504 504
             for(; yd<slice_h; yd+=4){
505
-                ff_spatial_idwt_buffered_slice(&s->dwt, cs, &s->sb, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);
505
+                ff_spatial_idwt_buffered_slice(&s->dwt, cs, &s->sb, s->temp_idwt_buffer, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);
506 506
             }
507 507
 
508 508
             if(s->qlog == LOSSLESS_QLOG){
... ...
@@ -94,7 +94,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
94 94
     //FIXME pass the copy cleanly ?
95 95
 
96 96
 //    memcpy(dwt_buffer, buffer, height * stride * sizeof(DWTELEM));
97
-    ff_spatial_dwt(buffer, width, height, stride, type, s->spatial_decomposition_count);
97
+    ff_spatial_dwt(buffer, s->temp_dwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
98 98
 
99 99
     for(level=0; level<s->spatial_decomposition_count; level++){
100 100
         for(orientation=level ? 1 : 0; orientation<4; orientation++){
... ...
@@ -119,7 +119,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
119 119
                     for(xs= 0; xs<Q2_STEP; xs++){
120 120
                         memcpy(idwt2_buffer, best_dequant, height * stride * sizeof(IDWTELEM));
121 121
                         dequantize_all(s, p, idwt2_buffer, width, height);
122
-                        ff_spatial_idwt(idwt2_buffer, width, height, stride, type, s->spatial_decomposition_count);
122
+                        ff_spatial_idwt(idwt2_buffer, s->temp_idwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
123 123
                         find_sse(s, p, best_score, score_stride, idwt2_buffer, s->spatial_idwt_buffer, level, orientation);
124 124
                         memcpy(idwt2_buffer, best_dequant, height * stride * sizeof(IDWTELEM));
125 125
                         for(y=ys; y<b->height; y+= Q2_STEP){
... ...
@@ -130,7 +130,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
130 130
                             }
131 131
                         }
132 132
                         dequantize_all(s, p, idwt2_buffer, width, height);
133
-                        ff_spatial_idwt(idwt2_buffer, width, height, stride, type, s->spatial_decomposition_count);
133
+                        ff_spatial_idwt(idwt2_buffer, s->temp_idwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
134 134
                         find_sse(s, p, score, score_stride, idwt2_buffer, s->spatial_idwt_buffer, level, orientation);
135 135
                         for(y=ys; y<b->height; y+= Q2_STEP){
136 136
                             for(x=xs; x<b->width; x+= Q2_STEP){
... ...
@@ -1588,7 +1588,7 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
1588 1588
 
1589 1589
             memset(s->spatial_idwt_buffer, 0, sizeof(*s->spatial_idwt_buffer)*width*height);
1590 1590
             ibuf[b->width/2 + b->height/2*b->stride]= 256*16;
1591
-            ff_spatial_idwt(s->spatial_idwt_buffer, width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count);
1591
+            ff_spatial_idwt(s->spatial_idwt_buffer, s->temp_idwt_buffer, width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count);
1592 1592
             for(y=0; y<height; y++){
1593 1593
                 for(x=0; x<width; x++){
1594 1594
                     int64_t d= s->spatial_idwt_buffer[x + y*width]*16;
... ...
@@ -1778,7 +1778,7 @@ redo_frame:
1778 1778
             /*  if(QUANTIZE2)
1779 1779
                 dwt_quantize(s, p, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type);
1780 1780
             else*/
1781
-                ff_spatial_dwt(s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
1781
+                ff_spatial_dwt(s->spatial_dwt_buffer, s->temp_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
1782 1782
 
1783 1783
             if(s->pass1_rc && plane_index==0){
1784 1784
                 int delta_qlog = ratecontrol_1pass(s, pic);
... ...
@@ -1818,7 +1818,7 @@ redo_frame:
1818 1818
                 }
1819 1819
             }
1820 1820
 
1821
-            ff_spatial_idwt(s->spatial_idwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
1821
+            ff_spatial_idwt(s->spatial_idwt_buffer, s->temp_idwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
1822 1822
             if(s->qlog == LOSSLESS_QLOG){
1823 1823
                 for(y=0; y<h; y++){
1824 1824
                     for(x=0; x<w; x++){
... ...
@@ -1413,17 +1413,24 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
1413 1413
                                 }
1414 1414
 
1415 1415
                             } else if (vr_type == 2) {
1416
-                                voffs = voffset;
1416
+                                unsigned voffs_div = FASTDIV(voffset, ch);
1417
+                                unsigned voffs_mod = voffset - voffs_div * ch;
1417 1418
 
1418 1419
                                 for (k = 0; k < step; ++k) {
1419 1420
                                     coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
1420
-                                    for (l = 0; l < dim; ++l, ++voffs) {
1421
-                                        vec[voffs / ch + (voffs % ch) * vlen] += codebook.codevectors[coffs + l];  // FPMATH FIXME use if and counter instead of / and %
1421
+                                    for (l = 0; l < dim; ++l) {
1422
+                                        vec[voffs_div + voffs_mod * vlen] +=
1423
+                                            codebook.codevectors[coffs + l];
1422 1424
 
1423 1425
                                         av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n",
1424
-                                                pass, voffset / ch + (voffs % ch) * vlen,
1425
-                                                vec[voffset / ch + (voffs % ch) * vlen],
1426
+                                                pass, voffs_div + voffs_mod * vlen,
1427
+                                                vec[voffs_div + voffs_mod * vlen],
1426 1428
                                                 codebook.codevectors[coffs + l], coffs, l);
1429
+
1430
+                                        if (++voffs_mod == ch) {
1431
+                                            voffs_div++;
1432
+                                            voffs_mod = 0;
1433
+                                        }
1427 1434
                                     }
1428 1435
                                 }
1429 1436
                             }
... ...
@@ -26,9 +26,8 @@
26 26
 #include "libavcodec/dwt.h"
27 27
 #include "dsputil_mmx.h"
28 28
 
29
-static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
29
+static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, IDWTELEM *temp, int width){
30 30
     const int w2= (width+1)>>1;
31
-    DECLARE_ALIGNED(16, IDWTELEM, temp)[width>>1];
32 31
     const int w_l= (width>>1);
33 32
     const int w_r= w2 - 1;
34 33
     int i;
... ...
@@ -215,9 +214,8 @@ static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
215 215
     }
216 216
 }
217 217
 
218
-static void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, int width){
218
+static void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, IDWTELEM *temp, int width){
219 219
     const int w2= (width+1)>>1;
220
-    IDWTELEM temp[width >> 1];
221 220
     const int w_l= (width>>1);
222 221
     const int w_r= w2 - 1;
223 222
     int i;
... ...
@@ -373,6 +373,8 @@ OBJS-$(CONFIG_MMST_PROTOCOL)             += mmst.o mms.o asf.o
373 373
 OBJS-$(CONFIG_MD5_PROTOCOL)              += md5proto.o
374 374
 OBJS-$(CONFIG_PIPE_PROTOCOL)             += file.o
375 375
 OBJS-$(CONFIG_RTMP_PROTOCOL)             += rtmpproto.o rtmppkt.o
376
+OBJS-$(CONFIG_RTMPHTTP_PROTOCOL)         += rtmphttp.o
377
+OBJS-$(CONFIG_RTMPT_PROTOCOL)            += rtmpproto.o rtmppkt.o
376 378
 OBJS-$(CONFIG_RTP_PROTOCOL)              += rtpproto.o
377 379
 OBJS-$(CONFIG_SCTP_PROTOCOL)             += sctp.o
378 380
 OBJS-$(CONFIG_TCP_PROTOCOL)              += tcp.o
... ...
@@ -277,6 +277,8 @@ void av_register_all(void)
277 277
     REGISTER_PROTOCOL (MD5,  md5);
278 278
     REGISTER_PROTOCOL (PIPE, pipe);
279 279
     REGISTER_PROTOCOL (RTMP, rtmp);
280
+    REGISTER_PROTOCOL (RTMPHTTP, rtmphttp);
281
+    REGISTER_PROTOCOL (RTMPT, rtmpt);
280 282
     REGISTER_PROTOCOL (RTP, rtp);
281 283
     REGISTER_PROTOCOL (SCTP, sctp);
282 284
     REGISTER_PROTOCOL (TCP, tcp);
... ...
@@ -124,8 +124,8 @@ static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
124 124
         };
125 125
 
126 126
         size = packed_size[mode] + 1;
127
-    } else if(enc->codec_id == CODEC_ID_AMR_WB) {
128
-        static uint8_t packed_size[16] = {
127
+    } else if (enc->codec_id == CODEC_ID_AMR_WB) {
128
+        static const uint8_t packed_size[16] = {
129 129
             18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1
130 130
         };
131 131
 
... ...
@@ -352,6 +352,8 @@ static int http_read_header(URLContext *h, int *new_location)
352 352
     char line[1024];
353 353
     int err = 0;
354 354
 
355
+    s->chunksize = -1;
356
+
355 357
     for (;;) {
356 358
         if ((err = http_get_line(s, line, sizeof(line))) < 0)
357 359
             return err;
... ...
@@ -470,7 +472,6 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
470 470
         s->http_code = 200;
471 471
         return 0;
472 472
     }
473
-    s->chunksize = -1;
474 473
 
475 474
     /* wait for header */
476 475
     err = http_read_header(h, new_location);
... ...
@@ -510,14 +511,13 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
510 510
     HTTPContext *s = h->priv_data;
511 511
     int err, new_location;
512 512
 
513
-    if (s->end_chunked_post) {
514
-        if (!s->end_header) {
515
-            err = http_read_header(h, &new_location);
516
-            if (err < 0)
517
-                return err;
518
-        }
513
+    if (!s->hd)
514
+        return AVERROR_EOF;
519 515
 
520
-        return http_buf_read(h, buf, size);
516
+    if (s->end_chunked_post && !s->end_header) {
517
+        err = http_read_header(h, &new_location);
518
+        if (err < 0)
519
+            return err;
521 520
     }
522 521
 
523 522
     if (s->chunksize >= 0) {
524 523
new file mode 100644
... ...
@@ -0,0 +1,239 @@
0
+/*
1
+ * RTMP HTTP network protocol
2
+ * Copyright (c) 2012 Samuel Pitoiset
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+/**
22
+ * @file
23
+ * RTMP HTTP protocol
24
+ */
25
+
26
+#include "libavutil/avstring.h"
27
+#include "libavutil/intfloat.h"
28
+#include "libavutil/opt.h"
29
+#include "internal.h"
30
+#include "http.h"
31
+
32
+#define RTMPT_DEFAULT_PORT 80
33
+
34
+/* protocol handler context */
35
+typedef struct RTMP_HTTPContext {
36
+    URLContext   *stream;           ///< HTTP stream
37
+    char         host[256];         ///< hostname of the server
38
+    int          port;              ///< port to connect (default is 80)
39
+    char         client_id[64];     ///< client ID used for all requests except the first one
40
+    int          seq;               ///< sequence ID used for all requests
41
+    uint8_t      *out_data;         ///< output buffer
42
+    int          out_size;          ///< current output buffer size
43
+    int          out_capacity;      ///< current output buffer capacity
44
+    int          initialized;       ///< flag indicating when the http context is initialized
45
+    int          finishing;         ///< flag indicating when the client closes the connection
46
+} RTMP_HTTPContext;
47
+
48
+static int rtmp_http_send_cmd(URLContext *h, const char *cmd)
49
+{
50
+    RTMP_HTTPContext *rt = h->priv_data;
51
+    char uri[2048];
52
+    uint8_t c;
53
+    int ret;
54
+
55
+    ff_url_join(uri, sizeof(uri), "http", NULL, rt->host, rt->port,
56
+                "/%s/%s/%d", cmd, rt->client_id, rt->seq++);
57
+
58
+    av_opt_set_bin(rt->stream->priv_data, "post_data", rt->out_data,
59
+                   rt->out_size, 0);
60
+
61
+    /* send a new request to the server */
62
+    if ((ret = ff_http_do_new_request(rt->stream, uri)) < 0)
63
+        return ret;
64
+
65
+    /* re-init output buffer */
66
+    rt->out_size = 0;
67
+
68
+    /* read the first byte which contains the polling interval */
69
+    if ((ret = ffurl_read(rt->stream, &c, 1)) < 0)
70
+        return ret;
71
+
72
+    return ret;
73
+}
74
+
75
+static int rtmp_http_write(URLContext *h, const uint8_t *buf, int size)
76
+{
77
+    RTMP_HTTPContext *rt = h->priv_data;
78
+    void *ptr;
79
+
80
+    if (rt->out_size + size > rt->out_capacity) {
81
+        rt->out_capacity = (rt->out_size + size) * 2;
82
+        ptr = av_realloc(rt->out_data, rt->out_capacity);
83
+        if (!ptr)
84
+            return AVERROR(ENOMEM);
85
+        rt->out_data = ptr;
86
+    }
87
+
88
+    memcpy(rt->out_data + rt->out_size, buf, size);
89
+    rt->out_size += size;
90
+
91
+    return size;
92
+}
93
+
94
+static int rtmp_http_read(URLContext *h, uint8_t *buf, int size)
95
+{
96
+    RTMP_HTTPContext *rt = h->priv_data;
97
+    int ret, off = 0;
98
+
99
+    /* try to read at least 1 byte of data */
100
+    do {
101
+        ret = ffurl_read(rt->stream, buf + off, size);
102
+        if (ret < 0 && ret != AVERROR_EOF)
103
+            return ret;
104
+
105
+        if (ret == AVERROR_EOF) {
106
+            if (rt->finishing) {
107
+                /* Do not send new requests when the client wants to
108
+                 * close the connection. */
109
+                return AVERROR(EAGAIN);
110
+            }
111
+
112
+            /* When the client has reached end of file for the last request,
113
+             * we have to send a new request if we have buffered data.
114
+             * Otherwise, we have to send an idle POST. */
115
+            if (rt->out_size > 0) {
116
+                if ((ret = rtmp_http_send_cmd(h, "send")) < 0)
117
+                    return ret;
118
+            } else {
119
+                if ((ret = rtmp_http_write(h, "", 1)) < 0)
120
+                    return ret;
121
+
122
+                if ((ret = rtmp_http_send_cmd(h, "idle")) < 0)
123
+                    return ret;
124
+            }
125
+
126
+            if (h->flags & AVIO_FLAG_NONBLOCK) {
127
+                /* no incoming data to handle in nonblocking mode */
128
+                return AVERROR(EAGAIN);
129
+            }
130
+        } else {
131
+            off  += ret;
132
+            size -= ret;
133
+        }
134
+    } while (off <= 0);
135
+
136
+    return off;
137
+}
138
+
139
+static int rtmp_http_close(URLContext *h)
140
+{
141
+    RTMP_HTTPContext *rt = h->priv_data;
142
+    uint8_t tmp_buf[2048];
143
+    int ret = 0;
144
+
145
+    if (rt->initialized) {
146
+        /* client wants to close the connection */
147
+        rt->finishing = 1;
148
+
149
+        do {
150
+            ret = rtmp_http_read(h, tmp_buf, sizeof(tmp_buf));
151
+        } while (ret > 0);
152
+
153
+        /* re-init output buffer before sending the close command */
154
+        rt->out_size = 0;
155
+
156
+        if ((ret = rtmp_http_write(h, "", 1)) == 1)
157
+            ret = rtmp_http_send_cmd(h, "close");
158
+    }
159
+
160
+    av_freep(&rt->out_data);
161
+    ffurl_close(rt->stream);
162
+
163
+    return ret;
164
+}
165
+
166
+static int rtmp_http_open(URLContext *h, const char *uri, int flags)
167
+{
168
+    RTMP_HTTPContext *rt = h->priv_data;
169
+    char headers[1024], url[1024];
170
+    int ret, off = 0;
171
+
172
+    av_url_split(NULL, 0, NULL, 0, rt->host, sizeof(rt->host), &rt->port,
173
+                 NULL, 0, uri);
174
+
175
+    if (rt->port < 0)
176
+        rt->port = RTMPT_DEFAULT_PORT;
177
+
178
+    /* This is the first request that is sent to the server in order to
179
+     * register a client on the server and start a new session. The server
180
+     * replies with a unique id (usually a number) that is used by the client
181
+     * for all future requests.
182
+     * Note: the reply doesn't contain a value for the polling interval.
183
+     * A successful connect resets the consecutive index that is used
184
+     * in the URLs. */
185
+    ff_url_join(url, sizeof(url), "http", NULL, rt->host, rt->port, "/open/1");
186
+
187
+    /* alloc the http context */
188
+    if ((ret = ffurl_alloc(&rt->stream, url, AVIO_FLAG_READ_WRITE, NULL)) < 0)
189
+        goto fail;
190
+
191
+    /* set options */
192
+    snprintf(headers, sizeof(headers),
193
+             "Cache-Control: no-cache\r\n"
194
+             "Content-type: application/x-fcs\r\n"
195
+             "User-Agent: Shockwave Flash\r\n");
196
+    av_opt_set(rt->stream->priv_data, "headers", headers, 0);
197
+    av_opt_set(rt->stream->priv_data, "multiple_requests", "1", 0);
198
+    av_opt_set_bin(rt->stream->priv_data, "post_data", "", 1, 0);
199
+
200
+    /* open the http context */
201
+    if ((ret = ffurl_connect(rt->stream, NULL)) < 0)
202
+        goto fail;
203
+
204
+    /* read the server reply which contains a unique ID */
205
+    for (;;) {
206
+        ret = ffurl_read(rt->stream, rt->client_id + off, sizeof(rt->client_id) - off);
207
+        if (ret == AVERROR_EOF)
208
+            break;
209
+        if (ret < 0)
210
+            goto fail;
211
+        off += ret;
212
+        if (off == sizeof(rt->client_id)) {
213
+            ret = AVERROR(EIO);
214
+            goto fail;
215
+        }
216
+    }
217
+    while (off > 0 && isspace(rt->client_id[off - 1]))
218
+        off--;
219
+    rt->client_id[off] = '\0';
220
+
221
+    /* http context is now initialized */
222
+    rt->initialized = 1;
223
+    return 0;
224
+
225
+fail:
226
+    rtmp_http_close(h);
227
+    return ret;
228
+}
229
+
230
+URLProtocol ff_rtmphttp_protocol = {
231
+    .name           = "rtmphttp",
232
+    .url_open       = rtmp_http_open,
233
+    .url_read       = rtmp_http_read,
234
+    .url_write      = rtmp_http_write,
235
+    .url_close      = rtmp_http_close,
236
+    .priv_data_size = sizeof(RTMP_HTTPContext),
237
+    .flags          = URL_PROTOCOL_FLAG_NETWORK,
238
+};
... ...
@@ -1112,9 +1112,15 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
1112 1112
     av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
1113 1113
                  path, sizeof(path), s->filename);
1114 1114
 
1115
-    if (port < 0)
1116
-        port = RTMP_DEFAULT_PORT;
1117
-    ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
1115
+    if (!strcmp(proto, "rtmpt")) {
1116
+        /* open the http tunneling connection */
1117
+        ff_url_join(buf, sizeof(buf), "rtmphttp", NULL, hostname, port, NULL);
1118
+    } else {
1119
+        /* open the tcp connection */
1120
+        if (port < 0)
1121
+            port = RTMP_DEFAULT_PORT;
1122
+        ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
1123
+    }
1118 1124
 
1119 1125
     if ((ret = ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE,
1120 1126
                           &s->interrupt_callback, NULL)) < 0) {
... ...
@@ -1425,3 +1431,21 @@ URLProtocol ff_rtmp_protocol = {
1425 1425
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
1426 1426
     .priv_data_class= &rtmp_class,
1427 1427
 };
1428
+
1429
+static const AVClass rtmpt_class = {
1430
+    .class_name = "rtmpt",
1431
+    .item_name  = av_default_item_name,
1432
+    .option     = rtmp_options,
1433
+    .version    = LIBAVUTIL_VERSION_INT,
1434
+};
1435
+
1436
+URLProtocol ff_rtmpt_protocol = {
1437
+    .name            = "rtmpt",
1438
+    .url_open        = rtmp_open,
1439
+    .url_read        = rtmp_read,
1440
+    .url_write       = rtmp_write,
1441
+    .url_close       = rtmp_close,
1442
+    .priv_data_size  = sizeof(RTMPContext),
1443
+    .flags           = URL_PROTOCOL_FLAG_NETWORK,
1444
+    .priv_data_class = &rtmpt_class,
1445
+};
... ...
@@ -198,11 +198,11 @@ static int rtp_write_header(AVFormatContext *s1)
198 198
         /* max_header_toc_size + the largest AMR payload must fit */
199 199
         if (1 + s->max_frames_per_packet + n > s->max_payload_size) {
200 200
             av_log(s1, AV_LOG_ERROR, "RTP max payload size too small for AMR\n");
201
-            return -1;
201
+            goto fail;
202 202
         }
203 203
         if (st->codec->channels != 1) {
204 204
             av_log(s1, AV_LOG_ERROR, "Only mono is supported\n");
205
-            return -1;
205
+            goto fail;
206 206
         }
207 207
     case CODEC_ID_AAC:
208 208
         s->num_frames = 0;
... ...
@@ -216,6 +216,10 @@ defaultcase:
216 216
     }
217 217
 
218 218
     return 0;
219
+
220
+fail:
221
+    av_freep(&s->buf);
222
+    return AVERROR(EINVAL);
219 223
 }
220 224
 
221 225
 /* send an rtcp sender report packet */
... ...
@@ -66,12 +66,14 @@ typedef struct RTPMuxContext RTPMuxContext;
66 66
 #define FF_RTP_FLAG_MP4A_LATM 1
67 67
 #define FF_RTP_FLAG_RFC2190   2
68 68
 #define FF_RTP_FLAG_SKIP_RTCP 4
69
+#define FF_RTP_FLAG_H264_MODE0 8
69 70
 
70 71
 #define FF_RTP_FLAG_OPTS(ctx, fieldname) \
71 72
     { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), AV_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
72 73
     { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
73 74
     { "rfc2190", "Use RFC 2190 packetization instead of RFC 4629 for H.263", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_RFC2190}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
74 75
     { "skip_rtcp", "Don't send RTCP sender reports", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_SKIP_RTCP}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
76
+    { "h264_mode0", "Use mode 0 for H264 in RTP", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_H264_MODE0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
75 77
 
76 78
 void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
77 79
 
... ...
@@ -55,6 +55,12 @@ static void nal_send(AVFormatContext *s1, const uint8_t *buf, int size, int last
55 55
         uint8_t type = buf[0] & 0x1F;
56 56
         uint8_t nri = buf[0] & 0x60;
57 57
 
58
+        if (s->flags & FF_RTP_FLAG_H264_MODE0) {
59
+            av_log(s1, AV_LOG_ERROR,
60
+                   "NAL size %d > %d, try -slice-max-size %d\n", size,
61
+                   s->max_payload_size, s->max_payload_size);
62
+            return;
63
+        }
58 64
         av_log(s1, AV_LOG_DEBUG, "NAL size %d > %d\n", size, s->max_payload_size);
59 65
         s->buf[0] = 28;        /* FU Indicator; Type = 28 ---> FU-A */
60 66
         s->buf[0] |= nri;
... ...
@@ -388,15 +388,20 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
388 388
     char *config = NULL;
389 389
 
390 390
     switch (c->codec_id) {
391
-        case CODEC_ID_H264:
391
+        case CODEC_ID_H264: {
392
+            int mode = 1;
393
+            if (fmt && fmt->oformat->priv_class &&
394
+                av_opt_flag_is_set(fmt->priv_data, "rtpflags", "h264_mode0"))
395
+                mode = 0;
392 396
             if (c->extradata_size) {
393 397
                 config = extradata2psets(c);
394 398
             }
395 399
             av_strlcatf(buff, size, "a=rtpmap:%d H264/90000\r\n"
396
-                                    "a=fmtp:%d packetization-mode=1%s\r\n",
400
+                                    "a=fmtp:%d packetization-mode=%d%s\r\n",
397 401
                                      payload_type,
398
-                                     payload_type, config ? config : "");
402
+                                     payload_type, mode, config ? config : "");
399 403
             break;
404
+        }
400 405
         case CODEC_ID_H263:
401 406
         case CODEC_ID_H263P:
402 407
             /* a=framesize is required by 3GPP TS 26.234 (PSS). It
... ...
@@ -30,7 +30,7 @@
30 30
 #include "libavutil/avutil.h"
31 31
 
32 32
 #define LIBAVFORMAT_VERSION_MAJOR 54
33
-#define LIBAVFORMAT_VERSION_MINOR  7
33
+#define LIBAVFORMAT_VERSION_MINOR  8
34 34
 #define LIBAVFORMAT_VERSION_MICRO 100
35 35
 
36 36
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
... ...
@@ -320,7 +320,8 @@ int ff_audio_mix_init(AVAudioResampleContext *avr)
320 320
                                       avr->center_mix_level,
321 321
                                       avr->surround_mix_level,
322 322
                                       avr->lfe_mix_level, 1, matrix_dbl,
323
-                                      avr->in_channels);
323
+                                      avr->in_channels,
324
+                                      avr->matrix_encoding);
324 325
         if (ret < 0) {
325 326
             av_free(matrix_dbl);
326 327
             return ret;
... ...
@@ -54,6 +54,8 @@
54 54
 #define SURROUND_DIRECT_LEFT   33
55 55
 #define SURROUND_DIRECT_RIGHT  34
56 56
 
57
+#define SQRT3_2      1.22474487139158904909  /* sqrt(3/2) */
58
+
57 59
 static av_always_inline int even(uint64_t layout)
58 60
 {
59 61
     return (!layout || (layout & (layout - 1)));
... ...
@@ -83,14 +85,21 @@ static int sane_layout(uint64_t layout)
83 83
 int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
84 84
                             double center_mix_level, double surround_mix_level,
85 85
                             double lfe_mix_level, int normalize,
86
-                            double *matrix_out, int stride)
86
+                            double *matrix_out, int stride,
87
+                            enum AVMatrixEncoding matrix_encoding)
87 88
 {
88 89
     int i, j, out_i, out_j;
89 90
     double matrix[64][64] = {{0}};
90
-    int64_t unaccounted = in_layout & ~out_layout;
91
+    int64_t unaccounted;
91 92
     double maxcoef = 0;
92 93
     int in_channels, out_channels;
93 94
 
95
+    if ((out_layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == AV_CH_LAYOUT_STEREO_DOWNMIX) {
96
+        out_layout = AV_CH_LAYOUT_STEREO;
97
+    }
98
+
99
+    unaccounted = in_layout & ~out_layout;
100
+
94 101
     in_channels  = av_get_channel_layout_nb_channels( in_layout);
95 102
     out_channels = av_get_channel_layout_nb_channels(out_layout);
96 103
 
... ...
@@ -140,8 +149,19 @@ int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
140 140
             matrix[SIDE_LEFT ][BACK_CENTER] += M_SQRT1_2;
141 141
             matrix[SIDE_RIGHT][BACK_CENTER] += M_SQRT1_2;
142 142
         } else if (out_layout & AV_CH_FRONT_LEFT) {
143
-            matrix[FRONT_LEFT ][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
144
-            matrix[FRONT_RIGHT][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
143
+            if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY ||
144
+                matrix_encoding == AV_MATRIX_ENCODING_DPLII) {
145
+                if (unaccounted & (AV_CH_BACK_LEFT | AV_CH_SIDE_LEFT)) {
146
+                    matrix[FRONT_LEFT ][BACK_CENTER] -= surround_mix_level * M_SQRT1_2;
147
+                    matrix[FRONT_RIGHT][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
148
+                } else {
149
+                    matrix[FRONT_LEFT ][BACK_CENTER] -= surround_mix_level;
150
+                    matrix[FRONT_RIGHT][BACK_CENTER] += surround_mix_level;
151
+                }
152
+            } else {
153
+                matrix[FRONT_LEFT ][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
154
+                matrix[FRONT_RIGHT][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
155
+            }
145 156
         } else if (out_layout & AV_CH_FRONT_CENTER) {
146 157
             matrix[FRONT_CENTER][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
147 158
         } else
... ...
@@ -163,8 +183,20 @@ int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
163 163
                 matrix[SIDE_RIGHT][BACK_RIGHT] += 1.0;
164 164
             }
165 165
         } else if (out_layout & AV_CH_FRONT_LEFT) {
166
-            matrix[FRONT_LEFT ][BACK_LEFT ] += surround_mix_level;
167
-            matrix[FRONT_RIGHT][BACK_RIGHT] += surround_mix_level;
166
+            if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY) {
167
+                matrix[FRONT_LEFT ][BACK_LEFT ] -= surround_mix_level * M_SQRT1_2;
168
+                matrix[FRONT_LEFT ][BACK_RIGHT] -= surround_mix_level * M_SQRT1_2;
169
+                matrix[FRONT_RIGHT][BACK_LEFT ] += surround_mix_level * M_SQRT1_2;
170
+                matrix[FRONT_RIGHT][BACK_RIGHT] += surround_mix_level * M_SQRT1_2;
171
+            } else if (matrix_encoding == AV_MATRIX_ENCODING_DPLII) {
172
+                matrix[FRONT_LEFT ][BACK_LEFT ] -= surround_mix_level * SQRT3_2;
173
+                matrix[FRONT_LEFT ][BACK_RIGHT] -= surround_mix_level * M_SQRT1_2;
174
+                matrix[FRONT_RIGHT][BACK_LEFT ] += surround_mix_level * M_SQRT1_2;
175
+                matrix[FRONT_RIGHT][BACK_RIGHT] += surround_mix_level * SQRT3_2;
176
+            } else {
177
+                matrix[FRONT_LEFT ][BACK_LEFT ] += surround_mix_level;
178
+                matrix[FRONT_RIGHT][BACK_RIGHT] += surround_mix_level;
179
+            }
168 180
         } else if (out_layout & AV_CH_FRONT_CENTER) {
169 181
             matrix[FRONT_CENTER][BACK_LEFT ] += surround_mix_level * M_SQRT1_2;
170 182
             matrix[FRONT_CENTER][BACK_RIGHT] += surround_mix_level * M_SQRT1_2;
... ...
@@ -187,8 +219,20 @@ int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
187 187
             matrix[BACK_CENTER][SIDE_LEFT ] += M_SQRT1_2;
188 188
             matrix[BACK_CENTER][SIDE_RIGHT] += M_SQRT1_2;
189 189
         } else if (out_layout & AV_CH_FRONT_LEFT) {
190
-            matrix[FRONT_LEFT ][SIDE_LEFT ] += surround_mix_level;
191
-            matrix[FRONT_RIGHT][SIDE_RIGHT] += surround_mix_level;
190
+            if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY) {
191
+                matrix[FRONT_LEFT ][SIDE_LEFT ] -= surround_mix_level * M_SQRT1_2;
192
+                matrix[FRONT_LEFT ][SIDE_RIGHT] -= surround_mix_level * M_SQRT1_2;
193
+                matrix[FRONT_RIGHT][SIDE_LEFT ] += surround_mix_level * M_SQRT1_2;
194
+                matrix[FRONT_RIGHT][SIDE_RIGHT] += surround_mix_level * M_SQRT1_2;
195
+            } else if (matrix_encoding == AV_MATRIX_ENCODING_DPLII) {
196
+                matrix[FRONT_LEFT ][SIDE_LEFT ] -= surround_mix_level * SQRT3_2;
197
+                matrix[FRONT_LEFT ][SIDE_RIGHT] -= surround_mix_level * M_SQRT1_2;
198
+                matrix[FRONT_RIGHT][SIDE_LEFT ] += surround_mix_level * M_SQRT1_2;
199
+                matrix[FRONT_RIGHT][SIDE_RIGHT] += surround_mix_level * SQRT3_2;
200
+            } else {
201
+                matrix[FRONT_LEFT ][SIDE_LEFT ] += surround_mix_level;
202
+                matrix[FRONT_RIGHT][SIDE_RIGHT] += surround_mix_level;
203
+            }
192 204
         } else if (out_layout & AV_CH_FRONT_CENTER) {
193 205
             matrix[FRONT_CENTER][SIDE_LEFT ] += surround_mix_level * M_SQRT1_2;
194 206
             matrix[FRONT_CENTER][SIDE_RIGHT] += surround_mix_level * M_SQRT1_2;
... ...
@@ -131,12 +131,13 @@ void avresample_free(AVAudioResampleContext **avr);
131 131
  *                            the weight of input channel i in output channel o.
132 132
  * @param stride              distance between adjacent input channels in the
133 133
  *                            matrix array
134
+ * @param matrix_encoding     matrixed stereo downmix mode (e.g. dplii)
134 135
  * @return                    0 on success, negative AVERROR code on failure
135 136
  */
136 137
 int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
137 138
                             double center_mix_level, double surround_mix_level,
138 139
                             double lfe_mix_level, int normalize, double *matrix,
139
-                            int stride);
140
+                            int stride, enum AVMatrixEncoding matrix_encoding);
140 141
 
141 142
 /**
142 143
  * Get the current channel mixing matrix.
... ...
@@ -70,6 +70,7 @@ struct AVAudioResampleContext {
70 70
     AudioConvert *ac_out;       /**< output sample format conversion context */
71 71
     ResampleContext *resample;  /**< resampling context                      */
72 72
     AudioMix *am;               /**< channel mixing context                  */
73
+    enum AVMatrixEncoding matrix_encoding;      /**< matrixed stereo encoding */
73 74
 };
74 75
 
75 76
 #endif /* AVRESAMPLE_INTERNAL_H */
... ...
@@ -52,6 +52,10 @@ static const AVOption options[] = {
52 52
     { "phase_shift",            "Resampling Phase Shift",   OFFSET(phase_shift),            AV_OPT_TYPE_INT,    { 10                    }, 0,                    30, /* ??? */           PARAM },
53 53
     { "linear_interp",          "Use Linear Interpolation", OFFSET(linear_interp),          AV_OPT_TYPE_INT,    { 0                     }, 0,                    1,                      PARAM },
54 54
     { "cutoff",                 "Cutoff Frequency Ratio",   OFFSET(cutoff),                 AV_OPT_TYPE_DOUBLE, { 0.8                   }, 0.0,                  1.0,                    PARAM },
55
+    { "matrix_encoding",        "Matrixed Stereo Encoding", OFFSET(matrix_encoding),        AV_OPT_TYPE_INT,    { AV_MATRIX_ENCODING_NONE}, AV_MATRIX_ENCODING_NONE,     AV_MATRIX_ENCODING_NB-1, PARAM, "matrix_encoding" },
56
+        { "none",  "None",               0, AV_OPT_TYPE_CONST, { AV_MATRIX_ENCODING_NONE  }, INT_MIN, INT_MAX, PARAM, "matrix_encoding" },
57
+        { "dolby", "Dolby",              0, AV_OPT_TYPE_CONST, { AV_MATRIX_ENCODING_DOLBY }, INT_MIN, INT_MAX, PARAM, "matrix_encoding" },
58
+        { "dplii", "Dolby Pro Logic II", 0, AV_OPT_TYPE_CONST, { AV_MATRIX_ENCODING_DPLII }, INT_MIN, INT_MAX, PARAM, "matrix_encoding" },
55 59
     { NULL },
56 60
 };
57 61
 
... ...
@@ -21,7 +21,7 @@
21 21
 
22 22
 #define LIBAVRESAMPLE_VERSION_MAJOR  0
23 23
 #define LIBAVRESAMPLE_VERSION_MINOR  0
24
-#define LIBAVRESAMPLE_VERSION_MICRO  2
24
+#define LIBAVRESAMPLE_VERSION_MICRO  3
25 25
 
26 26
 #define LIBAVRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \
27 27
                                                   LIBAVRESAMPLE_VERSION_MINOR, \
... ...
@@ -150,3 +150,84 @@ cglobal mix_2_to_1_s16p_q8, 3,4,6, src, matrix, len, src1
150 150
     sub        lend, mmsize/2
151 151
     jg .loop
152 152
     REP_RET
153
+
154
+;-----------------------------------------------------------------------------
155
+; void ff_mix_1_to_2_fltp_flt(float **src, float **matrix, int len,
156
+;                             int out_ch, int in_ch);
157
+;-----------------------------------------------------------------------------
158
+
159
+%macro MIX_1_TO_2_FLTP_FLT 0
160
+cglobal mix_1_to_2_fltp_flt, 3,5,4, src0, matrix0, len, src1, matrix1
161
+    mov       src1q, [src0q+gprsize]
162
+    mov       src0q, [src0q]
163
+    sub       src1q, src0q
164
+    mov    matrix1q, [matrix0q+gprsize]
165
+    mov    matrix0q, [matrix0q]
166
+    VBROADCASTSS m2, [matrix0q]
167
+    VBROADCASTSS m3, [matrix1q]
168
+    ALIGN 16
169
+.loop:
170
+    mova         m0, [src0q]
171
+    mulps        m1, m0, m3
172
+    mulps        m0, m0, m2
173
+    mova  [src0q      ], m0
174
+    mova  [src0q+src1q], m1
175
+    add       src0q, mmsize
176
+    sub        lend, mmsize/4
177
+    jg .loop
178
+    REP_RET
179
+%endmacro
180
+
181
+INIT_XMM sse
182
+MIX_1_TO_2_FLTP_FLT
183
+%if HAVE_AVX
184
+INIT_YMM avx
185
+MIX_1_TO_2_FLTP_FLT
186
+%endif
187
+
188
+;-----------------------------------------------------------------------------
189
+; void ff_mix_1_to_2_s16p_flt(int16_t **src, float **matrix, int len,
190
+;                             int out_ch, int in_ch);
191
+;-----------------------------------------------------------------------------
192
+
193
+%macro MIX_1_TO_2_S16P_FLT 0
194
+cglobal mix_1_to_2_s16p_flt, 3,5,6, src0, matrix0, len, src1, matrix1
195
+    mov       src1q, [src0q+gprsize]
196
+    mov       src0q, [src0q]
197
+    sub       src1q, src0q
198
+    mov    matrix1q, [matrix0q+gprsize]
199
+    mov    matrix0q, [matrix0q]
200
+    VBROADCASTSS m4, [matrix0q]
201
+    VBROADCASTSS m5, [matrix1q]
202
+    ALIGN 16
203
+.loop:
204
+    mova         m0, [src0q]
205
+    S16_TO_S32_SX 0, 2
206
+    cvtdq2ps     m0, m0
207
+    cvtdq2ps     m2, m2
208
+    mulps        m1, m0, m5
209
+    mulps        m0, m0, m4
210
+    mulps        m3, m2, m5
211
+    mulps        m2, m2, m4
212
+    cvtps2dq     m0, m0
213
+    cvtps2dq     m1, m1
214
+    cvtps2dq     m2, m2
215
+    cvtps2dq     m3, m3
216
+    packssdw     m0, m2
217
+    packssdw     m1, m3
218
+    mova  [src0q      ], m0
219
+    mova  [src0q+src1q], m1
220
+    add       src0q, mmsize
221
+    sub        lend, mmsize/2
222
+    jg .loop
223
+    REP_RET
224
+%endmacro
225
+
226
+INIT_XMM sse2
227
+MIX_1_TO_2_S16P_FLT
228
+INIT_XMM sse4
229
+MIX_1_TO_2_S16P_FLT
230
+%if HAVE_AVX
231
+INIT_XMM avx
232
+MIX_1_TO_2_S16P_FLT
233
+%endif
... ...
@@ -35,6 +35,18 @@ extern void ff_mix_2_to_1_s16p_flt_sse4(int16_t **src, float **matrix, int len,
35 35
 extern void ff_mix_2_to_1_s16p_q8_sse2(int16_t **src, int16_t **matrix,
36 36
                                        int len, int out_ch, int in_ch);
37 37
 
38
+extern void ff_mix_1_to_2_fltp_flt_sse(float **src, float **matrix, int len,
39
+                                       int out_ch, int in_ch);
40
+extern void ff_mix_1_to_2_fltp_flt_avx(float **src, float **matrix, int len,
41
+                                       int out_ch, int in_ch);
42
+
43
+extern void ff_mix_1_to_2_s16p_flt_sse2(int16_t **src, float **matrix, int len,
44
+                                        int out_ch, int in_ch);
45
+extern void ff_mix_1_to_2_s16p_flt_sse4(int16_t **src, float **matrix, int len,
46
+                                        int out_ch, int in_ch);
47
+extern void ff_mix_1_to_2_s16p_flt_avx (int16_t **src, float **matrix, int len,
48
+                                        int out_ch, int in_ch);
49
+
38 50
 av_cold void ff_audio_mix_init_x86(AudioMix *am)
39 51
 {
40 52
 #if HAVE_YASM
... ...
@@ -43,20 +55,30 @@ av_cold void ff_audio_mix_init_x86(AudioMix *am)
43 43
     if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
44 44
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
45 45
                               2, 1, 16, 8, "SSE", ff_mix_2_to_1_fltp_flt_sse);
46
+        ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
47
+                              1, 2, 16, 4, "SSE", ff_mix_1_to_2_fltp_flt_sse);
46 48
     }
47 49
     if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) {
48 50
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
49 51
                               2, 1, 16, 8, "SSE2", ff_mix_2_to_1_s16p_flt_sse2);
50 52
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q8,
51 53
                               2, 1, 16, 8, "SSE2", ff_mix_2_to_1_s16p_q8_sse2);
54
+        ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
55
+                              1, 2, 16, 8, "SSE2", ff_mix_1_to_2_s16p_flt_sse2);
52 56
     }
53 57
     if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) {
54 58
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
55 59
                               2, 1, 16, 8, "SSE4", ff_mix_2_to_1_s16p_flt_sse4);
60
+        ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
61
+                              1, 2, 16, 8, "SSE4", ff_mix_1_to_2_s16p_flt_sse4);
56 62
     }
57 63
     if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) {
58 64
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
59 65
                               2, 1, 32, 16, "AVX", ff_mix_2_to_1_fltp_flt_avx);
66
+        ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
67
+                              1, 2, 32, 8, "AVX", ff_mix_1_to_2_fltp_flt_avx);
68
+        ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
69
+                              1, 2, 16, 8, "AVX", ff_mix_1_to_2_s16p_flt_avx);
60 70
     }
61 71
 #endif
62 72
 }
... ...
@@ -101,6 +101,13 @@
101 101
 #define AV_CH_LAYOUT_OCTAGONAL         (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
102 102
 #define AV_CH_LAYOUT_STEREO_DOWNMIX    (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
103 103
 
104
+enum AVMatrixEncoding {
105
+    AV_MATRIX_ENCODING_NONE,
106
+    AV_MATRIX_ENCODING_DOLBY,
107
+    AV_MATRIX_ENCODING_DPLII,
108
+    AV_MATRIX_ENCODING_NB
109
+};
110
+
104 111
 /**
105 112
  * @}
106 113
  */
... ...
@@ -76,6 +76,10 @@ FATE_VORBIS += fate-vorbis-19
76 76
 fate-vorbis-19: CMD = pcm -i $(SAMPLES)/vorbis/test-short2_small.ogg
77 77
 fate-vorbis-19: REF = $(SAMPLES)/vorbis/test-short2_small.pcm
78 78
 
79
+FATE_VORBIS += fate-vorbis-20
80
+fate-vorbis-20: CMD = pcm -i $(SAMPLES)/vorbis/6.ogg
81
+fate-vorbis-20: REF = $(SAMPLES)/vorbis/6.pcm
82
+
79 83
 FATE_SAMPLES_AVCONV += $(FATE_VORBIS)
80 84
 fate-vorbis: $(FATE_VORBIS)
81 85
 $(FATE_VORBIS): CMP = oneoff