void CompositionObject::RenderHdmv(SubPicDesc& spd) { if (!m_pRLEData || !HavePalette()) { return; } CGolombBuffer GBuffer(m_pRLEData, m_nRLEDataSize); BYTE bTemp; BYTE bSwitch; BYTE nPaletteIndex = 0; short nCount; short nX = m_horizontal_position; short nY = m_vertical_position; while ((nY < (m_vertical_position + m_height)) && !GBuffer.IsEOF()) { bTemp = GBuffer.ReadByte(); if (bTemp != 0) { nPaletteIndex = bTemp; nCount = 1; } else { bSwitch = GBuffer.ReadByte(); if (!(bSwitch & 0x80)) { if (!(bSwitch & 0x40)) { nCount = bSwitch & 0x3F; if (nCount > 0) { nPaletteIndex = 0; } } else { nCount = (bSwitch & 0x3F) << 8 | (short)GBuffer.ReadByte(); nPaletteIndex = 0; } } else { if (!(bSwitch & 0x40)) { nCount = bSwitch & 0x3F; nPaletteIndex = GBuffer.ReadByte(); } else { nCount = (bSwitch & 0x3F) << 8 | (short)GBuffer.ReadByte(); nPaletteIndex = GBuffer.ReadByte(); } } } if (nCount > 0) { if (nPaletteIndex != 0xFF) { // Fully transparent (§9.14.4.2.2.1.1) FillSolidRect(spd, nX, nY, nCount, 1, m_Colors[nPaletteIndex]); } nX += nCount; } else { nY++; nX = m_horizontal_position; } } }
void GLWidget::initializeGL() { //Set up OpenGL incantations glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnable(GL_TEXTURE_3D); glClearColor(0.8f, 0.8f, 0.8f, 1.0f); //Ab hier, wenn Deferred Shading gbuffer = GBuffer(); gbuffer.Init(TEXTURE_WIDTH,TEXTURE_HEIGHT); //Create the drawing quad static const GLfloat g_quad_vertex_buffer_data[] = { -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, -1.0f, 1.0f, 0.0f, -1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 0.0f, }; glGenBuffers(1, &canvasQuad); glBindBuffer(GL_ARRAY_BUFFER, canvasQuad); glBufferData(GL_ARRAY_BUFFER, sizeof(g_quad_vertex_buffer_data), g_quad_vertex_buffer_data, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); cubeMapLocation = loadCubemap(); float points[] = { -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, -10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, 10.0f, -10.0f, 10.0f, 10.0f, -10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, -10.0f, 10.0f, 10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, 10.0f }; glGenBuffers (1, &skyBox); glBindBuffer (GL_ARRAY_BUFFER, skyBox); glBufferData (GL_ARRAY_BUFFER, 3 * 36 * sizeof (float), &points, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); }
void CompositionObject::RenderHdmv(SubPicDesc& spd) { if(m_pRLEData) { CGolombBuffer GBuffer(m_pRLEData, m_nRLEDataSize); BYTE bTemp; BYTE bSwitch; bool bEndOfLine = false; BYTE nPaletteIndex; SHORT nCount; SHORT nX = 0; SHORT nY = 0; while((nY < m_height) && !GBuffer.IsEOF()) { bTemp = GBuffer.ReadByte(); if(bTemp != 0) { nPaletteIndex = bTemp; nCount = 1; } else { bSwitch = GBuffer.ReadByte(); if(!(bSwitch & 0x80)) { if(!(bSwitch & 0x40)) { nCount = bSwitch & 0x3F; if(nCount > 0) nPaletteIndex = 0; } else { nCount = (bSwitch & 0x3F) << 8 | (SHORT)GBuffer.ReadByte(); nPaletteIndex = 0; } } else { if(!(bSwitch & 0x40)) { nCount = bSwitch & 0x3F; nPaletteIndex = GBuffer.ReadByte(); } else { nCount = (bSwitch & 0x3F) << 8 | (SHORT)GBuffer.ReadByte(); nPaletteIndex = GBuffer.ReadByte(); } } } if(nCount > 0) { if(nPaletteIndex != 0xFF) // Fully transparent (§9.14.4.2.2.1.1) FillSolidRect(spd, nX, nY, nCount, 1, m_Colors[nPaletteIndex]); nX += nCount; } else { nY++; nX = 0; } } } }
inline void SimpleSVDUpper ( DistMatrix<Complex<double> >& A, DistMatrix<double,VR,STAR>& s, DistMatrix<Complex<double> >& V ) { #ifndef RELEASE PushCallStack("svd::SimpleSVDUpper"); #endif typedef double Real; typedef Complex<Real> C; const int m = A.Height(); const int n = A.Width(); const int k = std::min( m, n ); const int offdiagonal = ( m>=n ? 1 : -1 ); const char uplo = ( m>=n ? 'U' : 'L' ); const Grid& g = A.Grid(); // Bidiagonalize A DistMatrix<C,STAR,STAR> tP( g ), tQ( g ); Bidiag( A, tP, tQ ); // Grab copies of the diagonal and sub/super-diagonal of A DistMatrix<Real,MD,STAR> d_MD_STAR( g ), e_MD_STAR( g ); A.GetRealPartOfDiagonal( d_MD_STAR ); A.GetRealPartOfDiagonal( e_MD_STAR, offdiagonal ); // In order to use serial QR kernels, we need the full bidiagonal matrix // on each process DistMatrix<Real,STAR,STAR> d_STAR_STAR( d_MD_STAR ), e_STAR_STAR( e_MD_STAR ); // Initialize U and VAdj to the appropriate identity matrices DistMatrix<C,VC,STAR> U_VC_STAR( g ); DistMatrix<C,VC,STAR> V_VC_STAR( g ); U_VC_STAR.AlignWith( A ); V_VC_STAR.AlignWith( V ); Identity( m, k, U_VC_STAR ); Identity( n, k, V_VC_STAR ); // Compute the SVD of the bidiagonal matrix and accumulate the Givens // rotations into our local portion of U and V // NOTE: This _only_ works in the case where m >= n const int numAccum = 32; const int maxNumIts = 30; const int bAlg = 512; std::vector<C> GBuffer( (k-1)*numAccum ), HBuffer( (k-1)*numAccum ); FLA_Bsvd_v_opz_var1 ( k, U_VC_STAR.LocalHeight(), V_VC_STAR.LocalHeight(), numAccum, maxNumIts, d_STAR_STAR.LocalBuffer(), 1, e_STAR_STAR.LocalBuffer(), 1, &GBuffer[0], 1, k-1, &HBuffer[0], 1, k-1, U_VC_STAR.LocalBuffer(), 1, U_VC_STAR.LocalLDim(), V_VC_STAR.LocalBuffer(), 1, V_VC_STAR.LocalLDim(), bAlg ); // Make a copy of A (for the Householder vectors) and pull the necessary // portions of U and V into a standard matrix dist. DistMatrix<C> B( A ); if( m >= n ) { DistMatrix<C> AT( g ), AB( g ); DistMatrix<C,VC,STAR> UT_VC_STAR( g ), UB_VC_STAR( g ); PartitionDown( A, AT, AB, n ); PartitionDown( U_VC_STAR, UT_VC_STAR, UB_VC_STAR, n ); AT = UT_VC_STAR; MakeZeros( AB ); V = V_VC_STAR; } else { DistMatrix<C> VT( g ), VB( g ); DistMatrix<C,VC,STAR> VT_VC_STAR( g ), VB_VC_STAR( g ); PartitionDown( V, VT, VB, m ); PartitionDown ( V_VC_STAR, VT_VC_STAR, VB_VC_STAR, m ); VT = VT_VC_STAR; MakeZeros( VB ); } // Backtransform U and V if( m >= n ) { ApplyPackedReflectors ( LEFT, LOWER, VERTICAL, BACKWARD, UNCONJUGATED, 0, B, tQ, A ); ApplyPackedReflectors ( LEFT, UPPER, HORIZONTAL, BACKWARD, UNCONJUGATED, 1, B, tP, V ); } else { ApplyPackedReflectors ( LEFT, LOWER, VERTICAL, BACKWARD, UNCONJUGATED, -1, B, tQ, A ); ApplyPackedReflectors ( LEFT, UPPER, HORIZONTAL, BACKWARD, UNCONJUGATED, 0, B, tP, V ); } // Copy out the appropriate subset of the singular values s = d_STAR_STAR; #ifndef RELEASE PopCallStack(); #endif }