Hi,

> +typedef struct Model {
> +    int cum_prob[MODEL_MAX_SYMS + 1];
> +    int weights[MODEL_MAX_SYMS + 1];
> +    int idx2sym[MODEL_MAX_SYMS + 1];
> +    int sym2idx[MODEL_MAX_SYMS + 1];
> +    int num_syms;
> +    int thr_weight, threshold;
> +} Model;

How high are the weights typically? Same for the LUT values of idx2sym
and sym2idx. num_syms seems to be set to 8 or 2, but there is probably
something I missed in between.

Basically, I am wondering if a smaller type could be used.

> +static void arith_normalise(ArithCoder *c)
[...]
> +static int arith_get_bit(ArithCoder *c)
[...]
> +static int arith_get_bits(ArithCoder *c, int bits)
[...]
> +static int arith_get_number(ArithCoder *c, int mod_val)

I guess you are not interested in this part, but probably those (and
mostly those) could benefit from some av_inline, but most compilers
probably get it right on their own.

> +        memset(neighbours, src[-1], 4);

Something like AV_WN32A(neighbours, src[-1]*0x01010101) maybe? I guess
other parts would be more in need than this but still...

I haven't checked even remotely if there is any issue with incorrect
bitstreams, which would probably be a more interesting review.

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

Reply via email to