From 179ae53fed874419951c3cc0f789ccecc980d641 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 11 Dec 2011 23:36:05 +0000 Subject: [PATCH 01/18] proresdec: fix decode_slice() prototype Make the function prototype match the argument of AVCodecCntext.execute() and remove the cast hiding this mismatch. Signed-off-by: Mans Rullgard --- libavcodec/proresdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c index 46434df263..adadcf8b75 100644 --- a/libavcodec/proresdec.c +++ b/libavcodec/proresdec.c @@ -499,8 +499,9 @@ static void decode_slice_plane(ProresContext *ctx, ProresThreadData *td, } -static int decode_slice(AVCodecContext *avctx, ProresThreadData *td) +static int decode_slice(AVCodecContext *avctx, void *tdata) { + ProresThreadData *td = tdata; ProresContext *ctx = avctx->priv_data; int mb_x_pos = td->x_pos; int mb_y_pos = td->y_pos; @@ -621,7 +622,7 @@ static int decode_picture(ProresContext *ctx, int pic_num, } } - return avctx->execute(avctx, (void *) decode_slice, + return avctx->execute(avctx, decode_slice, ctx->slice_data, NULL, slice_num, sizeof(ctx->slice_data[0])); } From 5695ae46f8771f5c63cb0f62faca6a3d27f7d921 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 11 Dec 2011 23:51:12 +0000 Subject: [PATCH 02/18] h264: remove useless cast Signed-off-by: Mans Rullgard --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 631ad96e6b..7a1af56004 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3708,7 +3708,7 @@ static int execute_decode_slices(H264Context *h, int context_count){ hx->s.error_count = 0; } - avctx->execute(avctx, (void *)decode_slice, + avctx->execute(avctx, decode_slice, h->thread_context, NULL, context_count, sizeof(void*)); /* pull back stuff from slices to master context */ From f64c2e710fa1a7b59753224e717f57c48462076f Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 12 Dec 2011 00:50:08 +0000 Subject: [PATCH 03/18] bswap: make generic implementation more compiler-friendly With these changes, gcc 4.5 and later recognise it as a bswap and use the proper instructions on ARM and x86. On x86, the 16-bit bswap is recognised from gcc 4.1. Signed-off-by: Mans Rullgard --- libavutil/arm/bswap.h | 2 ++ libavutil/bswap.h | 13 ++----------- libavutil/x86/bswap.h | 4 ++++ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/libavutil/arm/bswap.h b/libavutil/arm/bswap.h index 478ae981fb..f94cbcf23f 100644 --- a/libavutil/arm/bswap.h +++ b/libavutil/arm/bswap.h @@ -51,6 +51,7 @@ static av_always_inline av_const unsigned av_bswap16(unsigned x) } #endif +#if !AV_GCC_VERSION_AT_LEAST(4,5) #define av_bswap32 av_bswap32 static av_always_inline av_const uint32_t av_bswap32(uint32_t x) { @@ -66,6 +67,7 @@ static av_always_inline av_const uint32_t av_bswap32(uint32_t x) #endif /* HAVE_ARMV6 */ return x; } +#endif /* !AV_GCC_VERSION_AT_LEAST(4,5) */ #endif /* __ARMCC_VERSION */ diff --git a/libavutil/bswap.h b/libavutil/bswap.h index 3657ccd402..8a350e1cd5 100644 --- a/libavutil/bswap.h +++ b/libavutil/bswap.h @@ -65,23 +65,14 @@ static av_always_inline av_const uint16_t av_bswap16(uint16_t x) #ifndef av_bswap32 static av_always_inline av_const uint32_t av_bswap32(uint32_t x) { - x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); - x= (x>>16) | (x<<16); - return x; + return AV_BSWAP32C(x); } #endif #ifndef av_bswap64 static inline uint64_t av_const av_bswap64(uint64_t x) { - union { - uint64_t ll; - uint32_t l[2]; - } w, r; - w.ll = x; - r.l[0] = av_bswap32 (w.l[1]); - r.l[1] = av_bswap32 (w.l[0]); - return r.ll; + return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); } #endif diff --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h index b60d9ccd6c..6840b632cb 100644 --- a/libavutil/x86/bswap.h +++ b/libavutil/x86/bswap.h @@ -28,13 +28,16 @@ #include "config.h" #include "libavutil/attributes.h" +#if !AV_GCC_VERSION_AT_LEAST(4,1) #define av_bswap16 av_bswap16 static av_always_inline av_const unsigned av_bswap16(unsigned x) { __asm__("rorw $8, %w0" : "+r"(x)); return x; } +#endif /* !AV_GCC_VERSION_AT_LEAST(4,1) */ +#if !AV_GCC_VERSION_AT_LEAST(4,5) #define av_bswap32 av_bswap32 static av_always_inline av_const uint32_t av_bswap32(uint32_t x) { @@ -57,5 +60,6 @@ static inline uint64_t av_const av_bswap64(uint64_t x) return x; } #endif +#endif /* !AV_GCC_VERSION_AT_LEAST(4,5) */ #endif /* AVUTIL_X86_BSWAP_H */ From 5b0d35eaedbb08d0c11fa4f2b47a24d91aaa294d Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 12 Dec 2011 01:33:17 +0000 Subject: [PATCH 04/18] x86: bswap: remove test for bswap instruction Firstly, this test never worked as intended, always reporting success. Secondly, bswap is available from 486 onward and can thus be assumed present. Signed-off-by: Mans Rullgard --- configure | 3 --- libavutil/x86/bswap.h | 7 ------- 2 files changed, 10 deletions(-) diff --git a/configure b/configure index a0dc6e08f8..567fa9d1f4 100755 --- a/configure +++ b/configure @@ -1053,7 +1053,6 @@ HAVE_LIST=" asm_mod_y attribute_may_alias attribute_packed - bswap closesocket cmov dcbzl @@ -2741,8 +2740,6 @@ EOF enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"' enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"' - check_asm bswap '"bswap %%eax" ::: "%eax"' - if ! disabled_any asm mmx yasm; then if check_cmd $yasmexe --version; then enabled x86_64 && yasm_extra="-m amd64" diff --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h index 6840b632cb..c6cf007c86 100644 --- a/libavutil/x86/bswap.h +++ b/libavutil/x86/bswap.h @@ -41,14 +41,7 @@ static av_always_inline av_const unsigned av_bswap16(unsigned x) #define av_bswap32 av_bswap32 static av_always_inline av_const uint32_t av_bswap32(uint32_t x) { -#if HAVE_BSWAP __asm__("bswap %0" : "+r" (x)); -#else - __asm__("rorw $8, %w0 \n\t" - "rorl $16, %0 \n\t" - "rorw $8, %w0" - : "+r"(x)); -#endif return x; } From f1dba9e4988e78738ad9065e4639b82b8355774a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 12 Dec 2011 14:48:53 +0200 Subject: [PATCH 05/18] x86: Require 7 registers for the cabac asm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The change in 599b4c6ef didn't turn out to work properly on i386 on OS X, where it broke building with PIC enabled. Signed-off-by: Martin Storsjö --- libavcodec/x86/cabac.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h index d0d1332094..3c3652d5f0 100644 --- a/libavcodec/x86/cabac.h +++ b/libavcodec/x86/cabac.h @@ -81,7 +81,7 @@ "add "tmp" , "low" \n\t"\ "1: \n\t" -#if HAVE_6REGS && !defined(BROKEN_RELOCATIONS) +#if HAVE_7REGS && !defined(BROKEN_RELOCATIONS) #define get_cabac_inline get_cabac_inline_x86 static av_always_inline int get_cabac_inline_x86(CABACContext *c, uint8_t *const state) @@ -98,7 +98,7 @@ static av_always_inline int get_cabac_inline_x86(CABACContext *c, ); return bit & 1; } -#endif /* HAVE_6REGS && !defined(BROKEN_RELOCATIONS) */ +#endif /* HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */ #define get_cabac_bypass_sign get_cabac_bypass_sign_x86 static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val) From f6cf4be821e1901d983233edff8e22fe310fd6f6 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Mon, 12 Dec 2011 12:45:32 +0100 Subject: [PATCH 06/18] avconv: update -map option help text --- avconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avconv.c b/avconv.c index f3e80d3a86..91549a24fd 100644 --- a/avconv.c +++ b/avconv.c @@ -4113,7 +4113,7 @@ static const OptionDef options[] = { { "c", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(codec_names)}, "codec name", "codec" }, { "codec", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(codec_names)}, "codec name", "codec" }, { "pre", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(presets)}, "preset name", "preset" }, - { "map", HAS_ARG | OPT_EXPERT | OPT_FUNC2, {(void*)opt_map}, "set input stream mapping", "file.stream[:syncfile.syncstream]" }, + { "map", HAS_ARG | OPT_EXPERT | OPT_FUNC2, {(void*)opt_map}, "set input stream mapping", "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" }, { "map_metadata", HAS_ARG | OPT_EXPERT | OPT_FUNC2, {(void*)opt_map_metadata}, "set metadata information of outfile from infile", "outfile[,metadata]:infile[,metadata]" }, { "map_chapters", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(chapters_input_file)}, "set chapters mapping", "input_file_index" }, From 5b22d6e1323989b078ad097c5b50dddbbf0fe251 Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Wed, 7 Dec 2011 08:51:36 -0500 Subject: [PATCH 07/18] lavc: convert error_recognition to err_recognition. Signed-off-by: Anton Khirnov --- libavcodec/error_resilience.c | 8 ++++---- libavcodec/h263dec.c | 2 +- libavcodec/h264.c | 2 +- libavcodec/ituh263dec.c | 2 +- libavcodec/mpeg4video.h | 2 +- libavcodec/mpeg4videodec.c | 4 ++-- libavcodec/mpegvideo.c | 2 +- libavcodec/mpegvideo.h | 2 +- libavcodec/msmpeg4.c | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index a2e911b951..354e6b0717 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -703,7 +703,7 @@ static int is_intra_more_likely(MpegEncContext *s){ } void ff_er_frame_start(MpegEncContext *s){ - if(!s->error_recognition) return; + if(!s->err_recognition) return; memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_stride*s->mb_height*sizeof(uint8_t)); s->error_count= 3*s->mb_num; @@ -731,7 +731,7 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en return; } - if(!s->error_recognition) return; + if(!s->err_recognition) return; mask &= ~VP_START; if(status & (AC_ERROR|AC_END)){ @@ -787,7 +787,7 @@ void ff_er_frame_end(MpegEncContext *s){ int size = s->b8_stride * 2 * s->mb_height; Picture *pic= s->current_picture_ptr; - if(!s->error_recognition || s->error_count==0 || s->avctx->lowres || + if(!s->err_recognition || s->error_count==0 || s->avctx->lowres || s->avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU || s->picture_structure != PICT_FRAME || // we do not support ER of field pictures yet, though it should not crash if enabled @@ -859,7 +859,7 @@ void ff_er_frame_end(MpegEncContext *s){ } /* handle missing slices */ - if(s->error_recognition>=4){ + if(s->err_recognition&AV_EF_EXPLODE){ int end_ok=1; for(i=s->mb_num-2; i>=s->mb_width+100; i--){ //FIXME +100 hack diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 48f8240bc8..71ff2feac4 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -310,7 +310,7 @@ static int decode_slice(MpegEncContext *s){ max_extra+= 17; /* buggy padding but the frame should still end approximately at the bitstream end */ - if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_recognition>=3) + if((s->workaround_bugs&FF_BUG_NO_PADDING) && (s->err_recognition&AV_EF_BUFFER)) max_extra+= 48; else if((s->workaround_bugs&FF_BUG_NO_PADDING)) max_extra+= 256*256*256*64; diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 7a1af56004..4bcec7c418 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3704,7 +3704,7 @@ static int execute_decode_slices(H264Context *h, int context_count){ } else { for(i = 1; i < context_count; i++) { hx = h->thread_context[i]; - hx->s.error_recognition = avctx->error_recognition; + hx->s.err_recognition = avctx->err_recognition; hx->s.error_count = 0; } diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index a234c2ac7a..dceb62b84c 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -484,7 +484,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block, level = get_bits(&s->gb, 8); if((level&0x7F) == 0){ av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y); - if(s->error_recognition >= FF_ER_COMPLIANT) + if(s->err_recognition & AV_EF_BITSTREAM) return -1; } if (level == 255) diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h index d34e73149c..9f6f431080 100644 --- a/libavcodec/mpeg4video.h +++ b/libavcodec/mpeg4video.h @@ -174,7 +174,7 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *di }else{ level += pred; ret= level; - if(s->error_recognition>=3){ + if(s->err_recognition&AV_EF_BITSTREAM){ if(level<0){ av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y); return -1; diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 2807d506ee..8bc30fdbb2 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -520,7 +520,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) if (code > 8){ if(get_bits1(&s->gb)==0){ /* marker */ - if(s->error_recognition>=2){ + if(s->err_recognition&AV_EF_BITSTREAM){ av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n"); return -1; } @@ -994,7 +994,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, else level= level * qmul - qadd; if((unsigned)(level + 2048) > 4095){ - if(s->error_recognition > FF_ER_COMPLIANT){ + if(s->err_recognition & AV_EF_BITSTREAM){ if(level > 2560 || level<-2560){ av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale); return -1; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index f2651c8ac1..27e9f10f28 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1305,7 +1305,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) } } - s->error_recognition= avctx->error_recognition; + s->err_recognition = avctx->err_recognition; /* set dequantizer, we can't do it during init as it might change for mpeg4 and we can't do it in the header decode as init is not called for mpeg4 there yet */ diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 01df491907..599e3540ec 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -487,7 +487,7 @@ typedef struct MpegEncContext { GetBitContext last_resync_gb; ///< used to search for the next resync marker int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) int next_p_frame_damaged; ///< set if the next p frame is damaged, to avoid showing trashed b frames - int error_recognition; + int err_recognition; ParseContext parse_context; diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 84e6249858..ee2ae3d49d 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1810,7 +1810,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, i-= 192; if(i&(~63)){ const int left= get_bits_left(&s->gb); - if(((i+192 == 64 && level/qmul==-1) || s->error_recognition<=1) && left>=0){ + if(((i+192 == 64 && level/qmul==-1) || !(s->err_recognition&AV_EF_BITSTREAM)) && left>=0){ av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y); break; }else{ From 1be323054e05d79f5e74896add75a04802d79846 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 12:43:50 +0100 Subject: [PATCH 08/18] Add basic libavdevice documentation. --- libavdevice/avdevice.h | 22 ++++++++++++++++++++++ libavutil/avutil.h | 1 + 2 files changed, 23 insertions(+) diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index fd82816713..e6c86cb3c3 100644 --- a/libavdevice/avdevice.h +++ b/libavdevice/avdevice.h @@ -19,6 +19,28 @@ #ifndef AVDEVICE_AVDEVICE_H #define AVDEVICE_AVDEVICE_H +/** + * @file + * @ingroup lavd + * Main libavdevice API header + */ + +/** + * @defgroup lavd Special devices muxing/demuxing library + * @{ + * Libavdevice is a complementary library to @ref libavf "libavformat". It + * provides various "special" platform-specific muxers and demuxers, e.g. for + * grabbing devices, audio capture and playback etc. As a consequence, the + * (de)muxers in libavdevice are of the AVFMT_NOFILE type (they use their own + * I/O functions). The filename passed to avformat_open_input() often does not + * refer to an actually existing file, but has some special device-specific + * meaning - e.g. for the x11grab device it is the display name. + * + * To use libavdevice, simply call avdevice_register_all() to register all + * compiled muxers and demuxers. They all use standard libavformat API. + * @} + */ + #include "libavutil/avutil.h" #define LIBAVDEVICE_VERSION_MAJOR 53 diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 1ed9ffe87c..fa84eff9e7 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -37,6 +37,7 @@ * @li @ref libavc "libavcodec" encoding/decoding library * @li @subpage libavfilter graph based frame editing library * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavd "libavdevice" special devices muxing/demuxing library * @li @ref lavu "libavutil" common utility library * @li @subpage libpostproc post processing library * @li @subpage libswscale color conversion and scaling library From 469c62d0025518be994abe328c62b1fc160fe8bf Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 07:55:21 +0100 Subject: [PATCH 09/18] lavf doxy: add core functions to a doxy group. --- libavformat/avformat.h | 187 ++++++++++++++++++++++------------------- 1 file changed, 99 insertions(+), 88 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index eff60094b1..93087cbed2 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -62,21 +62,6 @@ * */ -/** - * Return the LIBAVFORMAT_VERSION_INT constant. - */ -unsigned avformat_version(void); - -/** - * Return the libavformat build-time configuration. - */ -const char *avformat_configuration(void); - -/** - * Return the libavformat license. - */ -const char *avformat_license(void); - #include #include /* FILE */ #include "libavcodec/avcodec.h" @@ -1110,6 +1095,60 @@ typedef struct AVPacketList { struct AVPacketList *next; } AVPacketList; + +/** + * @defgroup lavf_core Core functions + * @ingroup libavf + * + * Functions for querying libavformat capabilities, allocating core structures, + * etc. + * @{ + */ + +/** + * Return the LIBAVFORMAT_VERSION_INT constant. + */ +unsigned avformat_version(void); + +/** + * Return the libavformat build-time configuration. + */ +const char *avformat_configuration(void); + +/** + * Return the libavformat license. + */ +const char *avformat_license(void); + +/** + * Initialize libavformat and register all the muxers, demuxers and + * protocols. If you do not call this function, then you can select + * exactly which formats you want to support. + * + * @see av_register_input_format() + * @see av_register_output_format() + * @see av_register_protocol() + */ +void av_register_all(void); + +void av_register_input_format(AVInputFormat *format); +void av_register_output_format(AVOutputFormat *format); + +/** + * Do global initialization of network components. This is optional, + * but recommended, since it avoids the overhead of implicitly + * doing the setup for each session. + * + * Calling this function will become mandatory if using network + * protocols at some major version bump. + */ +int avformat_network_init(void); + +/** + * Undo the initialization done by avformat_network_init. + */ +int avformat_network_deinit(void); + /** * If f is NULL, returns the first registered input format, * if f is non-NULL, returns the next registered input format after f @@ -1124,17 +1163,55 @@ AVInputFormat *av_iformat_next(AVInputFormat *f); */ AVOutputFormat *av_oformat_next(AVOutputFormat *f); +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. + */ +AVFormatContext *avformat_alloc_context(void); + +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + +/** + * Get the AVClass for AVFormatContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avformat_get_class(void); + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); + +AVProgram *av_new_program(AVFormatContext *s, int id); + +/** + * @} + */ + + #if FF_API_GUESS_IMG2_CODEC attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename); #endif -/* XXX: Use automatic init with either ELF sections or C file parser */ -/* modules. */ - -/* utils.c */ -void av_register_input_format(AVInputFormat *format); -void av_register_output_format(AVOutputFormat *format); - /** * Return the output format in the list of registered output formats * which best matches the provided parameters, or return NULL if @@ -1214,17 +1291,6 @@ attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); #endif -/** - * Initialize libavformat and register all the muxers, demuxers and - * protocols. If you do not call this function, then you can select - * exactly which formats you want to support. - * - * @see av_register_input_format() - * @see av_register_output_format() - * @see av_register_protocol() - */ -void av_register_all(void); - /** * Get the CodecID for the given codec tag tag. * If no codec id is found returns CODEC_ID_NONE. @@ -1243,13 +1309,6 @@ enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int */ unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); -/** - * Allocate an AVFormatContext. - * avformat_free_context() can be used to free the context and everything - * allocated by the framework within it. - */ -AVFormatContext *avformat_alloc_context(void); - /** * @addtogroup lavf_decoding * @{ @@ -1534,12 +1593,6 @@ void av_close_input_file(AVFormatContext *s); * @} */ -/** - * Free an AVFormatContext and all its streams. - * @param s context to free - */ -void avformat_free_context(AVFormatContext *s); - #if FF_API_NEW_STREAM /** * Add a new stream to a media file. @@ -1555,25 +1608,6 @@ attribute_deprecated AVStream *av_new_stream(AVFormatContext *s, int id); #endif -/** - * Add a new stream to a media file. - * - * When demuxing, it is called by the demuxer in read_header(). If the - * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also - * be called in read_packet(). - * - * When muxing, should be called by the user before avformat_write_header(). - * - * @param c If non-NULL, the AVCodecContext corresponding to the new stream - * will be initialized to use this codec. This is needed for e.g. codec-specific - * defaults to be set, so codec should be provided if it is known. - * - * @return newly created stream or NULL on error. - */ -AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); - -AVProgram *av_new_program(AVFormatContext *s, int id); - #if FF_API_SET_PTS_INFO /** * @deprecated this function is not supposed to be called outside of lavf @@ -1852,27 +1886,4 @@ int av_match_ext(const char *filename, const char *extensions); */ int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance); -/** - * Get the AVClass for AVFormatContext. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - */ -const AVClass *avformat_get_class(void); - -/** - * Do global initialization of network components. This is optional, - * but recommended, since it avoids the overhead of implicitly - * doing the setup for each session. - * - * Calling this function will become mandatory if using network - * protocols at some major version bump. - */ -int avformat_network_init(void); - -/** - * Undo the initialization done by avformat_network_init. - */ -int avformat_network_deinit(void); - #endif /* AVFORMAT_AVFORMAT_H */ From c8dffc02fd6fb87f91183b01056d1a323ffadca3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 08:07:53 +0100 Subject: [PATCH 10/18] lavf doxy: add av_guess_codec/format to the encoding group. --- libavformat/avformat.h | 47 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 93087cbed2..b35580c681 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1212,29 +1212,6 @@ AVProgram *av_new_program(AVFormatContext *s, int id); attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename); #endif -/** - * Return the output format in the list of registered output formats - * which best matches the provided parameters, or return NULL if - * there is no match. - * - * @param short_name if non-NULL checks if short_name matches with the - * names of the registered formats - * @param filename if non-NULL checks if filename terminates with the - * extensions of the registered formats - * @param mime_type if non-NULL checks if mime_type matches with the - * MIME type of the registered formats - */ -AVOutputFormat *av_guess_format(const char *short_name, - const char *filename, - const char *mime_type); - -/** - * Guess the codec ID based upon muxer and filename. - */ -enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, - const char *filename, const char *mime_type, - enum AVMediaType type); - /** * Send a nice hexadecimal dump of a buffer to the specified file stream. * @@ -1785,6 +1762,30 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, * @return 0 if OK, AVERROR_xxx on error */ int av_write_trailer(AVFormatContext *s); + +/** + * Return the output format in the list of registered output formats + * which best matches the provided parameters, or return NULL if + * there is no match. + * + * @param short_name if non-NULL checks if short_name matches with the + * names of the registered formats + * @param filename if non-NULL checks if filename terminates with the + * extensions of the registered formats + * @param mime_type if non-NULL checks if mime_type matches with the + * MIME type of the registered formats + */ +AVOutputFormat *av_guess_format(const char *short_name, + const char *filename, + const char *mime_type); + +/** + * Guess the codec ID based upon muxer and filename. + */ +enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, + const char *filename, const char *mime_type, + enum AVMediaType type); + /** * @} */ From abf2c2d787ed3e3d91425b38c4b356b8f00f8dc2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 08:08:46 +0100 Subject: [PATCH 11/18] lavf doxy: add misc utility functions to a group. --- libavformat/avformat.h | 243 ++++++++++++++++++++++------------------- 1 file changed, 130 insertions(+), 113 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index b35580c681..cfec2f6a99 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1212,79 +1212,12 @@ AVProgram *av_new_program(AVFormatContext *s, int id); attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename); #endif -/** - * Send a nice hexadecimal dump of a buffer to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 - */ -void av_hex_dump(FILE *f, uint8_t *buf, int size); - -/** - * Send a nice hexadecimal dump of a buffer to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 - */ -void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); - -/** - * Send a nice dump of a packet to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param pkt packet to dump - * @param dump_payload True if the payload must be displayed, too. - * @param st AVStream that the packet belongs to - */ -void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); - - -/** - * Send a nice dump of a packet to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param pkt packet to dump - * @param dump_payload True if the payload must be displayed, too. - * @param st AVStream that the packet belongs to - */ -void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, - AVStream *st); - #if FF_API_PKT_DUMP attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); #endif -/** - * Get the CodecID for the given codec tag tag. - * If no codec id is found returns CODEC_ID_NONE. - * - * @param tags list of supported codec_id-codec_tag pairs, as stored - * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag - */ -enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); - -/** - * Get the codec tag for the given codec id id. - * If no codec tag is found returns 0. - * - * @param tags list of supported codec_id-codec_tag pairs, as stored - * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag - */ -unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); /** * @addtogroup lavf_decoding @@ -1599,27 +1532,6 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits, #define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes #define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number -int av_find_default_stream_index(AVFormatContext *s); - -/** - * Get the index for a specific timestamp. - * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond - * to the timestamp which is <= the requested one, if backward - * is 0, then it will be >= - * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise - * @return < 0 if no such timestamp could be found - */ -int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); - -/** - * Add an index entry into a sorted list. Update the entry if the list - * already contains it. - * - * @param timestamp timestamp in the time base of the given stream - */ -int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, - int size, int distance, int flags); - #if FF_API_SEEK_PUBLIC attribute_deprecated int av_seek_frame_binary(AVFormatContext *s, int stream_index, @@ -1642,31 +1554,6 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, attribute_deprecated int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap); #endif -/** - * Split a URL string into components. - * - * The pointers to buffers for storing individual components may be null, - * in order to ignore that component. Buffers for components not found are - * set to empty strings. If the port is not found, it is set to a negative - * value. - * - * @param proto the buffer for the protocol - * @param proto_size the size of the proto buffer - * @param authorization the buffer for the authorization - * @param authorization_size the size of the authorization buffer - * @param hostname the buffer for the host name - * @param hostname_size the size of the hostname buffer - * @param port_ptr a pointer to store the port number in - * @param path the buffer for the path - * @param path_size the size of the path buffer - * @param url the URL to split - */ -void av_url_split(char *proto, int proto_size, - char *authorization, int authorization_size, - char *hostname, int hostname_size, - int *port_ptr, - char *path, int path_size, - const char *url); /** * @addtogroup lavf_encoding * @{ @@ -1790,6 +1677,132 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, * @} */ + +/** + * @defgroup lavf_misc Utility functions + * @ingroup libavf + * @{ + * + * Miscelaneous utility functions related to both muxing and demuxing + * (or neither). + */ + +/** + * Send a nice hexadecimal dump of a buffer to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump(FILE *f, uint8_t *buf, int size); + +/** + * Send a nice hexadecimal dump of a buffer to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); + +/** + * Send a nice dump of a packet to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); + + +/** + * Send a nice dump of a packet to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st); + +/** + * Get the CodecID for the given codec tag tag. + * If no codec id is found returns CODEC_ID_NONE. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + */ +enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); + +/** + * Get the codec tag for the given codec id id. + * If no codec tag is found returns 0. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + */ +unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); + +int av_find_default_stream_index(AVFormatContext *s); + +/** + * Get the index for a specific timestamp. + * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond + * to the timestamp which is <= the requested one, if backward + * is 0, then it will be >= + * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise + * @return < 0 if no such timestamp could be found + */ +int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); + +/** + * Add an index entry into a sorted list. Update the entry if the list + * already contains it. + * + * @param timestamp timestamp in the time base of the given stream + */ +int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, + int size, int distance, int flags); + + +/** + * Split a URL string into components. + * + * The pointers to buffers for storing individual components may be null, + * in order to ignore that component. Buffers for components not found are + * set to empty strings. If the port is not found, it is set to a negative + * value. + * + * @param proto the buffer for the protocol + * @param proto_size the size of the proto buffer + * @param authorization the buffer for the authorization + * @param authorization_size the size of the authorization buffer + * @param hostname the buffer for the host name + * @param hostname_size the size of the hostname buffer + * @param port_ptr a pointer to store the port number in + * @param path the buffer for the path + * @param path_size the size of the path buffer + * @param url the URL to split + */ +void av_url_split(char *proto, int proto_size, + char *authorization, int authorization_size, + char *hostname, int hostname_size, + int *port_ptr, + char *path, int path_size, + const char *url); + #if FF_API_DUMP_FORMAT attribute_deprecated void dump_format(AVFormatContext *ic, int index, @@ -1887,4 +1900,8 @@ int av_match_ext(const char *filename, const char *extensions); */ int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance); +/** + * @} + */ + #endif /* AVFORMAT_AVFORMAT_H */ From ccbc106841ced3ea2653a48cae1038a324313f1c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 09:05:11 +0100 Subject: [PATCH 12/18] lavf doxy: add some general lavf information. --- libavformat/avformat.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index cfec2f6a99..688137259d 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -31,6 +31,41 @@ * @defgroup libavf I/O and Muxing/Demuxing Library * @{ * + * Libavformat (lavf) is a library for dealing with various media container + * formats. Its main two purposes are demuxing - i.e. splitting a media file + * into component streams, and the reverse process of muxing - writing supplied + * data in a specified container format. It also has an @ref lavf_io + * "I/O module" which supports a number of protocols for accessing the data (e.g. + * file, tcp, http and others). Before using lavf, you need to call + * av_register_all() to register all compiled muxers, demuxers and protocols. + * Unless you are absolutely sure you won't use libavformat's network + * capabilities, you should also call avformat_network_init(). + * + * A supported input format is described by an AVInputFormat struct, conversely + * an output format is described by AVOutputFormat. You can iterate over all + * registered input/output formats using the av_iformat_next() / + * av_oformat_next() functions. The protocols layer is not part of the public + * API, so you can only get the names of supported protocols with the + * avio_enum_protocols() function. + * + * Main lavf structure used for both muxing and demuxing is AVFormatContext, + * which exports all information about the file being read or written. As with + * most Libav structures, its size is not part of public ABI, so it cannot be + * allocated on stack or directly with av_malloc(). To create an + * AVFormatContext, use avformat_alloc_context() (some functions, like + * avformat_open_input() might do that for you). + * + * Most importantly an AVFormatContext contains: + * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat + * "output" format. It is either autodetected or set by user for input; + * always set by user for output. + * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all + * elementary streams stored in the file. AVStreams are typically referred to + * using their index in this array. + * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or + * set by user for input, always set by user for output (unless you are dealing + * with an AVFMT_NOFILE format). + * * @defgroup lavf_decoding Demuxing * @{ * @} From 59826cab8ad9f64bf5fd752f52c6acc16815dbb0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 09:51:19 +0100 Subject: [PATCH 13/18] lavf doxy: add some basic demuxing documentation. --- libavformat/avformat.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 688137259d..faef47483d 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -68,6 +68,44 @@ * * @defgroup lavf_decoding Demuxing * @{ + * Demuxers read a media file and split it into chunks of data (@em packets). A + * @ref AVPacket "packet" contains one or more frames which belong a single + * elementary stream. In lavf API this process is represented by the + * avformat_open_input() function for opening a file, av_read_frame() for + * reading a single packet and finally avformat_close_input(), which does the + * cleanup. + * + * @section lavf_decoding_open Opening a media file + * The minimum information required to open a file is its URL or filename, which + * is passed to avformat_open_input(), as in the following code: + * @code + * const char *url = "in.mp3"; + * AVFormatContext *s = NULL; + * int ret = avformat_open_input(&s, url, NULL, NULL); + * if (ret < 0) + * abort(); + * @endcode + * The above code attempts to allocate an AVFormatContext, open the + * specified file (autodetecting the format) and read the header, exporting the + * information stored there into s. Some formats do not have a header or do not + * store enough information there, so it is recommended that you call the + * avformat_find_stream_info() function which tries to read and decode a few + * frames to find missing information. + * + * In some cases you might want to preallocate an AVFormatContext yourself with + * avformat_alloc_context() and do some tweaking on it before passing it to + * avformat_open_input(). One such case is when you want to use custom functions + * for reading input data instead of lavf internal I/O layer. + * To do that, create your own AVIOContext with avio_alloc_context(), passing + * your reading callbacks to it. Then set the @em pb field of your + * AVFormatContext to newly created AVIOContext. + * + * After you have finished reading the file, you must close it with + * avformat_close_input(). It will free everything associated with the file. + * + * @section lavf_decoding_read Reading from an opened file + * + * @section lavf_decoding_seek Seeking * @} * * @defgroup lavf_encoding Muxing From 3a7f7678eb3be1f9a28414c9908ed8d34b1b9846 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 10:01:46 +0100 Subject: [PATCH 14/18] lavf: deprecate av_close_input_stream(). And remove all its uses. --- avserver.c | 4 ++-- libavformat/anm.c | 11 +++++------ libavformat/avformat.h | 4 ++++ libavformat/mpegts.c | 2 +- libavformat/rtsp.c | 2 +- libavformat/utils.c | 7 ++++++- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/avserver.c b/avserver.c index e4d353b559..89e0e6da1d 100644 --- a/avserver.c +++ b/avserver.c @@ -2736,7 +2736,7 @@ static int http_receive_data(HTTPContext *c) /* Now we have the actual streams */ if (s->nb_streams != feed->nb_streams) { - av_close_input_stream(s); + av_close_input_file(s); av_free(pb); http_log("Feed '%s' stream number does not match registered feed\n", c->stream->feed_filename); @@ -2749,7 +2749,7 @@ static int http_receive_data(HTTPContext *c) avcodec_copy_context(fst->codec, st->codec); } - av_close_input_stream(s); + av_close_input_file(s); av_free(pb); } c->buffer_ptr = c->buffer; diff --git a/libavformat/anm.c b/libavformat/anm.c index 00a36abebe..7ceb2d8918 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -137,16 +137,16 @@ static int read_header(AVFormatContext *s, st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { ret = AVERROR(ENOMEM); - goto close_and_return; + goto fail; } ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size); if (ret < 0) - goto close_and_return; + goto fail; /* read page table */ ret = avio_seek(pb, anm->page_table_offset, SEEK_SET); if (ret < 0) - goto close_and_return; + goto fail; for (i = 0; i < MAX_PAGES; i++) { Page *p = &anm->pt[i]; @@ -159,7 +159,7 @@ static int read_header(AVFormatContext *s, anm->page = find_record(anm, 0); if (anm->page < 0) { ret = anm->page; - goto close_and_return; + goto fail; } anm->record = -1; @@ -169,8 +169,7 @@ invalid: av_log_ask_for_sample(s, NULL); ret = AVERROR_INVALIDDATA; -close_and_return: - av_close_input_stream(s); +fail: return ret; } diff --git a/libavformat/avformat.h b/libavformat/avformat.h index faef47483d..548bc186fb 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1560,11 +1560,15 @@ int av_read_play(AVFormatContext *s); */ int av_read_pause(AVFormatContext *s); +#if FF_API_FORMAT_PARAMETERS /** * Free a AVFormatContext allocated by av_open_input_stream. * @param s context to free + * @deprecated use av_close_input_file() */ +attribute_deprecated void av_close_input_stream(AVFormatContext *s); +#endif /** * Close a media file (but not its codecs). diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 37ffae9f66..0d25e3f254 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -368,7 +368,7 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter) PESContext *pes = filter->u.pes_filter.opaque; av_freep(&pes->buffer); /* referenced private data will be freed later in - * av_close_input_stream */ + * av_close_input_file */ if (!((PESContext *)filter->u.pes_filter.opaque)->st) { av_freep(&filter->u.pes_filter.opaque); } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index b63f9f68cf..52821545ff 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -580,7 +580,7 @@ void ff_rtsp_close_streams(AVFormatContext *s) } av_free(rt->rtsp_streams); if (rt->asf_ctx) { - av_close_input_stream (rt->asf_ctx); + av_close_input_file(rt->asf_ctx); rt->asf_ctx = NULL; } av_free(rt->p); diff --git a/libavformat/utils.c b/libavformat/utils.c index 8b749ad7fc..8a76cb815e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2632,6 +2632,7 @@ int av_read_pause(AVFormatContext *s) return AVERROR(ENOSYS); } +#if FF_API_FORMAT_PARAMETERS void av_close_input_stream(AVFormatContext *s) { flush_packet_queue(s); @@ -2639,6 +2640,7 @@ void av_close_input_stream(AVFormatContext *s) s->iformat->read_close(s); avformat_free_context(s); } +#endif void avformat_free_context(AVFormatContext *s) { @@ -2686,7 +2688,10 @@ void av_close_input_file(AVFormatContext *s) { AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; - av_close_input_stream(s); + flush_packet_queue(s); + if (s->iformat->read_close) + s->iformat->read_close(s); + avformat_free_context(s); if (pb) avio_close(pb); } From 526604545fb1cc0c11af356fbffd5cddf8cdc95f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 10:34:08 +0100 Subject: [PATCH 15/18] lavf: add avformat_close_input(). It sets the supplied AVFormatContext pointer to NULL after freeing it, which is safer and its name is consistent with other lavf functions. Also deprecate av_close_input_file(). --- doc/APIchanges | 4 ++++ libavformat/avformat.h | 10 ++++++++++ libavformat/utils.c | 9 +++++++++ libavformat/version.h | 5 ++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 2c43e75dba..49c49d8b49 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,10 @@ libavutil: 2011-04-18 API changes, most recent first: +2011-xx-xx - xxxxxxx - lavf 53.17.0 + Add avformat_open_input(). + Deprecate av_close_input_file() and av_close_input_stream(). + 2011-xx-xx - xxxxxxx - lavc 53.25.0 Add nb_samples and extended_data fields to AVFrame. Deprecate AVCODEC_MAX_AUDIO_FRAME_SIZE. diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 548bc186fb..2eb75df43a 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1570,12 +1570,22 @@ attribute_deprecated void av_close_input_stream(AVFormatContext *s); #endif +#if FF_API_CLOSE_INPUT_FILE /** + * @deprecated use avformat_close_input() * Close a media file (but not its codecs). * * @param s media file handle */ +attribute_deprecated void av_close_input_file(AVFormatContext *s); +#endif + +/** + * Close an opened input AVFormatContext. Free it and all its contents + * and set *s to NULL. + */ +void avformat_close_input(AVFormatContext **s); /** * @} */ diff --git a/libavformat/utils.c b/libavformat/utils.c index 8a76cb815e..a078d9c88b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2684,14 +2684,23 @@ void avformat_free_context(AVFormatContext *s) av_free(s); } +#if FF_API_CLOSE_INPUT_FILE void av_close_input_file(AVFormatContext *s) { + avformat_close_input(&s); +} +#endif + +void avformat_close_input(AVFormatContext **ps) +{ + AVFormatContext *s = *ps; AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; flush_packet_queue(s); if (s->iformat->read_close) s->iformat->read_close(s); avformat_free_context(s); + *ps = NULL; if (pb) avio_close(pb); } diff --git a/libavformat/version.h b/libavformat/version.h index 7ba411c494..e80787b2ee 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,7 +30,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 53 -#define LIBAVFORMAT_VERSION_MINOR 16 +#define LIBAVFORMAT_VERSION_MINOR 17 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ @@ -122,5 +122,8 @@ #ifndef FF_API_SET_PTS_INFO #define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_CLOSE_INPUT_FILE +#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif /* AVFORMAT_VERSION_H */ From cd3716b9aae7e141e7b4faf9783131809f40991f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 11 Dec 2011 10:38:28 +0100 Subject: [PATCH 16/18] Replace all uses of av_close_input_file() with avformat_close_input(). --- avconv.c | 4 ++-- avplay.c | 3 +-- avprobe.c | 2 +- avserver.c | 17 ++++++++--------- libavfilter/vsrc_movie.c | 2 +- libavformat/applehttp.c | 2 +- libavformat/avidec.c | 2 +- libavformat/mpegts.c | 2 +- libavformat/rdt.c | 2 +- libavformat/rtpdec_asf.c | 3 +-- libavformat/rtsp.c | 3 +-- libavformat/sapdec.c | 2 +- libavformat/seek-test.c | 2 +- tools/pktdumper.c | 2 +- 14 files changed, 22 insertions(+), 26 deletions(-) diff --git a/avconv.c b/avconv.c index 91549a24fd..90ed00d935 100644 --- a/avconv.c +++ b/avconv.c @@ -523,7 +523,7 @@ void exit_program(int ret) av_dict_free(&output_files[i].opts); } for(i=0;isubtitle_stream >= 0) stream_component_close(is, is->subtitle_stream); if (is->ic) { - av_close_input_file(is->ic); - is->ic = NULL; /* safety */ + avformat_close_input(&is->ic); } avio_set_interrupt_cb(NULL); diff --git a/avprobe.c b/avprobe.c index 992f07c5cf..de9657b7e3 100644 --- a/avprobe.c +++ b/avprobe.c @@ -325,7 +325,7 @@ static int probe_file(const char *filename) if (do_show_format) show_format(fmt_ctx); - av_close_input_file(fmt_ctx); + avformat_close_input(&fmt_ctx); return 0; } diff --git a/avserver.c b/avserver.c index 89e0e6da1d..9016d1f9df 100644 --- a/avserver.c +++ b/avserver.c @@ -849,7 +849,7 @@ static void close_connection(HTTPContext *c) if (st->codec->codec) avcodec_close(st->codec); } - av_close_input_file(c->fmt_in); + avformat_close_input(&c->fmt_in); } /* free RTP output streams if any */ @@ -2169,7 +2169,7 @@ static int open_input_stream(HTTPContext *c, const char *info) c->fmt_in = s; if (strcmp(s->iformat->name, "ffm") && avformat_find_stream_info(c->fmt_in, NULL) < 0) { http_log("Could not find stream info '%s'\n", input_filename); - av_close_input_file(s); + avformat_close_input(&s); return -1; } @@ -2311,8 +2311,7 @@ static int http_prepare_data(HTTPContext *c) return 0; } else { if (c->stream->loop) { - av_close_input_file(c->fmt_in); - c->fmt_in = NULL; + avformat_close_input(&c->fmt_in); if (open_input_stream(c, "") < 0) goto no_loop; goto redo; @@ -2736,7 +2735,7 @@ static int http_receive_data(HTTPContext *c) /* Now we have the actual streams */ if (s->nb_streams != feed->nb_streams) { - av_close_input_file(s); + avformat_close_input(&s); av_free(pb); http_log("Feed '%s' stream number does not match registered feed\n", c->stream->feed_filename); @@ -2749,7 +2748,7 @@ static int http_receive_data(HTTPContext *c) avcodec_copy_context(fst->codec, st->codec); } - av_close_input_file(s); + avformat_close_input(&s); av_free(pb); } c->buffer_ptr = c->buffer; @@ -3629,7 +3628,7 @@ static void build_file_streams(void) if (avformat_find_stream_info(infile, NULL) < 0) { http_log("Could not find codec parameters from '%s'\n", stream->feed_filename); - av_close_input_file(infile); + avformat_close_input(&infile); goto fail; } extract_mpeg4_header(infile); @@ -3637,7 +3636,7 @@ static void build_file_streams(void) for(i=0;inb_streams;i++) add_av_stream1(stream, infile->streams[i]->codec, 1); - av_close_input_file(infile); + avformat_close_input(&infile); } } } @@ -3727,7 +3726,7 @@ static void build_feed_streams(void) http_log("Deleting feed file '%s' as stream counts differ (%d != %d)\n", feed->feed_filename, s->nb_streams, feed->nb_streams); - av_close_input_file(s); + avformat_close_input(&s); } else http_log("Deleting feed file '%s' as it appears to be corrupt\n", feed->feed_filename); diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c index a5e9124128..dec499904e 100644 --- a/libavfilter/vsrc_movie.c +++ b/libavfilter/vsrc_movie.c @@ -192,7 +192,7 @@ static av_cold void uninit(AVFilterContext *ctx) if (movie->codec_ctx) avcodec_close(movie->codec_ctx); if (movie->format_ctx) - av_close_input_file(movie->format_ctx); + avformat_close_input(&movie->format_ctx); avfilter_unref_buffer(movie->picref); av_freep(&movie->frame); } diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 366d8327ff..7cc04999d1 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -132,7 +132,7 @@ static void free_variant_list(AppleHTTPContext *c) ffurl_close(var->input); if (var->ctx) { var->ctx->pb = NULL; - av_close_input_file(var->ctx); + avformat_close_input(&var->ctx); } av_free(var); } diff --git a/libavformat/avidec.c b/libavformat/avidec.c index ad35995b05..b45224f641 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1365,7 +1365,7 @@ static int avi_read_close(AVFormatContext *s) if (ast) { if (ast->sub_ctx) { av_freep(&ast->sub_ctx->pb); - av_close_input_file(ast->sub_ctx); + avformat_close_input(&ast->sub_ctx); } av_free(ast->sub_buffer); av_free_packet(&ast->sub_pkt); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 0d25e3f254..c9b34abe1f 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -368,7 +368,7 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter) PESContext *pes = filter->u.pes_filter.opaque; av_freep(&pes->buffer); /* referenced private data will be freed later in - * av_close_input_file */ + * avformat_close_input */ if (!((PESContext *)filter->u.pes_filter.opaque)->st) { av_freep(&filter->u.pes_filter.opaque); } diff --git a/libavformat/rdt.c b/libavformat/rdt.c index c06583e105..207fc92542 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -544,7 +544,7 @@ rdt_free_context (PayloadContext *rdt) av_freep(&rdt->rmst[i]); } if (rdt->rmctx) - av_close_input_file(rdt->rmctx); + avformat_close_input(&rdt->rmctx); av_freep(&rdt->mlti_data); av_freep(&rdt->rmst); av_free(rdt); diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 6a8472844c..483b196d62 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -108,8 +108,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) "Failed to fix invalid RTSP-MS/ASF min_pktsize\n"); init_packetizer(&pb, buf, len); if (rt->asf_ctx) { - av_close_input_file(rt->asf_ctx); - rt->asf_ctx = NULL; + avformat_close_input(&rt->asf_ctx); } if (!(rt->asf_ctx = avformat_alloc_context())) return AVERROR(ENOMEM); diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 52821545ff..fcf168d426 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -580,8 +580,7 @@ void ff_rtsp_close_streams(AVFormatContext *s) } av_free(rt->rtsp_streams); if (rt->asf_ctx) { - av_close_input_file(rt->asf_ctx); - rt->asf_ctx = NULL; + avformat_close_input(&rt->asf_ctx); } av_free(rt->p); av_free(rt->recvbuf); diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index 6ac7bfd484..531cfd204d 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -52,7 +52,7 @@ static int sap_read_close(AVFormatContext *s) { struct SAPState *sap = s->priv_data; if (sap->sdp_ctx) - av_close_input_file(sap->sdp_ctx); + avformat_close_input(&sap->sdp_ctx); if (sap->ann_fd) ffurl_close(sap->ann_fd); av_freep(&sap->sdp); diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c index 43dee56fe7..699c693c3f 100644 --- a/libavformat/seek-test.c +++ b/libavformat/seek-test.c @@ -127,7 +127,7 @@ int main(int argc, char **argv) printf("ret:%-10s st:%2d flags:%d ts:%s\n", ret_str(ret), stream_id, i&1, ts_buf); } - av_close_input_file(ic); + avformat_close_input(&ic); return 0; } diff --git a/tools/pktdumper.c b/tools/pktdumper.c index 2da1146430..e9e5acfdec 100644 --- a/tools/pktdumper.c +++ b/tools/pktdumper.c @@ -117,7 +117,7 @@ int main(int argc, char **argv) break; } - av_close_input_file(fctx); + avformat_close_input(&fctx); while (donotquit) sleep(60); From 8b494b7b2773eb45c0ed364e346602de0d578196 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sat, 10 Dec 2011 16:39:21 +0000 Subject: [PATCH 17/18] vcr1: drop unnecessary emms_c() calls without MMX code Signed-off-by: Diego Biurrun --- libavcodec/vcr1.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c index 8c64afe570..e50e092c7e 100644 --- a/libavcodec/vcr1.c +++ b/libavcodec/vcr1.c @@ -114,8 +114,6 @@ static int decode_frame(AVCodecContext *avctx, *picture= *(AVFrame*)&a->picture; *data_size = sizeof(AVPicture); - emms_c(); - return buf_size; } @@ -130,8 +128,6 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, p->pict_type= AV_PICTURE_TYPE_I; p->key_frame= 1; - emms_c(); - avpriv_align_put_bits(&a->pb); while(get_bit_count(&a->pb)&31) put_bits(&a->pb, 8, 0); From 58c42af722cebecd86e340dc3ed9ec44b1fe4a55 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 7 Dec 2011 13:03:53 +0100 Subject: [PATCH 18/18] doxygen: misc consistency, spelling and wording fixes --- libavcodec/aacpsy.c | 2 +- libavcodec/amrwbdec.c | 68 +++++++++++++++--------------- libavcodec/avcodec.h | 10 ++--- libavcodec/cavs_parser.c | 2 +- libavcodec/celp_math.h | 2 +- libavcodec/dca_parser.c | 2 +- libavcodec/dsputil.c | 2 +- libavcodec/error_resilience.c | 4 +- libavcodec/get_bits.h | 19 ++++----- libavcodec/h261dec.c | 10 ++--- libavcodec/h261enc.c | 2 +- libavcodec/h263dec.c | 2 +- libavcodec/h264.c | 12 +++--- libavcodec/h264.h | 4 +- libavcodec/h264_cabac.c | 2 +- libavcodec/h264_cavlc.c | 4 +- libavcodec/h264_mvpred.h | 6 +-- libavcodec/ituh263dec.c | 8 ++-- libavcodec/ituh263enc.c | 2 +- libavcodec/latm_parser.c | 2 +- libavcodec/mjpeg_parser.c | 2 +- libavcodec/mpeg12.c | 7 +-- libavcodec/mpeg4video.h | 2 +- libavcodec/mpeg4video_parser.h | 2 +- libavcodec/mpeg4videodec.c | 18 ++++---- libavcodec/mpeg4videoenc.c | 4 +- libavcodec/mpegvideo.c | 19 ++++----- libavcodec/mpegvideo.h | 4 +- libavcodec/mpegvideo_common.h | 8 ++-- libavcodec/mpegvideo_enc.c | 2 +- libavcodec/parser.c | 2 +- libavcodec/pthread.c | 2 +- libavcodec/ratecontrol.c | 4 +- libavcodec/resample2.c | 2 +- libavcodec/thread.h | 11 +++-- libavcodec/vc1_parser.c | 2 +- libavfilter/avfilter.h | 2 +- libavformat/avformat.h | 2 +- libavformat/rtpdec_qdm2.c | 8 ++-- libavformat/rtsp.h | 4 +- libavformat/vorbiscomment.h | 2 +- libavutil/avstring.h | 8 ++-- libavutil/internal.h | 2 +- libavutil/parseutils.h | 2 +- libpostproc/postprocess.h | 7 +-- libpostproc/postprocess_template.c | 4 +- libswscale/swscale.h | 47 ++++++++++----------- libswscale/swscale_internal.h | 4 +- tests/audiogen.c | 4 +- tests/rotozoom.c | 2 +- tests/videogen.c | 4 +- 51 files changed, 179 insertions(+), 179 deletions(-) diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index 93ff934b2a..38d9d9f7d8 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -216,7 +216,7 @@ static const float psy_fir_coeffs[] = { }; /** - * calculates the attack threshold for ABR from the above table for the LAME psy model + * Calculate the ABR attack threshold from the above LAME psymodel table. */ static float lame_calc_attack_threshold(int bitrate) { diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index d4aa557d07..6ea5d228dd 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -111,7 +111,7 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx) /** * Decode the frame header in the "MIME/storage" format. This format - * is simpler and does not carry the auxiliary information of the frame + * is simpler and does not carry the auxiliary frame information. * * @param[in] ctx The Context * @param[in] buf Pointer to the input buffer @@ -133,7 +133,7 @@ static int decode_mime_header(AMRWBContext *ctx, const uint8_t *buf) } /** - * Decodes quantized ISF vectors using 36-bit indexes (6K60 mode only) + * Decode quantized ISF vectors using 36-bit indexes (6K60 mode only). * * @param[in] ind Array of 5 indexes * @param[out] isf_q Buffer for isf_q[LP_ORDER] @@ -160,7 +160,7 @@ static void decode_isf_indices_36b(uint16_t *ind, float *isf_q) } /** - * Decodes quantized ISF vectors using 46-bit indexes (except 6K60 mode) + * Decode quantized ISF vectors using 46-bit indexes (except 6K60 mode). * * @param[in] ind Array of 7 indexes * @param[out] isf_q Buffer for isf_q[LP_ORDER] @@ -193,8 +193,8 @@ static void decode_isf_indices_46b(uint16_t *ind, float *isf_q) } /** - * Apply mean and past ISF values using the prediction factor - * Updates past ISF vector + * Apply mean and past ISF values using the prediction factor. + * Updates past ISF vector. * * @param[in,out] isf_q Current quantized ISF * @param[in,out] isf_past Past quantized ISF @@ -215,7 +215,7 @@ static void isf_add_mean_and_past(float *isf_q, float *isf_past) /** * Interpolate the fourth ISP vector from current and past frames - * to obtain a ISP vector for each subframe + * to obtain an ISP vector for each subframe. * * @param[in,out] isp_q ISPs for each subframe * @param[in] isp4_past Past ISP for subframe 4 @@ -232,9 +232,9 @@ static void interpolate_isp(double isp_q[4][LP_ORDER], const double *isp4_past) } /** - * Decode an adaptive codebook index into pitch lag (except 6k60, 8k85 modes) - * Calculate integer lag and fractional lag always using 1/4 resolution - * In 1st and 3rd subframes the index is relative to last subframe integer lag + * Decode an adaptive codebook index into pitch lag (except 6k60, 8k85 modes). + * Calculate integer lag and fractional lag always using 1/4 resolution. + * In 1st and 3rd subframes the index is relative to last subframe integer lag. * * @param[out] lag_int Decoded integer pitch lag * @param[out] lag_frac Decoded fractional pitch lag @@ -271,9 +271,9 @@ static void decode_pitch_lag_high(int *lag_int, int *lag_frac, int pitch_index, } /** - * Decode a adaptive codebook index into pitch lag for 8k85 and 6k60 modes - * Description is analogous to decode_pitch_lag_high, but in 6k60 relative - * index is used for all subframes except the first + * Decode an adaptive codebook index into pitch lag for 8k85 and 6k60 modes. + * The description is analogous to decode_pitch_lag_high, but in 6k60 the + * relative index is used for all subframes except the first. */ static void decode_pitch_lag_low(int *lag_int, int *lag_frac, int pitch_index, uint8_t *base_lag_int, int subframe, enum Mode mode) @@ -298,7 +298,7 @@ static void decode_pitch_lag_low(int *lag_int, int *lag_frac, int pitch_index, /** * Find the pitch vector by interpolating the past excitation at the - * pitch delay, which is obtained in this function + * pitch delay, which is obtained in this function. * * @param[in,out] ctx The context * @param[in] amr_subframe Current subframe data @@ -351,10 +351,10 @@ static void decode_pitch_vector(AMRWBContext *ctx, /** * The next six functions decode_[i]p_track decode exactly i pulses * positions and amplitudes (-1 or 1) in a subframe track using - * an encoded pulse indexing (TS 26.190 section 5.8.2) + * an encoded pulse indexing (TS 26.190 section 5.8.2). * * The results are given in out[], in which a negative number means - * amplitude -1 and vice versa (i.e., ampl(x) = x / abs(x) ) + * amplitude -1 and vice versa (i.e., ampl(x) = x / abs(x) ). * * @param[out] out Output buffer (writes i elements) * @param[in] code Pulse index (no. of bits varies, see below) @@ -470,7 +470,7 @@ static void decode_6p_track(int *out, int code, int m, int off) ///code: 6m-2 bi /** * Decode the algebraic codebook index to pulse positions and signs, - * then construct the algebraic codebook vector + * then construct the algebraic codebook vector. * * @param[out] fixed_vector Buffer for the fixed codebook excitation * @param[in] pulse_hi MSBs part of the pulse index array (higher modes only) @@ -541,7 +541,7 @@ static void decode_fixed_vector(float *fixed_vector, const uint16_t *pulse_hi, } /** - * Decode pitch gain and fixed gain correction factor + * Decode pitch gain and fixed gain correction factor. * * @param[in] vq_gain Vector-quantized index for gains * @param[in] mode Mode of the current frame @@ -559,7 +559,7 @@ static void decode_gains(const uint8_t vq_gain, const enum Mode mode, } /** - * Apply pitch sharpening filters to the fixed codebook vector + * Apply pitch sharpening filters to the fixed codebook vector. * * @param[in] ctx The context * @param[in,out] fixed_vector Fixed codebook excitation @@ -580,7 +580,7 @@ static void pitch_sharpening(AMRWBContext *ctx, float *fixed_vector) } /** - * Calculate the voicing factor (-1.0 = unvoiced to 1.0 = voiced) + * Calculate the voicing factor (-1.0 = unvoiced to 1.0 = voiced). * * @param[in] p_vector, f_vector Pitch and fixed excitation vectors * @param[in] p_gain, f_gain Pitch and fixed gains @@ -599,8 +599,8 @@ static float voice_factor(float *p_vector, float p_gain, } /** - * Reduce fixed vector sparseness by smoothing with one of three IR filters - * Also known as "adaptive phase dispersion" + * Reduce fixed vector sparseness by smoothing with one of three IR filters, + * also known as "adaptive phase dispersion". * * @param[in] ctx The context * @param[in,out] fixed_vector Unfiltered fixed vector @@ -670,7 +670,7 @@ static float *anti_sparseness(AMRWBContext *ctx, /** * Calculate a stability factor {teta} based on distance between - * current and past isf. A value of 1 shows maximum signal stability + * current and past isf. A value of 1 shows maximum signal stability. */ static float stability_factor(const float *isf, const float *isf_past) { @@ -687,7 +687,7 @@ static float stability_factor(const float *isf, const float *isf_past) /** * Apply a non-linear fixed gain smoothing in order to reduce - * fluctuation in the energy of excitation + * fluctuation in the energy of excitation. * * @param[in] fixed_gain Unsmoothed fixed gain * @param[in,out] prev_tr_gain Previous threshold gain (updated) @@ -718,7 +718,7 @@ static float noise_enhancer(float fixed_gain, float *prev_tr_gain, } /** - * Filter the fixed_vector to emphasize the higher frequencies + * Filter the fixed_vector to emphasize the higher frequencies. * * @param[in,out] fixed_vector Fixed codebook vector * @param[in] voice_fac Frame voicing factor @@ -742,7 +742,7 @@ static void pitch_enhancer(float *fixed_vector, float voice_fac) } /** - * Conduct 16th order linear predictive coding synthesis from excitation + * Conduct 16th order linear predictive coding synthesis from excitation. * * @param[in] ctx Pointer to the AMRWBContext * @param[in] lpc Pointer to the LPC coefficients @@ -802,7 +802,7 @@ static void de_emphasis(float *out, float *in, float m, float mem[1]) /** * Upsample a signal by 5/4 ratio (from 12.8kHz to 16kHz) using - * a FIR interpolation filter. Uses past data from before *in address + * a FIR interpolation filter. Uses past data from before *in address. * * @param[out] out Buffer for interpolated signal * @param[in] in Current signal data (length 0.8*o_size) @@ -832,7 +832,7 @@ static void upsample_5_4(float *out, const float *in, int o_size) /** * Calculate the high-band gain based on encoded index (23k85 mode) or - * on the low-band speech signal and the Voice Activity Detection flag + * on the low-band speech signal and the Voice Activity Detection flag. * * @param[in] ctx The context * @param[in] synth LB speech synthesis at 12.8k @@ -857,7 +857,7 @@ static float find_hb_gain(AMRWBContext *ctx, const float *synth, /** * Generate the high-band excitation with the same energy from the lower - * one and scaled by the given gain + * one and scaled by the given gain. * * @param[in] ctx The context * @param[out] hb_exc Buffer for the excitation @@ -880,7 +880,7 @@ static void scaled_hb_excitation(AMRWBContext *ctx, float *hb_exc, } /** - * Calculate the auto-correlation for the ISF difference vector + * Calculate the auto-correlation for the ISF difference vector. */ static float auto_correlation(float *diff_isf, float mean, int lag) { @@ -896,7 +896,7 @@ static float auto_correlation(float *diff_isf, float mean, int lag) /** * Extrapolate a ISF vector to the 16kHz range (20th order LP) - * used at mode 6k60 LP filter for the high frequency band + * used at mode 6k60 LP filter for the high frequency band. * * @param[out] out Buffer for extrapolated isf * @param[in] isf Input isf vector @@ -981,7 +981,7 @@ static void lpc_weighting(float *out, const float *lpc, float gamma, int size) /** * Conduct 20th order linear predictive coding synthesis for the high - * frequency band excitation at 16kHz + * frequency band excitation at 16kHz. * * @param[in] ctx The context * @param[in] subframe Current subframe index (0 to 3) @@ -1019,8 +1019,8 @@ static void hb_synthesis(AMRWBContext *ctx, int subframe, float *samples, } /** - * Apply to high-band samples a 15th order filter - * The filter characteristic depends on the given coefficients + * Apply a 15th order filter to high-band samples. + * The filter characteristic depends on the given coefficients. * * @param[out] out Buffer for filtered output * @param[in] fir_coef Filter coefficients @@ -1048,7 +1048,7 @@ static void hb_fir_filter(float *out, const float fir_coef[HB_FIR_SIZE + 1], } /** - * Update context state before the next subframe + * Update context state before the next subframe. */ static void update_sub_state(AMRWBContext *ctx) { diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index ae5ce6e314..fe65a6e299 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2591,7 +2591,7 @@ typedef struct AVCodecContext { #if FF_API_X264_GLOBAL_OPTS /** - * Influences how often B-frames are used. + * Influence how often B-frames are used. * - encoding: Set by user. * - decoding: unused */ @@ -2672,7 +2672,7 @@ typedef struct AVCodecContext { int mv0_threshold; /** - * Adjusts sensitivity of b_frame_strategy 1. + * Adjust sensitivity of b_frame_strategy 1. * - encoding: Set by user. * - decoding: unused */ @@ -2956,7 +2956,7 @@ typedef struct AVCodecContext { #if FF_API_FLAC_GLOBAL_OPTS /** - * Determines which LPC analysis algorithm to use. + * Determine which LPC analysis algorithm to use. * - encoding: Set by user * - decoding: unused */ @@ -4121,7 +4121,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, AVPacket *avpkt); /** - * Frees all allocated data in the given subtitle struct. + * Free all allocated data in the given subtitle struct. * * @param sub AVSubtitle to free. */ @@ -4486,7 +4486,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, unsigned int av_xiphlacing(unsigned char *s, unsigned int v); /** - * Logs a generic warning message about a missing feature. This function is + * Log a generic warning message about a missing feature. This function is * intended to be used internally by Libav (libavcodec, libavformat, etc.) * only, and would normally not be used by applications. * @param[in] avc a pointer to an arbitrary struct of which the first field is diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c index 07464c39b2..a91be3a04d 100644 --- a/libavcodec/cavs_parser.c +++ b/libavcodec/cavs_parser.c @@ -30,7 +30,7 @@ /** - * finds the end of the current frame in the bitstream. + * Find the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, diff --git a/libavcodec/celp_math.h b/libavcodec/celp_math.h index 9cd9ae238d..4a502ca04b 100644 --- a/libavcodec/celp_math.h +++ b/libavcodec/celp_math.h @@ -64,7 +64,7 @@ static inline int bidir_sal(int value, int offset) } /** - * returns the dot product. + * Return the dot product. * @param a input data array * @param b input data array * @param length number of elements diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c index 2441099257..136cc458ef 100644 --- a/libavcodec/dca_parser.c +++ b/libavcodec/dca_parser.c @@ -39,7 +39,7 @@ typedef struct DCAParseContext { || state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE) /** - * finds the end of the current frame in the bitstream. + * Find the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf, diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 91238578b6..5c1039b028 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1779,7 +1779,7 @@ static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){ } /** - * permutes an 8x8 block. + * Permute an 8x8 block. * @param block the block which will be permuted according to the given permutation vector * @param permutation the permutation vector * @param last the last non zero coefficient in scantable order, used to speed the permutation up diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 354e6b0717..caa1a47ebf 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -80,7 +80,7 @@ static void set_mv_strides(MpegEncContext *s, int *mv_step, int *stride){ } /** - * replaces the current MB with a flat dc only version. + * Replace the current MB with a flat dc-only version. */ static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int mb_x, int mb_y) { @@ -711,7 +711,7 @@ void ff_er_frame_start(MpegEncContext *s){ } /** - * adds a slice. + * Add a slice. * @param endx x component of the last macroblock, can be -1 for the last of the previous line * @param status the status at the end (MV_END, AC_ERROR, ...), it is assumed that no earlier end or * error of the same type occurred diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index d2ae345315..79802848d4 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -85,13 +85,13 @@ gb getbitcontext OPEN_READER(name, gb) - loads gb into local variables + load gb into local variables CLOSE_READER(name, gb) - stores local vars in gb + store local vars in gb UPDATE_CACHE(name, gb) - refills the internal cache from the bitstream + refill the internal cache from the bitstream after this call at least MIN_CACHE_BITS will be available, GET_CACHE(name, gb) @@ -282,7 +282,7 @@ static inline unsigned int get_bits(GetBitContext *s, int n){ } /** - * Shows 1-25 bits. + * Show 1-25 bits. */ static inline unsigned int show_bits(GetBitContext *s, int n){ register int tmp; @@ -329,7 +329,7 @@ static inline void skip_bits1(GetBitContext *s){ } /** - * reads 0-32 bits. + * Read 0-32 bits. */ static inline unsigned int get_bits_long(GetBitContext *s, int n){ if (n <= MIN_CACHE_BITS) return get_bits(s, n); @@ -345,14 +345,14 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n){ } /** - * reads 0-32 bits as a signed integer. + * Read 0-32 bits as a signed integer. */ static inline int get_sbits_long(GetBitContext *s, int n) { return sign_extend(get_bits_long(s, n), n); } /** - * shows 0-32 bits. + * Show 0-32 bits. */ static inline unsigned int show_bits_long(GetBitContext *s, int n){ if (n <= MIN_CACHE_BITS) return show_bits(s, n); @@ -372,7 +372,7 @@ static inline int check_marker(GetBitContext *s, const char *msg) } /** - * init GetBitContext. + * Inititalize GetBitContext. * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger than the actual read bits * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end * @param bit_size the size of the buffer in bits @@ -434,7 +434,6 @@ void free_vlc(VLC *vlc); /** - * * If the vlc code is invalid and max_depth=1, then no bits will be removed. * If the vlc code is invalid and max_depth>1, then the number of bits removed * is undefined. @@ -496,7 +495,7 @@ void free_vlc(VLC *vlc); /** - * parses a vlc code, faster than get_vlc() + * Parse a vlc code, faster than get_vlc(). * @param bits is the number of bits which will be read at once, must be * identical to nb_bits in init_vlc() * @param max_depth is the number of times bits bits must be read to completely diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 81f7dc680e..cd4d764272 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -97,7 +97,7 @@ static av_cold int h261_decode_init(AVCodecContext *avctx){ } /** - * decodes the group of blocks header or slice header. + * Decode the group of blocks header or slice header. * @return <0 if an error occurred */ static int h261_decode_gob_header(H261Context *h){ @@ -150,7 +150,7 @@ static int h261_decode_gob_header(H261Context *h){ } /** - * decodes the group of blocks / video packet header. + * Decode the group of blocks / video packet header. * @return <0 if no resync found */ static int ff_h261_resync(H261Context *h){ @@ -191,7 +191,7 @@ static int ff_h261_resync(H261Context *h){ } /** - * decodes skipped macroblocks + * Decode skipped macroblocks. * @return 0 */ static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 ) @@ -355,7 +355,7 @@ intra: } /** - * decodes a macroblock + * Decode a macroblock. * @return <0 if an error occurred */ static int h261_decode_block(H261Context * h, DCTELEM * block, @@ -437,7 +437,7 @@ static int h261_decode_block(H261Context * h, DCTELEM * block, } /** - * decodes the H261 picture header. + * Decode the H.261 picture header. * @return <0 if no startcode found */ static int h261_decode_picture_header(H261Context *h){ diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c index 034237654b..c758ec09d5 100644 --- a/libavcodec/h261enc.c +++ b/libavcodec/h261enc.c @@ -251,7 +251,7 @@ void ff_h261_encode_init(MpegEncContext *s){ /** - * encodes a 8x8 block. + * Encode an 8x8 block. * @param block the 8x8 block * @param n block index (0-3 are luma, 4-5 are chroma) */ diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 71ff2feac4..268f69401a 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -127,7 +127,7 @@ av_cold int ff_h263_decode_end(AVCodecContext *avctx) } /** - * returns the number of bytes consumed for building the current frame + * Return the number of bytes consumed for building the current frame. */ static int get_consumed_bytes(MpegEncContext *s, int buf_size){ int pos= (get_bits_count(&s->gb)+7)>>3; diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 4bcec7c418..0d01caa2fd 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -62,7 +62,8 @@ static const enum PixelFormat hwaccel_pixfmt_list_h264_jpeg_420[] = { }; /** - * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks. + * Check if the top & left blocks are available if needed and + * change the dc mode so it only uses the available blocks. */ int ff_h264_check_intra4x4_pred_mode(H264Context *h){ MpegEncContext * const s = &h->s; @@ -101,7 +102,8 @@ int ff_h264_check_intra4x4_pred_mode(H264Context *h){ } //FIXME cleanup like ff_h264_check_intra_pred_mode /** - * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks. + * Check if the top & left blocks are available if needed and + * change the dc mode so it only uses the available blocks. */ int ff_h264_check_intra_pred_mode(H264Context *h, int mode){ MpegEncContext * const s = &h->s; @@ -2592,7 +2594,7 @@ static void clone_slice(H264Context *dst, H264Context *src) } /** - * computes profile from profile_idc and constraint_set?_flags + * Compute profile from profile_idc and constraint_set?_flags. * * @param sps SPS * @@ -2619,7 +2621,7 @@ int ff_h264_get_profile(SPS *sps) } /** - * decodes a slice header. + * Decode a slice header. * This will also call MPV_common_init() and frame_start() as needed. * * @param h h264context @@ -3982,7 +3984,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ } /** - * returns the number of bytes consumed for building the current frame + * Return the number of bytes consumed for building the current frame. */ static int get_consumed_bytes(MpegEncContext *s, int pos, int buf_size){ if(pos==0) pos=1; //avoid infinite loops (i doubt that is needed but ...) diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 5280e5155a..826b72018c 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -762,14 +762,14 @@ static av_always_inline uint16_t pack8to16(int a, int b){ } /** - * gets the chroma qp. + * Get the chroma qp. */ static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale){ return h->pps.chroma_qp_table[t][qscale]; } /** - * gets the predicted intra4x4 prediction mode. + * Get the predicted intra4x4 prediction mode. */ static av_always_inline int pred_intra_mode(H264Context *h, int n){ const int index8= scan8[n]; diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index 0325ea456f..c7e46e935f 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -1862,7 +1862,7 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u } /** - * decodes a macroblock + * Decode a macroblock. * @return 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed */ int ff_h264_decode_mb_cabac(H264Context *h) { diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index b94b51b9a1..db74602f66 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -281,7 +281,7 @@ static int8_t cavlc_level_tab[7][1< (1, 2, 4) * @param mx the x component of the predicted motion vector @@ -142,7 +142,7 @@ static av_always_inline void pred_motion(H264Context * const h, int n, int part_ } /** - * gets the directionally predicted 16x8 MV. + * Get the directionally predicted 16x8 MV. * @param n the block index * @param mx the x component of the predicted motion vector * @param my the y component of the predicted motion vector @@ -177,7 +177,7 @@ static av_always_inline void pred_16x8_motion(H264Context * const h, int n, int } /** - * gets the directionally predicted 8x16 MV. + * Get the directionally predicted 8x16 MV. * @param n the block index * @param mx the x component of the predicted motion vector * @param my the y component of the predicted motion vector diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index dceb62b84c..148bb33a36 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -148,7 +148,7 @@ int ff_h263_decode_mba(MpegEncContext *s) } /** - * decodes the group of blocks header or slice header. + * Decode the group of blocks header or slice header. * @return <0 if an error occurred */ static int h263_decode_gob_header(MpegEncContext *s) @@ -203,7 +203,7 @@ static int h263_decode_gob_header(MpegEncContext *s) } /** - * finds the next resync_marker + * Find the next resync_marker. * @param p pointer to buffer to scan * @param end pointer to the end of the buffer * @return pointer to the next resync_marker, or end if none was found @@ -224,7 +224,7 @@ const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8 } /** - * decodes the group of blocks / video packet header. + * Decode the group of blocks / video packet header. * @return bit position of the resync_marker, or <0 if none was found */ int ff_h263_resync(MpegEncContext *s){ @@ -306,7 +306,7 @@ int h263_decode_motion(MpegEncContext * s, int pred, int f_code) } -/* Decodes RVLC of H.263+ UMV */ +/* Decode RVLC of H.263+ UMV */ static int h263p_decode_umotion(MpegEncContext * s, int pred) { int code = 0, sign; diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index b9888f0ba7..6efba2d65a 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -302,7 +302,7 @@ void ff_clean_h263_qscales(MpegEncContext *s){ static const int dquant_code[5]= {1,0,9,2,3}; /** - * encodes a 8x8 block. + * Encode an 8x8 block. * @param block the 8x8 block * @param n block index (0-3 are luma, 4-5 are chroma) */ diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c index d2c0244c02..bd941f6dc3 100644 --- a/libavcodec/latm_parser.c +++ b/libavcodec/latm_parser.c @@ -36,7 +36,7 @@ typedef struct LATMParseContext{ } LATMParseContext; /** - * finds the end of the current frame in the bitstream. + * Find the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ static int latm_find_frame_end(AVCodecParserContext *s1, const uint8_t *buf, diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c index daa65483cd..5b83e59dcd 100644 --- a/libavcodec/mjpeg_parser.c +++ b/libavcodec/mjpeg_parser.c @@ -30,7 +30,7 @@ /** - * finds the end of the current frame in the bitstream. + * Find the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index eefcb7b45e..4358562389 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1619,9 +1619,10 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) #define DECODE_SLICE_OK 0 /** - * decodes a slice. MpegEncContext.mb_y must be set to the MB row from the startcode - * @return DECODE_SLICE_ERROR if the slice is damaged
- * DECODE_SLICE_OK if this slice is ok
+ * Decode a slice. + * MpegEncContext.mb_y must be set to the MB row from the startcode. + * @return DECODE_SLICE_ERROR if the slice is damaged, + * DECODE_SLICE_OK if this slice is OK */ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, const uint8_t **buf, int buf_size) diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h index 9f6f431080..ba67c218fc 100644 --- a/libavcodec/mpeg4video.h +++ b/libavcodec/mpeg4video.h @@ -119,7 +119,7 @@ extern uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3]; /** - * predicts the dc. + * Predict the dc. * encoding quantized level -> quantized diff * decoding quantized diff -> quantized level * @param n block index (0-3 are luma, 4-5 are chroma) diff --git a/libavcodec/mpeg4video_parser.h b/libavcodec/mpeg4video_parser.h index d907dc4d5b..0f56e7fd9e 100644 --- a/libavcodec/mpeg4video_parser.h +++ b/libavcodec/mpeg4video_parser.h @@ -26,7 +26,7 @@ #include "parser.h" /** - * finds the end of the current frame in the bitstream. + * Find the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size); diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 8bc30fdbb2..51985483b6 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -46,7 +46,7 @@ static const int mb_type_b_map[4]= { }; /** - * predicts the ac. + * Predict the ac. * @param n block index (0-3 are luma, 4-5 are chroma) * @param dir the ac prediction direction */ @@ -343,7 +343,7 @@ static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb } /** - * decodes the next video packet. + * Decode the next video packet. * @return <0 if something went wrong */ int mpeg4_decode_video_packet_header(MpegEncContext *s) @@ -439,7 +439,7 @@ int mpeg4_decode_video_packet_header(MpegEncContext *s) } /** - * gets the average motion vector for a GMC MB. + * Get the average motion vector for a GMC MB. * @param n either 0 for the x component or 1 for y * @return the average MV for a GMC MB */ @@ -485,7 +485,7 @@ static inline int get_amv(MpegEncContext *s, int n){ } /** - * decodes the dc value. + * Decode the dc value. * @param n block index (0-3 are luma, 4-5 are chroma) * @param dir_ptr the prediction direction will be stored here * @return the quantized dc @@ -532,7 +532,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) } /** - * decodes first partition. + * Decode first partition. * @return number of MBs decoded or <0 if an error occurred */ static int mpeg4_decode_partition_a(MpegEncContext *s){ @@ -784,7 +784,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){ } /** - * decodes the first & second partition + * Decode the first and second partition. * @return <0 if error (and sets error type in the error_status_table) */ int ff_mpeg4_decode_partitions(MpegEncContext *s) @@ -837,7 +837,7 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s) } /** - * decodes a block. + * Decode a block. * @return <0 if an error occurred */ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, @@ -1824,7 +1824,7 @@ no_cplx_est: } /** - * decodes the user data stuff in the header. + * Decode the user data stuff in the header. * Also initializes divx/xvid/lavc_version/build. */ static int decode_user_data(MpegEncContext *s, GetBitContext *gb){ @@ -2094,7 +2094,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ } /** - * decode mpeg4 headers + * Decode mpeg4 headers. * @return <0 if no VOP found (or a damaged one) * FRAME_SKIPPED if a not coded VOP is found * 0 if a VOP is found diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 3072ace046..41c153d0b0 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -238,7 +238,7 @@ void ff_clean_mpeg4_qscales(MpegEncContext *s){ /** - * encodes the dc value. + * Encode the dc value. * @param n block index (0-3 are luma, 4-5 are chroma) */ static inline void mpeg4_encode_dc(PutBitContext * s, int level, int n) @@ -291,7 +291,7 @@ static inline int mpeg4_get_dc_length(int level, int n){ } /** - * encodes a 8x8 block + * Encode an 8x8 block. * @param n block index (0-3 are luma, 4-5 are chroma) */ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n, int intra_dc, diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 27e9f10f28..a874548680 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -289,7 +289,7 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) } /** - * allocates a Picture + * Allocate a Picture. * The pixels are allocated/set by calling get_buffer() if shared = 0 */ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared) @@ -388,7 +388,7 @@ fail: // for the FF_ALLOCZ_OR_GOTO macro } /** - * deallocates a picture + * Deallocate a picture. */ static void free_picture(MpegEncContext *s, Picture *pic) { @@ -624,9 +624,9 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, } /** - * sets the given MpegEncContext to common defaults + * Set the given MpegEncContext to common defaults * (same for encoding and decoding). - * the changed fields will not depend upon the + * The changed fields will not depend upon the * prior state of the MpegEncContext. */ void MPV_common_defaults(MpegEncContext *s) @@ -652,7 +652,7 @@ void MPV_common_defaults(MpegEncContext *s) } /** - * sets the given MpegEncContext to defaults for decoding. + * Set the given MpegEncContext to defaults for decoding. * the changed fields will not depend upon * the prior state of the MpegEncContext. */ @@ -1400,7 +1400,7 @@ void MPV_frame_end(MpegEncContext *s) } /** - * draws an line from (ex, ey) -> (sx, sy). + * Draw a line from (ex, ey) -> (sx, sy). * @param w width of the image * @param h height of the image * @param stride stride/linesize of the image @@ -1449,7 +1449,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h } /** - * draws an arrow from (ex, ey) -> (sx, sy). + * Draw an arrow from (ex, ey) -> (sx, sy). * @param w width of the image * @param h height of the image * @param stride stride/linesize of the image @@ -1482,7 +1482,7 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int } /** - * prints debuging info for the given picture. + * Print debuging info for the given picture. */ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){ @@ -2127,7 +2127,7 @@ static inline void add_dequant_dct(MpegEncContext *s, } /** - * cleans dc, ac, coded_block for the current non intra MB + * Clean dc, ac, coded_block for the current non-intra MB. */ void ff_clean_intra_table_entries(MpegEncContext *s) { @@ -2432,7 +2432,6 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){ } /** - * * @param h is the normal height, this will be reduced automatically if needed for the last row */ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 599e3540ec..d0d1dc7748 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -728,8 +728,8 @@ void ff_init_block_index(MpegEncContext *s); void ff_copy_picture(Picture *dst, Picture *src); /** - * allocates a Picture - * The pixels are allocated/set by calling get_buffer() if shared=0 + * Allocate a Picture. + * The pixels are allocated/set by calling get_buffer() if shared = 0. */ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared); diff --git a/libavcodec/mpegvideo_common.h b/libavcodec/mpegvideo_common.h index b5b0d23c16..d64404d8c5 100644 --- a/libavcodec/mpegvideo_common.h +++ b/libavcodec/mpegvideo_common.h @@ -42,14 +42,14 @@ int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); /** - * allocates a Picture - * The pixels are allocated/set by calling get_buffer() if shared=0 + * Allocate a Picture. + * The pixels are allocated/set by calling get_buffer() if shared = 0. */ int alloc_picture(MpegEncContext *s, Picture *pic, int shared); /** - * sets the given MpegEncContext to common defaults (same for encoding and decoding). - * the changed fields will not depend upon the prior state of the MpegEncContext. + * Set the given MpegEncContext to common defaults (same for encoding and decoding). + * The changed fields will not depend upon the prior state of the MpegEncContext. */ void MPV_common_defaults(MpegEncContext *s); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ce7630ec7f..ce428661ee 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -227,7 +227,7 @@ static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContex } /** - * sets the given MpegEncContext to defaults for encoding. + * Set the given MpegEncContext to defaults for encoding. * the changed fields will not depend upon the prior state of the MpegEncContext. */ static void MPV_encode_defaults(MpegEncContext *s){ diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 03f548ef6a..9fd7af6ce6 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -216,7 +216,7 @@ void av_parser_close(AVCodecParserContext *s) /*****************************************************/ /** - * combines the (truncated) bitstream to a complete frame + * Combine the (truncated) bitstream to a complete frame. * @return -1 if no complete frame could be created, AVERROR(ENOMEM) if there was a memory allocation error */ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 1364f5722d..5f427c0390 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -322,7 +322,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg) } /** - * Updates the next thread's AVCodecContext with values from the reference thread's context. + * Update the next thread's AVCodecContext with values from the reference thread's context. * * @param dst The destination context. * @param src The source context. diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index e984ed5b29..5e4b49adf3 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -300,7 +300,7 @@ int ff_vbv_update(MpegEncContext *s, int frame_size){ } /** - * modifies the bitrate curve from pass1 for one frame + * Modify the bitrate curve from pass1 for one frame. */ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_factor, int frame_num){ RateControlContext *rcc= &s->rc_context; @@ -404,7 +404,7 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl } /** - * gets the qmin & qmax for pict_type + * Get the qmin & qmax for pict_type. */ static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pict_type){ int qmin= s->avctx->lmin; diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c index 7560d84bd4..48c20c2cbb 100644 --- a/libavcodec/resample2.c +++ b/libavcodec/resample2.c @@ -90,7 +90,7 @@ static double bessel(double x){ } /** - * builds a polyphase filterbank. + * Build a polyphase filterbank. * @param factor resampling factor * @param scale wanted sum of coefficients for each filter * @param type 0->cubic, 1->blackman nuttall windowed sinc, 2..16->kaiser windowed sinc beta=2..16 diff --git a/libavcodec/thread.h b/libavcodec/thread.h index dfd261df1c..7f018fc441 100644 --- a/libavcodec/thread.h +++ b/libavcodec/thread.h @@ -31,15 +31,15 @@ #include "avcodec.h" /** - * Waits for decoding threads to finish and resets internal - * state. Called by avcodec_flush_buffers(). + * Wait for decoding threads to finish and reset internal state. + * Called by avcodec_flush_buffers(). * * @param avctx The context. */ void ff_thread_flush(AVCodecContext *avctx); /** - * Submits a new frame to a decoding thread. + * Submit a new frame to a decoding thread. * Returns the next available frame in picture. *got_picture_ptr * will be 0 if none is available. * The return value on success is the size of the consumed packet for @@ -62,8 +62,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, void ff_thread_finish_setup(AVCodecContext *avctx); /** - * Notifies later decoding threads when part of their reference picture - * is ready. + * Notify later decoding threads when part of their reference picture is ready. * Call this when some part of the picture is finished decoding. * Later calls with lower values of progress have no effect. * @@ -75,7 +74,7 @@ void ff_thread_finish_setup(AVCodecContext *avctx); void ff_thread_report_progress(AVFrame *f, int progress, int field); /** - * Waits for earlier decoding threads to finish reference pictures + * Wait for earlier decoding threads to finish reference pictures. * Call this before accessing some part of a picture, with a given * value for progress, and it will return after the responsible decoding * thread calls ff_thread_report_progress() with the same or diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c index c660c9cd0d..e6243d9ac0 100644 --- a/libavcodec/vc1_parser.c +++ b/libavcodec/vc1_parser.c @@ -96,7 +96,7 @@ static void vc1_extract_headers(AVCodecParserContext *s, AVCodecContext *avctx, } /** - * finds the end of the current frame in the bitstream. + * Find the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ static int vc1_find_frame_end(ParseContext *pc, const uint8_t *buf, diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index c40d9f4d04..e0c664dd29 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -708,7 +708,7 @@ int avfilter_request_frame(AVFilterLink *link); int avfilter_poll_frame(AVFilterLink *link); /** - * Notifie the next filter of the start of a frame. + * Notify the next filter of the start of a frame. * * @param link the output link the frame will be sent over * @param picref A reference to the frame about to be sent. The data for this diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 2eb75df43a..89b9eda4a4 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -516,7 +516,7 @@ typedef struct AVInputFormat { int stream_index, int64_t timestamp, int flags); #endif /** - * Gets the next timestamp in stream[stream_index].time_base units. + * Get the next timestamp in stream[stream_index].time_base units. * @return the timestamp or AV_NOPTS_VALUE if an error occurred */ int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, diff --git a/libavformat/rtpdec_qdm2.c b/libavformat/rtpdec_qdm2.c index 66dd874003..76b4c5317d 100644 --- a/libavformat/rtpdec_qdm2.c +++ b/libavformat/rtpdec_qdm2.c @@ -52,8 +52,8 @@ struct PayloadContext { }; /** - * Parses configuration (basically the codec-specific extradata) from - * a RTP config subpacket (starts with 0xff). + * Parse configuration (basically the codec-specific extradata) from + * an RTP config subpacket (starts with 0xff). * * Layout of the config subpacket (in bytes): * 1: 0xFF <- config ID @@ -128,7 +128,7 @@ static int qdm2_parse_config(PayloadContext *qdm, AVStream *st, } /** - * Parses a single subpacket. We store this subpacket in an intermediate + * Parse a single subpacket. We store this subpacket in an intermediate * buffer (position depends on the ID (byte[0]). When called, at least * 4 bytes are available for reading (see qdm2_parse_packet()). * @@ -179,7 +179,7 @@ static int qdm2_parse_subpacket(PayloadContext *qdm, AVStream *st, } /** - * Adds a superblock header around a set of subpackets. + * Add a superblock header around a set of subpackets. * * @return <0 on error, else 0. */ diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 45b0032797..662407f299 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -186,7 +186,7 @@ enum RTSPClientState { }; /** - * Identifies particular servers that require special handling, such as + * Identify particular servers that require special handling, such as * standards-incompliant "Transport:" lines in the SETUP request. */ enum RTSPServerType { @@ -366,7 +366,7 @@ typedef struct RTSPState { source address and port. */ /** - * Describes a single stream, as identified by a single m= line block in the + * Describe a single stream, as identified by a single m= line block in the * SDP content. In the case of RDT, one RTSPStream can represent multiple * AVStreams. In this case, each AVStream in this set has similar content * (but different codec/bitrate). diff --git a/libavformat/vorbiscomment.h b/libavformat/vorbiscomment.h index 7b82dc1c95..95e1a5676f 100644 --- a/libavformat/vorbiscomment.h +++ b/libavformat/vorbiscomment.h @@ -39,7 +39,7 @@ int ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, unsigned *count); /** - * Writes a VorbisComment into a buffer. The buffer, p, must have enough + * Write a VorbisComment into a buffer. The buffer, p, must have enough * data to hold the whole VorbisComment. The minimum size required can be * obtained by passing the same AVDictionary and vendor_string to * ff_vorbiscomment_length() diff --git a/libavutil/avstring.h b/libavutil/avstring.h index 35b3d46c03..ed4e465cbc 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -137,7 +137,7 @@ char *av_d2str(double d); char *av_get_token(const char **buf, const char *term); /** - * Locale independent conversion of ASCII characters to upper case. + * Locale-independent conversion of ASCII characters to uppercase. */ static inline int av_toupper(int c) { @@ -147,7 +147,7 @@ static inline int av_toupper(int c) } /** - * Locale independent conversion of ASCII characters to lower case. + * Locale-independent conversion of ASCII characters to lowercase. */ static inline int av_tolower(int c) { @@ -157,13 +157,13 @@ static inline int av_tolower(int c) } /* - * Locale independent case-insensitive compare. + * Locale-independent case-insensitive compare. * @note This means only ASCII-range characters are case-insensitive */ int av_strcasecmp(const char *a, const char *b); /** - * Locale independent case-insensitive compare. + * Locale-independent case-insensitive compare. * @note This means only ASCII-range characters are case-insensitive */ int av_strncasecmp(const char *a, const char *b, size_t n); diff --git a/libavutil/internal.h b/libavutil/internal.h index 07e1ef1f05..ae678d5840 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -221,7 +221,7 @@ struct AVDictionary { #endif /** - * Returns NULL if a threading library has not been enabled. + * Return NULL if a threading library has not been enabled. * Used to disable threading functions in AVCodec definitions * when not needed. */ diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h index cd913d8ceb..0844abb2f0 100644 --- a/libavutil/parseutils.h +++ b/libavutil/parseutils.h @@ -75,7 +75,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx); /** - * Parses timestr and returns in *time a corresponding number of + * Parse timestr and return in *time a corresponding number of * microseconds. * * @param timeval puts here the number of microseconds corresponding diff --git a/libpostproc/postprocess.h b/libpostproc/postprocess.h index fe8c9b96ce..4cc6925924 100644 --- a/libpostproc/postprocess.h +++ b/libpostproc/postprocess.h @@ -77,9 +77,10 @@ void pp_postprocess(const uint8_t * src[3], const int srcStride[3], /** - * returns a pp_mode or NULL if an error occurred - * name is the string after "-pp" on the command line - * quality is a number from 0 to PP_QUALITY_MAX + * Return a pp_mode or NULL if an error occurred. + * + * @param name the string after "-pp" on the command line + * @param quality a number from 0 to PP_QUALITY_MAX */ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality); void pp_free_mode(pp_mode *mode); diff --git a/libpostproc/postprocess_template.c b/libpostproc/postprocess_template.c index 3b6d0f88f9..471b2524d7 100644 --- a/libpostproc/postprocess_template.c +++ b/libpostproc/postprocess_template.c @@ -1912,7 +1912,7 @@ MEDIAN((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8)) #if HAVE_MMX /** - * transposes and shift the given 8x8 Block into dst1 and dst2 + * Transpose and shift the given 8x8 Block into dst1 and dst2. */ static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride) { @@ -1997,7 +1997,7 @@ static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src } /** - * transposes the given 8x8 block + * Transpose the given 8x8 block. */ static inline void RENAME(transpose2)(uint8_t *dst, int dstStride, uint8_t *src) { diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 91378a40c4..5cd55a70ba 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -57,17 +57,17 @@ #endif /** - * Returns the LIBSWSCALE_VERSION_INT constant. + * Return the LIBSWSCALE_VERSION_INT constant. */ unsigned swscale_version(void); /** - * Returns the libswscale build-time configuration. + * Return the libswscale build-time configuration. */ const char *swscale_configuration(void); /** - * Returns the libswscale license. + * Return the libswscale license. */ const char *swscale_license(void); @@ -124,7 +124,7 @@ const char *swscale_license(void); #define SWS_CS_DEFAULT 5 /** - * Returns a pointer to yuv<->rgb coefficients for the given colorspace + * Return a pointer to yuv<->rgb coefficients for the given colorspace * suitable for sws_setColorspaceDetails(). * * @param colorspace One of the SWS_CS_* macros. If invalid, @@ -151,26 +151,26 @@ typedef struct { struct SwsContext; /** - * Returns a positive value if pix_fmt is a supported input format, 0 + * Return a positive value if pix_fmt is a supported input format, 0 * otherwise. */ int sws_isSupportedInput(enum PixelFormat pix_fmt); /** - * Returns a positive value if pix_fmt is a supported output format, 0 + * Return a positive value if pix_fmt is a supported output format, 0 * otherwise. */ int sws_isSupportedOutput(enum PixelFormat pix_fmt); /** - * Allocates an empty SwsContext. This must be filled and passed to + * Allocate an empty SwsContext. This must be filled and passed to * sws_init_context(). For filling see AVOptions, options.c and * sws_setColorspaceDetails(). */ struct SwsContext *sws_alloc_context(void); /** - * Initializes the swscaler context sws_context. + * Initialize the swscaler context sws_context. * * @return zero or positive value on success, a negative value on * error @@ -178,14 +178,14 @@ struct SwsContext *sws_alloc_context(void); int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter); /** - * Frees the swscaler context swsContext. + * Free the swscaler context swsContext. * If swsContext is NULL, then does nothing. */ void sws_freeContext(struct SwsContext *swsContext); #if FF_API_SWS_GETCONTEXT /** - * Allocates and returns a SwsContext. You need it to perform + * Allocate and return an SwsContext. You need it to perform * scaling/conversion operations using sws_scale(). * * @param srcW the width of the source image @@ -207,7 +207,7 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat #endif /** - * Scales the image slice in srcSlice and puts the resulting scaled + * Scale the image slice in srcSlice and put the resulting scaled * slice in the image in dst. A slice is a sequence of consecutive * rows in an image. * @@ -252,35 +252,35 @@ int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *brightness, int *contrast, int *saturation); /** - * Allocates and returns an uninitialized vector with length coefficients. + * Allocate and return an uninitialized vector with length coefficients. */ SwsVector *sws_allocVec(int length); /** - * Returns a normalized Gaussian curve used to filter stuff - * quality=3 is high quality, lower is lower quality. + * Return a normalized Gaussian curve used to filter stuff + * quality = 3 is high quality, lower is lower quality. */ SwsVector *sws_getGaussianVec(double variance, double quality); /** - * Allocates and returns a vector with length coefficients, all + * Allocate and return a vector with length coefficients, all * with the same value c. */ SwsVector *sws_getConstVec(double c, int length); /** - * Allocates and returns a vector with just one coefficient, with + * Allocate and return a vector with just one coefficient, with * value 1.0. */ SwsVector *sws_getIdentityVec(void); /** - * Scales all the coefficients of a by the scalar value. + * Scale all the coefficients of a by the scalar value. */ void sws_scaleVec(SwsVector *a, double scalar); /** - * Scales all the coefficients of a so that their sum equals height. + * Scale all the coefficients of a so that their sum equals height. */ void sws_normalizeVec(SwsVector *a, double height); void sws_convVec(SwsVector *a, SwsVector *b); @@ -289,13 +289,13 @@ void sws_subVec(SwsVector *a, SwsVector *b); void sws_shiftVec(SwsVector *a, int shift); /** - * Allocates and returns a clone of the vector a, that is a vector + * Allocate and return a clone of the vector a, that is a vector * with the same coefficients as a. */ SwsVector *sws_cloneVec(SwsVector *a); /** - * Prints with av_log() a textual representation of the vector a + * Print with av_log() a textual representation of the vector a * if log_level <= av_log_level. */ void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); @@ -309,8 +309,7 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, void sws_freeFilter(SwsFilter *filter); /** - * Checks if context can be reused, otherwise reallocates a new - * one. + * Check if context can be reused, otherwise reallocate a new one. * * If context is NULL, just calls sws_getContext() to get a new * context. Otherwise, checks if the parameters are the ones already @@ -328,7 +327,7 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, SwsFilter *dstFilter, const double *param); /** - * Converts an 8bit paletted frame into a frame with a color depth of 32-bits. + * Convert an 8-bit paletted frame into a frame with a color depth of 32 bits. * * The output frame will have the same packed format as the palette. * @@ -340,7 +339,7 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); /** - * Converts an 8bit paletted frame into a frame with a color depth of 24 bits. + * Convert an 8-bit paletted frame into a frame with a color depth of 24 bits. * * With the palette format "ABCD", the destination frame ends up with the format "ABC". * diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 7bfdc7eb6b..50554439f0 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -625,7 +625,7 @@ extern const uint64_t ff_dither8[2]; extern const AVClass sws_context_class; /** - * Sets c->swScale to an unscaled converter if one exists for the specific + * Set c->swScale to an unscaled converter if one exists for the specific * source and destination formats, bit depths, flags, etc. */ void ff_get_unscaled_swscale(SwsContext *c); @@ -633,7 +633,7 @@ void ff_get_unscaled_swscale(SwsContext *c); void ff_swscale_get_unscaled_altivec(SwsContext *c); /** - * Returns function pointer to fastest main scaler path function depending + * Return function pointer to fastest main scaler path function depending * on architecture and available optimizations. */ SwsFunc ff_getSwsFunc(SwsContext *c); diff --git a/tests/audiogen.c b/tests/audiogen.c index ddd1e18028..d48b5910bc 100644 --- a/tests/audiogen.c +++ b/tests/audiogen.c @@ -1,6 +1,6 @@ /* - * Generates a synthetic stereo sound - * NOTE: No floats are used to guarantee a bit exact output. + * Generate a synthetic stereo sound. + * NOTE: No floats are used to guarantee bitexact output. * * Copyright (c) 2002 Fabrice Bellard * diff --git a/tests/rotozoom.c b/tests/rotozoom.c index ff817acc3b..ba1db29641 100644 --- a/tests/rotozoom.c +++ b/tests/rotozoom.c @@ -1,5 +1,5 @@ /* - * Generates a synthetic YUV video sequence suitable for codec testing. + * Generate a synthetic YUV video sequence suitable for codec testing. * * copyright (c) Sebastien Bechet * diff --git a/tests/videogen.c b/tests/videogen.c index f114801a8a..957692d307 100644 --- a/tests/videogen.c +++ b/tests/videogen.c @@ -1,6 +1,6 @@ /* - * Generates a synthetic YUV video sequence suitable for codec testing. - * NOTE: No floats are used to guarantee a bit exact output. + * Generate a synthetic YUV video sequence suitable for codec testing. + * NOTE: No floats are used to guarantee bitexact output. * * Copyright (c) 2002 Fabrice Bellard *