int DCT_common_init(MpegEncContext *s)

{

    int i;



    ff_put_pixels_clamped = s->dsp.put_pixels_clamped;

    ff_add_pixels_clamped = s->dsp.add_pixels_clamped;



    s->dct_unquantize_h263 = dct_unquantize_h263_c;

    s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c;

    s->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c;

    s->dct_quantize= dct_quantize_c;



    if(s->avctx->dct_algo==FF_DCT_FASTINT)

        s->fdct = fdct_ifast;

    else

        s->fdct = ff_jpeg_fdct_islow; //slow/accurate/default



    if(s->avctx->idct_algo==FF_IDCT_INT){

        s->idct_put= ff_jref_idct_put;

        s->idct_add= ff_jref_idct_add;

        s->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;

    }else{ //accurate/default

        s->idct_put= simple_idct_put;

        s->idct_add= simple_idct_add;

        s->idct_permutation_type= FF_NO_IDCT_PERM;

    }

        

#ifdef HAVE_MMX

    MPV_common_init_mmx(s);

#endif

#ifdef ARCH_ALPHA

    MPV_common_init_axp(s);

#endif

#ifdef HAVE_MLIB

    MPV_common_init_mlib(s);

#endif

#ifdef HAVE_MMI

    MPV_common_init_mmi(s);

#endif

#ifdef ARCH_ARMV4L

    MPV_common_init_armv4l();

#endif

#ifdef ARCH_POWERPC

    MPV_common_init_ppc(s);

#endif



    switch(s->idct_permutation_type){

    case FF_NO_IDCT_PERM:

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

            s->idct_permutation[i]= i;

        break;

    case FF_LIBMPEG2_IDCT_PERM:

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

            s->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);

        break;

    case FF_SIMPLE_IDCT_PERM:

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

            s->idct_permutation[i]= simple_mmx_permutation[i];

        break;

    case FF_TRANSPOSE_IDCT_PERM:

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

            s->idct_permutation[i]= ((i&7)<<3) | (i>>3);

        break;

    default:

        fprintf(stderr, "Internal error, IDCT permutation not set\n");

        return -1;

    }





    /* load & permutate scantables

       note: only wmv uses differnt ones 

    */

    ff_init_scantable(s, &s->inter_scantable  , ff_zigzag_direct);

    ff_init_scantable(s, &s->intra_scantable  , ff_zigzag_direct);

    ff_init_scantable(s, &s->intra_h_scantable, ff_alternate_horizontal_scan);

    ff_init_scantable(s, &s->intra_v_scantable, ff_alternate_vertical_scan);



    return 0;

}

int DCT_common_init(MpegEncContext *s)

{

    int i;



    ff_put_pixels_clamped = s->dsp.put_pixels_clamped;

    ff_add_pixels_clamped = s->dsp.add_pixels_clamped;



    s->dct_unquantize_h263 = dct_unquantize_h263_c;

    s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c;

    s->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c;

    s->dct_quantize= dct_quantize_c;



    if(s->avctx->dct_algo==FF_DCT_FASTINT)

        s->fdct = fdct_ifast;

    else

        s->fdct = ff_jpeg_fdct_islow; 



    if(s->avctx->idct_algo==FF_IDCT_INT){

        s->idct_put= ff_jref_idct_put;

        s->idct_add= ff_jref_idct_add;

        s->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;

    }else{ 

        s->idct_put= simple_idct_put;

        s->idct_add= simple_idct_add;

        s->idct_permutation_type= FF_NO_IDCT_PERM;

    }

        

#ifdef HAVE_MMX

    MPV_common_init_mmx(s);

#endif

#ifdef ARCH_ALPHA

    MPV_common_init_axp(s);

#endif

#ifdef HAVE_MLIB

    MPV_common_init_mlib(s);

#endif

#ifdef HAVE_MMI

    MPV_common_init_mmi(s);

#endif

#ifdef ARCH_ARMV4L

    MPV_common_init_armv4l();

#endif

#ifdef ARCH_POWERPC

    MPV_common_init_ppc(s);

#endif



    switch(s->idct_permutation_type){

    case FF_NO_IDCT_PERM:

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

            s->idct_permutation[i]= i;

        break;

    case FF_LIBMPEG2_IDCT_PERM:

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

            s->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);

        break;

    case FF_SIMPLE_IDCT_PERM:

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

            s->idct_permutation[i]= simple_mmx_permutation[i];

        break;

    case FF_TRANSPOSE_IDCT_PERM:

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

            s->idct_permutation[i]= ((i&7)<<3) | (i>>3);

        break;

    default:

        fprintf(stderr, "Internal error, IDCT permutation not set\n");

        return -1;

    }





    





    ff_init_scantable(s, &s->inter_scantable  , ff_zigzag_direct);

    ff_init_scantable(s, &s->intra_scantable  , ff_zigzag_direct);

    ff_init_scantable(s, &s->intra_h_scantable, ff_alternate_horizontal_scan);

    ff_init_scantable(s, &s->intra_v_scantable, ff_alternate_vertical_scan);



    return 0;

}

int FUNC_0(MpegEncContext *VAR_0)

