1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '581281e242609a222233a2e5538b89dfb88fb18e'

* commit '581281e242609a222233a2e5538b89dfb88fb18e':
  matroskadec: check realloc in lzo encoding
  matroska: honor error_recognition on unknown doctypes
  tiffdec: Add support for GRAY16LE.
  tiffenc: Add support for little endian RGB48 and GRAY16
  mpeg4: support frame parameter changes with frame-mt
  mpegvideo: check ff_find_unused_picture() return value for errors
  mpegvideo: release frame buffers before freeing them
  configure: msvc: default to 'lib' as 'ar' tool
  build: support some non-standard ar variants

Conflicts:
	libavcodec/h263dec.c
	libavcodec/mpegvideo.c
	libavcodec/tiff.c
	libavcodec/tiffenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-09-20 03:20:29 +02:00
commit 61ced71d79
8 changed files with 64 additions and 20 deletions

14
configure vendored
View File

@ -2316,6 +2316,7 @@ case "$toolchain" in
cc_default="c99wrap cl"
ld_default="c99wrap link"
nm_default="dumpbin -symbols"
ar_default="lib"
;;
?*)
die "Unknown toolchain $toolchain"
@ -2688,6 +2689,17 @@ if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
DEPCCFLAGS=$_flags
fi
if $ar 2>&1 | grep -q Microsoft; then
arflags="-nologo"
ar_o='-out:$@'
elif $ar 2>&1 | grep -q 'Texas Instruments'; then
arflags="rq"
ar_o='$@'
else
arflags="rc"
ar_o='$@'
fi
add_cflags $extra_cflags
add_cxxflags $extra_cxxflags
add_asflags $extra_cflags
@ -4113,6 +4125,8 @@ DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
YASM=$yasmexe
DEPYASM=$yasmexe
AR=$ar
ARFLAGS=$arflags
AR_O=$ar_o
RANLIB=$ranlib
CP=cp -p
LN_S=$ln_s

View File

@ -462,15 +462,6 @@ retry:
if (ret < 0){
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return ret;
} else if ((s->width != avctx->coded_width ||
s->height != avctx->coded_height ||
(s->width + 15) >> 4 != s->mb_width ||
(s->height + 15) >> 4 != s->mb_height) &&
(HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))) {
av_log_missing_feature(s->avctx, "Width/height/bit depth/chroma idc changing with threads is", 0);
s->width = avctx->coded_width;
s->height= avctx->coded_height;
return AVERROR_PATCHWELCOME; // width / height changed during parallelized decoding
}
avctx->has_b_frames= !s->low_delay;
@ -607,21 +598,29 @@ retry:
/* FIXME: By the way H263 decoder is evolving it should have */
/* an H263EncContext */
if ( s->width != avctx->coded_width
|| s->height != avctx->coded_height) {
/* H.263 could change picture size any time */
if (!avctx->coded_width || !avctx->coded_height) {
ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat
s->parse_context.buffer=0;
ff_MPV_common_end(s);
s->parse_context= pc;
}
if (!s->context_initialized) {
avcodec_set_dimensions(avctx, s->width, s->height);
goto retry;
}
if (s->width != avctx->coded_width ||
s->height != avctx->coded_height ||
s->context_reinit) {
/* H.263 could change picture size any time */
s->context_reinit = 0;
avcodec_set_dimensions(avctx, s->width, s->height);
if ((ret = ff_MPV_common_frame_size_change(s)))
return ret;
}
if((s->codec_id==AV_CODEC_ID_H263 || s->codec_id==AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_H263I))
s->gob_index = ff_h263_get_gob_height(s);

View File

@ -1630,6 +1630,9 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
height = get_bits(gb, 13);
skip_bits1(gb); /* marker */
if(width && height && !(s->width && s->codec_tag == AV_RL32("MP4S"))){ /* they should be non zero but who knows ... */
if (s->width && s->height &&
(s->width != width || s->height != height))
s->context_reinit = 1;
s->width = width;
s->height = height;
}

View File

@ -552,6 +552,15 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
}
}
if (s->height != s1->height || s->width != s1->width || s->context_reinit) {
int err;
s->context_reinit = 0;
s->height = s1->height;
s->width = s1->width;
if ((err = ff_MPV_common_frame_size_change(s)) < 0)
return err;
}
s->avctx->coded_height = s1->avctx->coded_height;
s->avctx->coded_width = s1->avctx->coded_width;
s->avctx->width = s1->avctx->width;
@ -1328,8 +1337,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
pic = s->current_picture_ptr;
} else {
i = ff_find_unused_picture(s, 0);
if (i < 0)
if (i < 0) {
av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
}
pic = &s->picture[i];
}
@ -1393,8 +1404,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
if (i < 0)
if (i < 0) {
av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
}
s->last_picture_ptr = &s->picture[i];
s->last_picture_ptr->f.key_frame = 0;
if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) {
@ -1416,8 +1429,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->pict_type == AV_PICTURE_TYPE_B) {
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
if (i < 0)
if (i < 0) {
av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
}
s->next_picture_ptr = &s->picture[i];
s->next_picture_ptr->f.key_frame = 0;
if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) {

View File

@ -713,6 +713,10 @@ typedef struct MpegEncContext {
/* temp buffers for rate control */
float *cplx_tab, *bits_tab;
/* flag to indicate a reinitialization is required, e.g. after
* a frame size change */
int context_reinit;
} MpegEncContext;
#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \

View File

@ -520,7 +520,8 @@ AVCodec ff_tiff_encoder = {
.encode2 = encode_frame,
.close = encode_close,
.pix_fmts = (const enum PixelFormat[]) {
PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_GRAY8A, PIX_FMT_GRAY16LE,
PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8,
PIX_FMT_GRAY8A, PIX_FMT_GRAY16LE,
PIX_FMT_MONOBLACK, PIX_FMT_MONOWHITE,
PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV440P, PIX_FMT_YUV444P,
PIX_FMT_YUV410P, PIX_FMT_YUV411P, PIX_FMT_RGB48LE,

View File

@ -1065,7 +1065,11 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
case MATROSKA_TRACK_ENCODING_COMP_LZO:
do {
olen = pkt_size *= 3;
pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING);
newpktdata = av_realloc(pkt_data, pkt_size + AV_LZO_OUTPUT_PADDING);
if (!newpktdata) {
goto failed;
}
pkt_data = newpktdata;
result = av_lzo1x_decode(pkt_data, &olen, data, &isize);
} while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000);
if (result)
@ -1443,6 +1447,10 @@ static int matroska_read_header(AVFormatContext *s)
break;
if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) {
av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype);
if (matroska->ctx->error_recognition & AV_EF_EXPLODE) {
ebml_free(ebml_syntax, &ebml);
return AVERROR_INVALIDDATA;
}
}
ebml_free(ebml_syntax, &ebml);

View File

@ -25,7 +25,7 @@ $(TESTOBJS): CPPFLAGS += -DTEST
$(SUBDIR)$(LIBNAME): $(OBJS)
$(RM) $@
$(AR) rc $@ $^ $(EXTRAOBJS)
$(AR) $(ARFLAGS) $(AR_O) $^ $(EXTRAOBJS)
$(RANLIB) $@
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig