void ff_init_vscale_pfn(SwsContext *c,

    yuv2planar1_fn yuv2plane1,

    yuv2planarX_fn yuv2planeX,

    yuv2interleavedX_fn yuv2nv12cX,

    yuv2packed1_fn yuv2packed1,

    yuv2packed2_fn yuv2packed2,

    yuv2packedX_fn yuv2packedX,

    yuv2anyX_fn yuv2anyX, int use_mmx)

{

    VScalerContext *lumCtx = NULL;

    VScalerContext *chrCtx = NULL;

    int idx = c->numDesc - (c->is_internal_gamma ? 2 : 1); //FIXME avoid hardcoding indexes



    if (isPlanarYUV(c->dstFormat) || (isGray(c->dstFormat) && !isALPHA(c->dstFormat))) {

        if (!isGray(c->dstFormat)) {

            chrCtx = c->desc[idx].instance;



            chrCtx->filter[0] = use_mmx ? (int16_t*)c->chrMmxFilter : c->vChrFilter;

            chrCtx->filter_size = c->vChrFilterSize;

            chrCtx->filter_pos = c->vChrFilterPos;

            chrCtx->isMMX = use_mmx;



            --idx;

            if (yuv2nv12cX)               chrCtx->pfn = yuv2nv12cX;

            else if (c->vChrFilterSize == 1) chrCtx->pfn = yuv2plane1;

            else                             chrCtx->pfn = yuv2planeX;

        }



        lumCtx = c->desc[idx].instance;



        lumCtx->filter[0] = use_mmx ? (int16_t*)c->lumMmxFilter : c->vLumFilter;

        lumCtx->filter[1] = use_mmx ? (int16_t*)c->alpMmxFilter : c->vLumFilter;

        lumCtx->filter_size = c->vLumFilterSize;

        lumCtx->filter_pos = c->vLumFilterPos;

        lumCtx->isMMX = use_mmx;



        if (c->vLumFilterSize == 1) lumCtx->pfn = yuv2plane1;

        else                        lumCtx->pfn = yuv2planeX;



    } else {

        lumCtx = c->desc[idx].instance;

        chrCtx = &lumCtx[1];



        lumCtx->filter[0] = c->vLumFilter;

        lumCtx->filter_size = c->vLumFilterSize;

        lumCtx->filter_pos = c->vLumFilterPos;



        chrCtx->filter[0] = c->vChrFilter;

        chrCtx->filter_size = c->vChrFilterSize;

        chrCtx->filter_pos = c->vChrFilterPos;



        lumCtx->isMMX = use_mmx;

        chrCtx->isMMX = use_mmx;



        if (yuv2packedX) {

            if (c->yuv2packed1 && c->vLumFilterSize == 1 && c->vChrFilterSize <= 2)

                lumCtx->pfn = yuv2packed1;

            else if (c->yuv2packed2 && c->vLumFilterSize == 2 && c->vChrFilterSize == 2)

                lumCtx->pfn = yuv2packed2;

            else

                lumCtx->pfn = yuv2packedX;

        } else

            lumCtx->pfn = yuv2anyX;

    }

}

void ff_init_vscale_pfn(SwsContext *c,

    yuv2planar1_fn yuv2plane1,

    yuv2planarX_fn yuv2planeX,

    yuv2interleavedX_fn yuv2nv12cX,

    yuv2packed1_fn yuv2packed1,

    yuv2packed2_fn yuv2packed2,

    yuv2packedX_fn yuv2packedX,

    yuv2anyX_fn yuv2anyX, int use_mmx)

{

    VScalerContext *lumCtx = NULL;

    VScalerContext *chrCtx = NULL;

    int idx = c->numDesc - (c->is_internal_gamma ? 2 : 1); 



    if (isPlanarYUV(c->dstFormat) || (isGray(c->dstFormat) && !isALPHA(c->dstFormat))) {

        if (!isGray(c->dstFormat)) {

            chrCtx = c->desc[idx].instance;



            chrCtx->filter[0] = use_mmx ? (int16_t*)c->chrMmxFilter : c->vChrFilter;

            chrCtx->filter_size = c->vChrFilterSize;

            chrCtx->filter_pos = c->vChrFilterPos;

            chrCtx->isMMX = use_mmx;



            --idx;

            if (yuv2nv12cX)               chrCtx->pfn = yuv2nv12cX;

            else if (c->vChrFilterSize == 1) chrCtx->pfn = yuv2plane1;

            else                             chrCtx->pfn = yuv2planeX;

        }



        lumCtx = c->desc[idx].instance;



        lumCtx->filter[0] = use_mmx ? (int16_t*)c->lumMmxFilter : c->vLumFilter;

        lumCtx->filter[1] = use_mmx ? (int16_t*)c->alpMmxFilter : c->vLumFilter;

        lumCtx->filter_size = c->vLumFilterSize;

        lumCtx->filter_pos = c->vLumFilterPos;

        lumCtx->isMMX = use_mmx;



        if (c->vLumFilterSize == 1) lumCtx->pfn = yuv2plane1;

        else                        lumCtx->pfn = yuv2planeX;



    } else {

        lumCtx = c->desc[idx].instance;

        chrCtx = &lumCtx[1];



        lumCtx->filter[0] = c->vLumFilter;

        lumCtx->filter_size = c->vLumFilterSize;

        lumCtx->filter_pos = c->vLumFilterPos;



        chrCtx->filter[0] = c->vChrFilter;

        chrCtx->filter_size = c->vChrFilterSize;

        chrCtx->filter_pos = c->vChrFilterPos;



        lumCtx->isMMX = use_mmx;

        chrCtx->isMMX = use_mmx;



        if (yuv2packedX) {

            if (c->yuv2packed1 && c->vLumFilterSize == 1 && c->vChrFilterSize <= 2)

                lumCtx->pfn = yuv2packed1;

            else if (c->yuv2packed2 && c->vLumFilterSize == 2 && c->vChrFilterSize == 2)

                lumCtx->pfn = yuv2packed2;

            else

                lumCtx->pfn = yuv2packedX;

        } else

            lumCtx->pfn = yuv2anyX;

    }

}

void FUNC_0(SwsContext *VAR_0,

    yuv2planar1_fn VAR_1,

    yuv2planarX_fn VAR_2,

    yuv2interleavedX_fn VAR_3,

    yuv2packed1_fn VAR_4,

    yuv2packed2_fn VAR_5,

    yuv2packedX_fn VAR_6,

    yuv2anyX_fn VAR_7, int VAR_8)

{

    VScalerContext *lumCtx = NULL;

    VScalerContext *chrCtx = NULL;

    int VAR_9 = VAR_0->numDesc - (VAR_0->is_internal_gamma ? 2 : 1); 



    if (isPlanarYUV(VAR_0->dstFormat) || (isGray(VAR_0->dstFormat) && !isALPHA(VAR_0->dstFormat))) {

        if (!isGray(VAR_0->dstFormat)) {

            chrCtx = VAR_0->desc[VAR_9].instance;



            chrCtx->filter[0] = VAR_8 ? (int16_t*)VAR_0->chrMmxFilter : VAR_0->vChrFilter;

            chrCtx->filter_size = VAR_0->vChrFilterSize;

            chrCtx->filter_pos = VAR_0->vChrFilterPos;

            chrCtx->isMMX = VAR_8;



            --VAR_9;

            if (VAR_3)               chrCtx->pfn = VAR_3;

            else if (VAR_0->vChrFilterSize == 1) chrCtx->pfn = VAR_1;

            else                             chrCtx->pfn = VAR_2;

        }



        lumCtx = VAR_0->desc[VAR_9].instance;



        lumCtx->filter[0] = VAR_8 ? (int16_t*)VAR_0->lumMmxFilter : VAR_0->vLumFilter;

        lumCtx->filter[1] = VAR_8 ? (int16_t*)VAR_0->alpMmxFilter : VAR_0->vLumFilter;

        lumCtx->filter_size = VAR_0->vLumFilterSize;

        lumCtx->filter_pos = VAR_0->vLumFilterPos;

        lumCtx->isMMX = VAR_8;



        if (VAR_0->vLumFilterSize == 1) lumCtx->pfn = VAR_1;

        else                        lumCtx->pfn = VAR_2;



    } else {

        lumCtx = VAR_0->desc[VAR_9].instance;

        chrCtx = &lumCtx[1];



        lumCtx->filter[0] = VAR_0->vLumFilter;

        lumCtx->filter_size = VAR_0->vLumFilterSize;

        lumCtx->filter_pos = VAR_0->vLumFilterPos;



        chrCtx->filter[0] = VAR_0->vChrFilter;

        chrCtx->filter_size = VAR_0->vChrFilterSize;

        chrCtx->filter_pos = VAR_0->vChrFilterPos;



        lumCtx->isMMX = VAR_8;

        chrCtx->isMMX = VAR_8;



        if (VAR_6) {

            if (VAR_0->VAR_4 && VAR_0->vLumFilterSize == 1 && VAR_0->vChrFilterSize <= 2)

                lumCtx->pfn = VAR_4;

            else if (VAR_0->VAR_5 && VAR_0->vLumFilterSize == 2 && VAR_0->vChrFilterSize == 2)

                lumCtx->pfn = VAR_5;

            else

                lumCtx->pfn = VAR_6;

        } else

            lumCtx->pfn = VAR_7;

    }

}

