[FFmpeg-devel] avcodec/als: floating point support in ALS decoder

Michael Niedermayer michael at niedermayer.cc
Sat Jun 25 22:55:10 CEST 2016


On Sat, Jun 25, 2016 at 10:52:40PM +0530, Umair Khan wrote:
> Hi,
> 
> Patch attached.
> 
> Umair

>  libavcodec/Makefile           |    2 
>  libavcodec/alsdec.c           |  286 +++++++++++++++++++++++++++++++++++++++++-
>  libavcodec/mlz.c              |  162 +++++++++++++++++++++++
>  libavcodec/mlz.h              |   67 +++++++++
>  libavutil/softfloat_ieee754.h |  115 ++++++++++++++++
>  5 files changed, 629 insertions(+), 3 deletions(-)
> 2f99fc6d37f05089e8f312b4af0d894e22f3a829  0001-avcodec-als-floating-point-support-in-ALS-decoder.patch
> From 56281948ec484c19dd9009c861ded38905e1b786 Mon Sep 17 00:00:00 2001
> From: Umair Khan <omerjerk at gmail.com>
> Date: Sat, 25 Jun 2016 22:48:02 +0530
> Subject: [PATCH] avcodec/als: floating point support in ALS decoder
[...]
> @@ -1798,6 +2053,33 @@ static av_cold int decode_init(AVCodecContext *avctx)
>      ctx->raw_buffer       = av_mallocz_array(avctx->channels * channel_size, sizeof(*ctx->raw_buffer));
>      ctx->raw_samples      = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples));
>  
> +    if (sconf->floating) {
> +        ctx->acf =  av_malloc_array(avctx->channels, sizeof(*ctx->acf));
> +        ctx->shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value));
> +        ctx->last_shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->last_shift_value));
> +        ctx->last_acf_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->last_acf_mantissa));
> +        ctx->raw_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->raw_mantissa));

> +        for (int c = 0; c < avctx->channels; ++c) {
> +            ctx->raw_mantissa[c] = av_malloc_array(ctx->cur_frame_length, sizeof(**ctx->raw_mantissa));
> +            for (int i = 0; i < ctx->cur_frame_length; ++i) {

we dont use "for (int" syntax anywhere, i think some compilers had
problems with that

[...]

> +#define DIC_INDEX_MAX       32768L  // 2^15
> +#define FLUSH_CODE          256
> +#define FREEZE_CODE         257
> +#define FIRST_CODE          258
> +#define MAX_CODE            32767L
> +#define TABLE_SIZE          35023L  // TABLE_SIZE must be a prime number

The L postfixes shouldnt be needed, int is 32+bit in POSIX

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

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160625/d744c9bc/attachment.sig>


More information about the ffmpeg-devel mailing list