Adjust the MVP Matrix to rotate and crop the texture
to make vertical video appear upright
189846
public void adjustForVerticalVideo(SCREEN_ROTATION orientation, boolean scaleToFit) {
        synchronized (mDrawLock) {
            mCorrectVerticalVideo = true;
            mScaleToFit = scaleToFit;
            requestedOrientation = orientation;
            Matrix.setIdentityM(IDENTITY_MATRIX, 0);
            switch (orientation) {
                case VERTICAL:
                    if (scaleToFit) {
                        Matrix.rotateM(IDENTITY_MATRIX, 0, -90, 0f, 0f, 1f);
                        Matrix.scaleM(IDENTITY_MATRIX, 0, 3.16f, 1.0f, 1f);
                    } else {
                        Matrix.scaleM(IDENTITY_MATRIX, 0, 0.316f, 1f, 1f);
                    }
                    break;
                case UPSIDEDOWN_LANDSCAPE:
                    if (scaleToFit) {
                        Matrix.rotateM(IDENTITY_MATRIX, 0, -180, 0f, 0f, 1f);
                    }
                    break;
                case UPSIDEDOWN_VERTICAL:
                    if (scaleToFit) {
                        Matrix.rotateM(IDENTITY_MATRIX, 0, 90, 0f, 0f, 1f);
                        Matrix.scaleM(IDENTITY_MATRIX, 0, 3.16f, 1.0f, 1f);
                    } else {
                        Matrix.scaleM(IDENTITY_MATRIX, 0, 0.316f, 1f, 1f);
                    }
                    break;
            }
        }
    }
821722
public static void rotateCW( InterleavedS64 input , InterleavedS64 output ) {
		if( input.width != output.height || input.height != output.width || input.numBands != output.numBands )
			throw new IllegalArgumentException("Incompatible shapes");

		int h = input.height-1;

		for( int y = 0; y < input.height; y++ ) {
			int indexSrc = input.startIndex + y*input.stride;
			for (int x = 0; x < input.width; x++) {
				int indexDst = output.getIndex(h-y,x);

				int end = indexSrc + input.numBands;
				while( indexSrc != end ) {
					output.data[indexDst++] = input.data[indexSrc++];
				}
			}
		}
	}
127357
protected void adjustRectangle( Rectangle2D_F64 rect , ScaleTranslate2D motion ) {
		rect.p0.x = rect.p0.x*motion.scale + motion.transX;
		rect.p0.y = rect.p0.y*motion.scale + motion.transY;
		rect.p1.x = rect.p1.x*motion.scale + motion.transX;
		rect.p1.y = rect.p1.y*motion.scale + motion.transY;
	}
33747
def rotated(self, angle_degrees_ccw):
        """"""
        angle = angle_degrees_ccw / 180.0 * pi
        c, s = cos(angle), sin(angle)
        return self @ PdfMatrix((c, s, -s, c, 0, 0))
402452
public static void vertical(Kernel1D_S32 kernel, GrayS16 src, GrayI16 dst ) {
		InputSanityCheck.checkSameShape(src, dst);

		boolean processed = BOverrideConvolveImageNormalized.invokeNativeVertical(kernel,src,dst);
		
		if( !processed ) {
			if( kernel.width >= src.height ) {
				ConvolveNormalizedNaive_SB.vertical(kernel, src, dst);
			} else {
				ConvolveImageNoBorder.vertical(kernel, src, dst, kernel.computeSum());
				ConvolveNormalized_JustBorder_SB.vertical(kernel, src, dst);
			}
		}
	}
720290
def enforce_vertical_symmetry(pixmap):
    ''''''
    mirror = []
    for item in pixmap:
        y = item[0]
        x = item[1]

        if x <= IMAGE_APEX:
            diff_x = diff(x, IMAGE_APEX)
            mirror.append((y, x + (2 * diff_x) - 1))

        if x > IMAGE_APEX:
            diff_x = diff(x, IMAGE_APEX)
            mirror.append((y, x - (2 * diff_x) - 1))

    return mirror + pixmap
510919
def fixed_crop(src, x0, y0, w, h, size=None, interpolation=cv2.INTER_CUBIC):
    """"""
    out = mx.nd.crop(src, begin=(y0, x0, 0), end=(y0+h, x0+w, int(src.shape[2])))
    if size is not None and (w, h) != size:
        out = resize(out, size, interpolation=interpolation)
    return out
1295226
def apply_texture(self, image):
        """"""
        self.image = image.convert_alpha()
        self.untransformed_image = self.image.copy()
##        self.rect.x = 0
##        self.rect.y = 0
##        self.rect.width = self.image.get_width()
##        self.rect.height = self.image.get_height()
        self.source.x = 0
        self.source.y = 0
        self.source.width = self.image.get_width()
        self.source.height = self.image.get_height()
        center = Vector2(self.source.width / 2.0,
                         self.source.height / 2.0)
        self.set_origin(center)
685406
def on_resize(width, height):
	""""""
	glViewport(0, 0, width, height)
	glMatrixMode(GL_PROJECTION)
	glLoadIdentity()
	gluPerspective(30, 1.0*width/height, 0.1, 1000.0)
	glMatrixMode(GL_MODELVIEW)
	glLoadIdentity()
586280
def libvlc_video_get_adjust_float(p_mi, option):
    '''
    '''
    f = _Cfunctions.get('libvlc_video_get_adjust_float', None) or \
        _Cfunction('libvlc_video_get_adjust_float', ((1,), (1,),), None,
                    ctypes.c_float, MediaPlayer, ctypes.c_uint)
    return f(p_mi, option)
89254
void setPerspShadowMatrix(Matrix4f modelMtx, GVRLight light)
    {
        GVRPerspectiveCamera camera = (GVRPerspectiveCamera) getCamera();

        if (camera == null)
        {
            return;
        }
        float angle = light.getFloat("outer_cone_angle");
        float near = camera.getNearClippingDistance();
        float far = camera.getFarClippingDistance();

        angle = (float) Math.acos(angle) * 2.0f;
        modelMtx.invert();
        modelMtx.get(mTempMtx);
        camera.setViewMatrix(mTempMtx);
        camera.setFovY((float) Math.toDegrees(angle));
        mShadowMatrix.setPerspective(angle, 1.0f, near, far);
        mShadowMatrix.mul(modelMtx);
        sBiasMatrix.mul(mShadowMatrix, mShadowMatrix);
        mShadowMatrix.getColumn(0, mTemp);
        light.setVec4("sm0", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
        mShadowMatrix.getColumn(1, mTemp);
        light.setVec4("sm1", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
        mShadowMatrix.getColumn(2, mTemp);
        light.setVec4("sm2", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
        mShadowMatrix.getColumn(3, mTemp);
        light.setVec4("sm3", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
    }
238286
def wrap(self, video_mode):
        
        size, bits, self.refresh_rate = video_mode
        self.width, self.height = size
        self.red_bits, self.green_bits, self.blue_bits = bits
590083
function setProjection(w, h) {
         this.flush();
         this.gl.viewport(0, 0, w, h);
         this.uMatrix.setTransform(2 / w, 0, 0, 0, -2 / h, 0, -1, 1, 1);
       }
866148
public void flip(TextureFlipMode mode){
		float[][] tmp = corner.clone();
		switch (mode) {
		case VERTICAL:
			corner[0] = tmp[1];
			corner[1] = tmp[0];
			corner[2] = tmp[3];
			corner[3] = tmp[2];
			break;
		case HORIZONTAL:
			corner[0] = tmp[3];
			corner[1] = tmp[2];
			corner[2] = tmp[1];
			corner[3] = tmp[0];
			break;
		default:
			break;
		}
	}
1042364
def libvlc_video_set_crop_geometry(p_mi, psz_geometry):
    '''
    '''
    f = _Cfunctions.get('libvlc_video_set_crop_geometry', None) or \
        _Cfunction('libvlc_video_set_crop_geometry', ((1,), (1,),), None,
                    None, MediaPlayer, ctypes.c_char_p)
    return f(p_mi, psz_geometry)
195855
function TiltShiftAxisFilter()
{
    core.AbstractFilter.call(this,
        // vertex shader
        null,
        // fragment shader
        fs.readFileSync(__dirname + '/tiltShift.frag', 'utf8'),
        // custom uniforms
        {
            blur:           { type: '1f', value: 100 },
            gradientBlur:   { type: '1f', value: 600 },
            start:          { type: 'v2', value: { x: 0,    y: window.innerHeight / 2 } },
            end:            { type: 'v2', value: { x: 600,  y: window.innerHeight / 2 } },
            delta:          { type: 'v2', value: { x: 30,   y: 30 } },
            texSize:        { type: 'v2', value: { x: window.innerWidth, y: window.innerHeight } }
        }
    );

    this.updateDelta();
}
1022350
function (renderer, camera) {
        var viewport = renderer.viewport;
        var dpr = viewport.devicePixelRatio || renderer.getDevicePixelRatio();
        var width = viewport.width * dpr;
        var height = viewport.height * dpr;

        var offset = this._haltonSequence[this._frame % this._haltonSequence.length];

        var translationMat = new Matrix4();
        translationMat.array[12] = (offset[0] * 2.0 - 1.0) / width;
        translationMat.array[13] = (offset[1] * 2.0 - 1.0) / height;

        Matrix4.mul(camera.projectionMatrix, translationMat, camera.projectionMatrix);

        Matrix4.invert(camera.invProjectionMatrix, camera.projectionMatrix);
    }