static int xan_decode_init(AVCodecContext *avctx)

{

    XanContext *s = avctx->priv_data;

    int i;



    s->avctx = avctx;



    if ((avctx->codec->id == CODEC_ID_XAN_WC3) && 

        (s->avctx->palctrl == NULL)) {

        av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n");

        return -1;

    }



    avctx->pix_fmt = PIX_FMT_PAL8;

    avctx->has_b_frames = 0;

    dsputil_init(&s->dsp, avctx);



    /* initialize the RGB -> YUV tables */

    for (i = 0; i < 256; i++) {

        y_r_table[i] = Y_R * i;

        y_g_table[i] = Y_G * i;

        y_b_table[i] = Y_B * i;



        u_r_table[i] = U_R * i;

        u_g_table[i] = U_G * i;

        u_b_table[i] = U_B * i;



        v_r_table[i] = V_R * i;

        v_g_table[i] = V_G * i;

        v_b_table[i] = V_B * i;

    }



    if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))

        return -1;

    

    s->buffer1 = av_malloc(avctx->width * avctx->height);

    s->buffer2 = av_malloc(avctx->width * avctx->height);

    if (!s->buffer1 || !s->buffer2)

        return -1;



    return 0;

}

static int xan_decode_init(AVCodecContext *avctx)

{

    XanContext *s = avctx->priv_data;

    int i;



    s->avctx = avctx;



    if ((avctx->codec->id == CODEC_ID_XAN_WC3) && 

        (s->avctx->palctrl == NULL)) {

        av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n");

        return -1;

    }



    avctx->pix_fmt = PIX_FMT_PAL8;

    avctx->has_b_frames = 0;

    dsputil_init(&s->dsp, avctx);



    

    for (i = 0; i < 256; i++) {

        y_r_table[i] = Y_R * i;

        y_g_table[i] = Y_G * i;

        y_b_table[i] = Y_B * i;



        u_r_table[i] = U_R * i;

        u_g_table[i] = U_G * i;

        u_b_table[i] = U_B * i;



        v_r_table[i] = V_R * i;

        v_g_table[i] = V_G * i;

        v_b_table[i] = V_B * i;

    }



    if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))

        return -1;

    

    s->buffer1 = av_malloc(avctx->width * avctx->height);

    s->buffer2 = av_malloc(avctx->width * avctx->height);

    if (!s->buffer1 || !s->buffer2)

        return -1;



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0)

{

    XanContext *s = VAR_0->priv_data;

    int VAR_1;



    s->VAR_0 = VAR_0;



    if ((VAR_0->codec->id == CODEC_ID_XAN_WC3) && 

        (s->VAR_0->palctrl == NULL)) {

        av_log(VAR_0, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n");

        return -1;

    }



    VAR_0->pix_fmt = PIX_FMT_PAL8;

    VAR_0->has_b_frames = 0;

    dsputil_init(&s->dsp, VAR_0);



    

    for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {

        y_r_table[VAR_1] = Y_R * VAR_1;

        y_g_table[VAR_1] = Y_G * VAR_1;

        y_b_table[VAR_1] = Y_B * VAR_1;



        u_r_table[VAR_1] = U_R * VAR_1;

        u_g_table[VAR_1] = U_G * VAR_1;

        u_b_table[VAR_1] = U_B * VAR_1;



        v_r_table[VAR_1] = V_R * VAR_1;

        v_g_table[VAR_1] = V_G * VAR_1;

        v_b_table[VAR_1] = V_B * VAR_1;

    }



    if(avcodec_check_dimensions(VAR_0, VAR_0->width, VAR_0->height))

        return -1;

    

    s->buffer1 = av_malloc(VAR_0->width * VAR_0->height);

    s->buffer2 = av_malloc(VAR_0->width * VAR_0->height);

    if (!s->buffer1 || !s->buffer2)

        return -1;



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0)
{ XanContext *s = VAR_0->priv_data; int VAR_1; s->VAR_0 = VAR_0; if ((VAR_0->codec->id == CODEC_ID_XAN_WC3) &&
(s->VAR_0->palctrl == NULL)) { av_log(VAR_0, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n"); return -1; } VAR_0->pix_fmt = PIX_FMT_PAL8; VAR_0->has_b_frames = 0; dsputil_init(&s->dsp, VAR_0); for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { y_r_table[VAR_1] = Y_R * VAR_1; y_g_table[VAR_1] = Y_G * VAR_1; y_b_table[VAR_1] = Y_B * VAR_1; u_r_table[VAR_1] = U_R * VAR_1; u_g_table[VAR_1] = U_G * VAR_1; u_b_table[VAR_1] = U_B * VAR_1; v_r_table[VAR_1] = V_R * VAR_1; v_g_table[VAR_1] = V_G * VAR_1; v_b_table[VAR_1] = V_B * VAR_1; } if(avcodec_check_dimensions(VAR_0, VAR_0->width, VAR_0->height))
return -1; s->buffer1 = av_malloc(VAR_0->width * VAR_0->height); s->buffer2 = av_malloc(VAR_0->width * VAR_0->height); if (!s->buffer1 || !s->buffer2)
return -1; return 0; }