diff --git a/cmdutils.h b/cmdutils.h
index 2266ee132ec00f02660f139c8883f33adc2e6e06..07a8d32a2caba481a24a7f18d7a7e639abaa2dbc 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -370,7 +370,6 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
 FILE *get_preset_file(char *filename, size_t filename_size,
                       const char *preset_name, int is_path, const char *codec_name);
 
-
 /**
  * Do all the necessary cleanup and abort.
  * This function is implemented in the avtools, not cmdutils.
diff --git a/configure b/configure
index facf1d88d3d38e6f9c1fc8782219a8bcd457b49a..d534ffd47f930602d16ccfd4873e195570522b70 100755
--- a/configure
+++ b/configure
@@ -1217,6 +1217,7 @@ HAVE_LIST="
     memalign
     mkstemp
     mmap
+    netinet_sctp_h
     PeekNamedPipe
     poll_h
     posix_memalign
@@ -1662,6 +1663,7 @@ mmst_protocol_deps="network"
 rtmp_protocol_deps="!librtmp_protocol"
 rtmp_protocol_select="tcp_protocol"
 rtp_protocol_select="udp_protocol"
+sctp_protocol_deps="network netinet_sctp_h"
 tcp_protocol_deps="network"
 tls_protocol_deps_any="openssl gnutls"
 tls_protocol_select="tcp_protocol"
@@ -1707,7 +1709,7 @@ ffplay_select="buffersink_filter rdft"
 ffprobe_deps="avcodec avformat"
 ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
 ffserver_extralibs='$ldl'
-ffmpeg_deps="avcodec avfilter avformat swscale swresample"
+ffmpeg_deps="avcodec avfilter avformat swscale swresample format_filter"
 ffmpeg_select="buffersink_filter"
 
 doc_deps="texi2html"
@@ -3060,6 +3062,7 @@ if enabled network; then
     check_type netinet/in.h "struct sockaddr_in6"
     check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
     check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
+    check_header netinet/sctp.h
     # Prefer arpa/inet.h over winsock2
     if check_header arpa/inet.h ; then
         check_func closesocket
diff --git a/doc/APIchanges b/doc/APIchanges
index eb7044984451a766397e789ade7a4dd0397d0c3a..57537228b11a3730a6f9a490aa128d446dfdd282 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -24,6 +24,12 @@ API changes, most recent first:
 2012-03-26 - a67d9cf - lavfi 2.66.100
   Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
 
+2012-xx-xx - xxxxxxx - lavc 54.13.1
+  For audio formats with fixed frame size, the last frame
+  no longer needs to be padded with silence, libavcodec
+  will handle this internally (effectively all encoders
+  behave as if they had CODEC_CAP_SMALL_LAST_FRAME set).
+
 2012-xx-xx - xxxxxxx - lavr 0.0.1
   Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8.
 
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 75d5c1965d39f1b6af9e906f4628b9617c903b03..00a27373a7f53377f0139b5a3cff9d86ce2541d6 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -938,7 +938,7 @@ frame rate or decrease the frame size.
 @item
 If your computer is not fast enough, you can speed up the
 compression at the expense of the compression ratio. You can use
-'-me zero' to speed up motion estimation, and '-intra' to disable
+'-me zero' to speed up motion estimation, and '-g 0' to disable
 motion estimation completely (you have only I-frames, which means it
 is about as good as JPEG compression).
 
diff --git a/ffmpeg.c b/ffmpeg.c
index 39de517c1ed0d204a55a17a248e35577c8ecd746..c5d78fe6d2a7109b16c97b11986d92eea1d43e2b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -704,21 +704,34 @@ static enum PixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum Pixe
     return target;
 }
 
-static const enum PixelFormat *choose_pixel_fmts(OutputStream *ost)
+static char *choose_pixel_fmts(OutputStream *ost)
 {
     if (ost->st->codec->pix_fmt != PIX_FMT_NONE) {
-        ost->pix_fmts[0] = choose_pixel_fmt(ost->st, ost->enc, ost->st->codec->pix_fmt);
-        return ost->pix_fmts;
+        return av_strdup(av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc, ost->st->codec->pix_fmt)));
     } else if (ost->enc->pix_fmts) {
+        const enum PixelFormat *p;
+        AVIOContext *s = NULL;
+        uint8_t *ret;
+        int len;
+
+        if (avio_open_dyn_buf(&s) < 0)
+            exit_program(1);
+
+        p = ost->enc->pix_fmts;
         if (ost->st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
             if (ost->st->codec->codec_id == CODEC_ID_MJPEG) {
-                return (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE };
+                p = (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE };
             } else if (ost->st->codec->codec_id == CODEC_ID_LJPEG) {
-                return (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P,
+                p = (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P,
                                                     PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE };
             }
         }
-        return ost->enc->pix_fmts;
+
+        for (; *p != PIX_FMT_NONE; p++)
+            avio_printf(s, "%s:", av_get_pix_fmt_name(*p));
+        len = avio_close_dyn_buf(s, &ret);
+        ret[len - 1] = 0;
+        return ret;
     } else
         return NULL;
 }
@@ -727,10 +740,10 @@ static int configure_video_filters(FilterGraph *fg)
 {
     InputStream  *ist = fg->inputs[0]->ist;
     OutputStream *ost = fg->outputs[0]->ost;
-    AVFilterContext *last_filter, *filter;
+    AVFilterContext *in_filter, *out_filter, *filter;
     AVCodecContext *codec = ost->st->codec;
-    enum PixelFormat *pix_fmts = choose_pixel_fmts(ost);
     AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
+    char *pix_fmts;
     AVRational sample_aspect_ratio;
     char args[255];
     int ret;
@@ -756,18 +769,20 @@ static int configure_video_filters(FilterGraph *fg)
         return ret;
 
 #if FF_API_OLD_VSINK_API
-    ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, avfilter_get_by_name("buffersink"),
-                                       "out", NULL, pix_fmts, fg->graph);
+    ret = avfilter_graph_create_filter(&fg->outputs[0]->filter,
+                                       avfilter_get_by_name("buffersink"),
+                                       "out", NULL, NULL, fg->graph);
 #else
-    buffersink_params->pixel_fmts = pix_fmts;
-    ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, avfilter_get_by_name("buffersink"),
+    ret = avfilter_graph_create_filter(&fg->outputs[0]->filter,
+                                       avfilter_get_by_name("buffersink"),
                                        "out", NULL, buffersink_params, fg->graph);
 #endif
     av_freep(&buffersink_params);
 
     if (ret < 0)
         return ret;
-    last_filter = fg->inputs[0]->filter;
+    in_filter  = fg->inputs[0]->filter;
+    out_filter = fg->outputs[0]->filter;
 
     if (codec->width || codec->height) {
         snprintf(args, 255, "%d:%d:flags=0x%X",
@@ -777,9 +792,22 @@ static int configure_video_filters(FilterGraph *fg)
         if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
                                                 NULL, args, NULL, fg->graph)) < 0)
             return ret;
-        if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0)
+        if ((ret = avfilter_link(in_filter, 0, filter, 0)) < 0)
             return ret;
-        last_filter = filter;
+        in_filter = filter;
+    }
+
+    if ((pix_fmts = choose_pixel_fmts(ost))) {
+        if ((ret = avfilter_graph_create_filter(&filter,
+                                                avfilter_get_by_name("format"),
+                                                "format", pix_fmts, NULL,
+                                                fg->graph)) < 0)
+            return ret;
+        if ((ret = avfilter_link(filter, 0, out_filter, 0)) < 0)
+            return ret;
+
+        out_filter = filter;
+        av_freep(&pix_fmts);
     }
 
     snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags);
@@ -790,12 +818,12 @@ static int configure_video_filters(FilterGraph *fg)
         AVFilterInOut *inputs  = avfilter_inout_alloc();
 
         outputs->name    = av_strdup("in");
-        outputs->filter_ctx = last_filter;
+        outputs->filter_ctx = in_filter;
         outputs->pad_idx = 0;
         outputs->next    = NULL;
 
         inputs->name    = av_strdup("out");
-        inputs->filter_ctx = fg->outputs[0]->filter;
+        inputs->filter_ctx = out_filter;
         inputs->pad_idx = 0;
         inputs->next    = NULL;
 
@@ -803,7 +831,7 @@ static int configure_video_filters(FilterGraph *fg)
             return ret;
         av_freep(&ost->avfilter);
     } else {
-        if ((ret = avfilter_link(last_filter, 0, fg->outputs[0]->filter, 0)) < 0)
+        if ((ret = avfilter_link(in_filter, 0, out_filter, 0)) < 0)
             return ret;
     }
 
@@ -919,19 +947,20 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
 
 static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
 {
+    char *pix_fmts;
     AVCodecContext *codec = ofilter->ost->st->codec;
     AVFilterContext *last_filter = out->filter_ctx;
     int pad_idx = out->pad_idx;
     int ret;
-    enum PixelFormat *pix_fmts = choose_pixel_fmts(ofilter->ost);
     AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
 
 #if FF_API_OLD_VSINK_API
-    ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"),
-                                       "out", NULL, pix_fmts, fg->graph);
+    ret = avfilter_graph_create_filter(&ofilter->filter,
+                                       avfilter_get_by_name("buffersink"),
+                                       "out", NULL, NULL, fg->graph);
 #else
-    buffersink_params->pixel_fmts = pix_fmts;
-    ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"),
+    ret = avfilter_graph_create_filter(&ofilter->filter,
+                                       avfilter_get_by_name("buffersink"),
                                        "out", NULL, buffersink_params, fg->graph);
 #endif
     av_freep(&buffersink_params);
@@ -941,18 +970,37 @@ static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFil
 
     if (codec->width || codec->height) {
         char args[255];
+        AVFilterContext *filter;
+
         snprintf(args, sizeof(args), "%d:%d:flags=0x%X",
                  codec->width,
                  codec->height,
                  (unsigned)ofilter->ost->sws_flags);
-        if ((ret = avfilter_graph_create_filter(&last_filter, avfilter_get_by_name("scale"),
+        if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
                                                 NULL, args, NULL, fg->graph)) < 0)
             return ret;
-        if ((ret = avfilter_link(out->filter_ctx, out->pad_idx, last_filter, 0)) < 0)
+        if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
             return ret;
+
+        last_filter = filter;
         pad_idx = 0;
     }
 
+    if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) {
+        AVFilterContext *filter;
+        if ((ret = avfilter_graph_create_filter(&filter,
+                                                avfilter_get_by_name("format"),
+                                                "format", pix_fmts, NULL,
+                                                fg->graph)) < 0)
+            return ret;
+        if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
+            return ret;
+
+        last_filter = filter;
+        pad_idx     = 0;
+        av_freep(&pix_fmts);
+    }
+
     if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)
         return ret;
 
@@ -2299,14 +2347,6 @@ static void flush_encoders(void)
 
                     av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL);
 
-                    /* pad last frame with silence if needed */
-                    if (!(enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME)) {
-                        frame_bytes = enc->frame_size * enc->channels *
-                                      av_get_bytes_per_sample(enc->sample_fmt);
-                        if (allocated_audio_buf_size < frame_bytes)
-                            exit_program(1);
-                        generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes);
-                    }
                     encode_audio_frame(os, ost, audio_buf, frame_bytes);
                 } else {
                     /* flush encoder with NULL frames until it is done
diff --git a/ffplay.c b/ffplay.c
index 4015aaf8ec914c05fc2cb1d62d8448c7ac209fd4..3c5ef681c558bcedfb215b07f8531f9072c5bff2 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1747,7 +1747,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
     char sws_flags_str[128];
     int ret;
     AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
-    AVFilterContext *filt_src = NULL, *filt_out = NULL;
+    AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format;;
     snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags);
     graph->scale_sws_opts = av_strdup(sws_flags_str);
 
@@ -1756,17 +1756,27 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
         return ret;
 
 #if FF_API_OLD_VSINK_API
-    ret = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "out",
-                                       NULL, pix_fmts, graph);
+    ret = avfilter_graph_create_filter(&filt_out,
+                                       avfilter_get_by_name("buffersink"),
+                                       "out", NULL, pix_fmts, graph);
 #else
     buffersink_params->pixel_fmts = pix_fmts;
-    ret = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "out",
-                                       NULL, buffersink_params, graph);
+    ret = avfilter_graph_create_filter(&filt_out,
+                                       avfilter_get_by_name("buffersink"),
+                                       "out", NULL, buffersink_params, graph);
 #endif
     av_freep(&buffersink_params);
     if (ret < 0)
         return ret;
 
+    if ((ret = avfilter_graph_create_filter(&filt_format,
+                                            avfilter_get_by_name("format"),
+                                            "format", "yuv420p", NULL, graph)) < 0)
+        return ret;
+    if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0)
+        return ret;
+
+
     if (vfilters) {
         AVFilterInOut *outputs = avfilter_inout_alloc();
         AVFilterInOut *inputs  = avfilter_inout_alloc();
@@ -1777,14 +1787,14 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
         outputs->next    = NULL;
 
         inputs->name    = av_strdup("out");
-        inputs->filter_ctx = filt_out;
+        inputs->filter_ctx = filt_format;
         inputs->pad_idx = 0;
         inputs->next    = NULL;
 
         if ((ret = avfilter_graph_parse(graph, vfilters, &inputs, &outputs, NULL)) < 0)
             return ret;
     } else {
-        if ((ret = avfilter_link(filt_src, 0, filt_out, 0)) < 0)
+        if ((ret = avfilter_link(filt_src, 0, filt_format, 0)) < 0)
             return ret;
     }
 
@@ -1843,8 +1853,11 @@ static int video_thread(void *arg)
         if (picref) {
             avfilter_fill_frame_from_video_buffer_ref(frame, picref);
             pts_int = picref->pts;
+            tb      = filt_out->inputs[0]->time_base;
             pos     = picref->pos;
             frame->opaque = picref;
+
+            ret = 1;
         }
 
         if (ret >= 0 && av_cmp_q(tb, is->video_st->time_base)) {
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 54e79af1ca09abfb06b2b0a4375a823db78e618e..41cc9c2aba288182b3dd238f0f56612ce78ca220 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -46,6 +46,7 @@ OBJS-$(CONFIG_GOLOMB)                  += golomb.o
 OBJS-$(CONFIG_H264DSP)                 += h264dsp.o h264idct.o
 OBJS-$(CONFIG_H264PRED)                += h264pred.o
 OBJS-$(CONFIG_HUFFMAN)                 += huffman.o
+OBJS-$(CONFIG_LIBXVID)                 += libxvid_rc.o
 OBJS-$(CONFIG_LPC)                     += lpc.o
 OBJS-$(CONFIG_LSP)                     += lsp.o
 OBJS-$(CONFIG_MDCT)                    += mdct_fixed.o mdct_float.o
@@ -677,7 +678,7 @@ OBJS-$(CONFIG_LIBVPX_DECODER)             += libvpxdec.o
 OBJS-$(CONFIG_LIBVPX_ENCODER)             += libvpxenc.o
 OBJS-$(CONFIG_LIBX264_ENCODER)            += libx264.o
 OBJS-$(CONFIG_LIBXAVS_ENCODER)            += libxavs.o
-OBJS-$(CONFIG_LIBXVID)                    += libxvidff.o libxvid_rc.o
+OBJS-$(CONFIG_LIBXVID_ENCODER)            += libxvid.o
 
 # parsers
 OBJS-$(CONFIG_AAC_PARSER)              += aac_parser.o aac_ac3_parser.o \
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fd0007a63589b58d0012cf68bd9a9c2965e06658..e4d494b088b4975f44d5eab1a55bc51eb8baba27 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4044,15 +4044,11 @@ int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx,
  * @param[in] frame AVFrame containing the raw audio data to be encoded.
  *                  May be NULL when flushing an encoder that has the
  *                  CODEC_CAP_DELAY capability set.
- *                  There are 2 codec capabilities that affect the allowed
- *                  values of frame->nb_samples.
- *                  If CODEC_CAP_SMALL_LAST_FRAME is set, then only the final
- *                  frame may be smaller than avctx->frame_size, and all other
- *                  frames must be equal to avctx->frame_size.
  *                  If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
  *                  can have any number of samples.
- *                  If neither is set, frame->nb_samples must be equal to
- *                  avctx->frame_size for all frames.
+ *                  If it is not set, frame->nb_samples must be equal to
+ *                  avctx->frame_size for all frames except the last.
+ *                  The final frame may be smaller than avctx->frame_size.
  * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
  *                            output packet is non-empty, and to 0 if it is
  *                            empty. If the function returns an error, the
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 2686468545890acae4db17a7afae6c1c040f38fe..8f00695dc80e92aaf923aa4ba8a2c4afc01cd059 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -71,6 +71,12 @@ typedef struct AVCodecInternal {
     int sample_count;
 #endif
 
+    /**
+     * An audio frame with less than required samples has been submitted and
+     * padded with silence. Reject all subsequent frames.
+     */
+    int last_audio_frame;
+
     /**
      * temporary buffer used for encoders to store their bitstream
      */
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index db2158af15b0086cc33bc0539fbb6a37eda8601d..e0f6e88aa65acbd6a85807b4562a10c8457ce50f 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -51,10 +51,9 @@
  */
 int ff_jpegls_decode_lse(MJpegDecodeContext *s)
 {
-    int av_unused(len), id;
+    int id;
 
-    /* XXX: verify len field validity */
-    len = get_bits(&s->gb, 16);
+    skip_bits(&s->gb, 16);  /* length: FIXME: verify field validity */
     id = get_bits(&s->gb, 8);
 
     switch(id){
diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
index 4929eecb286cf36455799f9602845f0c35c61e34..bf6daf60ac6f008bb27fe598294f9dd1143be40f 100644
--- a/libavcodec/libschroedingerdec.c
+++ b/libavcodec/libschroedingerdec.c
@@ -28,6 +28,7 @@
 */
 
 #include "libavutil/imgutils.h"
+#include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 #include "libschroedinger.h"
 
@@ -39,6 +40,12 @@
 #include <schroedinger/schrodebug.h>
 #include <schroedinger/schrovideoformat.h>
 
+/** SchroFrame and Pts relation */
+typedef struct LibSchroFrameContext {
+     SchroFrame *frame;
+     int64_t pts;
+} LibSchroFrameContext;
+
 /** libschroedinger decoder private data */
 typedef struct SchroDecoderParams {
     /** Schroedinger video format */
@@ -60,7 +67,7 @@ typedef struct SchroDecoderParams {
     int eos_pulled;
 
     /** decoded picture */
-    AVPicture dec_pic;
+    AVFrame dec_frame;
 } SchroDecoderParams;
 
 typedef struct SchroParseUnitContext {
@@ -171,8 +178,8 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
     p_schro_params->format = schro_decoder_get_video_format(decoder);
 
     /* Tell FFmpeg about sequence details. */
-    if (av_image_check_size(p_schro_params->format->width, p_schro_params->format->height,
-                            0, avccontext) < 0) {
+    if (av_image_check_size(p_schro_params->format->width,
+                            p_schro_params->format->height, 0, avccontext) < 0) {
         av_log(avccontext, AV_LOG_ERROR, "invalid dimensions (%dx%d)\n",
                p_schro_params->format->width, p_schro_params->format->height);
         avccontext->height = avccontext->width = 0;
@@ -192,12 +199,6 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
 
     avccontext->time_base.den = p_schro_params->format->frame_rate_numerator;
     avccontext->time_base.num = p_schro_params->format->frame_rate_denominator;
-
-    if (!p_schro_params->dec_pic.data[0])
-        avpicture_alloc(&p_schro_params->dec_pic,
-                        avccontext->pix_fmt,
-                        avccontext->width,
-                        avccontext->height);
 }
 
 static int libschroedinger_decode_frame(AVCodecContext *avccontext,
@@ -206,16 +207,18 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
+    int64_t pts  = avpkt->pts;
+    SchroTag *tag;
 
     SchroDecoderParams *p_schro_params = avccontext->priv_data;
     SchroDecoder *decoder = p_schro_params->decoder;
-    AVPicture *picture = data;
     SchroBuffer *enc_buf;
     SchroFrame* frame;
     int state;
     int go = 1;
     int outer = 1;
     SchroParseUnitContext parse_ctx;
+    LibSchroFrameContext *framewithpts = NULL;
 
     *data_size = 0;
 
@@ -230,6 +233,13 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
     /* Loop through all the individual parse units in the input buffer */
     do {
         if ((enc_buf = find_next_parse_unit(&parse_ctx))) {
+            /* Set Schrotag with the pts to be recovered after decoding*/
+            enc_buf->tag = schro_tag_new(av_malloc(sizeof(int64_t)), av_free);
+            if (!enc_buf->tag->value) {
+                av_log(avccontext, AV_LOG_ERROR, "Unable to allocate SchroTag\n");
+                return AVERROR(ENOMEM);
+            }
+            AV_WN(64, enc_buf->tag->value, pts);
             /* Push buffer into decoder. */
             if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) &&
                 SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0)
@@ -263,11 +273,21 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
 
             case SCHRO_DECODER_OK:
                 /* Pull a frame out of the decoder. */
+                tag   = schro_decoder_get_picture_tag(decoder);
                 frame = schro_decoder_pull(decoder);
 
-                if (frame)
+                if (frame) {
+                    /* Add relation between schroframe and pts. */
+                    framewithpts = av_malloc(sizeof(LibSchroFrameContext));
+                    if (!framewithpts) {
+                        av_log(avccontext, AV_LOG_ERROR, "Unable to allocate FrameWithPts\n");
+                        return AVERROR(ENOMEM);
+                    }
+                    framewithpts->frame = frame;
+                    framewithpts->pts   = AV_RN64(tag->value);
                     ff_schro_queue_push_back(&p_schro_params->dec_frame_queue,
-                                             frame);
+                                             framewithpts);
+                }
                 break;
             case SCHRO_DECODER_EOS:
                 go = 0;
@@ -284,30 +304,46 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
     } while (outer);
 
     /* Grab next frame to be returned from the top of the queue. */
-    frame = ff_schro_queue_pop(&p_schro_params->dec_frame_queue);
+    framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue);
+
+    if (framewithpts && framewithpts->frame) {
+        if (p_schro_params->dec_frame.data[0])
+            avccontext->release_buffer(avccontext, &p_schro_params->dec_frame);
+        if (avccontext->get_buffer(avccontext, &p_schro_params->dec_frame) < 0) {
+            av_log(avccontext, AV_LOG_ERROR, "Unable to allocate buffer\n");
+            return AVERROR(ENOMEM);
+        }
 
-    if (frame) {
-        memcpy(p_schro_params->dec_pic.data[0],
-               frame->components[0].data,
-               frame->components[0].length);
+        memcpy(p_schro_params->dec_frame.data[0],
+               framewithpts->frame->components[0].data,
+               framewithpts->frame->components[0].length);
 
-        memcpy(p_schro_params->dec_pic.data[1],
-               frame->components[1].data,
-               frame->components[1].length);
+        memcpy(p_schro_params->dec_frame.data[1],
+               framewithpts->frame->components[1].data,
+               framewithpts->frame->components[1].length);
 
-        memcpy(p_schro_params->dec_pic.data[2],
-               frame->components[2].data,
-               frame->components[2].length);
+        memcpy(p_schro_params->dec_frame.data[2],
+               framewithpts->frame->components[2].data,
+               framewithpts->frame->components[2].length);
 
-        /* Fill picture with current buffer data from Schroedinger. */
-        avpicture_fill(picture, p_schro_params->dec_pic.data[0],
-                       avccontext->pix_fmt,
-                       avccontext->width, avccontext->height);
+        /* Fill frame with current buffer data from Schroedinger. */
+        p_schro_params->dec_frame.format  = -1; /* Unknown -1 */
+        p_schro_params->dec_frame.width   = framewithpts->frame->width;
+        p_schro_params->dec_frame.height  = framewithpts->frame->height;
+        p_schro_params->dec_frame.pkt_pts = framewithpts->pts;
+        p_schro_params->dec_frame.linesize[0] = framewithpts->frame->components[0].stride;
+        p_schro_params->dec_frame.linesize[1] = framewithpts->frame->components[1].stride;
+        p_schro_params->dec_frame.linesize[2] = framewithpts->frame->components[2].stride;
 
-        *data_size = sizeof(AVPicture);
+        *(AVFrame*)data = p_schro_params->dec_frame;
+        *data_size      = sizeof(AVFrame);
 
         /* Now free the frame resources. */
-        libschroedinger_decode_frame_free(frame);
+        libschroedinger_decode_frame_free(framewithpts->frame);
+        av_free(framewithpts);
+    } else {
+        data       = NULL;
+        *data_size = 0;
     }
     return buf_size;
 }
@@ -320,7 +356,8 @@ static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext)
     schro_decoder_free(p_schro_params->decoder);
     av_freep(&p_schro_params->format);
 
-    avpicture_free(&p_schro_params->dec_pic);
+    if (p_schro_params->dec_frame.data[0])
+        avccontext->release_buffer(avccontext, &p_schro_params->dec_frame);
 
     /* Free data in the output frame queue. */
     ff_schro_queue_free(&p_schro_params->dec_frame_queue,
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvid.c
similarity index 99%
rename from libavcodec/libxvidff.c
rename to libavcodec/libxvid.c
index 0426e9de14d993f15ac0e00424ad803d768c2f22..4b4f7824b1618d8dd32a66c2181d0a2d9d274943 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvid.c
@@ -33,7 +33,7 @@
 #include "libavutil/cpu.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
-#include "libxvid_internal.h"
+#include "libxvid.h"
 #include "mpegvideo.h"
 
 /**
@@ -82,7 +82,6 @@ struct xvid_ff_pass1 {
  * rate-control plugin.
  */
 
-
 /**
  * Initialize the two-pass plugin and context.
  *
diff --git a/libavcodec/libxvid_internal.h b/libavcodec/libxvid.h
similarity index 89%
rename from libavcodec/libxvid_internal.h
rename to libavcodec/libxvid.h
index 6517f621748118ad1902f8c3927ff2e659d50ab6..90ecd6f40b30889541fda055daaa20f5fb95997d 100644
--- a/libavcodec/libxvid_internal.h
+++ b/libavcodec/libxvid.h
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVCODEC_LIBXVID_INTERNAL_H
-#define AVCODEC_LIBXVID_INTERNAL_H
+#ifndef AVCODEC_LIBXVID_H
+#define AVCODEC_LIBXVID_H
 
 /**
  * @file
@@ -29,4 +29,4 @@
 
 int ff_tempfile(const char *prefix, char **filename);
 
-#endif /* AVCODEC_LIBXVID_INTERNAL_H */
+#endif /* AVCODEC_LIBXVID_H */
diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index 71579ebe7a9d8c0f2f530ec386900f1880bd5fdc..0f9e50e0058804dad3d77d58d436f55e8e6f734f 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -20,11 +20,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
 #include <xvid.h>
 #include <unistd.h>
 #include "libavutil/file.h"
 #include "avcodec.h"
-#include "libxvid_internal.h"
+#include "libxvid.h"
 //#include "dsputil.h"
 #include "mpegvideo.h"
 
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index c4d4277b04878777d2a704b46f6d58c20eaf0d38..92b19e23a27496fac34ed5d4ed25bc8845879c3c 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -22,6 +22,12 @@
 #ifndef AVCODEC_OPTIONS_TABLE
 #define AVCODEC_OPTIONS_TABLE
 
+#include <float.h>
+#include <limits.h>
+
+#include "libavutil/opt.h"
+#include "avcodec.h"
+
 #define OFFSET(x) offsetof(AVCodecContext,x)
 #define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
 //these names are too long to be readable
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 79b355472e60babe8bfe4a06f3651ef67533c2d3..c915de6a06ec482f24be3d331704d717a326e7e9 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1001,11 +1001,59 @@ int ff_alloc_packet(AVPacket *avpkt, int size)
     return ff_alloc_packet2(NULL, avpkt, size);
 }
 
+/**
+ * Pad last frame with silence.
+ */
+static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src)
+{
+    AVFrame *frame = NULL;
+    uint8_t *buf   = NULL;
+    int ret;
+
+    if (!(frame = avcodec_alloc_frame()))
+        return AVERROR(ENOMEM);
+    *frame = *src;
+
+    if ((ret = av_samples_get_buffer_size(&frame->linesize[0], s->channels,
+                                          s->frame_size, s->sample_fmt, 0)) < 0)
+        goto fail;
+
+    if (!(buf = av_malloc(ret))) {
+        ret = AVERROR(ENOMEM);
+        goto fail;
+    }
+
+    frame->nb_samples = s->frame_size;
+    if ((ret = avcodec_fill_audio_frame(frame, s->channels, s->sample_fmt,
+                                        buf, ret, 0)) < 0)
+        goto fail;
+    if ((ret = av_samples_copy(frame->extended_data, src->extended_data, 0, 0,
+                               src->nb_samples, s->channels, s->sample_fmt)) < 0)
+        goto fail;
+    if ((ret = av_samples_set_silence(frame->extended_data, src->nb_samples,
+                                      frame->nb_samples - src->nb_samples,
+                                      s->channels, s->sample_fmt)) < 0)
+        goto fail;
+
+    *dst = frame;
+
+    return 0;
+
+fail:
+    if (frame->extended_data != frame->data)
+        av_freep(&frame->extended_data);
+    av_freep(&buf);
+    av_freep(&frame);
+    return ret;
+}
+
 int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
                                               AVPacket *avpkt,
                                               const AVFrame *frame,
                                               int *got_packet_ptr)
 {
+    AVFrame tmp;
+    AVFrame *padded_frame = NULL;
     int ret;
     AVPacket user_pkt = *avpkt;
     int needs_realloc = !user_pkt.data;
@@ -1018,12 +1066,38 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
         return 0;
     }
 
+    /* ensure that extended_data is properly set */
+    if (frame && !frame->extended_data) {
+        if (av_sample_fmt_is_planar(avctx->sample_fmt) &&
+            avctx->channels > AV_NUM_DATA_POINTERS) {
+            av_log(avctx, AV_LOG_ERROR, "Encoding to a planar sample format, "
+                   "with more than %d channels, but extended_data is not set.\n",
+                   AV_NUM_DATA_POINTERS);
+            return AVERROR(EINVAL);
+        }
+        av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n");
+
+        tmp = *frame;
+        tmp.extended_data = tmp.data;
+        frame = &tmp;
+    }
+
     /* check for valid frame size */
     if (frame) {
         if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
             if (frame->nb_samples > avctx->frame_size)
                 return AVERROR(EINVAL);
         } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) {
+            if (frame->nb_samples < avctx->frame_size &&
+                !avctx->internal->last_audio_frame) {
+                ret = pad_last_frame(avctx, &padded_frame, frame);
+                if (ret < 0)
+                    return ret;
+
+                frame = padded_frame;
+                avctx->internal->last_audio_frame = 1;
+            }
+
             if (frame->nb_samples != avctx->frame_size)
                 return AVERROR(EINVAL);
         }
@@ -1084,6 +1158,13 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
              here to simplify things */
     avpkt->flags |= AV_PKT_FLAG_KEY;
 
+    if (padded_frame) {
+        av_freep(&padded_frame->data[0]);
+        if (padded_frame->extended_data != padded_frame->data)
+            av_freep(&padded_frame->extended_data);
+        av_freep(&padded_frame);
+    }
+
     return ret;
 }
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0ee3fd016bf25a73ca72139fe6c44ef9f0a01d65..a9fa31ac4813204ff9ac7e7835e87821a01524cb 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 54
 #define LIBAVCODEC_VERSION_MINOR  21
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 7da07eb76aed9fece662ea709c75fb811bff206d..0647772128f136c192b7711e01e4ab2153e96cbd 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -23,6 +23,7 @@ HEADERS = asrc_abuffer.h                                                \
 OBJS = allfilters.o                                                     \
        avfilter.o                                                       \
        avfiltergraph.o                                                  \
+       buffersink.o                                                     \
        defaults.o                                                       \
        drawutils.o                                                      \
        formats.o                                                        \
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 96de563606281a793f2fd0275513369dcbcc44e4..e4f82c96c5b7fff7b2c0a0cfaf64bcfc0a67e846 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -128,6 +128,10 @@ void avfilter_register_all(void)
         extern AVFilter avfilter_vsrc_buffer;
         avfilter_register(&avfilter_vsrc_buffer);
     }
+    {
+        extern AVFilter avfilter_vsink_buffer;
+        avfilter_register(&avfilter_vsink_buffer);
+    }
     {
         extern AVFilter avfilter_vf_scale;
         avfilter_register(&avfilter_vf_scale);
diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index a63c2a3c952bd0367ec4c654294e8ac2b7af8f18..b71cf97f70f293eaff53795f3f7522e66ae4e577 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -51,6 +51,50 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
     return 0;
 }
 
+int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
+{
+    int planes, nb_channels;
+
+    memcpy(dst->data, src->data, sizeof(dst->data));
+    memcpy(dst->linesize, src->linesize, sizeof(dst->linesize));
+
+    dst->pts     = src->pts;
+    dst->format  = src->format;
+
+    switch (src->type) {
+    case AVMEDIA_TYPE_VIDEO:
+        dst->width               = src->video->w;
+        dst->height              = src->video->h;
+        dst->sample_aspect_ratio = src->video->sample_aspect_ratio;
+        dst->interlaced_frame    = src->video->interlaced;
+        dst->top_field_first     = src->video->top_field_first;
+        dst->key_frame           = src->video->key_frame;
+        dst->pict_type           = src->video->pict_type;
+        break;
+    case AVMEDIA_TYPE_AUDIO:
+        nb_channels = av_get_channel_layout_nb_channels(src->audio->channel_layout);
+        planes      = av_sample_fmt_is_planar(src->format) ? nb_channels : 1;
+
+        if (planes > FF_ARRAY_ELEMS(dst->data)) {
+            dst->extended_data = av_mallocz(planes * sizeof(*dst->extended_data));
+            if (!dst->extended_data)
+                return AVERROR(ENOMEM);
+            memcpy(dst->extended_data, src->extended_data,
+                   planes * sizeof(dst->extended_data));
+        } else
+            dst->extended_data = dst->data;
+
+        dst->sample_rate         = src->audio->sample_rate;
+        dst->channel_layout      = src->audio->channel_layout;
+        dst->nb_samples          = src->audio->nb_samples;
+        break;
+    default:
+        return AVERROR(EINVAL);
+    }
+
+    return 0;
+}
+
 AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame,
                                                             int perms)
 {
diff --git a/libavfilter/avcodec.h b/libavfilter/avcodec.h
index cec847146fac5e0d0aac53286b7d212683edeb60..9636cfd1bc3943e4591c182044f18c5423d85492 100644
--- a/libavfilter/avcodec.h
+++ b/libavfilter/avcodec.h
@@ -35,9 +35,19 @@
 /**
  * Copy the frame properties of src to dst, without copying the actual
  * image data.
+ *
+ * @return 0 on success, a negative number on error.
  */
 int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
 
+/**
+ * Copy the frame properties and data pointers of src to dst, without copying
+ * the actual data.
+ *
+ * @return 0 on success, a negative number on error.
+ */
+int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src);
+
 /**
  * Create and return a picref reference from the data and properties
  * contained in frame.
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 99b97dfc5c2605848a4d58e131bf01904c9404d8..89afee060f8e3dfb95d99219295d75326d21fe16 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -68,6 +68,7 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
             return NULL;
         }
         *ret->video = *ref->video;
+        ret->extended_data = ret->data;
     } else if (ref->type == AVMEDIA_TYPE_AUDIO) {
         ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps));
         if (!ret->audio) {
@@ -75,6 +76,19 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
             return NULL;
         }
         *ret->audio = *ref->audio;
+
+        if (ref->extended_data != ref->data) {
+            int nb_channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout);
+            if (!(ret->extended_data = av_malloc(sizeof(*ret->extended_data) *
+                                                 nb_channels))) {
+                av_freep(&ret->audio);
+                av_freep(&ret);
+                return NULL;
+            }
+            memcpy(ret->extended_data, ref->extended_data,
+                   sizeof(*ret->extended_data) * nb_channels);
+        } else
+            ret->extended_data = ret->data;
     }
     ret->perms &= pmask;
     ret->buf->refcount ++;
@@ -155,6 +169,8 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref)
         }
         ref->buf->free(ref->buf);
     }
+    if (ref->extended_data != ref->data)
+        av_freep(&ref->extended_data);
     av_freep(&ref->video);
     av_freep(&ref->audio);
     av_free(ref);
@@ -472,6 +488,9 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int lin
     memcpy(picref->data,     pic->data,     sizeof(picref->data));
     memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));
 
+    pic->   extended_data = pic->data;
+    picref->extended_data = picref->data;
+
     return picref;
 
 fail:
@@ -541,6 +560,74 @@ fail:
     return NULL;
 }
 
+AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays_alt(uint8_t **data,
+                                                             int linesize, int perms,
+                                                             int nb_samples,
+                                                             enum AVSampleFormat sample_fmt,
+                                                             uint64_t channel_layout)
+{
+    int planes;
+    AVFilterBuffer    *samples    = av_mallocz(sizeof(*samples));
+    AVFilterBufferRef *samplesref = av_mallocz(sizeof(*samplesref));
+
+    if (!samples || !samplesref)
+        goto fail;
+
+    samplesref->buf         = samples;
+    samplesref->buf->free   = ff_avfilter_default_free_buffer;
+    if (!(samplesref->audio = av_mallocz(sizeof(*samplesref->audio))))
+        goto fail;
+
+    samplesref->audio->nb_samples     = nb_samples;
+    samplesref->audio->channel_layout = channel_layout;
+    samplesref->audio->planar         = av_sample_fmt_is_planar(sample_fmt);
+
+    planes = samplesref->audio->planar ? av_get_channel_layout_nb_channels(channel_layout) : 1;
+
+    /* make sure the buffer gets read permission or it's useless for output */
+    samplesref->perms = perms | AV_PERM_READ;
+
+    samples->refcount  = 1;
+    samplesref->type   = AVMEDIA_TYPE_AUDIO;
+    samplesref->format = sample_fmt;
+
+    memcpy(samples->data, data,
+           FFMIN(FF_ARRAY_ELEMS(samples->data), planes)*sizeof(samples->data[0]));
+    memcpy(samplesref->data, samples->data, sizeof(samples->data));
+
+    samples->linesize[0] = samplesref->linesize[0] = linesize;
+
+    if (planes > FF_ARRAY_ELEMS(samples->data)) {
+        samples->   extended_data = av_mallocz(sizeof(*samples->extended_data) *
+                                               planes);
+        samplesref->extended_data = av_mallocz(sizeof(*samplesref->extended_data) *
+                                               planes);
+
+        if (!samples->extended_data || !samplesref->extended_data)
+            goto fail;
+
+        memcpy(samples->   extended_data, data, sizeof(*data)*planes);
+        memcpy(samplesref->extended_data, data, sizeof(*data)*planes);
+    } else {
+        samples->extended_data    = samples->data;
+        samplesref->extended_data = samplesref->data;
+    }
+
+    return samplesref;
+
+fail:
+    if (samples && samples->extended_data != samples->data)
+        av_freep(&samples->extended_data);
+    if (samplesref) {
+        av_freep(&samplesref->audio);
+        if (samplesref->extended_data != samplesref->data)
+            av_freep(&samplesref->extended_data);
+    }
+    av_freep(&samplesref);
+    av_freep(&samples);
+    return NULL;
+}
+
 int avfilter_request_frame(AVFilterLink *link)
 {
     FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index c526df4a9f8727e476939b066ea7d0ef77491518..d7d4c16ec0a638f38091f41e297181f12eb3b5de 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -84,6 +84,22 @@ typedef struct AVFilterBuffer {
 
     int format;                 ///< media format
     int w, h;                   ///< width and height of the allocated buffer
+
+    /**
+     * pointers to the data planes/channels.
+     *
+     * For video, this should simply point to data[].
+     *
+     * For planar audio, each channel has a separate data pointer, and
+     * linesize[0] contains the size of each channel buffer.
+     * For packed audio, there is just one data pointer, and linesize[0]
+     * contains the total size of the buffer for all channels.
+     *
+     * Note: Both data and extended_data will always be set, but for planar
+     * audio with more channels that can fit in data, extended_data must be used
+     * in order to access all channels.
+     */
+    uint8_t **extended_data;
 } AVFilterBuffer;
 
 #define AV_PERM_READ     0x01   ///< can read from the buffer
@@ -150,6 +166,22 @@ typedef struct AVFilterBufferRef {
     enum AVMediaType type;      ///< media type of buffer data
     AVFilterBufferRefVideoProps *video; ///< video buffer specific properties
     AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties
+
+    /**
+     * pointers to the data planes/channels.
+     *
+     * For video, this should simply point to data[].
+     *
+     * For planar audio, each channel has a separate data pointer, and
+     * linesize[0] contains the size of each channel buffer.
+     * For packed audio, there is just one data pointer, and linesize[0]
+     * contains the total size of the buffer for all channels.
+     *
+     * Note: Both data and extended_data will always be set, but for planar
+     * audio with more channels that can fit in data, extended_data must be used
+     * in order to access all channels.
+     */
+    uint8_t **extended_data;
 } AVFilterBufferRef;
 
 /**
@@ -783,10 +815,31 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
  * @param channel_layout the channel layout of the buffer
  * @param planar         audio data layout - planar or packed
  */
-AVFilterBufferRef *
-avfilter_get_audio_buffer_ref_from_arrays(uint8_t *data[8], int linesize[8], int perms,
-                                          int nb_samples, enum AVSampleFormat sample_fmt,
-                                          uint64_t channel_layout, int planar);
+AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(uint8_t *data[8],
+                                                             int linesize[8],
+                                                             int perms,
+                                                             int nb_samples,
+                                                             enum AVSampleFormat sample_fmt,
+                                                             uint64_t channel_layout,
+                                                             int planar);
+/**
+ * Create an audio buffer reference wrapped around an already
+ * allocated samples buffer.
+ *
+ * @param data           pointers to the samples plane buffers
+ * @param linesize       linesize for the samples plane buffers
+ * @param perms          the required access permissions
+ * @param nb_samples     number of samples per channel
+ * @param sample_fmt     the format of each sample in the buffer to allocate
+ * @param channel_layout the channel layout of the buffer
+ */
+AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays_alt(uint8_t **data,
+                                                             int linesize,
+                                                             int perms,
+                                                             int nb_samples,
+                                                             enum AVSampleFormat sample_fmt,
+                                                             uint64_t channel_layout);
+
 /**
  * Request an input frame from the filter at the other end of the link.
  *
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
new file mode 100644
index 0000000000000000000000000000000000000000..f0fcab553e465a4634c36de00cb3ebcd3073b810
--- /dev/null
+++ b/libavfilter/buffersink.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2011 Stefano Sabatini
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * buffer sink
+ */
+
+#include "libavutil/fifo.h"
+
+#include "avfilter.h"
+#include "buffersink.h"
+
+typedef struct {
+    AVFifoBuffer *fifo;          ///< FIFO buffer of video frame references
+} BufferSinkContext;
+
+#define FIFO_INIT_SIZE 8
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+    BufferSinkContext *sink = ctx->priv;
+
+    while (sink->fifo && av_fifo_size(sink->fifo)) {
+        AVFilterBufferRef *buf;
+        av_fifo_generic_read(sink->fifo, &buf, sizeof(buf), NULL);
+        avfilter_unref_buffer(buf);
+    }
+    av_fifo_free(sink->fifo);
+}
+
+static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+{
+    BufferSinkContext *sink = ctx->priv;
+
+    if (!(sink->fifo = av_fifo_alloc(FIFO_INIT_SIZE*sizeof(AVFilterBufferRef*)))) {
+        av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n");
+        return AVERROR(ENOMEM);
+    }
+
+    return 0;
+}
+
+static void end_frame(AVFilterLink *link)
+{
+    AVFilterContext   *ctx = link->dst;
+    BufferSinkContext *sink = ctx->priv;
+
+    if (av_fifo_space(sink->fifo) < sizeof(AVFilterBufferRef *) &&
+        (av_fifo_realloc2(sink->fifo, av_fifo_size(sink->fifo) * 2) < 0)) {
+            av_log(ctx, AV_LOG_ERROR, "Error reallocating the FIFO.\n");
+            return;
+    }
+
+    av_fifo_generic_write(sink->fifo, &link->cur_buf, sizeof(link->cur_buf), NULL);
+    link->cur_buf = NULL;
+}
+
+int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf)
+{
+    BufferSinkContext *sink = ctx->priv;
+    AVFilterLink      *link = ctx->inputs[0];
+    int ret;
+
+    if (!buf) {
+        if (av_fifo_size(sink->fifo))
+            return av_fifo_size(sink->fifo)/sizeof(*buf);
+        else
+            return avfilter_poll_frame(ctx->inputs[0]);
+    }
+
+    if (!av_fifo_size(sink->fifo) &&
+        (ret = avfilter_request_frame(link)) < 0)
+        return ret;
+
+    if (!av_fifo_size(sink->fifo))
+        return AVERROR(EINVAL);
+
+    av_fifo_generic_read(sink->fifo, buf, sizeof(*buf), NULL);
+
+    return 0;
+}
+
+AVFilter avfilter_vsink_buffer = {
+    .name      = "buffersink_old",
+    .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
+    .priv_size = sizeof(BufferSinkContext),
+    .init      = init,
+    .uninit    = uninit,
+
+    .inputs    = (AVFilterPad[]) {{ .name          = "default",
+                                    .type          = AVMEDIA_TYPE_VIDEO,
+                                    .end_frame     = end_frame,
+                                    .min_perms     = AV_PERM_READ, },
+                                  { .name = NULL }},
+    .outputs   = (AVFilterPad[]) {{ .name = NULL }},
+};
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 4c13f0df64646443c9367ad94f19dd4ab8daa8b1..86a4b2462b7dd11c6ab0a6c9955db5474f9e5e72 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -98,4 +98,18 @@ int av_vsink_buffer_get_video_buffer_ref(AVFilterContext *buffer_sink,
                                          AVFilterBufferRef **picref, int flags);
 #endif
 
+/**
+ * Get a buffer with filtered data from sink and put it in buf.
+ *
+ * @param sink pointer to a context of a buffersink AVFilter.
+ * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
+ *            must be freed by the caller using avfilter_unref_buffer().
+ *            Buf may also be NULL to query whether a buffer is ready to be
+ *            output.
+ *
+ * @return >= 0 in case of success, a negative AVERROR code in case of
+ *         failure.
+ */
+int av_buffersink_read(AVFilterContext *sink, AVFilterBufferRef **buf);
+
 #endif /* AVFILTER_BUFFERSINK_H */
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index e71041ecb448702a6eced486f32681f50f99c185..e57a1290aa5f815a992398a2d367f71d75936213 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -28,6 +28,8 @@
 
 void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
 {
+    if (ptr->extended_data != ptr->data)
+        av_freep(&ptr->extended_data);
     av_free(ptr->data[0]);
     av_free(ptr);
 }
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 0a3beaa3ca4586eae9bfbb3f31cdab7057436d77..18a0e19b3f27b4631e5afd84a8f9a175fcf4583c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -374,6 +374,7 @@ OBJS-$(CONFIG_MD5_PROTOCOL)              += md5proto.o
 OBJS-$(CONFIG_PIPE_PROTOCOL)             += file.o
 OBJS-$(CONFIG_RTMP_PROTOCOL)             += rtmpproto.o rtmppkt.o
 OBJS-$(CONFIG_RTP_PROTOCOL)              += rtpproto.o
+OBJS-$(CONFIG_SCTP_PROTOCOL)             += sctp.o
 OBJS-$(CONFIG_TCP_PROTOCOL)              += tcp.o
 OBJS-$(CONFIG_TLS_PROTOCOL)              += tls.o
 OBJS-$(CONFIG_UDP_PROTOCOL)              += udp.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ad2693ad12bd7962cc28fb98a4e2b624697d4383..1862449a85f0f36f5abd032b0567ca91c0824e72 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -278,6 +278,7 @@ void av_register_all(void)
     REGISTER_PROTOCOL (PIPE, pipe);
     REGISTER_PROTOCOL (RTMP, rtmp);
     REGISTER_PROTOCOL (RTP, rtp);
+    REGISTER_PROTOCOL (SCTP, sctp);
     REGISTER_PROTOCOL (TCP, tcp);
     REGISTER_PROTOCOL (TLS, tls);
     REGISTER_PROTOCOL (UDP, udp);
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 8d57c273e38868fa0b77dd9461045df7344c3cb8..fddf1a3cb10fc84398a52ecefc18b2f7da24d801 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -21,6 +21,11 @@
 #ifndef AVFORMAT_OPTIONS_TABLE
 #define AVFORMAT_OPTIONS_TABLE
 
+#include <limits.h>
+
+#include "libavutil/opt.h"
+#include "avformat.h"
+
 #define OFFSET(x) offsetof(AVFormatContext,x)
 #define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
 //these names are too long to be readable
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 564d09c2840abe236762e9f9da65c567ff07c2a0..504b9f850d511313262214c95e8fcb5a42b64fd9 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -870,6 +870,9 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
     } else if (av_stristart(p, "x-Accept-Dynamic-Rate:", &p) && rt) {
         p += strspn(p, SPACE_CHARS);
         rt->accept_dynamic_rate = atoi(p);
+    } else if (av_stristart(p, "Content-Type:", &p)) {
+        p += strspn(p, SPACE_CHARS);
+        av_strlcpy(reply->content_type, p, sizeof(reply->content_type));
     }
 }
 
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index f67ceb89cad030cd34a6f5af10f8616b3ae4495c..9bb50cf07c140debc833a48dc688c0e1faecd682 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -171,6 +171,11 @@ typedef struct RTSPMessageHeader {
      * returned
      */
     char reason[256];
+
+    /**
+     * Content type header
+     */
+    char content_type[64];
 } RTSPMessageHeader;
 
 /**
diff --git a/libavformat/sctp.c b/libavformat/sctp.c
new file mode 100644
index 0000000000000000000000000000000000000000..3823e03ebefe98d3743cdc10ddaac0b3a2563df3
--- /dev/null
+++ b/libavformat/sctp.c
@@ -0,0 +1,328 @@
+/*
+ * SCTP protocol
+ * Copyright (c) 2012 Luca Barbato
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ *
+ * sctp url_protocol
+ *
+ * url syntax: sctp://host:port[?option=val...]
+ * option: 'listen'        : listen for an incoming connection
+ *         'max_streams=n' : set the maximum number of streams
+ *         'reuse=1'       : enable reusing the socket [TBD]
+ *
+ * by setting the maximum number of streams the protocol will use the
+ * first two bytes of the incoming/outgoing buffer to store the
+ * stream number of the packet being read/written.
+ * @see sctp_read
+ * @see sctp_write
+ */
+
+
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "config.h"
+
+#if HAVE_POLL_H
+#include <poll.h>
+#endif
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/parseutils.h"
+#include "avformat.h"
+#include "internal.h"
+#include "network.h"
+#include "os_support.h"
+#include "url.h"
+
+/*
+ * The sctp_recvmsg and sctp_sendmsg functions are part of the user
+ * library that offers support
+ * for the SCTP kernel Implementation. The main purpose of this
+ * code is to provide the SCTP Socket API mappings for user
+ * application to interface with the SCTP in kernel.
+ *
+ * This implementation is based on the Socket API Extensions for SCTP
+ * defined in <draft-ietf-tsvwg-sctpsocket-10.txt>
+ *
+ * Copyright (c) 2003 International Business Machines, Corp.
+ *
+ * Written or modified by:
+ *  Ryan Layer <rmlayer@us.ibm.com>
+ */
+
+static int ff_sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,
+                           socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo,
+                           int *msg_flags)
+{
+    int recvb;
+    struct iovec iov;
+    char incmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
+    struct msghdr inmsg  = { 0 };
+    struct cmsghdr *cmsg = NULL;
+
+    iov.iov_base = msg;
+    iov.iov_len  = len;
+
+    inmsg.msg_name       = from;
+    inmsg.msg_namelen    = fromlen ? *fromlen : 0;
+    inmsg.msg_iov        = &iov;
+    inmsg.msg_iovlen     = 1;
+    inmsg.msg_control    = incmsg;
+    inmsg.msg_controllen = sizeof(incmsg);
+
+    if ((recvb = recvmsg(s, &inmsg, msg_flags ? *msg_flags : 0)) < 0)
+        return recvb;
+
+    if (fromlen)
+        *fromlen   = inmsg.msg_namelen;
+    if (msg_flags)
+        *msg_flags = inmsg.msg_flags;
+
+    for (cmsg = CMSG_FIRSTHDR(&inmsg); cmsg != NULL;
+         cmsg = CMSG_NXTHDR(&inmsg, cmsg)) {
+        if ((IPPROTO_SCTP == cmsg->cmsg_level) &&
+            (SCTP_SNDRCV  == cmsg->cmsg_type))
+            break;
+    }
+
+    /* Copy sinfo. */
+    if (cmsg)
+        memcpy(sinfo, CMSG_DATA(cmsg), sizeof(struct sctp_sndrcvinfo));
+
+    return recvb;
+}
+
+static int ff_sctp_send(int s, const void *msg, size_t len,
+                        const struct sctp_sndrcvinfo *sinfo, int flags)
+{
+    struct msghdr outmsg;
+    struct iovec iov;
+
+    outmsg.msg_name       = NULL;
+    outmsg.msg_namelen    = 0;
+    outmsg.msg_iov        = &iov;
+    iov.iov_base          = msg;
+    iov.iov_len           = len;
+    outmsg.msg_iovlen     = 1;
+    outmsg.msg_controllen = 0;
+
+    if (sinfo) {
+        char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
+        struct cmsghdr *cmsg;
+
+        outmsg.msg_control    = outcmsg;
+        outmsg.msg_controllen = sizeof(outcmsg);
+        outmsg.msg_flags      = 0;
+
+        cmsg             = CMSG_FIRSTHDR(&outmsg);
+        cmsg->cmsg_level = IPPROTO_SCTP;
+        cmsg->cmsg_type  = SCTP_SNDRCV;
+        cmsg->cmsg_len   = CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
+
+        outmsg.msg_controllen = cmsg->cmsg_len;
+        memcpy(CMSG_DATA(cmsg), sinfo, sizeof(struct sctp_sndrcvinfo));
+    }
+
+    return sendmsg(s, &outmsg, flags);
+}
+
+typedef struct SCTPContext {
+    int fd;
+    int max_streams;
+    struct sockaddr_storage dest_addr;
+    socklen_t dest_addr_len;
+} SCTPContext;
+
+static int sctp_open(URLContext *h, const char *uri, int flags)
+{
+    struct addrinfo *ai, *cur_ai;
+    struct addrinfo hints             = { 0 };
+    struct sctp_event_subscribe event = { 0 };
+    struct sctp_initmsg initparams    = { 0 };
+    int port;
+    int fd         = -1;
+    SCTPContext *s = h->priv_data;
+    const char *p;
+    char buf[256];
+    int ret, listen_socket = 0;
+    char hostname[1024], proto[1024], path[1024];
+    char portstr[10];
+
+    av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
+                 &port, path, sizeof(path), uri);
+    if (strcmp(proto,"sctp") || port <= 0 || port >= 65536)
+        return AVERROR(EINVAL);
+
+    s->max_streams = 0;
+    p = strchr(uri, '?');
+    if (p) {
+        if (av_find_info_tag(buf, sizeof(buf), "listen", p))
+            listen_socket = 1;
+        if (av_find_info_tag(buf, sizeof(buf), "max_streams", p))
+            s->max_streams = strtol(buf, NULL, 10);
+    }
+
+    hints.ai_family   = AF_UNSPEC;
+    hints.ai_socktype = SOCK_STREAM;
+    snprintf(portstr, sizeof(portstr), "%d", port);
+    ret = getaddrinfo(hostname, portstr, &hints, &ai);
+    if (ret) {
+        av_log(h, AV_LOG_ERROR, "Failed to resolve hostname %s: %s\n",
+               hostname, gai_strerror(ret));
+        return AVERROR(EIO);
+    }
+
+    cur_ai = ai;
+
+    fd = socket(cur_ai->ai_family, SOCK_STREAM, IPPROTO_SCTP);
+    if (fd < 0)
+        goto fail;
+
+    s->dest_addr_len = sizeof(s->dest_addr);
+
+    if (listen_socket) {
+        int fd1;
+        ret = bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+        listen(fd, 100);
+        fd1 = accept(fd, NULL, NULL);
+        closesocket(fd);
+        fd  = fd1;
+    } else
+        ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+
+    ff_socket_nonblock(fd, 1);
+
+    event.sctp_data_io_event = 1;
+    /* TODO: Subscribe to more event types and handle them */
+
+    if (setsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS, &event,
+                   sizeof(event)) != 0) {
+        av_log(h, AV_LOG_ERROR,
+               "SCTP ERROR: Unable to subscribe to events\n");
+        goto fail;
+    }
+
+    if (s->max_streams) {
+        initparams.sinit_max_instreams = s->max_streams;
+        initparams.sinit_num_ostreams  = s->max_streams;
+        if (setsockopt(fd, SOL_SCTP, SCTP_INITMSG, &initparams,
+                       sizeof(initparams)) < 0)
+            av_log(h, AV_LOG_ERROR,
+                   "SCTP ERROR: Unable to initialize socket max streams %d\n",
+                   s->max_streams);
+    }
+
+    h->priv_data   = s;
+    h->is_streamed = 1;
+    s->fd          = fd;
+    freeaddrinfo(ai);
+    return 0;
+
+fail:
+    ret = AVERROR(EIO);
+    freeaddrinfo(ai);
+    return ret;
+}
+
+static int sctp_wait_fd(int fd, int write)
+{
+    int ev          = write ? POLLOUT : POLLIN;
+    struct pollfd p = { .fd = fd, .events = ev, .revents = 0 };
+    int ret;
+
+    ret = poll(&p, 1, 100);
+    return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : AVERROR(EAGAIN);
+}
+
+static int sctp_read(URLContext *h, uint8_t *buf, int size)
+{
+    SCTPContext *s = h->priv_data;
+    int ret;
+
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
+        ret = sctp_wait_fd(s->fd, 0);
+        if (ret < 0)
+            return ret;
+    }
+
+    if (s->max_streams) {
+        /*StreamId is introduced as a 2byte code into the stream*/
+        struct sctp_sndrcvinfo info = { 0 };
+        ret = ff_sctp_recvmsg(s->fd, buf + 2, size - 2, NULL, 0, &info, 0);
+        AV_WB16(buf, info.sinfo_stream);
+        ret = ret < 0 ? ret : ret + 2;
+    } else
+        ret = recv(s->fd, buf, size, 0);
+
+    return ret < 0 ? ff_neterrno() : ret;
+}
+
+static int sctp_write(URLContext *h, const uint8_t *buf, int size)
+{
+    SCTPContext *s = h->priv_data;
+    int ret;
+
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
+        ret = sctp_wait_fd(s->fd, 1);
+        if (ret < 0)
+            return ret;
+    }
+
+    if (s->max_streams) {
+        /*StreamId is introduced as a 2byte code into the stream*/
+        struct sctp_sndrcvinfo info = { 0 };
+        info.sinfo_stream           = AV_RB16(buf);
+        if (info.sinfo_stream > s->max_streams)
+            abort();
+        ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR);
+    } else
+        ret = send(s->fd, buf, size, 0);
+
+    return ret < 0 ? ff_neterrno() : ret;
+}
+
+static int sctp_close(URLContext *h)
+{
+    SCTPContext *s = h->priv_data;
+    closesocket(s->fd);
+    return 0;
+}
+
+static int sctp_get_file_handle(URLContext *h)
+{
+    SCTPContext *s = h->priv_data;
+    return s->fd;
+}
+
+URLProtocol ff_sctp_protocol = {
+    .name                = "sctp",
+    .url_open            = sctp_open,
+    .url_read            = sctp_read,
+    .url_write           = sctp_write,
+    .url_close           = sctp_close,
+    .url_get_file_handle = sctp_get_file_handle,
+    .priv_data_size      = sizeof(SCTPContext),
+    .flags               = URL_PROTOCOL_FLAG_NETWORK,
+};
diff --git a/libavresample/avresample.h b/libavresample/avresample.h
index 7350805e41773281962326d9fbc2d124f90c921b..65d4d2d6e2286d781a39c3f36c3b5d94d722b086 100644
--- a/libavresample/avresample.h
+++ b/libavresample/avresample.h
@@ -274,7 +274,8 @@ int avresample_available(AVAudioResampleContext *avr);
  * @see avresample_convert()
  *
  * @param avr         audio resample context
- * @param output      output data pointers
+ * @param output      output data pointers. May be NULL, in which case
+ *                    nb_samples of data is discarded from output FIFO.
  * @param nb_samples  number of samples to read from the FIFO
  * @return            the number of samples written to output
  */
diff --git a/libavresample/utils.c b/libavresample/utils.c
index 78ef1532509daf5f0f0e001b6098295b870d2098..21bb9309b3ab9c42f0d3483c3cdc98a94e009b2e 100644
--- a/libavresample/utils.c
+++ b/libavresample/utils.c
@@ -375,7 +375,8 @@ int avresample_convert(AVAudioResampleContext *avr, void **output,
         }
     }
 
-    return handle_buffered_output(avr, &output_buffer, current_buffer);
+    return handle_buffered_output(avr, output ? &output_buffer : NULL,
+                                  current_buffer);
 }
 
 int avresample_available(AVAudioResampleContext *avr)
@@ -385,6 +386,8 @@ int avresample_available(AVAudioResampleContext *avr)
 
 int avresample_read(AVAudioResampleContext *avr, void **output, int nb_samples)
 {
+    if (!output)
+        return av_audio_fifo_drain(avr->out_fifo, nb_samples);
     return av_audio_fifo_read(avr->out_fifo, output, nb_samples);
 }
 
diff --git a/libavresample/version.h b/libavresample/version.h
index 47504c938073ed926e0515baf1bf5d648f59a220..6211a56352fc8e13e93c5973c75bf6a0750d2445 100644
--- a/libavresample/version.h
+++ b/libavresample/version.h
@@ -21,7 +21,7 @@
 
 #define LIBAVRESAMPLE_VERSION_MAJOR  0
 #define LIBAVRESAMPLE_VERSION_MINOR  0
-#define LIBAVRESAMPLE_VERSION_MICRO  1
+#define LIBAVRESAMPLE_VERSION_MICRO  2
 
 #define LIBAVRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \
                                                   LIBAVRESAMPLE_VERSION_MINOR, \
diff --git a/libavutil/mips/intreadwrite.h b/libavutil/mips/intreadwrite.h
index cd4a9a9a67cbd71bd9bd356d9edcc931ddc3c86f..9ba04913720536082b73c4f473cdb5ee472b93cc 100644
--- a/libavutil/mips/intreadwrite.h
+++ b/libavutil/mips/intreadwrite.h
@@ -24,75 +24,23 @@
 #include <stdint.h>
 #include "config.h"
 
-#if HAVE_INLINE_ASM
+#if ARCH_MIPS64 && HAVE_INLINE_ASM
 
 #define AV_RN32 AV_RN32
 static av_always_inline uint32_t AV_RN32(const void *p)
 {
+    struct __attribute__((packed)) u32 { uint32_t v; };
+    const uint8_t *q = p;
+    const struct u32 *pl = (const struct u32 *)(q + 3 * !HAVE_BIGENDIAN);
+    const struct u32 *pr = (const struct u32 *)(q + 3 *  HAVE_BIGENDIAN);
     uint32_t v;
     __asm__ ("lwl %0, %1  \n\t"
              "lwr %0, %2  \n\t"
              : "=&r"(v)
-             : "m"(*(const uint32_t *)((const uint8_t *)p+3*!HAVE_BIGENDIAN)),
-               "m"(*(const uint32_t *)((const uint8_t *)p+3*HAVE_BIGENDIAN)));
+             : "m"(*pl), "m"(*pr));
     return v;
 }
 
-#define AV_WN32 AV_WN32
-static av_always_inline void AV_WN32(void *p, uint32_t v)
-{
-    __asm__ ("swl %2, %0  \n\t"
-             "swr %2, %1  \n\t"
-             : "=m"(*(uint32_t *)((uint8_t *)p+3*!HAVE_BIGENDIAN)),
-               "=m"(*(uint32_t *)((uint8_t *)p+3*HAVE_BIGENDIAN))
-             : "r"(v));
-}
-
-#if ARCH_MIPS64
-
-#define AV_RN64 AV_RN64
-static av_always_inline uint64_t AV_RN64(const void *p)
-{
-    uint64_t v;
-    __asm__ ("ldl %0, %1  \n\t"
-             "ldr %0, %2  \n\t"
-             : "=&r"(v)
-             : "m"(*(const uint64_t *)((const uint8_t *)p+7*!HAVE_BIGENDIAN)),
-               "m"(*(const uint64_t *)((const uint8_t *)p+7*HAVE_BIGENDIAN)));
-    return v;
-}
-
-#define AV_WN64 AV_WN64
-static av_always_inline void AV_WN64(void *p, uint64_t v)
-{
-    __asm__ ("sdl %2, %0  \n\t"
-             "sdr %2, %1  \n\t"
-             : "=m"(*(uint64_t *)((uint8_t *)p+7*!HAVE_BIGENDIAN)),
-               "=m"(*(uint64_t *)((uint8_t *)p+7*HAVE_BIGENDIAN))
-             : "r"(v));
-}
-
-#else
-
-#define AV_RN64 AV_RN64
-static av_always_inline uint64_t AV_RN64(const void *p)
-{
-    union { uint64_t v; uint32_t hl[2]; } v;
-    v.hl[0] = AV_RN32(p);
-    v.hl[1] = AV_RN32((const uint8_t *)p + 4);
-    return v.v;
-}
-
-#define AV_WN64 AV_WN64
-static av_always_inline void AV_WN64(void *p, uint64_t v)
-{
-    union { uint64_t v; uint32_t hl[2]; } vv = { v };
-    AV_WN32(p, vv.hl[0]);
-    AV_WN32((uint8_t *)p + 4, vv.hl[1]);
-}
-
-#endif /* ARCH_MIPS64 */
-
-#endif /* HAVE_INLINE_ASM */
+#endif /* ARCH_MIPS64 && HAVE_INLINE_ASM */
 
 #endif /* AVUTIL_MIPS_INTREADWRITE_H */
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index 560c7f5cd5737290b16f70a0f4e70821a2413b16..ae192ff3d46996d2d37eace3e21608f3b2442f16 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -194,3 +194,41 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
     }
     return 0;
 }