{

    int VAR_1;



    ff_put_pixels_clamped = VAR_0->dsp.put_pixels_clamped;

    ff_add_pixels_clamped = VAR_0->dsp.add_pixels_clamped;



    VAR_0->dct_unquantize_h263 = dct_unquantize_h263_c;

    VAR_0->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c;

    VAR_0->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c;

    VAR_0->dct_quantize= dct_quantize_c;



    if(VAR_0->avctx->dct_algo==FF_DCT_FASTINT)

        VAR_0->fdct = fdct_ifast;

    else

        VAR_0->fdct = ff_jpeg_fdct_islow; 



    if(VAR_0->avctx->idct_algo==FF_IDCT_INT){

        VAR_0->idct_put= ff_jref_idct_put;

        VAR_0->idct_add= ff_jref_idct_add;

        VAR_0->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;

    }else{ 

        VAR_0->idct_put= simple_idct_put;

        VAR_0->idct_add= simple_idct_add;

        VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;

    }

        

#ifdef HAVE_MMX

    MPV_common_init_mmx(VAR_0);

#endif

#ifdef ARCH_ALPHA

    MPV_common_init_axp(VAR_0);

#endif

#ifdef HAVE_MLIB

    MPV_common_init_mlib(VAR_0);

#endif

#ifdef HAVE_MMI

    MPV_common_init_mmi(VAR_0);

#endif

#ifdef ARCH_ARMV4L

    MPV_common_init_armv4l();

#endif

#ifdef ARCH_POWERPC

    MPV_common_init_ppc(VAR_0);

#endif



    switch(VAR_0->idct_permutation_type){

    case FF_NO_IDCT_PERM:

        for(VAR_1=0; VAR_1<64; VAR_1++)

            VAR_0->idct_permutation[VAR_1]= VAR_1;

        break;

    case FF_LIBMPEG2_IDCT_PERM:

        for(VAR_1=0; VAR_1<64; VAR_1++)

            VAR_0->idct_permutation[VAR_1]= (VAR_1 & 0x38) | ((VAR_1 & 6) >> 1) | ((VAR_1 & 1) << 2);

        break;

    case FF_SIMPLE_IDCT_PERM:

        for(VAR_1=0; VAR_1<64; VAR_1++)

            VAR_0->idct_permutation[VAR_1]= simple_mmx_permutation[VAR_1];

        break;

    case FF_TRANSPOSE_IDCT_PERM:

        for(VAR_1=0; VAR_1<64; VAR_1++)

            VAR_0->idct_permutation[VAR_1]= ((VAR_1&7)<<3) | (VAR_1>>3);

        break;

    default:

        fprintf(stderr, "Internal error, IDCT permutation not set\n");

        return -1;

    }





    





    ff_init_scantable(VAR_0, &VAR_0->inter_scantable  , ff_zigzag_direct);

    ff_init_scantable(VAR_0, &VAR_0->intra_scantable  , ff_zigzag_direct);

    ff_init_scantable(VAR_0, &VAR_0->intra_h_scantable, ff_alternate_horizontal_scan);

    ff_init_scantable(VAR_0, &VAR_0->intra_v_scantable, ff_alternate_vertical_scan);



    return 0;

}

int FUNC_0(MpegEncContext *VAR_0)
{ int VAR_1; ff_put_pixels_clamped = VAR_0->dsp.put_pixels_clamped; ff_add_pixels_clamped = VAR_0->dsp.add_pixels_clamped; VAR_0->dct_unquantize_h263 = dct_unquantize_h263_c; VAR_0->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c; VAR_0->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c; VAR_0->dct_quantize= dct_quantize_c; if(VAR_0->avctx->dct_algo==FF_DCT_FASTINT)
VAR_0->fdct = fdct_ifast; else
VAR_0->fdct = ff_jpeg_fdct_islow; if(VAR_0->avctx->idct_algo==FF_IDCT_INT){ VAR_0->idct_put= ff_jref_idct_put; VAR_0->idct_add= ff_jref_idct_add; VAR_0->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; }else{ VAR_0->idct_put= simple_idct_put; VAR_0->idct_add= simple_idct_add; VAR_0->idct_permutation_type= FF_NO_IDCT_PERM; } #ifdef HAVE_MMX
MPV_common_init_mmx(VAR_0); #endif
#ifdef ARCH_ALPHA
MPV_common_init_axp(VAR_0); #endif
#ifdef HAVE_MLIB
MPV_common_init_mlib(VAR_0); #endif
#ifdef HAVE_MMI
MPV_common_init_mmi(VAR_0); #endif
#ifdef ARCH_ARMV4L
MPV_common_init_armv4l(); #endif
#ifdef ARCH_POWERPC
MPV_common_init_ppc(VAR_0); #endif
switch(VAR_0->idct_permutation_type){ case FF_NO_IDCT_PERM:
for(VAR_1=0; VAR_1<64; VAR_1++) VAR_0->idct_permutation[VAR_1]= VAR_1; break; case FF_LIBMPEG2_IDCT_PERM:
for(VAR_1=0; VAR_1<64; VAR_1++) VAR_0->idct_permutation[VAR_1]= (VAR_1 & 0x38) | ((VAR_1 & 6) >> 1) | ((VAR_1 & 1) << 2); break; case FF_SIMPLE_IDCT_PERM:
for(VAR_1=0; VAR_1<64; VAR_1++) VAR_0->idct_permutation[VAR_1]= simple_mmx_permutation[VAR_1]; break; case FF_TRANSPOSE_IDCT_PERM:
for(VAR_1=0; VAR_1<64; VAR_1++) VAR_0->idct_permutation[VAR_1]= ((VAR_1&7)<<3) | (VAR_1>>3); break; default:
fprintf(stderr, "Internal error, IDCT permutation not set\n"); return -1; } ff_init_scantable(VAR_0, &VAR_0->inter_scantable  , ff_zigzag_direct); ff_init_scantable(VAR_0, &VAR_0->intra_scantable  , ff_zigzag_direct); ff_init_scantable(VAR_0, &VAR_0->intra_h_scantable, ff_alternate_horizontal_scan); ff_init_scantable(VAR_0, &VAR_0->intra_v_scantable, ff_alternate_vertical_scan); return 0; }