static void generate_codebook(RoqContext *enc, RoqTempdata *tempdata,

                              int *points, int inputCount, roq_cell *results,

                              int size, int cbsize)

{

    int i, j, k;

    int c_size = size*size/4;

    int *buf;

    int *codebook = av_malloc(6*c_size*cbsize*sizeof(int));

    int *closest_cb;



    if (size == 4)

        closest_cb = av_malloc(6*c_size*inputCount*sizeof(int));

    else

        closest_cb = tempdata->closest_cb2;



    ff_init_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx);

    ff_do_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx);



    if (size == 4)

        av_free(closest_cb);



    buf = codebook;

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

        for (k=0; k<c_size; k++) {

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

                results->y[j] = *buf++;



            results->u =    (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS;

            results->v =    (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS;

            results++;

        }



    av_free(codebook);

}

static void generate_codebook(RoqContext *enc, RoqTempdata *tempdata,

                              int *points, int inputCount, roq_cell *results,

                              int size, int cbsize)

{

    int i, j, k;

    int c_size = size*size/4;

    int *buf;

    int *codebook = av_malloc(6*c_size*cbsize*sizeof(int));

    int *closest_cb;



    if (size == 4)

        closest_cb = av_malloc(6*c_size*inputCount*sizeof(int));

    else

        closest_cb = tempdata->closest_cb2;



    ff_init_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx);

    ff_do_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx);



    if (size == 4)

        av_free(closest_cb);



    buf = codebook;

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

        for (k=0; k<c_size; k++) {

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

                results->y[j] = *buf++;



            results->u =    (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS;

            results->v =    (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS;

            results++;

        }



    av_free(codebook);

}

static void FUNC_0(RoqContext *VAR_0, RoqTempdata *VAR_1,

                              int *VAR_2, int VAR_3, roq_cell *VAR_4,

                              int VAR_5, int VAR_6)

{

    int VAR_7, VAR_8, VAR_9;

    int VAR_10 = VAR_5*VAR_5/4;

    int *VAR_11;

    int *VAR_12 = av_malloc(6*VAR_10*VAR_6*sizeof(int));

    int *VAR_13;



    if (VAR_5 == 4)

        VAR_13 = av_malloc(6*VAR_10*VAR_3*sizeof(int));

    else

        VAR_13 = VAR_1->closest_cb2;



    ff_init_elbg(VAR_2, 6*VAR_10, VAR_3, VAR_12, VAR_6, 1, VAR_13, &VAR_0->randctx);

    ff_do_elbg(VAR_2, 6*VAR_10, VAR_3, VAR_12, VAR_6, 1, VAR_13, &VAR_0->randctx);



    if (VAR_5 == 4)

        av_free(VAR_13);



    VAR_11 = VAR_12;

    for (VAR_7=0; VAR_7<VAR_6; VAR_7++)

        for (VAR_9=0; VAR_9<VAR_10; VAR_9++) {

            for(VAR_8=0; VAR_8<4; VAR_8++)

                VAR_4->y[VAR_8] = *VAR_11++;



            VAR_4->u =    (*VAR_11++ + CHROMA_BIAS/2)/CHROMA_BIAS;

            VAR_4->v =    (*VAR_11++ + CHROMA_BIAS/2)/CHROMA_BIAS;

            VAR_4++;

        }



    av_free(VAR_12);

}

static void FUNC_0(RoqContext *VAR_0, RoqTempdata *VAR_1,
int *VAR_2, int VAR_3, roq_cell *VAR_4,
int VAR_5, int VAR_6)
{ int VAR_7, VAR_8, VAR_9; int VAR_10 = VAR_5*VAR_5/4; int *VAR_11; int *VAR_12 = av_malloc(6*VAR_10*VAR_6*sizeof(int)); int *VAR_13; if (VAR_5 == 4)
VAR_13 = av_malloc(6*VAR_10*VAR_3*sizeof(int)); else
VAR_13 = VAR_1->closest_cb2; ff_init_elbg(VAR_2, 6*VAR_10, VAR_3, VAR_12, VAR_6, 1, VAR_13, &VAR_0->randctx); ff_do_elbg(VAR_2, 6*VAR_10, VAR_3, VAR_12, VAR_6, 1, VAR_13, &VAR_0->randctx); if (VAR_5 == 4)
av_free(VAR_13); VAR_11 = VAR_12; for (VAR_7=0; VAR_7<VAR_6; VAR_7++) for (VAR_9=0; VAR_9<VAR_10; VAR_9++) { for(VAR_8=0; VAR_8<4; VAR_8++) VAR_4->y[VAR_8] = *VAR_11++; VAR_4->u =    (*VAR_11++ + CHROMA_BIAS/2)/CHROMA_BIAS; VAR_4->v =    (*VAR_11++ + CHROMA_BIAS/2)/CHROMA_BIAS; VAR_4++; } av_free(VAR_12); }