Esempio n. 1
0
    lg_Void_t lg_gte_apperture( 

        li_C8_t           * const lgeBitmap,
        lg_Size_t   const         lgeWidth,
        lg_Size_t   const         lgeHeight,
        lg_Size_t   const         lgeLayers,
        li_C8_t     const * const lgrBitmap,
        lg_Size_t   const         lgrWidth,
        lg_Size_t   const         lgrHeight,
        lg_Size_t   const         lgrLayers, 
        lg_Real_t   const         lgAzim,
        lg_Real_t   const         lgElev,
        lg_Real_t   const         lgRoll,
        lg_Real_t   const         lgApper,
        li_Method_t const         lgInter

    ) { lg_gte_apperturep(

        lgeBitmap,
        lgeWidth,
        lgeHeight,
        lgeLayers,
        lgrBitmap,
        lgrWidth,
        lgrHeight,
        lgrLayers, 
        lgAzim,
        lgElev,
        lgRoll,
        lgApper,
        lgInter,
        lg_Size_s( 1 )

    ); }
    lg_Void_t lg_gtt_generic_point(

        lg_Real_t       * const lgePointX,
        lg_Real_t       * const lgePointY,
        lg_Real_t const         lgrPointX,
        lg_Real_t const         lgrPointY,
        lg_Real_t const         lgrSightX,
        lg_Real_t const         lgrSightY,
        lg_Size_t const         lgmWidth,
        lg_Size_t const         lgmHeight,
        lg_Size_t const         lgmCornerX,
        lg_Size_t const         lgmCornerY,
        lg_Real_t const         lgAzim,
        lg_Real_t const         lgElev,
        lg_Real_t const         lgRoll,
        lg_Real_t const         lgFocal,
        lg_Real_t const         lgPixel

    ) {

         /* Matrix array variables */
        lg_Real_t lgMat[3][3] = { { lg_Real_s( 0.0 ) } };

        /* Position arrays variables */
        lg_Real_t lgPvi[3] = { lg_Real_s( 0.0 ) };
        lg_Real_t lgPvf[3] = { lg_Real_s( 0.0 ) };

        /* Compute rotation matrix */
        lg_algebra_r2erotation( lgMat, lgAzim, lgElev, lgRoll );

        /* Compute pixel position in 3d-frame */
        lgPvi[0] = lgFocal;
        lgPvi[1] = lgPixel * ( lgrPointX - lgrSightX );
        lgPvi[2] = lgPixel * ( lgrPointY - lgrSightY );

        /* Compute rotated pixel position in 3d-frame */
        lgPvf[0] = lgMat[0][0] * lgPvi[0] + lgMat[0][1] * lgPvi[1] + lgMat[0][2] * lgPvi[2];
        lgPvf[1] = lgMat[1][0] * lgPvi[0] + lgMat[1][1] * lgPvi[1] + lgMat[1][2] * lgPvi[2];
        lgPvf[2] = lgMat[2][0] * lgPvi[0] + lgMat[2][1] * lgPvi[1] + lgMat[2][2] * lgPvi[2];

        /* Retrieve mapping pixel (x,y)-coordinates */
        ( * lgePointX ) = - lgmCornerX + ( lgmWidth  - lg_Size_s( 1 ) ) * ( LG_ATN( lgPvf[0], lgPvf[1] ) / LG_PI2 ) ;
        ( * lgePointY ) = - lgmCornerY + ( lgmHeight - lg_Size_s( 1 ) ) * ( LG_ASN( lgPvf[2] / LG_EUCLR3( lgPvf ) ) / LG_PI + lg_Real_s( 0.5 ) );

    }
    lg_Void_t lg_gtt_elphel(

        li_C8_t           * const lgeBitmap,
        lg_Size_t   const         lgeWidth,
        lg_Size_t   const         lgeHeight,
        lg_Size_t   const         lgeLayers,
        li_C8_t     const * const lgrBitmap,
        lg_Size_t   const         lgrWidth,
        lg_Size_t   const         lgrHeight,
        lg_Size_t   const         lgrLayers,
        lg_Real_t   const         lgrSightX,
        lg_Real_t   const         lgrSightY,
        lg_Size_t   const         lgmWidth,
        lg_Size_t   const         lgmHeight,
        lg_Size_t   const         lgmCornerX,
        lg_Size_t   const         lgmCornerY,
        lg_Real_t   const         lgRoll,
        lg_Real_t   const         lgAzim,
        lg_Real_t   const         lgElev,
        lg_Real_t   const         lgHead,
        lg_Real_t   const         lgPixel,
        lg_Real_t   const         lgFocal,
        li_Method_t const         lgInter

    ) { lg_gtt_elphelp(

        lgeBitmap,
        lgeWidth,
        lgeHeight,
        lgeLayers,
        lgrBitmap,
        lgrWidth,
        lgrHeight,
        lgrLayers,
        lgrSightX,
        lgrSightY,
        lgmWidth,
        lgmHeight,
        lgmCornerX,
        lgmCornerY,
        lgRoll,
        lgAzim,
        lgElev,
        lgHead,
        lgPixel,
        lgFocal,
        lgInter,
        lg_Size_s( 1 )

    ); }
    lg_Void_t lg_gtt_genericp_f(

        float            * const lgeBitmap,
        lg_Size_t   const         lgeWidth,
        lg_Size_t   const         lgeHeight,
        lg_Size_t   const         lgeLayers,
        float       const * const lgrBitmap,
        lg_Size_t   const         lgrWidth,
        lg_Size_t   const         lgrHeight,
        lg_Size_t   const         lgrLayers,
        lg_Real_t   const         lgrSightX,
        lg_Real_t   const         lgrSightY,
        lg_Size_t   const         lgmWidth,
        lg_Size_t   const         lgmHeight,
        lg_Size_t   const         lgmCornerX,
        lg_Size_t   const         lgmCornerY,
        lg_Real_t   const         lgAzim,
        lg_Real_t   const         lgElev,
        lg_Real_t   const         lgRoll,
        lg_Real_t   const         lgFocal,
        lg_Real_t   const         lgPixel,
        li_Method_tf const         lgInter,
        lg_Size_t   const         lgThread

    ) {

        /* Coordinates variables */
        lg_Size_t lgDX = lg_Size_s( 0   );
        lg_Size_t lgDY = lg_Size_s( 0   );
        lg_Real_t lgSX = lg_Real_s( 0.0 );
        lg_Real_t lgSY = lg_Real_s( 0.0 );

        /* Position vector variables */
        lg_Real_t lgPvi[3] = { lg_Real_s( 0.0 ) };
        lg_Real_t lgPvf[3] = { lg_Real_s( 0.0 ) };

        /* Rotation matrix variables */
        lg_Real_t lgMat[3][3] = { { lg_Real_s( 0.0 ) } };

        /* Optimization variables */
        lg_Size_t lgmEdgeX = lgmWidth  - lg_Size_s( 1 );
        lg_Size_t lgmEdgeY = lgmHeight - lg_Size_s( 1 );

        /* Transparency variables */
        lg_Real_t lgWeiA = lg_Real_s( 0.0 );
        lg_Real_t lgWeiB = lg_Real_s( 0.0 );

        /* Alpha channel variables */
        li_C8_t lgAlpha = li_C8_s( 0 );

        /* Bitmap padding variable */
        lg_Size_t lgePad = LG_B4PAD( lgeWidth * lgeLayers );

        /* Compute rotation matrix */
        lg_algebra_e2rrotation( lgMat, lgAzim, lgElev, lgRoll );

        /* Rectilinear pixels y-loop */
        # ifdef __OPENMP__
        # pragma omp parallel private(lgDX,lgDY,lgSX,lgSY,lgPvi,lgPvf,lgAlpha,lgWeiA,lgWeiB) firstprivate(lgmEdgeX,lgmEdgeY,lgePad,lgMat) num_threads( lgThread )
        {
        # pragma omp for
        # endif
        for ( lgDY = lg_Size_s( 0 ); lgDY < lgeHeight; lgDY ++ ) {

            /* Rectilinear pixels x-loop */
            for ( lgDX = lg_Size_s( 0 ); lgDX < lgeWidth; lgDX ++ ) {

                /* Compute mapping pixel angular coordinates */
                lgSX = + ( ( lg_Real_c( lgDX + lgmCornerX ) / lgmEdgeX ) * LG_PI2 );
                lgSY = + ( ( lg_Real_c( lgDY + lgmCornerY ) / lgmEdgeY ) - lg_Real_s( 0.5 ) ) * LG_PI;

                /* Compute pixel position in 3d-frame */
                lgPvi[0] = cos( lgSY );
                lgPvi[1] = lgPvi[0] * sin( lgSX );
                lgPvi[0] = lgPvi[0] * cos( lgSX );
                lgPvi[2] = sin( lgSY );

                /* Compute rotated pixel position in 3d-frame */
                lgPvf[0] = lgMat[0][0] * lgPvi[0] + lgMat[0][1] * lgPvi[1] + lgMat[0][2] * lgPvi[2];

                /* Positivity of x-axis check */
                if ( lgPvf[0] > lg_Real_s( 0.0 ) ) {

                    /* Compute rotated pixel position in 3d-frame */
                    lgPvf[1] = lgMat[1][0] * lgPvi[0] + lgMat[1][1] * lgPvi[1] + lgMat[1][2] * lgPvi[2];
                    lgPvf[2] = lgMat[2][0] * lgPvi[0] + lgMat[2][1] * lgPvi[1] + lgMat[2][2] * lgPvi[2];

                    /* Retrieve rectilinear (x,y)-coordinates */
                    lgSX = + ( ( lgPvf[1] / lgPvf[0] ) * lgFocal ) / lgPixel + lgrSightX;
                    lgSY = + ( ( lgPvf[2] / lgPvf[0] ) * lgFocal ) / lgPixel + lgrSightY;

                    /* Verify coordinates range */
                    if ( ( lgSX >= lg_Real_s( 0.0 ) ) && ( lgSY >= lg_Real_s( 0.0 ) ) && ( lgSX < lgrWidth ) && ( lgSY < lgrHeight ) ) {

                        /* Transparency management */
                        if ( lgrLayers == lg_Size_s( 4 ) ) {

                            /* Obtain alpha value and compute direct transparency weight */
                            lgAlpha = lgInter( ( float * ) lgrBitmap, lgrWidth, lgrHeight, lgrLayers, lg_Size_s( 3 ), lgSX, lgSY );

                            /* Compute transparency weights */
                            lgWeiA = lg_Real_c( lgAlpha ) / lg_Real_s( 255.0 );
                            lgWeiB = lg_Real_s( 1.0 ) - lgWeiA;

                            /* Assign interpolated pixel */
                            LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 0 ) ) = lgInter( 

                                ( float * ) lgrBitmap, 
                                lgrWidth, 
                                lgrHeight, 
                                lgrLayers, 
                                lg_Size_s( 0 ), 
                                lgSX, 
                                lgSY 

                            ) * lgWeiA + LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 0 ) ) * lgWeiB;

                            /* Assign interpolated pixel */
                            LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 1 ) ) = lgInter( 

                                ( float * ) lgrBitmap, 
                                lgrWidth, 
                                lgrHeight, 
                                lgrLayers, 
                                lg_Size_s( 1 ), 
                                lgSX, 
                                lgSY 

                            ) * lgWeiA + LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 1 ) ) * lgWeiB;

                            /* Assign interpolated pixel */
                            LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 2 ) ) = lgInter( 

                                ( float * ) lgrBitmap, 
                                lgrWidth, 
                                lgrHeight, 
                                lgrLayers, 
                                lg_Size_s( 2 ), 
                                lgSX, 
                                lgSY 

                            ) * lgWeiA + LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 2 ) ) * lgWeiB;

                            /* Assign transparency pixel */
                            if ( lgeLayers == 4 ) LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 3 ) ) = lgAlpha;

                        } else {

                            /* Assign interpolated pixel */
                            LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 0 ) ) = lgInter( 

                                ( float * ) lgrBitmap, 
                                lgrWidth, 
                                lgrHeight, 
                                lgrLayers, 
                                lg_Size_s( 0 ), 
                                lgSX, 
                                lgSY 

                            );

                            /* Assign interpolated pixel */
                            LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 1 ) ) = lgInter( 

                                ( float * ) lgrBitmap, 
                                lgrWidth, 
                                lgrHeight, 
                                lgrLayers, 
                                lg_Size_s( 1 ), 
                                lgSX, 
                                lgSY 

                            );

                            /* Assign interpolated pixel */
                            LG_B4( lgeBitmap, lgePad, lgeLayers, lgDX, lgDY, lg_Size_s( 2 ) ) = lgInter( 

                                ( float * ) lgrBitmap, 
                                lgrWidth, 
                                lgrHeight, 
                                lgrLayers, 
                                lg_Size_s( 2 ), 
                                lgSX, 
                                lgSY 

                            );

                        }

                    }

                }

            }

        }

        # ifdef __OPENMP__
        }
        # endif 

    }