From 4719ea7e1e6113010da2ccdb9a84e45104ab4de7 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 2 Jul 2012 13:49:13 +0100 Subject: flacdec: remove redundant setting of avctx->sample_fmt Signed-off-by: Mans Rullgard --- libavcodec/flacdec.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index cd2a69390a..6a06d1922d 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -108,8 +108,6 @@ static av_cold int flac_decode_init(AVCodecContext *avctx) FLACContext *s = avctx->priv_data; s->avctx = avctx; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - /* for now, the raw FLAC header is allowed to be passed to the decoder as frame data instead of extradata. */ if (!avctx->extradata) -- cgit v1.2.3 From 4d8516fdb15d0177ad745228508254dee187dff9 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Mon, 2 Jul 2012 10:39:25 +0300 Subject: snow: Check mallocs at init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/snow.c | 19 ++++++++++++------- libavcodec/snowdec.c | 7 ++++++- libavcodec/snowenc.c | 7 +++++-- 3 files changed, 23 insertions(+), 10 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 821b81bf47..96de9f36d2 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -394,7 +394,7 @@ mca( 8, 8,8) av_cold int ff_snow_common_init(AVCodecContext *avctx){ SnowContext *s = avctx->priv_data; int width, height; - int i, j; + int i, j, ret; s->avctx= avctx; s->max_ref_frames=1; //just make sure its not an invalid value in case of no initial keyframe @@ -447,19 +447,24 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ width= s->avctx->width; height= s->avctx->height; - s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM)); - s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this does not belong here - s->temp_dwt_buffer = av_mallocz(width * sizeof(DWTELEM)); - s->temp_idwt_buffer = av_mallocz(width * sizeof(IDWTELEM)); + FF_ALLOCZ_OR_GOTO(avctx, s->spatial_idwt_buffer, width * height * sizeof(IDWTELEM), fail); + FF_ALLOCZ_OR_GOTO(avctx, s->spatial_dwt_buffer, width * height * sizeof(DWTELEM), fail); //FIXME this does not belong here + FF_ALLOCZ_OR_GOTO(avctx, s->temp_dwt_buffer, width * sizeof(DWTELEM), fail); + FF_ALLOCZ_OR_GOTO(avctx, s->temp_idwt_buffer, width * sizeof(IDWTELEM), fail); for(i=0; iavctx->get_buffer(s->avctx, &s->mconly_picture); - s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE); + if ((ret = s->avctx->get_buffer(s->avctx, &s->mconly_picture)) < 0) { + av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return ret; + } + FF_ALLOC_OR_GOTO(avctx, s->scratchbuf, s->mconly_picture.linesize[0]*7*MB_SIZE, fail); return 0; +fail: + return AVERROR(ENOMEM); } int ff_snow_common_init_after_header(AVCodecContext *avctx) { diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c index 5dec277eb0..9ea8c493fd 100644 --- a/libavcodec/snowdec.c +++ b/libavcodec/snowdec.c @@ -354,9 +354,14 @@ static int decode_header(SnowContext *s){ static av_cold int decode_init(AVCodecContext *avctx) { + int ret; + avctx->pix_fmt= PIX_FMT_YUV420P; - ff_snow_common_init(avctx); + if ((ret = ff_snow_common_init(avctx)) < 0) { + ff_snow_common_end(avctx->priv_data); + return ret; + } return 0; } diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 627a406af9..f8694ae813 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -155,7 +155,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i static av_cold int encode_init(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; - int plane_index; + int plane_index, ret; if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "This codec is under development, files encoded with it may not be decodable with future versions!!!\n" @@ -184,7 +184,10 @@ static av_cold int encode_init(AVCodecContext *avctx) s->plane[plane_index].fast_mc= 1; } - ff_snow_common_init(avctx); + if ((ret = ff_snow_common_init(avctx)) < 0) { + ff_snow_common_end(avctx->priv_data); + return ret; + } ff_snow_alloc_blocks(s); s->version=0; -- cgit v1.2.3 From cbd9b2f918af681d206d10340f87fc6aced5cf3e Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 30 Jun 2012 10:34:39 -0700 Subject: snow: remove the runs[] VLA. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/snow.c | 2 ++ libavcodec/snow.h | 1 + libavcodec/snowenc.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 96de9f36d2..629367ac44 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -451,6 +451,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ FF_ALLOCZ_OR_GOTO(avctx, s->spatial_dwt_buffer, width * height * sizeof(DWTELEM), fail); //FIXME this does not belong here FF_ALLOCZ_OR_GOTO(avctx, s->temp_dwt_buffer, width * sizeof(DWTELEM), fail); FF_ALLOCZ_OR_GOTO(avctx, s->temp_idwt_buffer, width * sizeof(IDWTELEM), fail); + FF_ALLOC_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1) * ((height + 1) >> 1) * sizeof(*s->run_buffer), fail); for(i=0; itemp_dwt_buffer); av_freep(&s->spatial_idwt_buffer); av_freep(&s->temp_idwt_buffer); + av_freep(&s->run_buffer); s->m.me.temp= NULL; av_freep(&s->m.me.scratchpad); diff --git a/libavcodec/snow.h b/libavcodec/snow.h index 3ceb6af99d..aa27a50fd1 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -135,6 +135,7 @@ typedef struct SnowContext{ DWTELEM *temp_dwt_buffer; IDWTELEM *spatial_idwt_buffer; IDWTELEM *temp_idwt_buffer; + int *run_buffer; int colorspace_type; int chroma_h_shift; int chroma_v_shift; diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index f8694ae813..7503953e11 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -836,7 +836,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, IDWTELEM *src, IDWTE if(1){ int run=0; - int runs[w*h]; + int *runs = s->run_buffer; int run_index=0; int max_index; -- cgit v1.2.3 From 33895451570742c47404fec52d87a5c71de26b83 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 2 Jul 2012 10:39:54 +0300 Subject: snow: remove a VLA used for edge emulation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/snow.c | 4 ++++ libavcodec/snow.h | 1 + libavcodec/snowenc.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 629367ac44..d69f452e5d 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -395,6 +395,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ SnowContext *s = avctx->priv_data; int width, height; int i, j, ret; + int emu_buf_size; s->avctx= avctx; s->max_ref_frames=1; //just make sure its not an invalid value in case of no initial keyframe @@ -462,6 +463,8 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ return ret; } FF_ALLOC_OR_GOTO(avctx, s->scratchbuf, s->mconly_picture.linesize[0]*7*MB_SIZE, fail); + emu_buf_size = s->mconly_picture.linesize[0] * (2 * MB_SIZE + HTAPS_MAX - 1); + FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail); return 0; fail: @@ -648,6 +651,7 @@ av_cold void ff_snow_common_end(SnowContext *s) av_freep(&s->block); av_freep(&s->scratchbuf); + av_freep(&s->emu_edge_buffer); for(i=0; iref_mvs[i]); diff --git a/libavcodec/snow.h b/libavcodec/snow.h index aa27a50fd1..abf330962c 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -165,6 +165,7 @@ typedef struct SnowContext{ MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX) uint8_t *scratchbuf; + uint8_t *emu_edge_buffer; }SnowContext; /* Tables */ diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 7503953e11..f732820bd3 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -675,7 +675,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, uin uint8_t *src= s-> input_picture.data[plane_index]; IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4; uint8_t *cur = s->scratchbuf; - uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)]; + uint8_t *tmp = s->emu_edge_buffer; const int b_stride = s->b_width << s->block_max_depth; const int b_height = s->b_height<< s->block_max_depth; const int w= p->width; -- cgit v1.2.3 From 09f211987cddf279390f8abe24d6a7a69622e356 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 13 Jun 2012 11:41:12 +0200 Subject: misc typo and wording fixes --- libavcodec/anm.c | 4 ++-- libavcodec/dsputil.h | 4 ++-- libavcodec/h264.c | 4 ++-- libavcodec/version.h | 2 +- libavcodec/xvmc.h | 2 +- libavfilter/version.h | 2 +- libavformat/rtp.h | 2 +- libavformat/version.h | 2 +- tools/patcheck | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/anm.c b/libavcodec/anm.c index 831cdfb9ac..b86b7c0ffb 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -65,8 +65,8 @@ static av_cold int decode_init(AVCodecContext *avctx) * @return non-zero if destination buffer is exhausted * * a copy operation is achieved when 'gb' is set - * a fill operation is acheived when 'gb' is null and pixel is >= 0 - * a skip operation is acheived when 'gb' is null and pixel is < 0 + * a fill operation is achieved when 'gb' is null and pixel is >= 0 + * a skip operation is achieved when 'gb' is null and pixel is < 0 */ static inline int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index e54ae69831..77980e02f8 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -548,9 +548,9 @@ typedef struct DSPContext { * @param src source array * constraints: 16-byte aligned * @param min minimum value - * constraints: must in the the range [-(1<<24), 1<<24] + * constraints: must be in the range [-(1 << 24), 1 << 24] * @param max maximum value - * constraints: must in the the range [-(1<<24), 1<<24] + * constraints: must be in the range [-(1 << 24), 1 << 24] * @param len number of elements in the array * constraints: multiple of 32 greater than zero */ diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 025a0dd156..2d6a08e032 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1744,7 +1744,7 @@ static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y, } top_border = h->top_borders[top_idx][s->mb_x]; - /* There are two lines saved, the line above the the top macroblock + /* There are two lines saved, the line above the top macroblock * of a pair, and the line above the bottom macroblock. */ AV_COPY128(top_border, src_y + 16 * linesize); if (pixel_shift) @@ -4375,7 +4375,7 @@ again: if (ff_h264_decode_seq_parameter_set(h) < 0 && h->is_avc && (nalsize != consumed) && nalsize) { av_log(h->s.avctx, AV_LOG_DEBUG, - "SPS decoding failure, try parsing the coomplete NAL\n"); + "SPS decoding failure, trying again with the complete NAL\n"); init_get_bits(&s->gb, buf + buf_index + 1 - consumed, 8 * (nalsize - 1)); ff_h264_decode_seq_parameter_set(h); diff --git a/libavcodec/version.h b/libavcodec/version.h index f42aebe2bb..1e189f6390 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,7 +41,7 @@ #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) /** - * Those FF_API_* defines are not part of public API. + * These FF_API_* defines are not part of the public API. * They may change, break or disappear at any time. */ #ifndef FF_API_REQUEST_CHANNELS diff --git a/libavcodec/xvmc.h b/libavcodec/xvmc.h index cdec161c80..1f77e4efca 100644 --- a/libavcodec/xvmc.h +++ b/libavcodec/xvmc.h @@ -147,7 +147,7 @@ struct xvmc_pix_fmt { */ int filled_mv_blocks_num; - /** Number of the the next free data block; one data block consists of + /** Number of the next free data block; one data block consists of 64 short values in the data_blocks array. All blocks before this one have already been claimed by placing their position into the corresponding block description structure field, diff --git a/libavfilter/version.h b/libavfilter/version.h index 0f4353fea9..56ebc27dfd 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -41,7 +41,7 @@ #define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT /** - * Those FF_API_* defines are not part of public API. + * These FF_API_* defines are not part of the public API. * They may change, break or disappear at any time. */ #ifndef FF_API_AVFILTERPAD_PUBLIC diff --git a/libavformat/rtp.h b/libavformat/rtp.h index e9f87782fa..0ffe18fd84 100644 --- a/libavformat/rtp.h +++ b/libavformat/rtp.h @@ -77,7 +77,7 @@ enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type); #define RTCP_TX_RATIO_DEN 1000 /* An arbitrary id value for RTP Xiph streams - only relevant to indicate - * the the configuration has changed within a stream (by changing the + * that the configuration has changed within a stream (by changing the * ident value sent). */ #define RTP_XIPH_IDENT 0xfecdba diff --git a/libavformat/version.h b/libavformat/version.h index e2fa56188b..26bb2c596e 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -44,7 +44,7 @@ #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) /** - * Those FF_API_* defines are not part of public API. + * These FF_API_* defines are not part of the public API. * They may change, break or disappear at any time. */ #ifndef FF_API_CLOSE_INPUT_FILE diff --git a/tools/patcheck b/tools/patcheck index b3943c5d7c..78ca8246f7 100755 --- a/tools/patcheck +++ b/tools/patcheck @@ -67,7 +67,7 @@ $EGREP $OPT '^\+ *(const *|)static' $*| $EGREP --color=always '[^=]= *(0|NULL)[^ cat $TMP hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $* -hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention)\b' 'common typos' $* +hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|acheive)\b' 'common typos' $* hiegrep 'av_log\( *NULL' 'Missing context in av_log' $* hiegrep '[^sn]printf' 'Please use av_log' $* -- cgit v1.2.3 From 4051be6f50ff6a089195809cfdc872457b49ab02 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 2 Jul 2012 20:40:26 +0200 Subject: anm: fix a few Doxygen comments --- libavcodec/anm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/anm.c b/libavcodec/anm.c index b86b7c0ffb..d979ba4323 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -55,8 +55,9 @@ static av_cold int decode_init(AVCodecContext *avctx) /** * Perform decode operation - * @param dst, dst_end Destination image buffer - * @param gb, GetByteContext (optional, see below) + * @param dst pointer to destination image buffer + * @param dst_end pointer to end of destination image buffer + * @param gb GetByteContext (optional, see below) * @param pixel Fill color (optional, see below) * @param count Pixel count * @param x Pointer to x-axis counter -- cgit v1.2.3