void FUNC_0(SwsContext *VAR_0,
yuv2planar1_fn VAR_1,
yuv2planarX_fn VAR_2,
yuv2interleavedX_fn VAR_3,
yuv2packed1_fn VAR_4,
yuv2packed2_fn VAR_5,
yuv2packedX_fn VAR_6,
yuv2anyX_fn VAR_7, int VAR_8)
{ VScalerContext *lumCtx = NULL; VScalerContext *chrCtx = NULL; int VAR_9 = VAR_0->numDesc - (VAR_0->is_internal_gamma ? 2 : 1); if (isPlanarYUV(VAR_0->dstFormat) || (isGray(VAR_0->dstFormat) && !isALPHA(VAR_0->dstFormat))) { if (!isGray(VAR_0->dstFormat)) { chrCtx = VAR_0->desc[VAR_9].instance; chrCtx->filter[0] = VAR_8 ? (int16_t*)VAR_0->chrMmxFilter : VAR_0->vChrFilter; chrCtx->filter_size = VAR_0->vChrFilterSize; chrCtx->filter_pos = VAR_0->vChrFilterPos; chrCtx->isMMX = VAR_8; --VAR_9; if (VAR_3)               chrCtx->pfn = VAR_3; else if (VAR_0->vChrFilterSize == 1) chrCtx->pfn = VAR_1; else                             chrCtx->pfn = VAR_2; } lumCtx = VAR_0->desc[VAR_9].instance; lumCtx->filter[0] = VAR_8 ? (int16_t*)VAR_0->lumMmxFilter : VAR_0->vLumFilter; lumCtx->filter[1] = VAR_8 ? (int16_t*)VAR_0->alpMmxFilter : VAR_0->vLumFilter; lumCtx->filter_size = VAR_0->vLumFilterSize; lumCtx->filter_pos = VAR_0->vLumFilterPos; lumCtx->isMMX = VAR_8; if (VAR_0->vLumFilterSize == 1) lumCtx->pfn = VAR_1; else                        lumCtx->pfn = VAR_2; } else { lumCtx = VAR_0->desc[VAR_9].instance; chrCtx = &lumCtx[1]; lumCtx->filter[0] = VAR_0->vLumFilter; lumCtx->filter_size = VAR_0->vLumFilterSize; lumCtx->filter_pos = VAR_0->vLumFilterPos; chrCtx->filter[0] = VAR_0->vChrFilter; chrCtx->filter_size = VAR_0->vChrFilterSize; chrCtx->filter_pos = VAR_0->vChrFilterPos; lumCtx->isMMX = VAR_8; chrCtx->isMMX = VAR_8; if (VAR_6) { if (VAR_0->VAR_4 && VAR_0->vLumFilterSize == 1 && VAR_0->vChrFilterSize <= 2)
lumCtx->pfn = VAR_4; else if (VAR_0->VAR_5 && VAR_0->vLumFilterSize == 2 && VAR_0->vChrFilterSize == 2)
lumCtx->pfn = VAR_5; else
lumCtx->pfn = VAR_6; } else lumCtx->pfn = VAR_7; } }