[FFmpeg-devel] [PATCH] Split reading and decoding of blocks in ALS

Michael Niedermayer michaelni
Sat Dec 12 19:08:28 CET 2009


On Sat, Dec 12, 2009 at 08:11:51AM +0100, Thilo Borgmann wrote:
> Am 12.12.09 00:20, schrieb Carl Eugen Hoyos:
> > Thilo Borgmann <thilo.borgmann <at> googlemail.com> writes:
> > 
> >> I added a patch for clarification,
> > 
> > No.
> 
> Oh, thanks for reminding!
[...]
>  /** Reads the block data for a constant block
>   */
> -static void read_const_block(ALSDecContext *ctx, int32_t *raw_samples,
> -                             unsigned int block_length, unsigned int *js_blocks)
> +static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
>  {
>      ALSSpecificConfig *sconf = &ctx->sconf;
>      AVCodecContext *avctx    = ctx->avctx;
>      GetBitContext *gb        = &ctx->gb;
> -    int32_t const_val        = 0;
> -    unsigned int const_block, k;
>  
> -    const_block  = get_bits1(gb);    // 1 = constant value, 0 = zero block (silence)
> -    *js_blocks   = get_bits1(gb);
> +    bd->const_val    = 0;
> +    bd->const_block  = get_bits1(gb);    // 1 = constant value, 0 = zero block (silence)
> +    bd->js_blocks    = get_bits1(gb);
>  
>      // skip 5 reserved bits
>      skip_bits(gb, 5);
>  
> -    if (const_block) {
> +    if (bd->const_block) {
>          unsigned int const_val_bits = sconf->floating ? 24 : avctx->bits_per_raw_sample;
> -        const_val = get_sbits_long(gb, const_val_bits);
> +        bd->const_val = get_sbits_long(gb, const_val_bits);
>      }
>  
> +    // ensure constant block decoding by reusing this field
> +    bd->const_block = 1;

it seems const_block before this can stay as a local var
similar, if there are other variables tha can stay local they should

[...]
>  
> -
>      if (!sconf->rlslms) {

unrelated

[...]
>  }
>  
> -
>  /** Reads the block data.
>   */

hmm

except these the patch should be ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091212/eadbfac0/attachment.pgp>



More information about the ffmpeg-devel mailing list