+
+int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
+                    int src_offset, int nb_samples, int nb_channels,
+                    enum AVSampleFormat sample_fmt)
+{
+    int planar      = av_sample_fmt_is_planar(sample_fmt);
+    int planes      = planar ? nb_channels : 1;
+    int block_align = av_get_bytes_per_sample(sample_fmt) * (planar ? 1 : nb_channels);
+    int data_size   = nb_samples * block_align;
+    int i;
+
+    dst_offset *= block_align;
+    src_offset *= block_align;
+
+    for (i = 0; i < planes; i++)
+        memcpy(dst[i] + dst_offset, src[i] + src_offset, data_size);
+
+    return 0;
+}
+
+int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
+                           int nb_channels, enum AVSampleFormat sample_fmt)
+{
+    int planar      = av_sample_fmt_is_planar(sample_fmt);
+    int planes      = planar ? nb_channels : 1;
+    int block_align = av_get_bytes_per_sample(sample_fmt) * (planar ? 1 : nb_channels);
+    int data_size   = nb_samples * block_align;
+    int fill_char   = (sample_fmt == AV_SAMPLE_FMT_U8 ||
+                     sample_fmt == AV_SAMPLE_FMT_U8P) ? 0x80 : 0x00;
+    int i;
+
+    offset *= block_align;
+
+    for (i = 0; i < planes; i++)
+        memset(audio_data[i] + offset, fill_char, data_size);
+
+    return 0;
+}
diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h
index fa55efe78ae92330383be17a47092f40a016f028..4ce606d975ef672a2d64ee1feb9aef1b5017cd86 100644
--- a/libavutil/samplefmt.h
+++ b/libavutil/samplefmt.h
@@ -202,4 +202,31 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
 int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
                      int nb_samples, enum AVSampleFormat sample_fmt, int align);
 
+/**
+ * Copy samples from src to dst.
+ *
+ * @param dst destination array of pointers to data planes
+ * @param src source array of pointers to data planes
+ * @param dst_offset offset in samples at which the data will be written to dst
+ * @param src_offset offset in samples at which the data will be read from src
+ * @param nb_samples number of samples to be copied
+ * @param nb_channels number of audio channels
+ * @param sample_fmt audio sample format
+ */
+int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
+                    int src_offset, int nb_samples, int nb_channels,
+                    enum AVSampleFormat sample_fmt);
+
+/**
+ * Fill an audio buffer with silence.
+ *
+ * @param audio_data  array of pointers to data planes
+ * @param offset      offset in samples at which to start filling
+ * @param nb_samples  number of samples to fill
+ * @param nb_channels number of audio channels
+ * @param sample_fmt  audio sample format
+ */
+int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
+                           int nb_channels, enum AVSampleFormat sample_fmt);
+
 #endif /* AVUTIL_SAMPLEFMT_H */
diff --git a/tests/Makefile b/tests/Makefile
index 1f7d49e5fbbf1ff830aa9f570c3160ac0d02a91a..03e2b30d9e329c7f90c19fe5147ea4d07f8e4007 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -89,12 +89,17 @@ FATE_SEEK    = $(SEEK_TESTS:seek_%=fate-seek-%)
 FATE = $(FATE_ACODEC)                                                   \
        $(FATE_VCODEC)                                                   \
        $(FATE_LAVF)                                                     \
-       $(FATE_LIBAVUTIL)                                                \
        $(FATE_SEEK)                                                     \
 
+FATE_FFMPEG += $(FATE_FFMPEG-yes) $(FATE_AVCONV) $(FATE_AVCONV-yes)
+
+FATE-$(CONFIG_AVCODEC)  += $(FATE_LIBAVCODEC)
 FATE-$(CONFIG_AVFILTER) += $(FATE_LAVFI)
 
 FATE += $(FATE-yes)
+FATE += $(FATE_LIBAVUTIL)
+
+$(FATE_FFMPEG) $(FATE_LAVF_FATE): ffmpeg$(EXESUF)
 
 $(filter-out %-aref,$(FATE_ACODEC)): $(AREF)
 $(filter-out %-vref,$(FATE_VSYNTH1)): fate-vsynth1-vref
@@ -121,7 +126,7 @@ fate-seek:   $(FATE_SEEK)
 
 ifdef SAMPLES
 FATE += $(FATE_LAVF_FATE)
-FATE += $(FATE_TESTS) $(FATE_TESTS-yes)
+FATE += $(FATE_FFMPEG)
 fate-rsync:
 	rsync -vaLW --timeout=60 --contimeout=60 rsync://fate.ffmpeg.org/fate-suite/ $(SAMPLES)
 else
@@ -139,7 +144,7 @@ TOOL = ffmpeg
 
 fate:: $(FATE)
 
-$(FATE) $(FATE_TESTS-no): ffmpeg$(EXESUF) ffprobe$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
+$(FATE) $(FATE_TESTS-no): $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
 	@echo "TEST    $(@:fate-%=%)"
 	$(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)'
 
diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index 9236e95de594081f7aaf07978bf8309d1bf48f3b..48e45d6c3ce1c6455d3eb176e581a5aaa9a13cd9 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -88,7 +88,8 @@ fate-aac-ln-encode: CMP_SHIFT = -4096
 fate-aac-ln-encode: CMP_TARGET = 65
 fate-aac-ln-encode: SIZE_TOLERANCE = 3560
 
-FATE_TESTS += $(FATE_AAC) $(FATE_AAC_ENCODE)
+FATE_FFMPEG += $(FATE_AAC) $(FATE_AAC_ENCODE)
 fate-aac: $(FATE_AAC) $(FATE_AAC_ENCODE)
+
 $(FATE_AAC): CMP = oneoff
 $(FATE_AAC): FUZZ = 2
diff --git a/tests/fate/ac3.mak b/tests/fate/ac3.mak
index ca0704d08d3bdb57f6178567575f129e50f2662f..ed2ce12c0efd78c0b0a36ebebd9f2c7f1941aac6 100644
--- a/tests/fate/ac3.mak
+++ b/tests/fate/ac3.mak
@@ -44,5 +44,5 @@ fate-eac3-encode: CMP_SHIFT = -1024
 fate-eac3-encode: CMP_TARGET = 514.02
 fate-eac3-encode: SIZE_TOLERANCE = 488
 
-FATE_TESTS += $(FATE_AC3)
+FATE_AVCONV += $(FATE_AC3)
 fate-ac3: $(FATE_AC3)
diff --git a/tests/fate/adpcm.mak b/tests/fate/adpcm.mak
index 5e41d6e18f7d16095ed1c8c363c8a22d5b29385c..16fe69efc628d5c69a5363b9ebd4ea188c0ba19f 100644
--- a/tests/fate/adpcm.mak
+++ b/tests/fate/adpcm.mak
@@ -16,14 +16,17 @@ fate-adpcm-creative-8-2.6bit: CMD = md5 -i $(SAMPLES)/creative/BBC_3BIT.VOC -f s
 FATE_ADPCM += fate-adpcm-creative-8-4bit
 fate-adpcm-creative-8-4bit: CMD = md5 -i $(SAMPLES)/creative/BBC_4BIT.VOC -f s16le
 
-FATE_ADPCM += fate-adpcm-ea-mad-ea-r1
-fate-adpcm-ea-mad-ea-r1: CMD = framecrc -i $(SAMPLES)/ea-mad/NFS6LogoE.mad
+FATE_ADPCM += fate-adpcm-ea-1
+fate-adpcm-ea-1: CMD = framecrc -i $(SAMPLES)/ea-wve/networkBackbone-partial.wve -frames:a 26 -vn
+
+FATE_ADPCM += fate-adpcm-ea-2
+fate-adpcm-ea-2: CMD = framecrc -i $(SAMPLES)/ea-dct/NFS2Esprit-partial.dct -vn
 
 FATE_ADPCM += fate-adpcm-ea-maxis-xa
 fate-adpcm-ea-maxis-xa: CMD = framecrc -i $(SAMPLES)/maxis-xa/SC2KBUG.XA -frames:a 30
 
-FATE_ADPCM += fate-adpcm-ea-tqi
-fate-adpcm-ea-tqi: CMD = framecrc -i $(SAMPLES)/ea-wve/networkBackbone-partial.wve -frames:v 26
+FATE_ADPCM += fate-adpcm-ea-r1
+fate-adpcm-ea-r1: CMD = framecrc -i $(SAMPLES)/ea-mad/NFS6LogoE.mad -vn
 
 FATE_ADPCM += fate-adpcm-ima-dk3
 fate-adpcm-ima-dk3: CMD = md5 -i $(SAMPLES)/duck/sop-audio-only.avi -f s16le
@@ -31,6 +34,12 @@ fate-adpcm-ima-dk3: CMD = md5 -i $(SAMPLES)/duck/sop-audio-only.avi -f s16le
 FATE_ADPCM += fate-adpcm-ima-dk4
 fate-adpcm-ima-dk4: CMD = md5 -i $(SAMPLES)/duck/salsa-audio-only.avi -f s16le
 
+FATE_ADPCM += fate-adpcm-ima-ea-eacs
+fate-adpcm-ima-ea-eacs: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTRO8K-partial.TGV -vn
+
+FATE_ADPCM += fate-adpcm-ima-ea-sead
+fate-adpcm-ima-ea-sead: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTEL_S.TGV -vn
+
 FATE_ADPCM += fate-adpcm-ima_wav-stereo
 fate-adpcm-ima_wav-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-L-ms11.mov -f s16le
 
@@ -38,10 +47,10 @@ FATE_ADPCM += fate-adpcm-psx-str-v3
 fate-adpcm-psx-str-v3: CMD = framecrc -i $(SAMPLES)/psx-str/abc000_cut.str -vn
 
 FATE_ADPCM += fate-adpcm-thp
-fate-adpcm-thp: CMD = framecrc -idct simple -i $(SAMPLES)/thp/pikmin2-opening1-partial.thp
+fate-adpcm-thp: CMD = framecrc -i $(SAMPLES)/thp/pikmin2-opening1-partial.thp -vn
 
 FATE_ADPCM += fate-adpcm_ms-stereo
 fate-adpcm_ms-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-L-ms02.mov -f s16le
 
-FATE_TESTS += $(FATE_ADPCM)
+FATE_AVCONV += $(FATE_ADPCM)
 fate-adpcm: $(FATE_ADPCM)
diff --git a/tests/fate/als.mak b/tests/fate/als.mak
index 267403428ea54d23ed9b1bff47d41e54e9b3a1c9..b75dab4853e9ad5a67426dbb6cb107dc3e5e6fec 100644
--- a/tests/fate/als.mak
+++ b/tests/fate/als.mak
@@ -7,5 +7,5 @@ endef
 
 $(foreach N,$(ALS_SUITE),$(eval $(call FATE_ALS_SUITE,$(N))))
 
-FATE_TESTS += $(FATE_ALS)
+FATE_AVCONV += $(FATE_ALS)
 fate-als: $(FATE_ALS)
diff --git a/tests/fate/amrnb.mak b/tests/fate/amrnb.mak
index 3545ba86fbb8ac0cc70b00c814ab3562a699c57c..917b81a406928f742e29131b9a8dfab45367a1c7 100644
--- a/tests/fate/amrnb.mak
+++ b/tests/fate/amrnb.mak
@@ -46,5 +46,5 @@ fate-amrnb-12k2: CMP = stddev
 fate-amrnb-12k2: REF = $(SAMPLES)/amrnb/12.2k.pcm
 fate-amrnb-12k2: FUZZ = 1
 
-FATE_TESTS += $(FATE_AMRNB)
+FATE_AVCONV += $(FATE_AMRNB)
 fate-amrnb: $(FATE_AMRNB)
diff --git a/tests/fate/amrwb.mak b/tests/fate/amrwb.mak
index 8fc79289959d44837e9af90b3f4b625ab2546d21..112262940e4fbafecdec5fd3ce733347096bd799 100644
--- a/tests/fate/amrwb.mak
+++ b/tests/fate/amrwb.mak
@@ -58,5 +58,5 @@ fate-amrwb-23k85-2: CMP = stddev
 fate-amrwb-23k85-2: REF = $(SAMPLES)/amrwb/deus-23k85.pcm
 fate-amrwb-23k85-2: FUZZ = 1
 
-FATE_TESTS += $(FATE_AMRWB)
+FATE_AVCONV += $(FATE_AMRWB)
 fate-amrwb: $(FATE_AMRWB)
diff --git a/tests/fate/atrac.mak b/tests/fate/atrac.mak
index efb17274632ce114913bbc5fd9f321b49b49f47b..5e6bd95c3b49006d2c03695164f76d92b5802b1d 100644
--- a/tests/fate/atrac.mak
+++ b/tests/fate/atrac.mak
@@ -18,5 +18,5 @@ fate-atrac3-3: CMD = pcm -i $(SAMPLES)/atrac3/mc_sich_at3_132_small.wav
 fate-atrac3-3: CMP = oneoff
 fate-atrac3-3: REF = $(SAMPLES)/atrac3/mc_sich_at3_132_small.pcm
 
-FATE_TESTS += $(FATE_ATRAC)
+FATE_AVCONV += $(FATE_ATRAC)
 fate-atrac: $(FATE_ATRAC)
diff --git a/tests/fate/audio.mak b/tests/fate/audio.mak
index 186ac6e4ba2fd8c0be584e1cb37575bdd4b1b105..772a7a94379c25950448928e36c943bb050785d6 100644
--- a/tests/fate/audio.mak
+++ b/tests/fate/audio.mak
@@ -40,5 +40,5 @@ fate-nellymoser-aref-encode: SIZE_TOLERANCE = 268
 FATE_AUDIO += fate-ws_snd
 fate-ws_snd: CMD = md5 -i $(SAMPLES)/vqa/ws_snd.vqa -f s16le
 
-FATE_TESTS += $(FATE_AUDIO)
+FATE_FFMPEG += $(FATE_AUDIO)
 fate-audio: $(FATE_AUDIO)
diff --git a/tests/fate/bmp.mak b/tests/fate/bmp.mak
index 56b5059a339e9d8c058890f11c94235caecb87cb..4a01bb0e2a9198a06e4d826f190b0afc673745fc 100644
--- a/tests/fate/bmp.mak
+++ b/tests/fate/bmp.mak
@@ -37,5 +37,5 @@ fate-bmp-rle4: CMD = framecrc -i $(SAMPLES)/bmp/testcompress4.bmp -pix_fmt rgb24
 FATE_BMP += fate-bmp-rle8
 fate-bmp-rle8: CMD = framecrc -i $(SAMPLES)/bmp/testcompress8.bmp -pix_fmt rgb24
 
-FATE_TESTS += $(FATE_BMP)
+FATE_AVCONV += $(FATE_BMP)
 fate-bmp: $(FATE_BMP)
diff --git a/tests/fate/cdxl.mak b/tests/fate/cdxl.mak
index 3a46c5ce50b15a86b29c5796cf5f46a5162806ef..2cec5d2a5986b23ec77f4f4b8dbba1f0940122b2 100644
--- a/tests/fate/cdxl.mak
+++ b/tests/fate/cdxl.mak
@@ -13,5 +13,5 @@ fate-cdxl-pal8-small: CMD = framecrc -i $(SAMPLES)/cdxl/fruit.cdxl -an -pix_fmt
 FATE_CDXL += fate-cdxl-bitline-ham6
 fate-cdxl-bitline-ham6: CMD = framecrc -i $(SAMPLES)/cdxl/bitline.cdxl -frames:v 10
 
-FATE_TESTS += $(FATE_CDXL)
+FATE_AVCONV += $(FATE_CDXL)
 fate-cdxl: $(FATE_CDXL)
diff --git a/tests/fate/dct.mak b/tests/fate/dct.mak
index 8f2ab7a8e0989d40c8ab75ec905ccec6913242d6..d79cb9157d5196e94ee16d7a015d201d23a4a4d0 100644
--- a/tests/fate/dct.mak
+++ b/tests/fate/dct.mak
@@ -1,4 +1,4 @@
-FATE_TESTS += fate-idct8x8
+FATE-yes += fate-idct8x8
 fate-idct8x8: libavcodec/dct-test$(EXESUF)
 fate-idct8x8: CMD = run libavcodec/dct-test -i
 fate-idct8x8: REF = /dev/null
diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
index 5d3ad4491a7b210d14484a12c852db2bf32fae98..5512f844be20bff8d946ea614b4d03d68fc10e06 100644
--- a/tests/fate/demux.mak
+++ b/tests/fate/demux.mak
@@ -94,5 +94,5 @@ fate-xmv-demux: CMD = framecrc -i $(SAMPLES)/xmv/logos1p.fmv -vcodec copy -acode
 FATE_DEMUX += fate-xwma-demux
 fate-xwma-demux: CMD = crc -i $(SAMPLES)/xwma/ergon.xwma -acodec copy
 
-FATE_TESTS += $(FATE_DEMUX)
+FATE_FFMPEG += $(FATE_DEMUX)
 fate-demux: $(FATE_DEMUX)
diff --git a/tests/fate/dfa.mak b/tests/fate/dfa.mak
index 6220c070ef2e0eaa48f04cc7abd6256cd2e5b3af..e83683959b755b3ce596571b4b7de1596a2a4571 100644
--- a/tests/fate/dfa.mak
+++ b/tests/fate/dfa.mak
@@ -31,5 +31,5 @@ fate-dfa10: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0009.dfa -pix_fmt rgb2
 FATE_DFA += fate-dfa11
 fate-dfa11: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0010.dfa -pix_fmt rgb24
 
-FATE_TESTS += $(FATE_DFA)
+FATE_AVCONV += $(FATE_DFA)
 fate-dfa: $(FATE_DFA)
diff --git a/tests/fate/dpcm.mak b/tests/fate/dpcm.mak
index a8b8b3d8ed90086b7112eb9e79defadcafbfab94..36a33db220009903de95c1005c603a725f8c2bf9 100644
--- a/tests/fate/dpcm.mak
+++ b/tests/fate/dpcm.mak
@@ -1,5 +1,5 @@
 FATE_DPCM += fate-dpcm-idroq
-fate-dpcm-idroq: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq
+fate-dpcm-idroq: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq -vn
 
 FATE_DPCM += fate-dpcm-sierra
 fate-dpcm-sierra: CMD = md5 -i $(SAMPLES)/sol/lsl7sample.sol -f s16le
@@ -7,5 +7,5 @@ fate-dpcm-sierra: CMD = md5 -i $(SAMPLES)/sol/lsl7sample.sol -f s16le
 FATE_DPCM += fate-dpcm-xan
 fate-dpcm-xan: CMD = md5 -i $(SAMPLES)/wc4-xan/wc4_2.avi -vn -f s16le
 
-FATE_TESTS += $(FATE_DPCM)
+FATE_AVCONV += $(FATE_DPCM)
 fate-dpcm: $(FATE_DPCM)
diff --git a/tests/fate/ea.mak b/tests/fate/ea.mak
index 20d9404c88a84f3f695e0042ab363d85f4d7f95e..b0636feffbfba1d76ac83bd05614177bdbf034e0 100644
--- a/tests/fate/ea.mak
+++ b/tests/fate/ea.mak
@@ -4,17 +4,20 @@ fate-ea-cdata: CMD = md5 -i $(SAMPLES)/ea-cdata/166b084d.46410f77.0009b440.24be9
 FATE_EA += fate-ea-cmv
 fate-ea-cmv: CMD = framecrc -i $(SAMPLES)/ea-cmv/TITLE.CMV -pix_fmt rgb24
 
-FATE_EA += fate-ea-dct
-fate-ea-dct: CMD = framecrc -idct simple -i $(SAMPLES)/ea-dct/NFS2Esprit-partial.dct
-
 FATE_EA += fate-ea-tgq
 fate-ea-tgq: CMD = framecrc -i $(SAMPLES)/ea-tgq/v27.tgq -an
 
-FATE_EA += fate-ea-tgv-ima-ea-eacs
-fate-ea-tgv-ima-ea-eacs: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTRO8K-partial.TGV -pix_fmt rgb24
+FATE_EA += fate-ea-tqi
+fate-ea-tqi: CMD = framecrc -i $(SAMPLES)/ea-wve/networkBackbone-partial.wve -frames:v 26 -an
+
+FATE_EA += fate-ea-mad
+fate-ea-mad: CMD = framecrc -i $(SAMPLES)/ea-mad/NFS6LogoE.mad -an
+
+FATE_EA += fate-ea-tgv-1
+fate-ea-tgv-1: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTRO8K-partial.TGV -pix_fmt rgb24 -an
 
-FATE_EA += fate-ea-tgv-ima-ea-sead
-fate-ea-tgv-ima-ea-sead: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTEL_S.TGV -pix_fmt rgb24
+FATE_EA += fate-ea-tgv-2
+fate-ea-tgv-2: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTEL_S.TGV -pix_fmt rgb24 -an
 
-FATE_TESTS += $(FATE_EA)
+FATE_FFMPEG += $(FATE_EA)
 fate-ea: $(FATE_EA)
diff --git a/tests/fate/fft.mak b/tests/fate/fft.mak
index d4199384a4a98bdb0176c4a73b5a8a41cf294eb5..d3889cc8773424d012de4ed6883aae5f318c7d32 100644
--- a/tests/fate/fft.mak
+++ b/tests/fate/fft.mak
@@ -38,5 +38,5 @@ $(FATE_FFT_FIXED): libavcodec/fft-fixed-test$(EXESUF)
 $(FATE_FFT_FIXED): CMD = run libavcodec/fft-fixed-test $(CPUFLAGS:%=-c%) $(ARGS)
 $(FATE_FFT_FIXED): REF = /dev/null
 
-FATE_TESTS += $(FATE_FFT) $(FATE_FFT_FIXED)
+FATE-$(CONFIG_FFT) += $(FATE_FFT) $(FATE_FFT_FIXED)
 fate-fft: $(FATE_FFT) $(FATE_FFT_FIXED)
diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
index 0765f66e43bc5c95083802d83d9d267f7542948f..113fc3215824113f64fcade0294cf0df90b45ae2 100644
--- a/tests/fate/h264.mak
+++ b/tests/fate/h264.mak
@@ -188,7 +188,7 @@ FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%)                    \
               fate-h264-extreme-plane-pred                              \
               fate-h264-bsf-mp4toannexb                                 \
 
-FATE_TESTS += $(FATE_H264)
+FATE_AVCONV += $(FATE_H264)
 fate-h264: $(FATE_H264)
 
 fate-h264-conformance-aud_mw_e: CMD = framecrc -vsync drop -i $(SAMPLES)/h264-conformance/AUD_MW_E.264
diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 60c6cb26ef54956e27e575bcd1facdf6aad14092..7ded69fb7d2c83bb6beb46a5973573c5ef974b97 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -70,6 +70,6 @@ fate-tiff-fax-g3s: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31DS.TIF
 FATE_IMAGE += $(FATE_TIFF)
 fate-tiff: $(FATE_TIFF)
 
-FATE_TESTS += $(FATE_IMAGE)
+FATE_FFMPEG += $(FATE_IMAGE)
 fate-image: $(FATE_IMAGE)
 
diff --git a/tests/fate/indeo.mak b/tests/fate/indeo.mak
index cf1625c114258b890f16ac941a12d9e84e9d400f..fbffe4a89c390b6948bf734c3989dbd3b0538d27 100644
--- a/tests/fate/indeo.mak
+++ b/tests/fate/indeo.mak
@@ -10,5 +10,5 @@ fate-indeo4: CMD = framecrc -i $(SAMPLES)/iv41/indeo41-partial.avi -an
 FATE_INDEO += fate-indeo5
 fate-indeo5: CMD = framecrc -i $(SAMPLES)/iv50/Educ_Movie_DeadlyForce.avi -an
 
-FATE_TESTS += $(FATE_INDEO)
+FATE_AVCONV += $(FATE_INDEO)
 fate-indeo: $(FATE_INDEO)
diff --git a/tests/fate/libavcodec.mak b/tests/fate/libavcodec.mak
index ec4012ebb6d7734a98415733669fe5dc9202b9ec..2aa9596cdd239b0c19d89e640611cb9838e0b143 100644
--- a/tests/fate/libavcodec.mak
+++ b/tests/fate/libavcodec.mak
@@ -1,8 +1,10 @@
-FATE_TESTS += fate-golomb
+FATE_LIBAVCODEC += fate-golomb
 fate-golomb: libavcodec/golomb-test$(EXESUF)
 fate-golomb: CMD = run libavcodec/golomb-test
 fate-golomb: REF = /dev/null
 
-FATE_TESTS += fate-iirfilter
+FATE_LIBAVCODEC += fate-iirfilter
 fate-iirfilter: libavcodec/iirfilter-test$(EXESUF)
 fate-iirfilter: CMD = run libavcodec/iirfilter-test
+
+fate-libavcodec: $(FATE_LIBAVCODEC)
diff --git a/tests/fate/lossless-audio.mak b/tests/fate/lossless-audio.mak
index c12f31ead78b066bef01f037f02f8b52864e7386..14e1e65814189a3edd2df608aacbb5f6c6852292 100644
--- a/tests/fate/lossless-audio.mak
+++ b/tests/fate/lossless-audio.mak
@@ -16,6 +16,6 @@ fate-lossless-tta: CMD = crc -i $(SAMPLES)/lossless-audio/inside.tta
 FATE_LOSSLESS_AUDIO += fate-lossless-wma
 fate-lossless-wma: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.wma -f s16le
 
-FATE_TESTS += $(FATE_LOSSLESS_AUDIO)
+FATE_FFMPEG += $(FATE_LOSSLESS_AUDIO)
 fate-lossless-audio: $(FATE_LOSSLESS_AUDIO)
 
diff --git a/tests/fate/lossless-video.mak b/tests/fate/lossless-video.mak
index 9293b96b54fd21f03ab7ca4098d7670e42e1b049..79fd9eb31df764e9fa5909bf11d1626a9778ad47 100644
--- a/tests/fate/lossless-video.mak
+++ b/tests/fate/lossless-video.mak
@@ -22,6 +22,6 @@ fate-zlib: CMD = framecrc -i $(SAMPLES)/lcl/zlib-1frame.avi
 FATE_LOSSLESS_VIDEO += fate-zerocodec
 fate-zerocodec: CMD = framecrc -i $(SAMPLES)/zerocodec/sample-zeco.avi
 
-FATE_TESTS += $(FATE_LOSSLESS_VIDEO)
+FATE_FFMPEG += $(FATE_LOSSLESS_VIDEO)
 fate-lossless-video: $(FATE_LOSSLESS_VIDEO)
 
diff --git a/tests/fate/mapchan.mak b/tests/fate/mapchan.mak
index 20153b7438cfcfba5844c090c3276ac10145872d..19c515c455f20b507c686af3d13417bdd2bbedcb 100644
--- a/tests/fate/mapchan.mak
+++ b/tests/fate/mapchan.mak
@@ -10,5 +10,5 @@ FATE_MAPCHAN += fate-mapchan-silent-mono
 fate-mapchan-silent-mono: tests/data/asynth-22050-1.wav
 fate-mapchan-silent-mono: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-22050-1.wav -map_channel -1 -map_channel 0.0.0 -f wav
 
-FATE_TESTS += $(FATE_MAPCHAN)
+FATE_FFMPEG += $(FATE_MAPCHAN)
 fate-mapchan: $(FATE_MAPCHAN)
diff --git a/tests/fate/microsoft.mak b/tests/fate/microsoft.mak
index c9b78f7e521f3453b0c6deb97a1763d0fa62ab38..ba6aff71d60e3cbc141757af0733dc9187cf151f 100644
--- a/tests/fate/microsoft.mak
+++ b/tests/fate/microsoft.mak
@@ -42,5 +42,5 @@ fate-vc1-ism: CMD = framecrc -i $(SAMPLES)/isom/vc1-wmapro.ism -an
 FATE_MICROSOFT += $(FATE_VC1)
 fate-vc1: $(FATE_VC1)
 
-FATE_TESTS += $(FATE_MICROSOFT)
+FATE_FFMPEG += $(FATE_MICROSOFT)
 fate-microsoft: $(FATE_MICROSOFT)
diff --git a/tests/fate/mp3.mak b/tests/fate/mp3.mak
index 4c16cb84e04fe534676184217d9732b939e2a262..26a77d0b9d5eed356234aa6b3d8ab9f7487cda43 100644
--- a/tests/fate/mp3.mak
+++ b/tests/fate/mp3.mak
@@ -38,7 +38,7 @@ fate-mp3-float-extra_overread: CMD = pcm -c:a mp3float -i $(SAMPLES)/mpegaudio/e
 fate-mp3-float-extra_overread: CMP = stddev
 fate-mp3-float-extra_overread: REF = $(SAMPLES)/mpegaudio/extra_overread.pcm
 
-FATE_TESTS += $(FATE_MP3)
+FATE_AVCONV += $(FATE_MP3)
 fate-mp3: $(FATE_MP3)
 $(FATE_MP3): CMP = stddev
 $(FATE_MP3): FUZZ = 0.07
diff --git a/tests/fate/mpc.mak b/tests/fate/mpc.mak
index 2b263ce6bee20629ed9909afb3666c68fbb616d2..0a8a84054ffa2ffe357e48098eea6b2fc4f8f6d3 100644
--- a/tests/fate/mpc.mak
+++ b/tests/fate/mpc.mak
@@ -10,5 +10,5 @@ fate-musepack7: CMP = oneoff
 fate-musepack7: REF = $(SAMPLES)/musepack/inside-mp7.pcm
 fate-musepack7: FUZZ = 1
 
-FATE_TESTS += $(FATE_MPC)
+FATE_FFMPEG += $(FATE_MPC)
 fate-mpc: $(FATE_MPC)
diff --git a/tests/fate/pcm.mak b/tests/fate/pcm.mak
index 4b271346f6ac7f7411900073b2519a1fc272aece..d0acc23d4f2c4ab89b7d356fc85d284bca77c093 100644
--- a/tests/fate/pcm.mak
+++ b/tests/fate/pcm.mak
@@ -30,5 +30,5 @@ fate-dcinema-encode: tests/data/asynth-96000-6.wav
 fate-dcinema-encode: SRC = tests/data/asynth-96000-6.wav
 fate-dcinema-encode: CMD = enc_dec_pcm daud md5 s16le $(SRC) -c:a pcm_s24daud
 
-FATE_TESTS += $(FATE_PCM)
+FATE_AVCONV += $(FATE_PCM)
 fate-pcm: $(FATE_PCM)
diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak
index 39068f2d74ec5b1c75cfb2261729e373a591ad89..ae32af9bb270734a8b6c5c84c0b3097216fd87b0 100644
--- a/tests/fate/probe.mak
+++ b/tests/fate/probe.mak
@@ -10,8 +10,9 @@ fate-probe-format-roundup1414: REF = format_name=mpeg
 FATE_PROBE_FORMAT += fate-probe-format-roundup2015
 fate-probe-format-roundup2015: REF = format_name=dv
 
-FATE_TESTS += $(FATE_PROBE_FORMAT)
+FATE-$(CONFIG_FFPROBE) += $(FATE_PROBE_FORMAT)
 fate-probe-format: $(FATE_PROBE_FORMAT)
 
+$(FATE_PROBE_FORMAT): ffprobe$(EXESUF)
 $(FATE_PROBE_FORMAT): CMP = oneline
 fate-probe-format-%: CMD = probefmt $(SAMPLES)/probe-format/$(@:fate-probe-format-%=%)
diff --git a/tests/fate/prores.mak b/tests/fate/prores.mak
index d211d3f4ae9bf9be1862d0dbf5b247e712f56631..42828c8b2afcfe0783bfb7678aea824566f09d92 100644
--- a/tests/fate/prores.mak
+++ b/tests/fate/prores.mak
@@ -4,7 +4,7 @@ FATE_PRORES = fate-prores-422                                           \
               fate-prores-422_proxy                                     \
               fate-prores-alpha                                         \
 
-FATE_TESTS += $(FATE_PRORES)
+FATE_AVCONV += $(FATE_PRORES)
 fate-prores: $(FATE_PRORES)
 
 fate-prores-422:       CMD = framecrc -flags +bitexact -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422.mov -pix_fmt yuv422p10le
diff --git a/tests/fate/qt.mak b/tests/fate/qt.mak
index 0afa401d7cefdb3ef958a47f48ff0ce9def1faa2..12cdb60d3ab5aa32333a4414e771ca13f6423fcb 100644
--- a/tests/fate/qt.mak
+++ b/tests/fate/qt.mak
@@ -49,5 +49,5 @@ fate-svq1: CMD = framecrc -i $(SAMPLES)/svq1/marymary-shackles.mov -an -t 10
 FATE_QT += fate-svq3
 fate-svq3: CMD = framecrc -i $(SAMPLES)/svq3/Vertical400kbit.sorenson3.mov -t 6 -an
 
