aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer2011-12-02 00:51:11 +0100
committerMichael Niedermayer2011-12-02 00:51:11 +0100
commit7b0b10ce4186eaa1cd3c0a2bfbb86307d65eecfd (patch)
treea9a937af698ca14ef06ec2c07453f474aa5ca3c7
parent8b08f81949bcfa6fec42ff3f1c9bef5be8140300 (diff)
parent04403ec2e405a3cfcfbdd45f1274be30c652e462 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (25 commits) rtpenc: Add support for G726 audio rtpdec: Interpret the different G726 names as bits_per_coded_sample rtpenc: Change rtp_send_samples to handle sample sizes other than even bytes rtpenc: Cast a rescaling parameter to int64_t h264: cap max has_b_frames at MAX_DELAYED_PIC_COUNT - 1. ARM: fix indentation in ff_dsputil_init_neon() ARM: NEON put/avg_pixels8/16 cosmetics ARM: add remaining NEON avg_pixels8/16 functions ARM: clean up NEON put/avg_pixels macros fate: split acodec-pcm into individual tests swscale: #include "libavutil/mathematics.h" pmpdec: don't use deprecated av_set_pts_info. rv34: align temporary block of "dct" coefs Add PlayStation Portable PMP format demuxer proto: Realign struct initializers proto: Use .priv_data_size to allocate the private context mmsh: Properly clean up if the second ffurl_alloc failed rtmp: Clean up properly if the handshake failed md5proto: Remove the get_file_handle function applehttpproto: Use the close function if the open function fails ... Conflicts: libavcodec/vble.c libavformat/mmsh.c libavformat/pmpdec.c libavformat/udp.c tests/ref/acodec/pcm Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--Changelog1
-rw-r--r--libavcodec/arm/dsputil_init_neon.c77
-rw-r--r--libavcodec/arm/dsputil_neon.S317
-rw-r--r--libavcodec/h264.c2
-rw-r--r--libavcodec/rv34.c4
-rw-r--r--libavformat/applehttpproto.c40
-rw-r--r--libavformat/cache.c11
-rw-r--r--libavformat/concat.c20
-rw-r--r--libavformat/gopher.c20
-rw-r--r--libavformat/http.c2
-rw-r--r--libavformat/librtmp.c24
-rw-r--r--libavformat/md5proto.c5
-rw-r--r--libavformat/mmsh.c23
-rw-r--r--libavformat/mmst.c15
-rw-r--r--libavformat/pmpdec.c19
-rw-r--r--libavformat/rtmpproto.c20
-rw-r--r--libavformat/rtpdec_g726.c6
-rw-r--r--libavformat/rtpenc.c28
-rw-r--r--libavformat/rtpproto.c10
-rw-r--r--libavformat/sdp.c8
-rw-r--r--libavformat/tcp.c10
-rw-r--r--libavformat/udp.c10
-rw-r--r--libswscale/utils.c1
-rwxr-xr-xtests/codec-regression.sh50
-rw-r--r--tests/ref/acodec/pcm68
-rw-r--r--tests/ref/acodec/pcm_alaw4
-rw-r--r--tests/ref/acodec/pcm_f32be4
-rw-r--r--tests/ref/acodec/pcm_f32le4
-rw-r--r--tests/ref/acodec/pcm_f64be4
-rw-r--r--tests/ref/acodec/pcm_f64le4
-rw-r--r--tests/ref/acodec/pcm_mulaw4
-rw-r--r--tests/ref/acodec/pcm_s16be4
-rw-r--r--tests/ref/acodec/pcm_s16le4
-rw-r--r--tests/ref/acodec/pcm_s24be4
-rw-r--r--tests/ref/acodec/pcm_s24daud4
-rw-r--r--tests/ref/acodec/pcm_s24le4
-rw-r--r--tests/ref/acodec/pcm_s32be4
-rw-r--r--tests/ref/acodec/pcm_s32le4
-rw-r--r--tests/ref/acodec/pcm_s84
-rw-r--r--tests/ref/acodec/pcm_u84
-rw-r--r--tests/ref/seek/pcm_s16be_mkv53
-rw-r--r--tests/ref/seek/pcm_s16le_mkv53
42 files changed, 466 insertions, 491 deletions
diff --git a/Changelog b/Changelog
index e64dca688b..3b12e2ae97 100644
--- a/Changelog
+++ b/Changelog
@@ -126,6 +126,7 @@ easier to use. The changes are:
- IFF Amiga Continuous Bitmap (ACBM) decoder
- ass filter
- CRI ADX audio format demuxer
+- Playstation Portable PMP format demuxer
version 0.8:
diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c
index ddc9d640f8..3f4dcdad5c 100644
--- a/libavcodec/arm/dsputil_init_neon.c
+++ b/libavcodec/arm/dsputil_init_neon.c
@@ -53,7 +53,19 @@ void ff_put_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
void ff_put_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
void ff_avg_pixels16_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels16_x2_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels16_y2_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels16_xy2_neon(uint8_t *, const uint8_t *, int, int);
void ff_avg_pixels8_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels8_x2_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels8_y2_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels8_xy2_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels8_x2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
+void ff_avg_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
void ff_add_pixels_clamped_neon(const DCTELEM *, uint8_t *, int);
void ff_put_pixels_clamped_neon(const DCTELEM *, uint8_t *, int);
@@ -189,37 +201,51 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
}
if (!high_bit_depth) {
- c->clear_block = ff_clear_block_neon;
- c->clear_blocks = ff_clear_blocks_neon;
-
- c->put_pixels_tab[0][0] = ff_put_pixels16_neon;
- c->put_pixels_tab[0][1] = ff_put_pixels16_x2_neon;
- c->put_pixels_tab[0][2] = ff_put_pixels16_y2_neon;
- c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_neon;
- c->put_pixels_tab[1][0] = ff_put_pixels8_neon;
- c->put_pixels_tab[1][1] = ff_put_pixels8_x2_neon;
- c->put_pixels_tab[1][2] = ff_put_pixels8_y2_neon;
- c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_neon;
-
- c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_neon;
- c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_neon;
- c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_neon;
- c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_neon;
- c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_neon;
- c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_neon;
- c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_neon;
- c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_neon;
-
- c->avg_pixels_tab[0][0] = ff_avg_pixels16_neon;
- c->avg_pixels_tab[1][0] = ff_avg_pixels8_neon;
+ c->clear_block = ff_clear_block_neon;
+ c->clear_blocks = ff_clear_blocks_neon;
+
+ c->put_pixels_tab[0][0] = ff_put_pixels16_neon;
+ c->put_pixels_tab[0][1] = ff_put_pixels16_x2_neon;
+ c->put_pixels_tab[0][2] = ff_put_pixels16_y2_neon;
+ c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_neon;
+ c->put_pixels_tab[1][0] = ff_put_pixels8_neon;
+ c->put_pixels_tab[1][1] = ff_put_pixels8_x2_neon;
+ c->put_pixels_tab[1][2] = ff_put_pixels8_y2_neon;
+ c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_neon;
+
+ c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_neon;
+ c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_neon;
+ c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_neon;
+ c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_neon;
+ c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_neon;
+ c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_neon;
+ c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_neon;
+ c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_neon;
+
+ c->avg_pixels_tab[0][0] = ff_avg_pixels16_neon;
+ c->avg_pixels_tab[0][1] = ff_avg_pixels16_x2_neon;
+ c->avg_pixels_tab[0][2] = ff_avg_pixels16_y2_neon;
+ c->avg_pixels_tab[0][3] = ff_avg_pixels16_xy2_neon;
+ c->avg_pixels_tab[1][0] = ff_avg_pixels8_neon;
+ c->avg_pixels_tab[1][1] = ff_avg_pixels8_x2_neon;
+ c->avg_pixels_tab[1][2] = ff_avg_pixels8_y2_neon;
+ c->avg_pixels_tab[1][3] = ff_avg_pixels8_xy2_neon;
+
+ c->avg_no_rnd_pixels_tab[0][0] = ff_avg_pixels16_neon;
+ c->avg_no_rnd_pixels_tab[0][1] = ff_avg_pixels16_x2_no_rnd_neon;
+ c->avg_no_rnd_pixels_tab[0][2] = ff_avg_pixels16_y2_no_rnd_neon;
+ c->avg_no_rnd_pixels_tab[0][3] = ff_avg_pixels16_xy2_no_rnd_neon;
+ c->avg_no_rnd_pixels_tab[1][0] = ff_avg_pixels8_neon;
+ c->avg_no_rnd_pixels_tab[1][1] = ff_avg_pixels8_x2_no_rnd_neon;
+ c->avg_no_rnd_pixels_tab[1][2] = ff_avg_pixels8_y2_no_rnd_neon;
+ c->avg_no_rnd_pixels_tab[1][3] = ff_avg_pixels8_xy2_no_rnd_neon;
}
c->add_pixels_clamped = ff_add_pixels_clamped_neon;
c->put_pixels_clamped = ff_put_pixels_clamped_neon;
c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon;
- if (CONFIG_H264_DECODER) {
- if (!high_bit_depth) {
+ if (CONFIG_H264_DECODER && !high_bit_depth) {
c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon;
c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon;
c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_neon;
@@ -295,7 +321,6 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
c->avg_h264_qpel_pixels_tab[1][13] = ff_avg_h264_qpel8_mc13_neon;
c->avg_h264_qpel_pixels_tab[1][14] = ff_avg_h264_qpel8_mc23_neon;
c->avg_h264_qpel_pixels_tab[1][15] = ff_avg_h264_qpel8_mc33_neon;
- }
}
if (CONFIG_VP3_DECODER) {
diff --git a/libavcodec/arm/dsputil_neon.S b/libavcodec/arm/dsputil_neon.S
index b765f23d02..c660cb0d4c 100644
--- a/libavcodec/arm/dsputil_neon.S
+++ b/libavcodec/arm/dsputil_neon.S
@@ -40,75 +40,89 @@ function ff_clear_blocks_neon, export=1
bx lr
endfunc
- .macro pixels16 avg=0
-.if \avg
- mov ip, r0
-.endif
-1: vld1.64 {d0, d1}, [r1], r2
- vld1.64 {d2, d3}, [r1], r2
- vld1.64 {d4, d5}, [r1], r2
+.macro pixels16 rnd=1, avg=0
+ .if \avg
+ mov r12, r0
+ .endif
+1: vld1.64 {q0}, [r1], r2
+ vld1.64 {q1}, [r1], r2
+ vld1.64 {q2}, [r1], r2
pld [r1, r2, lsl #2]
- vld1.64 {d6, d7}, [r1], r2
+ vld1.64 {q3}, [r1], r2
pld [r1]
pld [r1, r2]
pld [r1, r2, lsl #1]
-.if \avg
- vld1.64 {d16,d17}, [ip,:128], r2
+ .if \avg
+ vld1.64 {q8}, [r12,:128], r2
vrhadd.u8 q0, q0, q8
- vld1.64 {d18,d19}, [ip,:128], r2
+ vld1.64 {q9}, [r12,:128], r2
vrhadd.u8 q1, q1, q9
- vld1.64 {d20,d21}, [ip,:128], r2
+ vld1.64 {q10}, [r12,:128], r2
vrhadd.u8 q2, q2, q10
- vld1.64 {d22,d23}, [ip,:128], r2
+ vld1.64 {q11}, [r12,:128], r2
vrhadd.u8 q3, q3, q11
-.endif
+ .endif
subs r3, r3, #4
- vst1.64 {d0, d1}, [r0,:128], r2
- vst1.64 {d2, d3}, [r0,:128], r2
- vst1.64 {d4, d5}, [r0,:128], r2
- vst1.64 {d6, d7}, [r0,:128], r2
+ vst1.64 {q0}, [r0,:128], r2
+ vst1.64 {q1}, [r0,:128], r2
+ vst1.64 {q2}, [r0,:128], r2
+ vst1.64 {q3}, [r0,:128], r2
bne 1b
bx lr
- .endm
+.endm
- .macro pixels16_x2 vhadd=vrhadd.u8
-1: vld1.64 {d0-d2}, [r1], r2
- vld1.64 {d4-d6}, [r1], r2
+.macro pixels16_x2 rnd=1, avg=0
+1: vld1.64 {d0-d2}, [r1], r2
+ vld1.64 {d4-d6}, [r1], r2
pld [r1]
pld [r1, r2]
subs r3, r3, #2
vext.8 q1, q0, q1, #1
- \vhadd q0, q0, q1
+ avg q0, q0, q1
vext.8 q3, q2, q3, #1
- \vhadd q2, q2, q3
- vst1.64 {d0, d1}, [r0,:128], r2
- vst1.64 {d4, d5}, [r0,:128], r2
+ avg q2, q2, q3
+ .if \avg
+ vld1.8 {q1}, [r0,:128], r2
+ vld1.8 {q3}, [r0,:128]
+ vrhadd.u8 q0, q0, q1
+ vrhadd.u8 q2, q2, q3
+ sub r0, r0, r2
+ .endif
+ vst1.64 {q0}, [r0,:128], r2
+ vst1.64 {q2}, [r0,:128], r2
bne 1b
bx lr
- .endm
+.endm
- .macro pixels16_y2 vhadd=vrhadd.u8
- vld1.64 {d0, d1}, [r1], r2
- vld1.64 {d2, d3}, [r1], r2
+.macro pixels16_y2 rnd=1, avg=0
+ vld1.64 {q0}, [r1], r2
+ vld1.64 {q1}, [r1], r2
1: subs r3, r3, #2
- \vhadd q2, q0, q1
- vld1.64 {d0, d1}, [r1], r2
- \vhadd q3, q0, q1
- vld1.64 {d2, d3}, [r1], r2
+ avg q2, q0, q1
+ vld1.64 {q0}, [r1], r2
+ avg q3, q0, q1
+ vld1.64 {q1}, [r1], r2
pld [r1]
pld [r1, r2]
- vst1.64 {d4, d5}, [r0,:128], r2
- vst1.64 {d6, d7}, [r0,:128], r2
+ .if \avg
+ vld1.8 {q8}, [r0,:128], r2
+ vld1.8 {q9}, [r0,:128]
+ vrhadd.u8 q2, q2, q8
+ vrhadd.u8 q3, q3, q9
+ sub r0, r0, r2
+ .endif
+ vst1.64 {q2}, [r0,:128], r2
+ vst1.64 {q3}, [r0,:128], r2
bne 1b
bx lr
- .endm
+.endm
- .macro pixels16_xy2 vshrn=vrshrn.u16 no_rnd=0
- vld1.64 {d0-d2}, [r1], r2
- vld1.64 {d4-d6}, [r1], r2
-.if \no_rnd
+.macro pixels16_xy2 rnd=1, avg=0
+ vld1.64 {d0-d2}, [r1], r2
+ vld1.64 {d4-d6}, [r1], r2
+ .ifeq \rnd
vmov.i16 q13, #1
-.endif
+ .endif
pld [r1]
pld [r1, r2]
vext.8 q1, q0, q1, #1
@@ -118,109 +132,129 @@ endfunc
vaddl.u8 q9, d4, d6
vaddl.u8 q11, d5, d7
1: subs r3, r3, #2
- vld1.64 {d0-d2}, [r1], r2
+ vld1.64 {d0-d2}, [r1], r2
vadd.u16 q12, q8, q9
pld [r1]
-.if \no_rnd
+ .ifeq \rnd
vadd.u16 q12, q12, q13
-.endif
+ .endif
vext.8 q15, q0, q1, #1
vadd.u16 q1 , q10, q11
- \vshrn d28, q12, #2
-.if \no_rnd
+ shrn d28, q12, #2
+ .ifeq \rnd
vadd.u16 q1, q1, q13
-.endif
- \vshrn d29, q1, #2
+ .endif
+ shrn d29, q1, #2
+ .if \avg
+ vld1.8 {q8}, [r0,:128]
+ vrhadd.u8 q14, q14, q8
+ .endif
vaddl.u8 q8, d0, d30
- vld1.64 {d2-d4}, [r1], r2
+ vld1.64 {d2-d4}, [r1], r2
vaddl.u8 q10, d1, d31
- vst1.64 {d28,d29}, [r0,:128], r2
+ vst1.64 {q14}, [r0,:128], r2
vadd.u16 q12, q8, q9
pld [r1, r2]
-.if \no_rnd
+ .ifeq \rnd
vadd.u16 q12, q12, q13
-.endif
+ .endif
vext.8 q2, q1, q2, #1
vadd.u16 q0, q10, q11
- \vshrn d30, q12, #2
-.if \no_rnd
+ shrn d30, q12, #2
+ .ifeq \rnd
vadd.u16 q0, q0, q13
-.endif
- \vshrn d31, q0, #2
+ .endif
+ shrn d31, q0, #2
+ .if \avg
+ vld1.8 {q9}, [r0,:128]
+ vrhadd.u8 q15, q15, q9
+ .endif
vaddl.u8 q9, d2, d4
vaddl.u8 q11, d3, d5
- vst1.64 {d30,d31}, [r0,:128], r2
+ vst1.64 {q15}, [r0,:128], r2
bgt 1b
bx lr
- .endm
+.endm
- .macro pixels8 avg=0
-1: vld1.64 {d0}, [r1], r2
- vld1.64 {d1}, [r1], r2
- vld1.64 {d2}, [r1], r2
+.macro pixels8 rnd=1, avg=0
+1: vld1.64 {d0}, [r1], r2
+ vld1.64 {d1}, [r1], r2
+ vld1.64 {d2}, [r1], r2
pld [r1, r2, lsl #2]
- vld1.64 {d3}, [r1], r2
+ vld1.64 {d3}, [r1], r2
pld [r1]
pld [r1, r2]
pld [r1, r2, lsl #1]
-.if \avg
- vld1.64 {d4}, [r0,:64], r2
+ .if \avg
+ vld1.64 {d4}, [r0,:64], r2
vrhadd.u8 d0, d0, d4
- vld1.64 {d5}, [r0,:64], r2
+ vld1.64 {d5}, [r0,:64], r2
vrhadd.u8 d1, d1, d5
- vld1.64 {d6}, [r0,:64], r2
+ vld1.64 {d6}, [r0,:64], r2
vrhadd.u8 d2, d2, d6
- vld1.64 {d7}, [r0,:64], r2
+ vld1.64 {d7}, [r0,:64], r2
vrhadd.u8 d3, d3, d7
sub r0, r0, r2, lsl #2
-.endif
+ .endif
subs r3, r3, #4
- vst1.64 {d0}, [r0,:64], r2
- vst1.64 {d1}, [r0,:64], r2
- vst1.64 {d2}, [r0,:64], r2
- vst1.64 {d3}, [r0,:64], r2
+ vst1.64 {d0}, [r0,:64], r2
+ vst1.64 {d1}, [r0,:64], r2
+ vst1.64 {d2}, [r0,:64], r2
+ vst1.64 {d3}, [r0,:64], r2
bne 1b
bx lr
- .endm
+.endm
- .macro pixels8_x2 vhadd=vrhadd.u8
-1: vld1.64 {d0, d1}, [r1], r2
+.macro pixels8_x2 rnd=1, avg=0
+1: vld1.64 {q0}, [r1], r2
vext.8 d1, d0, d1, #1
- vld1.64 {d2, d3}, [r1], r2
+ vld1.64 {q1}, [r1], r2
vext.8 d3, d2, d3, #1
pld [r1]
pld [r1, r2]
subs r3, r3, #2
vswp d1, d2
- \vhadd q0, q0, q1
- vst1.64 {d0}, [r0,:64], r2
- vst1.64 {d1}, [r0,:64], r2
+ avg q0, q0, q1
+ .if \avg
+ vld1.8 {d4}, [r0,:64], r2
+ vld1.8 {d5}, [r0,:64]
+ vrhadd.u8 q0, q0, q2
+ sub r0, r0, r2
+ .endif
+ vst1.64 {d0}, [r0,:64], r2
+ vst1.64 {d1}, [r0,:64], r2
bne 1b
bx lr
- .endm
+.endm
- .macro pixels8_y2 vhadd=vrhadd.u8
- vld1.64 {d0}, [r1], r2
- vld1.64 {d1}, [r1], r2
+.macro pixels8_y2 rnd=1, avg=0
+ vld1.64 {d0}, [r1], r2
+ vld1.64 {d1}, [r1], r2
1: subs r3, r3, #2
- \vhadd d4, d0, d1
- vld1.64 {d0}, [r1], r2
- \vhadd d5, d0, d1
- vld1.64 {d1}, [r1], r2
+ avg d4, d0, d1
+ vld1.64 {d0}, [r1], r2
+ avg d5, d0, d1
+ vld1.64 {d1}, [r1], r2
pld [r1]
pld [r1, r2]
- vst1.64 {d4}, [r0,:64], r2
- vst1.64 {d5}, [r0,:64], r2
+ .if \avg
+ vld1.8 {d2}, [r0,:64], r2
+ vld1.8 {d3}, [r0,:64]
+ vrhadd.u8 q2, q2, q1
+ sub r0, r0, r2
+ .endif
+ vst1.64 {d4}, [r0,:64], r2
+ vst1.64 {d5}, [r0,:64], r2
bne 1b
bx lr
- .endm
+.endm
- .macro pixels8_xy2 vshrn=vrshrn.u16 no_rnd=0
- vld1.64 {d0, d1}, [r1], r2
- vld1.64 {d2, d3}, [r1], r2
-.if \no_rnd
+.macro pixels8_xy2 rnd=1, avg=0
+ vld1.64 {q0}, [r1], r2
+ vld1.64 {q1}, [r1], r2
+ .ifeq \rnd
vmov.i16 q11, #1
-.endif
+ .endif
pld [r1]
pld [r1, r2]
vext.8 d4, d0, d1, #1
@@ -228,70 +262,101 @@ endfunc
vaddl.u8 q8, d0, d4
vaddl.u8 q9, d2, d6
1: subs r3, r3, #2
- vld1.64 {d0, d1}, [r1], r2
+ vld1.64 {q0}, [r1], r2
pld [r1]
vadd.u16 q10, q8, q9
vext.8 d4, d0, d1, #1
-.if \no_rnd
+ .ifeq \rnd
vadd.u16 q10, q10, q11
-.endif
+ .endif
vaddl.u8 q8, d0, d4
- \vshrn d5, q10, #2
- vld1.64 {d2, d3}, [r1], r2
+ shrn d5, q10, #2
+ vld1.64 {q1}, [r1], r2
vadd.u16 q10, q8, q9
pld [r1, r2]
-.if \no_rnd
+ .if \avg
+ vld1.8 {d7}, [r0,:64]
+ vrhadd.u8 d5, d5, d7
+ .endif
+ .ifeq \rnd
vadd.u16 q10, q10, q11
-.endif
- vst1.64 {d5}, [r0,:64], r2
- \vshrn d7, q10, #2
+ .endif
+ vst1.64 {d5}, [r0,:64], r2
+ shrn d7, q10, #2
+ .if \avg
+ vld1.8 {d5}, [r0,:64]
+ vrhadd.u8 d7, d7, d5
+ .endif
vext.8 d6, d2, d3, #1
vaddl.u8 q9, d2, d6
- vst1.64 {d7}, [r0,:64], r2
+ vst1.64 {d7}, [r0,:64], r2
bgt 1b
bx lr
- .endm
-
- .macro pixfunc pfx name suf rnd_op args:vararg
+.endm
+
+.macro pixfunc pfx, name, suf, rnd=1, avg=0
+ .if \rnd
+ .macro avg rd, rn, rm
+ vrhadd.u8 \rd, \rn, \rm
+ .endm
+ .macro shrn rd, rn, rm
+ vrshrn.u16 \rd, \rn, \rm
+ .endm
+ .else
+ .macro avg rd, rn, rm
+ vhadd.u8 \rd, \rn, \rm
+ .endm
+ .macro shrn rd, rn, rm
+ vshrn.u16 \rd, \rn, \rm
+ .endm
+ .endif
function ff_\pfx\name\suf\()_neon, export=1
- \name \rnd_op \args
+ \name \rnd, \avg
endfunc
- .endm
+ .purgem avg
+ .purgem shrn
+.endm
- .macro pixfunc2 pfx name args:vararg
- pixfunc \pfx \name
- pixfunc \pfx \name \args
- .endm
+.macro pixfunc2 pfx, name, avg=0
+ pixfunc \pfx, \name, rnd=1, avg=\avg
+ pixfunc \pfx, \name, _no_rnd, rnd=0, avg=\avg
+.endm
function ff_put_h264_qpel16_mc00_neon, export=1
mov r3, #16
endfunc
- pixfunc put_ pixels16
- pixfunc2 put_ pixels16_x2, _no_rnd, vhadd.u8
- pixfunc2 put_ pixels16_y2, _no_rnd, vhadd.u8
- pixfunc2 put_ pixels16_xy2, _no_rnd, vshrn.u16, 1
+ pixfunc put_, pixels16, avg=0
+ pixfunc2 put_, pixels16_x2, avg=0
+ pixfunc2 put_, pixels16_y2, avg=0
+ pixfunc2 put_, pixels16_xy2, avg=0
function ff_avg_h264_qpel16_mc00_neon, export=1
mov r3, #16
endfunc
- pixfunc avg_ pixels16,, 1
+ pixfunc avg_, pixels16, avg=1
+ pixfunc2 avg_, pixels16_x2, avg=1
+ pixfunc2 avg_, pixels16_y2, avg=1
+ pixfunc2 avg_, pixels16_xy2, avg=1
function ff_put_h264_qpel8_mc00_neon, export=1
mov r3, #8
endfunc
- pixfunc put_ pixels8
- pixfunc2 put_ pixels8_x2, _no_rnd, vhadd.u8
- pixfunc2 put_ pixels8_y2, _no_rnd, vhadd.u8
- pixfunc2 put_ pixels8_xy2, _no_rnd, vshrn.u16, 1
+ pixfunc put_, pixels8, avg=0
+ pixfunc2 put_, pixels8_x2, avg=0
+ pixfunc2 put_, pixels8_y2, avg=0
+ pixfunc2 put_, pixels8_xy2, avg=0
function ff_avg_h264_qpel8_mc00_neon, export=1
mov r3, #8
endfunc
- pixfunc avg_ pixels8,, 1
+ pixfunc avg_, pixels8, avg=1
+ pixfunc2 avg_, pixels8_x2, avg=1
+ pixfunc2 avg_, pixels8_y2, avg=1
+ pixfunc2 avg_, pixels8_xy2, avg=1
function ff_put_pixels_clamped_neon, export=1
vld1.64 {d16-d19}, [r0,:128]!
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index a08573e221..3bc13aa2d4 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1471,7 +1471,7 @@ static void decode_postinit(H264Context *h, int setup_finished){
if( s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
&& !h->sps.bitstream_restriction_flag){
- s->avctx->has_b_frames= MAX_DELAYED_PIC_COUNT;
+ s->avctx->has_b_frames = MAX_DELAYED_PIC_COUNT - 1;
s->low_delay= 0;
}
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 2e2de85044..15a5c5430f 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1112,7 +1112,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
GetBitContext *gb = &s->gb;
int cbp, cbp2;
int i, blknum, blkoff;
- DCTELEM block16[64];
+ LOCAL_ALIGNED_16(DCTELEM, block16, [64]);
int luma_dc_quant;
int dist;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
@@ -1147,7 +1147,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
luma_dc_quant = r->block_type == RV34_MB_P_MIX16x16 ? r->luma_dc_quant_p[s->qscale] : r->luma_dc_quant_i[s->qscale];
if(r->is16){
- memset(block16, 0, sizeof(block16));
+ memset(block16, 0, 64 * sizeof(*block16));
rv34_decode_block(block16, gb, r->cur_vlcs, 3, 0);
rv34_dequant4x4_16x16(block16, rv34_qscale_tab[luma_dc_quant],rv34_qscale_tab[s->qscale]);
r->rdsp.rv34_inv_transform_tab[1](block16);
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index 8218c0e05f..8295ccc5f5 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -174,19 +174,25 @@ fail:
return ret;
}
+static int applehttp_close(URLContext *h)
+{
+ AppleHTTPContext *s = h->priv_data;
+
+ free_segment_list(s);
+ free_variant_list(s);
+ ffurl_close(s->seg_hd);
+ return 0;
+}
+
static int applehttp_open(URLContext *h, const char *uri, int flags)
{
- AppleHTTPContext *s;
+ AppleHTTPContext *s = h->priv_data;
int ret, i;
const char *nested_url;
if (flags & AVIO_FLAG_WRITE)
return AVERROR(ENOSYS);
- s = av_mallocz(sizeof(AppleHTTPContext));
- if (!s)
- return AVERROR(ENOMEM);
- h->priv_data = s;
h->is_streamed = 1;
if (av_strstart(uri, "applehttp+", &nested_url)) {
@@ -229,7 +235,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
return 0;
fail:
- av_free(s);
+ applehttp_close(h);
return ret;
}
@@ -287,21 +293,11 @@ retry:
goto start;
}
-static int applehttp_close(URLContext *h)
-{
- AppleHTTPContext *s = h->priv_data;
-
- free_segment_list(s);
- free_variant_list(s);
- ffurl_close(s->seg_hd);
- av_free(s);
- return 0;
-}
-
URLProtocol ff_applehttp_protocol = {
- .name = "applehttp",
- .url_open = applehttp_open,
- .url_read = applehttp_read,
- .url_close = applehttp_close,
- .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+ .name = "applehttp",
+ .url_open = applehttp_open,
+ .url_read = applehttp_read,
+ .url_close = applehttp_close,
+ .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+ .priv_data_size = sizeof(AppleHTTPContext),
};
diff --git a/libavformat/cache.c b/libavformat/cache.c
index c2bddf5f6d..d94cf5fbac 100644
--- a/libavformat/cache.c
+++ b/libavformat/cache.c
@@ -53,13 +53,7 @@ static int cache_open(URLContext *h, const char *arg, int flags)
{
int access;
const char *buffername;
- Context *c;
-
- c = av_mallocz(sizeof(Context));
- if (!c) {
- return AVERROR(ENOMEM);
- }
- h->priv_data = c;
+ Context *c= h->priv_data;
av_strstart(arg, "cache:", &arg);
@@ -130,8 +124,6 @@ static int cache_close(URLContext *h)
close(c->fd);
ffurl_close(c->inner);
- av_freep(&h->priv_data);
-
return 0;
}
@@ -141,4 +133,5 @@ URLProtocol ff_cache_protocol = {
.url_read = cache_read,
.url_seek = cache_seek,
.url_close = cache_close,
+ .priv_data_size = sizeof(Context),
};
diff --git a/libavformat/concat.c b/libavformat/concat.c
index 81f37383b9..f97354c788 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -50,7 +50,6 @@ static av_cold int concat_close(URLContext *h)
err |= ffurl_close(nodes[i].uc);
av_freep(&data->nodes);
- av_freep(&h->priv_data);
return err < 0 ? -1 : 0;
}
@@ -62,16 +61,11 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
int64_t size;
size_t len, i;
URLContext *uc;
- struct concat_data *data;
+ struct concat_data *data = h->priv_data;
struct concat_nodes *nodes;
av_strstart(uri, "concat:", &uri);
- /* creating data */
- if (!(data = av_mallocz(sizeof(*data))))
- return AVERROR(ENOMEM);
- h->priv_data = data;
-
for (i = 0, len = 1; uri[i]; i++)
if (uri[i] == *AV_CAT_SEPARATOR)
/* integer overflow */
@@ -81,7 +75,6 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
}
if (!(nodes = av_malloc(sizeof(*nodes) * len))) {
- av_freep(&h->priv_data);
return AVERROR(ENOMEM);
} else
data->nodes = nodes;
@@ -191,9 +184,10 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
}
URLProtocol ff_concat_protocol = {
- .name = "concat",
- .url_open = concat_open,
- .url_read = concat_read,
- .url_seek = concat_seek,
- .url_close = concat_close,
+ .name = "concat",
+ .url_open = concat_open,
+ .url_read = concat_read,
+ .url_seek = concat_seek,
+ .url_close = concat_close,
+ .priv_data_size = sizeof(struct concat_data),
};
diff --git a/libavformat/gopher.c b/libavformat/gopher.c
index 6a829c8ce5..e1acf5039c 100644
--- a/libavformat/gopher.c
+++ b/libavformat/gopher.c
@@ -72,24 +72,17 @@ static int gopher_close(URLContext *h)
ffurl_close(s->hd);
s->hd = NULL;
}
- av_freep(&h->priv_data);
return 0;
}
static int gopher_open(URLContext *h, const char *uri, int flags)
{
- GopherContext *s;
+ GopherContext *s = h->priv_data;
char hostname[1024], auth[1024], path[1024], buf[1024];
int port, err;
h->is_streamed = 1;
- s = av_malloc(sizeof(GopherContext));
- if (!s) {
- return AVERROR(ENOMEM);
- }
- h->priv_data = s;
-
/* needed in any case to build the host string */
av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
path, sizeof(path), uri);
@@ -122,9 +115,10 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size)
URLProtocol ff_gopher_protocol = {
- .name = "gopher",
- .url_open = gopher_open,
- .url_read = gopher_read,
- .url_write = gopher_write,
- .url_close = gopher_close,
+ .name = "gopher",
+ .url_open = gopher_open,
+ .url_read = gopher_read,
+ .url_write = gopher_write,
+ .url_close = gopher_close,
+ .priv_data_size = sizeof(GopherContext),
};
diff --git a/libavformat/http.c b/libavformat/http.c
index 2e4e8c235d..f7e0b5cc8c 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -93,7 +93,7 @@ static int http_open_cnx(URLContext *h)
{
const char *path, *proxy_path, *lower_proto = "tcp", *local_path;
char hostname[1024], hoststr[1024], proto[10];
- char auth[1024], proxyauth[1024];
+ char auth[1024], proxyauth[1024] = "";
char path1[1024];
char buf[1024], urlbuf[1024];
int port, use_proxy, err, location_changed = 0, redirects = 0;
diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
index 01b6c3deb0..018ea0f4b0 100644
--- a/libavformat/librtmp.c
+++ b/libavformat/librtmp.c
@@ -52,7 +52,6 @@ static int rtmp_close(URLContext *s)
RTMP *r = s->priv_data;
RTMP_Close(r);
- av_free(r);
return 0;
}
@@ -70,13 +69,9 @@ static int rtmp_close(URLContext *s)
*/
static int rtmp_open(URLContext *s, const char *uri, int flags)
{
- RTMP *r;
+ RTMP *r = s->priv_data;
int rc;
- r = av_mallocz(sizeof(RTMP));
- if (!r)
- return AVERROR(ENOMEM);
-
switch (av_log_get_level()) {
default:
case AV_LOG_FATAL: rc = RTMP_LOGCRIT; break;
@@ -103,11 +98,9 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
goto fail;
}
- s->priv_data = r;
s->is_streamed = 1;
return 0;
fail:
- av_free(r);
return rc;
}
@@ -167,7 +160,8 @@ URLProtocol ff_rtmp_protocol = {
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
- .url_get_file_handle = rtmp_get_file_handle
+ .url_get_file_handle = rtmp_get_file_handle,
+ .priv_data_size = sizeof(RTMP),
};
URLProtocol ff_rtmpt_protocol = {
@@ -178,7 +172,8 @@ URLProtocol ff_rtmpt_protocol = {
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
- .url_get_file_handle = rtmp_get_file_handle
+ .url_get_file_handle = rtmp_get_file_handle,
+ .priv_data_size = sizeof(RTMP),
};
URLProtocol ff_rtmpe_protocol = {
@@ -189,7 +184,8 @@ URLProtocol ff_rtmpe_protocol = {
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
- .url_get_file_handle = rtmp_get_file_handle
+ .url_get_file_handle = rtmp_get_file_handle,
+ .priv_data_size = sizeof(RTMP),
};
URLProtocol ff_rtmpte_protocol = {
@@ -200,7 +196,8 @@ URLProtocol ff_rtmpte_protocol = {
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
- .url_get_file_handle = rtmp_get_file_handle
+ .url_get_file_handle = rtmp_get_file_handle,
+ .priv_data_size = sizeof(RTMP),
};
URLProtocol ff_rtmps_protocol = {
@@ -211,5 +208,6 @@ URLProtocol ff_rtmps_protocol = {
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
- .url_get_file_handle = rtmp_get_file_handle
+ .url_get_file_handle = rtmp_get_file_handle,
+ .priv_data_size = sizeof(RTMP),
};
diff --git a/libavformat/md5proto.c b/libavformat/md5proto.c
index 05ee9d366a..f7c8b78fee 100644
--- a/libavformat/md5proto.c
+++ b/libavformat/md5proto.c
@@ -79,16 +79,11 @@ static int md5_close(URLContext *h)
return err;
}
-static int md5_get_handle(URLContext *h)
-{
- return (intptr_t)h->priv_data;
-}
URLProtocol ff_md5_protocol = {
.name = "md5",
.url_open = md5_open,
.url_write = md5_write,
.url_close = md5_close,
- .url_get_file_handle = md5_get_handle,
.priv_data_size = PRIV_SIZE,
};
diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c
index bc93722f1a..e92b74fc0a 100644
--- a/libavformat/mmsh.c
+++ b/libavformat/mmsh.c
@@ -69,7 +69,6 @@ static int mmsh_close(URLContext *h)
ffurl_close(mms->mms_hd);
av_free(mms->streams);
av_free(mms->asf_header);
- av_freep(&h->priv_data);
return 0;
}
@@ -218,12 +217,9 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim
char httpname[256], path[256], host[128];
char *stream_selection = NULL;
char headers[1024];
- MMSHContext *mmsh;
+ MMSHContext *mmsh = h->priv_data;
MMSContext *mms;
- mmsh = h->priv_data = av_mallocz(sizeof(MMSHContext));
- if (!h->priv_data)
- return AVERROR(ENOMEM);
mmsh->request_seq = h->is_streamed = 1;
mms = &mmsh->mms;
av_strlcpy(mmsh->location, uri, sizeof(mmsh->location));
@@ -263,9 +259,9 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim
// close the socket and then reopen it for sending the second play request.
ffurl_close(mms->mms_hd);
memset(headers, 0, sizeof(headers));
- if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ,
- &h->interrupt_callback) < 0) {
- return AVERROR(EIO);
+ if ((err = ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ,
+ &h->interrupt_callback)) < 0) {
+ goto fail;
}
stream_selection = av_mallocz(mms->stream_num * 19 + 1);
if (!stream_selection)
@@ -403,10 +399,11 @@ static int64_t mmsh_seek(URLContext *h, int64_t pos, int whence)
}
URLProtocol ff_mmsh_protocol = {
- .name = "mmsh",
- .url_open = mmsh_open,
- .url_read = mmsh_read,
- .url_seek = mmsh_seek,
- .url_close = mmsh_close,
+ .name = "mmsh",
+ .url_open = mmsh_open,
+ .url_read = mmsh_read,
+ .url_seek = mmsh_seek,
+ .url_close = mmsh_close,
.url_read_seek = mmsh_read_seek,
+ .priv_data_size = sizeof(MMSHContext),
};
diff --git a/libavformat/mmst.c b/libavformat/mmst.c
index 0a728eb35f..a6fe696f5f 100644
--- a/libavformat/mmst.c
+++ b/libavformat/mmst.c
@@ -470,7 +470,6 @@ static int mms_close(URLContext *h)
/* free all separately allocated pointers in mms */
av_free(mms->streams);
av_free(mms->asf_header);
- av_freep(&h->priv_data);
return 0;
}
@@ -502,15 +501,12 @@ static void clear_stream_buffers(MMSContext *mms)
static int mms_open(URLContext *h, const char *uri, int flags)
{
- MMSTContext *mmst;
+ MMSTContext *mmst = h->priv_data;
MMSContext *mms;
int port, err;
char tcpname[256];
h->is_streamed = 1;
- mmst = h->priv_data = av_mallocz(sizeof(MMSTContext));
- if (!h->priv_data)
- return AVERROR(ENOMEM);
mms = &mmst->mms;
// only for MMS over TCP, so set proto = NULL
@@ -624,8 +620,9 @@ static int mms_read(URLContext *h, uint8_t *buf, int size)
}
URLProtocol ff_mmst_protocol = {
- .name = "mmst",
- .url_open = mms_open,
- .url_read = mms_read,
- .url_close = mms_close,
+ .name = "mmst",
+ .url_open = mms_open,
+ .url_read = mms_read,
+ .url_close = mms_close,
+ .priv_data_size = sizeof(MMSTContext),
};
diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c
index 88b8998ad9..3d54484314 100644
--- a/libavformat/pmpdec.c
+++ b/libavformat/pmpdec.c
@@ -38,7 +38,8 @@ static int pmp_probe(AVProbeData *p) {
return 0;
}
-static int pmp_header(AVFormatContext *s, AVFormatParameters *ap) {
+static int pmp_header(AVFormatContext *s, AVFormatParameters *ap)
+{
PMPContext *pmp = s->priv_data;
AVIOContext *pb = s->pb;
int tb_num, tb_den;
@@ -93,7 +94,6 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
- ast->id = i;
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = audio_codec_id;
ast->codec->channels = channels;
@@ -111,7 +111,8 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap) {
return 0;
}
-static int pmp_packet(AVFormatContext *s, AVPacket *pkt) {
+static int pmp_packet(AVFormatContext *s, AVPacket *pkt)
+{
PMPContext *pmp = s->priv_data;
AVIOContext *pb = s->pb;
int ret = 0;
@@ -128,14 +129,18 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt) {
av_fast_malloc(&pmp->packet_sizes,
&pmp->packet_sizes_alloc,
num_packets * sizeof(*pmp->packet_sizes));
+ if (!pmp->packet_sizes_alloc) {
+ av_log(s, AV_LOG_ERROR, "Cannot (re)allocate packet buffer\n");
+ return AVERROR(ENOMEM);
+ }
for (i = 0; i < num_packets; i++)
pmp->packet_sizes[i] = avio_rl32(pb);
}
ret = av_get_packet(pb, pkt, pmp->packet_sizes[pmp->current_packet]);
if (ret >= 0) {
ret = 0;
- // FIXME: this is a hack that should be remove once
- // compute_pkt_fields can handle
+ // FIXME: this is a hack that should be removed once
+ // compute_pkt_fields() can handle timestamps properly
if (pmp->cur_stream == 0)
pkt->dts = s->streams[0]->cur_dts++;
pkt->stream_index = pmp->cur_stream;
@@ -146,8 +151,8 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt) {
return ret;
}
-static int pmp_seek(AVFormatContext *s, int stream_index,
- int64_t ts, int flags) {
+static int pmp_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags)
+{
PMPContext *pmp = s->priv_data;
pmp->cur_stream = 0;
// fallback to default seek now
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 8935f56369..8f57d1bb59 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -784,7 +784,6 @@ static int rtmp_close(URLContext *h)
av_freep(&rt->flv_data);
ffurl_close(rt->stream);
- av_free(rt);
return 0;
}
@@ -799,16 +798,12 @@ static int rtmp_close(URLContext *h)
*/
static int rtmp_open(URLContext *s, const char *uri, int flags)
{
- RTMPContext *rt;
+ RTMPContext *rt = s->priv_data;
char proto[8], hostname[256], path[1024], *fname;
uint8_t buf[2048];
int port;
int ret;
- rt = av_mallocz(sizeof(RTMPContext));
- if (!rt)
- return AVERROR(ENOMEM);
- s->priv_data = rt;
rt->is_input = !(flags & AVIO_FLAG_WRITE);
av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
@@ -826,7 +821,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
rt->state = STATE_START;
if (rtmp_handshake(s, rt))
- return -1;
+ goto fail;
rt->chunk_size = 128;
rt->state = STATE_HANDSHAKED;
@@ -997,9 +992,10 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
}
URLProtocol ff_rtmp_protocol = {
- .name = "rtmp",
- .url_open = rtmp_open,
- .url_read = rtmp_read,
- .url_write = rtmp_write,
- .url_close = rtmp_close,
+ .name = "rtmp",
+ .url_open = rtmp_open,
+ .url_read = rtmp_read,
+ .url_write = rtmp_write,
+ .url_close = rtmp_close,
+ .priv_data_size = sizeof(RTMPContext),
};
diff --git a/libavformat/rtpdec_g726.c b/libavformat/rtpdec_g726.c
index 35ca9061fd..20450d8dfb 100644
--- a/libavformat/rtpdec_g726.c
+++ b/libavformat/rtpdec_g726.c
@@ -27,10 +27,8 @@ static int g726_ ## bitrate ##_init(AVFormatContext *s, int st_index, PayloadCon
AVStream *stream = s->streams[st_index]; \
AVCodecContext *codec = stream->codec; \
\
- codec->bit_rate = bitrate*1000; \
- if (codec->sample_rate) \
- codec->bits_per_coded_sample = \
- av_clip((codec->bit_rate + codec->sample_rate/2) / codec->sample_rate, 2, 5); \
+ codec->bits_per_coded_sample = bitrate/8; \
+ codec->bit_rate = codec->bits_per_coded_sample * codec->sample_rate; \
\
return 0; \
} \
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 73ac76fae7..ac9b32cc0c 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -72,6 +72,7 @@ static int is_supported(enum CodecID id)
case CODEC_ID_THEORA:
case CODEC_ID_VP8:
case CODEC_ID_ADPCM_G722:
+ case CODEC_ID_ADPCM_G726:
return 1;
default:
return 0;
@@ -121,7 +122,7 @@ static int rtp_write_header(AVFormatContext *s1)
if (st->codec->frame_size == 0) {
av_log(s1, AV_LOG_ERROR, "Cannot respect max delay: frame size = 0\n");
} else {
- s->max_frames_per_packet = av_rescale_rnd(s1->max_delay, st->codec->sample_rate, AV_TIME_BASE * st->codec->frame_size, AV_ROUND_DOWN);
+ s->max_frames_per_packet = av_rescale_rnd(s1->max_delay, st->codec->sample_rate, AV_TIME_BASE * (int64_t)st->codec->frame_size, AV_ROUND_DOWN);
}
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -248,14 +249,16 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
/* send an integer number of samples and compute time stamp and fill
the rtp send buffer before sending. */
static void rtp_send_samples(AVFormatContext *s1,
- const uint8_t *buf1, int size, int sample_size)
+ const uint8_t *buf1, int size, int sample_size_bits)
{
RTPMuxContext *s = s1->priv_data;
int len, max_packet_size, n;
+ /* Calculate the number of bytes to get samples aligned on a byte border */
+ int aligned_samples_size = sample_size_bits/av_gcd(sample_size_bits, 8);
- max_packet_size = (s->max_payload_size / sample_size) * sample_size;
- /* not needed, but who nows */
- if ((size % sample_size) != 0)
+ max_packet_size = (s->max_payload_size / aligned_samples_size) * aligned_samples_size;
+ /* Not needed, but who knows. Don't check if samples aren't an even number of bytes. */
+ if ((sample_size_bits % 8) == 0 && ((8 * size) % sample_size_bits) != 0)
av_abort();
n = 0;
while (size > 0) {
@@ -267,7 +270,7 @@ static void rtp_send_samples(AVFormatContext *s1,
s->buf_ptr += len;
buf1 += len;
size -= len;
- s->timestamp = s->cur_timestamp + n / sample_size;
+ s->timestamp = s->cur_timestamp + n * 8 / sample_size_bits;
ff_rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, 0);
n += (s->buf_ptr - s->buf);
}
@@ -394,19 +397,24 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_U8:
case CODEC_ID_PCM_S8:
- rtp_send_samples(s1, pkt->data, size, 1 * st->codec->channels);
+ rtp_send_samples(s1, pkt->data, size, 8 * st->codec->channels);
break;
case CODEC_ID_PCM_U16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_S16LE:
- rtp_send_samples(s1, pkt->data, size, 2 * st->codec->channels);
+ rtp_send_samples(s1, pkt->data, size, 16 * st->codec->channels);
break;
case CODEC_ID_ADPCM_G722:
/* The actual sample size is half a byte per sample, but since the
* stream clock rate is 8000 Hz while the sample rate is 16000 Hz,
- * the correct parameter for send_samples is 1 byte per stream clock. */
- rtp_send_samples(s1, pkt->data, size, 1 * st->codec->channels);
+ * the correct parameter for send_samples_bits is 8 bits per stream
+ * clock. */
+ rtp_send_samples(s1, pkt->data, size, 8 * st->codec->channels);
+ break;
+ case CODEC_ID_ADPCM_G726:
+ rtp_send_samples(s1, pkt->data, size,
+ st->codec->bits_per_coded_sample * st->codec->channels);
break;
case CODEC_ID_MP2:
case CODEC_ID_MP3:
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 41fb7317bb..b6f2a56146 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -137,7 +137,7 @@ static void build_udp_url(char *buf, int buf_size,
static int rtp_open(URLContext *h, const char *uri, int flags)
{
- RTPContext *s;
+ RTPContext *s = h->priv_data;
int rtp_port, rtcp_port,
ttl, connect,
local_rtp_port, local_rtcp_port, max_packet_size;
@@ -146,11 +146,6 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
char path[1024];
const char *p;
- s = av_mallocz(sizeof(RTPContext));
- if (!s)
- return AVERROR(ENOMEM);
- h->priv_data = s;
-
av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
path, sizeof(path), uri);
/* extract parameters */
@@ -214,7 +209,6 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
ffurl_close(s->rtp_hd);
if (s->rtcp_hd)
ffurl_close(s->rtcp_hd);
- av_free(s);
return AVERROR(EIO);
}
@@ -291,7 +285,6 @@ static int rtp_close(URLContext *h)
ffurl_close(s->rtp_hd);
ffurl_close(s->rtcp_hd);
- av_free(s);
return 0;
}
@@ -337,4 +330,5 @@ URLProtocol ff_rtp_protocol = {
.url_write = rtp_write,
.url_close = rtp_close,
.url_get_file_handle = rtp_get_file_handle,
+ .priv_data_size = sizeof(RTPContext),
};
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 13c5ba6629..5def15d2a3 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -517,6 +517,14 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
payload_type,
8000, c->channels);
break;
+ case CODEC_ID_ADPCM_G726: {
+ if (payload_type >= RTP_PT_PRIVATE)
+ av_strlcatf(buff, size, "a=rtpmap:%d G726-%d/%d\r\n",
+ payload_type,
+ c->bits_per_coded_sample*8,
+ c->sample_rate);
+ break;
+ }
default:
/* Nothing special to do here... */
break;
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index f882fc0dee..1aeceb9e02 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -39,7 +39,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
{
struct addrinfo hints, *ai, *cur_ai;
int port, fd = -1;
- TCPContext *s = NULL;
+ TCPContext *s = h->priv_data;
int listen_socket = 0;
const char *p;
char buf[256];
@@ -135,12 +135,6 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
goto fail;
}
}
- s = av_malloc(sizeof(TCPContext));
- if (!s) {
- freeaddrinfo(ai);
- return AVERROR(ENOMEM);
- }
- h->priv_data = s;
h->is_streamed = 1;
s->fd = fd;
freeaddrinfo(ai);
@@ -193,7 +187,6 @@ static int tcp_close(URLContext *h)
{
TCPContext *s = h->priv_data;
closesocket(s->fd);
- av_free(s);
return 0;
}
@@ -210,4 +203,5 @@ URLProtocol ff_tcp_protocol = {
.url_write = tcp_write,
.url_close = tcp_close,
.url_get_file_handle = tcp_get_file_handle,
+ .priv_data_size = sizeof(TCPContext),
};
diff --git a/libavformat/udp.c b/libavformat/udp.c
index ee5b304769..a0d127c614 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -381,7 +381,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
{
char hostname[1024], localaddr[1024] = "";
int port, udp_fd = -1, tmp, bind_ret = -1;
- UDPContext *s = NULL;
+ UDPContext *s = h->priv_data;
int is_output;
const char *p;
char buf[256];
@@ -394,11 +394,6 @@ static int udp_open(URLContext *h, const char *uri, int flags)
is_output = !(flags & AVIO_FLAG_READ);
- s = av_mallocz(sizeof(UDPContext));
- if (!s)
- return AVERROR(ENOMEM);
-
- h->priv_data = s;
s->ttl = 16;
s->buffer_size = is_output ? UDP_TX_BUF_SIZE : UDP_MAX_PKT_SIZE;
@@ -533,7 +528,6 @@ static int udp_open(URLContext *h, const char *uri, int flags)
if (udp_fd >= 0)
closesocket(udp_fd);
av_fifo_free(s->fifo);
- av_free(s);
return AVERROR(EIO);
}
@@ -614,7 +608,6 @@ static int udp_close(URLContext *h)
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
closesocket(s->udp_fd);
av_fifo_free(s->fifo);
- av_free(s);
return 0;
}
@@ -625,4 +618,5 @@ URLProtocol ff_udp_protocol = {
.url_write = udp_write,
.url_close = udp_close,
.url_get_file_handle = udp_get_file_handle,
+ .priv_data_size = sizeof(UDPContext),
};
diff --git a/libswscale/utils.c b/libswscale/utils.c
index e27144e594..3240b96030 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -44,6 +44,7 @@
#include "libavutil/cpu.h"
#include "libavutil/avutil.h"
#include "libavutil/bswap.h"
+#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"
diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh
index 12f74f055d..7a71e47273 100755
--- a/tests/codec-regression.sh
+++ b/tests/codec-regression.sh
@@ -395,26 +395,62 @@ do_audio_enc_dec() {
do_audio_decoding
}
-if [ -n "$do_pcm" ] ; then
+if [ -n "$do_pcm_alaw" ] ; then
do_audio_enc_dec wav s16 pcm_alaw
+fi
+if [ -n "$do_pcm_mulaw" ] ; then
do_audio_enc_dec wav s16 pcm_mulaw
+fi
+if [ -n "$do_pcm_s8" ] ; then
do_audio_enc_dec mov u8 pcm_s8
+fi
+if [ -n "$do_pcm_u8" ] ; then
do_audio_enc_dec wav u8 pcm_u8
+fi
+if [ -n "$do_pcm_s16be" ] ; then
do_audio_enc_dec mov s16 pcm_s16be
+fi
+if [ -n "$do_pcm_s16le" ] ; then
do_audio_enc_dec wav s16 pcm_s16le
-do_audio_enc_dec mkv s16 pcm_s16be
-do_audio_enc_dec mkv s16 pcm_s16le
+fi
+if [ -n "$do_pcm_s24be" ] ; then
do_audio_enc_dec mov s32 pcm_s24be
+fi
+if [ -n "$do_pcm_s24le" ] ; then
do_audio_enc_dec wav s32 pcm_s24le
-#do_audio_enc_dec ??? s32 pcm_u24be #no compatible muxer or demuxer
-#do_audio_enc_dec ??? s32 pcm_u24le #no compatible muxer or demuxer
+fi
+# no compatible muxer or demuxer
+# if [ -n "$do_pcm_u24be" ] ; then
+# do_audio_enc_dec ??? u32 pcm_u24be
+# fi
+# if [ -n "$do_pcm_u24le" ] ; then
+# do_audio_enc_dec ??? u32 pcm_u24le
+# fi
+if [ -n "$do_pcm_s32be" ] ; then
do_audio_enc_dec mov s32 pcm_s32be
+fi
+if [ -n "$do_pcm_s32le" ] ; then
do_audio_enc_dec wav s32 pcm_s32le
-#do_audio_enc_dec ??? s32 pcm_u32be #no compatible muxer or demuxer
-#do_audio_enc_dec ??? s32 pcm_u32le #no compatible muxer or demuxer
+fi
+# no compatible muxer or demuxer
+# if [ -n "$do_pcm_u32be" ] ; then
+# do_audio_enc_dec ??? u32 pcm_u32be
+# fi
+# if [ -n "$do_pcm_u32le" ] ; then
+# do_audio_enc_dec ??? u32 pcm_u32le
+# fi
+if [ -n "$do_pcm_f32be" ] ; then
do_audio_enc_dec au flt pcm_f32be
+fi
+if [ -n "$do_pcm_f32le" ] ; then
do_audio_enc_dec wav flt pcm_f32le
+fi
+if [ -n "$do_pcm_f64be" ] ; then
do_audio_enc_dec au dbl pcm_f64be
+fi
+if [ -n "$do_pcm_f64le" ] ; then
do_audio_enc_dec wav dbl pcm_f64le
+fi
+if [ -n "$do_pcm_s24daud" ] ; then
do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000"
fi
diff --git a/tests/ref/acodec/pcm b/tests/ref/acodec/pcm
deleted file mode 100644
index e338f2a1bf..0000000000
--- a/tests/ref/acodec/pcm
+++ /dev/null
@@ -1,68 +0,0 @@
-ede2da07839a00c255a43129922f2c7b *./tests/data/acodec/pcm_alaw.wav
-529258 ./tests/data/acodec/pcm_alaw.wav
-f323f7551ffad91de8613f44dcb198b6 *./tests/data/pcm.acodec.out.wav
-stddev: 101.67 PSNR: 56.19 MAXDIFF: 515 bytes: 1058400/ 1058400
-0c2a55850fb46ad5385a69b15b271f10 *./tests/data/acodec/pcm_mulaw.wav
-529258 ./tests/data/acodec/pcm_mulaw.wav
-7ae8c3fc804bd574006fd547fe28980c *./tests/data/pcm.acodec.out.wav
-stddev: 103.38 PSNR: 56.04 MAXDIFF: 644 bytes: 1058400/ 1058400
-b78d2a30df75af08ecf86f201281fec2 *./tests/data/acodec/pcm_s8.mov
-529793 ./tests/data/acodec/pcm_s8.mov
-651d4eb8d98dfcdda96ae6c43d8f156b *./tests/data/pcm.acodec.out.wav
-stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400
-70fecbae732f81143a560c7315eda49a *./tests/data/acodec/pcm_u8.wav
-529246 ./tests/data/acodec/pcm_u8.wav
-651d4eb8d98dfcdda96ae6c43d8f156b *./tests/data/pcm.acodec.out.wav
-stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400
-9686b93d1439fc2df991a004ab0298f4 *./tests/data/acodec/pcm_s16be.mov
-1058993 ./tests/data/acodec/pcm_s16be.mov
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/acodec/pcm_s16le.wav
-1058446 ./tests/data/acodec/pcm_s16le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-af717ca95eaca310772eb1238c745d1b *./tests/data/acodec/pcm_s16be.mkv
-1060638 ./tests/data/acodec/pcm_s16be.mkv
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-c4f51bf32fad2f7af8ea5beedb56168b *./tests/data/acodec/pcm_s16le.mkv
-1060638 ./tests/data/acodec/pcm_s16le.mkv
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-22c5c3df0a4765e28c205a4fb95b3cdc *./tests/data/acodec/pcm_s24be.mov
-1588193 ./tests/data/acodec/pcm_s24be.mov
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-a85380fb79b0d4fff38e24ac1e34bb94 *./tests/data/acodec/pcm_s24le.wav
-1587668 ./tests/data/acodec/pcm_s24le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-b36ac7a1b4fc28248a565a676e555bd1 *./tests/data/acodec/pcm_s32be.mov
-2117393 ./tests/data/acodec/pcm_s32be.mov
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-da6ed80f4f40f0082577dea80827e014 *./tests/data/acodec/pcm_s32le.wav
-2116868 ./tests/data/acodec/pcm_s32le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-118ff3dc83c62ce9ce669eef57e55bb2 *./tests/data/acodec/pcm_f32be.au
-2116824 ./tests/data/acodec/pcm_f32be.au
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-46f44f86a18984a832206ab9e29a79f2 *./tests/data/acodec/pcm_f32le.wav
-2116880 ./tests/data/acodec/pcm_f32le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-8112296b1ed94f72f20d04b1a54850a7 *./tests/data/acodec/pcm_f64be.au
-4233624 ./tests/data/acodec/pcm_f64be.au
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-ba17c6d1a270e1333e981f239bf7eb45 *./tests/data/acodec/pcm_f64le.wav
-4233680 ./tests/data/acodec/pcm_f64le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
-1b75d5198ae789ab3c48f7024e08f4a9 *./tests/data/acodec/pcm_s24daud.302
-10368730 ./tests/data/acodec/pcm_s24daud.302
-4708f86529c594e29404603c64bb208c *./tests/data/pcm.acodec.out.wav
-stddev: 8967.92 PSNR: 17.28 MAXDIFF:42548 bytes: 6911796/ 1058400
diff --git a/tests/ref/acodec/pcm_alaw b/tests/ref/acodec/pcm_alaw
new file mode 100644
index 0000000000..4943831d39
--- /dev/null
+++ b/tests/ref/acodec/pcm_alaw
@@ -0,0 +1,4 @@
+ede2da07839a00c255a43129922f2c7b *./tests/data/acodec/pcm_alaw.wav
+529258 ./tests/data/acodec/pcm_alaw.wav
+f323f7551ffad91de8613f44dcb198b6 *./tests/data/pcm_alaw.acodec.out.wav
+stddev: 101.67 PSNR: 56.19 MAXDIFF: 515 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_f32be b/tests/ref/acodec/pcm_f32be
new file mode 100644
index 0000000000..5f067c2dfb
--- /dev/null
+++ b/tests/ref/acodec/pcm_f32be
@@ -0,0 +1,4 @@
+118ff3dc83c62ce9ce669eef57e55bb2 *./tests/data/acodec/pcm_f32be.au
+2116824 ./tests/data/acodec/pcm_f32be.au
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f32be.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_f32le b/tests/ref/acodec/pcm_f32le
new file mode 100644
index 0000000000..38e5c0b719
--- /dev/null
+++ b/tests/ref/acodec/pcm_f32le
@@ -0,0 +1,4 @@
+46f44f86a18984a832206ab9e29a79f2 *./tests/data/acodec/pcm_f32le.wav
+2116880 ./tests/data/acodec/pcm_f32le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f32le.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_f64be b/tests/ref/acodec/pcm_f64be
new file mode 100644
index 0000000000..9abdabc747
--- /dev/null
+++ b/tests/ref/acodec/pcm_f64be
@@ -0,0 +1,4 @@
+8112296b1ed94f72f20d04b1a54850a7 *./tests/data/acodec/pcm_f64be.au
+4233624 ./tests/data/acodec/pcm_f64be.au
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f64be.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_f64le b/tests/ref/acodec/pcm_f64le
new file mode 100644
index 0000000000..42875a8d2f
--- /dev/null
+++ b/tests/ref/acodec/pcm_f64le
@@ -0,0 +1,4 @@
+ba17c6d1a270e1333e981f239bf7eb45 *./tests/data/acodec/pcm_f64le.wav
+4233680 ./tests/data/acodec/pcm_f64le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f64le.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_mulaw b/tests/ref/acodec/pcm_mulaw
new file mode 100644
index 0000000000..cefd76ba49
--- /dev/null
+++ b/tests/ref/acodec/pcm_mulaw
@@ -0,0 +1,4 @@
+0c2a55850fb46ad5385a69b15b271f10 *./tests/data/acodec/pcm_mulaw.wav
+529258 ./tests/data/acodec/pcm_mulaw.wav
+7ae8c3fc804bd574006fd547fe28980c *./tests/data/pcm_mulaw.acodec.out.wav
+stddev: 103.38 PSNR: 56.04 MAXDIFF: 644 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_s16be b/tests/ref/acodec/pcm_s16be
new file mode 100644
index 0000000000..53c4b43704
--- /dev/null
+++ b/tests/ref/acodec/pcm_s16be
@@ -0,0 +1,4 @@
+9686b93d1439fc2df991a004ab0298f4 *./tests/data/acodec/pcm_s16be.mov
+1058993 ./tests/data/acodec/pcm_s16be.mov
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s16be.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_s16le b/tests/ref/acodec/pcm_s16le
new file mode 100644
index 0000000000..c7b5de7b92
--- /dev/null
+++ b/tests/ref/acodec/pcm_s16le
@@ -0,0 +1,4 @@
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/acodec/pcm_s16le.wav
+1058446 ./tests/data/acodec/pcm_s16le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s16le.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_s24be b/tests/ref/acodec/pcm_s24be
new file mode 100644
index 0000000000..743183e337
--- /dev/null
+++ b/tests/ref/acodec/pcm_s24be
@@ -0,0 +1,4 @@
+22c5c3df0a4765e28c205a4fb95b3cdc *./tests/data/acodec/pcm_s24be.mov
+1588193 ./tests/data/acodec/pcm_s24be.mov
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s24be.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_s24daud b/tests/ref/acodec/pcm_s24daud
new file mode 100644
index 0000000000..62c4421908
--- /dev/null
+++ b/tests/ref/acodec/pcm_s24daud
@@ -0,0 +1,4 @@
+1b75d5198ae789ab3c48f7024e08f4a9 *./tests/data/acodec/pcm_s24daud.302
+10368730 ./tests/data/acodec/pcm_s24daud.302
+4708f86529c594e29404603c64bb208c *./tests/data/pcm_s24daud.acodec.out.wav
+stddev: 8967.92 PSNR: 17.28 MAXDIFF:42548 bytes: 6911796/ 1058400
diff --git a/tests/ref/acodec/pcm_s24le b/tests/ref/acodec/pcm_s24le
new file mode 100644
index 0000000000..a724e8c189
--- /dev/null
+++ b/tests/ref/acodec/pcm_s24le
@@ -0,0 +1,4 @@
+a85380fb79b0d4fff38e24ac1e34bb94 *./tests/data/acodec/pcm_s24le.wav
+1587668 ./tests/data/acodec/pcm_s24le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s24le.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_s32be b/tests/ref/acodec/pcm_s32be
new file mode 100644
index 0000000000..e2fbd3ba5a
--- /dev/null
+++ b/tests/ref/acodec/pcm_s32be
@@ -0,0 +1,4 @@
+b36ac7a1b4fc28248a565a676e555bd1 *./tests/data/acodec/pcm_s32be.mov
+2117393 ./tests/data/acodec/pcm_s32be.mov
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s32be.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_s32le b/tests/ref/acodec/pcm_s32le
new file mode 100644
index 0000000000..86777505f5
--- /dev/null
+++ b/tests/ref/acodec/pcm_s32le
@@ -0,0 +1,4 @@
+da6ed80f4f40f0082577dea80827e014 *./tests/data/acodec/pcm_s32le.wav
+2116868 ./tests/data/acodec/pcm_s32le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s32le.acodec.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_s8 b/tests/ref/acodec/pcm_s8
new file mode 100644
index 0000000000..34e5149f78
--- /dev/null
+++ b/tests/ref/acodec/pcm_s8
@@ -0,0 +1,4 @@
+b78d2a30df75af08ecf86f201281fec2 *./tests/data/acodec/pcm_s8.mov
+529793 ./tests/data/acodec/pcm_s8.mov
+651d4eb8d98dfcdda96ae6c43d8f156b *./tests/data/pcm_s8.acodec.out.wav
+stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400
diff --git a/tests/ref/acodec/pcm_u8 b/tests/ref/acodec/pcm_u8
new file mode 100644
index 0000000000..e8d70c93e9
--- /dev/null
+++ b/tests/ref/acodec/pcm_u8
@@ -0,0 +1,4 @@
+70fecbae732f81143a560c7315eda49a *./tests/data/acodec/pcm_u8.wav
+529246 ./tests/data/acodec/pcm_u8.wav
+651d4eb8d98dfcdda96ae6c43d8f156b *./tests/data/pcm_u8.acodec.out.wav
+stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400
diff --git a/tests/ref/seek/pcm_s16be_mkv b/tests/ref/seek/pcm_s16be_mkv
deleted file mode 100644
index 8889c423b7..0000000000
--- a/tests/ref/seek/pcm_s16be_mkv
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.881000 pts: 1.881000 pos: 332755 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.789000 pts: 0.789000 pos: 139914 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.577000 pts: 2.577000 pos: 455845 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.463000 pts: 1.463000 pos: 258901 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.365000
-ret: 0 st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos: 66060 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.741000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.159000 pts: 2.159000 pos: 381991 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.045000 pts: 1.045000 pos: 185047 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.058000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.836000
-ret: 0 st: 0 flags:1 dts: 2.833000 pts: 2.833000 pos: 500978 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.741000 pts: 1.741000 pos: 308137 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.604000 pts: 0.604000 pos: 107090 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 0 flags:1 dts: 2.392000 pts: 2.392000 pos: 423021 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.324000 pts: 1.324000 pos: 234283 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos: 33236 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.905000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.989000
-ret: 0 st: 0 flags:1 dts: 1.974000 pts: 1.974000 pos: 349167 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.906000 pts: 0.906000 pos: 160429 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st: 0 flags:0 ts: 2.672000
-ret: 0 st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 476360 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.566000
-ret: 0 st: 0 flags:1 dts: 1.556000 pts: 1.556000 pos: 275313 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos: 82472 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
diff --git a/tests/ref/seek/pcm_s16le_mkv b/tests/ref/seek/pcm_s16le_mkv
deleted file mode 100644
index 8889c423b7..0000000000
--- a/tests/ref/seek/pcm_s16le_mkv
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.881000 pts: 1.881000 pos: 332755 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.789000 pts: 0.789000 pos: 139914 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.577000 pts: 2.577000 pos: 455845 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.463000 pts: 1.463000 pos: 258901 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.365000
-ret: 0 st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos: 66060 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.741000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.159000 pts: 2.159000 pos: 381991 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.045000 pts: 1.045000 pos: 185047 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.058000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.836000
-ret: 0 st: 0 flags:1 dts: 2.833000 pts: 2.833000 pos: 500978 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.741000 pts: 1.741000 pos: 308137 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.604000 pts: 0.604000 pos: 107090 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 0 flags:1 dts: 2.392000 pts: 2.392000 pos: 423021 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.324000 pts: 1.324000 pos: 234283 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos: 33236 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.905000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.989000
-ret: 0 st: 0 flags:1 dts: 1.974000 pts: 1.974000 pos: 349167 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.906000 pts: 0.906000 pos: 160429 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096
-ret: 0 st: 0 flags:0 ts: 2.672000
-ret: 0 st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 476360 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.566000
-ret: 0 st: 0 flags:1 dts: 1.556000 pts: 1.556000 pos: 275313 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos: 82472 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 412 size: 4096