diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-31 14:15:42 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-31 14:20:01 +0100 |
commit | 08196c785a1df33da435c5a669c9c560f647290c (patch) | |
tree | 2f1e51c4f37f40cbcdff0c9858f0ae2acf5649ef | |
parent | 98275283d52622c16a6d59f508de7d40216e8b63 (diff) | |
parent | 506409776c49910050f3150d0e51d11b44d323ed (diff) | |
download | ffmpeg-08196c785a1df33da435c5a669c9c560f647290c.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
configure: suppress -fPIC in msvc builds
Drop unnecessary 'l' length modifier when printfing double values.
truemotion2: Sanitize tm2_read_header()
Conflicts:
libavcodec/truemotion2.c
libavfilter/src_movie.c
libavutil/opt.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | libavcodec/truemotion2.c | 39 | ||||
-rw-r--r-- | libavfilter/vf_frei0r.c | 2 | ||||
-rw-r--r-- | libavfilter/vf_hqdn3d.c | 2 |
4 files changed, 24 insertions, 20 deletions
@@ -2448,6 +2448,7 @@ msvc_flags(){ -fno-math-errno) ;; -fno-common) ;; -fno-signed-zeros) ;; + -fPIC) ;; -lz) echo zlib.lib ;; -lavifil32) echo vfw32.lib ;; -lavicap32) echo vfw32.lib user32.lib ;; diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index 20322435c5..5ba2cf10e7 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -205,21 +205,22 @@ static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code) return code->recode[val]; } +#define TM2_OLD_HEADER_MAGIC 0x00000100 +#define TM2_NEW_HEADER_MAGIC 0x00000101 + static inline int tm2_read_header(TM2Context *ctx, const uint8_t *buf) { - uint32_t magic; - - magic = AV_RL32(buf); - buf += 4; + uint32_t magic = AV_RL32(buf); - if(magic == 0x00000100) { /* old header */ + switch (magic) { + case TM2_OLD_HEADER_MAGIC: av_log_missing_feature(ctx->avctx, "TM2 old header", 1); - return 40; - } else if(magic == 0x00000101) { /* new header */ - return 40; - } else { - av_log (ctx->avctx, AV_LOG_ERROR, "Not a TM2 header: 0x%08X\n", magic); - return -1; + return 0; + case TM2_NEW_HEADER_MAGIC: + return 0; + default: + av_log(ctx->avctx, AV_LOG_ERROR, "Not a TM2 header: 0x%08X\n", magic); + return AVERROR_INVALIDDATA; } } @@ -825,6 +826,8 @@ static const int tm2_stream_order[TM2_NUM_STREAMS] = { TM2_C_HI, TM2_C_LO, TM2_L_HI, TM2_L_LO, TM2_UPD, TM2_MOT, TM2_TYPE }; +#define TM2_HEADER_SIZE 40 + static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) @@ -833,7 +836,7 @@ static int decode_frame(AVCodecContext *avctx, int buf_size = avpkt->size & ~3; TM2Context * const l = avctx->priv_data; AVFrame * const p = &l->pic; - int i, ret, skip, t; + int i, offset = TM2_HEADER_SIZE, t, ret; av_fast_padded_malloc(&l->buffer, &l->buffer_size, buf_size); if(!l->buffer){ @@ -848,23 +851,23 @@ static int decode_frame(AVCodecContext *avctx, } l->dsp.bswap_buf((uint32_t*)l->buffer, (const uint32_t*)buf, buf_size >> 2); - skip = tm2_read_header(l, l->buffer); - if(skip == -1){ - return AVERROR_INVALIDDATA; + if ((ret = tm2_read_header(l, l->buffer)) < 0) { + return ret; } for(i = 0; i < TM2_NUM_STREAMS; i++){ - if (skip >= buf_size) { + if (offset >= buf_size) { av_log(avctx, AV_LOG_ERROR, "no space for tm2_read_stream\n"); return AVERROR_INVALIDDATA; } - t = tm2_read_stream(l, l->buffer + skip, tm2_stream_order[i], buf_size - skip); + t = tm2_read_stream(l, l->buffer + offset, tm2_stream_order[i], + buf_size - offset); if(t < 0){ return t; } - skip += t; + offset += t; } p->key_frame = tm2_decode_blocks(l, p); if(p->key_frame) diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c index 0fb86b4267..7ed78fa1d7 100644 --- a/libavfilter/vf_frei0r.c +++ b/libavfilter/vf_frei0r.c @@ -189,7 +189,7 @@ static int set_params(AVFilterContext *ctx, const char *params) case F0R_PARAM_POSITION: v = &pos; frei0r->get_param_value(frei0r->instance, v, i); - av_log(ctx, AV_LOG_DEBUG, "%lf/%lf", pos.x, pos.y); + av_log(ctx, AV_LOG_DEBUG, "%f/%f", pos.x, pos.y); break; default: /* F0R_PARAM_STRING */ v = s; diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c index 4ea4ac9aa0..b30f8ae8ad 100644 --- a/libavfilter/vf_hqdn3d.c +++ b/libavfilter/vf_hqdn3d.c @@ -235,7 +235,7 @@ static int init(AVFilterContext *ctx, const char *args) hqdn3d->strength[2] = chrom_spac; hqdn3d->strength[3] = chrom_tmp; - av_log(ctx, AV_LOG_VERBOSE, "ls:%lf cs:%lf lt:%lf ct:%lf\n", + av_log(ctx, AV_LOG_VERBOSE, "ls:%f cs:%f lt:%f ct:%f\n", lum_spac, chrom_spac, lum_tmp, chrom_tmp); if (lum_spac < 0 || chrom_spac < 0 || isnan(chrom_tmp)) { av_log(ctx, AV_LOG_ERROR, |