-FATE_TESTS += $(FATE_QT)
+FATE_FFMPEG += $(FATE_QT)
 fate-qt: $(FATE_QT)
diff --git a/tests/fate/qtrle.mak b/tests/fate/qtrle.mak
index 0d1e3fcdfcf49d25f45777cdf150710db2db8c19..8e14c3c0283bb9f6f442eeb6179f7b49c5eaff45 100644
--- a/tests/fate/qtrle.mak
+++ b/tests/fate/qtrle.mak
@@ -19,5 +19,5 @@ fate-qtrle-24bit: CMD = framecrc -i $(SAMPLES)/qtrle/aletrek-rle.mov
 FATE_QTRLE += fate-qtrle-32bit
 fate-qtrle-32bit: CMD = framecrc -i $(SAMPLES)/qtrle/ultra_demo_720_480_32bpp_rle.mov -pix_fmt rgb24
 
-FATE_TESTS += $(FATE_QTRLE)
+FATE_AVCONV += $(FATE_QTRLE)
 fate-qtrle: $(FATE_QTRLE)
diff --git a/tests/fate/real.mak b/tests/fate/real.mak
index 939a6cb36f25c646759de00035ccdd4fe52e218b..710b90c741e7f3a631ebe4d4af2f859996e4862c 100644
--- a/tests/fate/real.mak
+++ b/tests/fate/real.mak
@@ -1,5 +1,5 @@
-FATE_REAL += fate-real-14_4
-fate-real-14_4: CMD = md5 -i $(SAMPLES)/real/ra3_in_rm_file.rm -f s16le
+FATE_REAL += fate-ra-144
+fate-ra-144: CMD = md5 -i $(SAMPLES)/real/ra3_in_rm_file.rm -f s16le
 
 FATE_REAL += fate-ra-288
 fate-ra-288: CMD = pcm -i $(SAMPLES)/real/ra_288.rm
@@ -18,8 +18,8 @@ fate-ralf: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.rmvb -vn -f
 FATE_REAL += fate-rv30
 fate-rv30: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/real/rv30.rm -an
 
-FATE_REAL += fate-real-rv40
-fate-real-rv40: CMD = framecrc -i $(SAMPLES)/real/spygames-2MB.rmvb -t 10 -an
+FATE_REAL += fate-rv40
+fate-rv40: CMD = framecrc -i $(SAMPLES)/real/spygames-2MB.rmvb -t 10 -an
 
 FATE_SIPR += fate-sipr-5k0
 fate-sipr-5k0: CMD = pcm -i $(SAMPLES)/sipr/sipr_5k0.rm
@@ -44,5 +44,5 @@ fate-sipr-16k: REF = $(SAMPLES)/sipr/sipr_16k.pcm
 FATE_REAL += $(FATE_SIPR)
 fate-sipr: $(FATE_SIPR)
 
-FATE_TESTS += $(FATE_REAL)
+FATE_FFMPEG += $(FATE_REAL)
 fate-real: $(FATE_REAL)
diff --git a/tests/fate/screen.mak b/tests/fate/screen.mak
index 1cc519dff84f0d24ac10aa5fb0775603ea91eaad..81f2398037b045bfd06b79dd5c28c19e0e4b87cb 100644
--- a/tests/fate/screen.mak
+++ b/tests/fate/screen.mak
@@ -59,5 +59,5 @@ fate-zmbv-32bit: CMD = framecrc -i $(SAMPLES)/zmbv/zmbv_32bit.avi -pix_fmt rgb24
 FATE_SCREEN += $(FATE_ZMBV)
 fate-zmbv: $(FATE_ZMBV)
 
-FATE_TESTS += $(FATE_SCREEN)
+FATE_FFMPEG += $(FATE_SCREEN)
 fate-screen: $(FATE_SCREEN)
diff --git a/tests/fate/utvideo.mak b/tests/fate/utvideo.mak
index 7cf6237b1e9acf3d32ecdd84f6b6c98aa0107af1..81f631afd9c618e3422e70329b9376a92ce7c10e 100644
--- a/tests/fate/utvideo.mak
+++ b/tests/fate/utvideo.mak
@@ -22,5 +22,5 @@ fate-utvideo_yuv422_left: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_le
 FATE_UTVIDEO += fate-utvideo_yuv422_median
 fate-utvideo_yuv422_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_median.avi
 
-FATE_TESTS += $(FATE_UTVIDEO)
+FATE_AVCONV += $(FATE_UTVIDEO)
 fate-utvideo: $(FATE_UTVIDEO)
diff --git a/tests/fate/video.mak b/tests/fate/video.mak
index c790fd4e7c37a24484bf4f3db0aaed89df7d1be3..c85bbbae539641be802e4698269b1a85942d7bb9 100644
--- a/tests/fate/video.mak
+++ b/tests/fate/video.mak
@@ -133,6 +133,9 @@ fate-kgv1: CMD = framecrc -i $(SAMPLES)/kega/kgv1.avi -pix_fmt rgb555le -an
 FATE_VIDEO += fate-kmvc
 fate-kmvc: CMD = framecrc -i $(SAMPLES)/KMVC/LOGO1.AVI -an -t 3 -pix_fmt rgb24
 
+FATE_VIDEO += fate-mdec
+fate-mdec: CMD = framecrc -idct simple -i $(SAMPLES)/ea-dct/NFS2Esprit-partial.dct -an
+
 FATE_VIDEO += fate-mimic
 fate-mimic: CMD = framecrc -idct simple -i $(SAMPLES)/mimic/mimic2-womanloveffmpeg.cam
 
@@ -145,6 +148,7 @@ fate-motionpixels: CMD = framecrc -i $(SAMPLES)/motion-pixels/INTRO-partial.MVI
 FATE_VIDEO += fate-mpeg2-field-enc
 fate-mpeg2-field-enc: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -an
 
+# FIXME dropped frames in this test because of coarse timebase
 FATE_VIDEO += fate-nuv
 fate-nuv: CMD = framecrc -idct simple -i $(SAMPLES)/nuv/Today.nuv -an
 
@@ -157,6 +161,9 @@ fate-r210: CMD = framecrc -i $(SAMPLES)/r210/r210.avi -pix_fmt rgb48le
 FATE_VIDEO += fate-rl2
 fate-rl2: CMD = framecrc -i $(SAMPLES)/rl2/Z4915300.RL2 -pix_fmt rgb24 -an
 
+FATE_VIDEO += fate-roqvideo
+fate-roqvideo: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq -an
+
 FATE_VIDEO += fate-smacker
 fate-smacker: CMD = framecrc -i $(SAMPLES)/smacker/wetlogo.smk -pix_fmt rgb24
 
@@ -169,6 +176,9 @@ fate-sp5x: CMD = framecrc -idct simple -i $(SAMPLES)/sp5x/sp5x_problem.avi
 FATE_VIDEO += fate-sub-srt
 fate-sub-srt: CMD = md5 -i $(SAMPLES)/sub/SubRip_capability_tester.srt -f ass
 
+FATE_VIDEO += fate-thp
+fate-thp: CMD = framecrc -idct simple -i $(SAMPLES)/thp/pikmin2-opening1-partial.thp -an
+
 FATE_VIDEO += fate-tiertex-seq
 fate-tiertex-seq: CMD = framecrc -i $(SAMPLES)/tiertex-seq/Gameover.seq -pix_fmt rgb24
 
@@ -218,5 +228,5 @@ fate-yop: CMD = framecrc -i $(SAMPLES)/yop/test1.yop -pix_fmt rgb24 -an
 FATE_VIDEO += fate-xxan-wc4
 fate-xxan-wc4: CMD = framecrc -i $(SAMPLES)/wc4-xan/wc4trailer-partial.avi -an
 
-FATE_TESTS += $(FATE_VIDEO)
+FATE_FFMPEG += $(FATE_VIDEO)
 fate-video: $(FATE_VIDEO)
diff --git a/tests/fate/voice.mak b/tests/fate/voice.mak
index f8fa24b7b61974d653a663e17e104405ce8d3f44..9d151dcebafef83b597b2aba13e96cbea974f3c4 100644
--- a/tests/fate/voice.mak
+++ b/tests/fate/voice.mak
@@ -51,5 +51,5 @@ fate-truespeech: CMD = pcm -i $(SAMPLES)/truespeech/a6.wav
 fate-truespeech: CMP = oneoff
 fate-truespeech: REF = $(SAMPLES)/truespeech/a6.pcm
 
-FATE_TESTS += $(FATE_VOICE)
+FATE_FFMPEG += $(FATE_VOICE)
 fate-voice: $(FATE_VOICE)
diff --git a/tests/fate/vorbis.mak b/tests/fate/vorbis.mak
index 5452b74af5dbe9bfb862219c6affb973008f0829..25a5d897964788486488a9ceba51a46adb54bf4f 100644
--- a/tests/fate/vorbis.mak
+++ b/tests/fate/vorbis.mak
@@ -75,6 +75,6 @@ FATE_VORBIS += fate-vorbis-19
 fate-vorbis-19: CMD = pcm -i $(SAMPLES)/vorbis/test-short2_small.ogg
 fate-vorbis-19: REF = $(SAMPLES)/vorbis/test-short2_small.pcm
 
-FATE_TESTS += $(FATE_VORBIS)
+FATE_AVCONV += $(FATE_VORBIS)
 fate-vorbis: $(FATE_VORBIS)
 $(FATE_VORBIS): CMP = oneoff
diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index 87b11cc23f3a8e7b25a1ba3e2708bed81588c083..e468735e21ac24a57e7f77c8bde299d8db4eb044 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -1,25 +1,28 @@
-FATE_TESTS += fate-ea-vp60
+FATE_EA_VP6 += fate-ea-vp60
 fate-ea-vp60: CMD = framecrc -i $(SAMPLES)/ea-vp6/g36.vp6
 
-FATE_TESTS += fate-ea-vp61
+FATE_EA_VP6 += fate-ea-vp61
 fate-ea-vp61: CMD = framecrc -i $(SAMPLES)/ea-vp6/MovieSkirmishGondor.vp6 -t 4
 
+FATE_AVCONV += $(FATE_EA_VP6)
+fate-ea-vp6: $(FATE_EA_VP6)
+
 FATE_VP3 += fate-vp31
 fate-vp31: CMD = framecrc -i $(SAMPLES)/vp3/vp31.avi
 
 FATE_VP3 += fate-vp3-coeff-level64
 fate-vp3-coeff-level64: CMD = framecrc -i $(SAMPLES)/vp3/coeff_level64.mkv
 
-FATE_TESTS += $(FATE_VP3)
+FATE_AVCONV += $(FATE_VP3)
 fate-vp3: $(FATE_VP3)
 
-FATE_TESTS += fate-vp5
+FATE_AVCONV += fate-vp5
 fate-vp5: CMD = framecrc -i $(SAMPLES)/vp5/potter512-400-partial.avi -an
 
-FATE_TESTS += fate-vp6a
+FATE_AVCONV += fate-vp6a
 fate-vp6a: CMD = framecrc -i $(SAMPLES)/flash-vp6/300x180-Scr-f8-056alpha.flv
 
-FATE_TESTS += fate-vp6f
+FATE_AVCONV += fate-vp6f
 fate-vp6f: CMD = framecrc -i $(SAMPLES)/flash-vp6/clip1024.flv
 
 VP8_SUITE = 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017
@@ -46,5 +49,5 @@ endef
 
 $(eval $(call FATE_VP8_FULL))
 $(eval $(call FATE_VP8_FULL,-emu-edge,-flags +emu_edge))
-FATE_TESTS += $(FATE_VP8)
+FATE_AVCONV += $(FATE_VP8)
 fate-vp8: $(FATE_VP8)
diff --git a/tests/fate/vqf.mak b/tests/fate/vqf.mak
index 04c531de0f1680d46e10a4e3ccb1567b5894ca35..042c055fc113f78e31859420e8c5e966163d2fc1 100644
--- a/tests/fate/vqf.mak
+++ b/tests/fate/vqf.mak
@@ -6,5 +6,5 @@ fate-twinvq: REF = $(SAMPLES)/vqf/achterba.pcm
 FATE_VQF += fate-vqf-demux
 fate-vqf-demux: CMD = md5 -i $(SAMPLES)/vqf/achterba.vqf -acodec copy -f framecrc
 
-FATE_TESTS += $(FATE_VQF)
+FATE_FFMPEG += $(FATE_VQF)
 fate-vqf: $(FATE_VQF)
diff --git a/tests/fate/wavpack.mak b/tests/fate/wavpack.mak
index bf1895487795d1cdb44442316bd08d078ae183cd..d70f713725856848f7d56c7bc573badba90722ae 100644
--- a/tests/fate/wavpack.mak
+++ b/tests/fate/wavpack.mak
@@ -1,4 +1,4 @@
-# Lossless
+# lossless
 
 FATE_WAVPACK += fate-wavpack-lossless-float
 fate-wavpack-lossless-float: CMD = md5 -i $(SAMPLES)/wavpack/lossless/32bit_float-partial.wv -f f32le
@@ -18,7 +18,7 @@ fate-wavpack-lossless-24bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/24bit-part
 FATE_WAVPACK += fate-wavpack-lossless-32bit
 fate-wavpack-lossless-32bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/32bit_int-partial.wv -f s32le
 
-# Lossy
+# lossy
 
 FATE_WAVPACK += fate-wavpack-lossy-float
 fate-wavpack-lossy-float: CMD = md5 -i $(SAMPLES)/wavpack/lossy/2.0_32-bit_float.wv -f f32le
@@ -35,7 +35,7 @@ fate-wavpack-lossy-24bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_24-bit.wv -f
 FATE_WAVPACK += fate-wavpack-lossy-32bit
 fate-wavpack-lossy-32bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_32-bit_int.wv -f s32le
 
-# Channel configurations
+# channel configurations
 
 FATE_WAVPACK += fate-wavpack-channels-monofloat
 fate-wavpack-channels-monofloat: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/mono_float-partial.wv -f f32le
@@ -55,7 +55,7 @@ fate-wavpack-channels-6.1: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/eva_2.22
 FATE_WAVPACK += fate-wavpack-channels-7.1
 fate-wavpack-channels-7.1: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/panslab_sample_7.1_16bit-partial.wv -f s16le
 
-# Speed modes
+# speed modes
 
 FATE_WAVPACK += fate-wavpack-speed-default
 fate-wavpack-speed-default: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/default-partial.wv  -f s16le
@@ -69,7 +69,7 @@ fate-wavpack-speed-high: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/high-partia
 FATE_WAVPACK += fate-wavpack-speed-vhigh
 fate-wavpack-speed-vhigh: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/vhigh-partial.wv  -f s16le
 
-# Special Cases
+# special cases
 
 FATE_WAVPACK += fate-wavpack-cuesheet
 fate-wavpack-cuesheet: CMD = md5 -i $(SAMPLES)/wavpack/special/cue_sheet.wv -f s16le
@@ -86,5 +86,5 @@ fate-wavpack-falsestereo: CMD = md5 -i $(SAMPLES)/wavpack/special/false_stereo.w
 FATE_WAVPACK += fate-wavpack-matroskamode
 fate-wavpack-matroskamode: CMD = md5 -i $(SAMPLES)/wavpack/special/matroska_mode.mka -f s16le
 
-FATE_TESTS += $(FATE_WAVPACK)
+FATE_AVCONV += $(FATE_WAVPACK)
 fate-wavpack: $(FATE_WAVPACK)
diff --git a/tests/fate/wma.mak b/tests/fate/wma.mak
index 6fd4b38ca71cb763d6160c8c7acf8019e3e2697f..41b88ae2f162247ea2c91d5e4dd1290bc24af801 100644
--- a/tests/fate/wma.mak
+++ b/tests/fate/wma.mak
@@ -13,7 +13,7 @@ fate-wmapro-ism: CMD = pcm -i $(SAMPLES)/isom/vc1-wmapro.ism -vn
 fate-wmapro-ism: CMP = oneoff
 fate-wmapro-ism: REF = $(SAMPLES)/isom/vc1-wmapro.pcm
 
-FATE_TESTS += $(FATE_WMAPRO)
+FATE_AVCONV += $(FATE_WMAPRO)
 fate-wmapro: $(FATE_WMAPRO)
 
 FATE_WMAVOICE += fate-wmavoice-7k
@@ -34,7 +34,7 @@ fate-wmavoice-19k: CMP = stddev
 fate-wmavoice-19k: REF = $(SAMPLES)/wmavoice/streaming_CBR-19K.pcm
 fate-wmavoice-19k: FUZZ = 3
 
-FATE_TESTS += $(FATE_WMAVOICE)
+FATE_AVCONV += $(FATE_WMAVOICE)
 fate-wmavoice: $(FATE_WMAVOICE)
 
 FATE_WMA_ENCODE += fate-wmav1-encode
@@ -53,5 +53,5 @@ fate-wmav2-encode: CMP_SHIFT = -8192
 fate-wmav2-encode: CMP_TARGET = 258.32
 fate-wmav2-encode: SIZE_TOLERANCE = 4632
 
-FATE_TESTS += $(FATE_WMA_ENCODE)
+FATE_AVCONV += $(FATE_WMA_ENCODE)
 fate-wma-encode: $(FATE_WMA_ENCODE)
