Quoting Diego Biurrun (2017-01-11 18:09:59)
> From: Alexandra Hájková <alexan...@khirnov.net>
> 
> ---
>  libavcodec/alsdec.c | 232 
> ++++++++++++++++++++++++++--------------------------
>  libavcodec/bgmc.c   |  16 ++--
>  libavcodec/bgmc.h   |   8 +-
>  3 files changed, 130 insertions(+), 126 deletions(-)
> 
> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
> index 9fd2827..342feaa 100644
> --- a/libavcodec/alsdec.c
> +++ b/libavcodec/alsdec.c
> @@ -28,13 +28,13 @@
>  #include <inttypes.h>
>  
>  #include "avcodec.h"
> -#include "get_bits.h"
> +#include "bitstream.h"
>  #include "mpeg4audio.h"
>  #include "bytestream.h"
>  #include "bgmc.h"
>  #include "bswapdsp.h"
>  #include "internal.h"
> -#include "unary_legacy.h"
> +#include "unary.h"
>  
>  #include "libavutil/samplefmt.h"
>  #include "libavutil/crc.h"
> @@ -192,7 +192,7 @@ typedef struct ALSChannelData {
>  typedef struct ALSDecContext {
>      AVCodecContext *avctx;
>      ALSSpecificConfig sconf;
> -    GetBitContext gb;
> +    BitstreamContext bc;
>      BswapDSPContext bdsp;
>      const AVCRC *crc_table;
>      uint32_t crc_org;               ///< CRC value of the original input data
> @@ -281,7 +281,7 @@ static av_cold void dprint_specific_config(ALSDecContext 
> *ctx)
>   */
>  static av_cold int read_specific_config(ALSDecContext *ctx)
>  {
> -    GetBitContext gb;
> +    BitstreamContext bc;
>      uint64_t ht_size;
>      int i, config_offset;
>      MPEG4AudioConfig m4ac;
> @@ -289,7 +289,7 @@ static av_cold int read_specific_config(ALSDecContext 
> *ctx)
>      AVCodecContext *avctx    = ctx->avctx;
>      uint32_t als_id, header_size, trailer_size;
>  
> -    init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);
> +    bitstream_init8(&bc, avctx->extradata, avctx->extradata_size);
>  
>      config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata,
>                                                   avctx->extradata_size * 8, 
> 1);
> @@ -297,40 +297,40 @@ static av_cold int read_specific_config(ALSDecContext 
> *ctx)
>      if (config_offset < 0)
>          return AVERROR_INVALIDDATA;
>  
> -    skip_bits_long(&gb, config_offset);
> +    bitstream_skip(&bc, config_offset);
>  
> -    if (get_bits_left(&gb) < (30 << 3))
> +    if (bitstream_bits_left(&bc) < (30 << 3))
>          return AVERROR_INVALIDDATA;
>  
>      // read the fixed items
> -    als_id                      = get_bits_long(&gb, 32);
> +    als_id                      = bitstream_read(&bc, 32);
>      avctx->sample_rate          = m4ac.sample_rate;
> -    skip_bits_long(&gb, 32); // sample rate already known
> -    sconf->samples              = get_bits_long(&gb, 32);
> +    bitstream_skip(&bc, 32); // sample rate already known
> +    sconf->samples              = bitstream_read(&bc, 32);
>      avctx->channels             = m4ac.channels;
> -    skip_bits(&gb, 16);      // number of channels already known
> -    skip_bits(&gb, 3);       // skip file_type
> -    sconf->resolution           = get_bits(&gb, 3);
> -    sconf->floating             = get_bits1(&gb);
> -    sconf->msb_first            = get_bits1(&gb);
> -    sconf->frame_length         = get_bits(&gb, 16) + 1;
> -    sconf->ra_distance          = get_bits(&gb, 8);
> -    sconf->ra_flag              = get_bits(&gb, 2);
> -    sconf->adapt_order          = get_bits1(&gb);
> -    sconf->coef_table           = get_bits(&gb, 2);
> -    sconf->long_term_prediction = get_bits1(&gb);
> -    sconf->max_order            = get_bits(&gb, 10);
> -    sconf->block_switching      = get_bits(&gb, 2);
> -    sconf->bgmc                 = get_bits1(&gb);
> -    sconf->sb_part              = get_bits1(&gb);
> -    sconf->joint_stereo         = get_bits1(&gb);
> -    sconf->mc_coding            = get_bits1(&gb);
> -    sconf->chan_config          = get_bits1(&gb);
> -    sconf->chan_sort            = get_bits1(&gb);
> -    sconf->crc_enabled          = get_bits1(&gb);
> -    sconf->rlslms               = get_bits1(&gb);
> -    skip_bits(&gb, 5);       // skip 5 reserved bits
> -    skip_bits1(&gb);         // skip aux_data_enabled
> +    bitstream_skip(&bc, 16); // number of channels already knwon

knwon?

Otherwise looks ok.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to