[FFmpeg-devel] [PATCH 2/3] Add single stream LATM/LOAS decoder

Janne Grunau janne-ffmpeg
Thu Oct 28 22:46:25 CEST 2010


On Tue, Oct 19, 2010 at 10:11:22AM +0200, Michael Niedermayer wrote:
> On Mon, Oct 18, 2010 at 07:37:14PM +0200, Janne Grunau wrote:
> > The decoder is basicly just a wrapper around the AAC decoder.
> > based on patch by Paul Kendall { paul <?t> kcbbs gen nz }
> > ---
> > index a16bfa0..fa1f1d0 100644
> > --- a/libavcodec/aacdec.h
> > +++ b/libavcodec/aacdec.h
> 
> > @@ -28,6 +28,9 @@
> >  #include "avcodec.h"
> >  #include "get_bits.h"
> >  
> > +av_cold int ff_aac_decode_init(AVCodecContext *avctx);
> > +
> > +av_cold int ff_aac_decode_close(AVCodecContext *avctx);
> >  
> >  int ff_aac_decode_frame_int(AVCodecContext *avctx, void *data,
> >                              int *data_size, GetBitContext *gb);
> 
> does that av_cold in there have any effect?

probably not, direct copying from the source. withdrawn since Alex
prefers latm decode in aacdec.c

> > +struct LATMContext {
> > +    AACContext      aac_ctx;
> > +    int             initialized;         // initilized after a valid extradata is set
> > +
> > +    // parser data
> > +    int             audio_mux_version_A; // LATM syntax version
> > +    int             frame_length_type;   // 0/1 variable/fixed frame length
> > +    int             frame_length;        // frame length for fixed frame length
> 
> doxy

done

> > +static inline uint32_t latm_get_value(GetBitContext *b)
> > +{
> > +    int length = get_bits(b, 2);
> 
> > +    uint32_t value = 0;
> > +    int i;
> > +    for (i = 0; i <= length; i++) {
> > +        value <<= 8;
> > +        value |= get_bits(b, 8);
> > +    }
> > +    return value;
> 
> isnt this
> return get_bits_long((length+1)*8);

yes, fixed.

> > +//copied from ff_copy_pce_data() in mpeg4audio.c
> > +static int parse_pce_data(GetBitContext *gb)
> > +{
> > +    int five_bit_ch, four_bit_ch, comment_size, bits;
> > +    int offset = get_bits_count(gb);
> > +
> > +    skip_bits(gb, 10);                  //Tag, Object Type, Frequency
> > +    five_bit_ch  = get_bits(gb, 4);     //Front
> > +    five_bit_ch += get_bits(gb, 4);     //Side
> > +    five_bit_ch += get_bits(gb, 4);     //Back
> > +    four_bit_ch  = get_bits(gb, 2);     //LFE
> > +    four_bit_ch += get_bits(gb, 3);     //Data
> > +    five_bit_ch += get_bits(gb, 4);     //Coupling
> > +    if (get_bits(gb, 1))                //Mono Mixdown
> > +        skip_bits(gb, 4);
> > +    if (get_bits(gb, 1))                //Stereo Mixdown
> > +        skip_bits(gb, 4);
> > +    if (get_bits(gb, 1))                //Matrix Mixdown
> > +        skip_bits(gb, 3);
> 
> > +    for (bits = five_bit_ch*5+four_bit_ch*4; bits > 16; bits -= 16)
> > +        skip_bits(gb, 16);
> > +    if (bits)
> > +        skip_bits(gb, bits);
> 
> skip_bits_long() ?
> 
> 
> > +    align_get_bits(gb);
> > +    comment_size = get_bits(gb, 8);
> 
> > +    for (; comment_size > 0; comment_size--)
> > +        get_bits(gb, 8);
> 
> same

both removed from this patch, fixing it in ff_copy_pce_data added to
todo list.

new patch will be sent out after handling Alex' comments.

Janne 



More information about the ffmpeg-devel mailing list