diff --git a/tests/ref/fate/adpcm-ea-1 b/tests/ref/fate/adpcm-ea-1
new file mode 100644
index 0000000000000000000000000000000000000000..f5a33df710a4ad690cce8ecb0178ec732f1cd362
--- /dev/null
+++ b/tests/ref/fate/adpcm-ea-1
@@ -0,0 +1,26 @@
+#tb 0: 1/22050
+0,          0,          0,     1484,     5936, 0x00000000
+0,       1484,       1484,     1456,     5824, 0x00000000
+0,       2940,       2940,     1484,     5936, 0x00000000
+0,       4424,       4424,     1456,     5824, 0x00000000
+0,       5880,       5880,     1484,     5936, 0x00000000
+0,       7364,       7364,     1456,     5824, 0x00000000
+0,       8820,       8820,     1484,     5936, 0x00000000
+0,      10304,      10304,     1456,     5824, 0x0f06f5bb
+0,      11760,      11760,     1484,     5936, 0xb0dbfc46
+0,      13244,      13244,     1456,     5824, 0x9daa9f9c
+0,      14700,      14700,     1484,     5936, 0x61400d2f
+0,      16184,      16184,     1456,     5824, 0x34a5b0e3
+0,      17640,      17640,     1484,     5936, 0x6e546f72
+0,      19124,      19124,     1456,     5824, 0x4f093b35
+0,      20580,      20580,     1484,     5936, 0x95b5b599
+0,      22064,      22064,     1456,     5824, 0x75e15e60
+0,      23520,      23520,     1484,     5936, 0xd1077d39
+0,      25004,      25004,     1456,     5824, 0x956e21ca
+0,      26460,      26460,     1484,     5936, 0x33bac234
+0,      27944,      27944,     1456,     5824, 0x5df37824
+0,      29400,      29400,     1484,     5936, 0xc174af24
+0,      30884,      30884,     1456,     5824, 0xe5dc2159
+0,      32340,      32340,     1484,     5936, 0x63ffc8b1
+0,      33824,      33824,     1456,     5824, 0xefe4c365
+0,      35280,      35280,     1484,     5936, 0x2174304d
diff --git a/tests/ref/fate/adpcm-ea-2 b/tests/ref/fate/adpcm-ea-2
new file mode 100644
index 0000000000000000000000000000000000000000..f58d9a00ce549fb76cf8d969c9752f1f9a9b0e4a
--- /dev/null
+++ b/tests/ref/fate/adpcm-ea-2
@@ -0,0 +1,134 @@
+#tb 0: 1/22050
+0,          0,          0,     1484,     5936, 0xea261a29
+0,       1484,       1484,     1456,     5824, 0x253df061
+0,       2940,       2940,     1484,     5936, 0x603a5bd7
+0,       4424,       4424,     1456,     5824, 0x9d283f59
+0,       5880,       5880,     1484,     5936, 0x49323497
+0,       7364,       7364,     1456,     5824, 0x7c299939
+0,       8820,       8820,     1484,     5936, 0x9f918e9a
+0,      10304,      10304,     1456,     5824, 0x1226b534
+0,      11760,      11760,     1484,     5936, 0xdd159326
+0,      13244,      13244,     1456,     5824, 0x361ad10f
+0,      14700,      14700,     1484,     5936, 0x6ccac9e3
+0,      16184,      16184,     1456,     5824, 0x1861efef
+0,      17640,      17640,     1484,     5936, 0x5f718eb9
+0,      19124,      19124,     1456,     5824, 0xd4ca72ba
+0,      20580,      20580,     1484,     5936, 0xbf2b27e6
+0,      22064,      22064,     1456,     5824, 0xcb6f024e
+0,      23520,      23520,     1484,     5936, 0x7dfb7e05
+0,      25004,      25004,     1456,     5824, 0x80e16f13
+0,      26460,      26460,     1484,     5936, 0x0fb59227
+0,      27944,      27944,     1456,     5824, 0x4d6f1fdb
+0,      29400,      29400,     1484,     5936, 0x505a5103
+0,      30884,      30884,     1456,     5824, 0x47ef4c13
+0,      32340,      32340,     1484,     5936, 0xbe4795fb
+0,      33824,      33824,     1456,     5824, 0xb82cc4ff
+0,      35280,      35280,     1484,     5936, 0xf7c6ab8d
+0,      36764,      36764,     1456,     5824, 0x1442f5e0
+0,      38220,      38220,     1484,     5936, 0x64659389
+0,      39704,      39704,     1456,     5824, 0xdd81725c
+0,      41160,      41160,     1484,     5936, 0x7f7c604f
+0,      42644,      42644,     1456,     5824, 0xafc77beb
+0,      44100,      44100,     1484,     5936, 0x24f88e4d
+0,      45584,      45584,     1456,     5824, 0xa31956ca
+0,      47040,      47040,     1484,     5936, 0x958e02b9
+0,      48524,      48524,     1456,     5824, 0xcfc79890
+0,      49980,      49980,     1484,     5936, 0xc7e788ae
+0,      51464,      51464,     1456,     5824, 0x4b6b1acc
+0,      52920,      52920,     1484,     5936, 0xa74496dc
+0,      54404,      54404,     1456,     5824, 0x719e6171
+0,      55860,      55860,     1484,     5936, 0x9346222d
+0,      57344,      57344,     1456,     5824, 0x9e2a876e
+0,      58800,      58800,     1484,     5936, 0xeca6ea64
+0,      60284,      60284,     1456,     5824, 0x07d8174f
+0,      61740,      61740,     1484,     5936, 0x2df5aa6b
+0,      63224,      63224,     1456,     5824, 0x314e7034
+0,      64680,      64680,     1484,     5936, 0x5a328768
+0,      66164,      66164,     1456,     5824, 0x32b92446
+0,      67620,      67620,     1484,     5936, 0x20ecbc9b
+0,      69104,      69104,     1456,     5824, 0x76019c14
+0,      70560,      70560,     1484,     5936, 0x8c3ef8a6
+0,      72044,      72044,     1456,     5824, 0xcdaab50b
+0,      73500,      73500,     1484,     5936, 0xb2f87f4f
+0,      74984,      74984,     1456,     5824, 0x70c26379
+0,      76440,      76440,     1484,     5936, 0x5691ecfd
+0,      77924,      77924,     1456,     5824, 0x61e208fe
+0,      79380,      79380,     1484,     5936, 0x87d1a5e0
+0,      80864,      80864,     1456,     5824, 0x02054cfd
+0,      82320,      82320,     1484,     5936, 0x22ff1c4b
+0,      83804,      83804,     1456,     5824, 0xc6d87fef
+0,      85260,      85260,     1484,     5936, 0x9028bb3b
+0,      86744,      86744,     1456,     5824, 0xbadde406
+0,      88200,      88200,     1484,     5936, 0x6e88ddf1
+0,      89684,      89684,     1456,     5824, 0x5bb8be6e
+0,      91140,      91140,     1484,     5936, 0xe1f8d7fc
+0,      92624,      92624,     1456,     5824, 0xc824e388
+0,      94080,      94080,     1484,     5936, 0x654371a9
+0,      95564,      95564,     1456,     5824, 0xae6ee9ec
+0,      97020,      97020,     1484,     5936, 0x9aa4550d
+0,      98504,      98504,     1456,     5824, 0xdce210ac
+0,      99960,      99960,     1484,     5936, 0xb12641c8
+0,     101444,     101444,     1456,     5824, 0x277e014b
+0,     102900,     102900,     1484,     5936, 0xb0d262de
+0,     104384,     104384,     1456,     5824, 0xf94d6f49
+0,     105840,     105840,     1484,     5936, 0x3d7848cb
+0,     107324,     107324,     1456,     5824, 0xe67fc08e
+0,     108780,     108780,     1484,     5936, 0x0475e0d6
+0,     110264,     110264,     1456,     5824, 0x8a9a4a2e
+0,     111720,     111720,     1484,     5936, 0x82576204
+0,     113204,     113204,     1456,     5824, 0x3017b648
+0,     114660,     114660,     1484,     5936, 0xca4c3e04
+0,     116144,     116144,     1456,     5824, 0x340077d1
+0,     117600,     117600,     1484,     5936, 0x805bea6e
+0,     119084,     119084,     1456,     5824, 0x2cf6c87b
+0,     120540,     120540,     1484,     5936, 0x3635bc5f
+0,     122024,     122024,     1456,     5824, 0x0d7a81c7
+0,     123480,     123480,     1484,     5936, 0x26179764
+0,     124964,     124964,     1456,     5824, 0xa0b2454f
+0,     126420,     126420,     1484,     5936, 0x91d24608
+0,     127904,     127904,     1456,     5824, 0x6509b3e1
+0,     129360,     129360,     1484,     5936, 0xa0e3c9fc
+0,     130844,     130844,     1456,     5824, 0x18682a2f
+0,     132300,     132300,     1484,     5936, 0x89cea4ff
+0,     133784,     133784,     1456,     5824, 0x7dd22b85
+0,     135240,     135240,     1484,     5936, 0x8b2eeb8d
+0,     136724,     136724,     1456,     5824, 0x0c21af82
+0,     138180,     138180,     1484,     5936, 0x9c5a748d
+0,     139664,     139664,     1456,     5824, 0x1dc72c5c
+0,     141120,     141120,     1484,     5936, 0xe6129383
+0,     142604,     142604,     1456,     5824, 0x0a44312a
+0,     144060,     144060,     1484,     5936, 0x7ed30640
+0,     145544,     145544,     1456,     5824, 0xede15f25
+0,     147000,     147000,     1484,     5936, 0x0096d0f3
+0,     148484,     148484,     1456,     5824, 0x13764b4b
+0,     149940,     149940,     1484,     5936, 0xd4608756
+0,     151424,     151424,     1456,     5824, 0x254b5f2a
+0,     152880,     152880,     1484,     5936, 0x7705b830
+0,     154364,     154364,     1456,     5824, 0x64a63d78
+0,     155820,     155820,     1484,     5936, 0xc02d81a6
+0,     157304,     157304,     1456,     5824, 0xd239e55e
+0,     158760,     158760,     1484,     5936, 0x8018cd3a
+0,     160244,     160244,     1456,     5824, 0xf86b8a98
+0,     161700,     161700,     1484,     5936, 0x2a0078bc
+0,     163184,     163184,     1456,     5824, 0x058d4e1b
+0,     164640,     164640,     1484,     5936, 0xbc718309
+0,     166124,     166124,     1456,     5824, 0xaf6c29e5
+0,     167580,     167580,     1484,     5936, 0x80df004d
+0,     169064,     169064,     1456,     5824, 0xeca5aa57
+0,     170520,     170520,     1484,     5936, 0xb793a8f8
+0,     172004,     172004,     1456,     5824, 0x70fa6aff
+0,     173460,     173460,     1484,     5936, 0xda8d4cc6
+0,     174944,     174944,     1456,     5824, 0xa70088eb
+0,     176400,     176400,     1484,     5936, 0x1c0b0aab
+0,     177884,     177884,     1456,     5824, 0x234d2436
+0,     179340,     179340,     1484,     5936, 0xf79d731e
+0,     180824,     180824,     1456,     5824, 0x5a4e454a
+0,     182280,     182280,     1484,     5936, 0xccf6d042
+0,     183764,     183764,     1456,     5824, 0x4e524d14
+0,     185220,     185220,     1484,     5936, 0xf8f2fcc3
+0,     186704,     186704,     1456,     5824, 0x08f12491
+0,     188160,     188160,     1484,     5936, 0x506e0a42
+0,     189644,     189644,     1456,     5824, 0x7cf05049
+0,     191100,     191100,     1484,     5936, 0xdeb9d295
+0,     192584,     192584,     1456,     5824, 0x758ef642
+0,     194040,     194040,     1484,     5936, 0x91903980
diff --git a/tests/ref/fate/adpcm-ea-r1 b/tests/ref/fate/adpcm-ea-r1
new file mode 100644
index 0000000000000000000000000000000000000000..74d15c6f673e5fc4f19ab6bea5a58b1ac74817b4
--- /dev/null
+++ b/tests/ref/fate/adpcm-ea-r1
@@ -0,0 +1,96 @@
+#tb 0: 1/48000
+0,          0,          0,     1624,     6496, 0x00000000
+0,       1624,       1624,     1596,     6384, 0x00000000
+0,       3220,       3220,     1596,     6384, 0x00000000
+0,       4816,       4816,     1596,     6384, 0x00000000
+0,       6412,       6412,     1596,     6384, 0x00000000
+0,       8008,       8008,     1624,     6496, 0xe2034d04
+0,       9632,       9632,     1596,     6384, 0x089c9157
+0,      11228,      11228,     1596,     6384, 0xeed5743c
+0,      12824,      12824,     1596,     6384, 0x71de6b34
+0,      14420,      14420,     1596,     6384, 0xc0d67710
+0,      16016,      16016,     1624,     6496, 0x35786490
+0,      17640,      17640,     1596,     6384, 0xdf1c99a2
+0,      19236,      19236,     1596,     6384, 0xca9591ad
+0,      20832,      20832,     1596,     6384, 0x6f0d9c3d
+0,      22428,      22428,     1596,     6384, 0xfacbbaee
+0,      24024,      24024,     1624,     6496, 0x927fb136
+0,      25648,      25648,     1596,     6384, 0x9d4f2572
+0,      27244,      27244,     1596,     6384, 0x2a3c6d08
+0,      28840,      28840,     1596,     6384, 0x4282b1e0
+0,      30436,      30436,     1596,     6384, 0xc4a77b9f
+0,      32032,      32032,     1624,     6496, 0x2af6a14f
+0,      33656,      33656,     1596,     6384, 0x4d734169
+0,      35252,      35252,     1596,     6384, 0xb91b5865
+0,      36848,      36848,     1596,     6384, 0x9dce2417
+0,      38444,      38444,     1596,     6384, 0xb7c4e1ce
+0,      40040,      40040,     1624,     6496, 0xef0dc07a
+0,      41664,      41664,     1596,     6384, 0x4ad21d10
+0,      43260,      43260,     1596,     6384, 0xcfe14682
+0,      44856,      44856,     1596,     6384, 0x07be48eb
+0,      46452,      46452,     1596,     6384, 0x09de3498
+0,      48048,      48048,     1624,     6496, 0xab2e9686
+0,      49672,      49672,     1596,     6384, 0x3aba3ccc
+0,      51268,      51268,     1596,     6384, 0x0a905ec3
+0,      52864,      52864,     1596,     6384, 0x76a93ce4
+0,      54460,      54460,     1596,     6384, 0xa99063a4
+0,      56056,      56056,     1624,     6496, 0xc16bb88d
+0,      57680,      57680,     1596,     6384, 0x650379bf
+0,      59276,      59276,     1596,     6384, 0x4e0749fe
+0,      60872,      60872,     1596,     6384, 0x778e8d12
+0,      62468,      62468,     1596,     6384, 0x9fa8c494
+0,      64064,      64064,     1624,     6496, 0x61d5bead
+0,      65688,      65688,     1596,     6384, 0x4da9bc3c
+0,      67284,      67284,     1596,     6384, 0xa72b6f93
+0,      68880,      68880,     1596,     6384, 0x811f5f77
+0,      70476,      70476,     1596,     6384, 0x83ea5e3d
+0,      72072,      72072,     1624,     6496, 0x78bab460
+0,      73696,      73696,     1596,     6384, 0xc9a07432
+0,      75292,      75292,     1596,     6384, 0x4b4f2a34
+0,      76888,      76888,     1596,     6384, 0x4d707a53
+0,      78484,      78484,     1596,     6384, 0x703efb60
+0,      80080,      80080,     1624,     6496, 0x319a77bb
+0,      81704,      81704,     1596,     6384, 0xbdfd82ec
+0,      83300,      83300,     1596,     6384, 0x413c3503
+0,      84896,      84896,     1596,     6384, 0xe6e666b3
+0,      86492,      86492,     1596,     6384, 0xa09c7342
+0,      88088,      88088,     1624,     6496, 0x60cba846
+0,      89712,      89712,     1596,     6384, 0x0ba34308
+0,      91308,      91308,     1596,     6384, 0xdc3a65f0
+0,      92904,      92904,     1596,     6384, 0x1ebf9dc4
+0,      94500,      94500,     1596,     6384, 0xbbcb1449
+0,      96096,      96096,     1624,     6496, 0x926574eb
+0,      97720,      97720,     1596,     6384, 0xb4da92f1
+0,      99316,      99316,     1596,     6384, 0xdbbd21e0
+0,     100912,     100912,     1596,     6384, 0x08510eff
+0,     102508,     102508,     1596,     6384, 0x9534b7ca
+0,     104104,     104104,     1624,     6496, 0x50a5ed30
+0,     105728,     105728,     1596,     6384, 0xf5ac2f7c
+0,     107324,     107324,     1596,     6384, 0x4fe1fa55
+0,     108920,     108920,     1596,     6384, 0xd61c4c05
+0,     110516,     110516,     1596,     6384, 0x56d11b45
+0,     112112,     112112,     1624,     6496, 0x3906084b
+0,     113736,     113736,     1596,     6384, 0x1ef31fed
+0,     115332,     115332,     1596,     6384, 0x58ed82f5
+0,     116928,     116928,     1596,     6384, 0xb31ccd1f
+0,     118524,     118524,     1596,     6384, 0xfb648285
+0,     120120,     120120,     1624,     6496, 0xfae2950b
+0,     121744,     121744,     1596,     6384, 0xe28c8357
+0,     123340,     123340,     1596,     6384, 0xda718e60
+0,     124936,     124936,     1596,     6384, 0x27516999
+0,     126532,     126532,     1596,     6384, 0x0ba07921
+0,     128128,     128128,     1624,     6496, 0xcfbecfab
+0,     129752,     129752,     1596,     6384, 0xae4cedcd
+0,     131348,     131348,     1596,     6384, 0x917b4707
+0,     132944,     132944,     1596,     6384, 0x8671b28e
+0,     134540,     134540,     1596,     6384, 0x9a1238fa
+0,     136136,     136136,     1624,     6496, 0x23b8f8ca
+0,     137760,     137760,     1596,     6384, 0x3903bcd6
+0,     139356,     139356,     1596,     6384, 0x0532b267
+0,     140952,     140952,     1596,     6384, 0xde931220
+0,     142548,     142548,     1596,     6384, 0x4ed70a80
+0,     144144,     144144,     1624,     6496, 0x4a52d5a1
+0,     145768,     145768,     1596,     6384, 0xc1be5760
+0,     147364,     147364,     1596,     6384, 0x790d69ba
+0,     148960,     148960,     1596,     6384, 0x9d73e6cf
+0,     150556,     150556,     1568,     6272, 0xbc0fc725
diff --git a/tests/ref/fate/adpcm-ima-ea-eacs b/tests/ref/fate/adpcm-ima-ea-eacs
new file mode 100644
index 0000000000000000000000000000000000000000..9887296f4542defc7d6684bf0f4221c878090572
--- /dev/null
+++ b/tests/ref/fate/adpcm-ima-ea-eacs
@@ -0,0 +1,48 @@
+#tb 0: 1/22050
+0,          0,          0,     1468,     5872, 0x00000000
+0,       1468,       1468,     1468,     5872, 0x00000000
+0,       2936,       2936,     1468,     5872, 0x00000000
+0,       4404,       4404,     1468,     5872, 0x00000000
+0,       5872,       5872,     1468,     5872, 0x00000000
+0,       7340,       7340,     1468,     5872, 0x00000000
+0,       8808,       8808,     1468,     5872, 0x00000000
+0,      10276,      10276,     1468,     5872, 0x00000000
+0,      11744,      11744,     1468,     5872, 0x00000000
+0,      13212,      13212,     1468,     5872, 0x00000000
+0,      14680,      14680,     1468,     5872, 0x00000000
+0,      16148,      16148,     1468,     5872, 0x00000000
+0,      17616,      17616,     1468,     5872, 0x00000000
+0,      19084,      19084,     1468,     5872, 0x00000000
+0,      20552,      20552,     1468,     5872, 0x00000000
+0,      22020,      22020,     1468,     5872, 0xc6f64777
+0,      23488,      23488,     1468,     5872, 0x7c9e60e8
+0,      24956,      24956,     1468,     5872, 0x46525c54
+0,      26424,      26424,     1468,     5872, 0x842796bb
+0,      27892,      27892,     1468,     5872, 0xb1f6cbd5
+0,      29360,      29360,     1468,     5872, 0x0261a74b
+0,      30828,      30828,     1468,     5872, 0x8218b1f9
+0,      32296,      32296,     1468,     5872, 0xd7a2cae6
+0,      33764,      33764,     1468,     5872, 0x69d34562
+0,      35232,      35232,     1468,     5872, 0x9303ec65
+0,      36700,      36700,     1468,     5872, 0xd5d963a1
+0,      38168,      38168,     1468,     5872, 0x0557e06f
+0,      39636,      39636,     1468,     5872, 0x1eb48b41
+0,      41104,      41104,     1468,     5872, 0x70f5ca3f
+0,      42572,      42572,     1468,     5872, 0xd39e5c5e
+0,      44040,      44040,     1468,     5872, 0x29c59140
+0,      45508,      45508,     1468,     5872, 0x7d95e643
+0,      46976,      46976,     1468,     5872, 0x45353fd8
+0,      48444,      48444,     1468,     5872, 0xad7b1b27
+0,      49912,      49912,     1468,     5872, 0x1f0377b3
+0,      51380,      51380,     1468,     5872, 0x6074541e
+0,      52848,      52848,     1468,     5872, 0xa4f5e892
+0,      54316,      54316,     1468,     5872, 0x084bc696
+0,      55784,      55784,     1468,     5872, 0x67fdafce
+0,      57252,      57252,     1468,     5872, 0x8dfd249d
+0,      58720,      58720,     1468,     5872, 0x514184ee
+0,      60188,      60188,     1468,     5872, 0xc0090b0d
+0,      61656,      61656,     1468,     5872, 0xc1171cc8
+0,      63124,      63124,     1468,     5872, 0x7d7dd07e
+0,      64592,      64592,     1468,     5872, 0xe6aa619c
+0,      66060,      66060,     1468,     5872, 0xd5aac0df
+0,      67528,      67528,     1468,     5872, 0x3b68b390
diff --git a/tests/ref/fate/adpcm-ima-ea-sead b/tests/ref/fate/adpcm-ima-ea-sead
new file mode 100644
index 0000000000000000000000000000000000000000..17c10875a6a601b8fbd3aac66093e5ab00a7b632
--- /dev/null
+++ b/tests/ref/fate/adpcm-ima-ea-sead
@@ -0,0 +1,50 @@
+#tb 0: 1/22050
+0,          0,          0,      736,     2944, 0x00000000
+0,        736,        736,     1472,     5888, 0x5ae3c2a4
+0,       2208,       2208,     1472,     5888, 0x158fbcb4
+0,       3680,       3680,     1472,     5888, 0x3fc85d35
+0,       5152,       5152,     1472,     5888, 0x4667ec2b
+0,       6624,       6624,     1472,     5888, 0x82744494
+0,       8096,       8096,     1472,     5888, 0x3b0cb86f
+0,       9568,       9568,     1472,     5888, 0x29493fbb
+0,      11040,      11040,     1472,     5888, 0xaa2d8595
+0,      12512,      12512,     1472,     5888, 0x2e563de6
+0,      13984,      13984,     1472,     5888, 0x225cca99
+0,      15456,      15456,     1472,     5888, 0x2b577599
+0,      16928,      16928,     1472,     5888, 0x3d967f32
+0,      18400,      18400,     1472,     5888, 0x16639a84
+0,      19872,      19872,     1472,     5888, 0x90549ba0
+0,      21344,      21344,     1472,     5888, 0xf46e6644
+0,      22816,      22816,     1472,     5888, 0x39a073ec
+0,      24288,      24288,     1472,     5888, 0xb1d7a93a
+0,      25760,      25760,     1472,     5888, 0x25e9795b
+0,      27232,      27232,     1472,     5888, 0xbbc07644
+0,      28704,      28704,     1472,     5888, 0x323f6a1b
+0,      30176,      30176,     1472,     5888, 0x7cae130b
+0,      31648,      31648,     1472,     5888, 0xd23bf9c6
+0,      33120,      33120,     1472,     5888, 0x5f73ef35
+0,      34592,      34592,     1472,     5888, 0xc66026be
+0,      36064,      36064,     1472,     5888, 0xc8fdb539
+0,      37536,      37536,     1472,     5888, 0x94c6bfbd
+0,      39008,      39008,     1472,     5888, 0xb77e1b83
+0,      40480,      40480,     1472,     5888, 0x6c6d6693
+0,      41952,      41952,     1472,     5888, 0xd9f064d4
+0,      43424,      43424,     1472,     5888, 0x85dd990d
+0,      44896,      44896,     1472,     5888, 0x385e021b
+0,      46368,      46368,     1472,     5888, 0xac09fd02
+0,      47840,      47840,     1472,     5888, 0xc6dcdff2
+0,      49312,      49312,     1472,     5888, 0x86a6944d
+0,      50784,      50784,     1472,     5888, 0x8587b964
+0,      52256,      52256,     1472,     5888, 0x2b0355ff
+0,      53728,      53728,     1472,     5888, 0xe4148a85
+0,      55200,      55200,     1472,     5888, 0xdf02ed4f
+0,      56672,      56672,     1472,     5888, 0x87a54b15
+0,      58144,      58144,     1472,     5888, 0x3ad2be45
+0,      59616,      59616,     1472,     5888, 0x3a49c2c3
+0,      61088,      61088,     1472,     5888, 0xc2b66404
+0,      62560,      62560,     1472,     5888, 0xac3e234a
+0,      64032,      64032,     1472,     5888, 0x5dcf523b
+0,      65504,      65504,     1472,     5888, 0x2034b5d6
+0,      66976,      66976,     1472,     5888, 0x96882832
+0,      68448,      68448,     1472,     5888, 0x2be3d534
+0,      69920,      69920,     1472,     5888, 0xa841a49d
diff --git a/tests/ref/fate/adpcm-thp b/tests/ref/fate/adpcm-thp
index 135de54910c93e02dcf2165e0bb5a437356578c9..72aff61ade023d0771f138daaa5c0078307cb1ee 100644
--- a/tests/ref/fate/adpcm-thp
+++ b/tests/ref/fate/adpcm-thp
@@ -1,145 +1,72 @@
-#tb 0: 524288/15712911
-#tb 1: 1/32000
-0,          0,          0,        1,   291840, 0xbd7e0b22
-1,          0,          0,     1078,     4312, 0x469714f6
-0,          1,          1,        1,   291840, 0xf6e12ca5
-1,       1078,       1078,     1064,     4256, 0xe03dd882
-0,          2,          2,        1,   291840, 0x528c7049
-1,       2142,       2142,     1078,     4312, 0x46b901f7
-0,          3,          3,        1,   291840, 0x93055de9
-1,       3220,       3220,     1064,     4256, 0x8d4a54e4
-0,          4,          4,        1,   291840, 0xf95a51c1
-1,       4284,       4284,     1064,     4256, 0xfd616b67
-0,          5,          5,        1,   291840, 0x6ad3a65a
-1,       5348,       5348,     1078,     4312, 0xefe62302
-0,          6,          6,        1,   291840, 0x494684a7
-1,       6426,       6426,     1064,     4256, 0xab11684e
-0,          7,          7,        1,   291840, 0x74c14eb1
-1,       7490,       7490,     1064,     4256, 0xb4b3feb8
-0,          8,          8,        1,   291840, 0x149fcb7e
-1,       8554,       8554,     1078,     4312, 0x71db6461
-0,          9,          9,        1,   291840, 0x25649761
-1,       9632,       9632,     1064,     4256, 0x090e5efa
-0,         10,         10,        1,   291840, 0xbc3f9052
-1,      10696,      10696,     1064,     4256, 0x36f49c28
-0,         11,         11,        1,   291840, 0x080edfff
-1,      11760,      11760,     1078,     4312, 0x0fe3d262
-0,         12,         12,        1,   291840, 0x6d7ad684
-1,      12838,      12838,     1064,     4256, 0x199ce269
-0,         13,         13,        1,   291840, 0x6d53844d
-1,      13902,      13902,     1064,     4256, 0x98342d05
-0,         14,         14,        1,   291840, 0xf7ad5385
-1,      14966,      14966,     1078,     4312, 0xb6fb7ebe
-0,         15,         15,        1,   291840, 0x0241b56a
-1,      16044,      16044,     1064,     4256, 0x033dd562
-0,         16,         16,        1,   291840, 0x120122c8
-1,      17108,      17108,     1064,     4256, 0xc2cc17e0
-0,         17,         17,        1,   291840, 0x31b0f32a
-1,      18172,      18172,     1078,     4312, 0x4bb3ff50
-0,         18,         18,        1,   291840, 0x14068b98
-1,      19250,      19250,     1064,     4256, 0x6f2671ef
-0,         19,         19,        1,   291840, 0xeeec658b
-1,      20314,      20314,     1064,     4256, 0x5a337bf4
-0,         20,         20,        1,   291840, 0x9376374c
-1,      21378,      21378,     1078,     4312, 0xa71f6967
-0,         21,         21,        1,   291840, 0x091e8c6e
-1,      22456,      22456,     1064,     4256, 0x48084aa9
-0,         22,         22,        1,   291840, 0x744ad07f
-1,      23520,      23520,     1064,     4256, 0x3cce4218
-0,         23,         23,        1,   291840, 0xf99c554e
-1,      24584,      24584,     1078,     4312, 0xcbb8f73d
-0,         24,         24,        1,   291840, 0xc84bd677
-1,      25662,      25662,     1064,     4256, 0x36825021
-0,         25,         25,        1,   291840, 0x3898d474
-1,      26726,      26726,     1064,     4256, 0xeae036c6
-0,         26,         26,        1,   291840, 0x1e2910c8
-1,      27790,      27790,     1078,     4312, 0x0d650ac6
-0,         27,         27,        1,   291840, 0xb11f58bc
-1,      28868,      28868,     1064,     4256, 0xfba4f58c
-0,         28,         28,        1,   291840, 0xf89170ee
-1,      29932,      29932,     1064,     4256, 0x54311f9b
-0,         29,         29,        1,   291840, 0x8f239dc3
-1,      30996,      30996,     1078,     4312, 0x286386b3
-0,         30,         30,        1,   291840, 0x8538c76c
-1,      32074,      32074,     1064,     4256, 0x871896de
-0,         31,         31,        1,   291840, 0x162ee66f
-1,      33138,      33138,     1064,     4256, 0x9ef9f970
-0,         32,         32,        1,   291840, 0x5f8708a5
-1,      34202,      34202,     1078,     4312, 0xf9ae97f1
-0,         33,         33,        1,   291840, 0x95802dfb
-1,      35280,      35280,     1064,     4256, 0x0ad0d765
-0,         34,         34,        1,   291840, 0xc424630d
-1,      36344,      36344,     1064,     4256, 0x8e6aa9b5
-0,         35,         35,        1,   291840, 0xfb8a8667
-1,      37408,      37408,     1078,     4312, 0x8362787b
-0,         36,         36,        1,   291840, 0xbad79af5
-1,      38486,      38486,     1064,     4256, 0x9b6a5d9c
-0,         37,         37,        1,   291840, 0xc733b325
-1,      39550,      39550,     1064,     4256, 0xfb715d8f
-0,         38,         38,        1,   291840, 0x4bfbcd70
-1,      40614,      40614,     1078,     4312, 0x02bd8075
-0,         39,         39,        1,   291840, 0x502cd950
-1,      41692,      41692,     1064,     4256, 0x428eb932
-0,         40,         40,        1,   291840, 0x8461ca2c
-1,      42756,      42756,     1064,     4256, 0x17ea8c94
-0,         41,         41,        1,   291840, 0x00219b0d
-1,      43820,      43820,     1078,     4312, 0xb3e761d7
-0,         42,         42,        1,   291840, 0xa4de45e1
-1,      44898,      44898,     1064,     4256, 0x0919755a
-0,         43,         43,        1,   291840, 0xacd3f4df
-1,      45962,      45962,     1064,     4256, 0x5e520edd
-0,         44,         44,        1,   291840, 0x2203a369
-1,      47026,      47026,     1078,     4312, 0x69aa070e
-0,         45,         45,        1,   291840, 0x0a66effa
-1,      48104,      48104,     1064,     4256, 0xf8192f7d
-0,         46,         46,        1,   291840, 0x7ac1fd91
-1,      49168,      49168,     1064,     4256, 0xaad4475c
-0,         47,         47,        1,   291840, 0x84970aa7
-1,      50232,      50232,     1078,     4312, 0x0cabcfcb
-0,         48,         48,        1,   291840, 0x569d145f
-1,      51310,      51310,     1064,     4256, 0x952f0f96
-0,         49,         49,        1,   291840, 0xe51efe1b
-1,      52374,      52374,     1064,     4256, 0x1b805a0c
-0,         50,         50,        1,   291840, 0x38e2cd78
-1,      53438,      53438,     1078,     4312, 0x93043d2a
-0,         51,         51,        1,   291840, 0x93428ea2
-1,      54516,      54516,     1064,     4256, 0x38b99e44
-0,         52,         52,        1,   291840, 0x3d3f5b17
-1,      55580,      55580,     1064,     4256, 0x60cc52ff
-0,         53,         53,        1,   291840, 0x9546127d
-1,      56644,      56644,     1078,     4312, 0x6a875849
-0,         54,         54,        1,   291840, 0x4178be54
-1,      57722,      57722,     1064,     4256, 0xd08d6d0e
-0,         55,         55,        1,   291840, 0x0d0f8036
-1,      58786,      58786,     1064,     4256, 0x36bfe48e
-0,         56,         56,        1,   291840, 0xc20557b9
-1,      59850,      59850,     1078,     4312, 0x795c6134
-0,         57,         57,        1,   291840, 0x6d4b2d64
-1,      60928,      60928,     1064,     4256, 0x4fd79583
-0,         58,         58,        1,   291840, 0xa750125d
-1,      61992,      61992,     1064,     4256, 0x65e2ab9f
-0,         59,         59,        1,   291840, 0x04623ce3
-1,      63056,      63056,     1078,     4312, 0xedeede4a
-0,         60,         60,        1,   291840, 0xc7f2bbc7
-1,      64134,      64134,     1064,     4256, 0x097e0d09
-0,         61,         61,        1,   291840, 0x6e271336
-1,      65198,      65198,     1064,     4256, 0x58afa133
-0,         62,         62,        1,   291840, 0xcfbd4246
-1,      66262,      66262,     1078,     4312, 0x442525b5
-0,         63,         63,        1,   291840, 0xe1493be9
-1,      67340,      67340,     1064,     4256, 0x6645c591
-0,         64,         64,        1,   291840, 0x6c731194
-1,      68404,      68404,     1064,     4256, 0xb0dd948a
-0,         65,         65,        1,   291840, 0x0fc30cc2
-1,      69468,      69468,     1078,     4312, 0x12684e69
-0,         66,         66,        1,   291840, 0x967427f3
-1,      70546,      70546,     1064,     4256, 0xb45098e3
-0,         67,         67,        1,   291840, 0x55ae3b00
-1,      71610,      71610,     1064,     4256, 0xb6d3c61c
-0,         68,         68,        1,   291840, 0xbe4f200c
-1,      72674,      72674,     1078,     4312, 0xb46b5b22
-0,         69,         69,        1,   291840, 0xc515e443
-1,      73752,      73752,     1064,     4256, 0x9a556830
-0,         70,         70,        1,   291840, 0xd738bd69
-1,      74816,      74816,     1064,     4256, 0x67ca2b35
-0,         71,         71,        1,   291840, 0xa8e0ab69
+#tb 0: 1/32000
+0,          0,          0,     1078,     4312, 0x469714f6
+0,       1078,       1078,     1064,     4256, 0xe03dd882
+0,       2142,       2142,     1078,     4312, 0x46b901f7
+0,       3220,       3220,     1064,     4256, 0x8d4a54e4
+0,       4284,       4284,     1064,     4256, 0xfd616b67
+0,       5348,       5348,     1078,     4312, 0xefe62302
+0,       6426,       6426,     1064,     4256, 0xab11684e
+0,       7490,       7490,     1064,     4256, 0xb4b3feb8
+0,       8554,       8554,     1078,     4312, 0x71db6461
+0,       9632,       9632,     1064,     4256, 0x090e5efa
+0,      10696,      10696,     1064,     4256, 0x36f49c28
+0,      11760,      11760,     1078,     4312, 0x0fe3d262
+0,      12838,      12838,     1064,     4256, 0x199ce269
+0,      13902,      13902,     1064,     4256, 0x98342d05
+0,      14966,      14966,     1078,     4312, 0xb6fb7ebe
+0,      16044,      16044,     1064,     4256, 0x033dd562
+0,      17108,      17108,     1064,     4256, 0xc2cc17e0
+0,      18172,      18172,     1078,     4312, 0x4bb3ff50
+0,      19250,      19250,     1064,     4256, 0x6f2671ef
+0,      20314,      20314,     1064,     4256, 0x5a337bf4
+0,      21378,      21378,     1078,     4312, 0xa71f6967
+0,      22456,      22456,     1064,     4256, 0x48084aa9
+0,      23520,      23520,     1064,     4256, 0x3cce4218
+0,      24584,      24584,     1078,     4312, 0xcbb8f73d
+0,      25662,      25662,     1064,     4256, 0x36825021
+0,      26726,      26726,     1064,     4256, 0xeae036c6
+0,      27790,      27790,     1078,     4312, 0x0d650ac6
+0,      28868,      28868,     1064,     4256, 0xfba4f58c
+0,      29932,      29932,     1064,     4256, 0x54311f9b
+0,      30996,      30996,     1078,     4312, 0x286386b3
+0,      32074,      32074,     1064,     4256, 0x871896de
+0,      33138,      33138,     1064,     4256, 0x9ef9f970
+0,      34202,      34202,     1078,     4312, 0xf9ae97f1
+0,      35280,      35280,     1064,     4256, 0x0ad0d765
+0,      36344,      36344,     1064,     4256, 0x8e6aa9b5
+0,      37408,      37408,     1078,     4312, 0x8362787b
+0,      38486,      38486,     1064,     4256, 0x9b6a5d9c
+0,      39550,      39550,     1064,     4256, 0xfb715d8f
+0,      40614,      40614,     1078,     4312, 0x02bd8075
+0,      41692,      41692,     1064,     4256, 0x428eb932
+0,      42756,      42756,     1064,     4256, 0x17ea8c94
+0,      43820,      43820,     1078,     4312, 0xb3e761d7
+0,      44898,      44898,     1064,     4256, 0x0919755a
+0,      45962,      45962,     1064,     4256, 0x5e520edd
+0,      47026,      47026,     1078,     4312, 0x69aa070e
+0,      48104,      48104,     1064,     4256, 0xf8192f7d
+0,      49168,      49168,     1064,     4256, 0xaad4475c
+0,      50232,      50232,     1078,     4312, 0x0cabcfcb
+0,      51310,      51310,     1064,     4256, 0x952f0f96
+0,      52374,      52374,     1064,     4256, 0x1b805a0c
+0,      53438,      53438,     1078,     4312, 0x93043d2a
+0,      54516,      54516,     1064,     4256, 0x38b99e44
+0,      55580,      55580,     1064,     4256, 0x60cc52ff
+0,      56644,      56644,     1078,     4312, 0x6a875849
+0,      57722,      57722,     1064,     4256, 0xd08d6d0e
+0,      58786,      58786,     1064,     4256, 0x36bfe48e
+0,      59850,      59850,     1078,     4312, 0x795c6134
+0,      60928,      60928,     1064,     4256, 0x4fd79583
+0,      61992,      61992,     1064,     4256, 0x65e2ab9f
+0,      63056,      63056,     1078,     4312, 0xedeede4a
+0,      64134,      64134,     1064,     4256, 0x097e0d09
+0,      65198,      65198,     1064,     4256, 0x58afa133
+0,      66262,      66262,     1078,     4312, 0x442525b5
+0,      67340,      67340,     1064,     4256, 0x6645c591
+0,      68404,      68404,     1064,     4256, 0xb0dd948a
+0,      69468,      69468,     1078,     4312, 0x12684e69
+0,      70546,      70546,     1064,     4256, 0xb45098e3
+0,      71610,      71610,     1064,     4256, 0xb6d3c61c
+0,      72674,      72674,     1078,     4312, 0xb46b5b22
+0,      73752,      73752,     1064,     4256, 0x9a556830
+0,      74816,      74816,     1064,     4256, 0x67ca2b35
diff --git a/tests/ref/fate/dpcm-idroq b/tests/ref/fate/dpcm-idroq
index 086534387c9777fc16d9e03a9f83aa26f9a15d9a..85e8efb098209f097092fb9a38d89e0f2c89dacf 100644
--- a/tests/ref/fate/dpcm-idroq
+++ b/tests/ref/fate/dpcm-idroq
@@ -1,379 +1,168 @@
-#tb 0: 1/30
-#tb 1: 1/22050
-0,          0,          0,        1,   393216, 0x56995aac
-1,          0,          0,     7456,    29824, 0x77e265b7
-0,          1,          1,        1,   393216, 0xf9ed5d6c
-0,          2,          2,        1,   393216, 0xd3285d75
-0,          3,          3,        1,   393216, 0x82d15d62
-0,          4,          4,        1,   393216, 0x893e5d6f
-0,          5,          5,        1,   393216, 0x82d15d62
-0,          6,          6,        1,   393216, 0x893e5d6f
-0,          7,          7,        1,   393216, 0x82d15d62
-0,          8,          8,        1,   393216, 0x893e5d6f
-0,          9,          9,        1,   393216, 0x82d15d62
-0,         10,         10,        1,   393216, 0x893e5d6f
-1,       7456,       7456,      736,     2944, 0x8dcdf50b
-0,         11,         11,        1,   393216, 0x82d15d62
-1,       8192,       8192,      736,     2944, 0xb135cd2a
-0,         12,         12,        1,   393216, 0x893e5d6f
-1,       8928,       8928,      736,     2944, 0x54a6e73f
-0,         13,         13,        1,   393216, 0x82d15d62
-1,       9664,       9664,      736,     2944, 0x050ccd4e
-0,         14,         14,        1,   393216, 0x893e5d6f
-1,      10400,      10400,      736,     2944, 0x6b68db44
-0,         15,         15,        1,   393216, 0x82d15d62
-1,      11136,      11136,      736,     2944, 0x55d1f308
-0,         16,         16,        1,   393216, 0x2ae39eca
-1,      11872,      11872,      736,     2944, 0x7e92f50b
-0,         17,         17,        1,   393216, 0x9254be70
-1,      12608,      12608,      736,     2944, 0xe9e91eed
-0,         18,         18,        1,   393216, 0x4b2ed384
-1,      13344,      13344,      736,     2944, 0x80af2ce0
-0,         19,         19,        1,   393216, 0xbbd9d8f7
-1,      14080,      14080,      736,     2944, 0xc67ffb07
-0,         20,         20,        1,   393216, 0x1f2be0c3
-1,      14816,      14816,      736,     2944, 0x7aaded27
-0,         21,         21,        1,   393216, 0x2434eb25
-1,      15552,      15552,      736,     2944, 0x14a024fd
-0,         22,         22,        1,   393216, 0xa6cced4e
-1,      16288,      16288,      736,     2944, 0x26e8df1f
-0,         23,         23,        1,   393216, 0xd116f38b
-1,      17024,      17024,      736,     2944, 0x2688df44
-0,         24,         24,        1,   393216, 0x6b86f380
-1,      17760,      17760,      736,     2944, 0x4b9cdd33
-0,         25,         25,        1,   393216, 0xc1b3f8e9
-1,      18496,      18496,      736,     2944, 0x10c2f11c
-0,         26,         26,        1,   393216, 0x2993fd5d
-1,      19232,      19232,      736,     2944, 0xc4e3ad6d
-0,         27,         27,        1,   393216, 0xf489fe18
-1,      19968,      19968,      736,     2944, 0xbeb1a78e
-0,         28,         28,        1,   393216, 0x9ef10501
-1,      20704,      20704,      736,     2944, 0x283d4e7f
-0,         29,         29,        1,   393216, 0x8faf0512
-1,      21440,      21440,      736,     2944, 0x4acf65e0
-0,         30,         30,        1,   393216, 0xa54d0736
-1,      22176,      22176,      736,     2944, 0x0ca29b8c
-0,         31,         31,        1,   393216, 0xf4ef01e0
-1,      22912,      22912,      736,     2944, 0x003fae34
-0,         32,         32,        1,   393216, 0xe241ef51
-1,      23648,      23648,      736,     2944, 0x2acfec7e
-0,         33,         33,        1,   393216, 0xcc38e51f
-1,      24384,      24384,      736,     2944, 0xea6fc6fe
-0,         34,         34,        1,   393216, 0xb1345876
-1,      25120,      25120,      736,     2944, 0xf5daec2f
-0,         35,         35,        1,   393216, 0xf9b0968b
-1,      25856,      25856,      736,     2944, 0x8d33ed7a
-0,         36,         36,        1,   393216, 0x6bb1523f
-1,      26592,      26592,      736,     2944, 0xc328f984
-0,         37,         37,        1,   393216, 0x83469a05
-1,      27328,      27328,      736,     2944, 0x6e0b58d3
-0,         38,         38,        1,   393216, 0x73e30882
-1,      28064,      28064,      736,     2944, 0xe282dc3f
-0,         39,         39,        1,   393216, 0x8673da66
-1,      28800,      28800,      736,     2944, 0xbf9bf3e6
-0,         40,         40,        1,   393216, 0xb67596d3
-1,      29536,      29536,      736,     2944, 0xd7b7d7e3
-0,         41,         41,        1,   393216, 0xf7638710
-1,      30272,      30272,      736,     2944, 0x4e87b6ab
-0,         42,         42,        1,   393216, 0x813a8f47
-1,      31008,      31008,      736,     2944, 0x7b8ce8d6
-0,         43,         43,        1,   393216, 0xb3526555
-1,      31744,      31744,      736,     2944, 0xd42991a5
-0,         44,         44,        1,   393216, 0x1b167be3
-1,      32480,      32480,      736,     2944, 0x452c98ca
-0,         45,         45,        1,   393216, 0x99114562
-1,      33216,      33216,      736,     2944, 0x6d27832d
-0,         46,         46,        1,   393216, 0xfafb0693
-1,      33952,      33952,      736,     2944, 0xa558720e
-0,         47,         47,        1,   393216, 0x121d96c8
-1,      34688,      34688,      736,     2944, 0x0a31bec0
-0,         48,         48,        1,   393216, 0xb3c68c5d
-1,      35424,      35424,      736,     2944, 0x28431384
-0,         49,         49,        1,   393216, 0x2035b97f
-1,      36160,      36160,      736,     2944, 0xd5e9fb3d
-0,         50,         50,        1,   393216, 0xfbcaeb62
-1,      36896,      36896,      736,     2944, 0x34f0e9f8
-0,         51,         51,        1,   393216, 0xfd5aea5d
-1,      37632,      37632,      736,     2944, 0x979432df
-0,         52,         52,        1,   393216, 0x66efbddd
-1,      38368,      38368,      736,     2944, 0xb00acd4d
-0,         53,         53,        1,   393216, 0xf1e17862
-1,      39104,      39104,      736,     2944, 0x726bffd6
-0,         54,         54,        1,   393216, 0x27fa584d
-1,      39840,      39840,      736,     2944, 0xa1f39a6d
-0,         55,         55,        1,   393216, 0xe644ec5f
-1,      40576,      40576,      736,     2944, 0xf6a8e30e
-0,         56,         56,        1,   393216, 0x7e3067ba
-1,      41312,      41312,      736,     2944, 0x608e9e06
-0,         57,         57,        1,   393216, 0x1b6ba6fd
-1,      42048,      42048,      736,     2944, 0x4ec58bc3
-0,         58,         58,        1,   393216, 0x55bdba34
-1,      42784,      42784,      736,     2944, 0x6d5c8458
-0,         59,         59,        1,   393216, 0xc67db2e4
-1,      43520,      43520,      736,     2944, 0x76a0abbd
-0,         60,         60,        1,   393216, 0x359de8a2
-1,      44256,      44256,      736,     2944, 0xf830e8a6
-0,         61,         61,        1,   393216, 0x7b7a32ef
-1,      44992,      44992,      736,     2944, 0x1bdd7bec
-0,         62,         62,        1,   393216, 0xbe512a66
-1,      45728,      45728,      736,     2944, 0x3c1bd187
-0,         63,         63,        1,   393216, 0x681d82bf
-1,      46464,      46464,      736,     2944, 0xf52cf697
-0,         64,         64,        1,   393216, 0xa2320ec5
-1,      47200,      47200,      736,     2944, 0x8f65b773
-0,         65,         65,        1,   393216, 0xcfbd9954
-1,      47936,      47936,      736,     2944, 0xf8b5b598
-0,         66,         66,        1,   393216, 0x7fee9854
-1,      48672,      48672,      736,     2944, 0xcd87d5ed
-0,         67,         67,        1,   393216, 0x70eec155
-1,      49408,      49408,      736,     2944, 0x672ac02a
-0,         68,         68,        1,   393216, 0x114f684e
-1,      50144,      50144,      736,     2944, 0x1d5d13ed
-0,         69,         69,        1,   393216, 0xe27f034f
-1,      50880,      50880,      736,     2944, 0xe298e3d4
-0,         70,         70,        1,   393216, 0xfbbd89b4
-1,      51616,      51616,      736,     2944, 0x3d2e9c32
-0,         71,         71,        1,   393216, 0xcef4c58a
-1,      52352,      52352,      736,     2944, 0xf3a39259
-0,         72,         72,        1,   393216, 0x9eea88e9
-1,      53088,      53088,      736,     2944, 0x930ae8f8
-0,         73,         73,        1,   393216, 0x911cea42
-1,      53824,      53824,      736,     2944, 0x8562aff7
-0,         74,         74,        1,   393216, 0xec5727ea
-1,      54560,      54560,      736,     2944, 0x9cd6c6a7
-0,         75,         75,        1,   393216, 0xda998c33
-1,      55296,      55296,      736,     2944, 0x2709dc5c
-0,         76,         76,        1,   393216, 0xc82140ed
-1,      56032,      56032,      736,     2944, 0xcbe31816
-0,         77,         77,        1,   393216, 0x4caa8591
-1,      56768,      56768,      736,     2944, 0xd7876ec4
-0,         78,         78,        1,   393216, 0x4944206c
-1,      57504,      57504,      736,     2944, 0xc2468b6a
-0,         79,         79,        1,   393216, 0xd4676a94
-1,      58240,      58240,      736,     2944, 0x76043e84
-0,         80,         80,        1,   393216, 0x9e0340b3
-1,      58976,      58976,      736,     2944, 0xd2c35bf0
-0,         81,         81,        1,   393216, 0xbdef7f94
-1,      59712,      59712,      736,     2944, 0x63de6061
-0,         82,         82,        1,   393216, 0xfac05cb0
-1,      60448,      60448,      736,     2944, 0xd8f6ed1d
-0,         83,         83,        1,   393216, 0xfef5a369
-1,      61184,      61184,      736,     2944, 0xe034928a
-0,         84,         84,        1,   393216, 0x9fcb3711
-1,      61920,      61920,      736,     2944, 0xa044da74
-0,         85,         85,        1,   393216, 0x6d93f761
-1,      62656,      62656,      736,     2944, 0xee410dba
-0,         86,         86,        1,   393216, 0xe95dc1ae
-1,      63392,      63392,      736,     2944, 0x8e020c7c
-0,         87,         87,        1,   393216, 0x3e561557
-1,      64128,      64128,      736,     2944, 0x73057ddb
-0,         88,         88,        1,   393216, 0x0fa7a049
-1,      64864,      64864,      736,     2944, 0xdee5cc18
-0,         89,         89,        1,   393216, 0xf16afb95
-1,      65600,      65600,      736,     2944, 0xf4d31dec
-0,         90,         90,        1,   393216, 0xe53a2064
-1,      66336,      66336,      736,     2944, 0xe8131e1c
-0,         91,         91,        1,   393216, 0x57f046a4
-1,      67072,      67072,      736,     2944, 0x8ae69c95
-0,         92,         92,        1,   393216, 0xf6f16a0c
-1,      67808,      67808,      736,     2944, 0x791c0bf4
-0,         93,         93,        1,   393216, 0xcba0c8b0
-1,      68544,      68544,      736,     2944, 0xd45a10db
-0,         94,         94,        1,   393216, 0x5bdbe522
-1,      69280,      69280,      736,     2944, 0x3a72b010
-0,         95,         95,        1,   393216, 0x0fed0151
-1,      70016,      70016,      736,     2944, 0x6a4a0411
-0,         96,         96,        1,   393216, 0xbf86faf8
-1,      70752,      70752,      736,     2944, 0xd77ab7f5
-0,         97,         97,        1,   393216, 0x39854c5f
-1,      71488,      71488,      736,     2944, 0xe3bf4fe5
-0,         98,         98,        1,   393216, 0xd9b7760a
-1,      72224,      72224,      736,     2944, 0x12db1be8
-0,         99,         99,        1,   393216, 0x8edcc1d9
-1,      72960,      72960,      736,     2944, 0x345210b0
-0,        100,        100,        1,   393216, 0x44ae1435
-1,      73696,      73696,      736,     2944, 0xcfc1f892
-0,        101,        101,        1,   393216, 0xbc3d6d73
-1,      74432,      74432,      736,     2944, 0x5b0a80bb
-0,        102,        102,        1,   393216, 0xedd82647
-1,      75168,      75168,      736,     2944, 0x31ab1168
-0,        103,        103,        1,   393216, 0x1c2e5ce3
-1,      75904,      75904,      736,     2944, 0xd4a4bb0a
-0,        104,        104,        1,   393216, 0x04e29afe
-1,      76640,      76640,      736,     2944, 0x8e211c8f
-0,        105,        105,        1,   393216, 0xb191578e
-1,      77376,      77376,      736,     2944, 0xcf464d50
-0,        106,        106,        1,   393216, 0x31d75a06
-1,      78112,      78112,      736,     2944, 0xe74ff3d6
-0,        107,        107,        1,   393216, 0xfdb6c56e
-1,      78848,      78848,      736,     2944, 0x6274635f
-0,        108,        108,        1,   393216, 0xf528f484
-1,      79584,      79584,      736,     2944, 0xc34c9f64
-0,        109,        109,        1,   393216, 0x87af758e
-1,      80320,      80320,      736,     2944, 0xbb997537
-0,        110,        110,        1,   393216, 0xc8bdafb7
-1,      81056,      81056,      736,     2944, 0x3600da72
-0,        111,        111,        1,   393216, 0x573afe93
-1,      81792,      81792,      736,     2944, 0x343e15f4
-0,        112,        112,        1,   393216, 0xb03cb8f5
-1,      82528,      82528,      736,     2944, 0x17bc58a8
-0,        113,        113,        1,   393216, 0x6e03ac71
-1,      83264,      83264,      736,     2944, 0x3dcbd3ff
-0,        114,        114,        1,   393216, 0xf919164e
-1,      84000,      84000,      736,     2944, 0x1d422371
-0,        115,        115,        1,   393216, 0x80059f3c
-1,      84736,      84736,      736,     2944, 0xe2b83d9d
-0,        116,        116,        1,   393216, 0xf4ea0b1a
-1,      85472,      85472,      736,     2944, 0x65388409
-0,        117,        117,        1,   393216, 0xe7720ffb
-1,      86208,      86208,      736,     2944, 0xafbca269
-0,        118,        118,        1,   393216, 0x1ec0cd56
-1,      86944,      86944,      736,     2944, 0x2d00c0fb
-0,        119,        119,        1,   393216, 0x2bc8cf18
-1,      87680,      87680,      736,     2944, 0xbac9c503
-0,        120,        120,        1,   393216, 0xe0bf17b5
-1,      88416,      88416,      736,     2944, 0x9990768d
-0,        121,        121,        1,   393216, 0x660247e1
-1,      89152,      89152,      736,     2944, 0x8ba978be
-0,        122,        122,        1,   393216, 0xcf66f2a9
-1,      89888,      89888,      736,     2944, 0x5a44a2f5
-0,        123,        123,        1,   393216, 0x5494d5ab
-1,      90624,      90624,      736,     2944, 0xa4b6f3b8
-0,        124,        124,        1,   393216, 0x2c02f2c4
-1,      91360,      91360,      736,     2944, 0x631b6b9f
-0,        125,        125,        1,   393216, 0x93fa3783
-1,      92096,      92096,      736,     2944, 0x4c840923
-0,        126,        126,        1,   393216, 0x4cc50633
-1,      92832,      92832,      736,     2944, 0x7c105df3
-0,        127,        127,        1,   393216, 0x3f179386
-1,      93568,      93568,      736,     2944, 0x01bcb213
-0,        128,        128,        1,   393216, 0x2bca9e1b
-1,      94304,      94304,      736,     2944, 0x95cffbf7
-0,        129,        129,        1,   393216, 0x3e4af867
-1,      95040,      95040,      736,     2944, 0x170a9c3a
-0,        130,        130,        1,   393216, 0x7e7df93c
-1,      95776,      95776,      736,     2944, 0x59e09d61
-0,        131,        131,        1,   393216, 0x577e4fb0
-1,      96512,      96512,      736,     2944, 0x3ea0f205
-0,        132,        132,        1,   393216, 0x34487f0a
-1,      97248,      97248,      736,     2944, 0xd9ea1a3a
-0,        133,        133,        1,   393216, 0x0937bcfc
-1,      97984,      97984,      736,     2944, 0xaf32d704
-0,        134,        134,        1,   393216, 0xa9e75a5e
-1,      98720,      98720,      736,     2944, 0x2d473392
-0,        135,        135,        1,   393216, 0xf7bc0c89
-1,      99456,      99456,      736,     2944, 0x2a8ec544
-0,        136,        136,        1,   393216, 0x06dacca6
-1,     100192,     100192,      736,     2944, 0x883c8838
-0,        137,        137,        1,   393216, 0x7baaa4bd
-1,     100928,     100928,      736,     2944, 0xfaf4d789
-0,        138,        138,        1,   393216, 0x95477f5f
-1,     101664,     101664,      736,     2944, 0xcb315b65
-0,        139,        139,        1,   393216, 0x51117526
-1,     102400,     102400,      736,     2944, 0x980c93b0
-0,        140,        140,        1,   393216, 0x69656d03
-1,     103136,     103136,      736,     2944, 0x0819583b
-0,        141,        141,        1,   393216, 0xcbd061bb
-1,     103872,     103872,      736,     2944, 0xf126e5b5
-0,        142,        142,        1,   393216, 0x8d1d5be2
-1,     104608,     104608,      736,     2944, 0x88836255
-0,        143,        143,        1,   393216, 0x43e55930
-1,     105344,     105344,      736,     2944, 0xc8ae8ca8
-0,        144,        144,        1,   393216, 0xb56f5872
-1,     106080,     106080,      736,     2944, 0xf0750551
-0,        145,        145,        1,   393216, 0x09a255e9
-1,     106816,     106816,      736,     2944, 0x3dfe13a3
-0,        146,        146,        1,   393216, 0xcaaa5456
-1,     107552,     107552,      736,     2944, 0xf2aa957b
-0,        147,        147,        1,   393216, 0xd267501f
-1,     108288,     108288,      736,     2944, 0xa77b79a3
-0,        148,        148,        1,   393216, 0x7bef4eca
-1,     109024,     109024,      736,     2944, 0xb1038284
-0,        149,        149,        1,   393216, 0x9aa94af3
-1,     109760,     109760,      736,     2944, 0xf96be3ba
-0,        150,        150,        1,   393216, 0xd39d4a29
-1,     110496,     110496,      736,     2944, 0x1ae6e293
-0,        151,        151,        1,   393216, 0x7a754960
-1,     111232,     111232,      736,     2944, 0x2059d020
-0,        152,        152,        1,   393216, 0x3f004921
-1,     111968,     111968,      736,     2944, 0x7e6c9996
-0,        153,        153,        1,   393216, 0x0f784ca8
-1,     112704,     112704,      736,     2944, 0x3108b540
-0,        154,        154,        1,   393216, 0x2a062c70
-1,     113440,     113440,      736,     2944, 0x75133155
-0,        155,        155,        1,   393216, 0x114ef770
-1,     114176,     114176,      736,     2944, 0x59a19226
-0,        156,        156,        1,   393216, 0xfb7673bf
-1,     114912,     114912,      736,     2944, 0x3140c138
-0,        157,        157,        1,   393216, 0xbaea88f7
-1,     115648,     115648,      736,     2944, 0x7570d3be
-0,        158,        158,        1,   393216, 0x6fdfe2ec
-1,     116384,     116384,      736,     2944, 0x54fd4ff6
-0,        159,        159,        1,   393216, 0xb7b2b398
-1,     117120,     117120,      736,     2944, 0x23bcf6dc
-0,        160,        160,        1,   393216, 0x14ba127e
-1,     117856,     117856,      736,     2944, 0x2d26489b
-0,        161,        161,        1,   393216, 0x660b3041
-1,     118592,     118592,      736,     2944, 0x4b37bf13
-0,        162,        162,        1,   393216, 0xe3f3302a
-1,     119328,     119328,      736,     2944, 0x12812ec9
-0,        163,        163,        1,   393216, 0x34c7f1c9
-1,     120064,     120064,      736,     2944, 0xc4a609dd
-0,        164,        164,        1,   393216, 0xa8257bf4
-1,     120800,     120800,      736,     2944, 0x5a8c5b20
-0,        165,        165,        1,   393216, 0xd63fc649
-1,     121536,     121536,      736,     2944, 0xd05d110f
-0,        166,        166,        1,   393216, 0xf8e5b79c
-1,     122272,     122272,      736,     2944, 0xceea6f1f
-0,        167,        167,        1,   393216, 0xa67b52ab
-1,     123008,     123008,      736,     2944, 0x4033b0a5
-0,        168,        168,        1,   393216, 0xef8f9c74
-1,     123744,     123744,      736,     2944, 0x101895ce
-0,        169,        169,        1,   393216, 0x6d3aa6b6
-1,     124480,     124480,      736,     2944, 0xd6c6809f
-0,        170,        170,        1,   393216, 0x8c174ee6
-1,     125216,     125216,      736,     2944, 0x197bda7e
-0,        171,        171,        1,   393216, 0x2dfbc524
-1,     125952,     125952,      736,     2944, 0x96fb3e4b
-0,        172,        172,        1,   393216, 0x7d0808b6
-1,     126688,     126688,      736,     2944, 0x12a6e3de
-0,        173,        173,        1,   393216, 0x6cbdf6f5
-1,     127424,     127424,      736,     2944, 0xfb80e466
-0,        174,        174,        1,   393216, 0xfe39bc53
-1,     128160,     128160,      736,     2944, 0xedb8c2fc
-0,        175,        175,        1,   393216, 0xa3d869b0
-1,     128896,     128896,      254,     1016, 0x30e56ca5
-0,        176,        176,        1,   393216, 0x09f00057
-0,        177,        177,        1,   393216, 0x6ba56343
-0,        178,        178,        1,   393216, 0xb696ca3e
-0,        179,        179,        1,   393216, 0x4eba0225
-0,        180,        180,        1,   393216, 0xdd45464b
-0,        181,        181,        1,   393216, 0x2909a9ea
-0,        182,        182,        1,   393216, 0x12aa3f85
-0,        183,        183,        1,   393216, 0x59421352
-0,        184,        184,        1,   393216, 0x57ea0313
-0,        185,        185,        1,   393216, 0x4e5f3a38
-0,        186,        186,        1,   393216, 0x55bc932d
-0,        187,        187,        1,   393216, 0x666ee55d
-0,        188,        188,        1,   393216, 0xb0f84a69
-0,        189,        189,        1,   393216, 0xad3ae63f
-0,        190,        190,        1,   393216, 0x970fd47d
-0,        191,        191,        1,   393216, 0x86c418e0
-0,        192,        192,        1,   393216, 0x52c9ce50
-0,        193,        193,        1,   393216, 0xd54c98c8
-0,        194,        194,        1,   393216, 0xb40e5fea
-0,        195,        195,        1,   393216, 0x2aa74875
-0,        196,        196,        1,   393216, 0x305b251e
-0,        197,        197,        1,   393216, 0xab8c0780
-0,        198,        198,        1,   393216, 0x0101dd0e
-0,        199,        199,        1,   393216, 0x23739cab
-0,        200,        200,        1,   393216, 0xf05196a0
-0,        201,        201,        1,   393216, 0x932d1e00
-0,        202,        202,        1,   393216, 0x932d1e00
-0,        203,        203,        1,   393216, 0x932d1e00
-0,        204,        204,        1,   393216, 0x932d1e00
-0,        205,        205,        1,   393216, 0x932d1e00
-0,        206,        206,        1,   393216, 0x932d1e00
-0,        207,        207,        1,   393216, 0x932d1e00
-0,        208,        208,        1,   393216, 0x932d1e00
-0,        209,        209,        1,   393216, 0x932d1e00
+#tb 0: 1/22050
+0,          0,          0,     7456,    29824, 0x77e265b7
+0,       7456,       7456,      736,     2944, 0x8dcdf50b
+0,       8192,       8192,      736,     2944, 0xb135cd2a
+0,       8928,       8928,      736,     2944, 0x54a6e73f
+0,       9664,       9664,      736,     2944, 0x050ccd4e
+0,      10400,      10400,      736,     2944, 0x6b68db44
+0,      11136,      11136,      736,     2944, 0x55d1f308
+0,      11872,      11872,      736,     2944, 0x7e92f50b
+0,      12608,      12608,      736,     2944, 0xe9e91eed
+0,      13344,      13344,      736,     2944, 0x80af2ce0
+0,      14080,      14080,      736,     2944, 0xc67ffb07
+0,      14816,      14816,      736,     2944, 0x7aaded27
+0,      15552,      15552,      736,     2944, 0x14a024fd
+0,      16288,      16288,      736,     2944, 0x26e8df1f
+0,      17024,      17024,      736,     2944, 0x2688df44
+0,      17760,      17760,      736,     2944, 0x4b9cdd33
+0,      18496,      18496,      736,     2944, 0x10c2f11c
+0,      19232,      19232,      736,     2944, 0xc4e3ad6d
+0,      19968,      19968,      736,     2944, 0xbeb1a78e
+0,      20704,      20704,      736,     2944, 0x283d4e7f
+0,      21440,      21440,      736,     2944, 0x4acf65e0
+0,      22176,      22176,      736,     2944, 0x0ca29b8c
+0,      22912,      22912,      736,     2944, 0x003fae34
+0,      23648,      23648,      736,     2944, 0x2acfec7e
+0,      24384,      24384,      736,     2944, 0xea6fc6fe
+0,      25120,      25120,      736,     2944, 0xf5daec2f
+0,      25856,      25856,      736,     2944, 0x8d33ed7a
+0,      26592,      26592,      736,     2944, 0xc328f984
+0,      27328,      27328,      736,     2944, 0x6e0b58d3
+0,      28064,      28064,      736,     2944, 0xe282dc3f
+0,      28800,      28800,      736,     2944, 0xbf9bf3e6
+0,      29536,      29536,      736,     2944, 0xd7b7d7e3
+0,      30272,      30272,      736,     2944, 0x4e87b6ab
+0,      31008,      31008,      736,     2944, 0x7b8ce8d6
+0,      31744,      31744,      736,     2944, 0xd42991a5
+0,      32480,      32480,      736,     2944, 0x452c98ca
+0,      33216,      33216,      736,     2944, 0x6d27832d
+0,      33952,      33952,      736,     2944, 0xa558720e
+0,      34688,      34688,      736,     2944, 0x0a31bec0
+0,      35424,      35424,      736,     2944, 0x28431384
+0,      36160,      36160,      736,     2944, 0xd5e9fb3d
+0,      36896,      36896,      736,     2944, 0x34f0e9f8
+0,      37632,      37632,      736,     2944, 0x979432df
+0,      38368,      38368,      736,     2944, 0xb00acd4d
+0,      39104,      39104,      736,     2944, 0x726bffd6
+0,      39840,      39840,      736,     2944, 0xa1f39a6d
+0,      40576,      40576,      736,     2944, 0xf6a8e30e
+0,      41312,      41312,      736,     2944, 0x608e9e06
+0,      42048,      42048,      736,     2944, 0x4ec58bc3
+0,      42784,      42784,      736,     2944, 0x6d5c8458
+0,      43520,      43520,      736,     2944, 0x76a0abbd
+0,      44256,      44256,      736,     2944, 0xf830e8a6
+0,      44992,      44992,      736,     2944, 0x1bdd7bec
+0,      45728,      45728,      736,     2944, 0x3c1bd187
+0,      46464,      46464,      736,     2944, 0xf52cf697
+0,      47200,      47200,      736,     2944, 0x8f65b773
+0,      47936,      47936,      736,     2944, 0xf8b5b598
+0,      48672,      48672,      736,     2944, 0xcd87d5ed
+0,      49408,      49408,      736,     2944, 0x672ac02a
+0,      50144,      50144,      736,     2944, 0x1d5d13ed
+0,      50880,      50880,      736,     2944, 0xe298e3d4
+0,      51616,      51616,      736,     2944, 0x3d2e9c32
+0,      52352,      52352,      736,     2944, 0xf3a39259
+0,      53088,      53088,      736,     2944, 0x930ae8f8
+0,      53824,      53824,      736,     2944, 0x8562aff7
+0,      54560,      54560,      736,     2944, 0x9cd6c6a7
+0,      55296,      55296,      736,     2944, 0x2709dc5c
+0,      56032,      56032,      736,     2944, 0xcbe31816
+0,      56768,      56768,      736,     2944, 0xd7876ec4
+0,      57504,      57504,      736,     2944, 0xc2468b6a
+0,      58240,      58240,      736,     2944, 0x76043e84
+0,      58976,      58976,      736,     2944, 0xd2c35bf0
+0,      59712,      59712,      736,     2944, 0x63de6061
+0,      60448,      60448,      736,     2944, 0xd8f6ed1d
+0,      61184,      61184,      736,     2944, 0xe034928a
+0,      61920,      61920,      736,     2944, 0xa044da74
+0,      62656,      62656,      736,     2944, 0xee410dba
+0,      63392,      63392,      736,     2944, 0x8e020c7c
+0,      64128,      64128,      736,     2944, 0x73057ddb
+0,      64864,      64864,      736,     2944, 0xdee5cc18
+0,      65600,      65600,      736,     2944, 0xf4d31dec
+0,      66336,      66336,      736,     2944, 0xe8131e1c
+0,      67072,      67072,      736,     2944, 0x8ae69c95
+0,      67808,      67808,      736,     2944, 0x791c0bf4
+0,      68544,      68544,      736,     2944, 0xd45a10db
+0,      69280,      69280,      736,     2944, 0x3a72b010
+0,      70016,      70016,      736,     2944, 0x6a4a0411
+0,      70752,      70752,      736,     2944, 0xd77ab7f5
+0,      71488,      71488,      736,     2944, 0xe3bf4fe5
+0,      72224,      72224,      736,     2944, 0x12db1be8
+0,      72960,      72960,      736,     2944, 0x345210b0
+0,      73696,      73696,      736,     2944, 0xcfc1f892
+0,      74432,      74432,      736,     2944, 0x5b0a80bb
+0,      75168,      75168,      736,     2944, 0x31ab1168
+0,      75904,      75904,      736,     2944, 0xd4a4bb0a
+0,      76640,      76640,      736,     2944, 0x8e211c8f
+0,      77376,      77376,      736,     2944, 0xcf464d50
+0,      78112,      78112,      736,     2944, 0xe74ff3d6
+0,      78848,      78848,      736,     2944, 0x6274635f
+0,      79584,      79584,      736,     2944, 0xc34c9f64
+0,      80320,      80320,      736,     2944, 0xbb997537
+0,      81056,      81056,      736,     2944, 0x3600da72
+0,      81792,      81792,      736,     2944, 0x343e15f4
+0,      82528,      82528,      736,     2944, 0x17bc58a8
+0,      83264,      83264,      736,     2944, 0x3dcbd3ff
+0,      84000,      84000,      736,     2944, 0x1d422371
+0,      84736,      84736,      736,     2944, 0xe2b83d9d
+0,      85472,      85472,      736,     2944, 0x65388409
+0,      86208,      86208,      736,     2944, 0xafbca269
+0,      86944,      86944,      736,     2944, 0x2d00c0fb
+0,      87680,      87680,      736,     2944, 0xbac9c503
+0,      88416,      88416,      736,     2944, 0x9990768d
+0,      89152,      89152,      736,     2944, 0x8ba978be
+0,      89888,      89888,      736,     2944, 0x5a44a2f5
+0,      90624,      90624,      736,     2944, 0xa4b6f3b8
+0,      91360,      91360,      736,     2944, 0x631b6b9f
+0,      92096,      92096,      736,     2944, 0x4c840923
+0,      92832,      92832,      736,     2944, 0x7c105df3
+0,      93568,      93568,      736,     2944, 0x01bcb213
+0,      94304,      94304,      736,     2944, 0x95cffbf7
+0,      95040,      95040,      736,     2944, 0x170a9c3a
+0,      95776,      95776,      736,     2944, 0x59e09d61
+0,      96512,      96512,      736,     2944, 0x3ea0f205
+0,      97248,      97248,      736,     2944, 0xd9ea1a3a
+0,      97984,      97984,      736,     2944, 0xaf32d704
+0,      98720,      98720,      736,     2944, 0x2d473392
+0,      99456,      99456,      736,     2944, 0x2a8ec544
+0,     100192,     100192,      736,     2944, 0x883c8838
+0,     100928,     100928,      736,     2944, 0xfaf4d789
+0,     101664,     101664,      736,     2944, 0xcb315b65
+0,     102400,     102400,      736,     2944, 0x980c93b0
+0,     103136,     103136,      736,     2944, 0x0819583b
+0,     103872,     103872,      736,     2944, 0xf126e5b5
+0,     104608,     104608,      736,     2944, 0x88836255
+0,     105344,     105344,      736,     2944, 0xc8ae8ca8
+0,     106080,     106080,      736,     2944, 0xf0750551
+0,     106816,     106816,      736,     2944, 0x3dfe13a3
+0,     107552,     107552,      736,     2944, 0xf2aa957b
+0,     108288,     108288,      736,     2944, 0xa77b79a3
+0,     109024,     109024,      736,     2944, 0xb1038284
+0,     109760,     109760,      736,     2944, 0xf96be3ba
+0,     110496,     110496,      736,     2944, 0x1ae6e293
+0,     111232,     111232,      736,     2944, 0x2059d020
+0,     111968,     111968,      736,     2944, 0x7e6c9996
+0,     112704,     112704,      736,     2944, 0x3108b540
+0,     113440,     113440,      736,     2944, 0x75133155
+0,     114176,     114176,      736,     2944, 0x59a19226
+0,     114912,     114912,      736,     2944, 0x3140c138
+0,     115648,     115648,      736,     2944, 0x7570d3be
+0,     116384,     116384,      736,     2944, 0x54fd4ff6
+0,     117120,     117120,      736,     2944, 0x23bcf6dc
+0,     117856,     117856,      736,     2944, 0x2d26489b
+0,     118592,     118592,      736,     2944, 0x4b37bf13
+0,     119328,     119328,      736,     2944, 0x12812ec9
+0,     120064,     120064,      736,     2944, 0xc4a609dd
+0,     120800,     120800,      736,     2944, 0x5a8c5b20
+0,     121536,     121536,      736,     2944, 0xd05d110f
+0,     122272,     122272,      736,     2944, 0xceea6f1f
+0,     123008,     123008,      736,     2944, 0x4033b0a5
+0,     123744,     123744,      736,     2944, 0x101895ce
+0,     124480,     124480,      736,     2944, 0xd6c6809f
+0,     125216,     125216,      736,     2944, 0x197bda7e
+0,     125952,     125952,      736,     2944, 0x96fb3e4b
+0,     126688,     126688,      736,     2944, 0x12a6e3de
+0,     127424,     127424,      736,     2944, 0xfb80e466
+0,     128160,     128160,      736,     2944, 0xedb8c2fc
+0,     128896,     128896,      254,     1016, 0x30e56ca5
diff --git a/tests/ref/fate/adpcm-ea-mad-ea-r1 b/tests/ref/fate/ea-mad
similarity index 50%
rename from tests/ref/fate/adpcm-ea-mad-ea-r1
rename to tests/ref/fate/ea-mad
index 01c7262b856bfe2bd3bde0f0e355634913640179..1ea92fda4224985ab2d85faf1c50e98f68143e56 100644
--- a/tests/ref/fate/adpcm-ea-mad-ea-r1
+++ b/tests/ref/fate/ea-mad
@@ -1,193 +1,97 @@
 #tb 0: 33/1000
