On Thu, May 16, 2013 at 10:54:29AM +0200, Evert Taube wrote:
> --- /dev/null
> +++ b/libavcodec/aic.c
> @@ -0,0 +1,477 @@
> +
> + ctx->quant = src[15];
> + ctx->interlaced = ((src[16] >> 4) == 3);
pointless ()
> +static void recombine_block(int16_t *dst, const uint8_t *scan,
> + int16_t **base, int16_t **ext)
> +{
> + int i, j;
> +
> + for (i = 0; i < 4; i++) {
> + for (j = 0; j < 4; j++)
> + dst[scan[i * 8 + j]] = (*base)[j];
> + for (j = 0; j < 4; j++)
> + dst[scan[i * 8 + j + 4]] = (*ext)[j];
> + *base += 4;
> + *ext += 4;
> + }
> + for (; i < 8; i++) {
> + for (j = 0; j < 8; j++)
> + dst[scan[i * 8 + j]] = (*ext)[j];
> + *ext += 8;
> + }
> +}
> +
> +static void recombine_block_il(int16_t *dst, const uint8_t *scan,
> + int16_t **base, int16_t **ext,
> + int block_no)
> +{
> + int i, j;
> +
> + if (block_no < 2) {
> + for (i = 0; i < 8; i++) {
> + for (j = 0; j < 4; j++)
> + dst[scan[i * 8 + j]] = (*base)[j];
> + for (j = 0; j < 4; j++)
> + dst[scan[i * 8 + j + 4]] = (*ext)[j];
> + *base += 4;
> + *ext += 4;
> + }
> + } else {
> + for (i = 0; i < 64; i++)
> + dst[scan[i]] = (*ext)[i];
> + *ext += 64;
> + }
> +}
Maybe refactor the contents of the for-loop into a function or macro?
> + memset(ctx->slice_data, 0, sizeof(*ctx->slice_data) * slice_width
> + * AIC_BAND_COEFFS);
memset(ctx->slice_data, 0,
sizeof(*ctx->slice_data) * slice_width * AIC_BAND_COEFFS);
looks less strange IMO
> +static av_cold int aic_decode_init(AVCodecContext *avctx)
> +{
> + AICContext *ctx = avctx->priv_data;
> + int i;
> + uint8_t scan[64];
> +
> + ctx->avctx = avctx;
> +
> + avctx->pix_fmt = AV_PIX_FMT_YUV420P;
> +
> + ff_dsputil_init(&ctx->dsp, avctx);
> +
> + for (i = 0; i < 64; i++)
> + scan[i] = i;
> + ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, scan);
Is that all you need dsputil for? Maybe it's time to split that part
off off the beast...
> +AVCodec ff_aic_decoder = {
> + .name = "aic",
> + .type = AVMEDIA_TYPE_VIDEO,
> + .id = AV_CODEC_ID_AIC,
> + .priv_data_size = sizeof(AICContext),
> + .init = aic_decode_init,
> + .close = aic_decode_close,
> + .decode = aic_decode_frame,
> + .capabilities = CODEC_CAP_DR1,
> + .long_name = NULL_IF_CONFIG_SMALL("Apple Intermediate Codec")
> +};
nit: Place long_name directly after name.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel