On Wed, Feb 29, 2012 at 09:32:31AM -0800, Mashiat Sarker Shakkhar wrote:
>  
> --- /dev/null
> +++ b/libavcodec/wmalosslessdec.c
> @@ -0,0 +1,1286 @@
> +    /* frame info */
> +    s->skip_frame  = 1; /* skip first frame */
> +    s->packet_loss = 1;
> +    s->len_prefix  = (s->decode_flags & 0x40);

pointless ()

> +    log2_max_num_subframes  = ((s->decode_flags & 0x38) >> 3);

more

> +/**
> + * @brief Decode the subframe length.
> + * @param s context
> + * @param offset sample offset in the frame
> + * @return decoded subframe length on success, < 0 in case of an error
> + */
> +
> +        for (c = 0; c < s->num_channels; c++) {
> +            WmallChannelCtx* chan = &s->channel[c];

*chan

> +static void clear_codec_buffers(WmallDecodeCtx *s)
> +{
> +    int ich, ilms;
> +
> +    memset(s->acfilter_coeffs, 0, 16 * sizeof(int));
> +    memset(s->acfilter_prevvalues, 0, 16 * 2 * sizeof(int));
> +    memset(s->lpc_coefs, 0, 40 * 2 * sizeof(int));

sizeof(*s->whatever) should be more robust, same below

> +    memset(s->mclms_coeffs, 0, 128 * sizeof(int16_t));
> +    memset(s->mclms_coeffs_cur, 0,   4 * sizeof(int16_t));
> +    memset(s->mclms_prevvalues, 0,  64 * sizeof(int));
> +    memset(s->mclms_updates, 0,  64 * sizeof(int16_t));

Either prettyprint all four lines or none, but just the middle two
looks silly.

> +        s->channel[ich].transient_counter = s->samples_per_frame;
> +        s->transient[ich]     = 1;
> +        s->transient_pos[ich] = 0;

align

> +static int decode_subframe(WmallDecodeCtx *s)
> +{
> +    int offset = s->samples_per_frame;
> +    int subframe_len = s->samples_per_frame;
> +    int i, j;
> +    int total_samples = s->samples_per_frame * s->num_channels;
> +    int rawpcm_tile;
> +    int padding_zeroes;

SCNR

  int offset        = s->samples_per_frame;
  int subframe_len  = s->samples_per_frame;
  int total_samples = s->samples_per_frame * s->num_channels;
  int i, j, rawpcm_tile, padding_zeroes;

> +/**
> + * @brief Decode one WMA frame.
> + * @param s codec context
> + * @return 0 if the trailer bit indicates that this is the last frame,
> + *        1 if there are additional frames

nit: align 0 and 1

> +static int decode_frame(WmallDecodeCtx *s)
> +{
> +    GetBitContext* gb = &s->gb;
> +    int more_frames = 0;
> +    int len = 0;
> +    int i, ret;
> +
> +    s->frame.nb_samples = s->samples_per_frame;
> +    if ((ret = s->avctx->get_buffer(s->avctx, &s->frame)) < 0) {
> +        /* return an error if no frame could be decoded at all */
> +        av_log(s->avctx, AV_LOG_ERROR,
> +               "not enough space for the output samples\n");
> +        s->packet_loss = 1;
> +        return 0;
> +    }

You discard the return value, so there is no need to capture it in a
variable.  Note that gcc 4.6 and later would warn about this
write-only variable.

> +    /* read drc info */
> +    if (s->dynamic_range_compression) {
> +        s->drc_gain = get_bits(gb, 8);
> +    }

pointless {}

> +static int decode_packet(AVCodecContext *avctx,
> +                         void *data, int *got_frame_ptr, AVPacket* avpkt)
> +{
> +    WmallDecodeCtx *s = avctx->priv_data;
> +    GetBitContext* gb  = &s->pgb;
> +    const uint8_t* buf = avpkt->data;
> +    int buf_size       = avpkt->size;

Align all = while you're at it.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to