[FFmpeg-cvslog] Canopus HQX decoder

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Mar 9 23:02:59 CET 2015


On Mon, Feb 23, 2015 at 12:29:27PM +0100, Vittorio Giovara wrote:
> +static const int hqx_quants[16][4] = {

Could be int16_t.

> +    int t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, tA, tB, tC, tD, tE, tF;
> +    int t10, t11, t12, t13;
> +    int s0, s1, s2, s3, s4, s5, s6, s7;
> +
> +    s0 = (int) blk[0 * 8] * quant[0 * 8];
> +    s1 = (int) blk[1 * 8] * quant[1 * 8];
> +    s2 = (int) blk[2 * 8] * quant[2 * 8];
> +    s3 = (int) blk[3 * 8] * quant[3 * 8];
> +    s4 = (int) blk[4 * 8] * quant[4 * 8];
> +    s5 = (int) blk[5 * 8] * quant[5 * 8];
> +    s6 = (int) blk[6 * 8] * quant[6 * 8];
> +    s7 = (int) blk[7 * 8] * quant[7 * 8];

Aren't those casts pointless?


> +    for (i = 0; i < 8; i++) {
> +        for (j = 0; j < 8; j++) {
> +            int v = av_clip(block[j + i * 8] + 0x800, 0, 0x1000);
> +            dst[j] = (v << 4) | (v >> 8);

It would be kind of nice if someone can figure out an explanation for
this.
Clip max value seems kind of strange as it basically overflows in that
case.

> +    int val;
> +
> +    val = show_bits(gb, ac->lut_bits);

Declaration and initialization could be merged.

> +    int flag;
> +    int last_dc;
> +    int i, ret;
> +
> +    if (ctx->interlaced)
> +        flag = get_bits1(gb);
> +    else
> +        flag = 0;

int flag = ctx->interlaced && get_bits1(gb);
maybe ?

> +    for (i = 0; i < 12; i++)
> +        memset(ctx->block[i], 0, sizeof(**ctx->block) * 64);
> +    for (i = 0; i < 12; i++)
> +        ctx->block[i][0] = -0x800;

The loops could be merged?
Though the memset could just be
memset(ctx->block, 0, sizeof(ctx->block[0]) * 12);
I think?
Both apply to basically all variants of the decode functions.

> +static const int shuffle_16[16] = {
> +    0, 5, 11, 14, 2, 7, 9, 13, 1, 4, 10, 15, 3, 6, 8, 12
> +};

int8_t would be enough...

> +        ret = init_get_bits(&gb, src + slice_off[slice],
> +                            (slice_off[slice + 1] - slice_off[slice]) * 8);

I think this should use init_get_bits8 instead?


More information about the ffmpeg-cvslog mailing list