static int vqa_decode_init(AVCodecContext *avctx)

{

    VqaContext *s = (VqaContext *)avctx->priv_data;

    unsigned char *vqa_header;

    int i, j, codebook_index;;



    s->avctx = avctx;

    avctx->pix_fmt = PIX_FMT_PAL8;

    avctx->has_b_frames = 0;

    dsputil_init(&s->dsp, avctx);



    /* make sure the extradata made it */

    if (s->avctx->extradata_size != VQA_HEADER_SIZE) {

        av_log(s->avctx, AV_LOG_ERROR, "  VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);





    /* load up the VQA parameters from the header */

    vqa_header = (unsigned char *)s->avctx->extradata;

    s->vqa_version = vqa_header[0];

    s->width = LE_16(&vqa_header[6]);

    s->height = LE_16(&vqa_header[8]);





    s->vector_width = vqa_header[10];

    s->vector_height = vqa_header[11];

    s->partial_count = s->partial_countdown = vqa_header[13];



    /* the vector dimensions have to meet very stringent requirements */

    if ((s->vector_width != 4) ||

        ((s->vector_height != 2) && (s->vector_height != 4))) {

        /* return without further initialization */





    /* allocate codebooks */

    s->codebook_size = MAX_CODEBOOK_SIZE;

    s->codebook = av_malloc(s->codebook_size);

    s->next_codebook_buffer = av_malloc(s->codebook_size);



    /* initialize the solid-color vectors */

    if (s->vector_height == 4) {

        codebook_index = 0xFF00 * 16;

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

            for (j = 0; j < 16; j++)

                s->codebook[codebook_index++] = i;

    } else {

        codebook_index = 0xF00 * 8;

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

            for (j = 0; j < 8; j++)

                s->codebook[codebook_index++] = i;


    s->next_codebook_buffer_index = 0;



    /* allocate decode buffer */

    s->decode_buffer_size = (s->width / s->vector_width) *

        (s->height / s->vector_height) * 2;

    s->decode_buffer = av_malloc(s->decode_buffer_size);



    s->frame.data[0] = NULL;



    return 0;

static int vqa_decode_init(AVCodecContext *avctx)

{

    VqaContext *s = (VqaContext *)avctx->priv_data;

    unsigned char *vqa_header;

    int i, j, codebook_index;;



    s->avctx = avctx;

    avctx->pix_fmt = PIX_FMT_PAL8;

    avctx->has_b_frames = 0;

    dsputil_init(&s->dsp, avctx);



    

    if (s->avctx->extradata_size != VQA_HEADER_SIZE) {

        av_log(s->avctx, AV_LOG_ERROR, "  VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);





    

    vqa_header = (unsigned char *)s->avctx->extradata;

    s->vqa_version = vqa_header[0];

    s->width = LE_16(&vqa_header[6]);

    s->height = LE_16(&vqa_header[8]);





    s->vector_width = vqa_header[10];

    s->vector_height = vqa_header[11];

    s->partial_count = s->partial_countdown = vqa_header[13];



    

    if ((s->vector_width != 4) ||

        ((s->vector_height != 2) && (s->vector_height != 4))) {

        





    

    s->codebook_size = MAX_CODEBOOK_SIZE;

    s->codebook = av_malloc(s->codebook_size);

    s->next_codebook_buffer = av_malloc(s->codebook_size);



    

    if (s->vector_height == 4) {

        codebook_index = 0xFF00 * 16;

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

            for (j = 0; j < 16; j++)

                s->codebook[codebook_index++] = i;

    } else {

        codebook_index = 0xF00 * 8;

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

            for (j = 0; j < 8; j++)

                s->codebook[codebook_index++] = i;


    s->next_codebook_buffer_index = 0;



    

    s->decode_buffer_size = (s->width / s->vector_width) *

        (s->height / s->vector_height) * 2;

    s->decode_buffer = av_malloc(s->decode_buffer_size);



    s->frame.data[0] = NULL;



    return 0;

    dsputil_init(&s->dsp, avctx);
static int FUNC_0(AVCodecContext *VAR_0)

{

    VqaContext *s = (VqaContext *)VAR_0->priv_data;

    unsigned char *VAR_1;

    int VAR_2, VAR_3, VAR_4;;



    s->VAR_0 = VAR_0;

    VAR_0->pix_fmt = PIX_FMT_PAL8;

    VAR_0->has_b_frames = 0;

    dsputil_init(&s->dsp, VAR_0);



    

    if (s->VAR_0->extradata_size != VQA_HEADER_SIZE) {

        av_log(s->VAR_0, AV_LOG_ERROR, "  VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);





    

    VAR_1 = (unsigned char *)s->VAR_0->extradata;

    s->vqa_version = VAR_1[0];

    s->width = LE_16(&VAR_1[6]);

    s->height = LE_16(&VAR_1[8]);





    s->vector_width = VAR_1[10];

    s->vector_height = VAR_1[11];

    s->partial_count = s->partial_countdown = VAR_1[13];



    

    if ((s->vector_width != 4) ||

        ((s->vector_height != 2) && (s->vector_height != 4))) {

        





    

    s->codebook_size = MAX_CODEBOOK_SIZE;

    s->codebook = av_malloc(s->codebook_size);

    s->next_codebook_buffer = av_malloc(s->codebook_size);



    

    if (s->vector_height == 4) {

        VAR_4 = 0xFF00 * 16;

        for (VAR_2 = 0; VAR_2 < 256; VAR_2++)

            for (VAR_3 = 0; VAR_3 < 16; VAR_3++)

                s->codebook[VAR_4++] = VAR_2;

    } else {

        VAR_4 = 0xF00 * 8;

        for (VAR_2 = 0; VAR_2 < 256; VAR_2++)

            for (VAR_3 = 0; VAR_3 < 8; VAR_3++)

                s->codebook[VAR_4++] = VAR_2;


    s->next_codebook_buffer_index = 0;



    

    s->decode_buffer_size = (s->width / s->vector_width) *

        (s->height / s->vector_height) * 2;

    s->decode_buffer = av_malloc(s->decode_buffer_size);



    s->frame.data[0] = NULL;



    return 0;

static int FUNC_0(AVCodecContext *VAR_0)
{ VqaContext *s = (VqaContext *)VAR_0->priv_data; unsigned char *VAR_1; int VAR_2, VAR_3, VAR_4;; s->VAR_0 = VAR_0; VAR_0->pix_fmt = PIX_FMT_PAL8; VAR_0->has_b_frames = 0; dsputil_init(&s->dsp, VAR_0); if (s->VAR_0->extradata_size != VQA_HEADER_SIZE) { av_log(s->VAR_0, AV_LOG_ERROR, "  VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE); VAR_1 = (unsigned char *)s->VAR_0->extradata; s->vqa_version = VAR_1[0]; s->width = LE_16(&VAR_1[6]); s->height = LE_16(&VAR_1[8]); s->vector_width = VAR_1[10]; s->vector_height = VAR_1[11]; s->partial_count = s->partial_countdown = VAR_1[13]; if ((s->vector_width != 4) ||
((s->vector_height != 2) && (s->vector_height != 4))) { s->codebook_size = MAX_CODEBOOK_SIZE; s->codebook = av_malloc(s->codebook_size); s->next_codebook_buffer = av_malloc(s->codebook_size); if (s->vector_height == 4) { VAR_4 = 0xFF00 * 16; for (VAR_2 = 0; VAR_2 < 256; VAR_2++) for (VAR_3 = 0; VAR_3 < 16; VAR_3++) s->codebook[VAR_4++] = VAR_2; } else { VAR_4 = 0xF00 * 8; for (VAR_2 = 0; VAR_2 < 256; VAR_2++) for (VAR_3 = 0; VAR_3 < 8; VAR_3++) s->codebook[VAR_4++] = VAR_2; s->next_codebook_buffer_index = 0; s->decode_buffer_size = (s->width / s->vector_width) *
(s->height / s->vector_height) * 2; s->decode_buffer = av_malloc(s->decode_buffer_size); s->frame.data[0] = NULL; return 0;