aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-29 01:41:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-03-29 04:11:10 +0200
commitd40ff29cacf9b8ffa1061392a0e9b3056c4882ea (patch)
tree3b59f4b9a74e209220f0b0dcb90c466e3e4a9b3d
parent99bb88c588ea9a46a06b966b9014394385ebe1c3 (diff)
parent44257ef4267f01dd698c8ab8abf50fd77136a8ce (diff)
downloadffmpeg-d40ff29cacf9b8ffa1061392a0e9b3056c4882ea.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: asf: only set index_read if the index contained entries. cabac: add overread protection to BRANCHLESS_GET_CABAC(). cabac: increment jump locations by one in callers of BRANCHLESS_GET_CABAC(). cabac: remove unused argument from BRANCHLESS_GET_CABAC_UPDATE(). cabac: use struct+offset instead of memory operand in BRANCHLESS_GET_CABAC(). h264: add overread protection to get_cabac_bypass_sign_x86(). h264: reindent get_cabac_bypass_sign_x86(). h264: use struct offsets in get_cabac_bypass_sign_x86(). h264: fix overreads in cabac reader. wmall: fix seeking. lagarith: fix buffer overreads. dvdec: drop unnecessary dv_tablegen.h #include build: fix doc generation errors in parallel builds Replace memset(0) by zero initializations. faandct: Remove FAAN_POSTSCALE define and related code. dvenc: print allowed profiles if the video doesn't conform to any of them. avcodec_encode_{audio,video}: only reallocate output packet when it has non-zero size. FATE: add a test for vp8 with changing frame size. fate: add kgv1 fate test. oggdec: calculate correct timestamps in Ogg/FLAC Conflicts: libavcodec/4xm.c libavcodec/cook.c libavcodec/dvdata.c libavcodec/dvdsubdec.c libavcodec/lagarith.c libavcodec/lagarithrac.c libavcodec/utils.c tests/fate/video.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/Makefile2
-rw-r--r--ffplay.c3
-rw-r--r--ffserver.c9
-rw-r--r--libavcodec/4xm.c6
-rw-r--r--libavcodec/aaccoder.c3
-rw-r--r--libavcodec/aacpsy.c6
-rw-r--r--libavcodec/ac3dec.c4
-rw-r--r--libavcodec/alsdec.c11
-rw-r--r--libavcodec/bink.c3
-rw-r--r--libavcodec/cabac_functions.h4
-rw-r--r--libavcodec/cook.c20
-rw-r--r--libavcodec/dct-test.c8
-rw-r--r--libavcodec/dv.c6
-rw-r--r--libavcodec/dvdata.c12
-rw-r--r--libavcodec/dvdata.h5
-rw-r--r--libavcodec/dvdec.c1
-rw-r--r--libavcodec/dvdsubdec.c6
-rw-r--r--libavcodec/dxva2.c3
-rw-r--r--libavcodec/faandct.c37
-rw-r--r--libavcodec/faandct.h2
-rw-r--r--libavcodec/flac_parser.c3
-rw-r--r--libavcodec/intrax8dsp.c6
-rw-r--r--libavcodec/jpeglsenc.c3
-rw-r--r--libavcodec/lagarith.c71
-rw-r--r--libavcodec/lagarithrac.c6
-rw-r--r--libavcodec/libxvid_rc.c9
-rw-r--r--libavcodec/libxvidff.c21
-rw-r--r--libavcodec/mjpegdec.c3
-rw-r--r--libavcodec/motion_est.c3
-rw-r--r--libavcodec/mpegaudiodec.c7
-rw-r--r--libavcodec/mpegvideo_enc.c25
-rw-r--r--libavcodec/ra144enc.c3
-rw-r--r--libavcodec/rangecoder.c2
-rw-r--r--libavcodec/rv34.c5
-rw-r--r--libavcodec/smacker.c11
-rw-r--r--libavcodec/tiff.c3
-rw-r--r--libavcodec/truemotion1.c3
-rw-r--r--libavcodec/wmalosslessdec.c13
-rw-r--r--libavcodec/wmaprodec.c4
-rw-r--r--libavcodec/wmavoice.c3
-rw-r--r--libavcodec/x86/cabac.h78
-rw-r--r--libavcodec/x86/h264_i386.h62
-rw-r--r--libavdevice/bktr.c3
-rw-r--r--libavformat/asfcrypt.c3
-rw-r--r--libavformat/asfdec.c2
-rw-r--r--libavformat/movenc.c3
-rw-r--r--libavformat/oggparseflac.c1
-rw-r--r--libavformat/rtsp.c9
-rw-r--r--libavformat/sapenc.c3
-rw-r--r--libavformat/sdp.c6
-rw-r--r--libavformat/seek-test.c3
-rw-r--r--libavformat/tcp.c3
-rw-r--r--libavformat/udp.c3
-rw-r--r--libavformat/utils.c3
-rw-r--r--libavutil/imgutils.c4
-rw-r--r--libavutil/parseutils.c4
-rw-r--r--tests/fate/video.mak3
-rw-r--r--tests/fate/vpx.mak4
-rw-r--r--tests/ref/fate/kgv1314
-rw-r--r--tests/ref/fate/vp8-size-change31
60 files changed, 604 insertions, 293 deletions
diff --git a/doc/Makefile b/doc/Makefile
index 07752c5ec7..a97218240b 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -51,7 +51,7 @@ doc/%.1: TAG = MAN
doc/%.1: doc/%.pod $(GENTEXI)
$(M)pod2man --section=1 --center=" " --release=" " $< > $@
-$(DOCS): | doc
+$(DOCS): | doc/
install-progs-$(CONFIG_DOC): install-man
diff --git a/ffplay.c b/ffplay.c
index 3d61a2292b..21abe4ecfe 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1416,7 +1416,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
/* if the frame is not skipped, then display it */
if (vp->bmp) {
- AVPicture pict;
+ AVPicture pict = { { 0 } };
#if CONFIG_AVFILTER
if (vp->picref)
avfilter_unref_buffer(vp->picref);
@@ -1426,7 +1426,6 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
/* get a pointer on the bitmap */
SDL_LockYUVOverlay (vp->bmp);
- memset(&pict, 0, sizeof(AVPicture));
pict.data[0] = vp->bmp->pixels[0];
pict.data[1] = vp->bmp->pixels[2];
pict.data[2] = vp->bmp->pixels[1];
diff --git a/ffserver.c b/ffserver.c
index 5b041fd89d..20636612c8 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -339,8 +339,7 @@ static int resolve_host(struct in_addr *sin_addr, const char *hostname)
if (!ff_inet_aton(hostname, sin_addr)) {
#if HAVE_GETADDRINFO
struct addrinfo *ai, *cur;
- struct addrinfo hints;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 };
hints.ai_family = AF_INET;
if (getaddrinfo(hostname, NULL, &hints, &ai))
return -1;
@@ -2835,7 +2834,7 @@ static int rtsp_parse_request(HTTPContext *c)
char protocol[32];
char line[1024];
int len;
- RTSPMessageHeader header1, *header = &header1;
+ RTSPMessageHeader header1 = { 0 }, *header = &header1;
c->buffer_ptr[0] = '\0';
p = c->buffer;
@@ -2861,7 +2860,6 @@ static int rtsp_parse_request(HTTPContext *c)
}
/* parse each header line */
- memset(header, 0, sizeof(*header));
/* skip to next line */
while (*p != '\n' && *p != '\0')
p++;
@@ -4664,7 +4662,7 @@ static const OptionDef options[] = {
int main(int argc, char **argv)
{
- struct sigaction sigact;
+ struct sigaction sigact = { { 0 } };
parse_loglevel(argc, argv, options);
av_register_all();
@@ -4682,7 +4680,6 @@ int main(int argc, char **argv)
av_lfg_init(&random_state, av_get_random_seed());
- memset(&sigact, 0, sizeof(sigact));
sigact.sa_handler = handle_child_exit;
sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART;
sigaction(SIGCHLD, &sigact, 0);
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 53ee855160..600cf81ccd 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -578,7 +578,7 @@ static int decode_i_mb(FourXContext *f)
static const uint8_t *read_huffman_tables(FourXContext *f,
const uint8_t * const buf, int buf_size)
{
- int frequency[512];
+ int frequency[512] = { 0 };
uint8_t flag[512];
int up[512];
uint8_t len_tab[257];
@@ -588,7 +588,6 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
const uint8_t *ptr_end = buf + buf_size;
int j;
- memset(frequency, 0, sizeof(frequency));
memset(up, -1, sizeof(up));
start = *ptr++;
@@ -691,10 +690,9 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
for (y = 0; y < height; y += 16) {
for (x = 0; x < width; x += 16) {
- unsigned int color[4], bits;
+ unsigned int color[4] = { 0 }, bits;
if (buf_end - buf < 8)
return -1;
- memset(color, 0, sizeof(color));
// warning following is purely guessed ...
color[0] = bytestream2_get_le16u(&g3);
color[1] = bytestream2_get_le16u(&g3);
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 8738460b81..25187b7c87 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -714,7 +714,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
{
int start = 0, i, w, w2, g;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
- float dists[128], uplims[128];
+ float dists[128] = { 0 }, uplims[128];
float maxvals[128];
int fflag, minscaler;
int its = 0;
@@ -722,7 +722,6 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
float minthr = INFINITY;
//XXX: some heuristic to determine initial quantizers will reduce search time
- memset(dists, 0, sizeof(dists));
//determine zero bands and upper limits
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) {
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 396a2d28b2..77dfec638d 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -389,9 +389,8 @@ static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
AacPsyChannel *pch = &pctx->ch[channel];
uint8_t grouping = 0;
int next_type = pch->next_window_seq;
- FFPsyWindowInfo wi;
+ FFPsyWindowInfo wi = { { 0 } };
- memset(&wi, 0, sizeof(wi));
if (la) {
float s[8], v;
int switch_to_eight = 0;
@@ -785,9 +784,8 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
int uselongblock = 1;
int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
int i;
- FFPsyWindowInfo wi;
+ FFPsyWindowInfo wi = { { 0 } };
- memset(&wi, 0, sizeof(wi));
if (la) {
float hpfsmpl[AAC_BLOCK_SIZE_LONG];
float const *pf = hpfsmpl;
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 31891b5807..6c1fdbebd7 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -753,9 +753,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
int downmix_output;
int cpl_in_use;
GetBitContext *gbc = &s->gbc;
- uint8_t bit_alloc_stages[AC3_MAX_CHANNELS];
-
- memset(bit_alloc_stages, 0, AC3_MAX_CHANNELS);
+ uint8_t bit_alloc_stages[AC3_MAX_CHANNELS] = { 0 };
/* block switch flags */
different_transforms = 0;
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index e61c29e180..b98473ef5e 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1035,9 +1035,7 @@ static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
unsigned int *js_blocks)
{
unsigned int b;
- ALSBlockData bd;
-
- memset(&bd, 0, sizeof(ALSBlockData));
+ ALSBlockData bd = { 0 };
bd.ra_block = ra_frame;
bd.const_block = ctx->const_block;
@@ -1078,9 +1076,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
ALSSpecificConfig *sconf = &ctx->sconf;
unsigned int offset = 0;
unsigned int b;
- ALSBlockData bd[2];
-
- memset(bd, 0, 2 * sizeof(ALSBlockData));
+ ALSBlockData bd[2] = { { 0 } };
bd[0].ra_block = ra_frame;
bd[0].const_block = ctx->const_block;
@@ -1346,7 +1342,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
sizeof(*ctx->raw_samples[c]) * sconf->max_order);
}
} else { // multi-channel coding
- ALSBlockData bd;
+ ALSBlockData bd = { 0 };
int b;
int *reverted_channels = ctx->reverted_channels;
unsigned int offset = 0;
@@ -1357,7 +1353,6 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
return -1;
}
- memset(&bd, 0, sizeof(ALSBlockData));
memset(reverted_channels, 0, sizeof(*reverted_channels) * avctx->channels);
bd.ra_block = ra_frame;
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 4ca96e5f76..694a7346ac 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -233,7 +233,7 @@ static void merge(GetBitContext *gb, uint8_t *dst, uint8_t *src, int size)
*/
static void read_tree(GetBitContext *gb, Tree *tree)
{
- uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2;
+ uint8_t tmp1[16] = { 0 }, tmp2[16], *in = tmp1, *out = tmp2;
int i, t, len;
tree->vlc_num = get_bits(gb, 4);
@@ -244,7 +244,6 @@ static void read_tree(GetBitContext *gb, Tree *tree)
}
if (get_bits1(gb)) {
len = get_bits(gb, 3);
- memset(tmp1, 0, sizeof(tmp1));
for (i = 0; i <= len; i++) {
tree->syms[i] = get_bits(gb, 4);
tmp1[tree->syms[i]] = 1;
diff --git a/libavcodec/cabac_functions.h b/libavcodec/cabac_functions.h
index 226edfa0ef..90af15c243 100644
--- a/libavcodec/cabac_functions.h
+++ b/libavcodec/cabac_functions.h
@@ -47,7 +47,7 @@ static void refill(CABACContext *c){
c->low+= c->bytestream[0]<<1;
#endif
c->low -= CABAC_MASK;
- c->bytestream+= CABAC_BITS/8;
+ c->bytestream += CABAC_BITS / 8;
}
static inline void renorm_cabac_decoder_once(CABACContext *c){
@@ -74,7 +74,7 @@ static void refill2(CABACContext *c){
#endif
c->low += x<<i;
- c->bytestream+= CABAC_BITS/8;
+ c->bytestream += CABAC_BITS/8;
}
static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const state){
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 31b0f1f8b0..cde2752ea7 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -411,10 +411,10 @@ static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_
int *category, int *category_index)
{
int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits, index, v, i, j;
- int exp_index2[102];
- int exp_index1[102];
+ int exp_index2[102] = { 0 };
+ int exp_index1[102] = { 0 };
- int tmp_categorize_array[128 * 2];
+ int tmp_categorize_array[128 * 2] = { 0 };
int tmp_categorize_array1_idx = p->numvector_size;
int tmp_categorize_array2_idx = p->numvector_size;
@@ -426,10 +426,6 @@ static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_
//av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left);
}
- memset(&exp_index1, 0, sizeof(exp_index1));
- memset(&exp_index2, 0, sizeof(exp_index2));
- memset(&tmp_categorize_array, 0, sizeof(tmp_categorize_array));
-
bias = -32;
/* Estimate bias. */
@@ -649,14 +645,11 @@ static void decode_vectors(COOKContext *q, COOKSubpacket *p, int *category,
*/
static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer)
{
- int category_index[128];
+ int category_index[128] = { 0 };
+ int category[128] = { 0 };
int quant_index_table[102];
- int category[128];
int res, i;
- memset(&category, 0, sizeof(category));
- memset(&category_index, 0, sizeof(category_index));
-
if ((res = decode_envelope(q, p, quant_index_table)) < 0)
return res;
q->num_vectors = get_bits(&q->gb, p->log2_numvector_size);
@@ -829,13 +822,12 @@ static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
float *mlt_buffer2)
{
int i, j, res;
- int decouple_tab[SUBBAND_SIZE];
+ int decouple_tab[SUBBAND_SIZE] = { 0 };
float *decode_buffer = q->decode_buffer_0;
int idx, cpl_tmp;
float f1, f2;
const float *cplscale;
- memset(decouple_tab, 0, sizeof(decouple_tab));
memset(decode_buffer, 0, sizeof(q->decode_buffer_0));
/* Make sure the buffers are zeroed out. */
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 3a6ab96e39..eb2fdc6439 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -74,17 +74,11 @@ struct algo {
int nonspec;
};
-#ifndef FAAN_POSTSCALE
-#define FAAN_SCALE SCALE_PERM
-#else
-#define FAAN_SCALE NO_PERM
-#endif
-
static int cpu_flags;
static const struct algo fdct_tab[] = {
{ "REF-DBL", ff_ref_fdct, NO_PERM },
- { "FAAN", ff_faandct, FAAN_SCALE },
+ { "FAAN", ff_faandct, NO_PERM },
{ "IJG-AAN-INT", ff_fdct_ifast, SCALE_PERM },
{ "IJG-LLM-INT", ff_jpeg_fdct_islow_8, NO_PERM },
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 805ebe31ee..d0de545008 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -323,9 +323,11 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx)
static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
{
if (!avpriv_dv_codec_profile(avctx)) {
- av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video\n",
+ av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. "
+ "Valid DV profiles are:\n",
avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));
- return -1;
+ ff_dv_print_profiles(avctx, AV_LOG_ERROR);
+ return AVERROR(EINVAL);
}
return ff_dvvideo_init(avctx);
diff --git a/libavcodec/dvdata.c b/libavcodec/dvdata.c
index 3dc3ae6785..6a29a59e5e 100644
--- a/libavcodec/dvdata.c
+++ b/libavcodec/dvdata.c
@@ -26,6 +26,7 @@
#include "libavutil/rational.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "dvdata.h"
@@ -345,3 +346,14 @@ const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec)
return NULL;
}
+
+void ff_dv_print_profiles(void *logctx, int loglevel)
+{
+ int i;
+ for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) {
+ const DVprofile *p = &dv_profiles[i];
+ av_log(logctx, loglevel, "Frame size: %dx%d; pixel format: %s, "
+ "framerate: %d/%d\n", p->width, p->height, av_get_pix_fmt_name(p->pix_fmt),
+ p->time_base.den, p->time_base.num);
+ }
+}
diff --git a/libavcodec/dvdata.h b/libavcodec/dvdata.h
index e3ce98ad12..9a6ac8921e 100644
--- a/libavcodec/dvdata.h
+++ b/libavcodec/dvdata.h
@@ -156,4 +156,9 @@ static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chun
}
}
+/**
+ * Print all allowed DV profiles into logctx at specified logging level.
+ */
+void ff_dv_print_profiles(void *logctx, int loglevel);
+
#endif /* AVCODEC_DVDATA_H */
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 8e0ee65bef..bff3a101af 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -43,7 +43,6 @@
#include "simple_idct.h"
#include "dvdata.h"
#include "dvquant.h"
-#include "dv_tablegen.h"
typedef struct BlockInfo {
const uint32_t *factor_table;
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index f4b54396d9..afc485bf6b 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -135,7 +135,7 @@ static void guess_palette(uint32_t *rgba_palette,
{0x00, 0x80, 0xff},
{0x00, 0x55, 0xaa, 0xff},
};
- uint8_t color_used[16];
+ uint8_t color_used[16] = { 0 };
int nb_opaque_colors, i, level, j, r, g, b;
uint8_t *colormap = ctx->colormap, *alpha = ctx->alpha;
@@ -149,7 +149,6 @@ static void guess_palette(uint32_t *rgba_palette,
for(i = 0; i < 4; i++)
rgba_palette[i] = 0;
- memset(color_used, 0, 16);
nb_opaque_colors = 0;
for(i = 0; i < 4; i++) {
if (alpha[i] != 0 && !color_used[colormap[i]]) {
@@ -397,14 +396,13 @@ static int is_transp(const uint8_t *buf, int pitch, int n,
/* return 0 if empty rectangle, 1 if non empty */
static int find_smallest_bounding_rectangle(AVSubtitle *s)
{
- uint8_t transp_color[256];
+ uint8_t transp_color[256] = { 0 };
int y1, y2, x1, x2, y, w, h, i;
uint8_t *bitmap;
if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0)
return 0;
- memset(transp_color, 0, 256);
for(i = 0; i < s->rects[0]->nb_colors; i++) {
if ((((uint32_t*)s->rects[0]->pict.data[1])[i] >> 24) == 0)
transp_color[i] = 1;
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index 9b94b58fbc..d8660710d6 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -86,7 +86,7 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
struct dxva_context *ctx = avctx->hwaccel_context;
unsigned buffer_count = 0;
DXVA2_DecodeBufferDesc buffer[4];
- DXVA2_DecodeExecuteParams exec;
+ DXVA2_DecodeExecuteParams exec = { 0 };
int result;
if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
@@ -132,7 +132,6 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
assert(buffer_count == 1 + (qm_size > 0) + 2);
- memset(&exec, 0, sizeof(exec));
exec.NumCompBuffers = buffer_count;
exec.pCompressedBuffers = buffer;
exec.pExtensionData = NULL;
diff --git a/libavcodec/faandct.c b/libavcodec/faandct.c
index a986f65440..eaf4b65f41 100644
--- a/libavcodec/faandct.c
+++ b/libavcodec/faandct.c
@@ -29,11 +29,6 @@
#include "faandct.h"
#define FLOAT float
-#ifdef FAAN_POSTSCALE
-# define SCALE(x) postscale[x]
-#else
-# define SCALE(x) 1
-#endif
//numbers generated by simple c code (not as accurate as they could be)
/*
@@ -150,13 +145,13 @@ void ff_faandct(DCTELEM * data)
tmp11= tmp1 + tmp2;
tmp12= tmp1 - tmp2;
- data[8*0 + i]= lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
- data[8*4 + i]= lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
+ data[8*0 + i]= lrintf(postscale[8*0 + i] * (tmp10 + tmp11));
+ data[8*4 + i]= lrintf(postscale[8*4 + i] * (tmp10 - tmp11));
tmp12 += tmp13;
tmp12 *= A1;
- data[8*2 + i]= lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
- data[8*6 + i]= lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
+ data[8*2 + i]= lrintf(postscale[8*2 + i] * (tmp13 + tmp12));
+ data[8*6 + i]= lrintf(postscale[8*6 + i] * (tmp13 - tmp12));
tmp4 += tmp5;
tmp5 += tmp6;
@@ -175,10 +170,10 @@ void ff_faandct(DCTELEM * data)
z11= tmp7 + tmp5;
z13= tmp7 - tmp5;
- data[8*5 + i]= lrintf(SCALE(8*5 + i) * (z13 + z2));
- data[8*3 + i]= lrintf(SCALE(8*3 + i) * (z13 - z2));
- data[8*1 + i]= lrintf(SCALE(8*1 + i) * (z11 + z4));
- data[8*7 + i]= lrintf(SCALE(8*7 + i) * (z11 - z4));
+ data[8*5 + i]= lrintf(postscale[8*5 + i] * (z13 + z2));
+ data[8*3 + i]= lrintf(postscale[8*3 + i] * (z13 - z2));
+ data[8*1 + i]= lrintf(postscale[8*1 + i] * (z11 + z4));
+ data[8*7 + i]= lrintf(postscale[8*7 + i] * (z11 - z4));
}
}
@@ -208,25 +203,25 @@ void ff_faandct248(DCTELEM * data)
tmp12 = tmp1 - tmp2;
tmp13 = tmp0 - tmp3;
- data[8*0 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
- data[8*4 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
+ data[8*0 + i] = lrintf(postscale[8*0 + i] * (tmp10 + tmp11));
+ data[8*4 + i] = lrintf(postscale[8*4 + i] * (tmp10 - tmp11));
tmp12 += tmp13;
tmp12 *= A1;
- data[8*2 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
- data[8*6 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
+ data[8*2 + i] = lrintf(postscale[8*2 + i] * (tmp13 + tmp12));
+ data[8*6 + i] = lrintf(postscale[8*6 + i] * (tmp13 - tmp12));
tmp10 = tmp4 + tmp7;
tmp11 = tmp5 + tmp6;
tmp12 = tmp5 - tmp6;
tmp13 = tmp4 - tmp7;
- data[8*1 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
- data[8*5 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
+ data[8*1 + i] = lrintf(postscale[8*0 + i] * (tmp10 + tmp11));
+ data[8*5 + i] = lrintf(postscale[8*4 + i] * (tmp10 - tmp11));
tmp12 += tmp13;
tmp12 *= A1;
- data[8*3 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
- data[8*7 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
+ data[8*3 + i] = lrintf(postscale[8*2 + i] * (tmp13 + tmp12));
+ data[8*7 + i] = lrintf(postscale[8*6 + i] * (tmp13 - tmp12));
}
}
diff --git a/libavcodec/faandct.h b/libavcodec/faandct.h
index f43b62f168..a12dcaf92f 100644
--- a/libavcodec/faandct.h
+++ b/libavcodec/faandct.h
@@ -31,8 +31,6 @@
#include "dsputil.h"
-#define FAAN_POSTSCALE
-
void ff_faandct(DCTELEM * data);
void ff_faandct248(DCTELEM * data);
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 83c03c3ba8..217461f828 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -573,8 +573,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
av_fifo_generic_write(fpc->fifo_buf, (void*) read_start,
read_end - read_start, NULL);
} else {
- int8_t pad[MAX_FRAME_HEADER_SIZE];
- memset(pad, 0, sizeof(pad));
+ int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 };
av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL);
}
diff --git a/libavcodec/intrax8dsp.c b/libavcodec/intrax8dsp.c
index 692e1b102f..2983f3de63 100644
--- a/libavcodec/intrax8dsp.c
+++ b/libavcodec/intrax8dsp.c
@@ -152,10 +152,8 @@ static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize){
int x,y;
unsigned int p;//power divided by 2
int a;
- uint16_t left_sum[2][8];
- uint16_t top_sum[2][8];
- memset(left_sum,0,2*8*sizeof(uint16_t));
- memset( top_sum,0,2*8*sizeof(uint16_t));
+ uint16_t left_sum[2][8] = { { 0 } };
+ uint16_t top_sum[2][8] = { { 0 } };
for(i=0;i<8;i++){
a=src[area2+7-i]<<4;
diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
index aadea77eb6..2a333c05e8 100644
--- a/libavcodec/jpeglsenc.c
+++ b/libavcodec/jpeglsenc.c
@@ -210,8 +210,7 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, void *last
static void ls_store_lse(JLSState *state, PutBitContext *pb){
/* Test if we have default params and don't need to store LSE */
- JLSState state2;
- memset(&state2, 0, sizeof(JLSState));
+ JLSState state2 = { 0 };
state2.bpp = state->bpp;
state2.near = state->near;
ff_jpegls_reset_coding_parameters(&state2, 1);
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index ce8af649ab..eea5c81a8a 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -251,21 +251,22 @@ static void lag_pred_line(LagarithContext *l, uint8_t *buf,
/* Left prediction only for first line */
L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1,
width - 1, buf[0]);
- return;
- }
- /* Left pixel is actually prev_row[width] */
- L = buf[width - stride - 1];
- if (line == 1) {
- /* Second line, left predict first pixel, the rest of the line is median predicted
- * NOTE: In the case of RGB this pixel is top predicted */
- TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L;
} else {
- /* Top left is 2 rows back, last pixel */
- TL = buf[width - (2 * stride) - 1];
- }
+ /* Left pixel is actually prev_row[width] */
+ L = buf[width - stride - 1];
+
+ if (line == 1) {
+ /* Second line, left predict first pixel, the rest of the line is median predicted
+ * NOTE: In the case of RGB this pixel is top predicted */
+ TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L;
+ } else {
+ /* Top left is 2 rows back, last pixel */
+ TL = buf[width - (2 * stride) - 1];
+ }
- add_lag_median_prediction(buf, buf - stride, buf,
- width, &L, &TL);
+ add_lag_median_prediction(buf, buf - stride, buf,
+ width, &L, &TL);
+ }
}
static int lag_decode_line(LagarithContext *l, lag_rac *rac,
@@ -311,13 +312,13 @@ handle_zeros:
}
static int lag_decode_zero_run_line(LagarithContext *l, uint8_t *dst,
- const uint8_t *src, const uint8_t *srcend, int width,
- int esc_count)
+ const uint8_t *src, const uint8_t *src_end,
+ int width, int esc_count)
{
int i = 0;
int count;
uint8_t zero_run = 0;
- const uint8_t *start = src;
+ const uint8_t *src_start = src;
uint8_t mask1 = -(esc_count < 2);
uint8_t mask2 = -(esc_count < 3);
uint8_t *end = dst + (width - 2);
@@ -334,8 +335,8 @@ output_zeros:
i = 0;
while (!zero_run && dst + i < end) {
i++;
- if (i+2 >= srcend - src)
- return src - start;
+ if (i+2 >= src_end - src)
+ return AVERROR_INVALIDDATA;
zero_run =
!(src[i] | (src[i + 1] & mask1) | (src[i + 2] & mask2));
}
@@ -351,9 +352,10 @@ output_zeros:
} else {
memcpy(dst, src, i);
src += i;
+ dst += i;
}
}
- return src - start;
+ return src - src_start;
}
@@ -369,7 +371,7 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
int esc_count;
GetBitContext gb;
lag_rac rac;
- const uint8_t *srcend = src + src_size;
+ const uint8_t *src_end = src + src_size;
rac.avctx = l->avctx;
l->zeros = 0;
@@ -406,12 +408,16 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
esc_count -= 4;
if (esc_count > 0) {
/* Zero run coding only, no range coding. */
- for (i = 0; i < height; i++)
- src += lag_decode_zero_run_line(l, dst + (i * stride), src, srcend,
- width, esc_count);
+ for (i = 0; i < height; i++) {
+ int res = lag_decode_zero_run_line(l, dst + (i * stride), src,
+ src_end, width, esc_count);
+ if (res < 0)
+ return res;
+ src += res;
+ }
} else {
- if (src_size < height * width)
- return -1;
+ if (src_size < width * height)
+ return AVERROR_INVALIDDATA; // buffer not big enough
/* Plane is stored uncompressed */
for (i = 0; i < height; i++) {
memcpy(dst + (i * stride), src, width);
@@ -518,15 +524,18 @@ static int lag_decode_frame(AVCodecContext *avctx,
}
for (i = 0; i < planes; i++)
srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride;
- for (i = 0; i < planes; i++) {
+ for (i = 0; i < planes; i++)
if (buf_size <= offs[i]) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
+
+ for (i = 0; i < planes; i++)
lag_decode_arith_plane(l, srcs[i],
avctx->width, avctx->height,
-l->rgb_stride, buf + offs[i],
buf_size - offs[i]);
- }
dst = p->data[0];
for (i = 0; i < planes; i++)
srcs[i] = l->rgb_planes + i * l->rgb_stride * avctx->height;
@@ -563,6 +572,14 @@ static int lag_decode_frame(AVCodecContext *avctx,
return AVERROR_INVALIDDATA;
}
+ if (offset_ry >= buf_size ||
+ offset_gu >= buf_size ||
+ offset_bv >= buf_size) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid frame offsets\n");
+ return AVERROR_INVALIDDATA;
+ }
+
lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height,
p->linesize[0], buf + offset_ry,
buf_size - offset_ry);
diff --git a/libavcodec/lagarithrac.c b/libavcodec/lagarithrac.c
index b3ad94189a..9f7bc41ef5 100644
--- a/libavcodec/lagarithrac.c
+++ b/libavcodec/lagarithrac.c
@@ -32,15 +32,17 @@
void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int length)
{
- int i, j;
+ int i, j, left;
/* According to reference decoder "1st byte is garbage",
* however, it gets skipped by the call to align_get_bits()
*/
align_get_bits(gb);
+ left = get_bits_left(gb) >> 3;
l->bytestream_start =
l->bytestream = gb->buffer + get_bits_count(gb) / 8;
- l->bytestream_end = l->bytestream_start + get_bits_left(gb) / 8;
+ l->bytestream_end = l->bytestream_start + left;
+
l->range = 0x80;
l->low = *l->bytestream >> 1;
l->hash_shift = FFMAX(l->scale - 8, 0);
diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index d65e4f2676..d18fc86eb8 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -36,8 +36,8 @@ extern unsigned int xvid_debug;
int ff_xvid_rate_control_init(MpegEncContext *s){
char *tmp_name;
int fd, i;
- xvid_plg_create_t xvid_plg_create;
- xvid_plugin_2pass2_t xvid_2pass2;
+ xvid_plg_create_t xvid_plg_create = { 0 };
+ xvid_plugin_2pass2_t xvid_2pass2 = { 0 };
//xvid_debug=-1;
@@ -67,7 +67,6 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
close(fd);
- memset(&xvid_2pass2, 0, sizeof(xvid_2pass2));
xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0);
xvid_2pass2.filename= tmp_name;
xvid_2pass2.bitrate= s->avctx->bit_rate;
@@ -75,7 +74,6 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
xvid_2pass2.vbv_maxrate= s->avctx->rc_max_rate;
xvid_2pass2.vbv_initial= s->avctx->rc_initial_buffer_occupancy;
- memset(&xvid_plg_create, 0, sizeof(xvid_plg_create));
xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0);
xvid_plg_create.fbase= s->avctx->time_base.den;
xvid_plg_create.fincr= s->avctx->time_base.num;
@@ -89,9 +87,8 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
}
float ff_xvid_rate_estimate_qscale(MpegEncContext *s, int dry_run){
- xvid_plg_data_t xvid_plg_data;
+ xvid_plg_data_t xvid_plg_data = { 0 };
- memset(&xvid_plg_data, 0, sizeof(xvid_plg_data));
xvid_plg_data.version= XVID_MAKE_VERSION(1,1,0);
xvid_plg_data.width = s->width;
xvid_plg_data.height= s->height;
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
index 3bca9456f1..3ec75fe134 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvidff.c
@@ -94,11 +94,11 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
uint16_t *intra, *inter;
int fd;
- xvid_plugin_single_t single;
- struct xvid_ff_pass1 rc2pass1;
- xvid_plugin_2pass2_t rc2pass2;
- xvid_gbl_init_t xvid_gbl_init;
- xvid_enc_create_t xvid_enc_create;
+ xvid_plugin_single_t single = { 0 };
+ struct xvid_ff_pass1 rc2pass1 = { 0 };
+ xvid_plugin_2pass2_t rc2pass2 = { 0 };
+ xvid_gbl_init_t xvid_gbl_init = { 0 };
+ xvid_enc_create_t xvid_enc_create = { 0 };
xvid_enc_plugin_t plugins[7];
/* Bring in VOP flags from ffmpeg command-line */
@@ -168,7 +168,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
x->me_flags |= XVID_ME_QUARTERPELREFINE8;
}
- memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));
xvid_gbl_init.version = XVID_VERSION;
xvid_gbl_init.debug = 0;
@@ -189,7 +188,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL);
/* Create the encoder reference */
- memset(&xvid_enc_create, 0, sizeof(xvid_enc_create));
xvid_enc_create.version = XVID_VERSION;
/* Store the desired frame size */
@@ -214,7 +212,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
x->twopassfile = NULL;
if( xvid_flags & CODEC_FLAG_PASS1 ) {
- memset(&rc2pass1, 0, sizeof(struct xvid_ff_pass1));
rc2pass1.version = XVID_VERSION;
rc2pass1.context = x;
x->twopassbuffer = av_malloc(BUFFER_SIZE);
@@ -230,7 +227,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
plugins[xvid_enc_create.num_plugins].param = &rc2pass1;
xvid_enc_create.num_plugins++;
} else if( xvid_flags & CODEC_FLAG_PASS2 ) {
- memset(&rc2pass2, 0, sizeof(xvid_plugin_2pass2_t));
rc2pass2.version = XVID_VERSION;
rc2pass2.bitrate = avctx->bit_rate;
@@ -262,7 +258,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
xvid_enc_create.num_plugins++;
} else if( !(xvid_flags & CODEC_FLAG_QSCALE) ) {
/* Single Pass Bitrate Control! */
- memset(&single, 0, sizeof(xvid_plugin_single_t));
single.version = XVID_VERSION;
single.bitrate = avctx->bit_rate;
@@ -382,16 +377,14 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int mb_width = (avctx->width + 15) / 16;
int mb_height = (avctx->height + 15) / 16;
- xvid_enc_frame_t xvid_enc_frame;
- xvid_enc_stats_t xvid_enc_stats;
+ xvid_enc_frame_t xvid_enc_frame = { 0 };
+ xvid_enc_stats_t xvid_enc_stats = { 0 };
if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0)
return ret;
/* Start setting up the frame */
- memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame));
xvid_enc_frame.version = XVID_VERSION;
- memset(&xvid_enc_stats, 0, sizeof(xvid_enc_stats));
xvid_enc_stats.version = XVID_VERSION;
*p = *picture;
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 70798fd478..d369518e69 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -47,14 +47,13 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table,
const uint8_t *val_table, int nb_codes,
int use_static, int is_ac)
{
- uint8_t huff_size[256];
+ uint8_t huff_size[256] = { 0 };
uint16_t huff_code[256];
uint16_t huff_sym[256];
int i;
assert(nb_codes <= 256);
- memset(huff_size, 0, sizeof(huff_size));
ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table);
for (i = 0; i < 256; i++)
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index ad6395296e..2708a1e467 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1435,9 +1435,8 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y)
#define HASH(fx,fy,bx,by) ((fx)+17*(fy)+63*(bx)+117*(by))
#define HASH8(fx,fy,bx,by) ((uint8_t)HASH(fx,fy,bx,by))
int hashidx= HASH(motion_fx,motion_fy, motion_bx, motion_by);
- uint8_t map[256];
+ uint8_t map[256] = { 0 };
- memset(map,0,sizeof(map));
map[hashidx&255] = 1;
fbmin= check_bidir_mv(s, motion_fx, motion_fy,
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 51db72a177..c2d8dd5cf6 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -304,11 +304,8 @@ static av_cold void decode_init_static(void)
for (i = 1; i < 16; i++) {
const HuffTable *h = &mpa_huff_tables[i];
int xsize, x, y;
- uint8_t tmp_bits [512];
- uint16_t tmp_codes[512];
-
- memset(tmp_bits , 0, sizeof(tmp_bits ));
- memset(tmp_codes, 0, sizeof(tmp_codes));
+ uint8_t tmp_bits [512] = { 0 };
+ uint16_t tmp_codes[512] = { 0 };
xsize = h->xsize;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 79ebaf087e..17a2512554 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -80,11 +80,8 @@ void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64],
for (qscale = qmin; qscale <= qmax; qscale++) {
int i;
if (dsp->fdct == ff_jpeg_fdct_islow_8 ||
- dsp->fdct == ff_jpeg_fdct_islow_10
-#ifdef FAAN_POSTSCALE
- || dsp->fdct == ff_faandct
-#endif
- ) {
+ dsp->fdct == ff_jpeg_fdct_islow_10 ||
+ dsp->fdct == ff_faandct) {
for (i = 0; i < 64; i++) {
const int j = dsp->idct_permutation[i];
/* 16 <= qscale * quant_matrix[i] <= 7905
@@ -96,11 +93,7 @@ void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64],
qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) /
(qscale * quant_matrix[j]));
}
- } else if (dsp->fdct == ff_fdct_ifast
-#ifndef FAAN_POSTSCALE
- || dsp->fdct == ff_faandct
-#endif
- ) {
+ } else if (dsp->fdct == ff_fdct_ifast) {
for (i = 0; i < 64; i++) {
const int j = dsp->idct_permutation[i];
/* 16 <= qscale * quant_matrix[i] <= 7905
@@ -138,11 +131,7 @@ void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64],
for (i = intra; i < 64; i++) {
int64_t max = 8191;
- if (dsp->fdct == ff_fdct_ifast
-#ifndef FAAN_POSTSCALE
- || dsp->fdct == ff_faandct
-#endif
- ) {
+ if (dsp->fdct == ff_fdct_ifast) {
max = (8191LL * ff_aanscales[i]) >> 14;
}
while (((max * qmat[qscale][i]) >> shift) > INT_MAX) {
@@ -3516,11 +3505,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
int dct_coeff= FFABS(block[ scantable[i] ]);
int best_score=256*256*256*120;
- if ( s->dsp.fdct == ff_fdct_ifast
-#ifndef FAAN_POSTSCALE
- || s->dsp.fdct == ff_faandct
-#endif
- )
+ if (s->dsp.fdct == ff_fdct_ifast)
dct_coeff= (dct_coeff*ff_inv_aanscales[ scantable[i] ]) >> 12;
zero_distortion= dct_coeff*dct_coeff;
diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c
index 9d74380cc6..6c08a70cd2 100644
--- a/libavcodec/ra144enc.c
+++ b/libavcodec/ra144enc.c
@@ -342,7 +342,7 @@ static void ra144_encode_subblock(RA144Context *ractx,
const int16_t *lpc_coefs, unsigned int rms,
PutBitContext *pb)
{
- float data[BLOCKSIZE], work[LPC_ORDER + BLOCKSIZE];
+ float data[BLOCKSIZE] = { 0 }, work[LPC_ORDER + BLOCKSIZE];
float coefs[LPC_ORDER];
float zero[BLOCKSIZE], cba[BLOCKSIZE], cb1[BLOCKSIZE], cb2[BLOCKSIZE];
int16_t cba_vect[BLOCKSIZE];
@@ -360,7 +360,6 @@ static void ra144_encode_subblock(RA144Context *ractx,
* Calculate the zero-input response of the LPC filter and subtract it from
* input data.
*/
- memset(data, 0, sizeof(data));
ff_celp_lp_synthesis_filterf(work + LPC_ORDER, coefs, data, BLOCKSIZE,
LPC_ORDER);
for (i = 0; i < BLOCKSIZE; i++) {
diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c
index 04c2738523..ef9a0906b5 100644
--- a/libavcodec/rangecoder.c
+++ b/libavcodec/rangecoder.c
@@ -119,7 +119,7 @@ int main(void){
uint8_t b[9*SIZE];
uint8_t r[9*SIZE];
int i;
- uint8_t state[10]= {0};
+ uint8_t state[10];
AVLFG prng;
av_lfg_init(&prng, 1);
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 235b3ed0bc..afde77b93f 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -554,7 +554,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
MpegEncContext *s = &r->s;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
- int A[2], B[2], C[2];
+ int A[2] = { 0 }, B[2] = { 0 }, C[2] = { 0 };
int has_A = 0, has_B = 0, has_C = 0;
int mx, my;
int i, j;
@@ -562,9 +562,6 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0;
int type = cur_pic->f.mb_type[mb_pos];
- memset(A, 0, sizeof(A));
- memset(B, 0, sizeof(B));
- memset(C, 0, sizeof(C));
if((r->avail_cache[6-1] & type) & mask){
A[0] = cur_pic->f.motion_val[dir][mv_pos - 1][0];
A[1] = cur_pic->f.motion_val[dir][mv_pos - 1][1];
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 04994b2d0c..d2f9df09c7 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -180,7 +180,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
int res;
HuffContext huff;
HuffContext tmp1, tmp2;
- VLC vlc[2];
+ VLC vlc[2] = { { 0 } };
int escapes[3];
DBCtx ctx;
int err = 0;
@@ -204,9 +204,6 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
tmp2.lengths = av_mallocz(256 * sizeof(int));
tmp2.values = av_mallocz(256 * sizeof(int));
- memset(&vlc[0], 0, sizeof(VLC));
- memset(&vlc[1], 0, sizeof(VLC));
-
if(get_bits1(gb)) {
smacker_decode_tree(gb, &tmp1, 0, 0);
skip_bits1(gb);
@@ -597,8 +594,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
GetBitContext gb;
- HuffContext h[4];
- VLC vlc[4];
+ HuffContext h[4] = { { 0 } };
+ VLC vlc[4] = { { 0 } };
int16_t *samples;
uint8_t *samples8;
int val;
@@ -641,8 +638,6 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
samples = (int16_t *)s->frame.data[0];
samples8 = s->frame.data[0];
- memset(vlc, 0, sizeof(VLC) * 4);
- memset(h, 0, sizeof(HuffContext) * 4);
// Initialize
for(i = 0; i < (1 << (bits + stereo)); i++) {
h[i].length = 256;
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 28bae611c1..e2ea1d3d31 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -82,10 +82,9 @@ static unsigned tget(const uint8_t **p, int type, int le) {
#if CONFIG_ZLIB
static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src, int size)
{
- z_stream zstream;
+ z_stream zstream = { 0 };
int zret;
- memset(&zstream, 0, sizeof(zstream));
zstream.next_in = src;
zstream.avail_in = size;
zstream.next_out = dst;
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index 767eced913..334d6bde47 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -310,7 +310,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
int width_shift = 0;
int new_pix_fmt;
struct frame_header header;
- uint8_t header_buffer[128]; /* logical maximum size of the header */
+ uint8_t header_buffer[128] = { 0 }; /* logical maximum size of the header */
const uint8_t *sel_vector_table;
header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
@@ -321,7 +321,6 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
}
/* unscramble the header bytes with a XOR operation */
- memset(header_buffer, 0, 128);
for (i = 1; i < header.header_size; i++)
header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1];
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index af676f171a..4f17a18694 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -903,6 +903,7 @@ static int decode_subframe(WmallDecodeCtx *s)
} else if (!s->cdlms[0][0].order) {
av_log(s->avctx, AV_LOG_DEBUG,
"Waiting for seekable tile\n");
+ s->frame.nb_samples = 0;
return -1;
}
@@ -1265,6 +1266,17 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
return (s->packet_loss) ? AVERROR_INVALIDDATA : get_bits_count(gb) >> 3;
}
+static void flush(AVCodecContext *avctx)
+{
+ WmallDecodeCtx *s = avctx->priv_data;
+ s->packet_loss = 1;
+ s->packet_done = 0;
+ s->num_saved_bits = 0;
+ s->frame_offset = 0;
+ s->next_packet_start = 0;
+ s->cdlms[0][0].order = 0;
+ s->frame.nb_samples = 0;
+}
AVCodec ff_wmalossless_decoder = {
.name = "wmalossless",
@@ -1273,6 +1285,7 @@ AVCodec ff_wmalossless_decoder = {
.priv_data_size = sizeof(WmallDecodeCtx),
.init = decode_init,
.decode = decode_packet,
+ .flush = flush,
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"),
};
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 5440d64241..287c598373 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -521,7 +521,7 @@ static int decode_subframe_length(WMAProDecodeCtx *s, int offset)
*/
static int decode_tilehdr(WMAProDecodeCtx *s)
{
- uint16_t num_samples[WMAPRO_MAX_CHANNELS]; /**< sum of samples for all currently known subframes of a channel */
+ uint16_t num_samples[WMAPRO_MAX_CHANNELS] = { 0 };/**< sum of samples for all currently known subframes of a channel */
uint8_t contains_subframe[WMAPRO_MAX_CHANNELS]; /**< flag indicating if a channel contains the current subframe */
int channels_for_cur_subframe = s->num_channels; /**< number of channels that contain the current subframe */
int fixed_channel_layout = 0; /**< flag indicating that all channels use the same subframe offsets and sizes */
@@ -538,8 +538,6 @@ static int decode_tilehdr(WMAProDecodeCtx *s)
for (c = 0; c < s->num_channels; c++)
s->channel[c].num_subframes = 0;
- memset(num_samples, 0, sizeof(num_samples));
-
if (s->max_num_subframes == 1 || get_bits1(&s->gb))
fixed_channel_layout = 1;
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 66c0ce40d3..48b79014a6 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -318,10 +318,9 @@ static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
0x0ffc, 0x0ffd, 0x0ffe, // 1111111111+00/01/10
0x3ffc, 0x3ffd, 0x3ffe, 0x3fff // 111111111111+xx
};
- int cntr[8], n, res;
+ int cntr[8] = { 0 }, n, res;
memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25);
- memset(cntr, 0, sizeof(cntr));
for (n = 0; n < 17; n++) {
res = get_bits(gb, 3);
if (cntr[res] > 3) // should be >= 3 + (res == 7))
diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
index 2bb0be6374..0c4419b4f3 100644
--- a/libavcodec/x86/cabac.h
+++ b/libavcodec/x86/cabac.h
@@ -27,7 +27,7 @@
#include "config.h"
#if HAVE_FAST_CMOV
-#define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp)\
+#define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, range, tmp)\
"mov "tmp" , %%ecx \n\t"\
"shl $17 , "tmp" \n\t"\
"cmp "low" , "tmp" \n\t"\
@@ -37,7 +37,7 @@
"xor %%ecx , "ret" \n\t"\
"sub "tmp" , "low" \n\t"
#else /* HAVE_FAST_CMOV */
-#define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp)\
+#define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, range, tmp)\
"mov "tmp" , %%ecx \n\t"\
"shl $17 , "tmp" \n\t"\
"sub "low" , "tmp" \n\t"\
@@ -51,20 +51,20 @@
"xor "tmp" , "ret" \n\t"
#endif /* HAVE_FAST_CMOV */
-#define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, tmpbyte, byte) \
+#define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, tmpbyte, byte, end) \
"movzbl "statep" , "ret" \n\t"\
"mov "range" , "tmp" \n\t"\
"and $0xC0 , "range" \n\t"\
"movzbl "MANGLE(ff_h264_lps_range)"("ret", "range", 2), "range" \n\t"\
"sub "range" , "tmp" \n\t"\
- BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp) \
+ BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, range, tmp) \
"movzbl " MANGLE(ff_h264_norm_shift) "("range"), %%ecx \n\t"\
"shl %%cl , "range" \n\t"\
"movzbl "MANGLE(ff_h264_mlps_state)"+128("ret"), "tmp" \n\t"\
"shl %%cl , "low" \n\t"\
"mov "tmpbyte" , "statep" \n\t"\
"test "lowword" , "lowword" \n\t"\
- " jnz 1f \n\t"\
+ " jnz 2f \n\t"\
"mov "byte" , %%"REG_c" \n\t"\
"add"OPSIZE" $2 , "byte" \n\t"\
"movzwl (%%"REG_c") , "tmp" \n\t"\
@@ -79,7 +79,7 @@
"add $7 , %%ecx \n\t"\
"shl %%cl , "tmp" \n\t"\
"add "tmp" , "low" \n\t"\
- "1: \n\t"
+ "2: \n\t"
#if HAVE_7REGS && !defined(BROKEN_RELOCATIONS) && !(defined(__i386) && defined(__clang__) && (__clang_major__<2 || (__clang_major__==2 && __clang_minor__<10)))\
@@ -91,11 +91,13 @@ static av_always_inline int get_cabac_inline_x86(CABACContext *c,
int bit, tmp;
__asm__ volatile(
- BRANCHLESS_GET_CABAC("%0", "(%5)", "%1", "%w1", "%2",
- "%3", "%b3", "%4")
- :"=&r"(bit), "+&r"(c->low), "+&r"(c->range), "=&q"(tmp),
- "+m"(c->bytestream)
- :"r"(state)
+ BRANCHLESS_GET_CABAC("%0", "(%4)", "%1", "%w1",
+ "%2", "%3", "%b3",
+ "%a6(%5)", "%a7(%5)")
+ : "=&r"(bit), "+&r"(c->low), "+&r"(c->range), "=&q"(tmp)
+ : "r"(state), "r"(c),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end))
: "%"REG_c, "memory"
);
return bit & 1;
@@ -107,32 +109,36 @@ static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val)
{
x86_reg tmp;
__asm__ volatile(
- "movl %4, %k1 \n\t"
- "movl %2, %%eax \n\t"
- "shl $17, %k1 \n\t"
- "add %%eax, %%eax \n\t"
- "sub %k1, %%eax \n\t"
- "cltd \n\t"
- "and %%edx, %k1 \n\t"
- "add %k1, %%eax \n\t"
- "xor %%edx, %%ecx \n\t"
- "sub %%edx, %%ecx \n\t"
- "test %%ax, %%ax \n\t"
- " jnz 1f \n\t"
- "mov %3, %1 \n\t"
- "subl $0xFFFF, %%eax \n\t"
- "movzwl (%1), %%edx \n\t"
- "bswap %%edx \n\t"
- "shrl $15, %%edx \n\t"
- "add $2, %1 \n\t"
- "addl %%edx, %%eax \n\t"
- "mov %1, %3 \n\t"
- "1: \n\t"
- "movl %%eax, %2 \n\t"
+ "movl %a6(%2), %k1 \n\t"
+ "movl %a3(%2), %%eax \n\t"
+ "shl $17, %k1 \n\t"
+ "add %%eax, %%eax \n\t"
+ "sub %k1, %%eax \n\t"
+ "cltd \n\t"
+ "and %%edx, %k1 \n\t"
+ "add %k1, %%eax \n\t"
+ "xor %%edx, %%ecx \n\t"
+ "sub %%edx, %%ecx \n\t"
+ "test %%ax, %%ax \n\t"
+ "jnz 1f \n\t"
+ "mov %a4(%2), %1 \n\t"
+ "subl $0xFFFF, %%eax \n\t"
+ "movzwl (%1), %%edx \n\t"
+ "bswap %%edx \n\t"
+ "shrl $15, %%edx \n\t"
+ "add $2, %1 \n\t"
+ "addl %%edx, %%eax \n\t"
+ "mov %1, %a4(%2) \n\t"
+ "1: \n\t"
+ "movl %%eax, %a3(%2) \n\t"
- :"+c"(val), "=&r"(tmp), "+m"(c->low), "+m"(c->bytestream)
- :"m"(c->range)
- : "%eax", "%edx"
+ : "+c"(val), "=&r"(tmp)
+ : "r"(c),
+ "i"(offsetof(CABACContext, low)),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end)),
+ "i"(offsetof(CABACContext, range))
+ : "%eax", "%edx", "memory"
);
return val;
}
diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h
index 510f726ba1..6aa2d073e3 100644
--- a/libavcodec/x86/h264_i386.h
+++ b/libavcodec/x86/h264_i386.h
@@ -46,17 +46,19 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
int bit;
x86_reg coeff_count;
__asm__ volatile(
- "2: \n\t"
+ "3: \n\t"
- BRANCHLESS_GET_CABAC("%4", "(%1)", "%3",
- "%w3", "%5", "%k0", "%b0", "%6")
+ BRANCHLESS_GET_CABAC("%4", "(%1)", "%3", "%w3",
+ "%5", "%k0", "%b0",
+ "%a11(%6)", "%a12(%6)")
"test $1, %4 \n\t"
- " jz 3f \n\t"
+ " jz 4f \n\t"
"add %10, %1 \n\t"
- BRANCHLESS_GET_CABAC("%4", "(%1)", "%3",
- "%w3", "%5", "%k0", "%b0", "%6")
+ BRANCHLESS_GET_CABAC("%4", "(%1)", "%3", "%w3",
+ "%5", "%k0", "%b0",
+ "%a11(%6)", "%a12(%6)")
"sub %10, %1 \n\t"
"mov %2, %0 \n\t"
@@ -65,25 +67,26 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
"movl %%ecx, (%0) \n\t"
"test $1, %4 \n\t"
- " jnz 4f \n\t"
+ " jnz 5f \n\t"
"add"OPSIZE" $4, %2 \n\t"
- "3: \n\t"
+ "4: \n\t"
"add $1, %1 \n\t"
"cmp %8, %1 \n\t"
- " jb 2b \n\t"
+ " jb 3b \n\t"
"mov %2, %0 \n\t"
"movl %7, %%ecx \n\t"
"add %1, %%"REG_c" \n\t"
"movl %%ecx, (%0) \n\t"
- "4: \n\t"
+ "5: \n\t"
"add %9, %k0 \n\t"
"shr $2, %k0 \n\t"
- :"=&q"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index),
- "+&r"(c->low), "=&r"(bit), "+&r"(c->range),
- "+m"(c->bytestream)
- :"m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off)
+ : "=&q"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index),
+ "+&r"(c->low), "=&r"(bit), "+&r"(c->range)
+ : "r"(c), "m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end))
: "%"REG_c, "memory"
);
return coeff_count;
@@ -99,47 +102,52 @@ static int decode_significance_8x8_x86(CABACContext *c,
x86_reg state;
__asm__ volatile(
"mov %1, %6 \n\t"
- "2: \n\t"
+ "3: \n\t"
"mov %10, %0 \n\t"
"movzbl (%0, %6), %k6 \n\t"
"add %9, %6 \n\t"
- BRANCHLESS_GET_CABAC("%4", "(%6)", "%3",
- "%w3", "%5", "%k0", "%b0", "%7")
+ BRANCHLESS_GET_CABAC("%4", "(%6)", "%3", "%w3",
+ "%5", "%k0", "%b0",
+ "%a12(%7)", "%a13(%7)")
"mov %1, %k6 \n\t"
"test $1, %4 \n\t"
- " jz 3f \n\t"
+ " jz 4f \n\t"
"movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%k6), %k6\n\t"
"add %11, %6 \n\t"
- BRANCHLESS_GET_CABAC("%4", "(%6)", "%3",
- "%w3", "%5", "%k0", "%b0", "%7")
+ BRANCHLESS_GET_CABAC("%4", "(%6)", "%3", "%w3",
+ "%5", "%k0", "%b0",
+ "%a12(%7)", "%a13(%7)")
"mov %2, %0 \n\t"
"mov %1, %k6 \n\t"
"movl %k6, (%0) \n\t"
"test $1, %4 \n\t"
- " jnz 4f \n\t"
+ " jnz 5f \n\t"
"add"OPSIZE" $4, %2 \n\t"
- "3: \n\t"
+ "4: \n\t"
"addl $1, %k6 \n\t"
"mov %k6, %1 \n\t"
"cmpl $63, %k6 \n\t"
- " jb 2b \n\t"
+ " jb 3b \n\t"
"mov %2, %0 \n\t"
"movl %k6, (%0) \n\t"
- "4: \n\t"
+ "5: \n\t"
"addl %8, %k0 \n\t"
"shr $2, %k0 \n\t"
- :"=&q"(coeff_count),"+m"(last), "+m"(index), "+&r"(c->low), "=&r"(bit),
- "+&r"(c->range), "=&r"(state), "+m"(c->bytestream)
- :"m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off), "m"(last_coeff_ctx_base)
+ : "=&q"(coeff_count), "+m"(last), "+m"(index), "+&r"(c->low),
+ "=&r"(bit), "+&r"(c->range), "=&r"(state)
+ : "r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base),
+ "m"(sig_off), "m"(last_coeff_ctx_base),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end))
: "%"REG_c, "memory"
);
return coeff_count;
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 9c97dafa84..c0a6cd74ce 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -102,7 +102,7 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
long ioctl_frequency;
char *arg;
int c;
- struct sigaction act, old;
+ struct sigaction act = { 0 }, old;
if (idev < 0 || idev > 4)
{
@@ -131,7 +131,6 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
frequency = 0.0;
}
- memset(&act, 0, sizeof(act));
sigemptyset(&act.sa_mask);
act.sa_handler = catchsignal;
sigaction(SIGUSR1, &act, &old);
diff --git a/libavformat/asfcrypt.c b/libavformat/asfcrypt.c
index 750758d822..6a51c0426e 100644
--- a/libavformat/asfcrypt.c
+++ b/libavformat/asfcrypt.c
@@ -140,7 +140,7 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
struct AVRC4 rc4;
int num_qwords = len >> 3;
uint8_t *qwords = data;
- uint64_t rc4buff[8];
+ uint64_t rc4buff[8] = { 0 };
uint64_t packetkey;
uint32_t ms_keys[12];
uint64_t ms_state;
@@ -151,7 +151,6 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
return;
}
- memset(rc4buff, 0, sizeof(rc4buff));
av_rc4_init(&rc4, key, 12 * 8, 1);
av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1);
multiswap_init((uint8_t *)rc4buff, ms_keys);
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 2adb1780c4..f447c38bf3 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1249,7 +1249,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
last_pos=pos;
}
}
- asf->index_read= 1;
+ asf->index_read= ict > 0;
}
avio_seek(s->pb, current_pos, SEEK_SET);
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f0b606e0fc..7c1c559d7e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1021,7 +1021,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
- char compressor_name[32];
+ char compressor_name[32] = { 0 };
avio_wb32(pb, 0); /* size */
avio_wl32(pb, track->tag); // store it byteswapped
@@ -1052,7 +1052,6 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, 0); /* Data size (= 0) */
avio_wb16(pb, 1); /* Frame count (= 1) */
- memset(compressor_name,0,32);
/* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
av_strlcpy(compressor_name,track->enc->codec->name,32);
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index 015a376755..d852c26152 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -60,6 +60,7 @@ flac_header (AVFormatContext * s, int idx)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_FLAC;
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
st->codec->extradata =
av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index a6cfd3af4a..9961b5a33c 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -157,8 +157,7 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
{
- struct addrinfo hints, *ai = NULL;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo(buf, NULL, &hints, &ai))
return -1;
@@ -497,9 +496,8 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
* The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
* in rtpdec_xiph.c. */
char buf[16384], *q;
- SDPParseState sdp_parse_state, *s1 = &sdp_parse_state;
+ SDPParseState sdp_parse_state = { { 0 } }, *s1 = &sdp_parse_state;
- memset(s1, 0, sizeof(SDPParseState));
p = content;
for (;;) {
p += strspn(p, SPACE_CHARS);
@@ -1950,7 +1948,7 @@ static int rtp_read_header(AVFormatContext *s)
int ret, port;
URLContext* in = NULL;
int payload_type;
- AVCodecContext codec;
+ AVCodecContext codec = { 0 };
struct sockaddr_storage addr;
AVIOContext pb;
socklen_t addrlen = sizeof(addr);
@@ -1991,7 +1989,6 @@ static int rtp_read_header(AVFormatContext *s)
ffurl_close(in);
in = NULL;
- memset(&codec, 0, sizeof(codec));
if (ff_rtp_get_codec_info(&codec, payload_type)) {
av_log(s, AV_LOG_ERROR, "Unable to receive RTP payload type %d "
"without an SDP file describing it\n",
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index 8a2a193b8e..cd7a46ef45 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -104,8 +104,7 @@ static int sap_write_header(AVFormatContext *s)
}
if (!announce_addr[0]) {
- struct addrinfo hints, *ai = NULL;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_family = AF_UNSPEC;
if (getaddrinfo(host, NULL, &hints, &ai)) {
av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host);
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 77b8945a25..caa661bbc2 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -88,7 +88,7 @@ static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
static int resolve_destination(char *dest_addr, int size, char *type,
int type_size)
{
- struct addrinfo hints, *ai;
+ struct addrinfo hints = { 0 }, *ai;
int is_multicast;
av_strlcpy(type, "IP4", type_size);
@@ -98,7 +98,6 @@ static int resolve_destination(char *dest_addr, int size, char *type,
/* Resolve the destination, since it must be written
* as a numeric IP address in the SDP. */
- memset(&hints, 0, sizeof(hints));
if (getaddrinfo(dest_addr, NULL, &hints, &ai))
return 0;
getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size,
@@ -581,12 +580,11 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
{
AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
- struct sdp_session_level s;
+ struct sdp_session_level s = { 0 };
int i, j, port, ttl, is_multicast;
char dst[32], dst_type[5];
memset(buf, 0, size);
- memset(&s, 0, sizeof(struct sdp_session_level));
s.user = "-";
s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */
s.src_type = "IP4";
diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c
index 9d7575d39e..2750836006 100644
--- a/libavformat/seek-test.c
+++ b/libavformat/seek-test.c
@@ -92,11 +92,10 @@ int main(int argc, char **argv)
}
for(i=0; ; i++){
- AVPacket pkt;
+ AVPacket pkt = { 0 };
AVStream *av_uninit(st);
char ts_buf[60];
- memset(&pkt, 0, sizeof(pkt));
if(ret>=0){
ret= av_read_frame(ic, &pkt);
if(ret>=0){
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 4eaf0a02b4..fa88467164 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -37,7 +37,7 @@ typedef struct TCPContext {
/* return non zero if error */
static int tcp_open(URLContext *h, const char *uri, int flags)
{
- struct addrinfo hints, *ai, *cur_ai;
+ struct addrinfo hints = { 0 }, *ai, *cur_ai;
int port, fd = -1;
TCPContext *s = h->priv_data;
int listen_socket = 0;
@@ -62,7 +62,6 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
timeout = strtol(buf, NULL, 10);
}
}
- memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf(portstr, sizeof(portstr), "%d", port);
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 5ab14f2230..9387e218d0 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -161,7 +161,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
static struct addrinfo* udp_resolve_host(const char *hostname, int port,
int type, int family, int flags)
{
- struct addrinfo hints, *res = 0;
+ struct addrinfo hints = { 0 }, *res = 0;
int error;
char sport[16];
const char *node = 0, *service = "0";
@@ -173,7 +173,6 @@ static struct addrinfo* udp_resolve_host(const char *hostname, int port,
if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
node = hostname;
}
- memset(&hints, 0, sizeof(hints));
hints.ai_socktype = type;
hints.ai_family = family;
hints.ai_flags = flags;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0f8b940566..7e64cf6a9f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4073,7 +4073,7 @@ int ff_url_join(char *str, int size, const char *proto,
int port, const char *fmt, ...)
{
#if CONFIG_NETWORK
- struct addrinfo hints, *ai;
+ struct addrinfo hints = { 0 }, *ai;
#endif
str[0] = '\0';
@@ -4084,7 +4084,6 @@ int ff_url_join(char *str, int size, const char *proto,
#if CONFIG_NETWORK && defined(AF_INET6)
/* Determine if hostname is a numerical IPv6 address,
* properly escape it within [] in that case. */
- memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
if (!getaddrinfo(hostname, NULL, &hints, &ai)) {
if (ai->ai_family == AF_INET6) {
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index f45c373eae..75642d1913 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -101,12 +101,10 @@ int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
uint8_t *ptr, const int linesizes[4])
{
- int i, total_size, size[4], has_plane[4];
+ int i, total_size, size[4] = { 0 }, has_plane[4] = { 0 };
const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
memset(data , 0, sizeof(data[0])*4);
- memset(size , 0, sizeof(size));
- memset(has_plane, 0, sizeof(has_plane));
if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
return AVERROR(EINVAL);
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 802931dd2e..7127afee8e 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -517,7 +517,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
{
const char *p;
int64_t t;
- struct tm dt;
+ struct tm dt = { 0 };
int i;
static const char * const date_fmt[] = {
"%Y-%m-%d",
@@ -542,8 +542,6 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
lastch = '\0';
is_utc = (lastch == 'z' || lastch == 'Z');
- memset(&dt, 0, sizeof(dt));
-
p = timestr;
q = NULL;
if (!duration) {
diff --git a/tests/fate/video.mak b/tests/fate/video.mak
index 02aa39598c..c790fd4e7c 100644
--- a/tests/fate/video.mak
+++ b/tests/fate/video.mak
@@ -127,6 +127,9 @@ fate-iff-ilbm: CMD = framecrc -i $(SAMPLES)/iff/lms-matriks.ilbm -pix_fmt rgb24
FATE_VIDEO += $(FATE_IFF)
fate-iff: $(FATE_IFF)
+FATE_VIDEO += fate-kgv1
+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
diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index 1560fe9d68..d7b2f22dd3 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -38,6 +38,10 @@ $(foreach N,$(VP8_SUITE),$(eval $(call FATE_VP8_SUITE,$(N),$(1),$(2))))
FATE_VP8 += fate-vp8-sign-bias$(1)
fate-vp8-sign-bias$(1): CMD = framemd5 $(2) -i $(SAMPLES)/vp8/sintel-signbias.ivf
fate-vp8-sign-bias$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-sign-bias
+
+FATE_VP8 += fate-vp8-size-change$(1)
+fate-vp8-size-change$(1): CMD = framemd5 $(2) -i $(SAMPLES)/vp8/frame_size_change.webm -frames:v 30
+fate-vp8-size-change$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-size-change
endef
$(eval $(call FATE_VP8_FULL))
diff --git a/tests/ref/fate/kgv1 b/tests/ref/fate/kgv1
new file mode 100644
index 0000000000..6f35893f83
--- /dev/null
+++ b/tests/ref/fate/kgv1
@@ -0,0 +1,314 @@
+#tb 0: 1/60
+0, 0, 0, 1, 153600, 0x00000000
+0, 1, 1, 1, 153600, 0x00000000
+0, 2, 2, 1, 153600, 0x00000000
+0, 3, 3, 1, 153600, 0x00000000
+0, 4, 4, 1, 153600, 0x00000000
+0, 5, 5, 1, 153600, 0x00000000
+0, 6, 6, 1, 153600, 0x00000000
+0, 7, 7, 1, 153600, 0x00000000
+0, 8, 8, 1, 153600, 0x00000000
+0, 9, 9, 1, 153600, 0x00000000
+0, 10, 10, 1, 153600, 0x00000000
+0, 11, 11, 1, 153600, 0x00000000
+0, 12, 12, 1, 153600, 0x00000000
+0, 13, 13, 1, 153600, 0x00000000
+0, 14, 14, 1, 153600, 0x00000000
+0, 15, 15, 1, 153600, 0x00000000
+0, 16, 16, 1, 153600, 0x00000000
+0, 17, 17, 1, 153600, 0x00000000
+0, 18, 18, 1, 153600, 0x00000000
+0, 19, 19, 1, 153600, 0x00000000
+0, 20, 20, 1, 153600, 0x00000000
+0, 21, 21, 1, 153600, 0x00000000
+0, 22, 22, 1, 153600, 0x00000000
+0, 23, 23, 1, 153600, 0x00000000
+0, 24, 24, 1, 153600, 0x00000000
+0, 25, 25, 1, 153600, 0x00000000
+0, 26, 26, 1, 153600, 0x00000000
+0, 27, 27, 1, 153600, 0x00000000
+0, 28, 28, 1, 153600, 0x00000000
+0, 29, 29, 1, 153600, 0x00000000
+0, 30, 30, 1, 153600, 0x00000000
+0, 31, 31, 1, 153600, 0x00000000
+0, 32, 32, 1, 153600, 0x00000000
+0, 33, 33, 1, 153600, 0x00000000
+0, 34, 34, 1, 153600, 0x00000000
+0, 35, 35, 1, 153600, 0x00000000
+0, 36, 36, 1, 153600, 0x00000000
+0, 37, 37, 1, 153600, 0x00000000
+0, 38, 38, 1, 153600, 0x00000000
+0, 39, 39, 1, 153600, 0x00000000
+0, 40, 40, 1, 153600, 0x00000000
+0, 41, 41, 1, 153600, 0x00000000
+0, 42, 42, 1, 153600, 0x00000000
+0, 43, 43, 1, 153600, 0x00000000
+0, 44, 44, 1, 153600, 0x00000000
+0, 45, 45, 1, 153600, 0x00000000
+0, 46, 46, 1, 153600, 0x00000000
+0, 47, 47, 1, 153600, 0xab738fc1
+0, 48, 48, 1, 153600, 0x520c9bd3
+0, 49, 49, 1, 153600, 0x19347233
+0, 50, 50, 1, 153600, 0x9e81fe64
+0, 51, 51, 1, 153600, 0x75be7504
+0, 52, 52, 1, 153600, 0x29374d04
+0, 53, 53, 1, 153600, 0xc6b92fd4
+0, 54, 54, 1, 153600, 0xeeec5124
+0, 55, 55, 1, 153600, 0x2fc36324
+0, 56, 56, 1, 153600, 0x112580f4
+0, 57, 57, 1, 153600, 0x177b9a84
+0, 58, 58, 1, 153600, 0x214abb44
+0, 59, 59, 1, 153600, 0x83580173
+0, 60, 60, 1, 153600, 0x95f49284
+0, 61, 61, 1, 153600, 0xe31c5984
+0, 62, 62, 1, 153600, 0xf1756984
+0, 63, 63, 1, 153600, 0x6c004804
+0, 64, 64, 1, 153600, 0xbe6631b4
+0, 65, 65, 1, 153600, 0x1d910494
+0, 66, 66, 1, 153600, 0xd8ecfc25
+0, 67, 67, 1, 153600, 0xdd281364
+0, 68, 68, 1, 153600, 0x52545084
+0, 69, 69, 1, 153600, 0xfed6b944
+0, 70, 70, 1, 153600, 0x6e0b7ee4
+0, 71, 71, 1, 153600, 0x516a5724
+0, 72, 72, 1, 153600, 0xaffd7844
+0, 73, 73, 1, 153600, 0x5a304ba4
+0, 74, 74, 1, 153600, 0xea365ce4
+0, 75, 75, 1, 153600, 0xef654a84
+0, 76, 76, 1, 153600, 0x32d14584
+0, 77, 77, 1, 153600, 0x6bf843e4
+0, 78, 78, 1, 153600, 0x023d5b94
+0, 79, 79, 1, 153600, 0xd4506154
+0, 80, 80, 1, 153600, 0xeaf0bd24
+0, 81, 81, 1, 153600, 0x426efb94
+0, 82, 82, 1, 153600, 0x98bcde64
+0, 83, 83, 1, 153600, 0xa1bbb4a4
+0, 84, 84, 1, 153600, 0x36688414
+0, 85, 85, 1, 153600, 0x2e4b75d4
+0, 86, 86, 1, 153600, 0x33885884
+0, 87, 87, 1, 153600, 0x6c065224
+0, 88, 88, 1, 153600, 0x1a0252b4
+0, 89, 89, 1, 153600, 0x55896084
+0, 90, 90, 1, 153600, 0xb9df7a04
+0, 91, 91, 1, 153600, 0x6f8a9734
+0, 92, 92, 1, 153600, 0xa3d3dbb4
+0, 93, 93, 1, 153600, 0x907a2483
+0, 94, 94, 1, 153600, 0xf4816ad3
+0, 95, 95, 1, 153600, 0x4e9195e3
+0, 96, 96, 1, 153600, 0xf486a373
+0, 97, 97, 1, 153600, 0x8f6aa693
+0, 98, 98, 1, 153600, 0x8f6aa693
+0, 99, 99, 1, 153600, 0x8f6aa693
+0, 100, 100, 1, 153600, 0x8f6aa693
+0, 101, 101, 1, 153600, 0x8f6aa693
+0, 102, 102, 1, 153600, 0x8f6aa693
+0, 103, 103, 1, 153600, 0x17d9c117
+0, 104, 104, 1, 153600, 0x17d9c117
+0, 105, 105, 1, 153600, 0x17d9c117
+0, 106, 106, 1, 153600, 0x17d9c117
+0, 107, 107, 1, 153600, 0x17d9c117
+0, 108, 108, 1, 153600, 0x7a47386f
+0, 109, 109, 1, 153600, 0x7a47386f
+0, 110, 110, 1, 153600, 0x7a47386f
+0, 111, 111, 1, 153600, 0x7a47386f
+0, 112, 112, 1, 153600, 0x7a47386f
+0, 113, 113, 1, 153600, 0x829dccaa
+0, 114, 114, 1, 153600, 0x829dccaa
+0, 115, 115, 1, 153600, 0x829dccaa
+0, 116, 116, 1, 153600, 0x829dccaa
+0, 117, 117, 1, 153600, 0x829dccaa
+0, 118, 118, 1, 153600, 0x2d58ab4a
+0, 119, 119, 1, 153600, 0x2d58ab4a
+0, 120, 120, 1, 153600, 0x2d58ab4a
+0, 121, 121, 1, 153600, 0x2d58ab4a
+0, 122, 122, 1, 153600, 0x2d58ab4a
+0, 123, 123, 1, 153600, 0x2d58ab4a
+0, 124, 124, 1, 153600, 0x2d58ab4a
+0, 125, 125, 1, 153600, 0x2d58ab4a
+0, 126, 126, 1, 153600, 0x2d58ab4a
+0, 127, 127, 1, 153600, 0x2d58ab4a
+0, 128, 128, 1, 153600, 0x2d58ab4a
+0, 129, 129, 1, 153600, 0x2d58ab4a
+0, 130, 130, 1, 153600, 0x2d58ab4a
+0, 131, 131, 1, 153600, 0x2d58ab4a
+0, 132, 132, 1, 153600, 0x2d58ab4a
+0, 133, 133, 1, 153600, 0x2d58ab4a
+0, 134, 134, 1, 153600, 0x2d58ab4a
+0, 135, 135, 1, 153600, 0x2d58ab4a
+0, 136, 136, 1, 153600, 0x2d58ab4a
+0, 137, 137, 1, 153600, 0x2d58ab4a
+0, 138, 138, 1, 153600, 0x2d58ab4a
+0, 139, 139, 1, 153600, 0x2d58ab4a
+0, 140, 140, 1, 153600, 0x2d58ab4a
+0, 141, 141, 1, 153600, 0x2d58ab4a
+0, 142, 142, 1, 153600, 0x2d58ab4a
+0, 143, 143, 1, 153600, 0x2d58ab4a
+0, 144, 144, 1, 153600, 0x2d58ab4a
+0, 145, 145, 1, 153600, 0x2d58ab4a
+0, 146, 146, 1, 153600, 0x2d58ab4a
+0, 147, 147, 1, 153600, 0x2d58ab4a
+0, 148, 148, 1, 153600, 0x2d58ab4a
+0, 149, 149, 1, 153600, 0x2d58ab4a
+0, 150, 150, 1, 153600, 0x2d58ab4a
+0, 151, 151, 1, 153600, 0x2d58ab4a
+0, 152, 152, 1, 153600, 0x2d58ab4a
+0, 153, 153, 1, 153600, 0x2d58ab4a
+0, 154, 154, 1, 153600, 0x2d58ab4a
+0, 155, 155, 1, 153600, 0x2d58ab4a
+0, 156, 156, 1, 153600, 0x2d58ab4a
+0, 157, 157, 1, 153600, 0x2d58ab4a
+0, 158, 158, 1, 153600, 0x2d58ab4a
+0, 159, 159, 1, 153600, 0x2d58ab4a
+0, 160, 160, 1, 153600, 0x2d58ab4a
+0, 161, 161, 1, 153600, 0x2d58ab4a
+0, 162, 162, 1, 153600, 0x2d58ab4a
+0, 163, 163, 1, 153600, 0x2d58ab4a
+0, 164, 164, 1, 153600, 0x2d58ab4a
+0, 165, 165, 1, 153600, 0x2d58ab4a
+0, 166, 166, 1, 153600, 0x2d58ab4a
+0, 167, 167, 1, 153600, 0x2d58ab4a
+0, 168, 168, 1, 153600, 0x2d58ab4a
+0, 169, 169, 1, 153600, 0x2d58ab4a
+0, 170, 170, 1, 153600, 0x2d58ab4a
+0, 171, 171, 1, 153600, 0x2d58ab4a
+0, 172, 172, 1, 153600, 0x2d58ab4a
+0, 173, 173, 1, 153600, 0x2d58ab4a
+0, 174, 174, 1, 153600, 0x2d58ab4a
+0, 175, 175, 1, 153600, 0x2d58ab4a
+0, 176, 176, 1, 153600, 0x2d58ab4a
+0, 177, 177, 1, 153600, 0x2d58ab4a
+0, 178, 178, 1, 153600, 0x2d58ab4a
+0, 179, 179, 1, 153600, 0x2d58ab4a
+0, 180, 180, 1, 153600, 0x2d58ab4a
+0, 181, 181, 1, 153600, 0x2d58ab4a
+0, 182, 182, 1, 153600, 0x2d58ab4a
+0, 183, 183, 1, 153600, 0x2d58ab4a
+0, 184, 184, 1, 153600, 0x2d58ab4a
+0, 185, 185, 1, 153600, 0x2d58ab4a
+0, 186, 186, 1, 153600, 0x2d58ab4a
+0, 187, 187, 1, 153600, 0x2d58ab4a
+0, 188, 188, 1, 153600, 0x2d58ab4a
+0, 189, 189, 1, 153600, 0x2d58ab4a
+0, 190, 190, 1, 153600, 0x2d58ab4a
+0, 191, 191, 1, 153600, 0x2d58ab4a
+0, 192, 192, 1, 153600, 0x2d58ab4a
+0, 193, 193, 1, 153600, 0x2d58ab4a
+0, 194, 194, 1, 153600, 0x2d58ab4a
+0, 195, 195, 1, 153600, 0x2d58ab4a
+0, 196, 196, 1, 153600, 0x2d58ab4a
+0, 197, 197, 1, 153600, 0x2d58ab4a
+0, 198, 198, 1, 153600, 0x2d58ab4a
+0, 199, 199, 1, 153600, 0x2d58ab4a
+0, 200, 200, 1, 153600, 0x2d58ab4a
+0, 201, 201, 1, 153600, 0x2d58ab4a
+0, 202, 202, 1, 153600, 0x2d58ab4a
+0, 203, 203, 1, 153600, 0x2d58ab4a
+0, 204, 204, 1, 153600, 0x2d58ab4a
+0, 205, 205, 1, 153600, 0x2d58ab4a
+0, 206, 206, 1, 153600, 0x2d58ab4a
+0, 207, 207, 1, 153600, 0x2d58ab4a
+0, 208, 208, 1, 153600, 0x2d58ab4a
+0, 209, 209, 1, 153600, 0x2d58ab4a
+0, 210, 210, 1, 153600, 0x2d58ab4a
+0, 211, 211, 1, 153600, 0x2d58ab4a
+0, 212, 212, 1, 153600, 0x2d58ab4a
+0, 213, 213, 1, 153600, 0x2d58ab4a
+0, 214, 214, 1, 153600, 0x2d58ab4a
+0, 215, 215, 1, 153600, 0x2d58ab4a
+0, 216, 216, 1, 153600, 0x2d58ab4a
+0, 217, 217, 1, 153600, 0x2d58ab4a
+0, 218, 218, 1, 153600, 0x2d58ab4a
+0, 219, 219, 1, 153600, 0x2d58ab4a
+0, 220, 220, 1, 153600, 0x2d58ab4a
+0, 221, 221, 1, 153600, 0x2d58ab4a
+0, 222, 222, 1, 153600, 0x2d58ab4a
+0, 223, 223, 1, 153600, 0x2d58ab4a
+0, 224, 224, 1, 153600, 0x2d58ab4a
+0, 225, 225, 1, 153600, 0x2d58ab4a
+0, 226, 226, 1, 153600, 0x2d58ab4a
+0, 227, 227, 1, 153600, 0x2d58ab4a
+0, 228, 228, 1, 153600, 0x2d58ab4a
+0, 229, 229, 1, 153600, 0x2d58ab4a
+0, 230, 230, 1, 153600, 0x2d58ab4a
+0, 231, 231, 1, 153600, 0x2d58ab4a
+0, 232, 232, 1, 153600, 0x2d58ab4a
+0, 233, 233, 1, 153600, 0x2d58ab4a
+0, 234, 234, 1, 153600, 0x2d58ab4a
+0, 235, 235, 1, 153600, 0x2d58ab4a
+0, 236, 236, 1, 153600, 0x2d58ab4a
+0, 237, 237, 1, 153600, 0x2d58ab4a
+0, 238, 238, 1, 153600, 0x2d58ab4a
+0, 239, 239, 1, 153600, 0x2d58ab4a
+0, 240, 240, 1, 153600, 0x2d58ab4a
+0, 241, 241, 1, 153600, 0x2d58ab4a
+0, 242, 242, 1, 153600, 0x2d58ab4a
+0, 243, 243, 1, 153600, 0x2d58ab4a
+0, 244, 244, 1, 153600, 0x2d58ab4a
+0, 245, 245, 1, 153600, 0x2d58ab4a
+0, 246, 246, 1, 153600, 0x2d58ab4a
+0, 247, 247, 1, 153600, 0x2d58ab4a
+0, 248, 248, 1, 153600, 0x2d58ab4a
+0, 249, 249, 1, 153600, 0x2d58ab4a
+0, 250, 250, 1, 153600, 0x2d58ab4a
+0, 251, 251, 1, 153600, 0x2d58ab4a
+0, 252, 252, 1, 153600, 0x2d58ab4a
+0, 253, 253, 1, 153600, 0x2d58ab4a
+0, 254, 254, 1, 153600, 0x2d58ab4a
+0, 255, 255, 1, 153600, 0x2d58ab4a
+0, 256, 256, 1, 153600, 0x2d58ab4a
+0, 257, 257, 1, 153600, 0x2d58ab4a
+0, 258, 258, 1, 153600, 0x2d58ab4a
+0, 259, 259, 1, 153600, 0x2d58ab4a
+0, 260, 260, 1, 153600, 0x2d58ab4a
+0, 261, 261, 1, 153600, 0x2d58ab4a
+0, 262, 262, 1, 153600, 0x2d58ab4a
+0, 263, 263, 1, 153600, 0x2d58ab4a
+0, 264, 264, 1, 153600, 0x2d58ab4a
+0, 265, 265, 1, 153600, 0x2d58ab4a
+0, 266, 266, 1, 153600, 0x2d58ab4a
+0, 267, 267, 1, 153600, 0x2d58ab4a
+0, 268, 268, 1, 153600, 0x2d58ab4a
+0, 269, 269, 1, 153600, 0x2d58ab4a
+0, 270, 270, 1, 153600, 0x2d58ab4a
+0, 271, 271, 1, 153600, 0x2d58ab4a
+0, 272, 272, 1, 153600, 0x2d58ab4a
+0, 273, 273, 1, 153600, 0x2d58ab4a
+0, 274, 274, 1, 153600, 0x2d58ab4a
+0, 275, 275, 1, 153600, 0x2d58ab4a
+0, 276, 276, 1, 153600, 0x2d58ab4a
+0, 277, 277, 1, 153600, 0x2d58ab4a
+0, 278, 278, 1, 153600, 0x2d58ab4a
+0, 279, 279, 1, 153600, 0x2d58ab4a
+0, 280, 280, 1, 153600, 0x2d58ab4a
+0, 281, 281, 1, 153600, 0x2d58ab4a
+0, 282, 282, 1, 153600, 0x2d58ab4a
+0, 283, 283, 1, 153600, 0x2d58ab4a
+0, 284, 284, 1, 153600, 0x7815bb72
+0, 285, 285, 1, 153600, 0x47ec1353
+0, 286, 286, 1, 153600, 0x6599fabc
+0, 287, 287, 1, 153600, 0x3d8a8690
+0, 288, 288, 1, 153600, 0xc0bc1ba5
+0, 289, 289, 1, 153600, 0x07368f2a
+0, 290, 290, 1, 153600, 0x81c54b89
+0, 291, 291, 1, 153600, 0xbfcae7bf
+0, 292, 292, 1, 153600, 0x1348310e
+0, 293, 293, 1, 153600, 0xb5489dad
+0, 294, 294, 1, 153600, 0xa1eb1408
+0, 295, 295, 1, 153600, 0x15e1832c
+0, 296, 296, 1, 153600, 0xb789cba5
+0, 297, 297, 1, 153600, 0x3ee86e4f
+0, 298, 298, 1, 153600, 0x06ea3883
+0, 299, 299, 1, 153600, 0xcedd02b7
+0, 300, 300, 1, 153600, 0xbce6ce58
+0, 301, 301, 1, 153600, 0xaadf9a00
+0, 302, 302, 1, 153600, 0x98c865a0
+0, 303, 303, 1, 153600, 0x4c8432e0
+0, 304, 304, 1, 153600, 0x00000000
+0, 305, 305, 1, 153600, 0x00000000
+0, 306, 306, 1, 153600, 0x00000000
+0, 307, 307, 1, 153600, 0x00000000
+0, 308, 308, 1, 153600, 0x00000000
+0, 309, 309, 1, 153600, 0x00000000
+0, 310, 310, 1, 153600, 0x00000000
+0, 311, 311, 1, 153600, 0x00000000
+0, 312, 312, 1, 153600, 0x00000000
diff --git a/tests/ref/fate/vp8-size-change b/tests/ref/fate/vp8-size-change
new file mode 100644
index 0000000000..85e27411bc
--- /dev/null
+++ b/tests/ref/fate/vp8-size-change
@@ -0,0 +1,31 @@
+#tb 0: 1/30
+0, 0, 0, 1, 3110400, f9b685c9aaa7652faeded50ed1005414
+0, 1, 1, 1, 3110400, d22c3d6a1e57ba4af2bd19e09ad7bdb1
+0, 2, 2, 1, 3110400, 0d516dc90992321576a1f090b382beab
+0, 3, 3, 1, 3110400, a306b1c732dbaea18ad1efd9d3820094
+0, 4, 4, 1, 3110400, faddd965d3e70e62cad07dc72225e8c2
+0, 5, 5, 1, 3110400, 375795188ae0ce026179aea29cb8a1b4
+0, 6, 6, 1, 3110400, aa372227e1630513116ff6678a2c4fcf
+0, 7, 7, 1, 3110400, e4937f5756a3bbbe2660c0874514479b
+0, 8, 8, 1, 3110400, ad7d1f6a28ac9f6490f1ee7595ef6b94
+0, 9, 9, 1, 3110400, 305414d3ca8aca36242e08041b92ad69
+0, 10, 10, 1, 3110400, b719401bd210e4fc02be258ca866e50e
+0, 11, 11, 1, 3110400, a25f312e44492715f334ab97f50e73ad
+0, 12, 12, 1, 3110400, 1da8d6815b3ce412690e86f18444c621
+0, 13, 13, 1, 3110400, 0522ee62ed61c900b71f3fff2030026b
+0, 14, 14, 1, 3110400, 523d2a4f5571a952f68d5768eb3336dc
+0, 15, 15, 1, 3110400, 03a9b1f05d48c25d689f74db4d2cdbe1
+0, 16, 16, 1, 3110400, 6ae91271da4f5c6e604df8e04a40ea45
+0, 17, 17, 1, 3110400, 5b3e7bac9f61c4248999a2587a630d28
+0, 18, 18, 1, 3110400, 60069876ccffeee06a535e471b8916e8
+0, 19, 19, 1, 3110400, 9f5101c81bc7702d98baee78c4ffe65d
+0, 20, 20, 1, 3110400, c02641360b4d8af4640aa330d9eb8bb0
+0, 21, 21, 1, 3110400, 63274292e7d3f2482c3c282722ae3f02
+0, 22, 22, 1, 3110400, ae39b5a18260046e96b4b44520ef0f7d
+0, 23, 23, 1, 3110400, bb89af6f8f2b13d0cd668d445669f655
+0, 24, 24, 1, 3110400, 0ac58c28575b804d9e63395653c3aef2
+0, 25, 25, 1, 3110400, 641f2a78e338c733ef159bd36ec7966f
+0, 26, 26, 1, 3110400, 9402d455fa5bd556b85f479c42c3a4d2
+0, 27, 27, 1, 3110400, fa2407483a8e169a161e45ac6cfa7831
+0, 28, 28, 1, 3110400, 087744a0ac52ef96803fc9c4fb17635b
+0, 29, 29, 1, 3110400, b62328f2bd00b269cd3a359360b613b7