本文整理汇总了C++中Copy函数的典型用法代码示例。如果您正苦于以下问题:C++ Copy函数的具体用法?C++ Copy怎么用?C++ Copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Copy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Copy
void
Canvas::Copy(const Bitmap &src)
{
Copy(0, 0, src.GetWidth(), src.GetHeight(), src, 0, 0);
}
示例2: Coder_ld8a
void Coder_ld8a(
g729a_encoder_state *state,
Word16 ana[] /* output : Analysis parameters */
)
{
/* LPC analysis */
Word16 Aq_t[(MP1)*2]; /* A(z) quantized for the 2 subframes */
Word16 Ap_t[(MP1)*2]; /* A(z/gamma) for the 2 subframes */
Word16 *Aq, *Ap; /* Pointer on Aq_t and Ap_t */
/* Other vectors */
Word16 h1[L_SUBFR]; /* Impulse response h1[] */
Word16 xn[L_SUBFR]; /* Target vector for pitch search */
Word16 xn2[L_SUBFR]; /* Target vector for codebook search */
Word16 code[L_SUBFR]; /* Fixed codebook excitation */
Word16 y1[L_SUBFR]; /* Filtered adaptive excitation */
Word16 y2[L_SUBFR]; /* Filtered fixed codebook excitation */
Word16 g_coeff[4]; /* Correlations between xn & y1 */
Word16 g_coeff_cs[5];
Word16 exp_g_coeff_cs[5]; /* Correlations between xn, y1, & y2
<y1,y1>, -2<xn,y1>,
<y2,y2>, -2<xn,y2>, 2<y1,y2> */
/* Scalars */
Word16 i, j, k, i_subfr;
Word16 T_op, T0, T0_min, T0_max, T0_frac;
Word16 gain_pit, gain_code, index;
Word16 temp, taming;
Word32 L_temp;
/*------------------------------------------------------------------------*
* - Perform LPC analysis: *
* * autocorrelation + lag windowing *
* * Levinson-durbin algorithm to find a[] *
* * convert a[] to lsp[] *
* * quantize and code the LSPs *
* * find the interpolated LSPs and convert to a[] for the 2 *
* subframes (both quantized and unquantized) *
*------------------------------------------------------------------------*/
{
/* Temporary vectors */
Word16 r_l[MP1], r_h[MP1]; /* Autocorrelations low and hi */
Word16 rc[M]; /* Reflection coefficients. */
Word16 lsp_new[M], lsp_new_q[M]; /* LSPs at 2th subframe */
/* LP analysis */
Autocorr(state->p_window, M, r_h, r_l); /* Autocorrelations */
Lag_window(M, r_h, r_l); /* Lag windowing */
Levinson(r_h, r_l, Ap_t, rc); /* Levinson Durbin */
Az_lsp(Ap_t, lsp_new, state->lsp_old); /* From A(z) to lsp */
/* LSP quantization */
Qua_lsp(state, lsp_new, lsp_new_q, ana);
ana += 2; /* Advance analysis parameters pointer */
/*--------------------------------------------------------------------*
* Find interpolated LPC parameters in all subframes *
* The interpolated parameters are in array Aq_t[]. *
*--------------------------------------------------------------------*/
Int_qlpc(state->lsp_old_q, lsp_new_q, Aq_t);
/* Compute A(z/gamma) */
Weight_Az(&Aq_t[0], GAMMA1, M, &Ap_t[0]);
Weight_Az(&Aq_t[MP1], GAMMA1, M, &Ap_t[MP1]);
/* update the LSPs for the next frame */
Copy(lsp_new, state->lsp_old, M);
Copy(lsp_new_q, state->lsp_old_q, M);
}
/*----------------------------------------------------------------------*
* - Find the weighted input speech w_sp[] for the whole speech frame *
* - Find the open-loop pitch delay *
*----------------------------------------------------------------------*/
Residu(&Aq_t[0], &(state->speech[0]), &(state->exc[0]), L_SUBFR);
Residu(&Aq_t[MP1], &(state->speech[L_SUBFR]), &(state->exc[L_SUBFR]), L_SUBFR);
{
Word16 Ap1[MP1];
Ap = Ap_t;
Ap1[0] = 4096;
for(i=1; i<=M; i++) /* Ap1[i] = Ap[i] - 0.7 * Ap[i-1]; */
Ap1[i] = sub(Ap[i], mult(Ap[i-1], 22938));
Syn_filt(Ap1, &(state->exc[0]), &(state->wsp[0]), L_SUBFR, state->mem_w, 1);
Ap += MP1;
for(i=1; i<=M; i++) /* Ap1[i] = Ap[i] - 0.7 * Ap[i-1]; */
Ap1[i] = sub(Ap[i], mult(Ap[i-1], 22938));
//.........这里部分代码省略.........
示例3: Rename
void P12218319_CALL Rename(const std::string& aOldPath, const std::string& aNewPath) {
Copy(aOldPath, aNewPath);
DeleteFile(aOldPath);
}
示例4: Copy
RefPtr<Type> Type::MakeSharedConst()
{
RefPtr<Type> type = Copy();
type->Mod = (MOD) (MODconst | MODshared);
return type;
}
示例5: memset
void CLightmapManager::CreateSpecial (tRgbColorb *texColorP, ushort nLightmap, ubyte nColor)
{
memset (texColorP, nColor, LM_W * LM_H * sizeof (tRgbColorb));
Copy (texColorP, nLightmap);
}
示例6: Rule13Alloc
static void Rule13Alloc(This *t)
{
static creal w[][nrules] = {
{ .00844923090033615, .3213775489050763, .3372900883288987,
-.8264123822525677, .6539094339575232 },
{ .023771474018994404, -.1767341636743844, -.1644903060344491,
.306583861409436, -.2041614154424632},
{ .02940016170142405, .07347600537466073, .07707849911634623,
.002389292538329435, -.174698151579499 },
{ .006644436465817374, -.03638022004364754, -.03804478358506311,
-.1343024157997222, .03937939671417803 },
{ .0042536044255016, .021252979220987123, .02223559940380806,
.08833366840533902, .006974520545933992 },
{ 0, .1460984204026913, .1480693879765931,
0, 0 },
{ .0040664827465935255, .017476132861520992, 4.467143702185815e-6,
.0009786283074168292, .0066677021717782585 },
{ .03362231646315497, .1444954045641582, .150894476707413,
-.1319227889147519, .05512960621544304 },
{ .033200804136503725, .0001307687976001325, 3.6472001075162155e-5,
.00799001220015063, .05443846381278608 },
{ .014093686924979677, .0005380992313941161, .000577719899901388,
.0033917470797606257, .02310903863953934 },
{ .000977069770327625, .0001042259576889814, .0001041757313688177,
.0022949157182832643, .01506937747477189 },
{ .007531996943580376, -.001401152865045733, -.001452822267047819,
-.01358584986119197, -.060570216489018905 },
{ .02577183086722915, .008041788181514763, .008338339968783704,
.04025866859057809, .04225737654686337},
{ .015625, -.1420416552759383, -.147279632923196,
.003760268580063992, .02561989142123099 }
};
static creal g[] = {
.12585646717265545, .3506966822267133,
.4795480315809981, .4978005239276064,
.25, .07972723291487795,
.1904495567970094, .3291384627633596,
.43807365825146577, .499121592026599,
.4895111329084231, .32461421628226944,
.43637106005656195, .1791307322940614,
.2833333333333333, .1038888888888889 };
enum { nsets = 14, ndim = 2 };
count n, r;
Set *first, *last, *s, *x;
csize_t setsize = SetSize;
Die(first = calloc(nsets, setsize));
last = first;
n = last->n = 1;
Copy(last->weight, w[0], nrules);
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[1], nrules);
last->gen[0] = g[0];
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[2], nrules);
last->gen[0] = g[1];
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[3], nrules);
last->gen[0] = g[2];
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[4], nrules);
last->gen[0] = g[3];
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[5], nrules);
last->gen[0] = g[4];
NextSet(last);
n += last->n = 2*ndim*(ndim - 1);
Copy(last->weight, w[6], nrules);
last->gen[0] = g[5];
last->gen[1] = g[5];
NextSet(last);
n += last->n = 2*ndim*(ndim - 1);
Copy(last->weight, w[7], nrules);
last->gen[0] = g[6];
last->gen[1] = g[6];
NextSet(last);
n += last->n = 2*ndim*(ndim - 1);
Copy(last->weight, w[8], nrules);
last->gen[0] = g[7];
last->gen[1] = g[7];
NextSet(last);
n += last->n = 2*ndim*(ndim - 1);
//.........这里部分代码省略.........
示例7: Rule11Alloc
static void Rule11Alloc(This *t)
{
static creal w[][nrules] = {
{ .0009903847688882167, 1.715006248224684, 1.936014978949526,
.517082819560576, 2.05440450381852 },
{ .0084964717409851, -.3755893815889209, -.3673449403754268,
.01445269144914044, .013777599884901202 },
{ .00013587331735072814, .1488632145140549, .02929778657898176,
-.3601489663995932, -.576806291790441 },
{ .022982920777660364, -.2497046640620823, -.1151883520260315,
.3628307003418485, .03726835047700328 },
{ .004202649722286289, .1792501419135204, .05086658220872218,
.007148802650872729, .0068148789397772195 },
{ .0012671889041675774, .0034461267589738897, .04453911087786469,
-.09222852896022966, .057231697338518496 },
{ .0002109560854981544, -.005140483185555825, -.022878282571259,
.01719339732471725, -.044930187438112855 },
{ .016830857056410086, .006536017839876424, .02908926216345833,
-.102141653746035, .027292365738663484 },
{ .00021876823557504823, -.00065134549392297, -.002898884350669207,
-.007504397861080493, .000354747395055699 },
{ .009690420479796819, -.006304672433547204, -.028059634133074954,
.01648362537726711, .01571366799739551 },
{ .030773311284628138, .01266959399788263, .05638741361145884,
.05234610158469334, .049900992192785674 },
{ .0084974310856038, -.005454241018647931, -.02427469611942451,
.014454323316130661, .0137791555266677 },
{ .0017749535291258914, .004826995274768427, .021483070341828822,
.003019236275367777, .0028782064230998723 }
};
static creal g[] = {
.095, .25,
.375, .4,
.4975, .49936724991757,
.38968518428362114, .49998494965443835,
.3951318612385894, .22016983438253684,
.4774686911397297, .2189239229503431,
.4830546566815374, .2288552938881567 };
enum { nsets = 13, ndim = 3 };
count n, r;
Set *first, *last, *s, *x;
csize_t setsize = SetSize;
Die(first = calloc(nsets, setsize));
last = first;
n = last->n = 1;
Copy(last->weight, w[0], nrules);
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[1], nrules);
last->gen[0] = g[0];
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[2], nrules);
last->gen[0] = g[1];
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[3], nrules);
last->gen[0] = g[2];
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[4], nrules);
last->gen[0] = g[3];
NextSet(last);
n += last->n = 2*ndim;
Copy(last->weight, w[5], nrules);
last->gen[0] = g[4];
NextSet(last);
n += last->n = 2*ndim*(ndim - 1);
Copy(last->weight, w[6], nrules);
last->gen[0] = g[5];
last->gen[1] = g[5];
NextSet(last);
n += last->n = 2*ndim*(ndim - 1);
Copy(last->weight, w[7], nrules);
last->gen[0] = g[6];
last->gen[1] = g[6];
NextSet(last);
n += last->n = 4*ndim*(ndim - 1)*(ndim - 2)/3;
Copy(last->weight, w[8], nrules);
last->gen[0] = g[7];
last->gen[1] = g[7];
last->gen[2] = g[7];
NextSet(last);
n += last->n = 4*ndim*(ndim - 1)*(ndim - 2)/3;
Copy(last->weight, w[9], nrules);
last->gen[0] = g[8];
//.........这里部分代码省略.........
示例8: WXUNUSED
void wxTextCtrl::OnCopy( wxCommandEvent& WXUNUSED(rEvent) )
{
Copy();
} // end of wxTextCtrl::OnCopy
示例9: CmdKeyExecute
void IWnd_stc::OnKeyEvent(wxKeyEvent& evt)
{
int kc = evt.GetRawKeyCode();
if(kc==wxSTC_KEY_TAB)
{
if(evt.ShiftDown())
{
CmdKeyExecute (wxSTC_CMD_BACKTAB);
}
else
{
CmdKeyExecute (wxSTC_CMD_TAB);
}
return;
}
if(evt.ControlDown())
{
switch(kc)
{
case 'C':
{
Copy();
}
return;
case 'X':
{
Cut();
}
return;
case 'V':
{
Paste();
}
return;
case 'A':
{
SelectAll();
}
return;
case 'Z':
{
Undo();
}
return;
case 'R':
{
Redo();
}
return;
case 'D':
{
this->Clear();
}
return;
//case 'F':
// if(style.get(STYLE_CAN_FIND))
// {
// WndManager::current().evtmgr["Find"].CmdExecuteEx(-1);
// evt.Skip();
// return;
// }
// break;
//case 'H':
// if(style.get(STYLE_CAN_REPLACE))
// {
// WndManager::current().evtmgr["Replace"].CmdExecuteEx(-1);
// evt.Skip();
// return;
// }
// break;
};
}
evt.Skip();
}
示例10: Copy
//------------------------------------------------------------------------------
//! Summary: Overloaded assignment operator
//!
//! Parameters: \li rSource - the object being assigned
//!
//! Returns: this object
//------------------------------------------------------------------------------
const CMLStartFederationResponse& CMLStartFederationResponse::operator = (const CMLStartFederationResponse& rSource)
{
Copy(rSource);
return *this;
}
示例11: if
/*
=============
idWinding2D::Split
=============
*/
int idWinding2D::Split( const idVec3 &plane, const float epsilon, idWinding2D **front, idWinding2D **back ) const {
float dists[MAX_POINTS_ON_WINDING_2D];
byte sides[MAX_POINTS_ON_WINDING_2D];
int counts[3];
float dot;
int i, j;
const idVec2 * p1, *p2;
idVec2 mid;
idWinding2D * f;
idWinding2D * b;
int maxpts;
counts[0] = counts[1] = counts[2] = 0;
// determine sides for each point
for ( i = 0; i < numPoints; i++ ) {
dists[i] = dot = plane.x * p[i].x + plane.y * p[i].y + plane.z;
if ( dot > epsilon ) {
sides[i] = SIDE_FRONT;
} else if ( dot < -epsilon ) {
sides[i] = SIDE_BACK;
} else {
sides[i] = SIDE_ON;
}
counts[sides[i]]++;
}
sides[i] = sides[0];
dists[i] = dists[0];
*front = *back = NULL;
// if nothing at the front of the clipping plane
if ( !counts[SIDE_FRONT] ) {
*back = Copy();
return SIDE_BACK;
}
// if nothing at the back of the clipping plane
if ( !counts[SIDE_BACK] ) {
*front = Copy();
return SIDE_FRONT;
}
maxpts = numPoints+4; // cant use counts[0]+2 because of fp grouping errors
*front = f = new idWinding2D;
*back = b = new idWinding2D;
for ( i = 0; i < numPoints; i++ ) {
p1 = &p[i];
if ( sides[i] == SIDE_ON ) {
f->p[f->numPoints] = *p1;
f->numPoints++;
b->p[b->numPoints] = *p1;
b->numPoints++;
continue;
}
if ( sides[i] == SIDE_FRONT ) {
f->p[f->numPoints] = *p1;
f->numPoints++;
}
if ( sides[i] == SIDE_BACK ) {
b->p[b->numPoints] = *p1;
b->numPoints++;
}
if ( sides[i+1] == SIDE_ON || sides[i+1] == sides[i] ) {
continue;
}
// generate a split point
p2 = &p[(i+1)%numPoints];
// always calculate the split going from the same side
// or minor epsilon issues can happen
if ( sides[i] == SIDE_FRONT ) {
dot = dists[i] / ( dists[i] - dists[i+1] );
for ( j = 0; j < 2; j++ ) {
// avoid round off error when possible
if ( plane[j] == 1.0f ) {
mid[j] = plane.z;
} else if ( plane[j] == -1.0f ) {
mid[j] = -plane.z;
} else {
mid[j] = (*p1)[j] + dot * ((*p2)[j] - (*p1)[j]);
}
}
} else {
dot = dists[i+1] / ( dists[i+1] - dists[i] );
for ( j = 0; j < 2; j++ ) {
// avoid round off error when possible
if ( plane[j] == 1.0f ) {
mid[j] = plane.z;
//.........这里部分代码省略.........
示例12: Initialize
cDMatrix::cDMatrix(const cDMatrix& theMatrix)
{
Initialize(theMatrix.mvNRow, theMatrix.mvNCol) ;
Copy(theMatrix.mvV) ;
}
示例13: Copy
// operators
void wxTextAttr::operator= (const wxTextAttr& attr)
{
Copy(attr);
}
示例14: AddLocalBridge
// Add a local-bridge
void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast)
{
UINT i;
HUB *h = NULL;
LOCALBRIDGE *br = NULL;
// Validate arguments
if (c == NULL || hubname == NULL || devicename == NULL)
{
return;
}
if (OS_IS_UNIX(GetOsInfo()->OsType) == false)
{
tapmode = false;
}
LockList(c->HubList);
{
LockList(c->LocalBridgeList);
{
bool exists = false;
// Ensure that the same configuration local-bridge doesn't exist already
for (i = 0; i < LIST_NUM(c->LocalBridgeList); i++)
{
LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
if (StrCmpi(br->DeviceName, devicename) == 0)
{
if (StrCmpi(br->HubName, hubname) == 0)
{
if (br->TapMode == tapmode)
{
exists = true;
}
}
}
}
if (exists == false)
{
// Add configuration
br = ZeroMalloc(sizeof(LOCALBRIDGE));
StrCpy(br->HubName, sizeof(br->HubName), hubname);
StrCpy(br->DeviceName, sizeof(br->DeviceName), devicename);
br->Bridge = NULL;
br->Local = local;
br->TapMode = tapmode;
br->LimitBroadcast = limit_broadcast;
br->Monitor = monitor;
if (br->TapMode)
{
if (tapaddr != NULL && IsZero(tapaddr, 6) == false)
{
Copy(br->TapMacAddress, tapaddr, 6);
}
else
{
GenMacAddress(br->TapMacAddress);
}
}
Add(c->LocalBridgeList, br);
// Find the hub
for (i = 0; i < LIST_NUM(c->HubList); i++)
{
HUB *hub = LIST_DATA(c->HubList, i);
if (StrCmpi(hub->Name, br->HubName) == 0)
{
h = hub;
AddRef(h->ref);
break;
}
}
}
}
UnlockList(c->LocalBridgeList);
}
UnlockList(c->HubList);
// Start the local-bridge immediately
if (h != NULL && br != NULL && h->Type != HUB_TYPE_FARM_DYNAMIC)
{
Lock(h->lock_online);
{
if (h->Offline == false)
{
LockList(c->LocalBridgeList);
{
if (IsInList(c->LocalBridgeList, br))
{
if (br->Bridge == NULL)
{
br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, br->TapMode, br->TapMacAddress, br->LimitBroadcast, br);
}
}
}
UnlockList(c->LocalBridgeList);
}
//.........这里部分代码省略.........
示例15: float
void CLightmapManager::BuildAll (int nFace)
{
CSide* sideP;
int nLastFace;
int i;
float h;
int nBlackLightmaps = 0, nWhiteLightmaps = 0;
gameStates.render.nState = 0;
h = 1.0f / float (LM_W - 1);
for (i = 0; i < LM_W; i++)
m_data.nOffset [i] = F2X (i * h);
InitVertColorData (m_data.vcd);
m_data.vcd.vertPosP = &m_data.vcd.vertPos;
m_data.vcd.fMatShininess = 4;
#if 0
if (gameStates.app.bMultiThreaded)
nLastFace = nFace ? gameData.segs.nFaces : gameData.segs.nFaces / 2;
else
#endif
INIT_PROGRESS_LOOP (nFace, nLastFace, gameData.segs.nFaces);
if (nFace <= 0) {
CreateSpecial (m_data.texColor, 0, 0);
CreateSpecial (m_data.texColor, 1, 255);
m_list.nLightmaps = 2;
}
//Next Go through each surface and create a lightmap for it.
for (m_data.faceP = FACES.faces + nFace; nFace < nLastFace; nFace++, m_data.faceP++) {
#if DBG
if ((m_data.faceP->nSegment == nDbgSeg) && ((nDbgSide < 0) || (m_data.faceP->nSide == nDbgSide)))
nDbgSeg = nDbgSeg;
#endif
if (SEGMENTS [m_data.faceP->nSegment].m_nType == SEGMENT_IS_SKYBOX)
continue;
sideP = SEGMENTS [m_data.faceP->nSegment].m_sides + m_data.faceP->nSide;
memcpy (m_data.sideVerts, m_data.faceP->index, sizeof (m_data.sideVerts));
m_data.nType = (sideP->m_nType == SIDE_IS_QUAD) || (sideP->m_nType == SIDE_IS_TRI_02);
m_data.vNormal = CFixVector::Avg (sideP->m_normals [0], sideP->m_normals [1]);
CFixVector::Normalize (m_data.vNormal);
m_data.vcd.vertNorm.Assign (m_data.vNormal);
CFloatVector3::Normalize (m_data.vcd.vertNorm);
m_data.nColor = 0;
memset (m_data.texColor, 0, LM_W * LM_H * sizeof (tRgbColorb));
if (!RunRenderThreads (rtLightmap))
Build (-1);
#if DBG
if ((m_data.faceP->nSegment == nDbgSeg) && ((nDbgSide < 0) || (m_data.faceP->nSide == nDbgSide)))
nDbgSeg = nDbgSeg;
#endif
if (m_data.nColor == 1) {
m_data.faceP->nLightmap = 0;
nBlackLightmaps++;
}
else if (m_data.nColor == 2) {
m_data.faceP->nLightmap = 1;
nWhiteLightmaps++;
}
else {
Copy (m_data.texColor, m_list.nLightmaps);
m_data.faceP->nLightmap = m_list.nLightmaps++;
}
}
}