-#tb 1: 1/48000
 0,          0,          0,        1,   535680, 0x889c32cf
-1,          0,          0,     1624,     6496, 0x00000000
 0,          1,          1,        1,   535680, 0x0b1ef044
-1,       1624,       1624,     1596,     6384, 0x00000000
 0,          2,          2,        1,   535680, 0xa7d0818b
-1,       3220,       3220,     1596,     6384, 0x00000000
 0,          3,          3,        1,   535680, 0xf392e4e1
-1,       4816,       4816,     1596,     6384, 0x00000000
 0,          4,          4,        1,   535680, 0x08480c69
-1,       6412,       6412,     1596,     6384, 0x00000000
 0,          5,          5,        1,   535680, 0x2b8af1ed
-1,       8008,       8008,     1624,     6496, 0xe2034d04
 0,          6,          6,        1,   535680, 0x0d58e062
-1,       9632,       9632,     1596,     6384, 0x089c9157
 0,          7,          7,        1,   535680, 0xd140ced0
-1,      11228,      11228,     1596,     6384, 0xeed5743c
 0,          8,          8,        1,   535680, 0xbd0e6652
-1,      12824,      12824,     1596,     6384, 0x71de6b34
 0,          9,          9,        1,   535680, 0xdc2f2a6b
-1,      14420,      14420,     1596,     6384, 0xc0d67710
 0,         10,         10,        1,   535680, 0x97c31a38
-1,      16016,      16016,     1624,     6496, 0x35786490
 0,         11,         11,        1,   535680, 0x1a2bdf38
-1,      17640,      17640,     1596,     6384, 0xdf1c99a2
 0,         12,         12,        1,   535680, 0xb3af3ac4
-1,      19236,      19236,     1596,     6384, 0xca9591ad
 0,         13,         13,        1,   535680, 0x07a52577
-1,      20832,      20832,     1596,     6384, 0x6f0d9c3d
 0,         14,         14,        1,   535680, 0x78407368
-1,      22428,      22428,     1596,     6384, 0xfacbbaee
 0,         15,         15,        1,   535680, 0xd2a9efc3
-1,      24024,      24024,     1624,     6496, 0x927fb136
 0,         16,         16,        1,   535680, 0x36df2f29
-1,      25648,      25648,     1596,     6384, 0x9d4f2572
 0,         17,         17,        1,   535680, 0x9821d8f7
-1,      27244,      27244,     1596,     6384, 0x2a3c6d08
 0,         18,         18,        1,   535680, 0xf64321aa
-1,      28840,      28840,     1596,     6384, 0x4282b1e0
 0,         19,         19,        1,   535680, 0x53e4d9aa
-1,      30436,      30436,     1596,     6384, 0xc4a77b9f
 0,         20,         20,        1,   535680, 0xdbd6f853
-1,      32032,      32032,     1624,     6496, 0x2af6a14f
 0,         21,         21,        1,   535680, 0x5d40cf8b
-1,      33656,      33656,     1596,     6384, 0x4d734169
 0,         22,         22,        1,   535680, 0xe624af9d
-1,      35252,      35252,     1596,     6384, 0xb91b5865
 0,         23,         23,        1,   535680, 0xd9dbb4cd
-1,      36848,      36848,     1596,     6384, 0x9dce2417
 0,         24,         24,        1,   535680, 0xf14e72ec
-1,      38444,      38444,     1596,     6384, 0xb7c4e1ce
 0,         25,         25,        1,   535680, 0xb35c18f6
-1,      40040,      40040,     1624,     6496, 0xef0dc07a
 0,         26,         26,        1,   535680, 0xc96d7757
-1,      41664,      41664,     1596,     6384, 0x4ad21d10
 0,         27,         27,        1,   535680, 0xdfb937df
-1,      43260,      43260,     1596,     6384, 0xcfe14682
 0,         28,         28,        1,   535680, 0x40cd71d7
-1,      44856,      44856,     1596,     6384, 0x07be48eb
 0,         29,         29,        1,   535680, 0x15e176d6
-1,      46452,      46452,     1596,     6384, 0x09de3498
 0,         30,         30,        1,   535680, 0x7f891b24
-1,      48048,      48048,     1624,     6496, 0xab2e9686
 0,         31,         31,        1,   535680, 0xb87a8c32
-1,      49672,      49672,     1596,     6384, 0x3aba3ccc
 0,         32,         32,        1,   535680, 0x0c01541f
-1,      51268,      51268,     1596,     6384, 0x0a905ec3
 0,         33,         33,        1,   535680, 0x9eee99b3
-1,      52864,      52864,     1596,     6384, 0x76a93ce4
 0,         34,         34,        1,   535680, 0xd65eb689
-1,      54460,      54460,     1596,     6384, 0xa99063a4
 0,         35,         35,        1,   535680, 0x6e733cfa
-1,      56056,      56056,     1624,     6496, 0xc16bb88d
 0,         36,         36,        1,   535680, 0xac536670
-1,      57680,      57680,     1596,     6384, 0x650379bf
 0,         37,         37,        1,   535680, 0x002275b8
-1,      59276,      59276,     1596,     6384, 0x4e0749fe
 0,         38,         38,        1,   535680, 0x6a5385cb
-1,      60872,      60872,     1596,     6384, 0x778e8d12
 0,         39,         39,        1,   535680, 0xd129ade3
-1,      62468,      62468,     1596,     6384, 0x9fa8c494
 0,         40,         40,        1,   535680, 0x32cab5d7
-1,      64064,      64064,     1624,     6496, 0x61d5bead
 0,         41,         41,        1,   535680, 0x08be1c8f
-1,      65688,      65688,     1596,     6384, 0x4da9bc3c
 0,         42,         42,        1,   535680, 0x59e1fba0
-1,      67284,      67284,     1596,     6384, 0xa72b6f93
 0,         43,         43,        1,   535680, 0x138aee3a
-1,      68880,      68880,     1596,     6384, 0x811f5f77
 0,         44,         44,        1,   535680, 0x4cfbcd5e
-1,      70476,      70476,     1596,     6384, 0x83ea5e3d
 0,         45,         45,        1,   535680, 0xf6cf0fb4
-1,      72072,      72072,     1624,     6496, 0x78bab460
 0,         46,         46,        1,   535680, 0xb13a06de
-1,      73696,      73696,     1596,     6384, 0xc9a07432
 0,         47,         47,        1,   535680, 0x59176f00
-1,      75292,      75292,     1596,     6384, 0x4b4f2a34
 0,         48,         48,        1,   535680, 0xf84b4ca3
-1,      76888,      76888,     1596,     6384, 0x4d707a53
 0,         49,         49,        1,   535680, 0x7fd09f73
-1,      78484,      78484,     1596,     6384, 0x703efb60
 0,         50,         50,        1,   535680, 0x3be383b8
-1,      80080,      80080,     1624,     6496, 0x319a77bb
 0,         51,         51,        1,   535680, 0xa7118e51
-1,      81704,      81704,     1596,     6384, 0xbdfd82ec
 0,         52,         52,        1,   535680, 0xbd83120c
-1,      83300,      83300,     1596,     6384, 0x413c3503
 0,         53,         53,        1,   535680, 0x3bc9d256
-1,      84896,      84896,     1596,     6384, 0xe6e666b3
 0,         54,         54,        1,   535680, 0xb6c87f87
-1,      86492,      86492,     1596,     6384, 0xa09c7342
 0,         55,         55,        1,   535680, 0xe80d110a
-1,      88088,      88088,     1624,     6496, 0x60cba846
 0,         56,         56,        1,   535680, 0xb3a83362
-1,      89712,      89712,     1596,     6384, 0x0ba34308
 0,         57,         57,        1,   535680, 0xfb39eb52
-1,      91308,      91308,     1596,     6384, 0xdc3a65f0
 0,         58,         58,        1,   535680, 0xbf6e1220
-1,      92904,      92904,     1596,     6384, 0x1ebf9dc4
 0,         59,         59,        1,   535680, 0x9ecdfbae
-1,      94500,      94500,     1596,     6384, 0xbbcb1449
 0,         60,         60,        1,   535680, 0x069a65f5
-1,      96096,      96096,     1624,     6496, 0x926574eb
 0,         61,         61,        1,   535680, 0x206e372c
-1,      97720,      97720,     1596,     6384, 0xb4da92f1
 0,         62,         62,        1,   535680, 0x58c83dd4
-1,      99316,      99316,     1596,     6384, 0xdbbd21e0
 0,         63,         63,        1,   535680, 0xc3562b03
-1,     100912,     100912,     1596,     6384, 0x08510eff
 0,         64,         64,        1,   535680, 0xd1ed85a0
-1,     102508,     102508,     1596,     6384, 0x9534b7ca
 0,         65,         65,        1,   535680, 0xb6205f4b
-1,     104104,     104104,     1624,     6496, 0x50a5ed30
 0,         66,         66,        1,   535680, 0xaedf8bfa
-1,     105728,     105728,     1596,     6384, 0xf5ac2f7c
 0,         67,         67,        1,   535680, 0xa48d5dea
-1,     107324,     107324,     1596,     6384, 0x4fe1fa55
 0,         68,         68,        1,   535680, 0xff82e7c1
-1,     108920,     108920,     1596,     6384, 0xd61c4c05
 0,         69,         69,        1,   535680, 0xc9560222
-1,     110516,     110516,     1596,     6384, 0x56d11b45
 0,         70,         70,        1,   535680, 0x0fafa549
-1,     112112,     112112,     1624,     6496, 0x3906084b
 0,         71,         71,        1,   535680, 0x8d556ccb
-1,     113736,     113736,     1596,     6384, 0x1ef31fed
 0,         72,         72,        1,   535680, 0x802aac1f
-1,     115332,     115332,     1596,     6384, 0x58ed82f5
 0,         73,         73,        1,   535680, 0x7d0fa168
-1,     116928,     116928,     1596,     6384, 0xb31ccd1f
 0,         74,         74,        1,   535680, 0x1a9255c9
-1,     118524,     118524,     1596,     6384, 0xfb648285
 0,         75,         75,        1,   535680, 0xb4ec7e35
-1,     120120,     120120,     1624,     6496, 0xfae2950b
 0,         76,         76,        1,   535680, 0x48fac072
-1,     121744,     121744,     1596,     6384, 0xe28c8357
 0,         77,         77,        1,   535680, 0x1e260135
-1,     123340,     123340,     1596,     6384, 0xda718e60
 0,         78,         78,        1,   535680, 0xce4d5079
-1,     124936,     124936,     1596,     6384, 0x27516999
 0,         79,         79,        1,   535680, 0x13e5e4ed
-1,     126532,     126532,     1596,     6384, 0x0ba07921
 0,         80,         80,        1,   535680, 0x592305ec
-1,     128128,     128128,     1624,     6496, 0xcfbecfab
 0,         81,         81,        1,   535680, 0x9e227508
-1,     129752,     129752,     1596,     6384, 0xae4cedcd
 0,         82,         82,        1,   535680, 0x1d37e5ea
-1,     131348,     131348,     1596,     6384, 0x917b4707
 0,         83,         83,        1,   535680, 0x7eae7692
-1,     132944,     132944,     1596,     6384, 0x8671b28e
 0,         84,         84,        1,   535680, 0xf452e4b9
-1,     134540,     134540,     1596,     6384, 0x9a1238fa
 0,         85,         85,        1,   535680, 0x1460e7e9
-1,     136136,     136136,     1624,     6496, 0x23b8f8ca
 0,         86,         86,        1,   535680, 0xc6d8a638
-1,     137760,     137760,     1596,     6384, 0x3903bcd6
 0,         87,         87,        1,   535680, 0x854f5fb0
-1,     139356,     139356,     1596,     6384, 0x0532b267
 0,         88,         88,        1,   535680, 0x854f5fb0
-1,     140952,     140952,     1596,     6384, 0xde931220
 0,         89,         89,        1,   535680, 0x70a02d87
-1,     142548,     142548,     1596,     6384, 0x4ed70a80
 0,         90,         90,        1,   535680, 0x9a4ad464
 0,         91,         91,        1,   535680, 0x9a4ad464
-1,     144144,     144144,     1624,     6496, 0x4a52d5a1
 0,         92,         92,        1,   535680, 0x9a4ad464
-1,     145768,     145768,     1596,     6384, 0xc1be5760
 0,         93,         93,        1,   535680, 0x9a4ad464
-1,     147364,     147364,     1596,     6384, 0x790d69ba
 0,         94,         94,        1,   535680, 0x9a4ad464
-1,     148960,     148960,     1596,     6384, 0x9d73e6cf
 0,         95,         95,        1,   535680, 0x9a4ad464
-1,     150556,     150556,     1568,     6272, 0xbc0fc725
diff --git a/tests/ref/fate/ea-tgv-1 b/tests/ref/fate/ea-tgv-1
new file mode 100644
index 0000000000000000000000000000000000000000..fc9218164b0ed179e77a2a141a1bc15143686188
--- /dev/null
+++ b/tests/ref/fate/ea-tgv-1
@@ -0,0 +1,48 @@
+#tb 0: 1/15
+0,          0,          0,        1,   230400, 0xfbf2581e
+0,          1,          1,        1,   230400, 0xfbf2581e
+0,          2,          2,        1,   230400, 0xfbf2581e
+0,          3,          3,        1,   230400, 0xfbf2581e
+0,          4,          4,        1,   230400, 0xfbf2581e
+0,          5,          5,        1,   230400, 0xfbf2581e
+0,          6,          6,        1,   230400, 0xfbf2581e
+0,          7,          7,        1,   230400, 0xfbf2581e
+0,          8,          8,        1,   230400, 0xfbf2581e
+0,          9,          9,        1,   230400, 0xfbf2581e
+0,         10,         10,        1,   230400, 0xfbf2581e
+0,         11,         11,        1,   230400, 0xfbf2581e
+0,         12,         12,        1,   230400, 0xfbf2581e
+0,         13,         13,        1,   230400, 0xfbf2581e
+0,         14,         14,        1,   230400, 0xfbf2581e
+0,         15,         15,        1,   230400, 0xf5a0a21d
+0,         16,         16,        1,   230400, 0x909cc039
+0,         17,         17,        1,   230400, 0x14d899dd
+0,         18,         18,        1,   230400, 0x0d246edf
+0,         19,         19,        1,   230400, 0x5345fe0d
+0,         20,         20,        1,   230400, 0x5abdff9a
+0,         21,         21,        1,   230400, 0x1730d973
+0,         22,         22,        1,   230400, 0xec881be9
+0,         23,         23,        1,   230400, 0xf4216895
+0,         24,         24,        1,   230400, 0x529d7a52
+0,         25,         25,        1,   230400, 0x93b4c7b9
+0,         26,         26,        1,   230400, 0xedc65bcd
+0,         27,         27,        1,   230400, 0xf0fb54ae
+0,         28,         28,        1,   230400, 0x27864ce9
+0,         29,         29,        1,   230400, 0xcd05012d
+0,         30,         30,        1,   230400, 0x019b6d84
+0,         31,         31,        1,   230400, 0xcc05d416
+0,         32,         32,        1,   230400, 0xb04c0248
+0,         33,         33,        1,   230400, 0x6806eb92
+0,         34,         34,        1,   230400, 0x60e9c001
+0,         35,         35,        1,   230400, 0x9b040261
+0,         36,         36,        1,   230400, 0x6961fb90
+0,         37,         37,        1,   230400, 0xbf67ad24
+0,         38,         38,        1,   230400, 0x2270f328
+0,         39,         39,        1,   230400, 0xd0c345f6
+0,         40,         40,        1,   230400, 0xfd159212
+0,         41,         41,        1,   230400, 0x085578ff
+0,         42,         42,        1,   230400, 0xcca8afa6
+0,         43,         43,        1,   230400, 0x901ec91c
+0,         44,         44,        1,   230400, 0xf1cb99f3
+0,         45,         45,        1,   230400, 0x86d98f0c
+0,         46,         46,        1,   230400, 0x52970700
diff --git a/tests/ref/fate/ea-tgv-2 b/tests/ref/fate/ea-tgv-2
new file mode 100644
index 0000000000000000000000000000000000000000..5e9de02149a0af36c633842c4dd54204662d9889
--- /dev/null
+++ b/tests/ref/fate/ea-tgv-2
@@ -0,0 +1,39 @@
+#tb 0: 1/15
+0,          0,          0,        1,   192000, 0xdfc2f225
+0,          1,          1,        1,   192000, 0x059b57bd
+0,          2,          2,        1,   192000, 0x766cb086
+0,          3,          3,        1,   192000, 0x459e3bac
+0,          4,          4,        1,   192000, 0x5293e622
+0,          5,          5,        1,   192000, 0x898b03f4
+0,          6,          6,        1,   192000, 0xb184a627
+0,          7,          7,        1,   192000, 0xa3fc650a
+0,          8,          8,        1,   192000, 0xea448589
+0,          9,          9,        1,   192000, 0x700e2b76
+0,         10,         10,        1,   192000, 0xa1a1d66d
+0,         11,         11,        1,   192000, 0xd63bc8a1
+0,         12,         12,        1,   192000, 0x5f08c023
+0,         13,         13,        1,   192000, 0x8b75ec3b
+0,         14,         14,        1,   192000, 0x62728ce4
+0,         15,         15,        1,   192000, 0xaa007941
+0,         16,         16,        1,   192000, 0x55dc5b3b
+0,         17,         17,        1,   192000, 0x72d836c2
+0,         18,         18,        1,   192000, 0x1f2de2fc
+0,         19,         19,        1,   192000, 0xb295dfdb
+0,         20,         20,        1,   192000, 0xe5c5f634
+0,         21,         21,        1,   192000, 0x455a0464
+0,         22,         22,        1,   192000, 0x3bf2340d
+0,         23,         23,        1,   192000, 0xe368f0fc
+0,         24,         24,        1,   192000, 0xfa7549c0
+0,         25,         25,        1,   192000, 0x4dd76f3d
+0,         26,         26,        1,   192000, 0x50a49f6c
+0,         27,         27,        1,   192000, 0xb6072f65
+0,         28,         28,        1,   192000, 0x093ce1a8
+0,         29,         29,        1,   192000, 0x55afe3db
+0,         30,         30,        1,   192000, 0x81c3bfab
+0,         31,         31,        1,   192000, 0x583ebd3d
+0,         32,         32,        1,   192000, 0x2504f003
+0,         33,         33,        1,   192000, 0x44ade2af
+0,         34,         34,        1,   192000, 0x77cbcfd8
+0,         35,         35,        1,   192000, 0xac7ddfa1
+0,         36,         36,        1,   192000, 0x79f7cfe8
+0,         37,         37,        1,   192000, 0xdf2898fd
diff --git a/tests/ref/fate/ea-tgv-ima-ea-eacs b/tests/ref/fate/ea-tgv-ima-ea-eacs
deleted file mode 100644
index 1814e3ce83be90ceebb71a39fdaa5d10e6063fbb..0000000000000000000000000000000000000000
--- a/tests/ref/fate/ea-tgv-ima-ea-eacs
+++ /dev/null
@@ -1,96 +0,0 @@
-#tb 0: 1/15
-#tb 1: 1/22050
-0,          0,          0,        1,   230400, 0xfbf2581e
-1,          0,          0,     1468,     5872, 0x00000000
-1,       1468,       1468,     1468,     5872, 0x00000000
-0,          1,          1,        1,   230400, 0xfbf2581e
-1,       2936,       2936,     1468,     5872, 0x00000000
-0,          2,          2,        1,   230400, 0xfbf2581e
-1,       4404,       4404,     1468,     5872, 0x00000000
-0,          3,          3,        1,   230400, 0xfbf2581e
-1,       5872,       5872,     1468,     5872, 0x00000000
-0,          4,          4,        1,   230400, 0xfbf2581e
-1,       7340,       7340,     1468,     5872, 0x00000000
-0,          5,          5,        1,   230400, 0xfbf2581e
-1,       8808,       8808,     1468,     5872, 0x00000000
-0,          6,          6,        1,   230400, 0xfbf2581e
-1,      10276,      10276,     1468,     5872, 0x00000000
-0,          7,          7,        1,   230400, 0xfbf2581e
-1,      11744,      11744,     1468,     5872, 0x00000000
-0,          8,          8,        1,   230400, 0xfbf2581e
-1,      13212,      13212,     1468,     5872, 0x00000000
-0,          9,          9,        1,   230400, 0xfbf2581e
-1,      14680,      14680,     1468,     5872, 0x00000000
-0,         10,         10,        1,   230400, 0xfbf2581e
-1,      16148,      16148,     1468,     5872, 0x00000000
-0,         11,         11,        1,   230400, 0xfbf2581e
-1,      17616,      17616,     1468,     5872, 0x00000000
-0,         12,         12,        1,   230400, 0xfbf2581e
-1,      19084,      19084,     1468,     5872, 0x00000000
-0,         13,         13,        1,   230400, 0xfbf2581e
-1,      20552,      20552,     1468,     5872, 0x00000000
-0,         14,         14,        1,   230400, 0xfbf2581e
-1,      22020,      22020,     1468,     5872, 0xc6f64777
-0,         15,         15,        1,   230400, 0xf5a0a21d
-1,      23488,      23488,     1468,     5872, 0x7c9e60e8
-0,         16,         16,        1,   230400, 0x909cc039
-1,      24956,      24956,     1468,     5872, 0x46525c54
-0,         17,         17,        1,   230400, 0x14d899dd
-1,      26424,      26424,     1468,     5872, 0x842796bb
-0,         18,         18,        1,   230400, 0x0d246edf
-1,      27892,      27892,     1468,     5872, 0xb1f6cbd5
-0,         19,         19,        1,   230400, 0x5345fe0d
-1,      29360,      29360,     1468,     5872, 0x0261a74b
-0,         20,         20,        1,   230400, 0x5abdff9a
-1,      30828,      30828,     1468,     5872, 0x8218b1f9
-0,         21,         21,        1,   230400, 0x1730d973
-1,      32296,      32296,     1468,     5872, 0xd7a2cae6
-0,         22,         22,        1,   230400, 0xec881be9
-1,      33764,      33764,     1468,     5872, 0x69d34562
-0,         23,         23,        1,   230400, 0xf4216895
-1,      35232,      35232,     1468,     5872, 0x9303ec65
-0,         24,         24,        1,   230400, 0x529d7a52
-1,      36700,      36700,     1468,     5872, 0xd5d963a1
-0,         25,         25,        1,   230400, 0x93b4c7b9
-1,      38168,      38168,     1468,     5872, 0x0557e06f
-0,         26,         26,        1,   230400, 0xedc65bcd
-1,      39636,      39636,     1468,     5872, 0x1eb48b41
-0,         27,         27,        1,   230400, 0xf0fb54ae
-1,      41104,      41104,     1468,     5872, 0x70f5ca3f
-0,         28,         28,        1,   230400, 0x27864ce9
-1,      42572,      42572,     1468,     5872, 0xd39e5c5e
-0,         29,         29,        1,   230400, 0xcd05012d
-1,      44040,      44040,     1468,     5872, 0x29c59140
-0,         30,         30,        1,   230400, 0x019b6d84
-1,      45508,      45508,     1468,     5872, 0x7d95e643
-0,         31,         31,        1,   230400, 0xcc05d416
-1,      46976,      46976,     1468,     5872, 0x45353fd8
-0,         32,         32,        1,   230400, 0xb04c0248
-1,      48444,      48444,     1468,     5872, 0xad7b1b27
-0,         33,         33,        1,   230400, 0x6806eb92
-1,      49912,      49912,     1468,     5872, 0x1f0377b3
-0,         34,         34,        1,   230400, 0x60e9c001
-1,      51380,      51380,     1468,     5872, 0x6074541e
-0,         35,         35,        1,   230400, 0x9b040261
-1,      52848,      52848,     1468,     5872, 0xa4f5e892
-0,         36,         36,        1,   230400, 0x6961fb90
-1,      54316,      54316,     1468,     5872, 0x084bc696
-0,         37,         37,        1,   230400, 0xbf67ad24
-1,      55784,      55784,     1468,     5872, 0x67fdafce
-0,         38,         38,        1,   230400, 0x2270f328
-1,      57252,      57252,     1468,     5872, 0x8dfd249d
-0,         39,         39,        1,   230400, 0xd0c345f6
-1,      58720,      58720,     1468,     5872, 0x514184ee
-0,         40,         40,        1,   230400, 0xfd159212
-1,      60188,      60188,     1468,     5872, 0xc0090b0d
-0,         41,         41,        1,   230400, 0x085578ff
-1,      61656,      61656,     1468,     5872, 0xc1171cc8
-0,         42,         42,        1,   230400, 0xcca8afa6
-1,      63124,      63124,     1468,     5872, 0x7d7dd07e
-0,         43,         43,        1,   230400, 0x901ec91c
-1,      64592,      64592,     1468,     5872, 0xe6aa619c
-0,         44,         44,        1,   230400, 0xf1cb99f3
-1,      66060,      66060,     1468,     5872, 0xd5aac0df
-0,         45,         45,        1,   230400, 0x86d98f0c
-1,      67528,      67528,     1468,     5872, 0x3b68b390
-0,         46,         46,        1,   230400, 0x52970700
diff --git a/tests/ref/fate/ea-tgv-ima-ea-sead b/tests/ref/fate/ea-tgv-ima-ea-sead
deleted file mode 100644
index bfc9cb58fec636685347e997f23f1c4c1adce2c0..0000000000000000000000000000000000000000
--- a/tests/ref/fate/ea-tgv-ima-ea-sead
+++ /dev/null
@@ -1,89 +0,0 @@
-#tb 0: 1/15
-#tb 1: 1/22050
-0,          0,          0,        1,   192000, 0xdfc2f225
-1,          0,          0,      736,     2944, 0x00000000
-1,        736,        736,     1472,     5888, 0x5ae3c2a4
-0,          1,          1,        1,   192000, 0x059b57bd
-1,       2208,       2208,     1472,     5888, 0x158fbcb4
-0,          2,          2,        1,   192000, 0x766cb086
-1,       3680,       3680,     1472,     5888, 0x3fc85d35
-0,          3,          3,        1,   192000, 0x459e3bac
-1,       5152,       5152,     1472,     5888, 0x4667ec2b
-0,          4,          4,        1,   192000, 0x5293e622
-1,       6624,       6624,     1472,     5888, 0x82744494
-0,          5,          5,        1,   192000, 0x898b03f4
-1,       8096,       8096,     1472,     5888, 0x3b0cb86f
-0,          6,          6,        1,   192000, 0xb184a627
-1,       9568,       9568,     1472,     5888, 0x29493fbb
-0,          7,          7,        1,   192000, 0xa3fc650a
-1,      11040,      11040,     1472,     5888, 0xaa2d8595
-0,          8,          8,        1,   192000, 0xea448589
-1,      12512,      12512,     1472,     5888, 0x2e563de6
-0,          9,          9,        1,   192000, 0x700e2b76
-1,      13984,      13984,     1472,     5888, 0x225cca99
-0,         10,         10,        1,   192000, 0xa1a1d66d
-1,      15456,      15456,     1472,     5888, 0x2b577599
-0,         11,         11,        1,   192000, 0xd63bc8a1
-1,      16928,      16928,     1472,     5888, 0x3d967f32
-0,         12,         12,        1,   192000, 0x5f08c023
-1,      18400,      18400,     1472,     5888, 0x16639a84
-0,         13,         13,        1,   192000, 0x8b75ec3b
-1,      19872,      19872,     1472,     5888, 0x90549ba0
-0,         14,         14,        1,   192000, 0x62728ce4
-1,      21344,      21344,     1472,     5888, 0xf46e6644
-0,         15,         15,        1,   192000, 0xaa007941
-1,      22816,      22816,     1472,     5888, 0x39a073ec
-0,         16,         16,        1,   192000, 0x55dc5b3b
-1,      24288,      24288,     1472,     5888, 0xb1d7a93a
-0,         17,         17,        1,   192000, 0x72d836c2
-1,      25760,      25760,     1472,     5888, 0x25e9795b
-0,         18,         18,        1,   192000, 0x1f2de2fc
-1,      27232,      27232,     1472,     5888, 0xbbc07644
-0,         19,         19,        1,   192000, 0xb295dfdb
-1,      28704,      28704,     1472,     5888, 0x323f6a1b
-0,         20,         20,        1,   192000, 0xe5c5f634
-1,      30176,      30176,     1472,     5888, 0x7cae130b
-0,         21,         21,        1,   192000, 0x455a0464
-1,      31648,      31648,     1472,     5888, 0xd23bf9c6
-0,         22,         22,        1,   192000, 0x3bf2340d
-1,      33120,      33120,     1472,     5888, 0x5f73ef35
-0,         23,         23,        1,   192000, 0xe368f0fc
-1,      34592,      34592,     1472,     5888, 0xc66026be
-0,         24,         24,        1,   192000, 0xfa7549c0
-1,      36064,      36064,     1472,     5888, 0xc8fdb539
-0,         25,         25,        1,   192000, 0x4dd76f3d
-1,      37536,      37536,     1472,     5888, 0x94c6bfbd
-0,         26,         26,        1,   192000, 0x50a49f6c
-1,      39008,      39008,     1472,     5888, 0xb77e1b83
-0,         27,         27,        1,   192000, 0xb6072f65
-1,      40480,      40480,     1472,     5888, 0x6c6d6693
-0,         28,         28,        1,   192000, 0x093ce1a8
-1,      41952,      41952,     1472,     5888, 0xd9f064d4
-0,         29,         29,        1,   192000, 0x55afe3db
-1,      43424,      43424,     1472,     5888, 0x85dd990d
-0,         30,         30,        1,   192000, 0x81c3bfab
-1,      44896,      44896,     1472,     5888, 0x385e021b
-0,         31,         31,        1,   192000, 0x583ebd3d
-1,      46368,      46368,     1472,     5888, 0xac09fd02
-0,         32,         32,        1,   192000, 0x2504f003
-1,      47840,      47840,     1472,     5888, 0xc6dcdff2
-0,         33,         33,        1,   192000, 0x44ade2af
-1,      49312,      49312,     1472,     5888, 0x86a6944d
-0,         34,         34,        1,   192000, 0x77cbcfd8
-1,      50784,      50784,     1472,     5888, 0x8587b964
-0,         35,         35,        1,   192000, 0xac7ddfa1
-1,      52256,      52256,     1472,     5888, 0x2b0355ff
-0,         36,         36,        1,   192000, 0x79f7cfe8
-1,      53728,      53728,     1472,     5888, 0xe4148a85
-0,         37,         37,        1,   192000, 0xdf2898fd
-1,      55200,      55200,     1472,     5888, 0xdf02ed4f
-1,      56672,      56672,     1472,     5888, 0x87a54b15
-1,      58144,      58144,     1472,     5888, 0x3ad2be45
-1,      59616,      59616,     1472,     5888, 0x3a49c2c3
-1,      61088,      61088,     1472,     5888, 0xc2b66404
-1,      62560,      62560,     1472,     5888, 0xac3e234a
-1,      64032,      64032,     1472,     5888, 0x5dcf523b
-1,      65504,      65504,     1472,     5888, 0x2034b5d6
-1,      66976,      66976,     1472,     5888, 0x96882832
-1,      68448,      68448,     1472,     5888, 0x2be3d534
-1,      69920,      69920,     1472,     5888, 0xa841a49d
diff --git a/tests/ref/fate/adpcm-ea-tqi b/tests/ref/fate/ea-tqi
similarity index 51%
rename from tests/ref/fate/adpcm-ea-tqi
rename to tests/ref/fate/ea-tqi
index 5c64661f7bce08c0f9b59010f910c2e3e7513e4b..72afb81ede5140abd6272a9b30886e545c5ca5f6 100644
--- a/tests/ref/fate/adpcm-ea-tqi
+++ b/tests/ref/fate/ea-tqi
@@ -1,52 +1,27 @@
 #tb 0: 1/15
-#tb 1: 1/22050
 0,          0,          0,        1,   115200, 0x375ec573
-1,          0,          0,     1484,     5936, 0x00000000
 0,          1,          1,        1,   115200, 0x375ec573
-1,       1484,       1484,     1456,     5824, 0x00000000
 0,          2,          2,        1,   115200, 0x375ec573
-1,       2940,       2940,     1484,     5936, 0x00000000
 0,          3,          3,        1,   115200, 0x375ec573
-1,       4424,       4424,     1456,     5824, 0x00000000
 0,          4,          4,        1,   115200, 0x375ec573
-1,       5880,       5880,     1484,     5936, 0x00000000
 0,          5,          5,        1,   115200, 0x375ec573
-1,       7364,       7364,     1456,     5824, 0x00000000
 0,          6,          6,        1,   115200, 0x375ec573
-1,       8820,       8820,     1484,     5936, 0x00000000
 0,          7,          7,        1,   115200, 0x375ec573
-1,      10304,      10304,     1456,     5824, 0x0f06f5bb
 0,          8,          8,        1,   115200, 0x0b4d31bf
-1,      11760,      11760,     1484,     5936, 0xb0dbfc46
 0,          9,          9,        1,   115200, 0xdd724598
-1,      13244,      13244,     1456,     5824, 0x9daa9f9c
 0,         10,         10,        1,   115200, 0xc3077e75
-1,      14700,      14700,     1484,     5936, 0x61400d2f
 0,         11,         11,        1,   115200, 0xbf70778a
-1,      16184,      16184,     1456,     5824, 0x34a5b0e3
 0,         12,         12,        1,   115200, 0x117eb766
-1,      17640,      17640,     1484,     5936, 0x6e546f72
 0,         13,         13,        1,   115200, 0x4617fbad
-1,      19124,      19124,     1456,     5824, 0x4f093b35
 0,         14,         14,        1,   115200, 0x5f5b02d2
-1,      20580,      20580,     1484,     5936, 0x95b5b599
 0,         15,         15,        1,   115200, 0x2a9c5325
-1,      22064,      22064,     1456,     5824, 0x75e15e60
 0,         16,         16,        1,   115200, 0x14a89e2a
-1,      23520,      23520,     1484,     5936, 0xd1077d39
 0,         17,         17,        1,   115200, 0xe69aa994
-1,      25004,      25004,     1456,     5824, 0x956e21ca
 0,         18,         18,        1,   115200, 0xfbacf589
-1,      26460,      26460,     1484,     5936, 0x33bac234
 0,         19,         19,        1,   115200, 0x1d714c6e
-1,      27944,      27944,     1456,     5824, 0x5df37824
 0,         20,         20,        1,   115200, 0x6eff66cb
-1,      29400,      29400,     1484,     5936, 0xc174af24
 0,         21,         21,        1,   115200, 0xee21c1cb
-1,      30884,      30884,     1456,     5824, 0xe5dc2159
 0,         22,         22,        1,   115200, 0xce714ada
-1,      32340,      32340,     1484,     5936, 0x63ffc8b1
 0,         23,         23,        1,   115200, 0xf89d56c3
-1,      33824,      33824,     1456,     5824, 0xefe4c365
 0,         24,         24,        1,   115200, 0x65fd5e60
 0,         25,         25,        1,   115200, 0x0c256424
diff --git a/tests/ref/fate/ea-dct b/tests/ref/fate/mdec
similarity index 50%
rename from tests/ref/fate/ea-dct
rename to tests/ref/fate/mdec
index 071be8abb64d22a302f8f10eb3bdc674af68f672..b7aab626e91261f341511c0277b45e732b44fc0f 100644
--- a/tests/ref/fate/ea-dct
+++ b/tests/ref/fate/mdec
@@ -1,269 +1,135 @@
 #tb 0: 1/15
-#tb 1: 1/22050
 0,          0,          0,        1,   102144, 0x6edc83de
-1,          0,          0,     1484,     5936, 0xea261a29
 0,          1,          1,        1,   102144, 0xd0534fda
-1,       1484,       1484,     1456,     5824, 0x253df061
 0,          2,          2,        1,   102144, 0x6447911f
-1,       2940,       2940,     1484,     5936, 0x603a5bd7
 0,          3,          3,        1,   102144, 0xf21f3b46
-1,       4424,       4424,     1456,     5824, 0x9d283f59
 0,          4,          4,        1,   102144, 0x0975077a
-1,       5880,       5880,     1484,     5936, 0x49323497
 0,          5,          5,        1,   102144, 0xb9a12d8e
-1,       7364,       7364,     1456,     5824, 0x7c299939
 0,          6,          6,        1,   102144, 0x17413513
-1,       8820,       8820,     1484,     5936, 0x9f918e9a
 0,          7,          7,        1,   102144, 0x1e622a04
-1,      10304,      10304,     1456,     5824, 0x1226b534
 0,          8,          8,        1,   102144, 0x7489224e
-1,      11760,      11760,     1484,     5936, 0xdd159326
 0,          9,          9,        1,   102144, 0xae14956e
-1,      13244,      13244,     1456,     5824, 0x361ad10f
 0,         10,         10,        1,   102144, 0x104fd3a0
-1,      14700,      14700,     1484,     5936, 0x6ccac9e3
 0,         11,         11,        1,   102144, 0xea63a940
-1,      16184,      16184,     1456,     5824, 0x1861efef
 0,         12,         12,        1,   102144, 0x0cf81588
-1,      17640,      17640,     1484,     5936, 0x5f718eb9
 0,         13,         13,        1,   102144, 0xe4a5b2fd
-1,      19124,      19124,     1456,     5824, 0xd4ca72ba
 0,         14,         14,        1,   102144, 0x0c9aaf77
-1,      20580,      20580,     1484,     5936, 0xbf2b27e6
 0,         15,         15,        1,   102144, 0x065007d7
-1,      22064,      22064,     1456,     5824, 0xcb6f024e
 0,         16,         16,        1,   102144, 0x54c0c29b
-1,      23520,      23520,     1484,     5936, 0x7dfb7e05
 0,         17,         17,        1,   102144, 0x1114cb8e
-1,      25004,      25004,     1456,     5824, 0x80e16f13
 0,         18,         18,        1,   102144, 0xe4270462
-1,      26460,      26460,     1484,     5936, 0x0fb59227
 0,         19,         19,        1,   102144, 0x61e5b7fd
-1,      27944,      27944,     1456,     5824, 0x4d6f1fdb
 0,         20,         20,        1,   102144, 0x7cbeaca6
-1,      29400,      29400,     1484,     5936, 0x505a5103
 0,         21,         21,        1,   102144, 0xed92daa4
-1,      30884,      30884,     1456,     5824, 0x47ef4c13
 0,         22,         22,        1,   102144, 0xd8654d0d
-1,      32340,      32340,     1484,     5936, 0xbe4795fb
 0,         23,         23,        1,   102144, 0x854e842b
-1,      33824,      33824,     1456,     5824, 0xb82cc4ff
 0,         24,         24,        1,   102144, 0x56407c3a
-1,      35280,      35280,     1484,     5936, 0xf7c6ab8d
 0,         25,         25,        1,   102144, 0x17db3f90
-1,      36764,      36764,     1456,     5824, 0x1442f5e0
 0,         26,         26,        1,   102144, 0x8b133b9a
-1,      38220,      38220,     1484,     5936, 0x64659389
 0,         27,         27,        1,   102144, 0xe4899db9
-1,      39704,      39704,     1456,     5824, 0xdd81725c
 0,         28,         28,        1,   102144, 0x579cf092
-1,      41160,      41160,     1484,     5936, 0x7f7c604f
 0,         29,         29,        1,   102144, 0x19fa5062
-1,      42644,      42644,     1456,     5824, 0xafc77beb
 0,         30,         30,        1,   102144, 0x71339792
-1,      44100,      44100,     1484,     5936, 0x24f88e4d
 0,         31,         31,        1,   102144, 0x970e5c0c
-1,      45584,      45584,     1456,     5824, 0xa31956ca
 0,         32,         32,        1,   102144, 0x84ee616a
-1,      47040,      47040,     1484,     5936, 0x958e02b9
 0,         33,         33,        1,   102144, 0x1d6f9a23
-1,      48524,      48524,     1456,     5824, 0xcfc79890
 0,         34,         34,        1,   102144, 0xc28e19db
-1,      49980,      49980,     1484,     5936, 0xc7e788ae
 0,         35,         35,        1,   102144, 0x0e898967
-1,      51464,      51464,     1456,     5824, 0x4b6b1acc
 0,         36,         36,        1,   102144, 0x52a8b671
-1,      52920,      52920,     1484,     5936, 0xa74496dc
 0,         37,         37,        1,   102144, 0x3f45ea83
-1,      54404,      54404,     1456,     5824, 0x719e6171
 0,         38,         38,        1,   102144, 0x7b0fc603
-1,      55860,      55860,     1484,     5936, 0x9346222d
 0,         39,         39,        1,   102144, 0x14f94469
-1,      57344,      57344,     1456,     5824, 0x9e2a876e
 0,         40,         40,        1,   102144, 0x5b9f37cc
-1,      58800,      58800,     1484,     5936, 0xeca6ea64
 0,         41,         41,        1,   102144, 0xf902b7c7
-1,      60284,      60284,     1456,     5824, 0x07d8174f
 0,         42,         42,        1,   102144, 0x326836e0
-1,      61740,      61740,     1484,     5936, 0x2df5aa6b
 0,         43,         43,        1,   102144, 0x2e4aebba
-1,      63224,      63224,     1456,     5824, 0x314e7034
 0,         44,         44,        1,   102144, 0xd10ae58c
-1,      64680,      64680,     1484,     5936, 0x5a328768
 0,         45,         45,        1,   102144, 0xbd084ecf
-1,      66164,      66164,     1456,     5824, 0x32b92446
 0,         46,         46,        1,   102144, 0xb2157c0a
-1,      67620,      67620,     1484,     5936, 0x20ecbc9b
 0,         47,         47,        1,   102144, 0xd7f158d4
-1,      69104,      69104,     1456,     5824, 0x76019c14
 0,         48,         48,        1,   102144, 0x3cf86462
-1,      70560,      70560,     1484,     5936, 0x8c3ef8a6
 0,         49,         49,        1,   102144, 0x53ecddab
-1,      72044,      72044,     1456,     5824, 0xcdaab50b
 0,         50,         50,        1,   102144, 0xcdaba8ef
-1,      73500,      73500,     1484,     5936, 0xb2f87f4f
 0,         51,         51,        1,   102144, 0xab9ede18
-1,      74984,      74984,     1456,     5824, 0x70c26379
 0,         52,         52,        1,   102144, 0xb6706e79
-1,      76440,      76440,     1484,     5936, 0x5691ecfd
 0,         53,         53,        1,   102144, 0x76371069
-1,      77924,      77924,     1456,     5824, 0x61e208fe
 0,         54,         54,        1,   102144, 0x3a365016
-1,      79380,      79380,     1484,     5936, 0x87d1a5e0
 0,         55,         55,        1,   102144, 0x52177c09
-1,      80864,      80864,     1456,     5824, 0x02054cfd
 0,         56,         56,        1,   102144, 0xc33eb4fb
-1,      82320,      82320,     1484,     5936, 0x22ff1c4b
 0,         57,         57,        1,   102144, 0x16098436
-1,      83804,      83804,     1456,     5824, 0xc6d87fef
 0,         58,         58,        1,   102144, 0x715d6a2b
-1,      85260,      85260,     1484,     5936, 0x9028bb3b
 0,         59,         59,        1,   102144, 0xd3abc960
-1,      86744,      86744,     1456,     5824, 0xbadde406
 0,         60,         60,        1,   102144, 0x7f34b0d4
-1,      88200,      88200,     1484,     5936, 0x6e88ddf1
 0,         61,         61,        1,   102144, 0xe3219b9c
-1,      89684,      89684,     1456,     5824, 0x5bb8be6e
 0,         62,         62,        1,   102144, 0x5fa54f54
-1,      91140,      91140,     1484,     5936, 0xe1f8d7fc
 0,         63,         63,        1,   102144, 0x0fb746cb
-1,      92624,      92624,     1456,     5824, 0xc824e388
 0,         64,         64,        1,   102144, 0xa6bd2da2
-1,      94080,      94080,     1484,     5936, 0x654371a9
 0,         65,         65,        1,   102144, 0x04579119
-1,      95564,      95564,     1456,     5824, 0xae6ee9ec
 0,         66,         66,        1,   102144, 0xda818691
-1,      97020,      97020,     1484,     5936, 0x9aa4550d
 0,         67,         67,        1,   102144, 0xe9d44445
-1,      98504,      98504,     1456,     5824, 0xdce210ac
 0,         68,         68,        1,   102144, 0x94868dc9
-1,      99960,      99960,     1484,     5936, 0xb12641c8
 0,         69,         69,        1,   102144, 0x3ca52ce6
-1,     101444,     101444,     1456,     5824, 0x277e014b
 0,         70,         70,        1,   102144, 0xd7eb4c4f
-1,     102900,     102900,     1484,     5936, 0xb0d262de
 0,         71,         71,        1,   102144, 0xfcdfafca
-1,     104384,     104384,     1456,     5824, 0xf94d6f49
 0,         72,         72,        1,   102144, 0x473a4a5a
-1,     105840,     105840,     1484,     5936, 0x3d7848cb
 0,         73,         73,        1,   102144, 0xe5a5f3cb
-1,     107324,     107324,     1456,     5824, 0xe67fc08e
 0,         74,         74,        1,   102144, 0x34070219
-1,     108780,     108780,     1484,     5936, 0x0475e0d6
 0,         75,         75,        1,   102144, 0x0faa965a
-1,     110264,     110264,     1456,     5824, 0x8a9a4a2e
 0,         76,         76,        1,   102144, 0xe2c6acda
-1,     111720,     111720,     1484,     5936, 0x82576204
 0,         77,         77,        1,   102144, 0xe22776d5
-1,     113204,     113204,     1456,     5824, 0x3017b648
 0,         78,         78,        1,   102144, 0x80d85602
-1,     114660,     114660,     1484,     5936, 0xca4c3e04
 0,         79,         79,        1,   102144, 0x2f3fa190
-1,     116144,     116144,     1456,     5824, 0x340077d1
 0,         80,         80,        1,   102144, 0x70b461b1
-1,     117600,     117600,     1484,     5936, 0x805bea6e
 0,         81,         81,        1,   102144, 0x366c8b27
-1,     119084,     119084,     1456,     5824, 0x2cf6c87b
 0,         82,         82,        1,   102144, 0x65cc0866
-1,     120540,     120540,     1484,     5936, 0x3635bc5f
 0,         83,         83,        1,   102144, 0x903beb14
-1,     122024,     122024,     1456,     5824, 0x0d7a81c7
 0,         84,         84,        1,   102144, 0xb6c5f5c7
-1,     123480,     123480,     1484,     5936, 0x26179764
 0,         85,         85,        1,   102144, 0xaa813725
-1,     124964,     124964,     1456,     5824, 0xa0b2454f
 0,         86,         86,        1,   102144, 0x014a84a0
-1,     126420,     126420,     1484,     5936, 0x91d24608
 0,         87,         87,        1,   102144, 0xd286ece1
-1,     127904,     127904,     1456,     5824, 0x6509b3e1
 0,         88,         88,        1,   102144, 0x48b1c27d
-1,     129360,     129360,     1484,     5936, 0xa0e3c9fc
 0,         89,         89,        1,   102144, 0xa611ef42
-1,     130844,     130844,     1456,     5824, 0x18682a2f
 0,         90,         90,        1,   102144, 0x98627584
-1,     132300,     132300,     1484,     5936, 0x89cea4ff
 0,         91,         91,        1,   102144, 0x43de7c75
-1,     133784,     133784,     1456,     5824, 0x7dd22b85
 0,         92,         92,        1,   102144, 0xa9e22c68
-1,     135240,     135240,     1484,     5936, 0x8b2eeb8d
 0,         93,         93,        1,   102144, 0x84ac34d4
-1,     136724,     136724,     1456,     5824, 0x0c21af82
 0,         94,         94,        1,   102144, 0x6abd00ba
-1,     138180,     138180,     1484,     5936, 0x9c5a748d
 0,         95,         95,        1,   102144, 0x5d11066e
-1,     139664,     139664,     1456,     5824, 0x1dc72c5c
 0,         96,         96,        1,   102144, 0xb6b083aa
-1,     141120,     141120,     1484,     5936, 0xe6129383
 0,         97,         97,        1,   102144, 0x5d152a11
-1,     142604,     142604,     1456,     5824, 0x0a44312a
 0,         98,         98,        1,   102144, 0x0c0aec67
-1,     144060,     144060,     1484,     5936, 0x7ed30640
 0,         99,         99,        1,   102144, 0xa248bd10
-1,     145544,     145544,     1456,     5824, 0xede15f25
 0,        100,        100,        1,   102144, 0x4e6c12cc
-1,     147000,     147000,     1484,     5936, 0x0096d0f3
 0,        101,        101,        1,   102144, 0xca1d6753
-1,     148484,     148484,     1456,     5824, 0x13764b4b
 0,        102,        102,        1,   102144, 0x116310c3
-1,     149940,     149940,     1484,     5936, 0xd4608756
 0,        103,        103,        1,   102144, 0x16903cd0
-1,     151424,     151424,     1456,     5824, 0x254b5f2a
 0,        104,        104,        1,   102144, 0x239adfed
-1,     152880,     152880,     1484,     5936, 0x7705b830
 0,        105,        105,        1,   102144, 0x0970ce49
-1,     154364,     154364,     1456,     5824, 0x64a63d78
 0,        106,        106,        1,   102144, 0xb628adc1
-1,     155820,     155820,     1484,     5936, 0xc02d81a6
 0,        107,        107,        1,   102144, 0x473613f7
-1,     157304,     157304,     1456,     5824, 0xd239e55e
 0,        108,        108,        1,   102144, 0x3eef3987
-1,     158760,     158760,     1484,     5936, 0x8018cd3a
 0,        109,        109,        1,   102144, 0x935b99ca
-1,     160244,     160244,     1456,     5824, 0xf86b8a98
 0,        110,        110,        1,   102144, 0xb9f4d6ee
-1,     161700,     161700,     1484,     5936, 0x2a0078bc
 0,        111,        111,        1,   102144, 0xac811656
-1,     163184,     163184,     1456,     5824, 0x058d4e1b
 0,        112,        112,        1,   102144, 0xd1f84af0
-1,     164640,     164640,     1484,     5936, 0xbc718309
 0,        113,        113,        1,   102144, 0xf2fd25f4
-1,     166124,     166124,     1456,     5824, 0xaf6c29e5
 0,        114,        114,        1,   102144, 0x935bbed9
-1,     167580,     167580,     1484,     5936, 0x80df004d
 0,        115,        115,        1,   102144, 0x8c8c3e53
-1,     169064,     169064,     1456,     5824, 0xeca5aa57
 0,        116,        116,        1,   102144, 0x24afc20f
-1,     170520,     170520,     1484,     5936, 0xb793a8f8
 0,        117,        117,        1,   102144, 0xad20a451
-1,     172004,     172004,     1456,     5824, 0x70fa6aff
 0,        118,        118,        1,   102144, 0xd1a0df13
-1,     173460,     173460,     1484,     5936, 0xda8d4cc6
 0,        119,        119,        1,   102144, 0xb0ee53f8
-1,     174944,     174944,     1456,     5824, 0xa70088eb
 0,        120,        120,        1,   102144, 0x08cdb591
-1,     176400,     176400,     1484,     5936, 0x1c0b0aab
 0,        121,        121,        1,   102144, 0x89b985b0
-1,     177884,     177884,     1456,     5824, 0x234d2436
 0,        122,        122,        1,   102144, 0xdd27d51f
-1,     179340,     179340,     1484,     5936, 0xf79d731e
 0,        123,        123,        1,   102144, 0xa783fce0
-1,     180824,     180824,     1456,     5824, 0x5a4e454a
 0,        124,        124,        1,   102144, 0xfe5602e8
-1,     182280,     182280,     1484,     5936, 0xccf6d042
 0,        125,        125,        1,   102144, 0xfb989934
-1,     183764,     183764,     1456,     5824, 0x4e524d14
 0,        126,        126,        1,   102144, 0xf857eb2b
-1,     185220,     185220,     1484,     5936, 0xf8f2fcc3
 0,        127,        127,        1,   102144, 0x987a7098
-1,     186704,     186704,     1456,     5824, 0x08f12491
 0,        128,        128,        1,   102144, 0xbc749f42
-1,     188160,     188160,     1484,     5936, 0x506e0a42
 0,        129,        129,        1,   102144, 0x221e48a6
-1,     189644,     189644,     1456,     5824, 0x7cf05049
 0,        130,        130,        1,   102144, 0x4c4b5da2
-1,     191100,     191100,     1484,     5936, 0xdeb9d295
 0,        131,        131,        1,   102144, 0x32140027
-1,     192584,     192584,     1456,     5824, 0x758ef642
 0,        132,        132,        1,   102144, 0xbeb4bf18
-1,     194040,     194040,     1484,     5936, 0x91903980
 0,        133,        133,        1,   102144, 0x523012e5
diff --git a/tests/ref/fate/real-14_4 b/tests/ref/fate/ra-144
similarity index 100%
rename from tests/ref/fate/real-14_4
rename to tests/ref/fate/ra-144
diff --git a/tests/ref/fate/roqvideo b/tests/ref/fate/roqvideo
new file mode 100644
index 0000000000000000000000000000000000000000..9febedba0ddaffcda15702b03bbec8269aede18a
--- /dev/null
+++ b/tests/ref/fate/roqvideo
@@ -0,0 +1,211 @@
+#tb 0: 1/30
+0,          0,          0,        1,   393216, 0x56995aac
+0,          1,          1,        1,   393216, 0xf9ed5d6c
+0,          2,          2,        1,   393216, 0xd3285d75
+0,          3,          3,        1,   393216, 0x82d15d62
+0,          4,          4,        1,   393216, 0x893e5d6f
+0,          5,          5,        1,   393216, 0x82d15d62
+0,          6,          6,        1,   393216, 0x893e5d6f
+0,          7,          7,        1,   393216, 0x82d15d62
+0,          8,          8,        1,   393216, 0x893e5d6f
+0,          9,          9,        1,   393216, 0x82d15d62
+0,         10,         10,        1,   393216, 0x893e5d6f
+0,         11,         11,        1,   393216, 0x82d15d62
+0,         12,         12,        1,   393216, 0x893e5d6f
+0,         13,         13,        1,   393216, 0x82d15d62
+0,         14,         14,        1,   393216, 0x893e5d6f
+0,         15,         15,        1,   393216, 0x82d15d62
+0,         16,         16,        1,   393216, 0x2ae39eca
+0,         17,         17,        1,   393216, 0x9254be70
+0,         18,         18,        1,   393216, 0x4b2ed384
+0,         19,         19,        1,   393216, 0xbbd9d8f7
+0,         20,         20,        1,   393216, 0x1f2be0c3
+0,         21,         21,        1,   393216, 0x2434eb25
+0,         22,         22,        1,   393216, 0xa6cced4e
+0,         23,         23,        1,   393216, 0xd116f38b
+0,         24,         24,        1,   393216, 0x6b86f380
+0,         25,         25,        1,   393216, 0xc1b3f8e9
+0,         26,         26,        1,   393216, 0x2993fd5d
+0,         27,         27,        1,   393216, 0xf489fe18
+0,         28,         28,        1,   393216, 0x9ef10501
+0,         29,         29,        1,   393216, 0x8faf0512
+0,         30,         30,        1,   393216, 0xa54d0736
+0,         31,         31,        1,   393216, 0xf4ef01e0
+0,         32,         32,        1,   393216, 0xe241ef51
+0,         33,         33,        1,   393216, 0xcc38e51f
+0,         34,         34,        1,   393216, 0xb1345876
+0,         35,         35,        1,   393216, 0xf9b0968b
+0,         36,         36,        1,   393216, 0x6bb1523f
+0,         37,         37,        1,   393216, 0x83469a05
+0,         38,         38,        1,   393216, 0x73e30882
+0,         39,         39,        1,   393216, 0x8673da66
+0,         40,         40,        1,   393216, 0xb67596d3
+0,         41,         41,        1,   393216, 0xf7638710
+0,         42,         42,        1,   393216, 0x813a8f47
+0,         43,         43,        1,   393216, 0xb3526555
+0,         44,         44,        1,   393216, 0x1b167be3
+0,         45,         45,        1,   393216, 0x99114562
+0,         46,         46,        1,   393216, 0xfafb0693
+0,         47,         47,        1,   393216, 0x121d96c8
+0,         48,         48,        1,   393216, 0xb3c68c5d
+0,         49,         49,        1,   393216, 0x2035b97f
+0,         50,         50,        1,   393216, 0xfbcaeb62
+0,         51,         51,        1,   393216, 0xfd5aea5d
+0,         52,         52,        1,   393216, 0x66efbddd
+0,         53,         53,        1,   393216, 0xf1e17862
+0,         54,         54,        1,   393216, 0x27fa584d
+0,         55,         55,        1,   393216, 0xe644ec5f
+0,         56,         56,        1,   393216, 0x7e3067ba
+0,         57,         57,        1,   393216, 0x1b6ba6fd
+0,         58,         58,        1,   393216, 0x55bdba34
+0,         59,         59,        1,   393216, 0xc67db2e4
+0,         60,         60,        1,   393216, 0x359de8a2
+0,         61,         61,        1,   393216, 0x7b7a32ef
+0,         62,         62,        1,   393216, 0xbe512a66
+0,         63,         63,        1,   393216, 0x681d82bf
+0,         64,         64,        1,   393216, 0xa2320ec5
+0,         65,         65,        1,   393216, 0xcfbd9954
+0,         66,         66,        1,   393216, 0x7fee9854
+0,         67,         67,        1,   393216, 0x70eec155
+0,         68,         68,        1,   393216, 0x114f684e
+0,         69,         69,        1,   393216, 0xe27f034f
+0,         70,         70,        1,   393216, 0xfbbd89b4
+0,         71,         71,        1,   393216, 0xcef4c58a
+0,         72,         72,        1,   393216, 0x9eea88e9
+0,         73,         73,        1,   393216, 0x911cea42
+0,         74,         74,        1,   393216, 0xec5727ea
+0,         75,         75,        1,   393216, 0xda998c33
+0,         76,         76,        1,   393216, 0xc82140ed
+0,         77,         77,        1,   393216, 0x4caa8591
+0,         78,         78,        1,   393216, 0x4944206c
+0,         79,         79,        1,   393216, 0xd4676a94
+0,         80,         80,        1,   393216, 0x9e0340b3
+0,         81,         81,        1,   393216, 0xbdef7f94
+0,         82,         82,        1,   393216, 0xfac05cb0
+0,         83,         83,        1,   393216, 0xfef5a369
+0,         84,         84,        1,   393216, 0x9fcb3711
+0,         85,         85,        1,   393216, 0x6d93f761
+0,         86,         86,        1,   393216, 0xe95dc1ae
+0,         87,         87,        1,   393216, 0x3e561557
+0,         88,         88,        1,   393216, 0x0fa7a049
+0,         89,         89,        1,   393216, 0xf16afb95
+0,         90,         90,        1,   393216, 0xe53a2064
+0,         91,         91,        1,   393216, 0x57f046a4
+0,         92,         92,        1,   393216, 0xf6f16a0c
+0,         93,         93,        1,   393216, 0xcba0c8b0
+0,         94,         94,        1,   393216, 0x5bdbe522
+0,         95,         95,        1,   393216, 0x0fed0151
+0,         96,         96,        1,   393216, 0xbf86faf8
+0,         97,         97,        1,   393216, 0x39854c5f
+0,         98,         98,        1,   393216, 0xd9b7760a
+0,         99,         99,        1,   393216, 0x8edcc1d9
+0,        100,        100,        1,   393216, 0x44ae1435
+0,        101,        101,        1,   393216, 0xbc3d6d73
+0,        102,        102,        1,   393216, 0xedd82647
+0,        103,        103,        1,   393216, 0x1c2e5ce3
+0,        104,        104,        1,   393216, 0x04e29afe
+0,        105,        105,        1,   393216, 0xb191578e
+0,        106,        106,        1,   393216, 0x31d75a06
+0,        107,        107,        1,   393216, 0xfdb6c56e
+0,        108,        108,        1,   393216, 0xf528f484
+0,        109,        109,        1,   393216, 0x87af758e
+0,        110,        110,        1,   393216, 0xc8bdafb7
+0,        111,        111,        1,   393216, 0x573afe93
+0,        112,        112,        1,   393216, 0xb03cb8f5
+0,        113,        113,        1,   393216, 0x6e03ac71
+0,        114,        114,        1,   393216, 0xf919164e
+0,        115,        115,        1,   393216, 0x80059f3c
+0,        116,        116,        1,   393216, 0xf4ea0b1a
+0,        117,        117,        1,   393216, 0xe7720ffb
+0,        118,        118,        1,   393216, 0x1ec0cd56
+0,        119,        119,        1,   393216, 0x2bc8cf18
+0,        120,        120,        1,   393216, 0xe0bf17b5
+0,        121,        121,        1,   393216, 0x660247e1
+0,        122,        122,        1,   393216, 0xcf66f2a9
+0,        123,        123,        1,   393216, 0x5494d5ab
+0,        124,        124,        1,   393216, 0x2c02f2c4
+0,        125,        125,        1,   393216, 0x93fa3783
+0,        126,        126,        1,   393216, 0x4cc50633
+0,        127,        127,        1,   393216, 0x3f179386
+0,        128,        128,        1,   393216, 0x2bca9e1b
+0,        129,        129,        1,   393216, 0x3e4af867
+0,        130,        130,        1,   393216, 0x7e7df93c
+0,        131,        131,        1,   393216, 0x577e4fb0
+0,        132,        132,        1,   393216, 0x34487f0a
+0,        133,        133,        1,   393216, 0x0937bcfc
+0,        134,        134,        1,   393216, 0xa9e75a5e
+0,        135,        135,        1,   393216, 0xf7bc0c89
+0,        136,        136,        1,   393216, 0x06dacca6
+0,        137,        137,        1,   393216, 0x7baaa4bd
+0,        138,        138,        1,   393216, 0x95477f5f
+0,        139,        139,        1,   393216, 0x51117526
+0,        140,        140,        1,   393216, 0x69656d03
+0,        141,        141,        1,   393216, 0xcbd061bb
+0,        142,        142,        1,   393216, 0x8d1d5be2
+0,        143,        143,        1,   393216, 0x43e55930
+0,        144,        144,        1,   393216, 0xb56f5872
+0,        145,        145,        1,   393216, 0x09a255e9
+0,        146,        146,        1,   393216, 0xcaaa5456
+0,        147,        147,        1,   393216, 0xd267501f
+0,        148,        148,        1,   393216, 0x7bef4eca
+0,        149,        149,        1,   393216, 0x9aa94af3
+0,        150,        150,        1,   393216, 0xd39d4a29
+0,        151,        151,        1,   393216, 0x7a754960
+0,        152,        152,        1,   393216, 0x3f004921
+0,        153,        153,        1,   393216, 0x0f784ca8
+0,        154,        154,        1,   393216, 0x2a062c70
+0,        155,        155,        1,   393216, 0x114ef770
+0,        156,        156,        1,   393216, 0xfb7673bf
+0,        157,        157,        1,   393216, 0xbaea88f7
+0,        158,        158,        1,   393216, 0x6fdfe2ec
+0,        159,        159,        1,   393216, 0xb7b2b398
+0,        160,        160,        1,   393216, 0x14ba127e
+0,        161,        161,        1,   393216, 0x660b3041
+0,        162,        162,        1,   393216, 0xe3f3302a
+0,        163,        163,        1,   393216, 0x34c7f1c9
+0,        164,        164,        1,   393216, 0xa8257bf4
+0,        165,        165,        1,   393216, 0xd63fc649
+0,        166,        166,        1,   393216, 0xf8e5b79c
+0,        167,        167,        1,   393216, 0xa67b52ab
+0,        168,        168,        1,   393216, 0xef8f9c74
+0,        169,        169,        1,   393216, 0x6d3aa6b6
+0,        170,        170,        1,   393216, 0x8c174ee6
+0,        171,        171,        1,   393216, 0x2dfbc524
+0,        172,        172,        1,   393216, 0x7d0808b6
+0,        173,        173,        1,   393216, 0x6cbdf6f5
+0,        174,        174,        1,   393216, 0xfe39bc53
+0,        175,        175,        1,   393216, 0xa3d869b0
+0,        176,        176,        1,   393216, 0x09f00057
+0,        177,        177,        1,   393216, 0x6ba56343
+0,        178,        178,        1,   393216, 0xb696ca3e
+0,        179,        179,        1,   393216, 0x4eba0225
+0,        180,        180,        1,   393216, 0xdd45464b
+0,        181,        181,        1,   393216, 0x2909a9ea
+0,        182,        182,        1,   393216, 0x12aa3f85
+0,        183,        183,        1,   393216, 0x59421352
+0,        184,        184,        1,   393216, 0x57ea0313
+0,        185,        185,        1,   393216, 0x4e5f3a38
+0,        186,        186,        1,   393216, 0x55bc932d
+0,        187,        187,        1,   393216, 0x666ee55d
+0,        188,        188,        1,   393216, 0xb0f84a69
+0,        189,        189,        1,   393216, 0xad3ae63f
+0,        190,        190,        1,   393216, 0x970fd47d
+0,        191,        191,        1,   393216, 0x86c418e0
+0,        192,        192,        1,   393216, 0x52c9ce50
+0,        193,        193,        1,   393216, 0xd54c98c8
+0,        194,        194,        1,   393216, 0xb40e5fea
+0,        195,        195,        1,   393216, 0x2aa74875
+0,        196,        196,        1,   393216, 0x305b251e
+0,        197,        197,        1,   393216, 0xab8c0780
+0,        198,        198,        1,   393216, 0x0101dd0e
+0,        199,        199,        1,   393216, 0x23739cab
+0,        200,        200,        1,   393216, 0xf05196a0
+0,        201,        201,        1,   393216, 0x932d1e00
+0,        202,        202,        1,   393216, 0x932d1e00
+0,        203,        203,        1,   393216, 0x932d1e00
+0,        204,        204,        1,   393216, 0x932d1e00
+0,        205,        205,        1,   393216, 0x932d1e00
+0,        206,        206,        1,   393216, 0x932d1e00
+0,        207,        207,        1,   393216, 0x932d1e00
+0,        208,        208,        1,   393216, 0x932d1e00
+0,        209,        209,        1,   393216, 0x932d1e00
diff --git a/tests/ref/fate/real-rv40 b/tests/ref/fate/rv40
similarity index 100%
rename from tests/ref/fate/real-rv40
rename to tests/ref/fate/rv40
diff --git a/tests/ref/fate/thp b/tests/ref/fate/thp
new file mode 100644
index 0000000000000000000000000000000000000000..52dd0590278135152afd2485705bd196ac067213
--- /dev/null
+++ b/tests/ref/fate/thp
@@ -0,0 +1,73 @@
+#tb 0: 524288/15712911
+0,          0,          0,        1,   291840, 0xbd7e0b22
+0,          1,          1,        1,   291840, 0xf6e12ca5
+0,          2,          2,        1,   291840, 0x528c7049
+0,          3,          3,        1,   291840, 0x93055de9
+0,          4,          4,        1,   291840, 0xf95a51c1
+0,          5,          5,        1,   291840, 0x6ad3a65a
+0,          6,          6,        1,   291840, 0x494684a7
+0,          7,          7,        1,   291840, 0x74c14eb1
+0,          8,          8,        1,   291840, 0x149fcb7e
+0,          9,          9,        1,   291840, 0x25649761
+0,         10,         10,        1,   291840, 0xbc3f9052
+0,         11,         11,        1,   291840, 0x080edfff
+0,         12,         12,        1,   291840, 0x6d7ad684
+0,         13,         13,        1,   291840, 0x6d53844d
+0,         14,         14,        1,   291840, 0xf7ad5385
+0,         15,         15,        1,   291840, 0x0241b56a
+0,         16,         16,        1,   291840, 0x120122c8
+0,         17,         17,        1,   291840, 0x31b0f32a
+0,         18,         18,        1,   291840, 0x14068b98
+0,         19,         19,        1,   291840, 0xeeec658b
+0,         20,         20,        1,   291840, 0x9376374c
+0,         21,         21,        1,   291840, 0x091e8c6e
+0,         22,         22,        1,   291840, 0x744ad07f
+0,         23,         23,        1,   291840, 0xf99c554e
+0,         24,         24,        1,   291840, 0xc84bd677
+0,         25,         25,        1,   291840, 0x3898d474
+0,         26,         26,        1,   291840, 0x1e2910c8
+0,         27,         27,        1,   291840, 0xb11f58bc
+0,         28,         28,        1,   291840, 0xf89170ee
+0,         29,         29,        1,   291840, 0x8f239dc3
+0,         30,         30,        1,   291840, 0x8538c76c
+0,         31,         31,        1,   291840, 0x162ee66f
+0,         32,         32,        1,   291840, 0x5f8708a5
+0,         33,         33,        1,   291840, 0x95802dfb
+0,         34,         34,        1,   291840, 0xc424630d
+0,         35,         35,        1,   291840, 0xfb8a8667
+0,         36,         36,        1,   291840, 0xbad79af5
+0,         37,         37,        1,   291840, 0xc733b325
+0,         38,         38,        1,   291840, 0x4bfbcd70
+0,         39,         39,        1,   291840, 0x502cd950
+0,         40,         40,        1,   291840, 0x8461ca2c
+0,         41,         41,        1,   291840, 0x00219b0d
+0,         42,         42,        1,   291840, 0xa4de45e1
+0,         43,         43,        1,   291840, 0xacd3f4df
+0,         44,         44,        1,   291840, 0x2203a369
+0,         45,         45,        1,   291840, 0x0a66effa
+0,         46,         46,        1,   291840, 0x7ac1fd91
+0,         47,         47,        1,   291840, 0x84970aa7
+0,         48,         48,        1,   291840, 0x569d145f
+0,         49,         49,        1,   291840, 0xe51efe1b
+0,         50,         50,        1,   291840, 0x38e2cd78
+0,         51,         51,        1,   291840, 0x93428ea2
+0,         52,         52,        1,   291840, 0x3d3f5b17
+0,         53,         53,        1,   291840, 0x9546127d
+0,         54,         54,        1,   291840, 0x4178be54
+0,         55,         55,        1,   291840, 0x0d0f8036
+0,         56,         56,        1,   291840, 0xc20557b9
+0,         57,         57,        1,   291840, 0x6d4b2d64
+0,         58,         58,        1,   291840, 0xa750125d
+0,         59,         59,        1,   291840, 0x04623ce3
+0,         60,         60,        1,   291840, 0xc7f2bbc7
+0,         61,         61,        1,   291840, 0x6e271336
+0,         62,         62,        1,   291840, 0xcfbd4246
+0,         63,         63,        1,   291840, 0xe1493be9
+0,         64,         64,        1,   291840, 0x6c731194
+0,         65,         65,        1,   291840, 0x0fc30cc2
+0,         66,         66,        1,   291840, 0x967427f3
+0,         67,         67,        1,   291840, 0x55ae3b00
+0,         68,         68,        1,   291840, 0xbe4f200c
+0,         69,         69,        1,   291840, 0xc515e443
+0,         70,         70,        1,   291840, 0xd738bd69
+0,         71,         71,        1,   291840, 0xa8e0ab69