diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-01 05:33:39 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-01 05:35:26 +0200 |
commit | 721be993713550e7f1c3bccf670fd0a1be7e7738 (patch) | |
tree | 500c5f113ad0092f52bca3bbb9db807d82c4ac92 /libavcodec | |
parent | 9251942ca728e7807a2a95306415b27b36a8b8e7 (diff) | |
parent | be73d76b34481686020e423ccabcca77042d0ede (diff) | |
download | ffmpeg-721be993713550e7f1c3bccf670fd0a1be7e7738.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
cosmetics: fix some then/than typos
doxygen: Include libavcodec and libavformat examples into the documentation
avutil: elaborate documentation for av_get_random_seed
Add support for aac streams in mp4/mov without extradata.
aes: whitespace cosmetics
adler32: whitespace cosmetics
swscale: fix another yuv range conversion overflow in 16bit scaling.
Fix cpu flags test program
opt-test: Add missing braces to silence compiler warnings.
build: Eliminate obsolete test targets.
udp: Fix a compilation warning
swscale: Unbreak build with --enable-small
base64: add fate test
aes: improve test program and add fate test
adler32: make test program more useful and add fate test
swscale: fix yuv range correction when using 16-bit scaling.
aacenc: Make chan_map const correct
Conflicts:
Makefile
doc/examples/muxing-example.c
libavformat/udp.c
libavutil/random_seed.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/aacdec.c | 42 | ||||
-rw-r--r-- | libavcodec/aacenc.h | 2 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 2 | ||||
-rw-r--r-- | libavcodec/dca.c | 2 | ||||
-rw-r--r-- | libavcodec/dsputil.h | 4 | ||||
-rw-r--r-- | libavcodec/get_bits.h | 4 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 4 | ||||
-rw-r--r-- | libavcodec/pgssubdec.c | 2 |
8 files changed, 52 insertions, 10 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index cb8760801a..8a936da59e 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -532,6 +532,22 @@ static void reset_all_predictors(PredictorState *ps) reset_predict_state(&ps[i]); } +static int sample_rate_idx (int rate) +{ + if (92017 <= rate) return 0; + else if (75132 <= rate) return 1; + else if (55426 <= rate) return 2; + else if (46009 <= rate) return 3; + else if (37566 <= rate) return 4; + else if (27713 <= rate) return 5; + else if (23004 <= rate) return 6; + else if (18783 <= rate) return 7; + else if (13856 <= rate) return 8; + else if (11502 <= rate) return 9; + else if (9391 <= rate) return 10; + else return 11; +} + static void reset_predictor_group(PredictorState *ps, int group_num) { int i; @@ -554,10 +570,33 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ac->m4ac.sample_rate = avctx->sample_rate; if (avctx->extradata_size > 0) { + avctx->channels = 0; + avctx->frame_size = 0; + avctx->sample_rate = 0; if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac, avctx->extradata, avctx->extradata_size) < 0) return -1; + } else { + int sr, i; + enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; + + sr = sample_rate_idx(avctx->sample_rate); + ac->m4ac.sampling_index = sr; + ac->m4ac.channels = avctx->channels; + + for (i = 0; i < FF_ARRAY_ELEMS(ff_mpeg4audio_channels); i++) + if (ff_mpeg4audio_channels[i] == avctx->channels) + break; + if (i == FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) { + i = 0; + } + ac->m4ac.chan_config = i; + + if (ac->m4ac.chan_config) { + set_default_channel_config(avctx, new_che_pos, ac->m4ac.chan_config); + output_configure(ac, ac->che_pos, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR); + } } if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) { @@ -2049,6 +2088,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config, OC_TRIAL_FRAME)) return -7; } else if (ac->output_configured != OC_LOCKED) { + ac->m4ac.chan_config = 0; ac->output_configured = OC_NONE; } if (ac->output_configured != OC_LOCKED) { @@ -2516,6 +2556,7 @@ AVCodec ff_aac_decoder = { .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, + .capabilities = CODEC_CAP_CHANNEL_CONF, .channel_layouts = aac_channel_layout, }; @@ -2536,5 +2577,6 @@ AVCodec ff_aac_latm_decoder = { .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, + .capabilities = CODEC_CAP_CHANNEL_CONF, .channel_layouts = aac_channel_layout, }; diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index 1e27ddc40d..150c651665 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -61,7 +61,7 @@ typedef struct AACEncContext { int16_t *samples; ///< saved preprocessed input int samplerate_index; ///< MPEG-4 samplerate index - uint8_t *chan_map; ///< channel configuration map + const uint8_t *chan_map; ///< channel configuration map ChannelElement *cpe; ///< channel elements FFPsyContext psy; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 2345b7e526..4cd928dc83 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1410,7 +1410,7 @@ typedef struct AVCodecContext { * A demuxer should set this to what is stored in the field used to identify the codec. * If there are multiple such fields in a container then the demuxer should choose the one * which maximizes the information about the used codec. - * If the codec tag field in a container is larger then 32 bits then the demuxer should + * If the codec tag field in a container is larger than 32 bits then the demuxer should * remap the longer ID to 32 bits with a table or other structure. Alternatively a new * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated * first. diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 4b445bc743..b56005b7cf 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1316,7 +1316,7 @@ static int dca_convert_bitstream(const uint8_t * src, int src_size, uint8_t * ds PutBitContext pb; if ((unsigned)src_size > (unsigned)max_size) { -// av_log(NULL, AV_LOG_ERROR, "Input frame size larger then DCA_MAX_FRAME_SIZE!\n"); +// av_log(NULL, AV_LOG_ERROR, "Input frame size larger than DCA_MAX_FRAME_SIZE!\n"); // return -1; src_size = max_size; } diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 0143ed7d3c..f2054a4cf0 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -150,7 +150,7 @@ void clear_blocks_c(DCTELEM *blocks); /* add and put pixel (decoding) */ // blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16 -//h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller then 4 +//h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller than 4 typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int h); typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int w, int h); typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride); @@ -183,7 +183,7 @@ static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ } /* motion estimation */ -// h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller then 2 +// h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller than 2 // although currently h<4 is not used as functions with width <8 are neither used nor implemented typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size, int h)/* __attribute__ ((const))*/; diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 8579c87cd1..3b09dfd285 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -381,7 +381,7 @@ static inline int check_marker(GetBitContext *s, const char *msg) /** * init GetBitContext. - * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits + * @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 * @@ -504,7 +504,7 @@ void free_vlc(VLC *vlc); /** - * parses a vlc code, faster then get_vlc() + * parses 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/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index a6e9c7c7be..bb7fdc735f 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1787,7 +1787,7 @@ static av_always_inline void encode_mb(MpegEncContext *s, int motion_x, int moti static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){ int i; - memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop? + memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster than a loop? /* mpeg1 */ d->mb_skip_run= s->mb_skip_run; @@ -1816,7 +1816,7 @@ static inline void copy_context_after_encode(MpegEncContext *d, MpegEncContext * int i; memcpy(d->mv, s->mv, 2*4*2*sizeof(int)); - memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop? + memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster than a loop? /* mpeg1 */ d->mb_skip_run= s->mb_skip_run; diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 315dbbd779..96b400b2bb 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -198,7 +198,7 @@ static int parse_picture_segment(AVCodecContext *avctx, /* Make sure the bitmap is not too large */ if (avctx->width < width || avctx->height < height) { - av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger then video.\n"); + av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger than video.\n"); return -1; } |