From ec5e521298f2a7c8b42f4d247dbf09009d400355 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 16 Oct 2011 22:31:53 -0700 Subject: [PATCH 1/9] macosx: use the default surface on newer sdl SDL 1.2.14 works fine with default colorspace on macosx and seems to have some issues with 24bit surfaces and resize in addition. --- avplay.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/avplay.c b/avplay.c index a4b58a539e..225f81acbc 100644 --- a/avplay.c +++ b/avplay.c @@ -904,11 +904,11 @@ static int video_open(VideoState *is){ && is->height== screen->h && screen->h == h) return 0; -#ifndef __APPLE__ - screen = SDL_SetVideoMode(w, h, 0, flags); -#else - /* setting bits_per_pixel = 0 or 32 causes blank video on OS X */ +#if defined(__APPLE__) && !SDL_VERSION_ATLEAST(1, 2, 14) + /* setting bits_per_pixel = 0 or 32 causes blank video on OS X and older SDL */ screen = SDL_SetVideoMode(w, h, 24, flags); +#else + screen = SDL_SetVideoMode(w, h, 0, flags); #endif if (!screen) { fprintf(stderr, "SDL: could not set video mode - exiting\n"); From 73dbc89cbb8826e76ff4b8f8cdb42a850cb2c463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 17 Oct 2011 23:03:49 +0300 Subject: [PATCH 2/9] fate: Add a target for creating a 16000 Hz mono synthetic audio file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- tests/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 1ec9dc342c..bf0ead7dfc 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -17,7 +17,11 @@ tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF) @mkdir -p tests/data $(M)./$< $@ -tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN +tests/data/asynth-16000-1.sw: tests/audiogen$(HOSTEXESUF) + @mkdir -p tests/data + $(M)./$< $@ 16000 1 + +tests/data/asynth%.sw tests/vsynth%/00.pgm: TAG = GEN include $(SRC_PATH)/tests/fate.mak include $(SRC_PATH)/tests/fate2.mak From 6e6003a4d244bb7b6d7ef24a98af9c6f3d269990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 9 Sep 2010 10:02:32 +0300 Subject: [PATCH 3/9] g722: Add a fate test for the encoder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- tests/fate2.mak | 4 ++++ tests/ref/fate/g722enc | 1 + 2 files changed, 5 insertions(+) create mode 100644 tests/ref/fate/g722enc diff --git a/tests/fate2.mak b/tests/fate2.mak index 0bb6654f8d..376a0196b6 100644 --- a/tests/fate2.mak +++ b/tests/fate2.mak @@ -133,6 +133,10 @@ fate-gsm-ms: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav FATE_TESTS += fate-g722dec-1 fate-g722dec-1: CMD = framecrc -i $(SAMPLES)/g722/conf-adminmenu-162.g722 +FATE_TESTS += fate-g722enc +fate-g722enc: tests/data/asynth-16000-1.sw +fate-g722enc: CMD = md5 -ar 16000 -ac 1 -f s16le -i $(TARGET_PATH)/tests/data/asynth-16000-1.sw -acodec g722 -ac 1 -f g722 + FATE_TESTS += fate-msmpeg4v1 fate-msmpeg4v1: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/msmpeg4v1/mpg4.avi -an diff --git a/tests/ref/fate/g722enc b/tests/ref/fate/g722enc new file mode 100644 index 0000000000..c1094565b5 --- /dev/null +++ b/tests/ref/fate/g722enc @@ -0,0 +1 @@ +750269cc236541df28e15da5c7b0df7a From d1d421cbc0d13b08535f7fc08d179572ee352072 Mon Sep 17 00:00:00 2001 From: Ronald Bultje Date: Tue, 18 Oct 2011 01:53:04 +0000 Subject: [PATCH 4/9] swscale: prevent overflow during initialization Signed-off-by: Janne Grunau --- libswscale/utils.c | 6 ++++-- tests/ref/lavfi/crop_scale | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index cfe4be9e20..8e5daf99dc 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -271,10 +271,12 @@ static int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSi floatd= d * (1.0/(1<<30)); if (flags & SWS_BICUBIC) { +#define SQRT_INT64_MAX 0xb504f333 int64_t B= (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1<<24); int64_t C= (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1<<24); - int64_t dd = ( d*d)>>30; - int64_t ddd= (dd*d)>>30; + int64_t dd = d > SQRT_INT64_MAX ? ((d >> 1) * d) >> 29 : (d * d) >> 30; + int64_t ddd = d > SQRT_INT64_MAX || dd > SQRT_INT64_MAX ? + ((dd >> 2) * d) >> 28 : (dd * d) >> 30; if (d < 1LL<<30) coeff = (12*(1<<24)-9*B-6*C)*ddd + (-18*(1<<24)+12*B+6*C)*dd + (6*(1<<24)-2*B)*(1<<30); diff --git a/tests/ref/lavfi/crop_scale b/tests/ref/lavfi/crop_scale index 82e5394496..ae26c8ee6d 100644 --- a/tests/ref/lavfi/crop_scale +++ b/tests/ref/lavfi/crop_scale @@ -1 +1 @@ -crop_scale 0a3d45d58b805b8c47416b9239535f94 +crop_scale f8cad857d2b7102fc256532ec9849da7 From a5f05e52e407a99419a6436303974ca068018483 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 11 Oct 2011 15:17:36 +0200 Subject: [PATCH 5/9] doc/avtools: add forgotten part to stream specifiers description --- doc/avtools-common-opts.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi index 1824813a1e..ba552fcc29 100644 --- a/doc/avtools-common-opts.texi +++ b/doc/avtools-common-opts.texi @@ -37,7 +37,7 @@ thread count for the second stream to 4. 'd' for data and 't' for attachments. If @var{stream_index} is given, then matches stream number @var{stream_index} of this type. Otherwise matches all streams of this type. -@item @var{program_id}[:@var{stream_index}] +@item p:@var{program_id}[:@var{stream_index}] If @var{stream_index} is given, then matches stream number @var{stream_index} in program with id @var{program_id}. Otherwise matches all streams in this program. @end table From 075d6439f17596a89dbf9fb6b3e1094ad0495f27 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 11 Oct 2011 15:56:40 +0200 Subject: [PATCH 6/9] Add libvpx presets. Based on a patch by James Zern jzern AT google DOT com --- ffpresets/libvpx-1080p.avpreset | 17 +++++++++++++++++ ffpresets/libvpx-1080p50_60.avpreset | 17 +++++++++++++++++ ffpresets/libvpx-360p.avpreset | 16 ++++++++++++++++ ffpresets/libvpx-720p.avpreset | 17 +++++++++++++++++ ffpresets/libvpx-720p50_60.avpreset | 17 +++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 ffpresets/libvpx-1080p.avpreset create mode 100644 ffpresets/libvpx-1080p50_60.avpreset create mode 100644 ffpresets/libvpx-360p.avpreset create mode 100644 ffpresets/libvpx-720p.avpreset create mode 100644 ffpresets/libvpx-720p50_60.avpreset diff --git a/ffpresets/libvpx-1080p.avpreset b/ffpresets/libvpx-1080p.avpreset new file mode 100644 index 0000000000..5c7da6fb86 --- /dev/null +++ b/ffpresets/libvpx-1080p.avpreset @@ -0,0 +1,17 @@ +g=120 +lag-in-frames=16 +deadline=good +cpu-used=0 +profile=1 +qmax=51 +qmin=11 +slices=4 +b=2M + +#ignored unless using -pass 2 +maxrate=24M +minrate=100k +auto-alt-ref=1 +arnr-maxframes=7 +arnr-strength=5 +arnr-type=centered diff --git a/ffpresets/libvpx-1080p50_60.avpreset b/ffpresets/libvpx-1080p50_60.avpreset new file mode 100644 index 0000000000..d42f731744 --- /dev/null +++ b/ffpresets/libvpx-1080p50_60.avpreset @@ -0,0 +1,17 @@ +g=120 +lag-in-frames=25 +deafline=good +cpu-used=0 +profile=1 +qmax=51 +qmin=11 +slices=4 +b=2M + +#ignored unless using -pass 2 +maxrate=24M +minrate=100k +auto-alt-ref=1 +arnr-maxframes=7 +arnr-strength=5 +arnr-type=centered diff --git a/ffpresets/libvpx-360p.avpreset b/ffpresets/libvpx-360p.avpreset new file mode 100644 index 0000000000..2cb9e380f3 --- /dev/null +++ b/ffpresets/libvpx-360p.avpreset @@ -0,0 +1,16 @@ +g=120 +lag-in-frames=16 +deadline=good +cpu-used=0 +profile=0 +qmax=63 +qmin=0 +b=768k + +#ignored unless using -pass 2 +maxrate=1.5M +minrate=40k +auto-alt-ref=1 +arnr-maxframes=7 +arnr-strength=5 +arnr-type=centered diff --git a/ffpresets/libvpx-720p.avpreset b/ffpresets/libvpx-720p.avpreset new file mode 100644 index 0000000000..3c7e396ad6 --- /dev/null +++ b/ffpresets/libvpx-720p.avpreset @@ -0,0 +1,17 @@ +g=120 +lag-in-frames=16 +deadline=good +cpu-used=0 +profile=0 +qmax=51 +qmin=11 +slices=4 +b=2M + +#ignored unless using -pass 2 +maxrate=24M +minrate=100k +auto-alt-ref=1 +arnr-maxframes=7 +arnr-strength=5 +arnr-type=centered diff --git a/ffpresets/libvpx-720p50_60.avpreset b/ffpresets/libvpx-720p50_60.avpreset new file mode 100644 index 0000000000..613930063e --- /dev/null +++ b/ffpresets/libvpx-720p50_60.avpreset @@ -0,0 +1,17 @@ +g=120 +lag-in-frames=25 +deadline=good +cpu-used=0 +profile=0 +qmax=51 +qmin=11 +slices=4 +b=2M + +#ignored unless using -pass 2 +maxrate=24M +minrate=100k +auto-alt-ref=1 +arnr-maxframes=7 +arnr-strength=5 +arnr-type=centered From 204e6132d24012abb03ab00bbae4b5db6a3074d0 Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Sun, 16 Oct 2011 21:22:02 -0400 Subject: [PATCH 7/9] lavc: replace API-bump-triggered AVCodecContext field change with shorter, non-conflicting name Signed-off-by: Anton Khirnov --- libavcodec/avcodec.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 593ee363dd..8298d5aeff 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2909,11 +2909,7 @@ typedef struct AVCodecContext { * - encoding: unused * - decoding: Set by user. */ -#if FF_API_ER - int error_recognition2; -#else - int error_recognition; -#endif /* FF_API_ER */ + int err_recognition; #define AV_ER_CRCCHECK (1<<0) #define AV_ER_BITSTREAM (1<<1) #define AV_ER_AGGRESSIVE (1<<2) From 6b1f93face444a6e6a4f5a332309f8503d0017f5 Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Sun, 16 Oct 2011 21:22:03 -0400 Subject: [PATCH 8/9] lavc: rename AV_ER_* options to AV_EF_* and rename AGGRESSIVE to BUFFER Signed-off-by: Anton Khirnov --- libavcodec/avcodec.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 8298d5aeff..440ba9b487 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2910,10 +2910,10 @@ typedef struct AVCodecContext { * - decoding: Set by user. */ int err_recognition; -#define AV_ER_CRCCHECK (1<<0) -#define AV_ER_BITSTREAM (1<<1) -#define AV_ER_AGGRESSIVE (1<<2) -#define AV_ER_EXPLODE (1<<3) +#define AV_EF_CRCCHECK (1<<0) +#define AV_EF_BITSTREAM (1<<1) +#define AV_EF_BUFFER (1<<2) +#define AV_EF_EXPLODE (1<<3) } AVCodecContext; /** From d97ca425efeb468bc8e9db891385a909883177bb Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Tue, 27 Sep 2011 22:15:32 +0000 Subject: [PATCH 9/9] sunrast: Check for out of bounds reads Signed-off-by: Janne Grunau --- libavcodec/sunrast.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index d63fd171b8..9ec1df8ae1 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -46,6 +46,7 @@ static av_cold int sunrast_init(AVCodecContext *avctx) { static int sunrast_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; + const uint8_t *buf_end = avpkt->data + avpkt->size; SUNRASTContext * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p = &s->picture; @@ -53,6 +54,9 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, uint8_t *ptr; const uint8_t *bufstart = buf; + if (avpkt->size < 32) + return AVERROR_INVALIDDATA; + if (AV_RB32(buf) != 0x59a66a95) { av_log(avctx, AV_LOG_ERROR, "this is not sunras encoded data\n"); return -1; @@ -109,6 +113,9 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, p->pict_type = AV_PICTURE_TYPE_I; + if (buf_end - buf < maplength) + return AVERROR_INVALIDDATA; + if (depth != 8 && maplength) { av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n"); @@ -143,8 +150,11 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, uint8_t *end = ptr + h*stride; x = 0; - while (ptr != end) { + while (ptr != end && buf < buf_end) { run = 1; + if (buf_end - buf < 1) + return AVERROR_INVALIDDATA; + if ((value = *buf++) == 0x80) { run = *buf++ + 1; if (run != 1) @@ -163,6 +173,8 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, } } else { for (y=0; y