aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-08 01:29:15 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-08 03:34:22 +0100
commit757473831c3e1cc231fb985bcaed622d66fd6b2e (patch)
treed3c83c1e3726c24b91bf9970b06fd1a83921fff0
parenta407baba85c2999707868e975c98b5a9de50f46d (diff)
parentbadb195d139f15dc189dd3f78930c9cbfce89c24 (diff)
downloadffmpeg-757473831c3e1cc231fb985bcaed622d66fd6b2e.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (29 commits) cabac: Move code only used within the CABAC test program into the test program. vp56: Drop unnecessary cabac.h #include. h264-test: Initialize AVCodecContext.av_class. build: Skip compiling network.h and rtsp.h if networking is not enabled. cosmetics: drop some pointless parentheses Disable annoying warning without changing behavior faq: Solutions for common problems with sample paths when running FATE. avcodec: attempt to clarify the CODEC_CAP_DELAY documentation avcodec: fix avcodec_encode_audio() documentation. FATE: xmv-demux test; exercise the XMV demuxer without decoding the perceptual codecs inside. vqf: recognize more metadata chunks FATE test: BMV demuxer and associated video and audio decoders. FATE: indeo4 video decoder test. FATE: update xxan-wc4 test to a sample with more code coverage. Change the recent h264_mp4toannexb bitstream filter test to output to an elementary stream rather than a program stream. g722enc: validate AVCodecContext.trellis g722enc: set frame_size, and also handle an odd number of input samples g722enc: split encoding into separate functions for trellis vs. no trellis mpegaudiodec: Use clearer pointer math tta: Fix returned error code at EOF ... Conflicts: libavcodec/h264.c libavcodec/indeo3.c libavcodec/interplayvideo.c libavcodec/ivi_common.c libavcodec/libxvidff.c libavcodec/mpegvideo.c libavcodec/ppc/mpegvideo_altivec.c libavcodec/tta.c libavcodec/utils.c libavfilter/vsrc_buffer.c libavformat/Makefile tests/fate/indeo.mak tests/ref/acodec/g722 Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/faq.texi12
-rw-r--r--libavcodec/ac3dec.c4
-rw-r--r--libavcodec/avcodec.h31
-rw-r--r--libavcodec/cabac.c25
-rw-r--r--libavcodec/cabac.h25
-rw-r--r--libavcodec/cavs.c4
-rw-r--r--libavcodec/cavsdec.c2
-rw-r--r--libavcodec/error_resilience.c8
-rw-r--r--libavcodec/g722enc.c103
-rw-r--r--libavcodec/h264.c1
-rw-r--r--libavcodec/indeo3.c24
-rw-r--r--libavcodec/interplayvideo.c9
-rw-r--r--libavcodec/ivi_common.c2
-rw-r--r--libavcodec/libdiracenc.c6
-rw-r--r--libavcodec/libschroedingerenc.c2
-rw-r--r--libavcodec/libxvidff.c6
-rw-r--r--libavcodec/mpeg12.c2
-rw-r--r--libavcodec/mpegvideo.c12
-rw-r--r--libavcodec/ppc/mpegvideo_altivec.c10
-rw-r--r--libavcodec/pthread.c2
-rw-r--r--libavcodec/tscc.c10
-rw-r--r--libavcodec/tta.c6
-rw-r--r--libavcodec/utils.c84
-rw-r--r--libavcodec/vc1dec.c2
-rw-r--r--libavcodec/vorbisdec.c7
-rw-r--r--libavcodec/vp56.h1
-rw-r--r--libavcodec/zmbv.c6
-rw-r--r--libavcodec/zmbvenc.c6
-rw-r--r--libavdevice/bktr.c2
-rw-r--r--libavdevice/timefilter.c2
-rw-r--r--libavfilter/vsrc_buffer.c2
-rw-r--r--libavformat/Makefile2
-rw-r--r--libavformat/aviobuf.c2
-rw-r--r--libavformat/electronicarts.c9
-rw-r--r--libavformat/ipmovie.c18
-rw-r--r--libavformat/mtv.c2
-rw-r--r--libavformat/rmdec.c2
-rw-r--r--libavformat/vqf.c80
-rw-r--r--tests/fate/demux.mak6
-rw-r--r--tests/fate/h264.mak2
-rw-r--r--tests/fate/indeo.mak3
-rw-r--r--tests/fate/video.mak4
-rw-r--r--tests/ref/acodec/g7228
-rw-r--r--tests/ref/fate/bmv42
-rw-r--r--tests/ref/fate/h264-bsf-mp4toannexb2
-rw-r--r--tests/ref/fate/indeo4100
-rw-r--r--tests/ref/fate/xmv-demux181
-rw-r--r--tests/ref/fate/xxan-wc431
48 files changed, 693 insertions, 219 deletions
diff --git a/doc/faq.texi b/doc/faq.texi
index fb180fbbf1..bd88da3568 100644
--- a/doc/faq.texi
+++ b/doc/faq.texi
@@ -397,4 +397,16 @@ wrong if it is larger than the average!
For example, if you have mixed 25 and 30 fps content, then r_frame_rate
will be 150.
+@section Why is @code{make fate} not running all tests?
+
+Make sure you have the fate-suite samples and the @code{SAMPLES} Make variable
+or @code{FATE_SAMPLES} environment variable or the @code{--samples}
+@command{configure} option is set to the right path.
+
+@section Why is @code{make fate} not finding the samples?
+
+Do you happen to have a @code{~} character in the samples path to indicate a
+home directory? The value is used in ways where the shell cannot expand it,
+causing FATE to not find files. Just replace @code{~} by the full path.
+
@bye
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 0cb7c67a1f..325d23bb3d 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -223,7 +223,7 @@ static int ac3_parse_header(AC3DecodeContext *s)
int i;
/* read the rest of the bsi. read twice for dual mono mode. */
- i = !(s->channel_mode);
+ i = !s->channel_mode;
do {
skip_bits(gbc, 5); // skip dialog normalization
if (get_bits1(gbc))
@@ -792,7 +792,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
}
/* dynamic range */
- i = !(s->channel_mode);
+ i = !s->channel_mode;
do {
if (get_bits1(gbc)) {
s->dynamic_range[i] = ((dynamic_range_tab[get_bits(gbc, 8)] - 1.0) *
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 2b7ac65c13..69e541a8f0 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -745,10 +745,22 @@ typedef struct RcOverride{
/* Codec can export data for HW decoding (XvMC). */
#define CODEC_CAP_HWACCEL 0x0010
/**
- * Codec has a nonzero delay and needs to be fed with avpkt->data=NULL,
+ * Encoder or decoder requires flushing with NULL input at the end in order to
+ * give the complete and correct output.
+ *
+ * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
+ * with NULL data. The user can still send NULL data to the public encode
+ * or decode function, but libavcodec will not pass it along to the codec
+ * unless this flag is set.
+ *
+ * Decoders:
+ * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
* avpkt->size=0 at the end to get the delayed data until the decoder no longer
- * returns frames. If this is not set, the codec is guaranteed to never be fed
- * with NULL data.
+ * returns frames.
+ *
+ * Encoders:
+ * The encoder needs to be fed with NULL data at the end of encoding until the
+ * encoder no longer returns data.
*/
#define CODEC_CAP_DELAY 0x0020
/**
@@ -4318,9 +4330,9 @@ void avsubtitle_free(AVSubtitle *sub);
* Encode an audio frame from samples into buf.
*
* @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
- * However, for PCM audio the user will know how much space is needed
- * because it depends on the value passed in buf_size as described
- * below. In that case a lower value can be used.
+ * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user
+ * will know how much space is needed because it depends on the value passed
+ * in buf_size as described below. In that case a lower value can be used.
*
* @param avctx the codec context
* @param[out] buf the output buffer
@@ -4328,8 +4340,11 @@ void avsubtitle_free(AVSubtitle *sub);
* @param[in] samples the input buffer containing the samples
* The number of samples read from this buffer is frame_size*channels,
* both of which are defined in avctx.
- * For PCM audio the number of samples read from samples is equal to
- * buf_size * input_sample_size / output_sample_size.
+ * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of
+ * samples read from samples is equal to:
+ * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id))
+ * This also implies that av_get_bits_per_sample() must not return 0 for these
+ * codecs.
* @return On error a negative value is returned, on success zero or the number
* of bytes used to encode the data read from the input buffer.
*/
diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
index c603dafddd..983614581d 100644
--- a/libavcodec/cabac.c
+++ b/libavcodec/cabac.c
@@ -166,6 +166,31 @@ void ff_init_cabac_states(CABACContext *c){
#include "avcodec.h"
#include "cabac.h"
+static inline void put_cabac_bit(CABACContext *c, int b){
+ put_bits(&c->pb, 1, b);
+ for(;c->outstanding_count; c->outstanding_count--){
+ put_bits(&c->pb, 1, 1-b);
+ }
+}
+
+static inline void renorm_cabac_encoder(CABACContext *c){
+ while(c->range < 0x100){
+ //FIXME optimize
+ if(c->low<0x100){
+ put_cabac_bit(c, 0);
+ }else if(c->low<0x200){
+ c->outstanding_count++;
+ c->low -= 0x100;
+ }else{
+ put_cabac_bit(c, 1);
+ c->low -= 0x200;
+ }
+
+ c->range+= c->range;
+ c->low += c->low;
+ }
+}
+
static void put_cabac(CABACContext *c, uint8_t * const state, int bit){
int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + *state];
diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h
index 0ee8e315f4..8065ae0f45 100644
--- a/libavcodec/cabac.h
+++ b/libavcodec/cabac.h
@@ -62,31 +62,6 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
void ff_init_cabac_states(CABACContext *c);
-static inline void put_cabac_bit(CABACContext *c, int b){
- put_bits(&c->pb, 1, b);
- for(;c->outstanding_count; c->outstanding_count--){
- put_bits(&c->pb, 1, 1-b);
- }
-}
-
-static inline void renorm_cabac_encoder(CABACContext *c){
- while(c->range < 0x100){
- //FIXME optimize
- if(c->low<0x100){
- put_cabac_bit(c, 0);
- }else if(c->low<0x200){
- c->outstanding_count++;
- c->low -= 0x100;
- }else{
- put_cabac_bit(c, 1);
- c->low -= 0x200;
- }
-
- c->range+= c->range;
- c->low += c->low;
- }
-}
-
static void refill(CABACContext *c){
#if CABAC_BITS == 16
c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index 47fc5a5da8..adaf797cde 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -658,8 +658,8 @@ void ff_cavs_init_top_lines(AVSContext *h) {
h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector));
h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y));
h->top_border_y = av_malloc((h->mb_width+1)*16);
- h->top_border_u = av_malloc((h->mb_width)*10);
- h->top_border_v = av_malloc((h->mb_width)*10);
+ h->top_border_u = av_malloc( h->mb_width * 10);
+ h->top_border_v = av_malloc( h->mb_width * 10);
/* alloc space for co-located MVs and types */
h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(cavs_vector));
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 2bf968ba22..16e5474d84 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -491,7 +491,7 @@ static int decode_pic(AVSContext *h) {
skip_bits(&s->gb,24);//time_code
/* old sample clips were all progressive and no low_delay,
bump stream revision if detected otherwise */
- if((s->low_delay) || !(show_bits(&s->gb,9) & 1))
+ if (s->low_delay || !(show_bits(&s->gb,9) & 1))
h->stream_revision = 1;
/* similarly test top_field_first and repeat_first_field */
else if(show_bits(&s->gb,11) & 3)
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 638215f7d8..d296a78148 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -109,8 +109,8 @@ static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t
for(y=0; y<8; y++){
int x;
for(x=0; x<8; x++){
- dest_cb[x + y*(s->uvlinesize)]= dcu/8;
- dest_cr[x + y*(s->uvlinesize)]= dcv/8;
+ dest_cb[x + y * s->uvlinesize] = dcu / 8;
+ dest_cr[x + y * s->uvlinesize] = dcv / 8;
}
}
}
@@ -1120,8 +1120,8 @@ void ff_er_frame_end(MpegEncContext *s){
for(y=0; y<8; y++){
int x;
for(x=0; x<8; x++){
- dcu+=dest_cb[x + y*(s->uvlinesize)];
- dcv+=dest_cr[x + y*(s->uvlinesize)];
+ dcu += dest_cb[x + y * s->uvlinesize];
+ dcv += dest_cr[x + y * s->uvlinesize];
}
}
s->dc_val[1][mb_x + mb_y*s->mb_stride]= (dcu+4)>>3;
diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c
index 1eed784a72..1cb0070649 100644
--- a/libavcodec/g722enc.c
+++ b/libavcodec/g722enc.c
@@ -32,6 +32,15 @@
#define FREEZE_INTERVAL 128
+/* This is an arbitrary value. Allowing insanely large values leads to strange
+ problems, so we limit it to a reasonable value */
+#define MAX_FRAME_SIZE 32768
+
+/* We clip the value of avctx->trellis to prevent data type overflows and
+ undefined behavior. Using larger values is insanely slow anyway. */
+#define MIN_TRELLIS 0
+#define MAX_TRELLIS 16
+
static av_cold int g722_encode_init(AVCodecContext * avctx)
{
G722Context *c = avctx->priv_data;
@@ -56,6 +65,40 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
}
}
+ if (avctx->frame_size) {
+ /* validate frame size */
+ if (avctx->frame_size & 1 || avctx->frame_size > MAX_FRAME_SIZE) {
+ int new_frame_size;
+
+ if (avctx->frame_size == 1)
+ new_frame_size = 2;
+ else if (avctx->frame_size > MAX_FRAME_SIZE)
+ new_frame_size = MAX_FRAME_SIZE;
+ else
+ new_frame_size = avctx->frame_size - 1;
+
+ av_log(avctx, AV_LOG_WARNING, "Requested frame size is not "
+ "allowed. Using %d instead of %d\n", new_frame_size,
+ avctx->frame_size);
+ avctx->frame_size = new_frame_size;
+ }
+ } else {
+ /* This is arbitrary. We use 320 because it's 20ms @ 16kHz, which is
+ a common packet size for VoIP applications */
+ avctx->frame_size = 320;
+ }
+
+ if (avctx->trellis) {
+ /* validate trellis */
+ if (avctx->trellis < MIN_TRELLIS || avctx->trellis > MAX_TRELLIS) {
+ int new_trellis = av_clip(avctx->trellis, MIN_TRELLIS, MAX_TRELLIS);
+ av_log(avctx, AV_LOG_WARNING, "Requested trellis value is not "
+ "allowed. Using %d instead of %d\n", new_trellis,
+ avctx->trellis);
+ avctx->trellis = new_trellis;
+ }
+ }
+
return 0;
}
@@ -117,13 +160,12 @@ static inline int encode_low(const struct G722Band* state, int xlow)
return (diff < 0 ? (i < 2 ? 63 : 33) : 61) - i;
}
-static int g722_encode_trellis(AVCodecContext *avctx,
- uint8_t *dst, int buf_size, void *data)
+static void g722_encode_trellis(G722Context *c, int trellis,
+ uint8_t *dst, int nb_samples,
+ const int16_t *samples)
{
- G722Context *c = avctx->priv_data;
- const int16_t *samples = data;
int i, j, k;
- int frontier = 1 << avctx->trellis;
+ int frontier = 1 << trellis;
struct TrellisNode **nodes[2];
struct TrellisNode **nodes_next[2];
int pathn[2] = {0, 0}, froze = -1;
@@ -139,7 +181,7 @@ static int g722_encode_trellis(AVCodecContext *avctx,
nodes[i][0]->state = c->band[i];
}
- for (i = 0; i < buf_size; i++) {
+ for (i = 0; i < nb_samples >> 1; i++) {
int xlow, xhigh;
struct TrellisNode *next[2];
int heap_pos[2] = {0, 0};
@@ -271,8 +313,28 @@ static int g722_encode_trellis(AVCodecContext *avctx,
}
c->band[0] = nodes[0][0]->state;
c->band[1] = nodes[1][0]->state;
+}
+
+static av_always_inline void encode_byte(G722Context *c, uint8_t *dst,
+ const int16_t *samples)
+{
+ int xlow, xhigh, ilow, ihigh;
+ filter_samples(c, samples, &xlow, &xhigh);
+ ihigh = encode_high(&c->band[1], xhigh);
+ ilow = encode_low (&c->band[0], xlow);
+ ff_g722_update_high_predictor(&c->band[1], c->band[1].scale_factor *
+ ff_g722_high_inv_quant[ihigh] >> 10, ihigh);
+ ff_g722_update_low_predictor(&c->band[0], ilow >> 2);
+ *dst = ihigh << 6 | ilow;
+}
- return i;
+static void g722_encode_no_trellis(G722Context *c,
+ uint8_t *dst, int nb_samples,
+ const int16_t *samples)
+{
+ int i;
+ for (i = 0; i < nb_samples; i += 2)
+ encode_byte(c, dst++, &samples[i]);
}
static int g722_encode_frame(AVCodecContext *avctx,
@@ -280,22 +342,22 @@ static int g722_encode_frame(AVCodecContext *avctx,
{
G722Context *c = avctx->priv_data;
const int16_t *samples = data;
- int i;
+ int nb_samples;
- if (avctx->trellis)
- return g722_encode_trellis(avctx, dst, buf_size, data);
+ nb_samples = avctx->frame_size - (avctx->frame_size & 1);
- for (i = 0; i < buf_size; i++) {
- int xlow, xhigh, ihigh, ilow;
- filter_samples(c, &samples[2*i], &xlow, &xhigh);
- ihigh = encode_high(&c->band[1], xhigh);
- ilow = encode_low(&c->band[0], xlow);
- ff_g722_update_high_predictor(&c->band[1], c->band[1].scale_factor *
- ff_g722_high_inv_quant[ihigh] >> 10, ihigh);
- ff_g722_update_low_predictor(&c->band[0], ilow >> 2);
- *dst++ = ihigh << 6 | ilow;
+ if (avctx->trellis)
+ g722_encode_trellis(c, avctx->trellis, dst, nb_samples, samples);
+ else
+ g722_encode_no_trellis(c, dst, nb_samples, samples);
+
+ /* handle last frame with odd frame_size */
+ if (nb_samples < avctx->frame_size) {
+ int16_t last_samples[2] = { samples[nb_samples], samples[nb_samples] };
+ encode_byte(c, &dst[nb_samples >> 1], last_samples);
}
- return i;
+
+ return (avctx->frame_size + 1) >> 1;
}
AVCodec ff_adpcm_g722_encoder = {
@@ -306,6 +368,7 @@ AVCodec ff_adpcm_g722_encoder = {
.init = g722_encode_init,
.close = g722_encode_close,
.encode = g722_encode_frame,
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
.long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"),
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
};
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index e4d6ee10a9..98eac17f66 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -4170,7 +4170,6 @@ int main(void){
uint8_t temp[SIZE];
PutBitContext pb;
GetBitContext gb;
-// int int_temp[10000];
DSPContext dsp;
AVCodecContext avctx;
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index 83c97bb96d..ce84d72f8b 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -89,6 +89,7 @@ typedef struct Indeo3DecodeContext {
const uint8_t *next_cell_data;
const uint8_t *last_byte;
const int8_t *mc_vectors;
+ unsigned num_vectors; ///< number of motion vectors in mc_vectors
int16_t width, height;
uint32_t frame_num; ///< current frame number (zero-based)
@@ -767,11 +768,17 @@ static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
break;
case INTER_DATA:
if (!curr_cell.tree) { /* MC tree INTER code */
+ unsigned mv_idx;
/* get motion vector index and setup the pointer to the mv set */
if (!ctx->need_resync)
ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3];
if(ctx->mc_vectors)
- curr_cell.mv_ptr = &ctx->mc_vectors[*(ctx->next_cell_data++) << 1];
+ mv_idx = *(ctx->next_cell_data++) << 1;
+ if (mv_idx >= ctx->num_vectors) {
+ av_log(avctx, AV_LOG_ERROR, "motion vector index out of range\n");
+ return AVERROR_INVALIDDATA;
+ }
+ curr_cell.mv_ptr = &ctx->mc_vectors[mv_idx];
curr_cell.tree = 1; /* enter the VQ tree */
UPDATE_BITPOS(8);
} else { /* VQ tree DATA code */
@@ -801,19 +808,24 @@ static int decode_plane(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
int32_t strip_width)
{
Cell curr_cell;
- uint32_t num_vectors;
+ unsigned num_vectors;
/* each plane data starts with mc_vector_count field, */
/* an optional array of motion vectors followed by the vq data */
num_vectors = bytestream_get_le32(&data);
- if(num_vectors >= data_size/2)
+ if (num_vectors > 256) {
+ av_log(ctx->avctx, AV_LOG_ERROR,
+ "Read invalid number of motion vectors %d\n", num_vectors);
return AVERROR_INVALIDDATA;
+ }
+ if (num_vectors * 2 >= data_size)
+ return AVERROR_INVALIDDATA;
+
+ ctx->num_vectors = num_vectors;
ctx->mc_vectors = num_vectors ? data : 0;
- data += num_vectors * 2;
- data_size-= num_vectors * 2;
/* init the bitreader */
- init_get_bits(&ctx->gb, data, data_size << 3);
+ init_get_bits(&ctx->gb, &data[num_vectors * 2], (data_size - num_vectors * 2) << 3);
ctx->skip_bits = 0;
ctx->need_resync = 0;
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index d27c9ba9c7..68aa966208 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -1019,12 +1019,10 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
dsputil_init(&s->dsp, avctx);
- /* decoding map contains 4 bits of information per 8x8 block */
- s->decoding_map_size = avctx->width * avctx->height / (8 * 8 * 2);
-
avcodec_get_frame_defaults(&s->second_last_frame);
avcodec_get_frame_defaults(&s->last_frame);
avcodec_get_frame_defaults(&s->current_frame);
+
s->current_frame.data[0] = s->last_frame.data[0] =
s->second_last_frame.data[0] = NULL;
@@ -1039,6 +1037,9 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
int buf_size = avpkt->size;
IpvideoContext *s = avctx->priv_data;
+ /* decoding map contains 4 bits of information per 8x8 block */
+ s->decoding_map_size = avctx->width * avctx->height / (8 * 8 * 2);
+
/* compressed buffer needs to be large enough to at least hold an entire
* decoding map */
if (buf_size < s->decoding_map_size)
@@ -1099,6 +1100,6 @@ AVCodec ff_interplay_video_decoder = {
.init = ipvideo_decode_init,
.close = ipvideo_decode_end,
.decode = ipvideo_decode_frame,
- .capabilities = CODEC_CAP_DR1,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_PARAM_CHANGE,
.long_name = NULL_IF_CONFIG_SMALL("Interplay MVE video"),
};
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c
index f917b3a826..c75769ec31 100644
--- a/libavcodec/ivi_common.c
+++ b/libavcodec/ivi_common.c
@@ -613,7 +613,7 @@ void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch)
const int16_t *src = plane->bands[0].buf;
uint32_t pitch = plane->bands[0].pitch;
- if(!src)
+ if (!src)
return;
for (y = 0; y < plane->height; y++) {
diff --git a/libavcodec/libdiracenc.c b/libavcodec/libdiracenc.c
index cd0b131745..385bce9018 100644
--- a/libavcodec/libdiracenc.c
+++ b/libavcodec/libdiracenc.c
@@ -136,7 +136,7 @@ static av_cold int libdirac_encode_init(AVCodecContext *avccontext)
preset = GetDiracVideoFormatPreset(avccontext);
/* initialize the encoder context */
- dirac_encoder_context_init(&(p_dirac_params->enc_ctx), preset);
+ dirac_encoder_context_init(&p_dirac_params->enc_ctx, preset);
p_dirac_params->enc_ctx.src_params.chroma = GetDiracChromaFormat(avccontext->pix_fmt);
@@ -199,7 +199,7 @@ static av_cold int libdirac_encode_init(AVCodecContext *avccontext)
* irrespective of the type of source material */
p_dirac_params->enc_ctx.enc_params.picture_coding_mode = 1;
- p_dirac_params->p_encoder = dirac_encoder_init(&(p_dirac_params->enc_ctx),
+ p_dirac_params->p_encoder = dirac_encoder_init(&p_dirac_params->enc_ctx,
verbose);
if (!p_dirac_params->p_encoder) {
@@ -221,7 +221,7 @@ static void DiracFreeFrame(void *data)
{
DiracSchroEncodedFrame *enc_frame = data;
- av_freep(&(enc_frame->p_encbuf));
+ av_freep(&enc_frame->p_encbuf);
av_free(enc_frame);
}
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c
index 96a9812233..27267cd0e9 100644
--- a/libavcodec/libschroedingerenc.c
+++ b/libavcodec/libschroedingerenc.c
@@ -258,7 +258,7 @@ static void SchroedingerFreeFrame(void *data)
{
DiracSchroEncodedFrame *enc_frame = data;
- av_freep(&(enc_frame->p_encbuf));
+ av_freep(&enc_frame->p_encbuf);
av_free(enc_frame);
}
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
index f7aa7fd44e..1501b44135 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvidff.c
@@ -232,7 +232,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
rc2pass2.version = XVID_VERSION;
rc2pass2.bitrate = avctx->bit_rate;
- fd = av_tempfile("xvidff.", &(x->twopassfile), 0, avctx);
+ fd = av_tempfile("xvidff.", &x->twopassfile, 0, avctx);
if( fd == -1 ) {
av_log(avctx, AV_LOG_ERROR,
"Xvid: Cannot write 2-pass pipe\n");
@@ -376,7 +376,7 @@ static int xvid_encode_frame(AVCodecContext *avctx,
char *tmp;
struct xvid_context *x = avctx->priv_data;
AVFrame *picture = data;
- AVFrame *p = &(x->encoded_picture);
+ AVFrame *p = &x->encoded_picture;
xvid_enc_frame_t xvid_enc_frame;
xvid_enc_stats_t xvid_enc_stats;
@@ -538,7 +538,7 @@ int xvid_strip_vol_header(AVCodecContext *avctx,
}
/* Less dangerous now, memmove properly copies the two
chunks of overlapping data */
- memmove(frame, &(frame[vo_len]), frame_len - vo_len);
+ memmove(frame, &frame[vo_len], frame_len - vo_len);
return frame_len - vo_len;
} else
return frame_len;
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index fcbea5429d..2677713cce 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1273,7 +1273,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
/* low_delay may be forced, in this case we will have B-frames
* that behave like P-frames. */
- avctx->has_b_frames = !(s->low_delay);
+ avctx->has_b_frames = !s->low_delay;
assert((avctx->sub_id == 1) == (avctx->codec_id == CODEC_ID_MPEG1VIDEO));
if (avctx->codec_id == CODEC_ID_MPEG1VIDEO) {
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 90eb737ec7..490a7cc751 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -704,9 +704,9 @@ av_cold int MPV_common_init(MpegEncContext *s)
mb_array_size = s->mb_height * s->mb_stride;
mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
- /* set chroma shifts */
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift),
- &(s->chroma_y_shift) );
+ /* set chroma shifts */
+ avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift,
+ &s->chroma_y_shift);
/* set default edge pos, will be overriden in decode_header if needed */
s->h_edge_pos = s->mb_width * 16;
@@ -2318,7 +2318,7 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
}
dct_linesize = linesize << s->interlaced_dct;
- dct_offset =(s->interlaced_dct)? linesize : linesize*block_size;
+ dct_offset = s->interlaced_dct ? linesize : linesize * block_size;
if(readable){
dest_y= s->dest[0];
@@ -2414,7 +2414,7 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
}else{
//chroma422
dct_linesize = uvlinesize << s->interlaced_dct;
- dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*block_size;
+ dct_offset = s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
add_dct(s, block[4], 4, dest_cb, dct_linesize);
add_dct(s, block[5], 5, dest_cr, dct_linesize);
@@ -2466,7 +2466,7 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
}else{
dct_linesize = uvlinesize << s->interlaced_dct;
- dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*block_size;
+ dct_offset = s->interlaced_dct? uvlinesize : uvlinesize*block_size;
s->dsp.idct_put(dest_cb, dct_linesize, block[4]);
s->dsp.idct_put(dest_cr, dct_linesize, block[5]);
diff --git a/libavcodec/ppc/mpegvideo_altivec.c b/libavcodec/ppc/mpegvideo_altivec.c
index 0ba532ec26..297e7fefce 100644
--- a/libavcodec/ppc/mpegvideo_altivec.c
+++ b/libavcodec/ppc/mpegvideo_altivec.c
@@ -269,14 +269,14 @@ static int dct_quantize_altivec(MpegEncContext* s,
if(n<4){
qmat = (vector signed int*)s->q_intra_matrix[qscale];
- biasAddr = &(s->intra_quant_bias);
+ biasAddr = &s->intra_quant_bias;
}else{
qmat = (vector signed int*)s->q_chroma_intra_matrix[qscale];
- biasAddr = &(s->intra_quant_bias);
+ biasAddr = &s->intra_quant_bias;
}
} else {
qmat = (vector signed int*)s->q_inter_matrix[qscale];
- biasAddr = &(s->inter_quant_bias);
+ biasAddr = &s->inter_quant_bias;
}
// Load the bias vector (We add 0.5 to the bias so that we're
@@ -366,8 +366,8 @@ static int dct_quantize_altivec(MpegEncContext* s,
vector signed int max_q_int, min_q_int;
vector signed short max_q, min_q;
- LOAD4(max_q_int, &(s->max_qcoeff));
- LOAD4(min_q_int, &(s->min_qcoeff));
+ LOAD4(max_q_int, &s->max_qcoeff);
+ LOAD4(min_q_int, &s->min_qcoeff);
max_q = vec_pack(max_q_int, max_q_int);
min_q = vec_pack(min_q_int, min_q_int);
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index d545f140ac..fe3dbdad5a 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -845,7 +845,7 @@ static int frame_thread_init(AVCodecContext *avctx)
err = AVERROR(ENOMEM);
goto error;
}
- *(copy->internal) = *(src->internal);
+ *copy->internal = *src->internal;
copy->internal->is_copy = 1;
if (codec->init_thread_copy)
diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
index 16b987e7c7..c07f3a87f7 100644
--- a/libavcodec/tscc.c
+++ b/libavcodec/tscc.c
@@ -88,7 +88,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
return -1;
}
- zret = inflateReset(&(c->zstream));
+ zret = inflateReset(&c->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
return -1;
@@ -97,7 +97,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
c->zstream.avail_in = len;
c->zstream.next_out = c->decomp_buf;
c->zstream.avail_out = c->decomp_size;
- zret = inflate(&(c->zstream), Z_FINISH);
+ zret = inflate(&c->zstream, Z_FINISH);
// Z_DATA_ERROR means empty picture
if ((zret != Z_OK) && (zret != Z_STREAM_END) && (zret != Z_DATA_ERROR)) {
av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
@@ -144,7 +144,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
avcodec_get_frame_defaults(&c->pic);
// Needed if zlib unused or init aborted before inflateInit
- memset(&(c->zstream), 0, sizeof(z_stream));
+ memset(&c->zstream, 0, sizeof(z_stream));
switch(avctx->bits_per_coded_sample){
case 8: avctx->pix_fmt = PIX_FMT_PAL8; break;
case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
@@ -170,7 +170,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->zstream.zalloc = Z_NULL;
c->zstream.zfree = Z_NULL;
c->zstream.opaque = Z_NULL;
- zret = inflateInit(&(c->zstream));
+ zret = inflateInit(&c->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
return 1;
@@ -194,7 +194,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
- inflateEnd(&(c->zstream));
+ inflateEnd(&c->zstream);
return 0;
}
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index a388cfde96..857b895e7a 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -324,6 +324,10 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
return ret;
}
+ // decode directly to output buffer for 24-bit sample format
+ if (s->bps == 3)
+ s->decode_buffer = s->frame.data[0];
+
// init per channel states
for (i = 0; i < s->channels; i++) {
s->ch_ctx[i].predictor = 0;
@@ -429,7 +433,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
// shift samples for 24-bit sample format
int32_t *samples = (int32_t *)s->frame.data[0];
for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++)
- *samples++ = *p<<8;
+ *samples++ <<= 8;
// reset decode buffer
s->decode_buffer = NULL;
break;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 619b70f3fb..b79e23e1c1 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -935,6 +935,48 @@ static int64_t guess_correct_pts(AVCodecContext *ctx,
return pts;
}
+static void apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
+{
+ int size = 0;
+ const uint8_t *data;
+ uint32_t flags;
+
+ if (!(avctx->codec->capabilities & CODEC_CAP_PARAM_CHANGE))
+ return;
+
+ data = av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, &size);
+ if (!data || size < 4)
+ return;
+ flags = bytestream_get_le32(&data);
+ size -= 4;
+ if (size < 4) /* Required for any of the changes */
+ return;
+ if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
+ avctx->channels = bytestream_get_le32(&data);
+ size -= 4;
+ }
+ if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
+ if (size < 8)
+ return;
+ avctx->channel_layout = bytestream_get_le64(&data);
+ size -= 8;
+ }
+ if (size < 4)
+ return;
+ if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
+ avctx->sample_rate = bytestream_get_le32(&data);
+ size -= 4;
+ }
+ if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
+ if (size < 8)
+ return;
+ avctx->width = bytestream_get_le32(&data);
+ avctx->height = bytestream_get_le32(&data);
+ avcodec_set_dimensions(avctx, avctx->width, avctx->height);
+ size -= 8;
+ }
+}
+
int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr,
AVPacket *avpkt)
@@ -947,6 +989,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){
av_packet_split_side_data(avpkt);
+ apply_param_change(avctx, avpkt);
avctx->pkt = avpkt;
if (HAVE_THREADS && avctx->active_thread_type&FF_THREAD_FRAME)
ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
@@ -1031,47 +1074,6 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
}
#endif
-static void apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
-{
- int size = 0;
- const uint8_t *data;
- uint32_t flags;
-
- if (!(avctx->codec->capabilities & CODEC_CAP_PARAM_CHANGE))
- return;
-
- data = av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, &size);
- if (!data || size < 4)
- return;
- flags = bytestream_get_le32(&data);
- size -= 4;
- if (size < 4) /* Required for any of the changes */
- return;
- if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
- avctx->channels = bytestream_get_le32(&data);
- size -= 4;
- }
- if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
- if (size < 8)
- return;
- avctx->channel_layout = bytestream_get_le64(&data);
- size -= 8;
- }
- if (size < 4)
- return;
- if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
- avctx->sample_rate = bytestream_get_le32(&data);
- size -= 4;
- }
- if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
- if (size < 8)
- return;
- avctx->width = bytestream_get_le32(&data);
- avctx->height = bytestream_get_le32(&data);
- size -= 8;
- }
-}
-
int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
AVFrame *frame,
int *got_frame_ptr,
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 1469d815ce..109c009338 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5342,7 +5342,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
if (v->profile == PROFILE_ADVANCED)
avctx->level = v->level;
- avctx->has_b_frames = !!(avctx->max_b_frames);
+ avctx->has_b_frames = !!avctx->max_b_frames;
s->mb_width = (avctx->coded_width + 15) >> 4;
s->mb_height = (avctx->coded_height + 15) >> 4;
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 1bd7a0ba12..6bf785ec25 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -820,8 +820,7 @@ static void create_map(vorbis_context *vc, unsigned floor_number)
for (idx = 0; idx < n; ++idx) {
map[idx] = floor(BARK((vf->rate * idx) / (2.0f * n)) *
- ((vf->bark_map_size) /
- BARK(vf->rate / 2.0f)));
+ (vf->bark_map_size / BARK(vf->rate / 2.0f)));
if (vf->bark_map_size-1 < map[idx])
map[idx] = vf->bark_map_size - 1;
}
@@ -979,7 +978,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
int headers_len = avccontext->extradata_size;
uint8_t *header_start[3];
int header_len[3];
- GetBitContext *gb = &(vc->gb);
+ GetBitContext *gb = &vc->gb;
int hdr_type, ret;
vc->avccontext = avccontext;
@@ -1642,7 +1641,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
vorbis_context *vc = avccontext->priv_data;
- GetBitContext *gb = &(vc->gb);
+ GetBitContext *gb = &vc->gb;
const float *channel_ptrs[255];
int i, len, ret;
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index b16a00054b..e135718d20 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -30,7 +30,6 @@
#include "dsputil.h"
#include "get_bits.h"
#include "bytestream.h"
-#include "cabac.h"
#include "vp56dsp.h"
typedef struct vp56_context VP56Context;
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 6f89c7e3ad..a68e42d789 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -618,7 +618,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->bpp = avctx->bits_per_coded_sample;
// Needed if zlib unused or init aborted before inflateInit
- memset(&(c->zstream), 0, sizeof(z_stream));
+ memset(&c->zstream, 0, sizeof(z_stream));
avctx->pix_fmt = PIX_FMT_RGB24;
c->decomp_size = (avctx->width + 255) * 4 * (avctx->height + 64);
@@ -635,7 +635,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->zstream.zalloc = Z_NULL;
c->zstream.zfree = Z_NULL;
c->zstream.opaque = Z_NULL;
- zret = inflateInit(&(c->zstream));
+ zret = inflateInit(&c->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
return 1;
@@ -659,7 +659,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
- inflateEnd(&(c->zstream));
+ inflateEnd(&c->zstream);
av_freep(&c->cur);
av_freep(&c->prev);
diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
index ce65ce4dc0..4b51fb167d 100644
--- a/libavcodec/zmbvenc.c
+++ b/libavcodec/zmbvenc.c
@@ -269,7 +269,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
}
// Needed if zlib unused or init aborted before deflateInit
- memset(&(c->zstream), 0, sizeof(z_stream));
+ memset(&c->zstream, 0, sizeof(z_stream));
c->comp_size = avctx->width * avctx->height + 1024 +
((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
if ((c->work_buf = av_malloc(c->comp_size)) == NULL) {
@@ -294,7 +294,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
c->zstream.zalloc = Z_NULL;
c->zstream.zfree = Z_NULL;
c->zstream.opaque = Z_NULL;
- zret = deflateInit(&(c->zstream), lvl);
+ zret = deflateInit(&c->zstream, lvl);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
return -1;
@@ -317,7 +317,7 @@ static av_cold int encode_end(AVCodecContext *avctx)
av_freep(&c->comp_buf);
av_freep(&c->work_buf);
- deflateEnd(&(c->zstream));
+ deflateEnd(&c->zstream);
av_freep(&c->prev);
return 0;
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 6e3970128f..63f7ee3f4a 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -292,7 +292,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
if (bktr_init(s1->filename, width, height, s->standard,
- &(s->video_fd), &(s->tuner_fd), -1, 0.0) < 0) {
+ &s->video_fd, &s->tuner_fd, -1, 0.0) < 0) {
ret = AVERROR(EIO);
goto out;
}
diff --git a/libavdevice/timefilter.c b/libavdevice/timefilter.c
index 3c67a59881..d0f49260db 100644
--- a/libavdevice/timefilter.c
+++ b/libavdevice/timefilter.c
@@ -69,7 +69,7 @@ double ff_timefilter_update(TimeFilter *self, double system_time, double period)
loop_error = system_time - self->cycle_time;
/// update loop
- self->cycle_time += FFMAX(self->feedback2_factor, 1.0/(self->count)) * loop_error;
+ self->cycle_time += FFMAX(self->feedback2_factor, 1.0 / self->count) * loop_error;
self->clock_period += self->feedback3_factor * loop_error / period;
}
return self->cycle_time;
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
index 6f44368a32..b43de067b4 100644
--- a/libavfilter/vsrc_buffer.c
+++ b/libavfilter/vsrc_buffer.c
@@ -217,7 +217,7 @@ static int request_frame(AVFilterLink *link)
static int poll_frame(AVFilterLink *link)
{
BufferSourceContext *c = link->src->priv;
- return !!(c->picref);
+ return !!c->picref;
}
AVFilter avfilter_vsrc_buffer = {
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 1afaddca1e..86518f6a58 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -371,6 +371,6 @@ OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o
OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o
OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o
-
+SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h
TESTPROGS = seek
TOOLS = pktdumper probetest
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index cac6b1f5eb..d8074780df 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -168,7 +168,7 @@ static void flush_buffer(AVIOContext *s)
void avio_w8(AVIOContext *s, int b)
{
- *(s->buf_ptr)++ = b;
+ *s->buf_ptr++ = b;
if (s->buf_ptr >= s->buf_end)
flush_buffer(s);
}
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 43d1f26a8e..a0007d2982 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -221,10 +221,6 @@ static int process_audio_header_eacs(AVFormatContext *s)
ea->sample_rate = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */
- if(ea->bytes == 0){
- av_log(s,AV_LOG_ERROR,"the file is corrupted, ea->bytes = 0\n");
- return AVERROR_INVALIDDATA;
- }
ea->num_channels = avio_r8(pb);
compression_type = avio_r8(pb);
avio_skip(pb, 13);
@@ -440,6 +436,11 @@ static int ea_read_header(AVFormatContext *s,
ea->audio_codec = 0;
return 1;
}
+ if (ea->bytes <= 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid number of bytes per sample: %d\n", ea->bytes);
+ ea->audio_codec = CODEC_ID_NONE;
+ return 1;
+ }
/* initialize the audio decoder stream */
st = avformat_new_stream(s, NULL);
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 6ebafb6647..bf9e5c0dcf 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -89,6 +89,7 @@ typedef struct IPMVEContext {
int64_t video_pts;
uint32_t palette[256];
int has_palette;
+ int changed;
unsigned int audio_bits;
unsigned int audio_channels;
@@ -168,6 +169,10 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
}
}
+ if (s->changed) {
+ ff_add_param_change(pkt, 0, 0, 0, s->video_width, s->video_height);
+ s->changed = 0;
+ }
pkt->pos= s->decode_map_chunk_offset;
avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET);
s->decode_map_chunk_offset = 0;
@@ -223,6 +228,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
int first_color, last_color;
int audio_flags;
unsigned char r, g, b;
+ unsigned int width, height;
/* see if there are any pending packets */
chunk_type = load_ipmovie_packet(s, pb, pkt);
@@ -379,8 +385,16 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
chunk_type = CHUNK_BAD;
break;
}
- s->video_width = AV_RL16(&scratch[0]) * 8;
- s->video_height = AV_RL16(&scratch[2]) * 8;
+ width = AV_RL16(&scratch[0]) * 8;
+ height = AV_RL16(&scratch[2]) * 8;
+ if (width != s->video_width) {
+ s->video_width = width;
+ s->changed++;
+ }
+ if (height != s->video_height) {
+ s->video_height = height;
+ s->changed++;
+ }
if (opcode_version < 2 || !AV_RL16(&scratch[6])) {
s->video_bpp = 8;
} else {
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index b4b06d96cd..7237963ef3 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -53,7 +53,7 @@ typedef struct MTVDemuxContext {
static int mtv_probe(AVProbeData *p)
{
/* Magic is 'AMV' */
- if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V')
+ if (*p->buf != 'A' || *(p->buf + 1) != 'M' || *(p->buf + 2) != 'V')
return 0;
/* Check for nonzero in bpp and (width|height) header fields */
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 5b9bfb869a..ae6cda3866 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -662,7 +662,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
vst->videobufpos += len;
rm->remaining_len-= len;
- if(type == 2 || (vst->videobufpos) == vst->videobufsize){
+ if (type == 2 || vst->videobufpos == vst->videobufsize) {
vst->pkt.data[0] = vst->cur_slice-1;
*pkt= vst->pkt;
vst->pkt.data= NULL;
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 69da4fd527..1014b41e68 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -24,6 +24,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
+#include "riff.h"
typedef struct VqfContext {
int frame_bit_len;
@@ -45,11 +46,11 @@ static int vqf_probe(AVProbeData *probe_packet)
return AVPROBE_SCORE_MAX/2;
}
-static void add_metadata(AVFormatContext *s, const char *tag,
+static void add_metadata(AVFormatContext *s, uint32_t tag,
unsigned int tag_len, unsigned int remaining)
{
int len = FFMIN(tag_len, remaining);
- char *buf;
+ char *buf, key[5] = {0};
if (len == UINT_MAX)
return;
@@ -59,9 +60,32 @@ static void add_metadata(AVFormatContext *s, const char *tag,
return;
avio_read(s->pb, buf, len);
buf[len] = 0;
- av_dict_set(&s->metadata, tag, buf, AV_DICT_DONT_STRDUP_VAL);
+ AV_WL32(key, tag);
+ av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);
}
+static const AVMetadataConv vqf_metadata_conv[] = {
+ { "(c) ", "copyright" },
+ { "ARNG", "arranger" },
+ { "AUTH", "author" },
+ { "BAND", "band" },
+ { "CDCT", "conductor" },
+ { "COMT", "comment" },
+ { "FILE", "filename" },
+ { "GENR", "genre" },
+ { "LABL", "publisher" },
+ { "MUSC", "composer" },
+ { "NAME", "title" },
+ { "NOTE", "note" },
+ { "PROD", "producer" },
+ { "PRSN", "personnel" },
+ { "REMX", "remixer" },
+ { "SING", "singer" },
+ { "TRCK", "track" },
+ { "WORD", "words" },
+ { 0 },
+};
+
static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
VqfContext *c = s->priv_data;
@@ -110,41 +134,25 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->bit_rate = read_bitrate*1000;
break;
- case MKTAG('N','A','M','E'):
- add_metadata(s, "title" , len, header_size);
- break;
- case MKTAG('(','c',')',' '):
- add_metadata(s, "copyright", len, header_size);
- break;
- case MKTAG('A','U','T','H'):
- add_metadata(s, "author" , len, header_size);
- break;
- case MKTAG('A','L','B','M'):
- add_metadata(s, "album" , len, header_size);
- break;
- case MKTAG('T','R','C','K'):
- add_metadata(s, "track" , len, header_size);
- break;
- case MKTAG('C','O','M','T'):
- add_metadata(s, "comment" , len, header_size);
- break;
- case MKTAG('F','I','L','E'):
- add_metadata(s, "filename" , len, header_size);
- break;
- case MKTAG('D','S','I','Z'):
- add_metadata(s, "size" , len, header_size);
- break;
- case MKTAG('D','A','T','E'):
- add_metadata(s, "date" , len, header_size);
+ case MKTAG('D','S','I','Z'): // size of compressed data
+ {
+ char buf[8] = {0};
+ int size = avio_rb32(s->pb);
+
+ snprintf(buf, sizeof(buf), "%d", size);
+ av_dict_set(&s->metadata, "size", buf, 0);
+ }
break;
- case MKTAG('G','E','N','R'):
- add_metadata(s, "genre" , len, header_size);
+ case MKTAG('Y','E','A','R'): // recording date
+ case MKTAG('E','N','C','D'): // compression date
+ case MKTAG('E','X','T','R'): // reserved
+ case MKTAG('_','Y','M','H'): // reserved
+ case MKTAG('_','N','T','T'): // reserved
+ case MKTAG('_','I','D','3'): // reserved for ID3 tags
+ avio_skip(s->pb, FFMIN(len, header_size));
break;
default:
- av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n",
- ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1],
- ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]);
- avio_skip(s->pb, FFMIN(len, header_size));
+ add_metadata(s, chunk_tag, len, header_size);
break;
}
@@ -201,6 +209,8 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->extradata_size = 12;
memcpy(st->codec->extradata, comm_chunk, 12);
+ ff_metadata_conv_ctx(s, NULL, vqf_metadata_conv);
+
return 0;
}
diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
index 6202346c1e..1e7d781e3c 100644
--- a/tests/fate/demux.mak
+++ b/tests/fate/demux.mak
@@ -10,6 +10,9 @@ fate-bink-demux: CMD = crc -i $(SAMPLES)/bink/Snd0a7d9b58.dee -vn -acodec copy
FATE_TESTS += fate-bink-demux-video
fate-bink-demux-video: CMD = framecrc -i $(SAMPLES)/bink/hol2br.bik
+FATE_TESTS += fate-bmv
+fate-bmv: CMD = framecrc -i $(SAMPLES)/bmv/SURFING-partial.BMV -pix_fmt rgb24
+
FATE_TESTS += fate-caf
fate-caf: CMD = crc -i $(SAMPLES)/caf/caf-pcm16.caf
@@ -78,3 +81,6 @@ fate-siff: CMD = framecrc -i $(SAMPLES)/SIFF/INTRO_B.VB -t 3 -pix_fmt rgb24
FATE_TESTS += fate-westwood-aud
fate-westwood-aud: CMD = md5 -i $(SAMPLES)/westwood-aud/excellent.aud -f s16le
+
+FATE_TESTS += fate-xmv-demux
+fate-xmv-demux: CMD = framecrc -i $(SAMPLES)/xmv/logos1p.fmv -vcodec copy -acodec copy
diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
index 20afdd7e98..6abe048035 100644
--- a/tests/fate/h264.mak
+++ b/tests/fate/h264.mak
@@ -378,4 +378,4 @@ fate-h264-conformance-sva_nl2_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conf
fate-h264-interlace-crop: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264/interlaced_crop.mp4 -vframes 3
fate-h264-lossless: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264/lossless.h264
fate-h264-extreme-plane-pred: CMD = framemd5 -vsync 0 -i $(SAMPLES)/h264/extreme-plane-pred.h264
-fate-h264-bsf-mp4toannexb: CMD = md5 -i $(SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -bsf h264_mp4toannexb -f mpeg
+fate-h264-bsf-mp4toannexb: CMD = md5 -i $(SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -bsf h264_mp4toannexb -f h264
diff --git a/tests/fate/indeo.mak b/tests/fate/indeo.mak
index 37837fef50..cf1625c114 100644
--- a/tests/fate/indeo.mak
+++ b/tests/fate/indeo.mak
@@ -4,6 +4,9 @@ fate-indeo2: CMD = framecrc -i $(SAMPLES)/rt21/VPAR0026.AVI
FATE_INDEO += fate-indeo3
fate-indeo3: CMD = framecrc -i $(SAMPLES)/iv32/cubes.mov
+FATE_INDEO += fate-indeo4
+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
diff --git a/tests/fate/video.mak b/tests/fate/video.mak
index bae51d6d62..7060c92b96 100644
--- a/tests/fate/video.mak
+++ b/tests/fate/video.mak
@@ -185,5 +185,5 @@ fate-wnv1: CMD = framecrc -i $(SAMPLES)/wnv1/wnv1-codec.avi -an
FATE_TESTS += fate-yop
fate-yop: CMD = framecrc -i $(SAMPLES)/yop/test1.yop -pix_fmt rgb24 -an
-FATE_TESTS += fate-xxan-wc4
-fate-xxan-wc4: CMD = framecrc -i $(SAMPLES)/wc4-xan/wc4_2.avi -an -vframes 10
+#FATE_TESTS += fate-xxan-wc4
+#fate-xxan-wc4: CMD = framecrc -i $(SAMPLES)/wc4-xan/wc4trailer-partial.avi -an
diff --git a/tests/ref/acodec/g722 b/tests/ref/acodec/g722
index 1ca02e219b..67e4442a86 100644
--- a/tests/ref/acodec/g722
+++ b/tests/ref/acodec/g722
@@ -1,4 +1,4 @@
-156f63e3391b95020ae882dbae6eccf3 *./tests/data/acodec/g722.wav
-47991 ./tests/data/acodec/g722.wav
-8f65de513acc08b37a488d6a802b4f00 *./tests/data/g722.acodec.out.wav
-stddev: 8860.50 PSNR: 17.38 MAXDIFF:33814 bytes: 191732/ 1058400
+b813a52d4efe6cf7974190ea9c4c7e8c *./tests/data/acodec/g722.wav
+48053 ./tests/data/acodec/g722.wav
+d8344d14a11eef0418b856af70694cbe *./tests/data/g722.acodec.out.wav
+stddev: 8841.18 PSNR: 17.40 MAXDIFF:36225 bytes: 191980/ 1058400
diff --git a/tests/ref/fate/bmv b/tests/ref/fate/bmv
new file mode 100644
index 0000000000..4e461650e8
--- /dev/null
+++ b/tests/ref/fate/bmv
@@ -0,0 +1,42 @@
+0, 0, 823680, 0xddb8a306
+1, 0, 7424, 0x18540b36
+0, 7500, 823680, 0xa95375c8
+1, 7576, 7296, 0x5acd2484
+0, 15000, 823680, 0xa95375c8
+1, 15020, 7424, 0xa1bc5c5a
+0, 22500, 823680, 0xb6f78afe
+1, 22596, 7296, 0x71a02ad1
+0, 30000, 823680, 0xb6f78afe
+1, 30041, 7424, 0x09cc32f2
+0, 37500, 823680, 0x45b9c8f0
+1, 37616, 7296, 0xa3451726
+0, 45000, 823680, 0x45b9c8f0
+1, 45061, 7296, 0x1eb40a18
+0, 52500, 823680, 0x7653d8e9
+1, 52506, 7424, 0xc55a2acf
+0, 60000, 823680, 0x7653d8e9
+1, 60082, 7296, 0x5b9fad3f
+0, 67500, 823680, 0xf1e2fd73
+1, 67527, 7424, 0xea651ae7
+0, 75000, 823680, 0xf1e2fd73
+1, 75102, 7296, 0x2bd5ddb6
+0, 82500, 823680, 0x6d2deab3
+1, 82547, 7424, 0xde4243b4
+0, 90000, 823680, 0x6d2deab3
+1, 90122, 7296, 0x358806d3
+0, 97500, 823680, 0x37fd33ce
+1, 97567, 7296, 0x511a144e
+0, 105000, 823680, 0x37fd33ce
+1, 105012, 7424, 0x887a3e84
+0, 112500, 823680, 0x0a8e0ab9
+1, 112588, 7296, 0xfeae2a0c
+0, 120000, 823680, 0x0a8e0ab9
+1, 120033, 7424, 0xa4ea5d22
+0, 127500, 823680, 0x991bb2b0
+1, 127608, 7296, 0xb3adf7fa
+0, 135000, 823680, 0x991bb2b0
+1, 135053, 7424, 0xce995dcc
+0, 142500, 823680, 0xb8397c8c
+1, 142629, 7296, 0x5b4cf574
+0, 150000, 823680, 0xb8397c8c
+1, 150073, 7296, 0x8a70eaf0
diff --git a/tests/ref/fate/h264-bsf-mp4toannexb b/tests/ref/fate/h264-bsf-mp4toannexb
index 6395f2437a..2049f39701 100644
--- a/tests/ref/fate/h264-bsf-mp4toannexb
+++ b/tests/ref/fate/h264-bsf-mp4toannexb
@@ -1 +1 @@
-503d34ff458a86387ab349c31726f19a
+5f04c27cc6ee8625fe2405fb0f7da9a3
diff --git a/tests/ref/fate/indeo4 b/tests/ref/fate/indeo4
new file mode 100644
index 0000000000..0f088ec7d9
--- /dev/null
+++ b/tests/ref/fate/indeo4
@@ -0,0 +1,100 @@
+0, 0, 86400, 0x98f5e422
+0, 6000, 86400, 0x1864cb06
+0, 12000, 86400, 0xb09532ef
+0, 18000, 86400, 0x3cd3dcdc
+0, 24000, 86400, 0xe738847f
+0, 30000, 86400, 0xc9b13afb
+0, 36000, 86400, 0x5005d035
+0, 42000, 86400, 0x22f63e17
+0, 48000, 86400, 0x93391f02
+0, 54000, 86400, 0x264830fd
+0, 60000, 86400, 0x8fff9f5f
+0, 66000, 86400, 0x524997fe
+0, 72000, 86400, 0x54e330f9
+0, 78000, 86400, 0x1d766a22
+0, 84000, 86400, 0x683a70ac
+0, 90000, 86400, 0x553b7b3d
+0, 96000, 86400, 0x822c79bc
+0, 102000, 86400, 0xe1087a1c
+0, 108000, 86400, 0xff397595
+0, 114000, 86400, 0x1b6b7717
+0, 120000, 86400, 0x6c5275c1
+0, 126000, 86400, 0x4e6a7189
+0, 132000, 86400, 0x285c6eba
+0, 138000, 86400, 0xce647227
+0, 144000, 86400, 0xa0d07b1c
+0, 150000, 86400, 0x5b567861
+0, 156000, 86400, 0x105873ec
+0, 162000, 86400, 0x59267fa0
+0, 168000, 86400, 0xaeac839f
+0, 174000, 86400, 0x2faf7402
+0, 180000, 86400, 0xc8547a30
+0, 186000, 86400, 0x3d357d49
+0, 192000, 86400, 0x75db6d6c
+0, 198000, 86400, 0x9fbf68e9
+0, 204000, 86400, 0x56a64d26
+0, 210000, 86400, 0xce9e1f43
+0, 216000, 86400, 0xa4d7fddc
+0, 222000, 86400, 0x3e20d77c
+0, 228000, 86400, 0x4680661d
+0, 234000, 86400, 0xf1b20af3
+0, 240000, 86400, 0xb79d8045
+0, 246000, 86400, 0x9479fc8a
+0, 252000, 86400, 0x232965c3
+0, 258000, 86400, 0xd18bca17
+0, 264000, 86400, 0xb9064249
+0, 270000, 86400, 0xcc48ab34
+0, 276000, 86400, 0xe25018cd
+0, 282000, 86400, 0x8da489ee
+0, 288000, 86400, 0x90de0fc1
+0, 294000, 86400, 0x2428dcee
+0, 300000, 86400, 0x4316e1ae
+0, 306000, 86400, 0x2b25e54c
+0, 312000, 86400, 0x736ce020
+0, 318000, 86400, 0x9a6be09a
+0, 324000, 86400, 0x23bddbcd
+0, 330000, 86400, 0x9368e465
+0, 336000, 86400, 0x1ae9bb87
+0, 342000, 86400, 0x4e591f32
+0, 348000, 86400, 0xba1bf9dc
+0, 354000, 86400, 0x07f0aa60
+0, 360000, 86400, 0xf5a2cfa2
+0, 366000, 86400, 0xcba5fc18
+0, 372000, 86400, 0x858c0cfe
+0, 378000, 86400, 0xac73ecd4
+0, 384000, 86400, 0xf41bf03c
+0, 390000, 86400, 0x928ed146
+0, 396000, 86400, 0x9ff5990a
+0, 402000, 86400, 0xc2fabc3d
+0, 408000, 86400, 0x94af87a3
+0, 414000, 86400, 0x9bae514c
+0, 420000, 86400, 0xe0da267a
+0, 426000, 86400, 0x1d40f55c
+0, 432000, 86400, 0xe6173b68
+0, 438000, 86400, 0x1445490d
+0, 444000, 86400, 0x8d8753c1
+0, 450000, 86400, 0xe5a7779d
+0, 456000, 86400, 0x3cfc66ef
+0, 462000, 86400, 0xa5d45608
+0, 468000, 86400, 0x62f17be1
+0, 474000, 86400, 0xa64c84d3
+0, 480000, 86400, 0xf98162f0
+0, 486000, 86400, 0x0db77d9f
+0, 492000, 86400, 0x0f0cbac9
+0, 498000, 86400, 0xb9934e97
+0, 504000, 86400, 0x7f8fa248
+0, 510000, 86400, 0xdfd96768
+0, 516000, 86400, 0x81b07919
+0, 522000, 86400, 0x66c11e9f
+0, 528000, 86400, 0xd86eb114
+0, 534000, 86400, 0x67f20c1f
+0, 540000, 86400, 0x66915de5
+0, 546000, 86400, 0x2b8aa76f
+0, 552000, 86400, 0x85b5a3d2
+0, 558000, 86400, 0x80d29ed6
+0, 564000, 86400, 0x4d508e2c
+0, 570000, 86400, 0x0d407374
+0, 576000, 86400, 0xd4068016
+0, 582000, 86400, 0x6ffab98f
+0, 588000, 86400, 0x2360903d
+0, 594000, 86400, 0x470e04a0
diff --git a/tests/ref/fate/xmv-demux b/tests/ref/fate/xmv-demux
new file mode 100644
index 0000000000..887b855d74
--- /dev/null
+++ b/tests/ref/fate/xmv-demux
@@ -0,0 +1,181 @@
+0, 0, 1508, 0xefceba48
+1, 0, 5976, 0xfa2c2db9
+1, 10841, 5976, 0x256b935c
+1, 21682, 5976, 0xa78a9563
+1, 32522, 5976, 0x4ea056f4
+1, 43363, 5976, 0xda772d8d
+1, 54204, 5976, 0xafacf7c9
+0, 57600, 108, 0x06713c96
+0, 61200, 952, 0xd306df7e
+0, 64800, 2312, 0xaf316585
+1, 65045, 5976, 0xdeb003f4
+0, 68400, 3872, 0xfc1c527c
+0, 72000, 20, 0xaffc0edd
+0, 75600, 6600, 0xe1b66c7f
+1, 75886, 2016, 0xa7380d36
+0, 79200, 6868, 0xd5b3f631
+1, 79543, 2016, 0xbc090bac
+0, 82800, 8420, 0xf70ee33b
+1, 83200, 2016, 0x6f8c164c
+0, 86400, 13144, 0x9a54ef39
+1, 86857, 2016, 0x13b80e28
+0, 90000, 6340, 0xe55bf555
+1, 90514, 2016, 0xd40ff863
+0, 93600, 3736, 0x0b23f89f
+1, 94171, 2016, 0x4d530ed7
+0, 97200, 2624, 0x79e2e451
+1, 97829, 2160, 0x0fbc37eb
+0, 100800, 1860, 0x63886f11
+1, 101747, 13824, 0x82fb2602
+0, 104400, 1244, 0x74594601
+0, 108000, 564, 0xf4561dfb
+0, 111600, 80, 0xbf8e2e30
+0, 115200, 20, 0xa0990c29
+1, 126824, 13824, 0x08771caf
+1, 151902, 13824, 0xdf7d4a65
+1, 176980, 13896, 0x24bf3f47
+1, 202188, 3600, 0x9ad26b9f
+1, 208718, 3600, 0x8c666fd6
+1, 215249, 3600, 0x305c6ca1
+1, 221780, 3600, 0x48b04e1e
+0, 223200, 104, 0x12413980
+0, 226800, 796, 0x2e698ed3
+1, 228310, 3600, 0x8c915935
+0, 230400, 1808, 0x8b3e6e5e
+0, 234000, 4712, 0xdbd51737
+1, 234841, 3600, 0xa8f45e01
+0, 237600, 5548, 0xee9c831c
+0, 241200, 6152, 0x9c18ccc1
+1, 241371, 3816, 0xc64cc5ed
+0, 244800, 6452, 0x7860462a
+1, 248294, 1944, 0x0ac2e3f1
+0, 248400, 6676, 0xe1b1c9e4
+1, 251820, 1944, 0x2197dccd
+0, 252000, 10904, 0x0bded7b7
+1, 255347, 1944, 0x0c02e77f
+0, 255600, 12844, 0xe6d16cff
+1, 258873, 1944, 0x675ee06a
+0, 259200, 10920, 0xe114c46b
+1, 262400, 2160, 0x0d803a8b
+0, 262800, 5952, 0xb7464634
+1, 266318, 6696, 0xa7a0dfea
+0, 266400, 4732, 0x2fa2e36d
+0, 270000, 2592, 0xf54ddd57
+0, 273600, 1516, 0x4a1cd4d5
+0, 277200, 864, 0x49889afc
+1, 278465, 6696, 0x59aa3145
+0, 280800, 468, 0x3932e6a4
+0, 284400, 116, 0x2b8341e6
+0, 288000, 16, 0x6a3109cf
+1, 290612, 6696, 0x69be4d78
+1, 302759, 6696, 0x64064c67
+1, 314906, 6696, 0xc8536f98
+1, 327053, 6696, 0xc0ce5199
+1, 339200, 6768, 0x3b275c58
+1, 351478, 8856, 0x90e5b37c
+0, 360000, 1508, 0xefceba48
+1, 367543, 8856, 0x86b33366
+1, 383608, 8856, 0x19e18797
+1, 399673, 8856, 0x0a0c7fbd
+1, 415739, 8928, 0x4a9b2d42
+0, 417600, 100, 0x45023894
+0, 421200, 948, 0xa65ed345
+0, 424800, 2808, 0xd7285746
+0, 428400, 5372, 0x05794175
+1, 431935, 1512, 0xed8b3f4b
+0, 432000, 11596, 0x8636eca7
+1, 434678, 1512, 0xa27d3891
+0, 435600, 11524, 0xe1f39be3
+1, 437420, 1512, 0xb0f13eb6
+0, 439200, 23392, 0xab053f05
+1, 440163, 1656, 0xe5a98324
+0, 442800, 4560, 0x03197d07
+1, 443167, 2232, 0x15445433
+0, 446400, 4440, 0x1cc361a2
+1, 447216, 2232, 0x5cb348a9
+0, 450000, 23688, 0x16030634
+1, 451265, 2232, 0xf10347da
+0, 453600, 16132, 0xf0eca799
+1, 455314, 2448, 0x3e16a175
+0, 457200, 29896, 0x0c0988ea
+1, 459755, 2520, 0x17e3ca2b
+0, 460800, 19956, 0x0093aa0b
+1, 464327, 1944, 0x35c2de84
+0, 464400, 16392, 0x8829a9ca
+1, 467853, 1944, 0x55b4db40
+0, 468000, 16772, 0x9a4a546d
+1, 471380, 2088, 0xdaae14b2
+0, 471600, 8920, 0xcd8ca203
+1, 475167, 1944, 0x92ccd37f
+0, 475200, 9632, 0x53c1d37b
+1, 478694, 1944, 0x70efede1
+0, 478800, 8976, 0xfe4da2cc
+1, 482220, 1944, 0x7601d304
+0, 482400, 6680, 0x35348fe0
+1, 485747, 1944, 0x3922ebc2
+0, 486000, 9228, 0xcbf62b0c
+1, 489273, 2160, 0xde462f2e
+0, 489600, 5108, 0xd1d88511
+1, 493192, 1872, 0x467ac1d2
+0, 493200, 10016, 0xaff4b2b2
+1, 496588, 1872, 0xa1e4cd43
+0, 496800, 7468, 0x23e81ab8
+1, 499984, 1872, 0x1dceccc6
+0, 500400, 4172, 0x253cd05b
+1, 503380, 1872, 0x2bbad2a5
+0, 504000, 8188, 0x7ede743f
+1, 506776, 1872, 0xc603d44d
+0, 507600, 2884, 0x2dec55a3
+1, 510171, 1872, 0x1b4cc261
+0, 511200, 3900, 0xd0666a18
+1, 513567, 1872, 0x10edd6cf
+0, 514800, 2996, 0x9cc99b8c
+1, 516963, 2376, 0xecdb9d61
+0, 518400, 2156, 0xae612776
+1, 521273, 2592, 0x5559eced
+0, 522000, 3988, 0x0d2c9992
+0, 525600, 1512, 0x6281fc00
+1, 525976, 2592, 0x8848dfc7
+0, 529200, 6544, 0xb75c2562
+1, 530678, 2592, 0x4ca2d7da
+0, 532800, 4108, 0xfb21efc9
+1, 535380, 2592, 0x285fd7e6
+0, 536400, 1096, 0x85922a37
+0, 540000, 9740, 0xe57d7647
+1, 540082, 2592, 0x2717e404
+0, 543600, 416, 0x61c2ea02
+1, 544784, 2592, 0xf106111a
+0, 547200, 336, 0x1dc5ac1c
+1, 549486, 2592, 0xd7d01119
+0, 550800, 204, 0x16f57017
+1, 554188, 2592, 0x550cfeda
+0, 554400, 112, 0x78374234
+0, 558000, 40, 0x6cb21985
+1, 558890, 2592, 0x47ad00c4
+1, 563592, 2592, 0x39bbf306
+1, 568294, 3240, 0x69addfce
+1, 574171, 21384, 0x254f63e0
+1, 612963, 21456, 0x2f7a9859
+0, 615600, 14420, 0x53324ca4
+0, 619200, 40, 0x10971420
+1, 651886, 37512, 0x6e962928
+1, 719935, 2736, 0x1dc91c69
+0, 720000, 24904, 0x15574f7e
+1, 724898, 2736, 0x023434fd
+1, 729861, 2736, 0x906f1541
+0, 734400, 1908, 0xccb2dd3c
+1, 734824, 2736, 0x85a31102
+0, 738000, 4676, 0xbfa42b7e
+1, 739788, 3024, 0x9296a5f3
+0, 741600, 3600, 0x87c9dc58
+0, 745200, 8184, 0x504a8e65
+1, 745273, 1944, 0x7bf4dedc
+0, 748800, 9636, 0x2efb3006
+1, 748800, 1944, 0x4196c404
+1, 752327, 1944, 0xcda97c7a
+0, 752400, 9580, 0x0fb6f4e8
+1, 755853, 1944, 0x5f4922b2
+0, 756000, 7840, 0xe996f564
+1, 759380, 2088, 0x37dfc157
+0, 759600, 4208, 0xe9c2fba2
+0, 763200, 556, 0x3f1e077c
diff --git a/tests/ref/fate/xxan-wc4 b/tests/ref/fate/xxan-wc4
index d31fbb697c..7fede0afc6 100644
--- a/tests/ref/fate/xxan-wc4
+++ b/tests/ref/fate/xxan-wc4
@@ -1,10 +1,21 @@
-0, 0, 79360, 0x877eb3ed
-0, 6000, 79360, 0x9ff8707c
-0, 12000, 79360, 0x144dec86
-0, 18000, 79360, 0x56d59588
-0, 24000, 79360, 0x2d20f8ce
-0, 30000, 79360, 0x1a752c42
-0, 36000, 79360, 0x85705730
-0, 42000, 79360, 0xddea3741
-0, 48000, 79360, 0x46448efd
-0, 54000, 79360, 0x27186e2b
+0, 0, 79360, 0x3b0a7d1b
+0, 6000, 79360, 0x740842c3
+0, 12000, 79360, 0x85160167
+0, 18000, 79360, 0xaf510e92
+0, 24000, 79360, 0x8e290bec
+0, 30000, 79360, 0x51e981b0
+0, 36000, 79360, 0x16e52c60
+0, 42000, 79360, 0x66e1e60a
+0, 48000, 79360, 0x40fa58f6
+0, 54000, 79360, 0x00388edd
+0, 60000, 79360, 0xc74f95bf
+0, 66000, 79360, 0xf446a3fd
+0, 72000, 79360, 0x27b5eb60
+0, 78000, 79360, 0xea9266a2
+0, 84000, 79360, 0x7b6a7907
+0, 90000, 79360, 0x2be7d946
+0, 96000, 79360, 0x61881ee4
+0, 102000, 79360, 0x9214bd4f
+0, 108000, 79360, 0xeb294afe
+0, 114000, 79360, 0xc861ad55
+0, 120000, 79360, 0x3d3b6220