diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-06 01:37:27 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-06 01:37:27 +0100 |
commit | b404ab9e74d3bca12d5989c366f5cfd746279067 (patch) | |
tree | fdbba6fdf7a4694fe7b7ecda6401ea6a2e01f95e /libavcodec | |
parent | a448a5d1c4620aa58ec138fbffd46d18d42d53e0 (diff) | |
parent | 52401b82bd2ed30d4c4353cb084bf4ee679d0c22 (diff) | |
download | ffmpeg-b404ab9e74d3bca12d5989c366f5cfd746279067.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mov: Don't av_malloc(0).
avconv: only allocate 1 AVFrame per input stream
avconv: fix memleaks due to not freeing the AVFrame for audio
h264-fate: remove -strict 1 except where necessary (mr4/5-tandberg).
misc Doxygen markup improvements
doxygen: eliminate Qt-style doxygen syntax
g722: Add a regression test for muxing/demuxing in wav
g722: Change bits per sample to 4
g722dec: Signal skipping the lower bits via AVOptions instead of bits_per_coded_sample
api-example: update to use avcodec_decode_audio4()
avplay: use avcodec_decode_audio4()
avplay: use a separate buffer for playing silence
avformat: use avcodec_decode_audio4() in avformat_find_stream_info()
avconv: use avcodec_decode_audio4() instead of avcodec_decode_audio3()
mov: Allow empty stts atom.
doc: document preferred Doxygen syntax and make patcheck detect it
Conflicts:
avconv.c
ffplay.c
libavcodec/mlpdec.c
libavcodec/version.h
libavformat/mov.c
tests/codec-regression.sh
tests/fate/h264.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/amrnbdec.c | 2 | ||||
-rw-r--r-- | libavcodec/cinepak.c | 7 | ||||
-rw-r--r-- | libavcodec/eamad.c | 4 | ||||
-rw-r--r-- | libavcodec/g722.h | 2 | ||||
-rw-r--r-- | libavcodec/g722dec.c | 32 | ||||
-rw-r--r-- | libavcodec/g722enc.c | 4 | ||||
-rw-r--r-- | libavcodec/ivi_common.h | 2 | ||||
-rw-r--r-- | libavcodec/lsp.c | 2 | ||||
-rw-r--r-- | libavcodec/mlpdec.c | 56 | ||||
-rw-r--r-- | libavcodec/qcelpdata.h | 16 | ||||
-rw-r--r-- | libavcodec/rtjpeg.c | 2 | ||||
-rw-r--r-- | libavcodec/utils.c | 2 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
13 files changed, 69 insertions, 64 deletions
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index 0a4a7e6dda..57c8ae9ae5 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -653,7 +653,7 @@ static void decode_gains(AMRContext *p, const AMRNBSubframe *amr_subframe, static void apply_ir_filter(float *out, const AMRFixed *in, const float *filter) { - float filter1[AMR_SUBFRAME_SIZE], //!< filters at pitch lag*1 and *2 + float filter1[AMR_SUBFRAME_SIZE], ///< filters at pitch lag*1 and *2 filter2[AMR_SUBFRAME_SIZE]; int lag = in->pitch_lag; float fac = in->pitch_fac; diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index ebdbb5eaec..1181c99e7e 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -22,10 +22,11 @@ /** * @file * Cinepak video decoder - * by Ewald Snel <ewald@rambo.its.tudelft.nl> - * For more information on the Cinepak algorithm, visit: + * @author Ewald Snel <ewald@rambo.its.tudelft.nl> + * + * @see For more information on the Cinepak algorithm, visit: * http://www.csse.monash.edu.au/~timf/ - * For more information on the quirky data inside Sega FILM/CPK files, visit: + * @see For more information on the quirky data inside Sega FILM/CPK files, visit: * http://wiki.multimedia.cx/index.php?title=Sega_FILM */ diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index ebad3b336c..1f6282394e 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -22,9 +22,9 @@ /** * @file * Electronic Arts Madcow Video Decoder - * by Peter Ross <pross@xvid.org> + * @author Peter Ross <pross@xvid.org> * - * Technical details here: + * @see technical details at * http://wiki.multimedia.cx/index.php?title=Electronic_Arts_MAD */ diff --git a/libavcodec/g722.h b/libavcodec/g722.h index 69e7a86e25..eb3b9b872e 100644 --- a/libavcodec/g722.h +++ b/libavcodec/g722.h @@ -31,7 +31,9 @@ #define PREV_SAMPLES_BUF_SIZE 1024 typedef struct { + const AVClass *class; AVFrame frame; + int bits_per_codeword; int16_t prev_samples[PREV_SAMPLES_BUF_SIZE]; ///< memory of past decoded samples int prev_samples_pos; ///< the number of values in prev_samples diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c index 652a1aa4ae..50a224ba10 100644 --- a/libavcodec/g722dec.c +++ b/libavcodec/g722dec.c @@ -37,6 +37,21 @@ #include "avcodec.h" #include "get_bits.h" #include "g722.h" +#include "libavutil/opt.h" + +#define OFFSET(x) offsetof(G722Context, x) +#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM +static const AVOption options[] = { + { "bits_per_codeword", "Bits per G722 codeword", OFFSET(bits_per_codeword), AV_OPT_TYPE_FLAGS, { 8 }, 6, 8, AD }, + { NULL } +}; + +static const AVClass g722_decoder_class = { + .class_name = "g722 decoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; static av_cold int g722_decode_init(AVCodecContext * avctx) { @@ -48,20 +63,6 @@ static av_cold int g722_decode_init(AVCodecContext * avctx) } avctx->sample_fmt = AV_SAMPLE_FMT_S16; - switch (avctx->bits_per_coded_sample) { - case 8: - case 7: - case 6: - break; - default: - av_log(avctx, AV_LOG_WARNING, "Unsupported bits_per_coded_sample [%d], " - "assuming 8\n", - avctx->bits_per_coded_sample); - case 0: - avctx->bits_per_coded_sample = 8; - break; - } - c->band[0].scale_factor = 8; c->band[1].scale_factor = 2; c->prev_samples_pos = 22; @@ -89,7 +90,7 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data, G722Context *c = avctx->priv_data; int16_t *out_buf; int j, ret; - const int skip = 8 - avctx->bits_per_coded_sample; + const int skip = 8 - c->bits_per_codeword; const int16_t *quantizer_table = low_inv_quants[skip]; GetBitContext gb; @@ -149,4 +150,5 @@ AVCodec ff_adpcm_g722_decoder = { .decode = g722_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"), + .priv_class = &g722_decoder_class, }; diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c index bdc30d5d07..f8db49aba8 100644 --- a/libavcodec/g722enc.c +++ b/libavcodec/g722enc.c @@ -139,7 +139,7 @@ static int g722_encode_trellis(AVCodecContext *avctx, nodes[i][0]->state = c->band[i]; } - for (i = 0; i < buf_size >> 1; i++) { + for (i = 0; i < buf_size; i++) { int xlow, xhigh; struct TrellisNode *next[2]; int heap_pos[2] = {0, 0}; @@ -285,7 +285,7 @@ static int g722_encode_frame(AVCodecContext *avctx, if (avctx->trellis) return g722_encode_trellis(avctx, dst, buf_size, data); - for (i = 0; i < buf_size >> 1; i++) { + for (i = 0; i < buf_size; i++) { int xlow, xhigh, ihigh, ilow; filter_samples(c, &samples[2*i], &xlow, &xhigh); ihigh = encode_high(&c->band[1], xhigh); diff --git a/libavcodec/ivi_common.h b/libavcodec/ivi_common.h index 10cca26045..c4c7c3da4d 100644 --- a/libavcodec/ivi_common.h +++ b/libavcodec/ivi_common.h @@ -51,7 +51,7 @@ typedef struct { /// or "7" for custom one VLC *tab; /// pointer to the table associated with tab_sel - //! the following are used only when tab_sel == 7 + /// the following are used only when tab_sel == 7 IVIHuffDesc cust_desc; /// custom Huffman codebook descriptor VLC cust_tab; /// vlc table for custom codebook } IVIHuffTab; diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c index 374539a029..7fda12ee62 100644 --- a/libavcodec/lsp.c +++ b/libavcodec/lsp.c @@ -75,7 +75,7 @@ void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order) /** * @brief decodes polynomial coefficients from LSP - * @param f [out] decoded polynomial coefficients (-0x20000000 <= (3.22) <= 0x1fffffff) + * @param[out] f decoded polynomial coefficients (-0x20000000 <= (3.22) <= 0x1fffffff) * @param lsp LSP coefficients (-0x8000 <= (0.15) <= 0x7fff) */ static void lsp2poly(int* f, const int16_t* lsp, int lp_half_order) diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 4b439ddb67..e91295084c 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -45,35 +45,35 @@ static const char* sample_message = "a sample of this file."; typedef struct SubStream { - //! Set if a valid restart header has been read. Otherwise the substream cannot be decoded. + /// Set if a valid restart header has been read. Otherwise the substream cannot be decoded. uint8_t restart_seen; //@{ /** restart header data */ - //! The type of noise to be used in the rematrix stage. + /// The type of noise to be used in the rematrix stage. uint16_t noise_type; - //! The index of the first channel coded in this substream. + /// The index of the first channel coded in this substream. uint8_t min_channel; - //! The index of the last channel coded in this substream. + /// The index of the last channel coded in this substream. uint8_t max_channel; - //! The number of channels input into the rematrix stage. + /// The number of channels input into the rematrix stage. uint8_t max_matrix_channel; - //! For each channel output by the matrix, the output channel to map it to + /// For each channel output by the matrix, the output channel to map it to uint8_t ch_assign[MAX_CHANNELS]; - //! Channel coding parameters for channels in the substream + /// Channel coding parameters for channels in the substream ChannelParams channel_params[MAX_CHANNELS]; - //! The left shift applied to random noise in 0x31ea substreams. + /// The left shift applied to random noise in 0x31ea substreams. uint8_t noise_shift; - //! The current seed value for the pseudorandom noise generator(s). + /// The current seed value for the pseudorandom noise generator(s). uint32_t noisegen_seed; - //! Set if the substream contains extra info to check the size of VLC blocks. + /// Set if the substream contains extra info to check the size of VLC blocks. uint8_t data_check_present; - //! Bitmask of which parameter sets are conveyed in a decoding parameter block. + /// Bitmask of which parameter sets are conveyed in a decoding parameter block. uint8_t param_presence_flags; #define PARAM_BLOCKSIZE (1 << 7) #define PARAM_MATRIX (1 << 6) @@ -88,32 +88,32 @@ typedef struct SubStream { //@{ /** matrix data */ - //! Number of matrices to be applied. + /// Number of matrices to be applied. uint8_t num_primitive_matrices; - //! matrix output channel + /// matrix output channel uint8_t matrix_out_ch[MAX_MATRICES]; - //! Whether the LSBs of the matrix output are encoded in the bitstream. + /// Whether the LSBs of the matrix output are encoded in the bitstream. uint8_t lsb_bypass[MAX_MATRICES]; - //! Matrix coefficients, stored as 2.14 fixed point. + /// Matrix coefficients, stored as 2.14 fixed point. int32_t matrix_coeff[MAX_MATRICES][MAX_CHANNELS]; - //! Left shift to apply to noise values in 0x31eb substreams. + /// Left shift to apply to noise values in 0x31eb substreams. uint8_t matrix_noise_shift[MAX_MATRICES]; //@} - //! Left shift to apply to Huffman-decoded residuals. + /// Left shift to apply to Huffman-decoded residuals. uint8_t quant_step_size[MAX_CHANNELS]; - //! number of PCM samples in current audio block + /// number of PCM samples in current audio block uint16_t blocksize; - //! Number of PCM samples decoded so far in this frame. + /// Number of PCM samples decoded so far in this frame. uint16_t blockpos; - //! Left shift to apply to decoded PCM values to get final 24-bit output. + /// Left shift to apply to decoded PCM values to get final 24-bit output. int8_t output_shift[MAX_CHANNELS]; - //! Running XOR of all output samples. + /// Running XOR of all output samples. int32_t lossless_check_data; } SubStream; @@ -122,24 +122,24 @@ typedef struct MLPDecodeContext { AVCodecContext *avctx; AVFrame frame; - //! Current access unit being read has a major sync. + /// Current access unit being read has a major sync. int is_major_sync_unit; - //! Set if a valid major sync block has been read. Otherwise no decoding is possible. + /// Set if a valid major sync block has been read. Otherwise no decoding is possible. uint8_t params_valid; - //! Number of substreams contained within this stream. + /// Number of substreams contained within this stream. uint8_t num_substreams; - //! Index of the last substream to decode - further substreams are skipped. + /// Index of the last substream to decode - further substreams are skipped. uint8_t max_decoded_substream; - //! Stream needs channel reordering to comply with FFmpeg's channel order + /// Stream needs channel reordering to comply with FFmpeg's channel order uint8_t needs_reordering; - //! number of PCM samples contained in each frame + /// number of PCM samples contained in each frame int access_unit_size; - //! next power of two above the number of samples in each frame + /// next power of two above the number of samples in each frame int access_unit_size_pow2; SubStream substream[MAX_SUBSTREAMS]; diff --git a/libavcodec/qcelpdata.h b/libavcodec/qcelpdata.h index e71ee9fdb7..4a7dcdb38b 100644 --- a/libavcodec/qcelpdata.h +++ b/libavcodec/qcelpdata.h @@ -40,16 +40,16 @@ typedef struct { /// @name QCELP excitation codebook parameters /// @{ - uint8_t cbsign[16]; ///!< sign of the codebook gain for each codebook subframe - uint8_t cbgain[16]; ///!< unsigned codebook gain for each codebook subframe - uint8_t cindex[16]; ///!< codebook index for each codebook subframe + uint8_t cbsign[16]; ///< sign of the codebook gain for each codebook subframe + uint8_t cbgain[16]; ///< unsigned codebook gain for each codebook subframe + uint8_t cindex[16]; ///< codebook index for each codebook subframe /// @} /// @name QCELP pitch prediction parameters /// @{ - uint8_t plag[4]; ///!< pitch lag for each pitch subframe - uint8_t pfrac[4]; ///!< fractional pitch lag for each pitch subframe - uint8_t pgain[4]; ///!< pitch gain for each pitch subframe + uint8_t plag[4]; ///< pitch lag for each pitch subframe + uint8_t pfrac[4]; ///< fractional pitch lag for each pitch subframe + uint8_t pgain[4]; ///< pitch gain for each pitch subframe /// @} /** @@ -266,7 +266,7 @@ static const QCELPBitmap qcelp_rate_octave_bitmap[] = { * the QCELPContext */ static const QCELPBitmap * const qcelp_unpacking_bitmaps_per_rate[5] = { - NULL, ///!< for SILENCE rate + NULL, ///< for SILENCE rate qcelp_rate_octave_bitmap, qcelp_rate_quarter_bitmap, qcelp_rate_half_bitmap, @@ -274,7 +274,7 @@ static const QCELPBitmap * const qcelp_unpacking_bitmaps_per_rate[5] = { }; static const uint16_t qcelp_unpacking_bitmaps_lengths[5] = { - 0, ///!< for SILENCE rate + 0, ///< for SILENCE rate FF_ARRAY_ELEMS(qcelp_rate_octave_bitmap), FF_ARRAY_ELEMS(qcelp_rate_quarter_bitmap), FF_ARRAY_ELEMS(qcelp_rate_half_bitmap), diff --git a/libavcodec/rtjpeg.c b/libavcodec/rtjpeg.c index 07e4f02e67..e03282b412 100644 --- a/libavcodec/rtjpeg.c +++ b/libavcodec/rtjpeg.c @@ -27,7 +27,7 @@ i = scan[coeff--]; \ block[i] = (c) * quant[i]; -//! aligns the bitstream to the give power of two +/// aligns the bitstream to the given power of two #define ALIGN(a) \ n = (-get_bits_count(gb)) & (a - 1); \ if (n) {skip_bits(gb, n);} diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ae26590a69..1685b4d196 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1468,8 +1468,8 @@ int av_get_bits_per_sample(enum CodecID codec_id){ case CODEC_ID_ADPCM_SWF: case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_YAMAHA: - return 4; case CODEC_ID_ADPCM_G722: + return 4; case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_MULAW: case CODEC_ID_PCM_S8: diff --git a/libavcodec/version.h b/libavcodec/version.h index 70dbd0001e..14b04bac01 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,7 +21,7 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 53 -#define LIBAVCODEC_VERSION_MINOR 40 +#define LIBAVCODEC_VERSION_MINOR 41 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |